Q3DLoader.cpp 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585
  1. /*
  2. ---------------------------------------------------------------------------
  3. Open Asset Import Library (assimp)
  4. ---------------------------------------------------------------------------
  5. Copyright (c) 2006-2022, 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. using namespace Assimp;
  48. static const aiImporterDesc desc = {
  49. "Quick3D Importer",
  50. "",
  51. "",
  52. "http://www.quick3d.com/",
  53. aiImporterFlags_SupportBinaryFlavour,
  54. 0,
  55. 0,
  56. 0,
  57. 0,
  58. "q3o q3s"
  59. };
  60. // ------------------------------------------------------------------------------------------------
  61. // Constructor to be privately used by Importer
  62. Q3DImporter::Q3DImporter() {
  63. // empty
  64. }
  65. // ------------------------------------------------------------------------------------------------
  66. // Destructor, private as well
  67. Q3DImporter::~Q3DImporter() {
  68. // empty
  69. }
  70. // ------------------------------------------------------------------------------------------------
  71. // Returns whether the class can handle the format of the given file.
  72. bool Q3DImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool /*checkSig*/) const {
  73. static const char *tokens[] = { "quick3Do", "quick3Ds" };
  74. return SearchFileHeaderForToken(pIOHandler, pFile, tokens, AI_COUNT_OF(tokens));
  75. }
  76. // ------------------------------------------------------------------------------------------------
  77. const aiImporterDesc *Q3DImporter::GetInfo() const {
  78. return &desc;
  79. }
  80. // ------------------------------------------------------------------------------------------------
  81. // Imports the given file into the given scene structure.
  82. void Q3DImporter::InternReadFile(const std::string &pFile,
  83. aiScene *pScene, IOSystem *pIOHandler) {
  84. auto file = pIOHandler->Open(pFile, "rb");
  85. if (!file)
  86. throw DeadlyImportError("Quick3D: Could not open ", pFile);
  87. StreamReaderLE stream(file);
  88. // The header is 22 bytes large
  89. if (stream.GetRemainingSize() < 22)
  90. throw DeadlyImportError("File is either empty or corrupt: ", pFile);
  91. // Check the file's signature
  92. if (ASSIMP_strincmp((const char *)stream.GetPtr(), "quick3Do", 8) &&
  93. ASSIMP_strincmp((const char *)stream.GetPtr(), "quick3Ds", 8)) {
  94. throw DeadlyImportError("Not a Quick3D file. Signature string is: ", ai_str_toprintable((const char *)stream.GetPtr(), 8));
  95. }
  96. // Print the file format version
  97. ASSIMP_LOG_INFO("Quick3D File format version: ",
  98. std::string(&((const char *)stream.GetPtr())[8], 2));
  99. // ... an store it
  100. char major = ((const char *)stream.GetPtr())[8];
  101. char minor = ((const char *)stream.GetPtr())[9];
  102. stream.IncPtr(10);
  103. unsigned int numMeshes = (unsigned int)stream.GetI4();
  104. unsigned int numMats = (unsigned int)stream.GetI4();
  105. unsigned int numTextures = (unsigned int)stream.GetI4();
  106. std::vector<Material> materials;
  107. try {
  108. materials.reserve(numMats);
  109. } catch(const std::bad_alloc&) {
  110. ASSIMP_LOG_ERROR("Invalid alloc for materials.");
  111. throw DeadlyImportError("Invalid Quick3D-file, material allocation failed.");
  112. }
  113. std::vector<Mesh> meshes;
  114. try {
  115. meshes.reserve(numMeshes);
  116. } catch(const std::bad_alloc&) {
  117. ASSIMP_LOG_ERROR("Invalid alloc for meshes.");
  118. throw DeadlyImportError("Invalid Quick3D-file, mesh allocation failed.");
  119. }
  120. // Allocate the scene root node
  121. pScene->mRootNode = new aiNode();
  122. aiColor3D fgColor(0.6f, 0.6f, 0.6f);
  123. // Now read all file chunks
  124. while (true) {
  125. if (stream.GetRemainingSize() < 1) break;
  126. char c = stream.GetI1();
  127. switch (c) {
  128. // Meshes chunk
  129. case 'm': {
  130. for (unsigned int quak = 0; quak < numMeshes; ++quak) {
  131. meshes.push_back(Mesh());
  132. Mesh &mesh = meshes.back();
  133. // read all vertices
  134. unsigned int numVerts = (unsigned int)stream.GetI4();
  135. if (!numVerts)
  136. throw DeadlyImportError("Quick3D: Found mesh with zero vertices");
  137. std::vector<aiVector3D> &verts = mesh.verts;
  138. verts.resize(numVerts);
  139. for (unsigned int i = 0; i < numVerts; ++i) {
  140. verts[i].x = stream.GetF4();
  141. verts[i].y = stream.GetF4();
  142. verts[i].z = stream.GetF4();
  143. }
  144. // read all faces
  145. numVerts = (unsigned int)stream.GetI4();
  146. if (!numVerts)
  147. throw DeadlyImportError("Quick3D: Found mesh with zero faces");
  148. std::vector<Face> &faces = mesh.faces;
  149. faces.reserve(numVerts);
  150. // number of indices
  151. for (unsigned int i = 0; i < numVerts; ++i) {
  152. faces.push_back(Face(stream.GetI2()));
  153. if (faces.back().indices.empty())
  154. throw DeadlyImportError("Quick3D: Found face with zero indices");
  155. }
  156. // indices
  157. for (unsigned int i = 0; i < numVerts; ++i) {
  158. Face &vec = faces[i];
  159. for (unsigned int a = 0; a < (unsigned int)vec.indices.size(); ++a)
  160. vec.indices[a] = stream.GetI4();
  161. }
  162. // material indices
  163. for (unsigned int i = 0; i < numVerts; ++i) {
  164. faces[i].mat = (unsigned int)stream.GetI4();
  165. }
  166. // read all normals
  167. numVerts = (unsigned int)stream.GetI4();
  168. std::vector<aiVector3D> &normals = mesh.normals;
  169. normals.resize(numVerts);
  170. for (unsigned int i = 0; i < numVerts; ++i) {
  171. normals[i].x = stream.GetF4();
  172. normals[i].y = stream.GetF4();
  173. normals[i].z = stream.GetF4();
  174. }
  175. numVerts = (unsigned int)stream.GetI4();
  176. if (numTextures && numVerts) {
  177. // read all texture coordinates
  178. std::vector<aiVector3D> &uv = mesh.uv;
  179. uv.resize(numVerts);
  180. for (unsigned int i = 0; i < numVerts; ++i) {
  181. uv[i].x = stream.GetF4();
  182. uv[i].y = stream.GetF4();
  183. }
  184. // UV indices
  185. for (unsigned int i = 0; i < (unsigned int)faces.size(); ++i) {
  186. Face &vec = faces[i];
  187. for (unsigned int a = 0; a < (unsigned int)vec.indices.size(); ++a) {
  188. vec.uvindices[a] = stream.GetI4();
  189. if (!i && !a)
  190. mesh.prevUVIdx = vec.uvindices[a];
  191. else if (vec.uvindices[a] != mesh.prevUVIdx)
  192. mesh.prevUVIdx = UINT_MAX;
  193. }
  194. }
  195. }
  196. // we don't need the rest, but we need to get to the next chunk
  197. stream.IncPtr(36);
  198. if (minor > '0' && major == '3')
  199. stream.IncPtr(mesh.faces.size());
  200. }
  201. // stream.IncPtr(4); // unknown value here
  202. } break;
  203. // materials chunk
  204. case 'c':
  205. for (unsigned int i = 0; i < numMats; ++i) {
  206. materials.push_back(Material());
  207. Material &mat = materials.back();
  208. // read the material name
  209. c = stream.GetI1();
  210. while (c) {
  211. mat.name.data[mat.name.length++] = c;
  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. // unknown value here
  231. // stream.IncPtr(4);
  232. // FIX: it could be the texture index ...
  233. mat.texIdx = (unsigned int)stream.GetI4();
  234. }
  235. break;
  236. // texture chunk
  237. case 't':
  238. pScene->mNumTextures = numTextures;
  239. if (!numTextures) {
  240. break;
  241. }
  242. pScene->mTextures = new aiTexture *[pScene->mNumTextures];
  243. // to make sure we won't crash if we leave through an exception
  244. ::memset(pScene->mTextures, 0, sizeof(void *) * pScene->mNumTextures);
  245. for (unsigned int i = 0; i < pScene->mNumTextures; ++i) {
  246. aiTexture *tex = pScene->mTextures[i] = new aiTexture;
  247. // skip the texture name
  248. while (stream.GetI1())
  249. ;
  250. // read texture width and height
  251. tex->mWidth = (unsigned int)stream.GetI4();
  252. tex->mHeight = (unsigned int)stream.GetI4();
  253. if (!tex->mWidth || !tex->mHeight) {
  254. throw DeadlyImportError("Quick3D: Invalid texture. Width or height is zero");
  255. }
  256. unsigned int mul = tex->mWidth * tex->mHeight;
  257. aiTexel *begin = tex->pcData = new aiTexel[mul];
  258. aiTexel *const end = &begin[mul - 1] + 1;
  259. for (; begin != end; ++begin) {
  260. begin->r = stream.GetI1();
  261. begin->g = stream.GetI1();
  262. begin->b = stream.GetI1();
  263. begin->a = 0xff;
  264. }
  265. }
  266. break;
  267. // scene chunk
  268. case 's': {
  269. // skip position and rotation
  270. stream.IncPtr(12);
  271. for (unsigned int i = 0; i < 4; ++i)
  272. for (unsigned int a = 0; a < 4; ++a)
  273. pScene->mRootNode->mTransformation[i][a] = stream.GetF4();
  274. stream.IncPtr(16);
  275. // now setup a single camera
  276. pScene->mNumCameras = 1;
  277. pScene->mCameras = new aiCamera *[1];
  278. aiCamera *cam = pScene->mCameras[0] = new aiCamera();
  279. cam->mPosition.x = stream.GetF4();
  280. cam->mPosition.y = stream.GetF4();
  281. cam->mPosition.z = stream.GetF4();
  282. cam->mName.Set("Q3DCamera");
  283. // skip eye rotation for the moment
  284. stream.IncPtr(12);
  285. // read the default material color
  286. fgColor.r = stream.GetF4();
  287. fgColor.g = stream.GetF4();
  288. fgColor.b = stream.GetF4();
  289. // skip some unimportant properties
  290. stream.IncPtr(29);
  291. // setup a single point light with no attenuation
  292. pScene->mNumLights = 1;
  293. pScene->mLights = new aiLight *[1];
  294. aiLight *light = pScene->mLights[0] = new aiLight();
  295. light->mName.Set("Q3DLight");
  296. light->mType = aiLightSource_POINT;
  297. light->mAttenuationConstant = 1;
  298. light->mAttenuationLinear = 0;
  299. light->mAttenuationQuadratic = 0;
  300. light->mColorDiffuse.r = stream.GetF4();
  301. light->mColorDiffuse.g = stream.GetF4();
  302. light->mColorDiffuse.b = stream.GetF4();
  303. light->mColorSpecular = light->mColorDiffuse;
  304. // We don't need the rest, but we need to know where this chunk ends.
  305. unsigned int temp = (unsigned int)(stream.GetI4() * stream.GetI4());
  306. // skip the background file name
  307. while (stream.GetI1())
  308. ;
  309. // skip background texture data + the remaining fields
  310. stream.IncPtr(temp * 3 + 20); // 4 bytes of unknown data here
  311. // TODO
  312. goto outer;
  313. } break;
  314. default:
  315. throw DeadlyImportError("Quick3D: Unknown chunk");
  316. break;
  317. };
  318. }
  319. outer:
  320. // If we have no mesh loaded - break here
  321. if (meshes.empty())
  322. throw DeadlyImportError("Quick3D: No meshes loaded");
  323. // If we have no materials loaded - generate a default mat
  324. if (materials.empty()) {
  325. ASSIMP_LOG_INFO("Quick3D: No material found, generating one");
  326. materials.push_back(Material());
  327. materials.back().diffuse = fgColor;
  328. }
  329. // find out which materials we'll need
  330. typedef std::pair<unsigned int, unsigned int> FaceIdx;
  331. typedef std::vector<FaceIdx> FaceIdxArray;
  332. FaceIdxArray *fidx = new FaceIdxArray[materials.size()];
  333. unsigned int p = 0;
  334. for (std::vector<Mesh>::iterator it = meshes.begin(), end = meshes.end();
  335. it != end; ++it, ++p) {
  336. unsigned int q = 0;
  337. for (std::vector<Face>::iterator fit = (*it).faces.begin(), fend = (*it).faces.end();
  338. fit != fend; ++fit, ++q) {
  339. if ((*fit).mat >= materials.size()) {
  340. ASSIMP_LOG_WARN("Quick3D: Material index overflow");
  341. (*fit).mat = 0;
  342. }
  343. if (fidx[(*fit).mat].empty()) ++pScene->mNumMeshes;
  344. fidx[(*fit).mat].push_back(FaceIdx(p, q));
  345. }
  346. }
  347. pScene->mNumMaterials = pScene->mNumMeshes;
  348. pScene->mMaterials = new aiMaterial *[pScene->mNumMaterials];
  349. pScene->mMeshes = new aiMesh *[pScene->mNumMaterials];
  350. for (unsigned int i = 0, real = 0; i < (unsigned int)materials.size(); ++i) {
  351. if (fidx[i].empty()) continue;
  352. // Allocate a mesh and a material
  353. aiMesh *mesh = pScene->mMeshes[real] = new aiMesh();
  354. aiMaterial *mat = new aiMaterial();
  355. pScene->mMaterials[real] = mat;
  356. mesh->mMaterialIndex = real;
  357. // Build the output material
  358. Material &srcMat = materials[i];
  359. mat->AddProperty(&srcMat.diffuse, 1, AI_MATKEY_COLOR_DIFFUSE);
  360. mat->AddProperty(&srcMat.specular, 1, AI_MATKEY_COLOR_SPECULAR);
  361. mat->AddProperty(&srcMat.ambient, 1, AI_MATKEY_COLOR_AMBIENT);
  362. // NOTE: Ignore transparency for the moment - it seems
  363. // unclear how to interpret the data
  364. #if 0
  365. if (!(minor > '0' && major == '3'))
  366. srcMat.transparency = 1.0f - srcMat.transparency;
  367. mat->AddProperty(&srcMat.transparency, 1, AI_MATKEY_OPACITY);
  368. #endif
  369. // add shininess - Quick3D seems to use it ins its viewer
  370. srcMat.transparency = 16.f;
  371. mat->AddProperty(&srcMat.transparency, 1, AI_MATKEY_SHININESS);
  372. int m = (int)aiShadingMode_Phong;
  373. mat->AddProperty(&m, 1, AI_MATKEY_SHADING_MODEL);
  374. if (srcMat.name.length)
  375. mat->AddProperty(&srcMat.name, AI_MATKEY_NAME);
  376. // Add a texture
  377. if (srcMat.texIdx < pScene->mNumTextures || real < pScene->mNumTextures) {
  378. srcMat.name.data[0] = '*';
  379. srcMat.name.length = ASSIMP_itoa10(&srcMat.name.data[1], 1000,
  380. (srcMat.texIdx < pScene->mNumTextures ? srcMat.texIdx : real));
  381. mat->AddProperty(&srcMat.name, AI_MATKEY_TEXTURE_DIFFUSE(0));
  382. }
  383. mesh->mNumFaces = (unsigned int)fidx[i].size();
  384. aiFace *faces = mesh->mFaces = new aiFace[mesh->mNumFaces];
  385. // Now build the output mesh. First find out how many
  386. // vertices we'll need
  387. for (FaceIdxArray::const_iterator it = fidx[i].begin(), end = fidx[i].end();
  388. it != end; ++it) {
  389. mesh->mNumVertices += (unsigned int)meshes[(*it).first].faces[(*it).second].indices.size();
  390. }
  391. aiVector3D *verts = mesh->mVertices = new aiVector3D[mesh->mNumVertices];
  392. aiVector3D *norms = mesh->mNormals = new aiVector3D[mesh->mNumVertices];
  393. aiVector3D *uv = nullptr;
  394. if (real < pScene->mNumTextures) {
  395. uv = mesh->mTextureCoords[0] = new aiVector3D[mesh->mNumVertices];
  396. mesh->mNumUVComponents[0] = 2;
  397. }
  398. // Build the final array
  399. unsigned int cnt = 0;
  400. for (FaceIdxArray::const_iterator it = fidx[i].begin(), end = fidx[i].end();
  401. it != end; ++it, ++faces) {
  402. Mesh &curMesh = meshes[(*it).first];
  403. Face &face = curMesh.faces[(*it).second];
  404. faces->mNumIndices = (unsigned int)face.indices.size();
  405. faces->mIndices = new unsigned int[faces->mNumIndices];
  406. aiVector3D faceNormal;
  407. bool fnOK = false;
  408. for (unsigned int n = 0; n < faces->mNumIndices; ++n, ++cnt, ++norms, ++verts) {
  409. if (face.indices[n] >= curMesh.verts.size()) {
  410. ASSIMP_LOG_WARN("Quick3D: Vertex index overflow");
  411. face.indices[n] = 0;
  412. }
  413. // copy vertices
  414. *verts = curMesh.verts[face.indices[n]];
  415. if (face.indices[n] >= curMesh.normals.size() && faces->mNumIndices >= 3) {
  416. // we have no normal here - assign the face normal
  417. if (!fnOK) {
  418. const aiVector3D &pV1 = curMesh.verts[face.indices[0]];
  419. const aiVector3D &pV2 = curMesh.verts[face.indices[1]];
  420. const aiVector3D &pV3 = curMesh.verts[face.indices.size() - 1];
  421. faceNormal = (pV2 - pV1) ^ (pV3 - pV1).Normalize();
  422. fnOK = true;
  423. }
  424. *norms = faceNormal;
  425. } else {
  426. *norms = curMesh.normals[face.indices[n]];
  427. }
  428. // copy texture coordinates
  429. if (uv && curMesh.uv.size()) {
  430. if (curMesh.prevUVIdx != 0xffffffff && curMesh.uv.size() >= curMesh.verts.size()) // workaround
  431. {
  432. *uv = curMesh.uv[face.indices[n]];
  433. } else {
  434. if (face.uvindices[n] >= curMesh.uv.size()) {
  435. ASSIMP_LOG_WARN("Quick3D: Texture coordinate index overflow");
  436. face.uvindices[n] = 0;
  437. }
  438. *uv = curMesh.uv[face.uvindices[n]];
  439. }
  440. uv->y = 1.f - uv->y;
  441. ++uv;
  442. }
  443. // setup the new vertex index
  444. faces->mIndices[n] = cnt;
  445. }
  446. }
  447. ++real;
  448. }
  449. // Delete our nice helper array
  450. delete[] fidx;
  451. // Now we need to attach the meshes to the root node of the scene
  452. pScene->mRootNode->mNumMeshes = pScene->mNumMeshes;
  453. pScene->mRootNode->mMeshes = new unsigned int[pScene->mNumMeshes];
  454. for (unsigned int i = 0; i < pScene->mNumMeshes; ++i)
  455. pScene->mRootNode->mMeshes[i] = i;
  456. /*pScene->mRootNode->mTransformation *= aiMatrix4x4(
  457. 1.f, 0.f, 0.f, 0.f,
  458. 0.f, -1.f,0.f, 0.f,
  459. 0.f, 0.f, 1.f, 0.f,
  460. 0.f, 0.f, 0.f, 1.f);*/
  461. // Add cameras and light sources to the scene root node
  462. pScene->mRootNode->mNumChildren = pScene->mNumLights + pScene->mNumCameras;
  463. if (pScene->mRootNode->mNumChildren) {
  464. pScene->mRootNode->mChildren = new aiNode *[pScene->mRootNode->mNumChildren];
  465. // the light source
  466. aiNode *nd = pScene->mRootNode->mChildren[0] = new aiNode();
  467. nd->mParent = pScene->mRootNode;
  468. nd->mName.Set("Q3DLight");
  469. nd->mTransformation = pScene->mRootNode->mTransformation;
  470. nd->mTransformation.Inverse();
  471. // camera
  472. nd = pScene->mRootNode->mChildren[1] = new aiNode();
  473. nd->mParent = pScene->mRootNode;
  474. nd->mName.Set("Q3DCamera");
  475. nd->mTransformation = pScene->mRootNode->mChildren[0]->mTransformation;
  476. }
  477. }
  478. #endif // !! ASSIMP_BUILD_NO_Q3D_IMPORTER