Relax VRML1 specifications conformance to support more non-conformant models
This commit is contained in:
parent
ece1291d93
commit
b1d35965f5
|
@ -143,18 +143,8 @@ bool WRL1BASE::Read( WRLPROC& proc )
|
||||||
std::string glob;
|
std::string glob;
|
||||||
WRL1NODES ntype;
|
WRL1NODES ntype;
|
||||||
|
|
||||||
if( !proc.ReadName( glob ) )
|
while( proc.ReadName( glob ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
|
||||||
if( !proc.eof() )
|
|
||||||
{
|
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
|
||||||
std::cerr << proc.GetError() << "\n";
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Process node name: only Separator, Switch and DEF are acceptable;
|
// Process node name: only Separator, Switch and DEF are acceptable;
|
||||||
// WWWAnchor and LOD will not be supported
|
// WWWAnchor and LOD will not be supported
|
||||||
|
@ -218,6 +208,18 @@ bool WRL1BASE::Read( WRLPROC& proc )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !proc.eof() )
|
||||||
|
{
|
||||||
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
||||||
|
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
std::cerr << proc.GetError() << "\n";
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -723,15 +725,32 @@ SGNODE* WRL1BASE::TranslateToSG( SGNODE* aParent, WRL1STATUS* /*sp*/ )
|
||||||
if( m_Items.empty() )
|
if( m_Items.empty() )
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if( m_Items.size() != 1 )
|
if( m_Items.size() == 1 )
|
||||||
{
|
return (*m_Items.begin())->TranslateToSG( NULL, NULL );
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
|
||||||
std::cerr << " * [INFO] Bad VRML file, >1 top level transform (";
|
|
||||||
std::cerr << m_Items.size() << ")\n";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
m_current.Init();
|
||||||
|
|
||||||
|
IFSG_TRANSFORM txNode( true );
|
||||||
|
bool hasContent = false;
|
||||||
|
|
||||||
|
std::list< WRL1NODE* >::iterator sI = m_Items.begin();
|
||||||
|
std::list< WRL1NODE* >::iterator eI = m_Items.end();
|
||||||
|
|
||||||
|
SGNODE* node = txNode.GetRawPtr();
|
||||||
|
|
||||||
|
while( sI != eI )
|
||||||
|
{
|
||||||
|
if( NULL != (*sI)->TranslateToSG( node, &m_current ) )
|
||||||
|
hasContent = true;
|
||||||
|
|
||||||
|
++sI;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !hasContent )
|
||||||
|
{
|
||||||
|
txNode.Destroy();
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (*m_Items.begin())->TranslateToSG( NULL, NULL );
|
return node;
|
||||||
}
|
}
|
||||||
|
|
|
@ -170,7 +170,7 @@ SGNODE* WRL1GROUP::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp )
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else if( NULL == sp )
|
||||||
{
|
{
|
||||||
m_current.Init();
|
m_current.Init();
|
||||||
sp = &m_current;
|
sp = &m_current;
|
||||||
|
|
Loading…
Reference in New Issue