2008-10-13 16:45:48 +00:00
|
|
|
/*
|
|
|
|
---------------------------------------------------------------------------
|
2012-02-03 03:38:30 +00:00
|
|
|
Open Asset Import Library (assimp)
|
2008-10-13 16:45:48 +00:00
|
|
|
---------------------------------------------------------------------------
|
|
|
|
|
2012-02-03 03:38:30 +00:00
|
|
|
Copyright (c) 2006-2012, assimp team
|
2008-10-13 16:45:48 +00:00
|
|
|
|
|
|
|
All rights reserved.
|
|
|
|
|
|
|
|
Redistribution and use of this software in source and binary forms,
|
|
|
|
with or without modification, are permitted provided that the following
|
|
|
|
conditions are met:
|
|
|
|
|
|
|
|
* Redistributions of source code must retain the above
|
|
|
|
copyright notice, this list of conditions and the
|
|
|
|
following disclaimer.
|
|
|
|
|
|
|
|
* Redistributions in binary form must reproduce the above
|
|
|
|
copyright notice, this list of conditions and the
|
|
|
|
following disclaimer in the documentation and/or other
|
|
|
|
materials provided with the distribution.
|
|
|
|
|
2012-02-03 03:38:30 +00:00
|
|
|
* Neither the name of the assimp team, nor the names of its
|
2008-10-13 16:45:48 +00:00
|
|
|
contributors may be used to endorse or promote products
|
|
|
|
derived from this software without specific prior
|
2012-02-03 03:38:30 +00:00
|
|
|
written permission of the assimp team.
|
2008-10-13 16:45:48 +00:00
|
|
|
|
|
|
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
|
|
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
|
|
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
|
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
|
|
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
|
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
---------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "AssimpPCH.h"
|
2009-01-18 23:48:25 +00:00
|
|
|
#ifndef ASSIMP_BUILD_NO_OBJ_IMPORTER
|
2008-10-13 16:45:48 +00:00
|
|
|
|
2008-05-05 12:36:31 +00:00
|
|
|
#include "ObjFileParser.h"
|
2008-06-03 21:32:56 +00:00
|
|
|
#include "ObjFileMtlImporter.h"
|
2008-05-05 12:36:31 +00:00
|
|
|
#include "ObjTools.h"
|
|
|
|
#include "ObjFileData.h"
|
2011-08-23 16:23:13 +00:00
|
|
|
#include "ParsingUtils.h"
|
2012-02-03 17:04:06 +00:00
|
|
|
#include "../include/assimp/types.h"
|
2008-10-13 16:45:48 +00:00
|
|
|
#include "DefaultIOSystem.h"
|
2008-05-05 12:36:31 +00:00
|
|
|
|
2013-10-11 13:29:17 +00:00
|
|
|
namespace Assimp {
|
2010-05-30 12:45:38 +00:00
|
|
|
|
2009-01-18 23:48:25 +00:00
|
|
|
const std::string ObjFileParser::DEFAULT_MATERIAL = AI_DEFAULT_MATERIAL_NAME;
|
2008-05-05 12:36:31 +00:00
|
|
|
|
|
|
|
// -------------------------------------------------------------------
|
2008-08-14 21:25:50 +00:00
|
|
|
// Constructor with loaded data and directories.
|
2009-12-06 12:14:47 +00:00
|
|
|
ObjFileParser::ObjFileParser(std::vector<char> &Data,const std::string &strModelName, IOSystem *io ) :
|
2008-05-05 12:36:31 +00:00
|
|
|
m_DataIt(Data.begin()),
|
|
|
|
m_DataItEnd(Data.end()),
|
|
|
|
m_pModel(NULL),
|
2009-04-02 15:16:01 +00:00
|
|
|
m_uiLine(0),
|
2009-12-06 12:14:47 +00:00
|
|
|
m_pIO( io )
|
2008-05-05 12:36:31 +00:00
|
|
|
{
|
2011-05-06 20:26:55 +00:00
|
|
|
std::fill_n(m_buffer,BUFFERSIZE,0);
|
2011-02-20 00:01:52 +00:00
|
|
|
|
2008-05-05 12:36:31 +00:00
|
|
|
// Create the model instance to store all the data
|
|
|
|
m_pModel = new ObjFile::Model();
|
|
|
|
m_pModel->m_ModelName = strModelName;
|
2008-06-11 20:12:48 +00:00
|
|
|
|
2013-10-11 13:29:17 +00:00
|
|
|
// create default material and store it
|
2008-06-11 20:12:48 +00:00
|
|
|
m_pModel->m_pDefaultMaterial = new ObjFile::Material();
|
2008-07-02 20:41:30 +00:00
|
|
|
m_pModel->m_pDefaultMaterial->MaterialName.Set( DEFAULT_MATERIAL );
|
2013-10-11 13:29:17 +00:00
|
|
|
m_pModel->m_MaterialLib.push_back( DEFAULT_MATERIAL );
|
2008-06-11 20:12:48 +00:00
|
|
|
m_pModel->m_MaterialMap[ DEFAULT_MATERIAL ] = m_pModel->m_pDefaultMaterial;
|
|
|
|
|
2008-05-05 12:36:31 +00:00
|
|
|
// Start parsing the file
|
|
|
|
parseFile();
|
|
|
|
}
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------
|
2011-08-23 16:23:13 +00:00
|
|
|
// Destructor
|
2008-05-05 12:36:31 +00:00
|
|
|
ObjFileParser::~ObjFileParser()
|
|
|
|
{
|
2008-10-05 13:05:53 +00:00
|
|
|
delete m_pModel;
|
|
|
|
m_pModel = NULL;
|
2008-05-05 12:36:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------
|
2010-05-30 12:45:38 +00:00
|
|
|
// Returns a pointer to the model instance.
|
2008-05-05 12:36:31 +00:00
|
|
|
ObjFile::Model *ObjFileParser::GetModel() const
|
|
|
|
{
|
|
|
|
return m_pModel;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------
|
2010-05-30 12:45:38 +00:00
|
|
|
// File parsing method.
|
2008-05-05 12:36:31 +00:00
|
|
|
void ObjFileParser::parseFile()
|
|
|
|
{
|
|
|
|
if (m_DataIt == m_DataItEnd)
|
|
|
|
return;
|
|
|
|
|
|
|
|
while (m_DataIt != m_DataItEnd)
|
|
|
|
{
|
|
|
|
switch (*m_DataIt)
|
|
|
|
{
|
|
|
|
case 'v': // Parse a vertex texture coordinate
|
|
|
|
{
|
|
|
|
++m_DataIt;
|
2014-04-28 22:04:54 +00:00
|
|
|
if (*m_DataIt == ' ' || *m_DataIt == '\t') {
|
|
|
|
// read in vertex definition
|
2008-05-05 12:36:31 +00:00
|
|
|
getVector3(m_pModel->m_Vertices);
|
2014-04-28 22:04:54 +00:00
|
|
|
} else if (*m_DataIt == 't') {
|
|
|
|
// read in texture coordinate ( 2D or 3D )
|
2014-07-22 06:03:08 +00:00
|
|
|
++m_DataIt;
|
|
|
|
getVector( m_pModel->m_TextureCoord );
|
2014-04-28 22:04:54 +00:00
|
|
|
} else if (*m_DataIt == 'n') {
|
2008-05-05 12:36:31 +00:00
|
|
|
// Read in normal vector definition
|
2008-07-02 18:12:54 +00:00
|
|
|
++m_DataIt;
|
2009-04-18 23:41:50 +00:00
|
|
|
getVector3( m_pModel->m_Normals );
|
2008-05-05 12:36:31 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2011-08-23 16:23:13 +00:00
|
|
|
case 'p': // Parse a face, line or point statement
|
|
|
|
case 'l':
|
|
|
|
case 'f':
|
2008-05-05 12:36:31 +00:00
|
|
|
{
|
2011-08-23 16:23:13 +00:00
|
|
|
getFace(*m_DataIt == 'f' ? aiPrimitiveType_POLYGON : (*m_DataIt == 'l'
|
|
|
|
? aiPrimitiveType_LINE : aiPrimitiveType_POINT));
|
2008-05-05 12:36:31 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case '#': // Parse a comment
|
|
|
|
{
|
|
|
|
getComment();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'u': // Parse a material desc. setter
|
|
|
|
{
|
|
|
|
getMaterialDesc();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2013-11-26 22:21:32 +00:00
|
|
|
case 'm': // Parse a material library or merging group ('mg')
|
2008-05-05 12:36:31 +00:00
|
|
|
{
|
2013-11-26 22:21:32 +00:00
|
|
|
if (*(m_DataIt + 1) == 'g')
|
|
|
|
getGroupNumberAndResolution();
|
|
|
|
else
|
|
|
|
getMaterialLib();
|
2008-05-05 12:36:31 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'g': // Parse group name
|
|
|
|
{
|
|
|
|
getGroupName();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 's': // Parse group number
|
|
|
|
{
|
|
|
|
getGroupNumber();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'o': // Parse object name
|
|
|
|
{
|
|
|
|
getObjectName();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
{
|
2008-05-16 17:57:48 +00:00
|
|
|
m_DataIt = skipLine<DataArrayIt>( m_DataIt, m_DataItEnd, m_uiLine );
|
2008-05-05 12:36:31 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------
|
|
|
|
// Copy the next word in a temporary buffer
|
|
|
|
void ObjFileParser::copyNextWord(char *pBuffer, size_t length)
|
|
|
|
{
|
|
|
|
size_t index = 0;
|
|
|
|
m_DataIt = getNextWord<DataArrayIt>(m_DataIt, m_DataItEnd);
|
2011-02-20 00:01:52 +00:00
|
|
|
while ( m_DataIt != m_DataItEnd && !isSeparator(*m_DataIt) )
|
2008-05-05 12:36:31 +00:00
|
|
|
{
|
|
|
|
pBuffer[index] = *m_DataIt;
|
|
|
|
index++;
|
|
|
|
if (index == length-1)
|
|
|
|
break;
|
|
|
|
++m_DataIt;
|
|
|
|
}
|
2013-09-18 17:34:03 +00:00
|
|
|
|
|
|
|
ai_assert(index < length);
|
2008-05-05 12:36:31 +00:00
|
|
|
pBuffer[index] = '\0';
|
|
|
|
}
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------
|
|
|
|
// Copy the next line into a temporary buffer
|
|
|
|
void ObjFileParser::copyNextLine(char *pBuffer, size_t length)
|
|
|
|
{
|
2013-09-18 17:34:03 +00:00
|
|
|
size_t index = 0u;
|
|
|
|
|
|
|
|
// some OBJ files have line continuations using \ (such as in C++ et al)
|
|
|
|
bool continuation = false;
|
|
|
|
for (;m_DataIt != m_DataItEnd && index < length-1; ++m_DataIt)
|
2008-05-05 12:36:31 +00:00
|
|
|
{
|
2013-09-18 17:34:03 +00:00
|
|
|
const char c = *m_DataIt;
|
|
|
|
if (c == '\\') {
|
|
|
|
continuation = true;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (c == '\n' || c == '\r') {
|
|
|
|
if(continuation) {
|
|
|
|
pBuffer[ index++ ] = ' ';
|
|
|
|
continue;
|
|
|
|
}
|
2008-05-05 12:36:31 +00:00
|
|
|
break;
|
2013-09-18 17:34:03 +00:00
|
|
|
}
|
2010-03-16 00:04:17 +00:00
|
|
|
|
2013-09-18 17:34:03 +00:00
|
|
|
continuation = false;
|
|
|
|
pBuffer[ index++ ] = c;
|
2008-05-05 12:36:31 +00:00
|
|
|
}
|
2013-09-18 17:34:03 +00:00
|
|
|
ai_assert(index < length);
|
2008-05-05 12:36:31 +00:00
|
|
|
pBuffer[ index ] = '\0';
|
|
|
|
}
|
|
|
|
|
2014-04-28 22:04:54 +00:00
|
|
|
// -------------------------------------------------------------------
|
|
|
|
void ObjFileParser::getVector( std::vector<aiVector3D> &point3d_array ) {
|
|
|
|
size_t numComponents( 0 );
|
2014-07-23 04:59:23 +00:00
|
|
|
const char* tmp( &m_DataIt[0] );
|
|
|
|
while( !IsLineEnd( *tmp ) ) {
|
|
|
|
if ( !SkipSpaces( &tmp ) ) {
|
2014-07-22 06:03:08 +00:00
|
|
|
break;
|
|
|
|
}
|
2014-07-23 04:59:23 +00:00
|
|
|
SkipToken( tmp );
|
2014-07-22 06:03:08 +00:00
|
|
|
++numComponents;
|
2014-04-28 22:04:54 +00:00
|
|
|
}
|
|
|
|
float x, y, z;
|
|
|
|
if( 2 == numComponents ) {
|
|
|
|
copyNextWord( m_buffer, BUFFERSIZE );
|
|
|
|
x = ( float ) fast_atof( m_buffer );
|
|
|
|
|
|
|
|
copyNextWord( m_buffer, BUFFERSIZE );
|
|
|
|
y = ( float ) fast_atof( m_buffer );
|
|
|
|
z = 0.0;
|
|
|
|
} else if( 3 == numComponents ) {
|
|
|
|
copyNextWord( m_buffer, BUFFERSIZE );
|
|
|
|
x = ( float ) fast_atof( m_buffer );
|
|
|
|
|
|
|
|
copyNextWord( m_buffer, BUFFERSIZE );
|
|
|
|
y = ( float ) fast_atof( m_buffer );
|
|
|
|
|
|
|
|
copyNextWord( m_buffer, BUFFERSIZE );
|
|
|
|
z = ( float ) fast_atof( m_buffer );
|
|
|
|
} else {
|
|
|
|
ai_assert( !"Invalid number of components" );
|
|
|
|
}
|
|
|
|
point3d_array.push_back( aiVector3D( x, y, z ) );
|
|
|
|
m_DataIt = skipLine<DataArrayIt>( m_DataIt, m_DataItEnd, m_uiLine );
|
|
|
|
}
|
|
|
|
|
2008-05-05 12:36:31 +00:00
|
|
|
// -------------------------------------------------------------------
|
|
|
|
// Get values for a new 3D vector instance
|
2014-04-28 22:04:54 +00:00
|
|
|
void ObjFileParser::getVector3(std::vector<aiVector3D> &point3d_array) {
|
2008-05-05 12:36:31 +00:00
|
|
|
float x, y, z;
|
|
|
|
copyNextWord(m_buffer, BUFFERSIZE);
|
|
|
|
x = (float) fast_atof(m_buffer);
|
|
|
|
|
|
|
|
copyNextWord(m_buffer, BUFFERSIZE);
|
|
|
|
y = (float) fast_atof(m_buffer);
|
|
|
|
|
2014-04-28 22:04:54 +00:00
|
|
|
copyNextWord( m_buffer, BUFFERSIZE );
|
|
|
|
z = ( float ) fast_atof( m_buffer );
|
2008-05-05 12:36:31 +00:00
|
|
|
|
2009-04-18 23:41:50 +00:00
|
|
|
point3d_array.push_back( aiVector3D( x, y, z ) );
|
2008-05-16 17:57:48 +00:00
|
|
|
m_DataIt = skipLine<DataArrayIt>( m_DataIt, m_DataItEnd, m_uiLine );
|
2008-05-05 12:36:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------
|
|
|
|
// Get values for a new 2D vector instance
|
2014-04-28 22:04:54 +00:00
|
|
|
void ObjFileParser::getVector2( std::vector<aiVector2D> &point2d_array ) {
|
2008-05-05 12:36:31 +00:00
|
|
|
float x, y;
|
|
|
|
copyNextWord(m_buffer, BUFFERSIZE);
|
|
|
|
x = (float) fast_atof(m_buffer);
|
|
|
|
|
|
|
|
copyNextWord(m_buffer, BUFFERSIZE);
|
|
|
|
y = (float) fast_atof(m_buffer);
|
|
|
|
|
2009-04-19 10:36:36 +00:00
|
|
|
point2d_array.push_back(aiVector2D(x, y));
|
2008-05-05 12:36:31 +00:00
|
|
|
|
2008-05-16 17:57:48 +00:00
|
|
|
m_DataIt = skipLine<DataArrayIt>( m_DataIt, m_DataItEnd, m_uiLine );
|
2008-05-05 12:36:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------
|
|
|
|
// Get values for a new face instance
|
2011-08-23 16:23:13 +00:00
|
|
|
void ObjFileParser::getFace(aiPrimitiveType type)
|
2008-05-05 12:36:31 +00:00
|
|
|
{
|
|
|
|
copyNextLine(m_buffer, BUFFERSIZE);
|
|
|
|
if (m_DataIt == m_DataItEnd)
|
|
|
|
return;
|
2008-05-16 17:57:48 +00:00
|
|
|
|
2008-05-05 12:36:31 +00:00
|
|
|
char *pPtr = m_buffer;
|
|
|
|
char *pEnd = &pPtr[BUFFERSIZE];
|
|
|
|
pPtr = getNextToken<char*>(pPtr, pEnd);
|
2011-02-20 00:01:52 +00:00
|
|
|
if (pPtr == pEnd || *pPtr == '\0')
|
2008-05-05 12:36:31 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
std::vector<unsigned int> *pIndices = new std::vector<unsigned int>;
|
|
|
|
std::vector<unsigned int> *pTexID = new std::vector<unsigned int>;
|
|
|
|
std::vector<unsigned int> *pNormalID = new std::vector<unsigned int>;
|
2008-09-22 08:22:36 +00:00
|
|
|
bool hasNormal = false;
|
|
|
|
|
2013-09-30 22:13:11 +00:00
|
|
|
const int vSize = m_pModel->m_Vertices.size();
|
|
|
|
const int vtSize = m_pModel->m_TextureCoord.size();
|
|
|
|
const int vnSize = m_pModel->m_Normals.size();
|
|
|
|
|
2011-08-23 16:23:13 +00:00
|
|
|
const bool vt = (!m_pModel->m_TextureCoord.empty());
|
|
|
|
const bool vn = (!m_pModel->m_Normals.empty());
|
2008-05-05 12:36:31 +00:00
|
|
|
int iStep = 0, iPos = 0;
|
|
|
|
while (pPtr != pEnd)
|
|
|
|
{
|
|
|
|
iStep = 1;
|
|
|
|
|
2011-08-23 16:23:13 +00:00
|
|
|
if (IsLineEnd(*pPtr))
|
2008-05-05 12:36:31 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
if (*pPtr=='/' )
|
|
|
|
{
|
2011-08-23 16:23:13 +00:00
|
|
|
if (type == aiPrimitiveType_POINT) {
|
|
|
|
DefaultLogger::get()->error("Obj: Separator unexpected in point statement");
|
|
|
|
}
|
2008-05-05 12:36:31 +00:00
|
|
|
if (iPos == 0)
|
|
|
|
{
|
2011-08-23 16:23:13 +00:00
|
|
|
//if there are no texture coordinates in the file, but normals
|
2008-09-16 13:53:10 +00:00
|
|
|
if (!vt && vn) {
|
2008-05-05 12:36:31 +00:00
|
|
|
iPos = 1;
|
2008-09-16 13:53:10 +00:00
|
|
|
iStep++;
|
|
|
|
}
|
2008-05-05 12:36:31 +00:00
|
|
|
}
|
|
|
|
iPos++;
|
|
|
|
}
|
2009-08-02 17:11:38 +00:00
|
|
|
else if ( isSeparator(*pPtr) )
|
2008-05-05 12:36:31 +00:00
|
|
|
{
|
|
|
|
iPos = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
//OBJ USES 1 Base ARRAYS!!!!
|
2008-09-09 22:32:04 +00:00
|
|
|
const int iVal = atoi( pPtr );
|
2013-09-30 22:13:11 +00:00
|
|
|
|
|
|
|
// increment iStep position based off of the sign and # of digits
|
2008-05-05 12:36:31 +00:00
|
|
|
int tmp = iVal;
|
2013-09-30 22:13:11 +00:00
|
|
|
if (iVal < 0)
|
|
|
|
++iStep;
|
2009-08-02 17:17:40 +00:00
|
|
|
while ( ( tmp = tmp / 10 )!=0 )
|
2008-05-05 12:36:31 +00:00
|
|
|
++iStep;
|
|
|
|
|
2009-08-02 17:17:40 +00:00
|
|
|
if ( iVal > 0 )
|
2008-05-05 12:36:31 +00:00
|
|
|
{
|
|
|
|
// Store parsed index
|
2008-09-09 22:32:04 +00:00
|
|
|
if ( 0 == iPos )
|
2008-05-05 12:36:31 +00:00
|
|
|
{
|
2008-09-09 22:32:04 +00:00
|
|
|
pIndices->push_back( iVal-1 );
|
2008-05-05 12:36:31 +00:00
|
|
|
}
|
2008-09-09 22:32:04 +00:00
|
|
|
else if ( 1 == iPos )
|
2008-05-05 12:36:31 +00:00
|
|
|
{
|
2008-09-09 22:32:04 +00:00
|
|
|
pTexID->push_back( iVal-1 );
|
2008-05-05 12:36:31 +00:00
|
|
|
}
|
2008-09-09 22:32:04 +00:00
|
|
|
else if ( 2 == iPos )
|
2008-05-05 12:36:31 +00:00
|
|
|
{
|
2008-09-09 22:32:04 +00:00
|
|
|
pNormalID->push_back( iVal-1 );
|
2008-09-22 08:22:36 +00:00
|
|
|
hasNormal = true;
|
2008-05-05 12:36:31 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
reportErrorTokenInFace();
|
|
|
|
}
|
|
|
|
}
|
2013-09-30 22:13:11 +00:00
|
|
|
else if ( iVal < 0 )
|
|
|
|
{
|
|
|
|
// Store relatively index
|
|
|
|
if ( 0 == iPos )
|
|
|
|
{
|
|
|
|
pIndices->push_back( vSize + iVal );
|
|
|
|
}
|
|
|
|
else if ( 1 == iPos )
|
|
|
|
{
|
|
|
|
pTexID->push_back( vtSize + iVal );
|
|
|
|
}
|
|
|
|
else if ( 2 == iPos )
|
|
|
|
{
|
|
|
|
pNormalID->push_back( vnSize + iVal );
|
|
|
|
hasNormal = true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
reportErrorTokenInFace();
|
|
|
|
}
|
|
|
|
}
|
2008-05-05 12:36:31 +00:00
|
|
|
}
|
2011-08-23 16:23:13 +00:00
|
|
|
pPtr += iStep;
|
|
|
|
}
|
|
|
|
|
2011-10-31 08:34:55 +00:00
|
|
|
if ( pIndices->empty() )
|
|
|
|
{
|
2011-08-23 16:23:13 +00:00
|
|
|
DefaultLogger::get()->error("Obj: Ignoring empty face");
|
|
|
|
m_DataIt = skipLine<DataArrayIt>( m_DataIt, m_DataItEnd, m_uiLine );
|
|
|
|
return;
|
2008-05-05 12:36:31 +00:00
|
|
|
}
|
|
|
|
|
2011-08-23 16:23:13 +00:00
|
|
|
ObjFile::Face *face = new ObjFile::Face( pIndices, pNormalID, pTexID, type );
|
2008-05-05 12:36:31 +00:00
|
|
|
|
|
|
|
// Set active material, if one set
|
|
|
|
if (NULL != m_pModel->m_pCurrentMaterial)
|
|
|
|
face->m_pMaterial = m_pModel->m_pCurrentMaterial;
|
|
|
|
else
|
|
|
|
face->m_pMaterial = m_pModel->m_pDefaultMaterial;
|
|
|
|
|
2011-10-31 08:34:55 +00:00
|
|
|
// Create a default object, if nothing is there
|
2008-07-02 18:12:54 +00:00
|
|
|
if ( NULL == m_pModel->m_pCurrent )
|
2010-05-30 12:45:38 +00:00
|
|
|
createObject( "defaultobject" );
|
2008-05-05 12:36:31 +00:00
|
|
|
|
2008-06-03 21:32:56 +00:00
|
|
|
// Assign face to mesh
|
2008-06-11 20:12:48 +00:00
|
|
|
if ( NULL == m_pModel->m_pCurrentMesh )
|
|
|
|
{
|
2010-05-30 12:45:38 +00:00
|
|
|
createMesh();
|
2008-06-11 20:12:48 +00:00
|
|
|
}
|
2008-08-14 21:25:50 +00:00
|
|
|
|
|
|
|
// Store the face
|
2008-06-03 21:32:56 +00:00
|
|
|
m_pModel->m_pCurrentMesh->m_Faces.push_back( face );
|
2008-08-28 17:35:36 +00:00
|
|
|
m_pModel->m_pCurrentMesh->m_uiNumIndices += (unsigned int)face->m_pVertices->size();
|
|
|
|
m_pModel->m_pCurrentMesh->m_uiUVCoordinates[ 0 ] += (unsigned int)face->m_pTexturCoords[0].size();
|
2010-05-30 12:45:38 +00:00
|
|
|
if( !m_pModel->m_pCurrentMesh->m_hasNormals && hasNormal )
|
|
|
|
{
|
2008-09-22 08:22:36 +00:00
|
|
|
m_pModel->m_pCurrentMesh->m_hasNormals = true;
|
|
|
|
}
|
2008-05-05 12:36:31 +00:00
|
|
|
// Skip the rest of the line
|
2008-05-16 17:57:48 +00:00
|
|
|
m_DataIt = skipLine<DataArrayIt>( m_DataIt, m_DataItEnd, m_uiLine );
|
2008-05-05 12:36:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------
|
|
|
|
// Get values for a new material description
|
|
|
|
void ObjFileParser::getMaterialDesc()
|
|
|
|
{
|
2012-01-11 13:38:56 +00:00
|
|
|
// Each material request a new object.
|
|
|
|
// Sometimes the object is already created (see 'o' tag by example), but it is not initialized !
|
|
|
|
// So, we create a new object only if the current on is already initialized !
|
|
|
|
if (m_pModel->m_pCurrent != NULL &&
|
|
|
|
( m_pModel->m_pCurrent->m_Meshes.size() > 1 ||
|
|
|
|
(m_pModel->m_pCurrent->m_Meshes.size() == 1 && m_pModel->m_Meshes[m_pModel->m_pCurrent->m_Meshes[0]]->m_Faces.size() != 0) )
|
|
|
|
)
|
|
|
|
m_pModel->m_pCurrent = NULL;
|
|
|
|
|
2008-05-05 12:36:31 +00:00
|
|
|
// Get next data for material data
|
|
|
|
m_DataIt = getNextToken<DataArrayIt>(m_DataIt, m_DataItEnd);
|
|
|
|
if (m_DataIt == m_DataItEnd)
|
|
|
|
return;
|
|
|
|
|
|
|
|
char *pStart = &(*m_DataIt);
|
2011-02-20 00:01:52 +00:00
|
|
|
while ( m_DataIt != m_DataItEnd && !isSeparator(*m_DataIt) )
|
2008-06-03 21:32:56 +00:00
|
|
|
++m_DataIt;
|
2008-05-05 12:36:31 +00:00
|
|
|
|
|
|
|
// Get name
|
|
|
|
std::string strName(pStart, &(*m_DataIt));
|
2008-09-22 08:22:36 +00:00
|
|
|
if ( strName.empty())
|
2008-05-05 12:36:31 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
// Search for material
|
2008-05-16 17:57:48 +00:00
|
|
|
std::map<std::string, ObjFile::Material*>::iterator it = m_pModel->m_MaterialMap.find( strName );
|
2008-06-03 21:32:56 +00:00
|
|
|
if ( it == m_pModel->m_MaterialMap.end() )
|
2008-05-05 12:36:31 +00:00
|
|
|
{
|
2008-06-03 21:32:56 +00:00
|
|
|
// Not found, use default material
|
|
|
|
m_pModel->m_pCurrentMaterial = m_pModel->m_pDefaultMaterial;
|
2011-05-07 11:14:06 +00:00
|
|
|
DefaultLogger::get()->error("OBJ: failed to locate material " + strName + ", skipping");
|
2008-06-03 21:32:56 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Found, using detected material
|
|
|
|
m_pModel->m_pCurrentMaterial = (*it).second;
|
2010-05-30 12:45:38 +00:00
|
|
|
if ( needsNewMesh( strName ))
|
|
|
|
{
|
|
|
|
createMesh();
|
|
|
|
}
|
2010-02-27 14:04:14 +00:00
|
|
|
m_pModel->m_pCurrentMesh->m_uiMaterialIndex = getMaterialIndex( strName );
|
2008-05-05 12:36:31 +00:00
|
|
|
}
|
|
|
|
|
2008-06-03 21:32:56 +00:00
|
|
|
// Skip rest of line
|
2008-05-16 17:57:48 +00:00
|
|
|
m_DataIt = skipLine<DataArrayIt>( m_DataIt, m_DataItEnd, m_uiLine );
|
2008-05-05 12:36:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------
|
|
|
|
// Get a comment, values will be skipped
|
|
|
|
void ObjFileParser::getComment()
|
|
|
|
{
|
2011-02-20 00:01:52 +00:00
|
|
|
while (m_DataIt != m_DataItEnd)
|
2008-05-05 12:36:31 +00:00
|
|
|
{
|
2011-02-20 00:01:52 +00:00
|
|
|
if ( '\n' == (*m_DataIt))
|
2008-05-05 12:36:31 +00:00
|
|
|
{
|
|
|
|
++m_DataIt;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
++m_DataIt;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------
|
2008-06-03 21:32:56 +00:00
|
|
|
// Get material library from file.
|
2008-05-05 12:36:31 +00:00
|
|
|
void ObjFileParser::getMaterialLib()
|
|
|
|
{
|
|
|
|
// Translate tuple
|
|
|
|
m_DataIt = getNextToken<DataArrayIt>(m_DataIt, m_DataItEnd);
|
|
|
|
if (m_DataIt == m_DataItEnd)
|
|
|
|
return;
|
|
|
|
|
|
|
|
char *pStart = &(*m_DataIt);
|
2011-02-20 00:01:52 +00:00
|
|
|
while (m_DataIt != m_DataItEnd && !isNewLine(*m_DataIt))
|
2008-05-05 12:36:31 +00:00
|
|
|
m_DataIt++;
|
2009-01-23 21:06:43 +00:00
|
|
|
|
2008-05-05 12:36:31 +00:00
|
|
|
// Check for existence
|
2009-08-24 08:46:04 +00:00
|
|
|
const std::string strMatName(pStart, &(*m_DataIt));
|
2009-12-06 12:14:47 +00:00
|
|
|
IOStream *pFile = m_pIO->Open(strMatName);
|
2009-04-02 15:16:01 +00:00
|
|
|
|
|
|
|
if (!pFile )
|
2008-05-05 12:36:31 +00:00
|
|
|
{
|
2009-08-24 08:46:04 +00:00
|
|
|
DefaultLogger::get()->error("OBJ: Unable to locate material file " + strMatName);
|
2008-05-16 17:57:48 +00:00
|
|
|
m_DataIt = skipLine<DataArrayIt>( m_DataIt, m_DataItEnd, m_uiLine );
|
2008-05-05 12:36:31 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2009-04-02 15:16:01 +00:00
|
|
|
// Import material library data from file
|
2009-08-21 22:49:58 +00:00
|
|
|
std::vector<char> buffer;
|
|
|
|
BaseImporter::TextFileToBuffer(pFile,buffer);
|
2009-12-06 12:14:47 +00:00
|
|
|
m_pIO->Close( pFile );
|
2008-05-05 12:36:31 +00:00
|
|
|
|
2009-04-02 15:16:01 +00:00
|
|
|
// Importing the material library
|
2009-08-24 08:46:04 +00:00
|
|
|
ObjFileMtlImporter mtlImporter( buffer, strMatName, m_pModel );
|
2008-05-05 12:36:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------
|
2008-06-03 21:32:56 +00:00
|
|
|
// Set a new material definition as the current material.
|
2008-05-05 12:36:31 +00:00
|
|
|
void ObjFileParser::getNewMaterial()
|
|
|
|
{
|
|
|
|
m_DataIt = getNextToken<DataArrayIt>(m_DataIt, m_DataItEnd);
|
|
|
|
m_DataIt = getNextWord<DataArrayIt>(m_DataIt, m_DataItEnd);
|
2014-07-03 18:33:52 +00:00
|
|
|
if( m_DataIt == m_DataItEnd ) {
|
|
|
|
return;
|
|
|
|
}
|
2008-05-05 12:36:31 +00:00
|
|
|
|
|
|
|
char *pStart = &(*m_DataIt);
|
2010-05-30 12:45:38 +00:00
|
|
|
std::string strMat( pStart, *m_DataIt );
|
2014-07-03 18:33:52 +00:00
|
|
|
while( m_DataIt != m_DataItEnd && isSeparator( *m_DataIt ) ) {
|
|
|
|
++m_DataIt;
|
|
|
|
}
|
2008-07-02 18:12:54 +00:00
|
|
|
std::map<std::string, ObjFile::Material*>::iterator it = m_pModel->m_MaterialMap.find( strMat );
|
2010-05-30 12:45:38 +00:00
|
|
|
if ( it == m_pModel->m_MaterialMap.end() )
|
2008-05-05 12:36:31 +00:00
|
|
|
{
|
|
|
|
// Show a warning, if material was not found
|
2009-04-02 15:16:01 +00:00
|
|
|
DefaultLogger::get()->warn("OBJ: Unsupported material requested: " + strMat);
|
2008-05-05 12:36:31 +00:00
|
|
|
m_pModel->m_pCurrentMaterial = m_pModel->m_pDefaultMaterial;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Set new material
|
2010-05-30 12:45:38 +00:00
|
|
|
if ( needsNewMesh( strMat ) )
|
|
|
|
{
|
|
|
|
createMesh();
|
|
|
|
}
|
2008-07-02 18:12:54 +00:00
|
|
|
m_pModel->m_pCurrentMesh->m_uiMaterialIndex = getMaterialIndex( strMat );
|
2008-05-05 12:36:31 +00:00
|
|
|
}
|
|
|
|
|
2008-05-16 17:57:48 +00:00
|
|
|
m_DataIt = skipLine<DataArrayIt>( m_DataIt, m_DataItEnd, m_uiLine );
|
2008-05-05 12:36:31 +00:00
|
|
|
}
|
|
|
|
|
2008-07-02 18:12:54 +00:00
|
|
|
// -------------------------------------------------------------------
|
|
|
|
int ObjFileParser::getMaterialIndex( const std::string &strMaterialName )
|
|
|
|
{
|
|
|
|
int mat_index = -1;
|
2014-07-03 18:33:52 +00:00
|
|
|
if( strMaterialName.empty() ) {
|
|
|
|
return mat_index;
|
|
|
|
}
|
2010-02-02 19:54:37 +00:00
|
|
|
for (size_t index = 0; index < m_pModel->m_MaterialLib.size(); ++index)
|
|
|
|
{
|
|
|
|
if ( strMaterialName == m_pModel->m_MaterialLib[ index ])
|
2008-07-02 18:12:54 +00:00
|
|
|
{
|
2010-02-02 19:54:37 +00:00
|
|
|
mat_index = (int)index;
|
|
|
|
break;
|
2008-07-02 18:12:54 +00:00
|
|
|
}
|
2010-02-02 19:54:37 +00:00
|
|
|
}
|
2008-07-02 18:12:54 +00:00
|
|
|
return mat_index;
|
|
|
|
}
|
|
|
|
|
2008-05-05 12:36:31 +00:00
|
|
|
// -------------------------------------------------------------------
|
2008-06-03 21:32:56 +00:00
|
|
|
// Getter for a group name.
|
2008-05-05 12:36:31 +00:00
|
|
|
void ObjFileParser::getGroupName()
|
|
|
|
{
|
2013-06-20 12:40:08 +00:00
|
|
|
std::string strGroupName;
|
|
|
|
|
|
|
|
m_DataIt = getName<DataArrayIt>(m_DataIt, m_DataItEnd, strGroupName);
|
2014-07-03 18:33:52 +00:00
|
|
|
if( isEndOfBuffer( m_DataIt, m_DataItEnd ) ) {
|
|
|
|
return;
|
|
|
|
}
|
2008-09-07 20:50:51 +00:00
|
|
|
|
2008-05-05 12:36:31 +00:00
|
|
|
// Change active group, if necessary
|
2010-05-30 12:45:38 +00:00
|
|
|
if ( m_pModel->m_strActiveGroup != strGroupName )
|
2008-05-05 12:36:31 +00:00
|
|
|
{
|
|
|
|
// Search for already existing entry
|
2011-02-20 00:01:52 +00:00
|
|
|
ObjFile::Model::ConstGroupMapIt it = m_pModel->m_Groups.find(strGroupName);
|
2008-05-05 12:36:31 +00:00
|
|
|
|
2010-01-31 16:53:08 +00:00
|
|
|
// We are mapping groups into the object structure
|
|
|
|
createObject( strGroupName );
|
|
|
|
|
2008-05-05 12:36:31 +00:00
|
|
|
// New group name, creating a new entry
|
|
|
|
if (it == m_pModel->m_Groups.end())
|
|
|
|
{
|
|
|
|
std::vector<unsigned int> *pFaceIDArray = new std::vector<unsigned int>;
|
2011-02-20 00:01:52 +00:00
|
|
|
m_pModel->m_Groups[ strGroupName ] = pFaceIDArray;
|
2008-05-05 12:36:31 +00:00
|
|
|
m_pModel->m_pGroupFaceIDs = (pFaceIDArray);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_pModel->m_pGroupFaceIDs = (*it).second;
|
|
|
|
}
|
|
|
|
m_pModel->m_strActiveGroup = strGroupName;
|
|
|
|
}
|
2008-05-16 17:57:48 +00:00
|
|
|
m_DataIt = skipLine<DataArrayIt>( m_DataIt, m_DataItEnd, m_uiLine );
|
2008-05-05 12:36:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------
|
|
|
|
// Not supported
|
|
|
|
void ObjFileParser::getGroupNumber()
|
|
|
|
{
|
2008-05-16 17:57:48 +00:00
|
|
|
// Not used
|
2008-05-05 12:36:31 +00:00
|
|
|
|
2008-05-16 17:57:48 +00:00
|
|
|
m_DataIt = skipLine<DataArrayIt>( m_DataIt, m_DataItEnd, m_uiLine );
|
2008-05-05 12:36:31 +00:00
|
|
|
}
|
|
|
|
|
2013-11-26 22:21:32 +00:00
|
|
|
// -------------------------------------------------------------------
|
|
|
|
// Not supported
|
|
|
|
void ObjFileParser::getGroupNumberAndResolution()
|
|
|
|
{
|
|
|
|
// Not used
|
|
|
|
|
|
|
|
m_DataIt = skipLine<DataArrayIt>( m_DataIt, m_DataItEnd, m_uiLine );
|
|
|
|
}
|
|
|
|
|
2008-05-05 12:36:31 +00:00
|
|
|
// -------------------------------------------------------------------
|
|
|
|
// Stores values for a new object instance, name will be used to
|
|
|
|
// identify it.
|
|
|
|
void ObjFileParser::getObjectName()
|
|
|
|
{
|
|
|
|
m_DataIt = getNextToken<DataArrayIt>(m_DataIt, m_DataItEnd);
|
2014-07-03 18:33:52 +00:00
|
|
|
if( m_DataIt == m_DataItEnd ) {
|
|
|
|
return;
|
|
|
|
}
|
2008-05-05 12:36:31 +00:00
|
|
|
char *pStart = &(*m_DataIt);
|
2014-07-03 18:33:52 +00:00
|
|
|
while( m_DataIt != m_DataItEnd && !isSeparator( *m_DataIt ) ) {
|
|
|
|
++m_DataIt;
|
|
|
|
}
|
2008-05-05 12:36:31 +00:00
|
|
|
|
|
|
|
std::string strObjectName(pStart, &(*m_DataIt));
|
|
|
|
if (!strObjectName.empty())
|
|
|
|
{
|
|
|
|
// Reset current object
|
|
|
|
m_pModel->m_pCurrent = NULL;
|
|
|
|
|
|
|
|
// Search for actual object
|
|
|
|
for (std::vector<ObjFile::Object*>::const_iterator it = m_pModel->m_Objects.begin();
|
|
|
|
it != m_pModel->m_Objects.end();
|
|
|
|
++it)
|
|
|
|
{
|
|
|
|
if ((*it)->m_strObjName == strObjectName)
|
|
|
|
{
|
|
|
|
m_pModel->m_pCurrent = *it;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-05-30 18:35:55 +00:00
|
|
|
// Allocate a new object, if current one was not found before
|
2014-07-03 18:33:52 +00:00
|
|
|
if( NULL == m_pModel->m_pCurrent ) {
|
|
|
|
createObject( strObjectName );
|
|
|
|
}
|
2008-05-05 12:36:31 +00:00
|
|
|
}
|
2008-05-16 17:57:48 +00:00
|
|
|
m_DataIt = skipLine<DataArrayIt>( m_DataIt, m_DataItEnd, m_uiLine );
|
2008-05-05 12:36:31 +00:00
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------
|
|
|
|
// Creates a new object instance
|
|
|
|
void ObjFileParser::createObject(const std::string &strObjectName)
|
|
|
|
{
|
2010-05-30 12:45:38 +00:00
|
|
|
ai_assert( NULL != m_pModel );
|
2010-08-23 15:34:48 +00:00
|
|
|
//ai_assert( !strObjectName.empty() );
|
2008-05-05 12:36:31 +00:00
|
|
|
|
2010-05-30 12:45:38 +00:00
|
|
|
m_pModel->m_pCurrent = new ObjFile::Object;
|
2008-05-05 12:36:31 +00:00
|
|
|
m_pModel->m_pCurrent->m_strObjName = strObjectName;
|
2010-02-02 19:54:37 +00:00
|
|
|
m_pModel->m_Objects.push_back( m_pModel->m_pCurrent );
|
2009-11-27 14:33:29 +00:00
|
|
|
|
2010-05-30 12:45:38 +00:00
|
|
|
createMesh();
|
2009-11-27 14:33:29 +00:00
|
|
|
|
2010-02-02 19:54:37 +00:00
|
|
|
if( m_pModel->m_pCurrentMaterial )
|
2009-11-27 14:33:29 +00:00
|
|
|
{
|
|
|
|
m_pModel->m_pCurrentMesh->m_uiMaterialIndex =
|
|
|
|
getMaterialIndex( m_pModel->m_pCurrentMaterial->MaterialName.data );
|
|
|
|
m_pModel->m_pCurrentMesh->m_pMaterial = m_pModel->m_pCurrentMaterial;
|
|
|
|
}
|
2008-05-05 12:36:31 +00:00
|
|
|
}
|
2010-05-30 12:45:38 +00:00
|
|
|
// -------------------------------------------------------------------
|
|
|
|
// Creates a new mesh
|
|
|
|
void ObjFileParser::createMesh()
|
|
|
|
{
|
|
|
|
ai_assert( NULL != m_pModel );
|
|
|
|
m_pModel->m_pCurrentMesh = new ObjFile::Mesh;
|
|
|
|
m_pModel->m_Meshes.push_back( m_pModel->m_pCurrentMesh );
|
|
|
|
unsigned int meshId = m_pModel->m_Meshes.size()-1;
|
|
|
|
if ( NULL != m_pModel->m_pCurrent )
|
|
|
|
{
|
|
|
|
m_pModel->m_pCurrent->m_Meshes.push_back( meshId );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
DefaultLogger::get()->error("OBJ: No object detected to attach a new mesh instance.");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------
|
|
|
|
// Returns true, if a new mesh must be created.
|
|
|
|
bool ObjFileParser::needsNewMesh( const std::string &rMaterialName )
|
|
|
|
{
|
2010-08-27 12:36:02 +00:00
|
|
|
if(m_pModel->m_pCurrentMesh == 0)
|
|
|
|
{
|
|
|
|
// No mesh data yet
|
|
|
|
return true;
|
|
|
|
}
|
2010-05-30 12:45:38 +00:00
|
|
|
bool newMat = false;
|
|
|
|
int matIdx = getMaterialIndex( rMaterialName );
|
|
|
|
int curMatIdx = m_pModel->m_pCurrentMesh->m_uiMaterialIndex;
|
2011-06-09 14:29:32 +00:00
|
|
|
if ( curMatIdx != int(ObjFile::Mesh::NoMaterial) || curMatIdx != matIdx )
|
2010-05-30 12:45:38 +00:00
|
|
|
{
|
|
|
|
// New material -> only one material per mesh, so we need to create a new
|
|
|
|
// material
|
|
|
|
newMat = true;
|
|
|
|
}
|
|
|
|
return newMat;
|
|
|
|
}
|
2008-05-05 12:36:31 +00:00
|
|
|
|
|
|
|
// -------------------------------------------------------------------
|
|
|
|
// Shows an error in parsing process.
|
|
|
|
void ObjFileParser::reportErrorTokenInFace()
|
|
|
|
{
|
2008-05-16 17:57:48 +00:00
|
|
|
m_DataIt = skipLine<DataArrayIt>( m_DataIt, m_DataItEnd, m_uiLine );
|
2009-04-02 15:16:01 +00:00
|
|
|
DefaultLogger::get()->error("OBJ: Not supported token in face description detected");
|
2008-05-05 12:36:31 +00:00
|
|
|
}
|
2010-05-30 12:45:38 +00:00
|
|
|
|
2008-05-05 12:36:31 +00:00
|
|
|
// -------------------------------------------------------------------
|
|
|
|
|
|
|
|
} // Namespace Assimp
|
2009-01-18 23:48:25 +00:00
|
|
|
|
|
|
|
#endif // !! ASSIMP_BUILD_NO_OBJ_IMPORTER
|