Obj_Importer: remove dead code.

pull/790/head
Kim Kulling 2016-02-09 17:50:08 +01:00
parent 1550191256
commit 8681abe845
1 changed files with 20 additions and 25 deletions

View File

@ -323,19 +323,18 @@ void ObjFileParser::getVector2( std::vector<aiVector2D> &point2d_array ) {
m_DataIt = skipLine<DataArrayIt>( m_DataIt, m_DataItEnd, m_uiLine ); m_DataIt = skipLine<DataArrayIt>( m_DataIt, m_DataItEnd, m_uiLine );
} }
static const std::string DefaultObjName = "defaultobject";
// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Get values for a new face instance // Get values for a new face instance
void ObjFileParser::getFace(aiPrimitiveType type) void ObjFileParser::getFace(aiPrimitiveType type) {
{
copyNextLine(m_buffer, Buffersize); copyNextLine(m_buffer, Buffersize);
/*if (m_DataIt == m_DataItEnd)
return;*/
char *pPtr = m_buffer; char *pPtr = m_buffer;
char *pEnd = &pPtr[Buffersize]; char *pEnd = &pPtr[Buffersize];
pPtr = getNextToken<char*>(pPtr, pEnd); pPtr = getNextToken<char*>(pPtr, pEnd);
if (pPtr == pEnd || *pPtr == '\0') if ( pPtr == pEnd || *pPtr == '\0' ) {
return; return;
}
std::vector<unsigned int> *pIndices = new std::vector<unsigned int>; std::vector<unsigned int> *pIndices = new std::vector<unsigned int>;
std::vector<unsigned int> *pTexID = new std::vector<unsigned int>; std::vector<unsigned int> *pTexID = new std::vector<unsigned int>;
@ -349,20 +348,18 @@ void ObjFileParser::getFace(aiPrimitiveType type)
const bool vt = (!m_pModel->m_TextureCoord.empty()); const bool vt = (!m_pModel->m_TextureCoord.empty());
const bool vn = (!m_pModel->m_Normals.empty()); const bool vn = (!m_pModel->m_Normals.empty());
int iStep = 0, iPos = 0; int iStep = 0, iPos = 0;
while (pPtr != pEnd) while (pPtr != pEnd) {
{
iStep = 1; iStep = 1;
if (IsLineEnd(*pPtr)) if ( IsLineEnd( *pPtr ) ) {
break; break;
}
if (*pPtr=='/' ) if (*pPtr=='/' ) {
{
if (type == aiPrimitiveType_POINT) { if (type == aiPrimitiveType_POINT) {
DefaultLogger::get()->error("Obj: Separator unexpected in point statement"); DefaultLogger::get()->error("Obj: Separator unexpected in point statement");
} }
if (iPos == 0) if (iPos == 0) {
{
//if there are no texture coordinates in the file, but normals //if there are no texture coordinates in the file, but normals
if (!vt && vn) { if (!vt && vn) {
iPos = 1; iPos = 1;
@ -370,22 +367,20 @@ void ObjFileParser::getFace(aiPrimitiveType type)
} }
} }
iPos++; iPos++;
} } else if( IsSpaceOrNewLine( *pPtr ) ) {
else if( IsSpaceOrNewLine( *pPtr ) )
{
iPos = 0; iPos = 0;
} } else {
else
{
//OBJ USES 1 Base ARRAYS!!!! //OBJ USES 1 Base ARRAYS!!!!
const int iVal = atoi( pPtr ); const int iVal( ::atoi( pPtr ) );
// increment iStep position based off of the sign and # of digits // increment iStep position based off of the sign and # of digits
int tmp = iVal; int tmp = iVal;
if (iVal < 0) if ( iVal < 0 ) {
++iStep; ++iStep;
while ( ( tmp = tmp / 10 )!=0 ) }
while ( ( tmp = tmp / 10 ) != 0 ) {
++iStep; ++iStep;
}
if ( iVal > 0 ) if ( iVal > 0 )
{ {
@ -455,12 +450,12 @@ void ObjFileParser::getFace(aiPrimitiveType type)
// Create a default object, if nothing is there // Create a default object, if nothing is there
if( NULL == m_pModel->m_pCurrent ) { if( NULL == m_pModel->m_pCurrent ) {
createObject( "defaultobject" ); createObject( DefaultObjName );
} }
// Assign face to mesh // Assign face to mesh
if ( NULL == m_pModel->m_pCurrentMesh ) { if ( NULL == m_pModel->m_pCurrentMesh ) {
createMesh( "defaultobject" ); createMesh( DefaultObjName );
} }
// Store the face // Store the face
@ -782,9 +777,9 @@ void ObjFileParser::createMesh( const std::string &meshName )
// Returns true, if a new mesh must be created. // Returns true, if a new mesh must be created.
bool ObjFileParser::needsNewMesh( const std::string &rMaterialName ) bool ObjFileParser::needsNewMesh( const std::string &rMaterialName )
{ {
// If no mesh data yet
if(m_pModel->m_pCurrentMesh == 0) if(m_pModel->m_pCurrentMesh == 0)
{ {
// No mesh data yet
return true; return true;
} }
bool newMat = false; bool newMat = false;