2
0

OgreMesh.cpp 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532
  1. /*
  2. Open Asset Import Library (assimp)
  3. ----------------------------------------------------------------------
  4. Copyright (c) 2006-2012, assimp team
  5. All rights reserved.
  6. Redistribution and use of this software in source and binary forms,
  7. with or without modification, are permitted provided that the
  8. following conditions are met:
  9. * Redistributions of source code must retain the above
  10. copyright notice, this list of conditions and the
  11. following disclaimer.
  12. * Redistributions in binary form must reproduce the above
  13. copyright notice, this list of conditions and the
  14. following disclaimer in the documentation and/or other
  15. materials provided with the distribution.
  16. * Neither the name of the assimp team, nor the names of its
  17. contributors may be used to endorse or promote products
  18. derived from this software without specific prior
  19. written permission of the assimp team.
  20. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  21. "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  22. LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  23. A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  24. OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  25. SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  26. LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  27. DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  28. THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  29. (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  30. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  31. ----------------------------------------------------------------------
  32. */
  33. #include "AssimpPCH.h"
  34. #ifndef ASSIMP_BUILD_NO_OGRE_IMPORTER
  35. #include "OgreImporter.h"
  36. #include "TinyFormatter.h"
  37. using namespace std;
  38. namespace Assimp
  39. {
  40. namespace Ogre
  41. {
  42. void OgreImporter::ReadSubMesh(const unsigned int submeshIndex, SubMesh &submesh, XmlReader *reader)
  43. {
  44. if (reader->getAttributeValue("material"))
  45. submesh.MaterialName = GetAttribute<string>(reader, "material");
  46. if (reader->getAttributeValue("use32bitindexes"))
  47. submesh.Use32bitIndexes = GetAttribute<bool>(reader, "use32bitindexes");
  48. if (reader->getAttributeValue("usesharedvertices"))
  49. submesh.UseSharedGeometry = GetAttribute<bool>(reader, "usesharedvertices");
  50. DefaultLogger::get()->debug(Formatter::format() << "Reading submesh " << submeshIndex);
  51. DefaultLogger::get()->debug(Formatter::format() << " - Material '" << submesh.MaterialName << "'");
  52. DefaultLogger::get()->debug(Formatter::format() << " - Shader geometry = " << (submesh.UseSharedGeometry ? "true" : "false") <<
  53. ", 32bit indexes = " << (submesh.Use32bitIndexes ? "true" : "false"));
  54. //TODO: maybe we have alsways just 1 faces and 1 geometry and always in this order. this loop will only work correct, when the order
  55. //of faces and geometry changed, and not if we have more than one of one
  56. /// @todo Fix above comment with better read logic below
  57. NextNode(reader);
  58. string currentNodeName = reader->getNodeName();
  59. const string nnFaces = "faces";
  60. const string nnFace = "face";
  61. const string nnGeometry = "geometry";
  62. const string nnBoneAssignments = "boneassignments";
  63. const string nnVertexBuffer = "vertexbuffer";
  64. bool quadWarned = false;
  65. while(currentNodeName == nnFaces ||
  66. currentNodeName == nnGeometry ||
  67. currentNodeName == nnBoneAssignments)
  68. {
  69. if (currentNodeName == nnFaces)
  70. {
  71. unsigned int numFaces = GetAttribute<unsigned int>(reader, "count");
  72. NextNode(reader);
  73. currentNodeName = reader->getNodeName();
  74. while(currentNodeName == nnFace)
  75. {
  76. Face NewFace;
  77. NewFace.VertexIndices[0] = GetAttribute<int>(reader, "v1");
  78. NewFace.VertexIndices[1] = GetAttribute<int>(reader, "v2");
  79. NewFace.VertexIndices[2] = GetAttribute<int>(reader, "v3");
  80. /// @todo Support quads
  81. if (!quadWarned && reader->getAttributeValue("v4"))
  82. DefaultLogger::get()->warn("Submesh has quads, only triangles are supported at the moment!");
  83. submesh.Faces.push_back(NewFace);
  84. // Advance
  85. NextNode(reader);
  86. currentNodeName = reader->getNodeName();
  87. }
  88. if (submesh.Faces.size() == numFaces)
  89. DefaultLogger::get()->debug(Formatter::format() << " - Faces " << numFaces);
  90. else
  91. throw DeadlyImportError(Formatter::format() << "Read only " << submesh.Faces.size() << " faces when should have read " << numFaces);
  92. }
  93. else if (currentNodeName == nnGeometry)
  94. {
  95. unsigned int numVertices = GetAttribute<int>(reader, "vertexcount");
  96. NextNode(reader);
  97. while(string(reader->getNodeName()) == nnVertexBuffer)
  98. ReadVertexBuffer(submesh, reader, numVertices);
  99. }
  100. else if (reader->getNodeName() == nnBoneAssignments)
  101. ReadBoneWeights(submesh, reader);
  102. currentNodeName = reader->getNodeName();
  103. }
  104. }
  105. void OgreImporter::ReadVertexBuffer(SubMesh &submesh, XmlReader *reader, const unsigned int numVertices)
  106. {
  107. DefaultLogger::get()->debug(Formatter::format() << "Reading vertex buffer with " << numVertices << " vertices");
  108. submesh.HasGeometry = true;
  109. if (reader->getAttributeValue("positions") && GetAttribute<bool>(reader, "positions"))
  110. {
  111. submesh.HasPositions = true;
  112. submesh.Positions.reserve(numVertices);
  113. DefaultLogger::get()->debug(" - Has positions");
  114. }
  115. if (reader->getAttributeValue("normals") && GetAttribute<bool>(reader, "normals"))
  116. {
  117. submesh.HasNormals = true;
  118. submesh.Normals.reserve(numVertices);
  119. DefaultLogger::get()->debug(" - Has normals");
  120. }
  121. if (reader->getAttributeValue("tangents") && GetAttribute<bool>(reader, "tangents"))
  122. {
  123. submesh.HasTangents = true;
  124. submesh.Tangents.reserve(numVertices);
  125. DefaultLogger::get()->debug(" - Has tangents");
  126. }
  127. if (reader->getAttributeValue("texture_coords"))
  128. {
  129. submesh.Uvs.resize(GetAttribute<unsigned int>(reader, "texture_coords"));
  130. for(size_t i=0, len=submesh.Uvs.size(); i<len; ++i)
  131. submesh.Uvs[i].reserve(numVertices);
  132. DefaultLogger::get()->debug(Formatter::format() << " - Has " << submesh.Uvs.size() << " texture coords");
  133. }
  134. if (!submesh.HasPositions)
  135. throw DeadlyImportError("Vertex buffer does not contain positions!");
  136. const string nnVertex = "vertex";
  137. const string nnPosition = "position";
  138. const string nnNormal = "normal";
  139. const string nnTangent = "tangent";
  140. const string nnBinormal = "binormal";
  141. const string nnTexCoord = "texcoord";
  142. const string nnColorDiffuse = "colour_diffuse";
  143. const string nnColorSpecular = "colour_specular";
  144. bool warnBinormal = true;
  145. bool warnColorDiffuse = true;
  146. bool warnColorSpecular = true;
  147. NextNode(reader);
  148. string currentNodeName = reader->getNodeName();
  149. /// @todo Make this loop nicer.
  150. while(currentNodeName == nnVertex ||
  151. currentNodeName == nnPosition ||
  152. currentNodeName == nnNormal ||
  153. currentNodeName == nnTangent ||
  154. currentNodeName == nnBinormal ||
  155. currentNodeName == nnTexCoord ||
  156. currentNodeName == nnColorDiffuse ||
  157. currentNodeName == nnColorSpecular)
  158. {
  159. if (currentNodeName == nnVertex)
  160. {
  161. NextNode(reader);
  162. currentNodeName = reader->getNodeName();
  163. }
  164. /// @todo Implement nnBinormal, nnColorDiffuse and nnColorSpecular
  165. if (submesh.HasPositions && currentNodeName == nnPosition)
  166. {
  167. aiVector3D NewPos;
  168. NewPos.x = GetAttribute<float>(reader, "x");
  169. NewPos.y = GetAttribute<float>(reader, "y");
  170. NewPos.z = GetAttribute<float>(reader, "z");
  171. submesh.Positions.push_back(NewPos);
  172. }
  173. else if (submesh.HasNormals && currentNodeName == nnNormal)
  174. {
  175. aiVector3D NewNormal;
  176. NewNormal.x = GetAttribute<float>(reader, "x");
  177. NewNormal.y = GetAttribute<float>(reader, "y");
  178. NewNormal.z = GetAttribute<float>(reader, "z");
  179. submesh.Normals.push_back(NewNormal);
  180. }
  181. else if (submesh.HasTangents && currentNodeName == nnTangent)
  182. {
  183. aiVector3D NewTangent;
  184. NewTangent.x = GetAttribute<float>(reader, "x");
  185. NewTangent.y = GetAttribute<float>(reader, "y");
  186. NewTangent.z = GetAttribute<float>(reader, "z");
  187. submesh.Tangents.push_back(NewTangent);
  188. }
  189. else if (submesh.Uvs.size() > 0 && currentNodeName == nnTexCoord)
  190. {
  191. for(size_t i=0, len=submesh.Uvs.size(); i<len; ++i)
  192. {
  193. if (currentNodeName != nnTexCoord)
  194. throw DeadlyImportError("Vertex buffer declared more UVs than can be found in a vertex");
  195. aiVector3D NewUv;
  196. NewUv.x = GetAttribute<float>(reader, "u");
  197. NewUv.y = GetAttribute<float>(reader, "v") * (-1)+1; //flip the uv vertikal, blender exports them so! (ahem... @todo ????)
  198. submesh.Uvs[i].push_back(NewUv);
  199. NextNode(reader);
  200. currentNodeName = reader->getNodeName();
  201. }
  202. // Continue main loop as above already read next node
  203. continue;
  204. }
  205. else
  206. {
  207. /// @todo Remove this stuff once implemented. We only want to log warnings once per element.
  208. bool warn = true;
  209. if (currentNodeName == nnBinormal)
  210. {
  211. if (warnBinormal)
  212. warnBinormal = false;
  213. else
  214. warn = false;
  215. }
  216. else if (currentNodeName == nnColorDiffuse)
  217. {
  218. if (warnColorDiffuse)
  219. warnColorDiffuse = false;
  220. else
  221. warn = false;
  222. }
  223. else if (currentNodeName == nnColorSpecular)
  224. {
  225. if (warnColorSpecular)
  226. warnColorSpecular = false;
  227. else
  228. warn = false;
  229. }
  230. if (warn)
  231. DefaultLogger::get()->warn(string("Vertex buffer attribute read not implemented for element: ") + currentNodeName);
  232. }
  233. // Advance
  234. NextNode(reader);
  235. currentNodeName = reader->getNodeName();
  236. }
  237. DefaultLogger::get()->debug(Formatter::format() <<
  238. " - Positions " << submesh.Positions.size() <<
  239. " Normals " << submesh.Normals.size() <<
  240. " TexCoords " << submesh.Uvs.size() <<
  241. " Tangents " << submesh.Tangents.size());
  242. // Sanity checks
  243. if (submesh.HasNormals && submesh.Normals.size() != numVertices)
  244. throw DeadlyImportError(Formatter::format() << "Read only " << submesh.Normals.size() << " normals when should have read " << numVertices);
  245. if (submesh.HasTangents && submesh.Tangents.size() != numVertices)
  246. throw DeadlyImportError(Formatter::format() << "Read only " << submesh.Tangents.size() << " tangents when should have read " << numVertices);
  247. for(unsigned int i=0; i<submesh.Uvs.size(); ++i)
  248. {
  249. if (submesh.Uvs[i].size() != numVertices)
  250. throw DeadlyImportError(Formatter::format() << "Read only " << submesh.Uvs[i].size()
  251. << " uvs for uv index " << i << " when should have read " << numVertices);
  252. }
  253. }
  254. void OgreImporter::ReadBoneWeights(SubMesh &submesh, XmlReader *reader)
  255. {
  256. submesh.Weights.resize(submesh.Positions.size());
  257. unsigned int numRead = 0;
  258. const string nnVertexBoneAssignment = "vertexboneassignment";
  259. NextNode(reader);
  260. while(CurrentNodeNameEquals(reader, nnVertexBoneAssignment))
  261. {
  262. numRead++;
  263. BoneWeight weight;
  264. weight.Id = GetAttribute<int>(reader, "boneindex");
  265. weight.Value = GetAttribute<float>(reader, "weight");
  266. //calculate the number of bones used (this is the highest id +1 becuase bone ids start at 0)
  267. /// @todo This can probably be refactored to something else.
  268. submesh.BonesUsed = max(submesh.BonesUsed, weight.Id+1);
  269. const unsigned int vertexId = GetAttribute<int>(reader, "vertexindex");
  270. submesh.Weights[vertexId].push_back(weight);
  271. NextNode(reader);
  272. }
  273. DefaultLogger::get()->debug(Formatter::format() << " - Bone weights " << numRead);
  274. }
  275. void OgreImporter::ProcessSubMesh(SubMesh &submesh, SubMesh &sharedGeometry)
  276. {
  277. // Make all vertexes unique. Required by Assimp.
  278. vector<Face> uniqueFaceList(submesh.Faces.size());
  279. unsigned int uniqueVertexCount = submesh.Faces.size() * 3;
  280. vector<aiVector3D> uniquePositions(uniqueVertexCount);
  281. vector<aiVector3D> uniqueNormals(uniqueVertexCount);
  282. vector<aiVector3D> uniqueTangents(uniqueVertexCount);
  283. vector<vector<BoneWeight> > uniqueWeights(uniqueVertexCount);
  284. vector<vector<aiVector3D> > uniqueUvs(submesh.UseSharedGeometry ? sharedGeometry.Uvs.size() : submesh.Uvs.size());
  285. for(size_t uvi=0; uvi<uniqueUvs.size(); ++uvi)
  286. uniqueUvs[uvi].resize(uniqueVertexCount);
  287. /* Support for shared geometry.
  288. We can use this loop to copy vertex informations from the shared data pool. In order to do so
  289. we just use a reference to a submodel instead of our submodel itself */
  290. SubMesh &vertexSource = (submesh.UseSharedGeometry ? sharedGeometry : submesh);
  291. if (submesh.UseSharedGeometry)
  292. {
  293. submesh.HasPositions = sharedGeometry.HasPositions;
  294. submesh.HasNormals = sharedGeometry.HasNormals;
  295. submesh.HasTangents = sharedGeometry.HasTangents;
  296. submesh.BonesUsed = sharedGeometry.BonesUsed;
  297. }
  298. for (size_t i=0, flen=submesh.Faces.size(); i<flen; ++i)
  299. {
  300. const Face &face = submesh.Faces[i];
  301. // We pre calculate the index values here,
  302. // because we need them in all vertex attributes.
  303. unsigned int v1 = face.VertexIndices[0];
  304. unsigned int v2 = face.VertexIndices[1];
  305. unsigned int v3 = face.VertexIndices[2];
  306. size_t pos = i*3;
  307. uniqueFaceList[i].VertexIndices[0] = pos;
  308. uniqueFaceList[i].VertexIndices[1] = pos + 1;
  309. uniqueFaceList[i].VertexIndices[2] = pos + 2;
  310. uniquePositions[pos] = vertexSource.Positions[v1];
  311. uniquePositions[pos+1] = vertexSource.Positions[v2];
  312. uniquePositions[pos+2] = vertexSource.Positions[v3];
  313. if (vertexSource.HasNormals)
  314. {
  315. uniqueNormals[pos ] = vertexSource.Normals[v1];
  316. uniqueNormals[pos+1] = vertexSource.Normals[v2];
  317. uniqueNormals[pos+2] = vertexSource.Normals[v3];
  318. }
  319. if (vertexSource.HasTangents)
  320. {
  321. uniqueTangents[pos] = vertexSource.Tangents[v1];
  322. uniqueTangents[pos+1] = vertexSource.Tangents[v2];
  323. uniqueTangents[pos+2] = vertexSource.Tangents[v3];
  324. }
  325. for(size_t uvi=0; uvi<uniqueUvs.size(); ++uvi)
  326. {
  327. const std::vector<aiVector3D> &uv = vertexSource.Uvs[uvi];
  328. uniqueUvs[uvi][pos] = uv[v1];
  329. uniqueUvs[uvi][pos+1] = uv[v2];
  330. uniqueUvs[uvi][pos+2] = uv[v3];
  331. }
  332. if (!vertexSource.Weights.empty())
  333. {
  334. uniqueWeights[pos] = vertexSource.Weights[v1];
  335. uniqueWeights[pos+1] = vertexSource.Weights[v2];
  336. uniqueWeights[pos+2] = vertexSource.Weights[v3];
  337. }
  338. }
  339. // Now we have the unique data, but want them in the SubMesh, so we swap all the containers.
  340. // If we don't have one of them, we just swap empty containers, so everything is ok.
  341. submesh.Faces.swap(uniqueFaceList);
  342. submesh.Positions.swap(uniquePositions);
  343. submesh.Normals.swap(uniqueNormals);
  344. submesh.Tangents.swap(uniqueTangents);
  345. submesh.Uvs.swap(uniqueUvs);
  346. submesh.Weights.swap(uniqueWeights);
  347. // Normalize bone weights
  348. // For example the Blender exporter doesn't care about whether the sum of all bone
  349. // weights for a single vertex equals 1 or not, so validate here.
  350. for(size_t vertexId=0, wlen=submesh.Weights.size(); vertexId<wlen; ++vertexId)
  351. {
  352. std::vector<BoneWeight> &weights = submesh.Weights[vertexId];
  353. float sum = 0.0f;
  354. for(size_t boneId=0, blen=weights.size(); boneId<blen; ++boneId)
  355. sum += weights[boneId].Value;
  356. //check if the sum is too far away from 1
  357. if ((sum < (1.0f - 0.05f)) || (sum > (1.0f + 0.05f)))
  358. for(size_t boneId=0, blen=weights.size(); boneId<blen; ++boneId)
  359. weights[boneId].Value /= sum;
  360. }
  361. }
  362. aiMesh *OgreImporter::CreateAssimpSubMesh(aiScene *pScene, const SubMesh& submesh, const vector<Bone>& bones) const
  363. {
  364. const size_t sizeVector3D = sizeof(aiVector3D);
  365. aiMesh *dest = new aiMesh();
  366. // Material
  367. dest->mMaterialIndex = submesh.MaterialIndex;
  368. // Positions
  369. dest->mVertices = new aiVector3D[submesh.Positions.size()];
  370. dest->mNumVertices = submesh.Positions.size();
  371. memcpy(dest->mVertices, &submesh.Positions[0], submesh.Positions.size() * sizeVector3D);
  372. // Normals
  373. if (submesh.HasNormals)
  374. {
  375. dest->mNormals = new aiVector3D[submesh.Normals.size()];
  376. memcpy(dest->mNormals, &submesh.Normals[0], submesh.Normals.size() * sizeVector3D);
  377. }
  378. // Tangents
  379. // Until we have support for bitangents, no tangents will be written
  380. /// @todo Investigate why the above?
  381. if (submesh.HasTangents)
  382. {
  383. DefaultLogger::get()->warn("Tangents found from Ogre mesh but writing to Assimp mesh not yet supported!");
  384. //dest->mTangents = new aiVector3D[submesh.Tangents.size()];
  385. //memcpy(dest->mTangents, &submesh.Tangents[0], submesh.Tangents.size() * sizeVector3D);
  386. }
  387. // UVs
  388. for (size_t i=0, len=submesh.Uvs.size(); i<len; ++i)
  389. {
  390. dest->mNumUVComponents[i] = 2;
  391. dest->mTextureCoords[i] = new aiVector3D[submesh.Uvs[i].size()];
  392. memcpy(dest->mTextureCoords[i], &(submesh.Uvs[i][0]), submesh.Uvs[i].size() * sizeVector3D);
  393. }
  394. // Bone weights. Convert internal vertex-to-bone mapping to bone-to-vertex.
  395. vector<vector<aiVertexWeight> > assimpWeights(submesh.BonesUsed);
  396. for(size_t vertexId=0, len=submesh.Weights.size(); vertexId<len; ++vertexId)
  397. {
  398. const vector<BoneWeight> &vertexWeights = submesh.Weights[vertexId];
  399. for (size_t boneId=0, len=vertexWeights.size(); boneId<len; ++boneId)
  400. {
  401. const BoneWeight &ogreWeight = vertexWeights[boneId];
  402. assimpWeights[ogreWeight.Id].push_back(aiVertexWeight(vertexId, ogreWeight.Value));
  403. }
  404. }
  405. // Bones.
  406. vector<aiBone*> assimpBones;
  407. assimpBones.reserve(submesh.BonesUsed);
  408. for(size_t boneId=0, len=submesh.BonesUsed; boneId<len; ++boneId)
  409. {
  410. const vector<aiVertexWeight> &boneWeights = assimpWeights[boneId];
  411. if (boneWeights.size() == 0)
  412. continue;
  413. // @note The bones list is sorted by id's, this was done in LoadSkeleton.
  414. aiBone *assimpBone = new aiBone();
  415. assimpBone->mName = bones[boneId].Name;
  416. assimpBone->mOffsetMatrix = bones[boneId].BoneToWorldSpace;
  417. assimpBone->mNumWeights = boneWeights.size();
  418. assimpBone->mWeights = new aiVertexWeight[boneWeights.size()];
  419. memcpy(assimpBone->mWeights, &boneWeights[0], boneWeights.size() * sizeof(aiVertexWeight));
  420. assimpBones.push_back(assimpBone);
  421. }
  422. if (!assimpBones.empty())
  423. {
  424. dest->mBones = new aiBone*[assimpBones.size()];
  425. dest->mNumBones = assimpBones.size();
  426. for(size_t i=0, len=assimpBones.size(); i<len; ++i)
  427. dest->mBones[i] = assimpBones[i];
  428. }
  429. // Faces
  430. dest->mFaces = new aiFace[submesh.Faces.size()];
  431. dest->mNumFaces = submesh.Faces.size();
  432. for(size_t i=0, len=submesh.Faces.size(); i<len; ++i)
  433. {
  434. dest->mFaces[i].mNumIndices = 3;
  435. dest->mFaces[i].mIndices = new unsigned int[3];
  436. const Face &f = submesh.Faces[i];
  437. dest->mFaces[i].mIndices[0] = f.VertexIndices[0];
  438. dest->mFaces[i].mIndices[1] = f.VertexIndices[1];
  439. dest->mFaces[i].mIndices[2] = f.VertexIndices[2];
  440. }
  441. return dest;
  442. }
  443. } // Ogre
  444. } // Assimp
  445. #endif // ASSIMP_BUILD_NO_OGRE_IMPORTER