Fill in mParent for each node in Assbin Loader
This commit is contained in:
@@ -196,7 +196,7 @@ template <typename T> void ReadBounds( IOStream * stream, T* /*p*/, unsigned int
|
||||
stream->Seek( sizeof(T) * n, aiOrigin_CUR );
|
||||
}
|
||||
|
||||
void AssbinImporter::ReadBinaryNode( IOStream * stream, aiNode** node )
|
||||
void AssbinImporter::ReadBinaryNode( IOStream * stream, aiNode** node, aiNode* parent )
|
||||
{
|
||||
uint32_t chunkID = Read<uint32_t>(stream);
|
||||
ai_assert(chunkID == ASSBIN_CHUNK_AINODE);
|
||||
@@ -208,6 +208,10 @@ void AssbinImporter::ReadBinaryNode( IOStream * stream, aiNode** node )
|
||||
(*node)->mTransformation = Read<aiMatrix4x4>(stream);
|
||||
(*node)->mNumChildren = Read<unsigned int>(stream);
|
||||
(*node)->mNumMeshes = Read<unsigned int>(stream);
|
||||
if(parent)
|
||||
{
|
||||
(*node)->mParent = parent;
|
||||
}
|
||||
|
||||
if ((*node)->mNumMeshes)
|
||||
{
|
||||
@@ -221,7 +225,7 @@ void AssbinImporter::ReadBinaryNode( IOStream * stream, aiNode** node )
|
||||
{
|
||||
(*node)->mChildren = new aiNode*[(*node)->mNumChildren];
|
||||
for (unsigned int i = 0; i < (*node)->mNumChildren; ++i) {
|
||||
ReadBinaryNode( stream, &(*node)->mChildren[i] );
|
||||
ReadBinaryNode( stream, &(*node)->mChildren[i], *node );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -569,7 +573,7 @@ void AssbinImporter::ReadBinaryScene( IOStream * stream, aiScene* scene )
|
||||
|
||||
// Read node graph
|
||||
scene->mRootNode = new aiNode[1];
|
||||
ReadBinaryNode( stream, &scene->mRootNode );
|
||||
ReadBinaryNode( stream, &scene->mRootNode, (aiNode*)NULL );
|
||||
|
||||
// Read all meshes
|
||||
if (scene->mNumMeshes)
|
||||
|
||||
Reference in New Issue
Block a user