TextureTransform.cpp 17 KB

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