- blend: compute parent inverses on your own instead of trusting the blend input. Thanks to Kalmár Dániel for the patch.
git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@1291 67173fc5-114c-0410-ac8e-9d2fd5bffc1fpull/8/head
parent
3f47ac3fe2
commit
d8c2295962
|
@ -360,7 +360,7 @@ void BlenderImporter::ConvertBlendFile(aiScene* out, const Scene& in,const FileD
|
||||||
root->mNumChildren = static_cast<unsigned int>(no_parents.size());
|
root->mNumChildren = static_cast<unsigned int>(no_parents.size());
|
||||||
root->mChildren = new aiNode*[root->mNumChildren]();
|
root->mChildren = new aiNode*[root->mNumChildren]();
|
||||||
for (unsigned int i = 0; i < root->mNumChildren; ++i) {
|
for (unsigned int i = 0; i < root->mNumChildren; ++i) {
|
||||||
root->mChildren[i] = ConvertNode(in, no_parents[i], conv);
|
root->mChildren[i] = ConvertNode(in, no_parents[i], conv, aiMatrix4x4());
|
||||||
root->mChildren[i]->mParent = root;
|
root->mChildren[i]->mParent = root;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -882,7 +882,7 @@ aiLight* BlenderImporter::ConvertLight(const Scene& /*in*/, const Object* /*obj*
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
aiNode* BlenderImporter::ConvertNode(const Scene& in, const Object* obj, ConversionData& conv_data)
|
aiNode* BlenderImporter::ConvertNode(const Scene& in, const Object* obj, ConversionData& conv_data, const aiMatrix4x4& parentTransform)
|
||||||
{
|
{
|
||||||
std::deque<const Object*> children;
|
std::deque<const Object*> children;
|
||||||
for(std::set<const Object*>::iterator it = conv_data.objects.begin(); it != conv_data.objects.end() ;) {
|
for(std::set<const Object*>::iterator it = conv_data.objects.begin(); it != conv_data.objects.end() ;) {
|
||||||
|
@ -966,16 +966,12 @@ aiNode* BlenderImporter::ConvertNode(const Scene& in, const Object* obj, Convers
|
||||||
|
|
||||||
for(unsigned int x = 0; x < 4; ++x) {
|
for(unsigned int x = 0; x < 4; ++x) {
|
||||||
for(unsigned int y = 0; y < 4; ++y) {
|
for(unsigned int y = 0; y < 4; ++y) {
|
||||||
node->mTransformation[y][x] = obj->parentinv[x][y];
|
node->mTransformation[y][x] = obj->obmat[x][y];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
aiMatrix4x4 m;
|
aiMatrix4x4 m = parentTransform;
|
||||||
for(unsigned int x = 0; x < 4; ++x) {
|
m = m.Inverse();
|
||||||
for(unsigned int y = 0; y < 4; ++y) {
|
|
||||||
m[y][x] = obj->obmat[x][y];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
node->mTransformation = m*node->mTransformation;
|
node->mTransformation = m*node->mTransformation;
|
||||||
|
|
||||||
|
@ -983,7 +979,7 @@ aiNode* BlenderImporter::ConvertNode(const Scene& in, const Object* obj, Convers
|
||||||
node->mNumChildren = static_cast<unsigned int>(children.size());
|
node->mNumChildren = static_cast<unsigned int>(children.size());
|
||||||
aiNode** nd = node->mChildren = new aiNode*[node->mNumChildren]();
|
aiNode** nd = node->mChildren = new aiNode*[node->mNumChildren]();
|
||||||
for_each (const Object* nobj,children) {
|
for_each (const Object* nobj,children) {
|
||||||
*nd = ConvertNode(in,nobj,conv_data);
|
*nd = ConvertNode(in,nobj,conv_data,node->mTransformation * parentTransform);
|
||||||
(*nd++)->mParent = node;
|
(*nd++)->mParent = node;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -145,7 +145,8 @@ private:
|
||||||
// --------------------
|
// --------------------
|
||||||
aiNode* ConvertNode(const Blender::Scene& in,
|
aiNode* ConvertNode(const Blender::Scene& in,
|
||||||
const Blender::Object* obj,
|
const Blender::Object* obj,
|
||||||
Blender::ConversionData& conv_info
|
Blender::ConversionData& conv_info,
|
||||||
|
const aiMatrix4x4& parentTransform
|
||||||
);
|
);
|
||||||
|
|
||||||
// --------------------
|
// --------------------
|
||||||
|
|
Loading…
Reference in New Issue