TextureTransform.cpp 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576
  1. /*
  2. Open Asset Import Library (ASSIMP)
  3. ----------------------------------------------------------------------
  4. Copyright (c) 2006-2008, ASSIMP Development 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 Development 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. /** @file A helper class that processes texture transformations */
  34. #include "AssimpPCH.h"
  35. #include "TextureTransform.h"
  36. namespace Assimp
  37. {
  38. // ------------------------------------------------------------------------------------------------
  39. void TextureTransform::PreProcessUVTransform(
  40. D3DS::Texture& rcIn)
  41. {
  42. char szTemp[512];
  43. int iField;
  44. if (rcIn.mOffsetU)
  45. {
  46. if ((iField = (int)rcIn.mOffsetU))
  47. {
  48. if (aiTextureMapMode_Wrap == rcIn.mMapMode)
  49. {
  50. float fNew = rcIn.mOffsetU-(float)iField;
  51. sprintf(szTemp,"[wrap] Found texture coordinate U offset %f. "
  52. "This can be optimized to %f",rcIn.mOffsetU,fNew);
  53. DefaultLogger::get()->info(szTemp);
  54. rcIn.mOffsetU = fNew;
  55. }
  56. else if (aiTextureMapMode_Mirror == rcIn.mMapMode)
  57. {
  58. if (0 != (iField % 2))iField--;
  59. float fNew = rcIn.mOffsetU-(float)iField;
  60. sprintf(szTemp,"[mirror] Found texture coordinate U offset %f. "
  61. "This can be optimized to %f",rcIn.mOffsetU,fNew);
  62. DefaultLogger::get()->info(szTemp);
  63. rcIn.mOffsetU = fNew;
  64. }
  65. else if (aiTextureMapMode_Clamp == rcIn.mMapMode)
  66. {
  67. sprintf(szTemp,"[clamp] Found texture coordinate U offset %f. "
  68. "This can be clamped to 1.0f",rcIn.mOffsetU);
  69. DefaultLogger::get()->info(szTemp);
  70. rcIn.mOffsetU = 1.0f;
  71. }
  72. }
  73. }
  74. if (rcIn.mOffsetV)
  75. {
  76. if ((iField = (int)rcIn.mOffsetV))
  77. {
  78. if (aiTextureMapMode_Wrap == rcIn.mMapMode)
  79. {
  80. float fNew = rcIn.mOffsetV-(float)iField;
  81. sprintf(szTemp,"[wrap] Found texture coordinate V offset %f. "
  82. "This can be optimized to %f",rcIn.mOffsetV,fNew);
  83. DefaultLogger::get()->info(szTemp);
  84. rcIn.mOffsetV = fNew;
  85. }
  86. else if (aiTextureMapMode_Mirror == rcIn.mMapMode)
  87. {
  88. if (0 != (iField % 2))iField--;
  89. float fNew = rcIn.mOffsetV-(float)iField;
  90. sprintf(szTemp,"[mirror] Found texture coordinate V offset %f. "
  91. "This can be optimized to %f",rcIn.mOffsetV,fNew);
  92. DefaultLogger::get()->info(szTemp);
  93. rcIn.mOffsetV = fNew;
  94. }
  95. else if (aiTextureMapMode_Clamp == rcIn.mMapMode)
  96. {
  97. sprintf(szTemp,"[clamp] Found texture coordinate U offset %f. "
  98. "This can be clamped to 1.0f",rcIn.mOffsetV);
  99. DefaultLogger::get()->info(szTemp);
  100. rcIn.mOffsetV = 1.0f;
  101. }
  102. }
  103. }
  104. if (rcIn.mRotation)
  105. {
  106. if ((iField = (int)(rcIn.mRotation / 3.141592654f)))
  107. {
  108. float fNew = rcIn.mRotation-(float)iField*3.141592654f;
  109. sprintf(szTemp,"[wrap] Found texture coordinate rotation %f. "
  110. "This can be optimized to %f",rcIn.mRotation,fNew);
  111. DefaultLogger::get()->info(szTemp);
  112. rcIn.mRotation = fNew;
  113. }
  114. }
  115. return;
  116. }
  117. // ------------------------------------------------------------------------------------------------
  118. void TextureTransform::AddToList(std::vector<STransformVecInfo>& rasVec,
  119. D3DS::Texture* pcTex)
  120. {
  121. // check whether the texture is existing
  122. if (0 == pcTex->mMapName.length())return;
  123. // search for an identical transformation in our list
  124. for (std::vector<STransformVecInfo>::iterator
  125. i = rasVec.begin();
  126. i != rasVec.end();++i)
  127. {
  128. if ((*i).fOffsetU == pcTex->mOffsetU &&
  129. (*i).fOffsetV == pcTex->mOffsetV &&
  130. (*i).fScaleU == pcTex->mScaleU &&
  131. (*i).fScaleV == pcTex->mScaleV &&
  132. (*i).fRotation == pcTex->mRotation &&
  133. (*i).iUVIndex == (unsigned int)pcTex->iUVSrc)
  134. {
  135. (*i).pcTextures.push_back(pcTex);
  136. return;
  137. }
  138. }
  139. // this is a new transformation, so add it to the list
  140. STransformVecInfo sInfo;
  141. sInfo.fScaleU = pcTex->mScaleU;
  142. sInfo.fScaleV = pcTex->mScaleV;
  143. sInfo.fOffsetU = pcTex->mOffsetU;
  144. sInfo.fOffsetV = pcTex->mOffsetV;
  145. sInfo.fRotation = pcTex->mRotation;
  146. sInfo.iUVIndex = pcTex->iUVSrc;
  147. // add the texture to the list
  148. sInfo.pcTextures.push_back(pcTex);
  149. // and add the transformation itself to the second list
  150. rasVec.push_back(sInfo);
  151. }
  152. // ------------------------------------------------------------------------------------------------
  153. void TextureTransform::ApplyScaleNOffset(D3DS::Material& material)
  154. {
  155. unsigned int iCnt = 0;
  156. D3DS::Texture* pcTexture = NULL;
  157. // diffuse texture
  158. if (material.sTexDiffuse.mMapName.length())
  159. {
  160. PreProcessUVTransform(material.sTexDiffuse);
  161. if (HasUVTransform(material.sTexDiffuse))
  162. {
  163. material.sTexDiffuse.bPrivate = true;
  164. pcTexture = &material.sTexDiffuse;
  165. ++iCnt;
  166. }
  167. }
  168. // specular texture
  169. if (material.sTexSpecular.mMapName.length())
  170. {
  171. PreProcessUVTransform(material.sTexSpecular);
  172. if (HasUVTransform(material.sTexSpecular))
  173. {
  174. material.sTexSpecular.bPrivate = true;
  175. pcTexture = &material.sTexSpecular;
  176. ++iCnt;
  177. }
  178. }
  179. // ambient texture
  180. if (material.sTexAmbient.mMapName.length())
  181. {
  182. PreProcessUVTransform(material.sTexAmbient);
  183. if (HasUVTransform(material.sTexAmbient))
  184. {
  185. material.sTexAmbient.bPrivate = true;
  186. pcTexture = &material.sTexAmbient;
  187. ++iCnt;
  188. }
  189. }
  190. // emissive texture
  191. if (material.sTexEmissive.mMapName.length())
  192. {
  193. PreProcessUVTransform(material.sTexEmissive);
  194. if (HasUVTransform(material.sTexEmissive))
  195. {
  196. material.sTexEmissive.bPrivate = true;
  197. pcTexture = &material.sTexEmissive;
  198. ++iCnt;
  199. }
  200. }
  201. // opacity texture
  202. if (material.sTexOpacity.mMapName.length())
  203. {
  204. PreProcessUVTransform(material.sTexOpacity);
  205. if (HasUVTransform(material.sTexOpacity))
  206. {
  207. material.sTexOpacity.bPrivate = true;
  208. pcTexture = &material.sTexOpacity;
  209. ++iCnt;
  210. }
  211. }
  212. // bump texture
  213. if (material.sTexBump.mMapName.length())
  214. {
  215. PreProcessUVTransform(material.sTexBump);
  216. if (HasUVTransform(material.sTexBump))
  217. {
  218. material.sTexBump.bPrivate = true;
  219. pcTexture = &material.sTexBump;
  220. ++iCnt;
  221. }
  222. }
  223. // shininess texture
  224. if (material.sTexShininess.mMapName.length())
  225. {
  226. PreProcessUVTransform(material.sTexShininess);
  227. if (HasUVTransform(material.sTexShininess))
  228. {
  229. material.sTexBump.bPrivate = true;
  230. pcTexture = &material.sTexShininess;
  231. ++iCnt;
  232. }
  233. }
  234. if (0 != iCnt)
  235. {
  236. // if only one texture needs scaling/offset operations
  237. // we can apply them directly to the first texture
  238. // coordinate sets of all meshes referencing *this* material
  239. // However, we can't do it now. We need to wait until
  240. // everything is sorted by materials.
  241. if (1 == iCnt && 0 == pcTexture->iUVSrc)
  242. {
  243. material.iBakeUVTransform = 1;
  244. material.pcSingleTexture = pcTexture;
  245. }
  246. // we will need to generate a separate new texture channel
  247. // for each texture.
  248. // However, we can't do it now. We need to wait until
  249. // everything is sorted by materials.
  250. else material.iBakeUVTransform = 2;
  251. }
  252. }
  253. // ------------------------------------------------------------------------------------------------
  254. void TextureTransform::ApplyScaleNOffset(std::vector<D3DS::Material>& materials)
  255. {
  256. unsigned int iNum = 0;
  257. for (std::vector<D3DS::Material>::iterator
  258. i = materials.begin();
  259. i != materials.end();++i,++iNum)
  260. {
  261. ApplyScaleNOffset(*i);
  262. }
  263. return;
  264. }
  265. // ------------------------------------------------------------------------------------------------
  266. void TextureTransform::BakeScaleNOffset(
  267. aiMesh* pcMesh, D3DS::Material* pcSrc)
  268. {
  269. // NOTE: we don't use a texture matrix to do the transformation
  270. // it is more efficient this way ...
  271. if (!pcMesh->mTextureCoords[0])return;
  272. if (0x1 == pcSrc->iBakeUVTransform)
  273. {
  274. char szTemp[512];
  275. int iLen;
  276. #if _MSC_VER >= 1400
  277. iLen = ::sprintf_s(szTemp,
  278. #else
  279. iLen = ::sprintf(szTemp,
  280. #endif
  281. "Transforming existing UV channel. Source UV: %i"
  282. " OffsetU: %f"
  283. " OffsetV: %f"
  284. " ScaleU: %f"
  285. " ScaleV: %f"
  286. " Rotation (rad): %f",0,
  287. pcSrc->pcSingleTexture->mOffsetU,
  288. pcSrc->pcSingleTexture->mOffsetV,
  289. pcSrc->pcSingleTexture->mScaleU,
  290. pcSrc->pcSingleTexture->mScaleV,
  291. pcSrc->pcSingleTexture->mRotation);
  292. ai_assert(0 < iLen);
  293. DefaultLogger::get()->info(std::string(szTemp,iLen));
  294. if (!pcSrc->pcSingleTexture->mRotation)
  295. {
  296. for (unsigned int i = 0; i < pcMesh->mNumVertices;++i)
  297. {
  298. // scaling
  299. pcMesh->mTextureCoords[0][i].x *= pcSrc->pcSingleTexture->mScaleU;
  300. pcMesh->mTextureCoords[0][i].y *= pcSrc->pcSingleTexture->mScaleV;
  301. // offset
  302. pcMesh->mTextureCoords[0][i].x += pcSrc->pcSingleTexture->mOffsetU;
  303. pcMesh->mTextureCoords[0][i].y += pcSrc->pcSingleTexture->mOffsetV;
  304. }
  305. }
  306. else
  307. {
  308. const float fSin = sinf(pcSrc->pcSingleTexture->mRotation);
  309. const float fCos = cosf(pcSrc->pcSingleTexture->mRotation);
  310. for (unsigned int i = 0; i < pcMesh->mNumVertices;++i)
  311. {
  312. // scaling
  313. pcMesh->mTextureCoords[0][i].x *= pcSrc->pcSingleTexture->mScaleU;
  314. pcMesh->mTextureCoords[0][i].y *= pcSrc->pcSingleTexture->mScaleV;
  315. // rotation
  316. pcMesh->mTextureCoords[0][i].x *= fCos;
  317. pcMesh->mTextureCoords[0][i].y *= fSin;
  318. // offset
  319. pcMesh->mTextureCoords[0][i].x += pcSrc->pcSingleTexture->mOffsetU;
  320. pcMesh->mTextureCoords[0][i].y += pcSrc->pcSingleTexture->mOffsetV;
  321. }
  322. }
  323. }
  324. else if (0x2 == pcSrc->iBakeUVTransform)
  325. {
  326. // first save all texture coordinate sets
  327. aiVector3D* apvOriginalSets[AI_MAX_NUMBER_OF_TEXTURECOORDS];
  328. for (unsigned int i = 0; i < AI_MAX_NUMBER_OF_TEXTURECOORDS;++i)
  329. {
  330. apvOriginalSets[i] = pcMesh->mTextureCoords[i];
  331. }
  332. unsigned int iNextEmpty = 0;
  333. while (pcMesh->mTextureCoords[++iNextEmpty]);
  334. aiVector3D* apvOutputSets[AI_MAX_NUMBER_OF_TEXTURECOORDS];
  335. for (unsigned int i = 0; i < AI_MAX_NUMBER_OF_TEXTURECOORDS;++i)
  336. apvOutputSets[i] = NULL;
  337. // now we need to find all textures in the material
  338. // which require scaling/offset operations
  339. std::vector<STransformVecInfo> sOps;
  340. sOps.reserve(10);
  341. TextureTransform::AddToList(sOps,&pcSrc->sTexDiffuse);
  342. TextureTransform::AddToList(sOps,&pcSrc->sTexSpecular);
  343. TextureTransform::AddToList(sOps,&pcSrc->sTexEmissive);
  344. TextureTransform::AddToList(sOps,&pcSrc->sTexOpacity);
  345. TextureTransform::AddToList(sOps,&pcSrc->sTexBump);
  346. TextureTransform::AddToList(sOps,&pcSrc->sTexShininess);
  347. TextureTransform::AddToList(sOps,&pcSrc->sTexAmbient);
  348. // check the list and find out how many we won't be able
  349. // to generate.
  350. std::vector<STransformVecInfo*> sFilteredOps;
  351. unsigned int iNumUntransformed = 0;
  352. sFilteredOps.reserve(sOps.size());
  353. {
  354. std::vector<STransformVecInfo*> sWishList;
  355. sWishList.reserve(sOps.size());
  356. for (unsigned int iUV = 0; iUV < AI_MAX_NUMBER_OF_TEXTURECOORDS;++iUV)
  357. {
  358. for (std::vector<STransformVecInfo>::iterator
  359. i = sOps.begin();
  360. i != sOps.end();++i)
  361. {
  362. if (iUV != (*i).iUVIndex)continue;
  363. if ((*i).IsUntransformed())
  364. {
  365. sFilteredOps.push_back(&(*i));
  366. }
  367. else sWishList.push_back(&(*i));
  368. }
  369. }
  370. // are we able to generate all?
  371. const int iDiff = AI_MAX_NUMBER_OF_TEXTURECOORDS-(int)
  372. (sWishList.size()+sFilteredOps.size());
  373. iNumUntransformed = (unsigned int)sFilteredOps.size();
  374. if (0 >= iDiff)
  375. {
  376. DefaultLogger::get()->warn("There are too many combinations of different "
  377. "UV transformation operations to generate an own UV channel for each "
  378. "(maximum is AI_MAX_NUMBER_OF_TEXTURECOORDS = 4 or 6). "
  379. "An untransformed UV channel will be used for all remaining transformations");
  380. std::vector<STransformVecInfo*>::const_iterator nash = sWishList.begin();
  381. for (;nash != sWishList.end()-iDiff;++nash)
  382. {
  383. sFilteredOps.push_back(*nash);
  384. }
  385. }
  386. else
  387. {
  388. for (std::vector<STransformVecInfo*>::const_iterator
  389. nash = sWishList.begin();
  390. nash != sWishList.end();++nash)sFilteredOps.push_back(*nash);
  391. }
  392. }
  393. // now fill in all output IV indices
  394. unsigned int iNum = 0;
  395. for (std::vector<STransformVecInfo*>::iterator
  396. bogart = sFilteredOps.begin();
  397. bogart != sFilteredOps.end();++bogart,++iNum)
  398. {
  399. (**bogart).iUVIndex = iNum;
  400. }
  401. iNum = 0;
  402. for (; iNum < iNumUntransformed; ++iNum)
  403. pcMesh->mTextureCoords[iNum] = apvOriginalSets[iNum];
  404. // now generate the texture coordinate sets
  405. for (std::vector<STransformVecInfo*>::iterator
  406. i = sFilteredOps.begin()+iNumUntransformed;
  407. i != sFilteredOps.end();++i,++iNum)
  408. {
  409. const aiVector3D* _pvBase = apvOriginalSets[(**i).iUVIndex];
  410. aiVector3D* _pvOut = new aiVector3D[pcMesh->mNumVertices];
  411. pcMesh->mTextureCoords[iNum] = _pvOut;
  412. char szTemp[512];
  413. int iLen;
  414. #if _MSC_VER >= 1400
  415. iLen = ::sprintf_s(szTemp,
  416. #else
  417. iLen = ::sprintf(szTemp,
  418. #endif
  419. "Generating additional UV channel. Source UV: %i"
  420. " OffsetU: %f"
  421. " OffsetV: %f"
  422. " ScaleU: %f"
  423. " ScaleV: %f"
  424. " Rotation (rad): %f",0,
  425. (**i).fOffsetU,
  426. (**i).fOffsetV,
  427. (**i).fScaleU,
  428. (**i).fScaleV,
  429. (**i).fRotation);
  430. ai_assert(0 < iLen);
  431. DefaultLogger::get()->info(std::string(szTemp,iLen));
  432. const aiVector3D* pvBase = _pvBase;
  433. aiVector3D* pvOut = _pvOut;
  434. if (0.0f == (**i).fRotation)
  435. {
  436. for (unsigned int n = 0; n < pcMesh->mNumVertices;++n)
  437. {
  438. // scaling
  439. pvOut->x = pvBase->x * (**i).fScaleU;
  440. pvOut->y = pvBase->y * (**i).fScaleV;
  441. // offset
  442. pvOut->x += (**i).fOffsetU;
  443. pvOut->y += (**i).fOffsetV;
  444. pvBase++;
  445. pvOut++;
  446. }
  447. }
  448. else
  449. {
  450. const float fSin = sinf((**i).fRotation);
  451. const float fCos = cosf((**i).fRotation);
  452. for (unsigned int n = 0; n < pcMesh->mNumVertices;++n)
  453. {
  454. // scaling
  455. pvOut->x = pvBase->x * (**i).fScaleU;
  456. pvOut->y = pvBase->y * (**i).fScaleV;
  457. // rotation
  458. pvOut->x *= fCos;
  459. pvOut->y *= fSin;
  460. // offset
  461. pvOut->x += (**i).fOffsetU;
  462. pvOut->y += (**i).fOffsetV;
  463. pvBase++;
  464. pvOut++;
  465. }
  466. }
  467. }
  468. // now check which source texture coordinate sets
  469. // can be deleted because they're not anymore required
  470. for (iNum = 0; iNum < AI_MAX_NUMBER_OF_TEXTURECOORDS;++iNum)
  471. {
  472. for (unsigned int z = 0; z < iNumUntransformed;++z)
  473. {
  474. if (apvOriginalSets[iNum] == pcMesh->mTextureCoords[z])
  475. {
  476. apvOriginalSets[iNum] = NULL;
  477. break;
  478. }
  479. }
  480. if (apvOriginalSets[iNum])delete[] apvOriginalSets[iNum];
  481. }
  482. }
  483. // setup bitflags to indicate which texture coordinate
  484. // channels are used (this class works for 2d texture coordinates only)
  485. unsigned int iIndex = 0;
  486. while (pcMesh->HasTextureCoords(iIndex))pcMesh->mNumUVComponents[iIndex++] = 2;
  487. return;
  488. }
  489. // ------------------------------------------------------------------------------------------------
  490. void TextureTransform::SetupMatUVSrc (aiMaterial* pcMat, const D3DS::Material* pcMatIn)
  491. {
  492. ai_assert(NULL != pcMat);
  493. ai_assert(NULL != pcMatIn);
  494. MaterialHelper* pcHelper = (MaterialHelper*)pcMat;
  495. if(pcMatIn->sTexDiffuse.mMapName.length() > 0)
  496. pcHelper->AddProperty<int>(&pcMatIn->sTexDiffuse.iUVSrc,1,
  497. AI_MATKEY_UVWSRC_DIFFUSE(0));
  498. if(pcMatIn->sTexSpecular.mMapName.length() > 0)
  499. pcHelper->AddProperty<int>(&pcMatIn->sTexSpecular.iUVSrc,1,
  500. AI_MATKEY_UVWSRC_SPECULAR(0));
  501. if(pcMatIn->sTexEmissive.mMapName.length() > 0)
  502. pcHelper->AddProperty<int>(&pcMatIn->sTexEmissive.iUVSrc,1,
  503. AI_MATKEY_UVWSRC_EMISSIVE(0));
  504. if(pcMatIn->sTexBump.mMapName.length() > 0)
  505. pcHelper->AddProperty<int>(&pcMatIn->sTexBump.iUVSrc,1,
  506. AI_MATKEY_UVWSRC_HEIGHT(0));
  507. if(pcMatIn->sTexShininess.mMapName.length() > 0)
  508. pcHelper->AddProperty<int>(&pcMatIn->sTexShininess.iUVSrc,1,
  509. AI_MATKEY_UVWSRC_SHININESS(0));
  510. if(pcMatIn->sTexOpacity.mMapName.length() > 0)
  511. pcHelper->AddProperty<int>(&pcMatIn->sTexOpacity.iUVSrc,1,
  512. AI_MATKEY_UVWSRC_OPACITY(0));
  513. if(pcMatIn->sTexAmbient.mMapName.length() > 0)
  514. pcHelper->AddProperty<int>(&pcMatIn->sTexAmbient.iUVSrc,1,
  515. AI_MATKEY_UVWSRC_AMBIENT(0));
  516. }
  517. };