ObjFileParser.cpp 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660
  1. /*
  2. ---------------------------------------------------------------------------
  3. Open Asset Import Library (ASSIMP)
  4. ---------------------------------------------------------------------------
  5. Copyright (c) 2006-2010, 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. #include "AssimpPCH.h"
  35. #ifndef ASSIMP_BUILD_NO_OBJ_IMPORTER
  36. #include "ObjFileParser.h"
  37. #include "ObjFileMtlImporter.h"
  38. #include "ObjTools.h"
  39. #include "ObjFileData.h"
  40. #include "fast_atof.h"
  41. #include "../include/aiTypes.h"
  42. #include "DefaultIOSystem.h"
  43. namespace Assimp
  44. {
  45. // -------------------------------------------------------------------
  46. const std::string ObjFileParser::DEFAULT_MATERIAL = AI_DEFAULT_MATERIAL_NAME;
  47. // fix: changed that to our standard default name
  48. // -------------------------------------------------------------------
  49. // Constructor with loaded data and directories.
  50. ObjFileParser::ObjFileParser(std::vector<char> &Data,const std::string &strModelName, IOSystem *io ) :
  51. m_DataIt(Data.begin()),
  52. m_DataItEnd(Data.end()),
  53. m_pModel(NULL),
  54. m_uiLine(0),
  55. m_pIO( io )
  56. {
  57. // Create the model instance to store all the data
  58. m_pModel = new ObjFile::Model();
  59. m_pModel->m_ModelName = strModelName;
  60. m_pModel->m_pDefaultMaterial = new ObjFile::Material();
  61. m_pModel->m_pDefaultMaterial->MaterialName.Set( DEFAULT_MATERIAL );
  62. m_pModel->m_MaterialLib.push_back( DEFAULT_MATERIAL );
  63. m_pModel->m_MaterialMap[ DEFAULT_MATERIAL ] = m_pModel->m_pDefaultMaterial;
  64. // Start parsing the file
  65. parseFile();
  66. }
  67. // -------------------------------------------------------------------
  68. // Destrcutor.
  69. ObjFileParser::~ObjFileParser()
  70. {
  71. delete m_pModel->m_pDefaultMaterial;
  72. m_pModel->m_pDefaultMaterial = NULL;
  73. delete m_pModel;
  74. m_pModel = NULL;
  75. }
  76. // -------------------------------------------------------------------
  77. // Returns a pointer to the model instance.
  78. ObjFile::Model *ObjFileParser::GetModel() const
  79. {
  80. return m_pModel;
  81. }
  82. // -------------------------------------------------------------------
  83. // File parsing method.
  84. void ObjFileParser::parseFile()
  85. {
  86. if (m_DataIt == m_DataItEnd)
  87. return;
  88. while (m_DataIt != m_DataItEnd)
  89. {
  90. switch (*m_DataIt)
  91. {
  92. case 'v': // Parse a vertex texture coordinate
  93. {
  94. ++m_DataIt;
  95. if (*m_DataIt == ' ')
  96. {
  97. // Read in vertex definition
  98. getVector3(m_pModel->m_Vertices);
  99. }
  100. else if (*m_DataIt == 't')
  101. {
  102. // Read in texture coordinate (2D)
  103. ++m_DataIt;
  104. getVector2(m_pModel->m_TextureCoord);
  105. }
  106. else if (*m_DataIt == 'n')
  107. {
  108. // Read in normal vector definition
  109. ++m_DataIt;
  110. getVector3( m_pModel->m_Normals );
  111. }
  112. }
  113. break;
  114. case 'f': // Parse a face
  115. {
  116. getFace();
  117. }
  118. break;
  119. case '#': // Parse a comment
  120. {
  121. getComment();
  122. }
  123. break;
  124. case 'u': // Parse a material desc. setter
  125. {
  126. getMaterialDesc();
  127. }
  128. break;
  129. case 'm': // Parse a material library
  130. {
  131. getMaterialLib();
  132. }
  133. break;
  134. case 'g': // Parse group name
  135. {
  136. getGroupName();
  137. }
  138. break;
  139. case 's': // Parse group number
  140. {
  141. getGroupNumber();
  142. }
  143. break;
  144. case 'o': // Parse object name
  145. {
  146. getObjectName();
  147. }
  148. break;
  149. default:
  150. {
  151. m_DataIt = skipLine<DataArrayIt>( m_DataIt, m_DataItEnd, m_uiLine );
  152. }
  153. break;
  154. }
  155. }
  156. }
  157. // -------------------------------------------------------------------
  158. // Copy the next word in a temporary buffer
  159. void ObjFileParser::copyNextWord(char *pBuffer, size_t length)
  160. {
  161. size_t index = 0;
  162. m_DataIt = getNextWord<DataArrayIt>(m_DataIt, m_DataItEnd);
  163. while ( !isSeparator(*m_DataIt) && m_DataIt != m_DataItEnd )
  164. {
  165. pBuffer[index] = *m_DataIt;
  166. index++;
  167. if (index == length-1)
  168. break;
  169. ++m_DataIt;
  170. }
  171. pBuffer[index] = '\0';
  172. }
  173. // -------------------------------------------------------------------
  174. // Copy the next line into a temporary buffer
  175. void ObjFileParser::copyNextLine(char *pBuffer, size_t length)
  176. {
  177. size_t index = 0;
  178. while (m_DataIt != m_DataItEnd)
  179. {
  180. if (*m_DataIt == '\n' || *m_DataIt == '\r' || index == length-1)
  181. break;
  182. pBuffer[ index ] = *m_DataIt;
  183. ++index;
  184. ++m_DataIt;
  185. }
  186. pBuffer[ index ] = '\0';
  187. }
  188. // -------------------------------------------------------------------
  189. // Get values for a new 3D vector instance
  190. void ObjFileParser::getVector3(std::vector<aiVector3D> &point3d_array)
  191. {
  192. float x, y, z;
  193. copyNextWord(m_buffer, BUFFERSIZE);
  194. x = (float) fast_atof(m_buffer);
  195. copyNextWord(m_buffer, BUFFERSIZE);
  196. y = (float) fast_atof(m_buffer);
  197. copyNextWord(m_buffer, BUFFERSIZE);
  198. z = (float) fast_atof(m_buffer);
  199. point3d_array.push_back( aiVector3D( x, y, z ) );
  200. //skipLine();
  201. m_DataIt = skipLine<DataArrayIt>( m_DataIt, m_DataItEnd, m_uiLine );
  202. }
  203. // -------------------------------------------------------------------
  204. // Get values for a new 2D vector instance
  205. void ObjFileParser::getVector2( std::vector<aiVector2D> &point2d_array )
  206. {
  207. float x, y;
  208. copyNextWord(m_buffer, BUFFERSIZE);
  209. x = (float) fast_atof(m_buffer);
  210. copyNextWord(m_buffer, BUFFERSIZE);
  211. y = (float) fast_atof(m_buffer);
  212. point2d_array.push_back(aiVector2D(x, y));
  213. m_DataIt = skipLine<DataArrayIt>( m_DataIt, m_DataItEnd, m_uiLine );
  214. }
  215. // -------------------------------------------------------------------
  216. // Get values for a new face instance
  217. void ObjFileParser::getFace()
  218. {
  219. copyNextLine(m_buffer, BUFFERSIZE);
  220. if (m_DataIt == m_DataItEnd)
  221. return;
  222. char *pPtr = m_buffer;
  223. char *pEnd = &pPtr[BUFFERSIZE];
  224. pPtr = getNextToken<char*>(pPtr, pEnd);
  225. if (pPtr == '\0')
  226. return;
  227. std::vector<unsigned int> *pIndices = new std::vector<unsigned int>;
  228. std::vector<unsigned int> *pTexID = new std::vector<unsigned int>;
  229. std::vector<unsigned int> *pNormalID = new std::vector<unsigned int>;
  230. bool hasNormal = false;
  231. bool vt = (!m_pModel->m_TextureCoord.empty());
  232. bool vn = (!m_pModel->m_Normals.empty());
  233. int iStep = 0, iPos = 0;
  234. while (pPtr != pEnd)
  235. {
  236. iStep = 1;
  237. if (*pPtr == '\0')
  238. break;
  239. if (*pPtr=='\r')
  240. break;
  241. if (*pPtr=='/' )
  242. {
  243. if (iPos == 0)
  244. {
  245. //if there are no texturecoordinates in the obj file but normals
  246. if (!vt && vn) {
  247. iPos = 1;
  248. iStep++;
  249. }
  250. }
  251. iPos++;
  252. }
  253. else if ( isSeparator(*pPtr) )
  254. {
  255. iPos = 0;
  256. }
  257. else
  258. {
  259. //OBJ USES 1 Base ARRAYS!!!!
  260. const int iVal = atoi( pPtr );
  261. int tmp = iVal;
  262. while ( ( tmp = tmp / 10 )!=0 )
  263. ++iStep;
  264. if ( iVal > 0 )
  265. {
  266. // Store parsed index
  267. if ( 0 == iPos )
  268. {
  269. pIndices->push_back( iVal-1 );
  270. }
  271. else if ( 1 == iPos )
  272. {
  273. pTexID->push_back( iVal-1 );
  274. }
  275. else if ( 2 == iPos )
  276. {
  277. pNormalID->push_back( iVal-1 );
  278. hasNormal = true;
  279. }
  280. else
  281. {
  282. reportErrorTokenInFace();
  283. }
  284. }
  285. }
  286. for ( int i=0; i<iStep; i++ )
  287. ++pPtr;
  288. }
  289. ObjFile::Face *face = new ObjFile::Face( pIndices, pNormalID, pTexID );
  290. // Set active material, if one set
  291. if (NULL != m_pModel->m_pCurrentMaterial)
  292. face->m_pMaterial = m_pModel->m_pCurrentMaterial;
  293. else
  294. face->m_pMaterial = m_pModel->m_pDefaultMaterial;
  295. // Create a default object, if nothing there
  296. if ( NULL == m_pModel->m_pCurrent )
  297. createObject( "defaultobject" );
  298. // Assign face to mesh
  299. if ( NULL == m_pModel->m_pCurrentMesh )
  300. {
  301. createMesh();
  302. }
  303. // Store the face
  304. m_pModel->m_pCurrentMesh->m_Faces.push_back( face );
  305. m_pModel->m_pCurrentMesh->m_uiNumIndices += (unsigned int)face->m_pVertices->size();
  306. m_pModel->m_pCurrentMesh->m_uiUVCoordinates[ 0 ] += (unsigned int)face->m_pTexturCoords[0].size();
  307. if( !m_pModel->m_pCurrentMesh->m_hasNormals && hasNormal )
  308. {
  309. m_pModel->m_pCurrentMesh->m_hasNormals = true;
  310. }
  311. // Skip the rest of the line
  312. m_DataIt = skipLine<DataArrayIt>( m_DataIt, m_DataItEnd, m_uiLine );
  313. }
  314. // -------------------------------------------------------------------
  315. // Get values for a new material description
  316. void ObjFileParser::getMaterialDesc()
  317. {
  318. // Get next data for material data
  319. m_DataIt = getNextToken<DataArrayIt>(m_DataIt, m_DataItEnd);
  320. if (m_DataIt == m_DataItEnd)
  321. return;
  322. char *pStart = &(*m_DataIt);
  323. while ( !isSeparator(*m_DataIt) && m_DataIt != m_DataItEnd )
  324. ++m_DataIt;
  325. // Get name
  326. std::string strName(pStart, &(*m_DataIt));
  327. if ( strName.empty())
  328. return;
  329. // Search for material
  330. std::map<std::string, ObjFile::Material*>::iterator it = m_pModel->m_MaterialMap.find( strName );
  331. if ( it == m_pModel->m_MaterialMap.end() )
  332. {
  333. // Not found, use default material
  334. m_pModel->m_pCurrentMaterial = m_pModel->m_pDefaultMaterial;
  335. }
  336. else
  337. {
  338. // Found, using detected material
  339. m_pModel->m_pCurrentMaterial = (*it).second;
  340. if ( needsNewMesh( strName ))
  341. {
  342. createMesh();
  343. }
  344. m_pModel->m_pCurrentMesh->m_uiMaterialIndex = getMaterialIndex( strName );
  345. }
  346. // Skip rest of line
  347. m_DataIt = skipLine<DataArrayIt>( m_DataIt, m_DataItEnd, m_uiLine );
  348. }
  349. // -------------------------------------------------------------------
  350. // Get a comment, values will be skipped
  351. void ObjFileParser::getComment()
  352. {
  353. bool running = true;
  354. while (running)
  355. {
  356. if ( '\n' == (*m_DataIt) || m_DataIt == m_DataItEnd )
  357. {
  358. ++m_DataIt;
  359. break;
  360. }
  361. else
  362. {
  363. ++m_DataIt;
  364. }
  365. }
  366. }
  367. // -------------------------------------------------------------------
  368. // Get material library from file.
  369. void ObjFileParser::getMaterialLib()
  370. {
  371. // Translate tuple
  372. m_DataIt = getNextToken<DataArrayIt>(m_DataIt, m_DataItEnd);
  373. if (m_DataIt == m_DataItEnd)
  374. return;
  375. char *pStart = &(*m_DataIt);
  376. while (!isNewLine(*m_DataIt))
  377. m_DataIt++;
  378. // Check for existence
  379. const std::string strMatName(pStart, &(*m_DataIt));
  380. IOStream *pFile = m_pIO->Open(strMatName);
  381. if (!pFile )
  382. {
  383. DefaultLogger::get()->error("OBJ: Unable to locate material file " + strMatName);
  384. m_DataIt = skipLine<DataArrayIt>( m_DataIt, m_DataItEnd, m_uiLine );
  385. return;
  386. }
  387. // Import material library data from file
  388. std::vector<char> buffer;
  389. BaseImporter::TextFileToBuffer(pFile,buffer);
  390. m_pIO->Close( pFile );
  391. // Importing the material library
  392. ObjFileMtlImporter mtlImporter( buffer, strMatName, m_pModel );
  393. }
  394. // -------------------------------------------------------------------
  395. // Set a new material definition as the current material.
  396. void ObjFileParser::getNewMaterial()
  397. {
  398. m_DataIt = getNextToken<DataArrayIt>(m_DataIt, m_DataItEnd);
  399. m_DataIt = getNextWord<DataArrayIt>(m_DataIt, m_DataItEnd);
  400. if ( m_DataIt == m_DataItEnd )
  401. return;
  402. char *pStart = &(*m_DataIt);
  403. std::string strMat( pStart, *m_DataIt );
  404. while ( isSeparator( *m_DataIt ) )
  405. m_DataIt++;
  406. std::map<std::string, ObjFile::Material*>::iterator it = m_pModel->m_MaterialMap.find( strMat );
  407. if ( it == m_pModel->m_MaterialMap.end() )
  408. {
  409. // Show a warning, if material was not found
  410. DefaultLogger::get()->warn("OBJ: Unsupported material requested: " + strMat);
  411. m_pModel->m_pCurrentMaterial = m_pModel->m_pDefaultMaterial;
  412. }
  413. else
  414. {
  415. // Set new material
  416. if ( needsNewMesh( strMat ) )
  417. {
  418. createMesh();
  419. }
  420. m_pModel->m_pCurrentMesh->m_uiMaterialIndex = getMaterialIndex( strMat );
  421. }
  422. m_DataIt = skipLine<DataArrayIt>( m_DataIt, m_DataItEnd, m_uiLine );
  423. }
  424. // -------------------------------------------------------------------
  425. int ObjFileParser::getMaterialIndex( const std::string &strMaterialName )
  426. {
  427. int mat_index = -1;
  428. if ( strMaterialName.empty() )
  429. return mat_index;
  430. for (size_t index = 0; index < m_pModel->m_MaterialLib.size(); ++index)
  431. {
  432. if ( strMaterialName == m_pModel->m_MaterialLib[ index ])
  433. {
  434. mat_index = (int)index;
  435. break;
  436. }
  437. }
  438. return mat_index;
  439. }
  440. // -------------------------------------------------------------------
  441. // Getter for a group name.
  442. void ObjFileParser::getGroupName()
  443. {
  444. // Get next word from data buffer
  445. m_DataIt = getNextToken<DataArrayIt>(m_DataIt, m_DataItEnd);
  446. m_DataIt = getNextWord<DataArrayIt>(m_DataIt, m_DataItEnd);
  447. if ( isEndOfBuffer( m_DataIt, m_DataItEnd ) )
  448. return;
  449. // Store groupname in group library
  450. char *pStart = &(*m_DataIt);
  451. while ( !isSeparator(*m_DataIt) )
  452. m_DataIt++;
  453. std::string strGroupName(pStart, &(*m_DataIt));
  454. // Change active group, if necessary
  455. if ( m_pModel->m_strActiveGroup != strGroupName )
  456. {
  457. // Search for already existing entry
  458. ObjFile::Model::ConstGroupMapIt it = m_pModel->m_Groups.find(&strGroupName);
  459. // We are mapping groups into the object structure
  460. createObject( strGroupName );
  461. // New group name, creating a new entry
  462. if (it == m_pModel->m_Groups.end())
  463. {
  464. std::vector<unsigned int> *pFaceIDArray = new std::vector<unsigned int>;
  465. m_pModel->m_Groups[ &strGroupName ] = pFaceIDArray;
  466. m_pModel->m_pGroupFaceIDs = (pFaceIDArray);
  467. }
  468. else
  469. {
  470. m_pModel->m_pGroupFaceIDs = (*it).second;
  471. }
  472. m_pModel->m_strActiveGroup = strGroupName;
  473. }
  474. m_DataIt = skipLine<DataArrayIt>( m_DataIt, m_DataItEnd, m_uiLine );
  475. }
  476. // -------------------------------------------------------------------
  477. // Not supported
  478. void ObjFileParser::getGroupNumber()
  479. {
  480. // Not used
  481. m_DataIt = skipLine<DataArrayIt>( m_DataIt, m_DataItEnd, m_uiLine );
  482. }
  483. // -------------------------------------------------------------------
  484. // Stores values for a new object instance, name will be used to
  485. // identify it.
  486. void ObjFileParser::getObjectName()
  487. {
  488. m_DataIt = getNextToken<DataArrayIt>(m_DataIt, m_DataItEnd);
  489. if (m_DataIt == m_DataItEnd)
  490. return;
  491. char *pStart = &(*m_DataIt);
  492. while ( !isSeparator( *m_DataIt ) )
  493. ++m_DataIt;
  494. std::string strObjectName(pStart, &(*m_DataIt));
  495. if (!strObjectName.empty())
  496. {
  497. // Reset current object
  498. m_pModel->m_pCurrent = NULL;
  499. // Search for actual object
  500. for (std::vector<ObjFile::Object*>::const_iterator it = m_pModel->m_Objects.begin();
  501. it != m_pModel->m_Objects.end();
  502. ++it)
  503. {
  504. if ((*it)->m_strObjName == strObjectName)
  505. {
  506. m_pModel->m_pCurrent = *it;
  507. break;
  508. }
  509. }
  510. // Allocate a new object, if current one was not found before
  511. if ( NULL == m_pModel->m_pCurrent )
  512. createObject(strObjectName);
  513. }
  514. m_DataIt = skipLine<DataArrayIt>( m_DataIt, m_DataItEnd, m_uiLine );
  515. }
  516. // -------------------------------------------------------------------
  517. // Creates a new object instance
  518. void ObjFileParser::createObject(const std::string &strObjectName)
  519. {
  520. ai_assert( NULL != m_pModel );
  521. ai_assert( !strObjectName.empty() );
  522. m_pModel->m_pCurrent = new ObjFile::Object;
  523. m_pModel->m_pCurrent->m_strObjName = strObjectName;
  524. m_pModel->m_Objects.push_back( m_pModel->m_pCurrent );
  525. createMesh();
  526. if( m_pModel->m_pCurrentMaterial )
  527. {
  528. m_pModel->m_pCurrentMesh->m_uiMaterialIndex =
  529. getMaterialIndex( m_pModel->m_pCurrentMaterial->MaterialName.data );
  530. m_pModel->m_pCurrentMesh->m_pMaterial = m_pModel->m_pCurrentMaterial;
  531. }
  532. }
  533. // -------------------------------------------------------------------
  534. // Creates a new mesh
  535. void ObjFileParser::createMesh()
  536. {
  537. ai_assert( NULL != m_pModel );
  538. m_pModel->m_pCurrentMesh = new ObjFile::Mesh;
  539. m_pModel->m_Meshes.push_back( m_pModel->m_pCurrentMesh );
  540. unsigned int meshId = m_pModel->m_Meshes.size()-1;
  541. if ( NULL != m_pModel->m_pCurrent )
  542. {
  543. m_pModel->m_pCurrent->m_Meshes.push_back( meshId );
  544. }
  545. else
  546. {
  547. DefaultLogger::get()->error("OBJ: No object detected to attach a new mesh instance.");
  548. }
  549. }
  550. // -------------------------------------------------------------------
  551. // Returns true, if a new mesh must be created.
  552. bool ObjFileParser::needsNewMesh( const std::string &rMaterialName )
  553. {
  554. bool newMat = false;
  555. int matIdx = getMaterialIndex( rMaterialName );
  556. int curMatIdx = m_pModel->m_pCurrentMesh->m_uiMaterialIndex;
  557. if ( curMatIdx != ObjFile::Mesh::NoMaterial || curMatIdx != matIdx )
  558. {
  559. // New material -> only one material per mesh, so we need to create a new
  560. // material
  561. newMat = true;
  562. }
  563. return newMat;
  564. }
  565. // -------------------------------------------------------------------
  566. // Shows an error in parsing process.
  567. void ObjFileParser::reportErrorTokenInFace()
  568. {
  569. m_DataIt = skipLine<DataArrayIt>( m_DataIt, m_DataItEnd, m_uiLine );
  570. DefaultLogger::get()->error("OBJ: Not supported token in face description detected");
  571. }
  572. // -------------------------------------------------------------------
  573. } // Namespace Assimp
  574. #endif // !! ASSIMP_BUILD_NO_OBJ_IMPORTER