2
0

MDCLoader.cpp 17 KB

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