MDCLoader.cpp 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463
  1. /*
  2. ---------------------------------------------------------------------------
  3. Open Asset Import Library (ASSIMP)
  4. ---------------------------------------------------------------------------
  5. Copyright (c) 2006-2008, ASSIMP Development 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 Development 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 Implementation of the MDC importer class */
  35. #include "AssimpPCH.h"
  36. // internal headers
  37. #include "MDCLoader.h"
  38. #include "MD3FileData.h"
  39. #include "MDCNormalTable.h" // shouldn't be included by other units
  40. using namespace Assimp;
  41. using namespace Assimp::MDC;
  42. // ------------------------------------------------------------------------------------------------
  43. void MDC::BuildVertex(const Frame& frame,
  44. const BaseVertex& bvert,
  45. const CompressedVertex& cvert,
  46. aiVector3D& vXYZOut,
  47. aiVector3D& vNorOut)
  48. {
  49. // compute the position
  50. const float xd = (cvert.xd - AI_MDC_CVERT_BIAS) * AI_MDC_DELTA_SCALING;
  51. const float yd = (cvert.yd - AI_MDC_CVERT_BIAS) * AI_MDC_DELTA_SCALING;
  52. const float zd = (cvert.zd - AI_MDC_CVERT_BIAS) * AI_MDC_DELTA_SCALING;
  53. vXYZOut.x = frame.localOrigin.x + AI_MDC_BASE_SCALING * (bvert.x + xd);
  54. vXYZOut.y = frame.localOrigin.y + AI_MDC_BASE_SCALING * (bvert.y + yd);
  55. vXYZOut.z = frame.localOrigin.z + AI_MDC_BASE_SCALING * (bvert.z + zd);
  56. // compute the normal vector .. ehm ... lookup it in the table :-)
  57. vNorOut.x = mdcNormals[cvert.nd][0];
  58. vNorOut.y = mdcNormals[cvert.nd][1];
  59. vNorOut.z = mdcNormals[cvert.nd][2];
  60. }
  61. // ------------------------------------------------------------------------------------------------
  62. // Constructor to be privately used by Importer
  63. MDCImporter::MDCImporter()
  64. {
  65. }
  66. // ------------------------------------------------------------------------------------------------
  67. // Destructor, private as well
  68. MDCImporter::~MDCImporter()
  69. {
  70. }
  71. // ------------------------------------------------------------------------------------------------
  72. // Returns whether the class can handle the format of the given file.
  73. bool MDCImporter::CanRead( const std::string& pFile, IOSystem* pIOHandler) const
  74. {
  75. // simple check of file extension is enough for the moment
  76. std::string::size_type pos = pFile.find_last_of('.');
  77. // no file extension - can't read
  78. if( pos == std::string::npos)
  79. return false;
  80. std::string extension = pFile.substr( pos);
  81. if (extension.length() < 4)return false;
  82. if (extension[0] != '.')return false;
  83. if( extension[1] != 'M' && extension[1] != 'm')return false;
  84. if( extension[2] != 'D' && extension[2] != 'd')return false;
  85. if( extension[3] != 'C' && extension[3] != 'c')return false;
  86. return true;
  87. }
  88. // ------------------------------------------------------------------------------------------------
  89. // Validate the header of the given MDC file
  90. void MDCImporter::ValidateHeader()
  91. {
  92. AI_SWAP4( this->pcHeader->ulVersion );
  93. AI_SWAP4( this->pcHeader->ulFlags );
  94. AI_SWAP4( this->pcHeader->ulNumFrames );
  95. AI_SWAP4( this->pcHeader->ulNumTags );
  96. AI_SWAP4( this->pcHeader->ulNumSurfaces );
  97. AI_SWAP4( this->pcHeader->ulNumSkins );
  98. AI_SWAP4( this->pcHeader->ulOffsetBorderFrames );
  99. if (pcHeader->ulIdent != AI_MDC_MAGIC_NUMBER_BE &&
  100. pcHeader->ulIdent != AI_MDC_MAGIC_NUMBER_LE)
  101. {
  102. char szBuffer[5];
  103. szBuffer[0] = ((char*)&pcHeader->ulIdent)[0];
  104. szBuffer[1] = ((char*)&pcHeader->ulIdent)[1];
  105. szBuffer[2] = ((char*)&pcHeader->ulIdent)[2];
  106. szBuffer[3] = ((char*)&pcHeader->ulIdent)[3];
  107. szBuffer[4] = '\0';
  108. throw new ImportErrorException("Invalid MDC magic word: should be IDPC, the "
  109. "magic word found is " + std::string( szBuffer ));
  110. }
  111. if (pcHeader->ulVersion != AI_MDC_VERSION)
  112. DefaultLogger::get()->warn("Unsupported MDC file version (2 (AI_MDC_VERSION) was expected)");
  113. if (pcHeader->ulOffsetBorderFrames + pcHeader->ulNumFrames * sizeof(MDC::Frame) > this->fileSize ||
  114. pcHeader->ulOffsetSurfaces + pcHeader->ulNumSurfaces * sizeof(MDC::Surface) > this->fileSize)
  115. {
  116. throw new ImportErrorException("Some of the offset values in the MDC header are invalid "
  117. "and point to something behind the file.");
  118. }
  119. if (this->configFrameID >= this->pcHeader->ulNumFrames)
  120. throw new ImportErrorException("The requested frame is not available");
  121. }
  122. // ------------------------------------------------------------------------------------------------
  123. // Validate the header of a given MDC file surface
  124. void MDCImporter::ValidateSurfaceHeader(BE_NCONST MDC::Surface* pcSurf)
  125. {
  126. AI_SWAP4(pcSurf->ulFlags);
  127. AI_SWAP4(pcSurf->ulNumCompFrames);
  128. AI_SWAP4(pcSurf->ulNumBaseFrames);
  129. AI_SWAP4(pcSurf->ulNumShaders);
  130. AI_SWAP4(pcSurf->ulNumVertices);
  131. AI_SWAP4(pcSurf->ulNumTriangles);
  132. AI_SWAP4(pcSurf->ulOffsetTriangles);
  133. AI_SWAP4(pcSurf->ulOffsetTexCoords);
  134. AI_SWAP4(pcSurf->ulOffsetBaseVerts);
  135. AI_SWAP4(pcSurf->ulOffsetCompVerts);
  136. AI_SWAP4(pcSurf->ulOffsetFrameBaseFrames);
  137. AI_SWAP4(pcSurf->ulOffsetFrameCompFrames);
  138. AI_SWAP4(pcSurf->ulOffsetEnd);
  139. const unsigned int iMax = this->fileSize - (unsigned int)((int8_t*)pcSurf-(int8_t*)pcHeader);
  140. if (pcSurf->ulOffsetBaseVerts + pcSurf->ulNumVertices * sizeof(MDC::BaseVertex) > iMax ||
  141. (pcSurf->ulNumCompFrames && pcSurf->ulOffsetCompVerts + pcSurf->ulNumVertices * sizeof(MDC::CompressedVertex) > iMax) ||
  142. pcSurf->ulOffsetTriangles + pcSurf->ulNumTriangles * sizeof(MDC::Triangle) > iMax ||
  143. pcSurf->ulOffsetTexCoords + pcSurf->ulNumVertices * sizeof(MDC::TexturCoord) > iMax ||
  144. pcSurf->ulOffsetShaders + pcSurf->ulNumShaders * sizeof(MDC::Shader) > iMax ||
  145. pcSurf->ulOffsetFrameBaseFrames + pcSurf->ulNumBaseFrames * 2 > iMax ||
  146. (pcSurf->ulNumCompFrames && pcSurf->ulOffsetFrameCompFrames + pcSurf->ulNumCompFrames * 2 > iMax))
  147. {
  148. throw new ImportErrorException("Some of the offset values in the MDC surface header "
  149. "are invalid and point somewhere behind the file.");
  150. }
  151. }
  152. // ------------------------------------------------------------------------------------------------
  153. // Setup configuration properties
  154. void MDCImporter::SetupProperties(const Importer* pImp)
  155. {
  156. // The AI_CONFIG_IMPORT_MDC_KEYFRAME option overrides the
  157. // AI_CONFIG_IMPORT_GLOBAL_KEYFRAME option.
  158. if(0xffffffff == (this->configFrameID = pImp->GetPropertyInteger(
  159. AI_CONFIG_IMPORT_MDC_KEYFRAME,0xffffffff)))
  160. {
  161. this->configFrameID = pImp->GetPropertyInteger(AI_CONFIG_IMPORT_GLOBAL_KEYFRAME,0);
  162. }
  163. }
  164. // ------------------------------------------------------------------------------------------------
  165. // Imports the given file into the given scene structure.
  166. void MDCImporter::InternReadFile(
  167. const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler)
  168. {
  169. boost::scoped_ptr<IOStream> file( pIOHandler->Open( pFile));
  170. // Check whether we can read from the file
  171. if( file.get() == NULL)
  172. throw new ImportErrorException( "Failed to open MDC file " + pFile + ".");
  173. // check whether the mdc file is large enough to contain the file header
  174. fileSize = (unsigned int)file->FileSize();
  175. if( fileSize < sizeof(MDC::Header))
  176. throw new ImportErrorException( "MDC File is too small.");
  177. std::vector<unsigned char> mBuffer2(fileSize);
  178. file->Read( &mBuffer2[0], 1, fileSize);
  179. mBuffer = &mBuffer2[0];
  180. // validate the file header
  181. this->pcHeader = (BE_NCONST MDC::Header*)this->mBuffer;
  182. this->ValidateHeader();
  183. std::vector<std::string> aszShaders;
  184. // get a pointer to the frame we want to read
  185. BE_NCONST MDC::Frame* pcFrame = (BE_NCONST MDC::Frame*)(this->mBuffer+
  186. this->pcHeader->ulOffsetBorderFrames);
  187. // no need to swap the other members, we won't need them
  188. pcFrame += configFrameID;
  189. AI_SWAP4( pcFrame->localOrigin[0] );
  190. AI_SWAP4( pcFrame->localOrigin[1] );
  191. AI_SWAP4( pcFrame->localOrigin[2] );
  192. // get the number of valid surfaces
  193. BE_NCONST MDC::Surface* pcSurface, *pcSurface2;
  194. pcSurface = pcSurface2 = (BE_NCONST MDC::Surface*)(mBuffer + pcHeader->ulOffsetSurfaces);
  195. unsigned int iNumShaders = 0;
  196. for (unsigned int i = 0; i < pcHeader->ulNumSurfaces;++i)
  197. {
  198. // validate the surface header
  199. this->ValidateSurfaceHeader(pcSurface2);
  200. if (pcSurface2->ulNumVertices && pcSurface2->ulNumTriangles)++pScene->mNumMeshes;
  201. iNumShaders += pcSurface2->ulNumShaders;
  202. pcSurface2 = (BE_NCONST MDC::Surface*)((int8_t*)pcSurface2 + pcSurface2->ulOffsetEnd);
  203. }
  204. aszShaders.reserve(iNumShaders);
  205. pScene->mMeshes = new aiMesh*[pScene->mNumMeshes];
  206. // necessary that we don't crash if an exception occurs
  207. for (unsigned int i = 0; i < pScene->mNumMeshes;++i)
  208. pScene->mMeshes[i] = NULL;
  209. // now read all surfaces
  210. unsigned int iDefaultMatIndex = 0xffffffff;
  211. for (unsigned int i = 0, iNum = 0; i < pcHeader->ulNumSurfaces;++i)
  212. {
  213. if (!pcSurface->ulNumVertices || !pcSurface->ulNumTriangles)continue;
  214. aiMesh* pcMesh = pScene->mMeshes[iNum++] = new aiMesh();
  215. pcMesh->mNumFaces = pcSurface->ulNumTriangles;
  216. pcMesh->mNumVertices = pcMesh->mNumFaces * 3;
  217. // store the name of the surface for use as node name.
  218. // FIX: make sure there is a 0 termination
  219. const_cast<char&>(pcSurface->ucName[AI_MDC_MAXQPATH-1]) = '\0';
  220. pcMesh->mTextureCoords[3] = (aiVector3D*)pcSurface->ucName;
  221. // go to the first shader in the file. ignore the others.
  222. if (pcSurface->ulNumShaders)
  223. {
  224. const MDC::Shader* pcShader = (const MDC::Shader*)((int8_t*)pcSurface + pcSurface->ulOffsetShaders);
  225. pcMesh->mMaterialIndex = (unsigned int)aszShaders.size();
  226. // create a new shader
  227. aszShaders.push_back(std::string( pcShader->ucName, std::min(
  228. ::strlen(pcShader->ucName),sizeof(pcShader->ucName)) ));
  229. }
  230. // need to create a default material
  231. else if (0xffffffff == iDefaultMatIndex)
  232. {
  233. pcMesh->mMaterialIndex = iDefaultMatIndex = (unsigned int)aszShaders.size();
  234. aszShaders.push_back(std::string());
  235. }
  236. // otherwise assign a reference to the default material
  237. else pcMesh->mMaterialIndex = iDefaultMatIndex;
  238. // allocate output storage for the mesh
  239. aiVector3D* pcVertCur = pcMesh->mVertices = new aiVector3D[pcMesh->mNumVertices];
  240. aiVector3D* pcNorCur = pcMesh->mNormals = new aiVector3D[pcMesh->mNumVertices];
  241. aiVector3D* pcUVCur = pcMesh->mTextureCoords[0] = new aiVector3D[pcMesh->mNumVertices];
  242. aiFace* pcFaceCur = pcMesh->mFaces = new aiFace[pcMesh->mNumFaces];
  243. // create all vertices/faces
  244. BE_NCONST MDC::Triangle* pcTriangle = (BE_NCONST MDC::Triangle*)
  245. ((int8_t*)pcSurface+pcSurface->ulOffsetTriangles);
  246. BE_NCONST MDC::TexturCoord* const pcUVs = (BE_NCONST MDC::TexturCoord*)
  247. ((int8_t*)pcSurface+pcSurface->ulOffsetTexCoords);
  248. // get a pointer to the uncompressed vertices
  249. int16_t iOfs = *((int16_t*) ((int8_t*) pcSurface +
  250. pcSurface->ulOffsetFrameBaseFrames) + this->configFrameID);
  251. AI_SWAP2(iOfs);
  252. BE_NCONST MDC::BaseVertex* const pcVerts = (BE_NCONST MDC::BaseVertex*)
  253. ((int8_t*)pcSurface+pcSurface->ulOffsetBaseVerts) +
  254. ((int)iOfs * pcSurface->ulNumVertices * 4);
  255. // do the main swapping stuff ...
  256. #if (defined AI_BUILD_BIG_ENDIAN)
  257. // swap all triangles
  258. for (unsigned int i = 0; i < pcSurface->ulNumTriangles;++i)
  259. {
  260. AI_SWAP4( pcTriangle[i].aiIndices[0] );
  261. AI_SWAP4( pcTriangle[i].aiIndices[1] );
  262. AI_SWAP4( pcTriangle[i].aiIndices[2] );
  263. }
  264. // swap all vertices
  265. for (unsigned int i = 0; i < pcSurface->ulNumVertices*pcSurface->ulNumBaseFrames;++i)
  266. {
  267. AI_SWAP2( pcVerts->normal );
  268. AI_SWAP2( pcVerts->x );
  269. AI_SWAP2( pcVerts->y );
  270. AI_SWAP2( pcVerts->z );
  271. }
  272. // swap all texture coordinates
  273. for (unsigned int i = 0; i < pcSurface->ulNumVertices;++i)
  274. {
  275. AI_SWAP4( pcUVs->v );
  276. AI_SWAP4( pcUVs->v );
  277. }
  278. #endif
  279. const MDC::CompressedVertex* pcCVerts = NULL;
  280. int16_t* mdcCompVert = NULL;
  281. // access compressed frames for large frame numbers, but never for the first
  282. if( this->configFrameID && pcSurface->ulNumCompFrames > 0 )
  283. {
  284. mdcCompVert = (int16_t*) ((int8_t*)pcSurface+pcSurface->ulOffsetFrameCompFrames) + this->configFrameID;
  285. AI_SWAP2P(mdcCompVert);
  286. if( *mdcCompVert >= 0 )
  287. {
  288. pcCVerts = (const MDC::CompressedVertex*)((int8_t*)pcSurface +
  289. pcSurface->ulOffsetCompVerts) + *mdcCompVert * pcSurface->ulNumVertices;
  290. }
  291. else mdcCompVert = NULL;
  292. }
  293. // copy all faces
  294. for (unsigned int iFace = 0; iFace < pcSurface->ulNumTriangles;++iFace,
  295. ++pcTriangle,++pcFaceCur)
  296. {
  297. const unsigned int iOutIndex = iFace*3;
  298. pcFaceCur->mNumIndices = 3;
  299. pcFaceCur->mIndices = new unsigned int[3];
  300. for (unsigned int iIndex = 0; iIndex < 3;++iIndex,
  301. ++pcVertCur,++pcUVCur,++pcNorCur)
  302. {
  303. uint32_t quak = pcTriangle->aiIndices[iIndex];
  304. if (quak >= pcSurface->ulNumVertices)
  305. {
  306. DefaultLogger::get()->error("MDC vertex index is out of range");
  307. quak = pcSurface->ulNumVertices-1;
  308. }
  309. // compressed vertices?
  310. if (mdcCompVert)
  311. {
  312. MDC::BuildVertex(*pcFrame,pcVerts[quak],pcCVerts[quak],
  313. *pcVertCur,*pcNorCur);
  314. }
  315. else
  316. {
  317. // copy position
  318. pcVertCur->x = pcVerts[quak].x * AI_MDC_BASE_SCALING;
  319. pcVertCur->y = pcVerts[quak].y * AI_MDC_BASE_SCALING;
  320. pcVertCur->z = pcVerts[quak].z * AI_MDC_BASE_SCALING;
  321. // copy normals
  322. MD3::LatLngNormalToVec3( pcVerts[quak].normal, &pcNorCur->x );
  323. // copy texture coordinates
  324. pcUVCur->x = pcUVs[quak].u;
  325. pcUVCur->y = 1.0f-pcUVs[quak].v; // DX to OGL
  326. }
  327. pcVertCur->x += pcFrame->localOrigin[0] ;
  328. pcVertCur->y += pcFrame->localOrigin[1] ;
  329. pcVertCur->z += pcFrame->localOrigin[2] ;
  330. }
  331. // swap the face order - DX to OGL
  332. pcFaceCur->mIndices[0] = iOutIndex + 2;
  333. pcFaceCur->mIndices[1] = iOutIndex + 1;
  334. pcFaceCur->mIndices[2] = iOutIndex + 0;
  335. }
  336. pcSurface = (BE_NCONST MDC::Surface*)((int8_t*)pcSurface + pcSurface->ulOffsetEnd);
  337. }
  338. // create a flat node graph with a root node and one child for each surface
  339. if (!pScene->mNumMeshes)
  340. throw new ImportErrorException( "Invalid MDC file: File contains no valid mesh");
  341. else if (1 == pScene->mNumMeshes)
  342. {
  343. pScene->mRootNode = new aiNode();
  344. pScene->mRootNode->mName.Set(std::string((const char*)pScene->mMeshes[0]->mTextureCoords[3]));
  345. pScene->mRootNode->mNumMeshes = 1;
  346. pScene->mRootNode->mMeshes = new unsigned int[1];
  347. pScene->mRootNode->mMeshes[0] = 0;
  348. }
  349. else
  350. {
  351. pScene->mRootNode = new aiNode();
  352. pScene->mRootNode->mNumChildren = pScene->mNumMeshes;
  353. pScene->mRootNode->mChildren = new aiNode*[pScene->mNumMeshes];
  354. pScene->mRootNode->mName.Set("<root>");
  355. for (unsigned int i = 0; i < pScene->mNumMeshes;++i)
  356. {
  357. aiNode* pcNode = pScene->mRootNode->mChildren[i] = new aiNode();
  358. pcNode->mParent = pScene->mRootNode;
  359. pcNode->mName.Set(std::string((const char*)pScene->mMeshes[i]->mTextureCoords[3]));
  360. pcNode->mNumMeshes = 1;
  361. pcNode->mMeshes = new unsigned int[1];
  362. pcNode->mMeshes[0] = i;
  363. }
  364. }
  365. // make sure we invalidate the pointer to the mesh name
  366. for (unsigned int i = 0; i < pScene->mNumMeshes;++i)
  367. pScene->mMeshes[i]->mTextureCoords[3] = NULL;
  368. // create materials
  369. pScene->mNumMaterials = (unsigned int)aszShaders.size();
  370. pScene->mMaterials = new aiMaterial*[pScene->mNumMaterials];
  371. for (unsigned int i = 0; i < pScene->mNumMaterials;++i)
  372. {
  373. MaterialHelper* pcMat = new MaterialHelper();
  374. pScene->mMaterials[i] = pcMat;
  375. const std::string& name = aszShaders[i];
  376. int iMode = (int)aiShadingMode_Gouraud;
  377. pcMat->AddProperty<int>(&iMode, 1, AI_MATKEY_SHADING_MODEL);
  378. // add a small ambient color value - RtCW seems to have one
  379. aiColor3D clr;
  380. clr.b = clr.g = clr.r = 0.05f;
  381. pcMat->AddProperty<aiColor3D>(&clr, 1,AI_MATKEY_COLOR_AMBIENT);
  382. if (name.length())clr.b = clr.g = clr.r = 1.0f;
  383. else clr.b = clr.g = clr.r = 0.6f;
  384. pcMat->AddProperty<aiColor3D>(&clr, 1,AI_MATKEY_COLOR_DIFFUSE);
  385. pcMat->AddProperty<aiColor3D>(&clr, 1,AI_MATKEY_COLOR_SPECULAR);
  386. if (name.length())
  387. {
  388. aiString path;
  389. path.Set(name);
  390. pcMat->AddProperty(&path,AI_MATKEY_TEXTURE_DIFFUSE(0));
  391. }
  392. }
  393. }