Q3DLoader.cpp 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591
  1. /*
  2. ---------------------------------------------------------------------------
  3. Open Asset Import Library (assimp)
  4. ---------------------------------------------------------------------------
  5. Copyright (c) 2006-2025, assimp team
  6. All rights reserved.
  7. Redistribution and use of this software in source and binary forms,
  8. with or without modification, are permitted provided that the following
  9. conditions are met:
  10. * Redistributions of source code must retain the above
  11. copyright notice, this list of conditions and the
  12. following disclaimer.
  13. * Redistributions in binary form must reproduce the above
  14. copyright notice, this list of conditions and the
  15. following disclaimer in the documentation and/or other
  16. materials provided with the distribution.
  17. * Neither the name of the assimp team, nor the names of its
  18. contributors may be used to endorse or promote products
  19. derived from this software without specific prior
  20. written permission of the assimp team.
  21. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  22. "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  23. LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  24. A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  25. OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  26. SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  27. LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  28. DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  29. THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  30. (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  31. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  32. ---------------------------------------------------------------------------
  33. */
  34. /** @file Q3DLoader.cpp
  35. * @brief Implementation of the Q3D importer class
  36. */
  37. #ifndef ASSIMP_BUILD_NO_Q3D_IMPORTER
  38. // internal headers
  39. #include "Q3DLoader.h"
  40. #include <assimp/StringUtils.h>
  41. #include <assimp/StreamReader.h>
  42. #include <assimp/fast_atof.h>
  43. #include <assimp/importerdesc.h>
  44. #include <assimp/scene.h>
  45. #include <assimp/DefaultLogger.hpp>
  46. #include <assimp/IOSystem.hpp>
  47. #include <limits>
  48. namespace Assimp {
  49. static constexpr aiImporterDesc desc = {
  50. "Quick3D Importer",
  51. "",
  52. "",
  53. "http://www.quick3d.com/",
  54. aiImporterFlags_SupportBinaryFlavour,
  55. 0,
  56. 0,
  57. 0,
  58. 0,
  59. "q3o q3s"
  60. };
  61. // ------------------------------------------------------------------------------------------------
  62. // Constructor to be privately used by Importer
  63. Q3DImporter::Q3DImporter() = default;
  64. // ------------------------------------------------------------------------------------------------
  65. // Destructor, private as well
  66. Q3DImporter::~Q3DImporter() = default;
  67. // ------------------------------------------------------------------------------------------------
  68. // Returns whether the class can handle the format of the given file.
  69. bool Q3DImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool /*checkSig*/) const {
  70. static const char *tokens[] = { "quick3Do", "quick3Ds" };
  71. return SearchFileHeaderForToken(pIOHandler, pFile, tokens, AI_COUNT_OF(tokens));
  72. }
  73. // ------------------------------------------------------------------------------------------------
  74. const aiImporterDesc *Q3DImporter::GetInfo() const {
  75. return &desc;
  76. }
  77. // ------------------------------------------------------------------------------------------------
  78. // Imports the given file into the given scene structure.
  79. void Q3DImporter::InternReadFile(const std::string &pFile,
  80. aiScene *pScene, IOSystem *pIOHandler) {
  81. auto file = pIOHandler->Open(pFile, "rb");
  82. if (!file)
  83. throw DeadlyImportError("Quick3D: Could not open ", pFile);
  84. StreamReaderLE stream(file);
  85. // The header is 22 bytes large
  86. if (stream.GetRemainingSize() < 22)
  87. throw DeadlyImportError("File is either empty or corrupt: ", pFile);
  88. // Check the file's signature
  89. if (ASSIMP_strincmp((const char *)stream.GetPtr(), "quick3Do", 8) &&
  90. ASSIMP_strincmp((const char *)stream.GetPtr(), "quick3Ds", 8)) {
  91. throw DeadlyImportError("Not a Quick3D file. Signature string is: ", ai_str_toprintable((const char *)stream.GetPtr(), 8));
  92. }
  93. // Print the file format version
  94. ASSIMP_LOG_INFO("Quick3D File format version: ",
  95. std::string(&((const char *)stream.GetPtr())[8], 2));
  96. // ... an store it
  97. char major = ((const char *)stream.GetPtr())[8];
  98. char minor = ((const char *)stream.GetPtr())[9];
  99. stream.IncPtr(10);
  100. unsigned int numMeshes = (unsigned int)stream.GetI4();
  101. unsigned int numMats = (unsigned int)stream.GetI4();
  102. unsigned int numTextures = (unsigned int)stream.GetI4();
  103. std::vector<Material> materials;
  104. try {
  105. materials.reserve(numMats);
  106. } catch (const std::bad_alloc &) {
  107. ASSIMP_LOG_ERROR("Invalid alloc for materials.");
  108. throw DeadlyImportError("Invalid Quick3D-file, material allocation failed.");
  109. }
  110. std::vector<Mesh> meshes;
  111. try {
  112. meshes.reserve(numMeshes);
  113. } catch (const std::bad_alloc &) {
  114. ASSIMP_LOG_ERROR("Invalid alloc for meshes.");
  115. throw DeadlyImportError("Invalid Quick3D-file, mesh allocation failed.");
  116. }
  117. // Allocate the scene root node
  118. pScene->mRootNode = new aiNode();
  119. aiColor3D fgColor(0.6f, 0.6f, 0.6f);
  120. // Now read all file chunks
  121. while (true) {
  122. if (stream.GetRemainingSize() < 1) break;
  123. char c = stream.GetI1();
  124. switch (c) {
  125. // Meshes chunk
  126. case 'm': {
  127. for (unsigned int quak = 0; quak < numMeshes; ++quak) {
  128. meshes.emplace_back();
  129. Mesh &mesh = meshes.back();
  130. // read all vertices
  131. unsigned int numVerts = (unsigned int)stream.GetI4();
  132. if (!numVerts)
  133. throw DeadlyImportError("Quick3D: Found mesh with zero vertices");
  134. std::vector<aiVector3D> &verts = mesh.verts;
  135. verts.resize(numVerts);
  136. for (unsigned int i = 0; i < numVerts; ++i) {
  137. verts[i].x = stream.GetF4();
  138. verts[i].y = stream.GetF4();
  139. verts[i].z = stream.GetF4();
  140. }
  141. // read all faces
  142. numVerts = (unsigned int)stream.GetI4();
  143. if (!numVerts)
  144. throw DeadlyImportError("Quick3D: Found mesh with zero faces");
  145. std::vector<Face> &faces = mesh.faces;
  146. faces.reserve(numVerts);
  147. // number of indices
  148. for (unsigned int i = 0; i < numVerts; ++i) {
  149. faces.emplace_back(stream.GetI2());
  150. if (faces.back().indices.empty())
  151. throw DeadlyImportError("Quick3D: Found face with zero indices");
  152. }
  153. // indices
  154. for (unsigned int i = 0; i < numVerts; ++i) {
  155. Face &vec = faces[i];
  156. for (unsigned int a = 0; a < (unsigned int)vec.indices.size(); ++a)
  157. vec.indices[a] = stream.GetI4();
  158. }
  159. // material indices
  160. for (unsigned int i = 0; i < numVerts; ++i) {
  161. faces[i].mat = (unsigned int)stream.GetI4();
  162. }
  163. // read all normals
  164. numVerts = (unsigned int)stream.GetI4();
  165. std::vector<aiVector3D> &normals = mesh.normals;
  166. normals.resize(numVerts);
  167. for (unsigned int i = 0; i < numVerts; ++i) {
  168. normals[i].x = stream.GetF4();
  169. normals[i].y = stream.GetF4();
  170. normals[i].z = stream.GetF4();
  171. }
  172. numVerts = (unsigned int)stream.GetI4();
  173. if (numTextures && numVerts) {
  174. // read all texture coordinates
  175. std::vector<aiVector3D> &uv = mesh.uv;
  176. uv.resize(numVerts);
  177. for (unsigned int i = 0; i < numVerts; ++i) {
  178. uv[i].x = stream.GetF4();
  179. uv[i].y = stream.GetF4();
  180. }
  181. // UV indices
  182. for (unsigned int i = 0; i < (unsigned int)faces.size(); ++i) {
  183. Face &vec = faces[i];
  184. for (unsigned int a = 0; a < (unsigned int)vec.indices.size(); ++a) {
  185. vec.uvindices[a] = stream.GetI4();
  186. if (!i && !a)
  187. mesh.prevUVIdx = vec.uvindices[a];
  188. else if (vec.uvindices[a] != mesh.prevUVIdx)
  189. mesh.prevUVIdx = UINT_MAX;
  190. }
  191. }
  192. }
  193. // we don't need the rest, but we need to get to the next chunk
  194. stream.IncPtr(36);
  195. if (minor > '0' && major == '3')
  196. stream.IncPtr(mesh.faces.size());
  197. }
  198. } break;
  199. // materials chunk
  200. case 'c':
  201. for (unsigned int i = 0; i < numMats; ++i) {
  202. materials.emplace_back();
  203. Material &mat = materials.back();
  204. // read the material name
  205. c = stream.GetI1();
  206. while (c) {
  207. mat.name.data[mat.name.length++] = c;
  208. if (mat.name.length == AI_MAXLEN) {
  209. ASSIMP_LOG_ERROR("String ouverflow detected, skipped material name parsing.");
  210. break;
  211. }
  212. c = stream.GetI1();
  213. }
  214. // add the terminal character
  215. mat.name.data[mat.name.length] = '\0';
  216. // read the ambient color
  217. mat.ambient.r = stream.GetF4();
  218. mat.ambient.g = stream.GetF4();
  219. mat.ambient.b = stream.GetF4();
  220. // read the diffuse color
  221. mat.diffuse.r = stream.GetF4();
  222. mat.diffuse.g = stream.GetF4();
  223. mat.diffuse.b = stream.GetF4();
  224. // read the ambient color
  225. mat.specular.r = stream.GetF4();
  226. mat.specular.g = stream.GetF4();
  227. mat.specular.b = stream.GetF4();
  228. // read the transparency
  229. mat.transparency = stream.GetF4();
  230. // FIX: it could be the texture index ...
  231. mat.texIdx = (unsigned int)stream.GetI4();
  232. }
  233. break;
  234. // texture chunk
  235. case 't':
  236. pScene->mNumTextures = numTextures;
  237. if (!numTextures) {
  238. break;
  239. }
  240. pScene->mTextures = new aiTexture *[pScene->mNumTextures];
  241. // to make sure we won't crash if we leave through an exception
  242. ::memset(pScene->mTextures, 0, sizeof(void *) * pScene->mNumTextures);
  243. for (unsigned int i = 0; i < pScene->mNumTextures; ++i) {
  244. aiTexture *tex = pScene->mTextures[i] = new aiTexture;
  245. // skip the texture name
  246. while (stream.GetI1())
  247. ;
  248. // read texture width and height
  249. tex->mWidth = (unsigned int)stream.GetI4();
  250. tex->mHeight = (unsigned int)stream.GetI4();
  251. if (!tex->mWidth || !tex->mHeight) {
  252. throw DeadlyImportError("Quick3D: Invalid texture. Width or height is zero");
  253. }
  254. const unsigned int uint_max = std::numeric_limits<unsigned int>::max();
  255. if (tex->mWidth > (uint_max / tex->mHeight)) {
  256. throw DeadlyImportError("Quick3D: Texture dimensions are too large, resulting in overflow.");
  257. }
  258. unsigned int mul = tex->mWidth * tex->mHeight;
  259. aiTexel *begin = tex->pcData = new aiTexel[mul];
  260. aiTexel *const end = &begin[mul - 1] + 1;
  261. for (; begin != end; ++begin) {
  262. begin->r = stream.GetI1();
  263. begin->g = stream.GetI1();
  264. begin->b = stream.GetI1();
  265. begin->a = 0xff;
  266. }
  267. }
  268. break;
  269. // scene chunk
  270. case 's': {
  271. // skip position and rotation
  272. stream.IncPtr(12);
  273. for (unsigned int i = 0; i < 4; ++i)
  274. for (unsigned int a = 0; a < 4; ++a)
  275. pScene->mRootNode->mTransformation[i][a] = stream.GetF4();
  276. stream.IncPtr(16);
  277. // now setup a single camera
  278. pScene->mNumCameras = 1;
  279. pScene->mCameras = new aiCamera *[1];
  280. aiCamera *cam = pScene->mCameras[0] = new aiCamera();
  281. cam->mPosition.x = stream.GetF4();
  282. cam->mPosition.y = stream.GetF4();
  283. cam->mPosition.z = stream.GetF4();
  284. cam->mName.Set("Q3DCamera");
  285. // skip eye rotation for the moment
  286. stream.IncPtr(12);
  287. // read the default material color
  288. fgColor.r = stream.GetF4();
  289. fgColor.g = stream.GetF4();
  290. fgColor.b = stream.GetF4();
  291. // skip some unimportant properties
  292. stream.IncPtr(29);
  293. // setup a single point light with no attenuation
  294. pScene->mNumLights = 1;
  295. pScene->mLights = new aiLight *[1];
  296. aiLight *light = pScene->mLights[0] = new aiLight();
  297. light->mName.Set("Q3DLight");
  298. light->mType = aiLightSource_POINT;
  299. light->mAttenuationConstant = 1;
  300. light->mAttenuationLinear = 0;
  301. light->mAttenuationQuadratic = 0;
  302. light->mColorDiffuse.r = stream.GetF4();
  303. light->mColorDiffuse.g = stream.GetF4();
  304. light->mColorDiffuse.b = stream.GetF4();
  305. light->mColorSpecular = light->mColorDiffuse;
  306. // We don't need the rest, but we need to know where this chunk ends.
  307. const auto t1 = stream.GetI4();
  308. const auto t2 = stream.GetI4();
  309. if (t1 < 0 || t2 < 0) {
  310. throw DeadlyImportError("Quick3D: Overflow detected.");
  311. }
  312. const unsigned int temp = static_cast<unsigned int>(t1*t2);
  313. // skip the background file name
  314. while (stream.GetI1())
  315. ;
  316. // skip background texture data + the remaining fields
  317. stream.IncPtr(temp * 3 + 20); // 4 bytes of unknown data here
  318. // TODO
  319. goto outer;
  320. }
  321. default:
  322. throw DeadlyImportError("Quick3D: Unknown chunk");
  323. };
  324. }
  325. outer:
  326. // If we have no mesh loaded - break here
  327. if (meshes.empty())
  328. throw DeadlyImportError("Quick3D: No meshes loaded");
  329. // If we have no materials loaded - generate a default mat
  330. if (materials.empty()) {
  331. ASSIMP_LOG_INFO("Quick3D: No material found, generating one");
  332. materials.emplace_back();
  333. materials.back().diffuse = fgColor;
  334. }
  335. // find out which materials we'll need
  336. typedef std::pair<unsigned int, unsigned int> FaceIdx;
  337. typedef std::vector<FaceIdx> FaceIdxArray;
  338. FaceIdxArray *fidx = new FaceIdxArray[materials.size()];
  339. unsigned int p = 0;
  340. for (std::vector<Mesh>::iterator it = meshes.begin(), end = meshes.end();
  341. it != end; ++it, ++p) {
  342. unsigned int q = 0;
  343. for (std::vector<Face>::iterator fit = (*it).faces.begin(), fend = (*it).faces.end();
  344. fit != fend; ++fit, ++q) {
  345. if ((*fit).mat >= materials.size()) {
  346. ASSIMP_LOG_WARN("Quick3D: Material index overflow");
  347. (*fit).mat = 0;
  348. }
  349. if (fidx[(*fit).mat].empty()) ++pScene->mNumMeshes;
  350. fidx[(*fit).mat].emplace_back(p, q);
  351. }
  352. }
  353. pScene->mNumMaterials = pScene->mNumMeshes;
  354. pScene->mMaterials = new aiMaterial *[pScene->mNumMaterials];
  355. pScene->mMeshes = new aiMesh *[pScene->mNumMaterials];
  356. for (unsigned int i = 0, real = 0; i < (unsigned int)materials.size(); ++i) {
  357. if (fidx[i].empty())
  358. continue;
  359. // Allocate a mesh and a material
  360. aiMesh *mesh = pScene->mMeshes[real] = new aiMesh();
  361. aiMaterial *mat = new aiMaterial();
  362. pScene->mMaterials[real] = mat;
  363. mesh->mMaterialIndex = real;
  364. // Build the output material
  365. Material &srcMat = materials[i];
  366. mat->AddProperty(&srcMat.diffuse, 1, AI_MATKEY_COLOR_DIFFUSE);
  367. mat->AddProperty(&srcMat.specular, 1, AI_MATKEY_COLOR_SPECULAR);
  368. mat->AddProperty(&srcMat.ambient, 1, AI_MATKEY_COLOR_AMBIENT);
  369. // NOTE: Ignore transparency for the moment - it seems
  370. // unclear how to interpret the data
  371. #if 0
  372. if (!(minor > '0' && major == '3'))
  373. srcMat.transparency = 1.0f - srcMat.transparency;
  374. mat->AddProperty(&srcMat.transparency, 1, AI_MATKEY_OPACITY);
  375. #endif
  376. // add shininess - Quick3D seems to use it ins its viewer
  377. srcMat.transparency = 16.f;
  378. mat->AddProperty(&srcMat.transparency, 1, AI_MATKEY_SHININESS);
  379. int m = (int)aiShadingMode_Phong;
  380. mat->AddProperty(&m, 1, AI_MATKEY_SHADING_MODEL);
  381. if (srcMat.name.length)
  382. mat->AddProperty(&srcMat.name, AI_MATKEY_NAME);
  383. // Add a texture
  384. if (srcMat.texIdx < pScene->mNumTextures || real < pScene->mNumTextures) {
  385. srcMat.name.data[0] = '*';
  386. srcMat.name.length = ASSIMP_itoa10(&srcMat.name.data[1], 1000,
  387. (srcMat.texIdx < pScene->mNumTextures ? srcMat.texIdx : real));
  388. mat->AddProperty(&srcMat.name, AI_MATKEY_TEXTURE_DIFFUSE(0));
  389. }
  390. mesh->mNumFaces = (unsigned int)fidx[i].size();
  391. aiFace *faces = mesh->mFaces = new aiFace[mesh->mNumFaces];
  392. // Now build the output mesh. First find out how many
  393. // vertices we'll need
  394. for (FaceIdxArray::const_iterator it = fidx[i].begin(), end = fidx[i].end();
  395. it != end; ++it) {
  396. mesh->mNumVertices += (unsigned int)meshes[(*it).first].faces[(*it).second].indices.size();
  397. }
  398. aiVector3D *verts = mesh->mVertices = new aiVector3D[mesh->mNumVertices];
  399. aiVector3D *norms = mesh->mNormals = new aiVector3D[mesh->mNumVertices];
  400. aiVector3D *uv = nullptr;
  401. if (real < pScene->mNumTextures) {
  402. uv = mesh->mTextureCoords[0] = new aiVector3D[mesh->mNumVertices];
  403. mesh->mNumUVComponents[0] = 2;
  404. }
  405. // Build the final array
  406. unsigned int cnt = 0;
  407. for (FaceIdxArray::const_iterator it = fidx[i].begin(), end = fidx[i].end();
  408. it != end; ++it, ++faces) {
  409. Mesh &curMesh = meshes[(*it).first];
  410. Face &face = curMesh.faces[(*it).second];
  411. faces->mNumIndices = (unsigned int)face.indices.size();
  412. faces->mIndices = new unsigned int[faces->mNumIndices];
  413. aiVector3D faceNormal;
  414. bool fnOK = false;
  415. for (unsigned int n = 0; n < faces->mNumIndices; ++n, ++cnt, ++norms, ++verts) {
  416. if (face.indices[n] >= curMesh.verts.size()) {
  417. ASSIMP_LOG_WARN("Quick3D: Vertex index overflow");
  418. face.indices[n] = 0;
  419. }
  420. // copy vertices
  421. *verts = curMesh.verts[face.indices[n]];
  422. if (face.indices[n] >= curMesh.normals.size() && faces->mNumIndices >= 3) {
  423. // we have no normal here - assign the face normal
  424. if (!fnOK) {
  425. const aiVector3D &pV1 = curMesh.verts[face.indices[0]];
  426. const aiVector3D &pV2 = curMesh.verts[face.indices[1]];
  427. const aiVector3D &pV3 = curMesh.verts[face.indices.size() - 1];
  428. faceNormal = (pV2 - pV1) ^ (pV3 - pV1).Normalize();
  429. fnOK = true;
  430. }
  431. *norms = faceNormal;
  432. } else {
  433. *norms = curMesh.normals[face.indices[n]];
  434. }
  435. // copy texture coordinates
  436. if (uv && curMesh.uv.size()) {
  437. if (curMesh.prevUVIdx != 0xffffffff && curMesh.uv.size() >= curMesh.verts.size()) // workaround
  438. {
  439. *uv = curMesh.uv[face.indices[n]];
  440. } else {
  441. if (face.uvindices[n] >= curMesh.uv.size()) {
  442. ASSIMP_LOG_WARN("Quick3D: Texture coordinate index overflow");
  443. face.uvindices[n] = 0;
  444. }
  445. *uv = curMesh.uv[face.uvindices[n]];
  446. }
  447. uv->y = 1.f - uv->y;
  448. ++uv;
  449. }
  450. // setup the new vertex index
  451. faces->mIndices[n] = cnt;
  452. }
  453. }
  454. ++real;
  455. }
  456. // Delete our nice helper array
  457. delete[] fidx;
  458. // Now we need to attach the meshes to the root node of the scene
  459. pScene->mRootNode->mNumMeshes = pScene->mNumMeshes;
  460. pScene->mRootNode->mMeshes = new unsigned int[pScene->mNumMeshes];
  461. for (unsigned int i = 0; i < pScene->mNumMeshes; ++i) {
  462. pScene->mRootNode->mMeshes[i] = i;
  463. }
  464. // Add cameras and light sources to the scene root node
  465. pScene->mRootNode->mNumChildren = pScene->mNumLights + pScene->mNumCameras;
  466. if (pScene->mRootNode->mNumChildren) {
  467. pScene->mRootNode->mChildren = new aiNode *[pScene->mRootNode->mNumChildren];
  468. // the light source
  469. aiNode *nd = pScene->mRootNode->mChildren[0] = new aiNode();
  470. nd->mParent = pScene->mRootNode;
  471. nd->mName.Set("Q3DLight");
  472. nd->mTransformation = pScene->mRootNode->mTransformation;
  473. nd->mTransformation.Inverse();
  474. // camera
  475. nd = pScene->mRootNode->mChildren[1] = new aiNode();
  476. nd->mParent = pScene->mRootNode;
  477. nd->mName.Set("Q3DCamera");
  478. nd->mTransformation = pScene->mRootNode->mChildren[0]->mTransformation;
  479. }
  480. }
  481. } // namespace Assimp
  482. #endif // !! ASSIMP_BUILD_NO_Q3D_IMPORTER