From 7d630e98da89bc9ad41bbbda28e820ef6189b58d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=92=D0=BB=D0=B0=D1=81=D0=BE=D0=B2=20=D0=95=D0=B2=D0=B3?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B9?= Date: Mon, 23 Jul 2018 16:44:20 +0300 Subject: [PATCH] STLImporter::LoadBinaryFile add one child node to produce same scene structure as in STLImporter::LoadASCIIFile --- code/STLLoader.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/code/STLLoader.cpp b/code/STLLoader.cpp index 5abccc774..71cbbc72b 100644 --- a/code/STLLoader.cpp +++ b/code/STLLoader.cpp @@ -535,11 +535,21 @@ bool STLImporter::LoadBinaryFile() // now copy faces addFacesToMesh(pMesh); + aiNode* root = pScene->mRootNode; + + // allocate one node + aiNode* node = new aiNode(); + node->mParent = root; + + root->mNumChildren = 1u; + root->mChildren = new aiNode*[root->mNumChildren]; + root->mChildren[0] = node; + // add all created meshes to the single node - pScene->mRootNode->mNumMeshes = pScene->mNumMeshes; - pScene->mRootNode->mMeshes = new unsigned int[pScene->mNumMeshes]; + node->mNumMeshes = pScene->mNumMeshes; + node->mMeshes = new unsigned int[pScene->mNumMeshes]; for (unsigned int i = 0; i < pScene->mNumMeshes; i++) - pScene->mRootNode->mMeshes[i] = i; + node->mMeshes[i] = i; if (bIsMaterialise && !pMesh->mColors[0]) {