Change logging of X3D and VRML1 parsers from stderr to wxLogTrace

This commit is contained in:
Cirilo Bernardo 2016-02-23 11:20:34 +11:00
parent 0d14fd0f9b
commit 14178ee521
22 changed files with 1031 additions and 466 deletions

View File

@ -6,7 +6,7 @@ include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/x3d ${CMAKE_CURRENT_SOURCE_DIR}/x3d
) )
add_definitions( -DDEBUG_VRML1=1 -DDEBUG_VRML2=1 -DDEBUG_X3D=1 ) add_definitions( -DDEBUG_VRML1=3 -DDEBUG_VRML2=3 -DDEBUG_X3D=3 )
add_library( s3d_plugin_vrml MODULE add_library( s3d_plugin_vrml MODULE
${CMAKE_SOURCE_DIR}/common/richio.cpp ${CMAKE_SOURCE_DIR}/common/richio.cpp

View File

@ -22,6 +22,8 @@
*/ */
#include <iostream> #include <iostream>
#include <sstream>
#include <wx/log.h>
#include "vrml1_base.h" #include "vrml1_base.h"
#include "vrml1_group.h" #include "vrml1_group.h"
@ -48,7 +50,7 @@ WRL1BASE::WRL1BASE() : WRL1NODE( NULL )
WRL1BASE::~WRL1BASE() WRL1BASE::~WRL1BASE()
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 )
std::cerr << " * [INFO] Destroying virtual base node\n"; wxLogTrace( MASK_VRML, " * [INFO] Destroying virtual base node\n" );
#endif #endif
cancelDict(); cancelDict();
@ -60,8 +62,12 @@ WRL1BASE::~WRL1BASE()
bool WRL1BASE::SetParent( WRL1NODE* aParent ) bool WRL1BASE::SetParent( WRL1NODE* aParent )
{ {
#ifdef DEBUG_VRML1 #ifdef DEBUG_VRML1
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << " * [BUG] attempting to set parent on WRL1BASE node\n"; std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] attempting to set parent on WRL1BASE node";
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -109,8 +115,12 @@ void WRL1BASE::DelInlineData( const std::string& aName, WRL1INLINE* aObject )
std::string WRL1BASE::GetName( void ) std::string WRL1BASE::GetName( void )
{ {
#ifdef DEBUG_VRML1 #ifdef DEBUG_VRML1
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << " * [BUG] attempting to extract name from virtual base node\n"; std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] attempting to extract name from virtual base node";
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return std::string( "" ); return std::string( "" );
@ -120,8 +130,12 @@ std::string WRL1BASE::GetName( void )
bool WRL1BASE::SetName( const std::string& aName ) bool WRL1BASE::SetName( const std::string& aName )
{ {
#ifdef DEBUG_VRML1 #ifdef DEBUG_VRML1
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << " * [BUG] attempting to set name on virtual base node\n"; std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] attempting to set name on virtual base node";
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -133,15 +147,18 @@ bool WRL1BASE::Read( WRLPROC& proc )
if( proc.GetVRMLType() != VRML_V1 ) if( proc.GetVRMLType() != VRML_V1 )
{ {
#ifdef DEBUG_VRML1 #ifdef DEBUG_VRML1
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << " * [BUG] no open file or file is not a VRML1 file\n"; std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] no open file or file is not a VRML1 file";
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
} }
std::string glob; std::string glob;
WRL1NODES ntype;
// Note: according to the VRML1 specification, a file may contain // Note: according to the VRML1 specification, a file may contain
// only one grouping node at the top level. The following code // only one grouping node at the top level. The following code
@ -150,12 +167,19 @@ bool WRL1BASE::Read( WRLPROC& proc )
while( proc.Peek() ) while( proc.Peek() )
{ {
size_t line, column;
proc.GetFilePosData( line, column );
if( !ReadNode( proc, this, NULL ) ) if( !ReadNode( proc, this, NULL ) )
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << " * [INFO] bad file format; unexpected eof at line "; std::ostringstream ostr;
std::cerr << line << ", column " << column << "\n"; ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] bad file format; unexpected eof at line ";
ostr << line << ", column " << column;
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -165,8 +189,12 @@ bool WRL1BASE::Read( WRLPROC& proc )
if( !proc.eof() ) if( !proc.eof() )
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << proc.GetError() << "\n"; std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << proc.GetError();
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -184,8 +212,12 @@ bool WRL1BASE::implementUse( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode
if( !aParent ) if( !aParent )
{ {
#ifdef DEBUG_VRML1 #ifdef DEBUG_VRML1
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << " * [BUG] invoked with NULL parent\n"; std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] invoked with NULL parent";
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -196,8 +228,12 @@ bool WRL1BASE::implementUse( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode
if( !proc.ReadName( glob ) ) if( !proc.ReadName( glob ) )
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << proc.GetError() << "\n"; std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << proc.GetError();
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -209,8 +245,12 @@ bool WRL1BASE::implementUse( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode
if( NULL == ref ) if( NULL == ref )
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << " * [INFO] node '" << glob << "' not found\n"; std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] node '" << glob << "' not found";
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return true; return true;
@ -219,10 +259,14 @@ bool WRL1BASE::implementUse( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode
if( !aParent->AddRefNode( ref ) ) if( !aParent->AddRefNode( ref ) )
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << " * [INFO] failed to add node '" << glob << "' ("; std::ostringstream ostr;
std::cerr << ref->GetNodeTypeName( ref->GetNodeType() ) << ") to parent of type "; ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << aParent->GetNodeTypeName( aParent->GetNodeType() ) << "\n"; ostr << " * [INFO] failed to add node '" << glob << "' (";
ostr << ref->GetNodeTypeName( ref->GetNodeType() ) << ") to parent of type ";
ostr << aParent->GetNodeTypeName( aParent->GetNodeType() );
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -243,8 +287,12 @@ bool WRL1BASE::implementDef( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode
if( NULL == aParent ) if( NULL == aParent )
{ {
#ifdef DEBUG_VRML1 #ifdef DEBUG_VRML1
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << " * [BUG] invalid parent pointer (NULL)\n"; std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] invalid parent pointer (NULL)";
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -256,8 +304,12 @@ bool WRL1BASE::implementDef( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode
if( !proc.ReadName( glob ) ) if( !proc.ReadName( glob ) )
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << proc.GetError() << "\n"; std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << proc.GetError();
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -274,11 +326,15 @@ bool WRL1BASE::implementDef( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode
if( lnode && !lnode->SetName( glob ) ) if( lnode && !lnode->SetName( glob ) )
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
size_t line, column; do {
proc.GetFilePosData( line, column ); std::ostringstream ostr;
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; size_t line, column;
std::cerr << " * [INFO] bad formatting (invalid name) at line"; proc.GetFilePosData( line, column );
std::cerr << line << ", column " << column << "\n"; ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] bad formatting (invalid name) at line";
ostr << line << ", column " << column;
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -310,8 +366,12 @@ bool WRL1BASE::ReadNode( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode )
if( NULL == aParent ) if( NULL == aParent )
{ {
#ifdef DEBUG_VRML1 #ifdef DEBUG_VRML1
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << " * [BUG] invalid parent pointer (NULL)\n"; std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] invalid parent pointer (NULL)";
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -325,8 +385,10 @@ bool WRL1BASE::ReadNode( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode )
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
if( !proc.eof() ) if( !proc.eof() )
{ {
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; std::ostringstream ostr;
std::cerr << proc.GetError() << "\n"; ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << proc.GetError();
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} }
#endif #endif
@ -342,8 +404,12 @@ bool WRL1BASE::ReadNode( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode )
if( !implementUse( proc, aParent, aNode ) ) if( !implementUse( proc, aParent, aNode ) )
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << proc.GetError() << "\n"; std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << proc.GetError();
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -357,8 +423,12 @@ bool WRL1BASE::ReadNode( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode )
if( !implementDef( proc, aParent, aNode ) ) if( !implementDef( proc, aParent, aNode ) )
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << proc.GetError() << "\n"; std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << proc.GetError();
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -373,7 +443,11 @@ bool WRL1BASE::ReadNode( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode )
proc.GetFilePosData( line, column ); proc.GetFilePosData( line, column );
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 )
std::cerr << " * [INFO] Processing node '" << glob << "' ID: " << ntype << "\n"; do {
std::ostringstream ostr;
ostr << " * [INFO] Processing node '" << glob << "' ID: " << ntype;
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
switch( ntype ) switch( ntype )
@ -454,10 +528,14 @@ bool WRL1BASE::ReadNode( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode )
if( !proc.DiscardNode() ) if( !proc.DiscardNode() )
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
std::cerr << proc.GetError() << "\n"; do {
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; std::ostringstream ostr;
std::cerr << " * [INFO] could not discard node at line " << line; ostr << proc.GetError() << "\n";
std::cerr << ", column " << column << "\n"; ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] could not discard node at line " << line;
ostr << ", column " << column;
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -465,8 +543,10 @@ bool WRL1BASE::ReadNode( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode )
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
else else
{ {
std::cerr << " * [INFO] discarded node '" << glob << "' at line "; std::ostringstream ostr;
std::cerr << line << ", col " << column << " (currently unsupported)\n"; ostr << " * [INFO] discarded node '" << glob << "' at line ";
ostr << line << ", col " << column << " (currently unsupported)";
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} }
#endif #endif
@ -481,9 +561,13 @@ bool WRL1BASE::Read( WRLPROC& proc, WRL1BASE* aTopNode )
{ {
// this function makes no sense in the base node // this function makes no sense in the base node
#ifdef DEBUG_VRML1 #ifdef DEBUG_VRML1
std::cerr << proc.GetError() << "\n"; do {
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; std::ostringstream ostr;
std::cerr << " * [BUG] this method must never be invoked on a WRL1BASE object\n"; ostr << proc.GetError() << "\n";
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] this method must never be invoked on a WRL1BASE object";
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -670,8 +754,12 @@ bool WRL1BASE::readShapeHints( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNod
SGNODE* WRL1BASE::TranslateToSG( SGNODE* aParent, WRL1STATUS* /*sp*/ ) SGNODE* WRL1BASE::TranslateToSG( SGNODE* aParent, WRL1STATUS* /*sp*/ )
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 )
std::cerr << " * [INFO] Translating VRML1 Base with " << m_Items.size(); do {
std::cerr << " items\n"; std::ostringstream ostr;
ostr << " * [INFO] Translating VRML1 Base with " << m_Items.size();
ostr << " items";
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
if( m_Items.empty() ) if( m_Items.empty() )

View File

@ -23,6 +23,8 @@
#include <iostream> #include <iostream>
#include <sstream>
#include <wx/log.h>
#include "vrml1_base.h" #include "vrml1_base.h"
#include "vrml1_coords.h" #include "vrml1_coords.h"
@ -51,7 +53,7 @@ WRL1COORDS::WRL1COORDS( NAMEREGISTER* aDictionary, WRL1NODE* aParent ) :
WRL1COORDS::~WRL1COORDS() WRL1COORDS::~WRL1COORDS()
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 )
std::cerr << " * [INFO] Destroying Coordinate3 node\n"; wxLogTrace( MASK_VRML, " * [INFO] Destroying Coordinate3 node\n" );
#endif #endif
return; return;
@ -63,8 +65,12 @@ bool WRL1COORDS::AddRefNode( WRL1NODE* aNode )
// this node may not own or reference any other node // this node may not own or reference any other node
#ifdef DEBUG_VRML1 #ifdef DEBUG_VRML1
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << " * [BUG] AddRefNode is not applicable\n"; std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] AddRefNode is not applicable";
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -76,8 +82,12 @@ bool WRL1COORDS::AddChildNode( WRL1NODE* aNode )
// this node may not own or reference any other node // this node may not own or reference any other node
#ifdef DEBUG_VRML1 #ifdef DEBUG_VRML1
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << " * [BUG] AddChildNode is not applicable\n"; std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] AddChildNode is not applicable";
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -94,9 +104,13 @@ bool WRL1COORDS::Read( WRLPROC& proc, WRL1BASE* aTopNode )
if( proc.eof() ) if( proc.eof() )
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << " * [INFO] bad file format; unexpected eof at line "; std::ostringstream ostr;
std::cerr << line << ", column " << column << "\n"; ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] bad file format; unexpected eof at line ";
ostr << line << ", column " << column;
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -105,10 +119,14 @@ bool WRL1COORDS::Read( WRLPROC& proc, WRL1BASE* aTopNode )
if( '{' != tok ) if( '{' != tok )
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
std::cerr << proc.GetError() << "\n"; do {
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; std::ostringstream ostr;
std::cerr << " * [INFO] bad file format; expecting '{' but got '" << tok; ostr << proc.GetError() << "\n";
std::cerr << "' at line " << line << ", column " << column << "\n"; ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] bad file format; expecting '{' but got '" << tok;
ostr << "' at line " << line << ", column " << column << "\n";
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -126,8 +144,12 @@ bool WRL1COORDS::Read( WRLPROC& proc, WRL1BASE* aTopNode )
if( !proc.ReadName( glob ) ) if( !proc.ReadName( glob ) )
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << proc.GetError() << "\n"; std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << proc.GetError();
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -141,11 +163,15 @@ bool WRL1COORDS::Read( WRLPROC& proc, WRL1BASE* aTopNode )
if( !proc.ReadMFVec3f( points ) ) if( !proc.ReadMFVec3f( points ) )
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << " * [INFO] invalid point set at line " << line << ", column "; std::ostringstream ostr;
std::cerr << column << "\n"; ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; ostr << " * [INFO] invalid point set at line " << line << ", column ";
std::cerr << " * [INFO] message: '" << proc.GetError() << "'\n"; ostr << column << "\n";
ostr << " * [INFO] file: '" << proc.GetFileName() << "'\n";
ostr << " * [INFO] message: '" << proc.GetError();
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -154,10 +180,14 @@ bool WRL1COORDS::Read( WRLPROC& proc, WRL1BASE* aTopNode )
else else
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << " * [INFO] bad Coordinate at line " << line << ", column "; std::ostringstream ostr;
std::cerr << column << "\n"; ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; ostr << " * [INFO] bad Coordinate at line " << line << ", column ";
ostr << column << "\n";
ostr << " * [INFO] file: '" << proc.GetFileName();
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -185,10 +215,14 @@ bool WRL1COORDS::Read( WRLPROC& proc, WRL1BASE* aTopNode )
proc.GetFilePosData( line, column ); proc.GetFilePosData( line, column );
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << " * [INFO] bad Coordinate at line " << line << ", column "; std::ostringstream ostr;
std::cerr << column << " (no closing brace)\n"; ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; ostr << " * [INFO] bad Coordinate at line " << line << ", column ";
ostr << column << " (no closing brace)\n";
ostr << " * [INFO] file: '" << proc.GetFileName();
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -215,7 +249,7 @@ SGNODE* WRL1COORDS::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp )
if( NULL == sp ) if( NULL == sp )
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
std::cerr << " * [INFO] bad model: no base data given\n"; wxLogTrace( MASK_VRML, " * [INFO] bad model: no base data given\n" );
#endif #endif
return NULL; return NULL;

View File

@ -23,6 +23,8 @@
#include <iostream> #include <iostream>
#include <sstream>
#include <wx/log.h>
#include "vrml1_base.h" #include "vrml1_base.h"
#include "vrml1_faceset.h" #include "vrml1_faceset.h"
@ -56,9 +58,13 @@ WRL1FACESET::WRL1FACESET( NAMEREGISTER* aDictionary, WRL1NODE* aParent ) :
WRL1FACESET::~WRL1FACESET() WRL1FACESET::~WRL1FACESET()
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 )
std::cerr << " * [INFO] Destroying IndexedFaceSet with " << m_Children.size(); do {
std::cerr << " children, " << m_Refs.size() << " references and "; std::ostringstream ostr;
std::cerr << m_BackPointers.size() << " backpointers\n"; ostr << " * [INFO] Destroying IndexedFaceSet with " << m_Children.size();
ostr << " children, " << m_Refs.size() << " references and ";
ostr << m_BackPointers.size() << " backpointers";
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return; return;
@ -70,8 +76,12 @@ bool WRL1FACESET::AddRefNode( WRL1NODE* aNode )
// this node may not own or reference any other node // this node may not own or reference any other node
#ifdef DEBUG_VRML1 #ifdef DEBUG_VRML1
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << " * [BUG] AddRefNode is not applicable\n"; std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] AddRefNode is not applicable";
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -83,8 +93,12 @@ bool WRL1FACESET::AddChildNode( WRL1NODE* aNode )
// this node may not own or reference any other node // this node may not own or reference any other node
#ifdef DEBUG_VRML1 #ifdef DEBUG_VRML1
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << " * [BUG] AddChildNode is not applicable\n"; std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] AddChildNode is not applicable";
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -101,9 +115,13 @@ bool WRL1FACESET::Read( WRLPROC& proc, WRL1BASE* aTopNode )
if( proc.eof() ) if( proc.eof() )
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << " * [INFO] bad file format; unexpected eof at line "; std::ostringstream ostr;
std::cerr << line << ", column " << column << "\n"; ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] bad file format; unexpected eof at line ";
ostr << line << ", column " << column;
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -112,10 +130,14 @@ bool WRL1FACESET::Read( WRLPROC& proc, WRL1BASE* aTopNode )
if( '{' != tok ) if( '{' != tok )
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
std::cerr << proc.GetError() << "\n"; do {
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; std::ostringstream ostr;
std::cerr << " * [INFO] bad file format; expecting '{' but got '" << tok; ostr << proc.GetError() << "\n";
std::cerr << "' at line " << line << ", column " << column << "\n"; ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] bad file format; expecting '{' but got '" << tok;
ostr << "' at line " << line << ", column " << column;
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -135,8 +157,12 @@ bool WRL1FACESET::Read( WRLPROC& proc, WRL1BASE* aTopNode )
if( !proc.ReadName( glob ) ) if( !proc.ReadName( glob ) )
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << proc.GetError() << "\n"; std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << proc.GetError();
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -153,11 +179,15 @@ bool WRL1FACESET::Read( WRLPROC& proc, WRL1BASE* aTopNode )
if( !proc.ReadMFInt( coordIndex ) ) if( !proc.ReadMFInt( coordIndex ) )
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << " * [INFO] invalid coordIndex at line " << line << ", column "; std::ostringstream ostr;
std::cerr << column << "\n"; ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; ostr << " * [INFO] invalid coordIndex at line " << line << ", column ";
std::cerr << " * [INFO] message: '" << proc.GetError() << "'\n"; ostr << column << "\n";
ostr << " * [INFO] file: '" << proc.GetFileName() << "'\n";
ostr << " * [INFO] message: '" << proc.GetError();
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -168,11 +198,15 @@ bool WRL1FACESET::Read( WRLPROC& proc, WRL1BASE* aTopNode )
if( !proc.ReadMFInt( matIndex ) ) if( !proc.ReadMFInt( matIndex ) )
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << " * [INFO] invalid materialIndex at line " << line << ", column "; std::ostringstream ostr;
std::cerr << column << "\n"; ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; ostr << " * [INFO] invalid materialIndex at line " << line << ", column ";
std::cerr << " * [INFO] message: '" << proc.GetError() << "'\n"; ostr << column << "\n";
ostr << " * [INFO] file: '" << proc.GetFileName() << "'\n";
ostr << " * [INFO] message: '" << proc.GetError();
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -183,11 +217,15 @@ bool WRL1FACESET::Read( WRLPROC& proc, WRL1BASE* aTopNode )
if( !proc.ReadMFInt( normIndex ) ) if( !proc.ReadMFInt( normIndex ) )
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << " * [INFO] invalid normalIndex at line " << line << ", column "; std::ostringstream ostr;
std::cerr << column << "\n"; ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; ostr << " * [INFO] invalid normalIndex at line " << line << ", column ";
std::cerr << " * [INFO] message: '" << proc.GetError() << "'\n"; ostr << column << "\n";
ostr << " * [INFO] file: '" << proc.GetFileName() << "'\n";
ostr << " * [INFO] message: '" << proc.GetError();
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -198,11 +236,15 @@ bool WRL1FACESET::Read( WRLPROC& proc, WRL1BASE* aTopNode )
if( !proc.ReadMFInt( texIndex ) ) if( !proc.ReadMFInt( texIndex ) )
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << " * [INFO] invalid textureCoordIndex at line " << line << ", column "; std::ostringstream ostr;
std::cerr << column << "\n"; ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; ostr << " * [INFO] invalid textureCoordIndex at line " << line << ", column ";
std::cerr << " * [INFO] message: '" << proc.GetError() << "'\n"; ostr << column << "\n";
ostr << " * [INFO] file: '" << proc.GetFileName() << "'\n";
ostr << " * [INFO] message: '" << proc.GetError();
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -211,10 +253,14 @@ bool WRL1FACESET::Read( WRLPROC& proc, WRL1BASE* aTopNode )
else else
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << " * [INFO] bad IndexedFaceSet at line " << line << ", column "; std::ostringstream ostr;
std::cerr << column << "\n"; ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; ostr << " * [INFO] bad IndexedFaceSet at line " << line << ", column ";
ostr << column << "\n";
ostr << " * [INFO] file: '" << proc.GetFileName() << "'";
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -234,7 +280,7 @@ SGNODE* WRL1FACESET::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp )
if( !m_Parent ) if( !m_Parent )
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
std::cerr << " * [INFO] bad model: no parent node\n"; wxLogTrace( MASK_VRML, " * [INFO] bad model: no parent node\n" );
#endif #endif
return NULL; return NULL;
@ -244,7 +290,7 @@ SGNODE* WRL1FACESET::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp )
if( NULL == sp ) if( NULL == sp )
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
std::cerr << " * [INFO] bad model: no base data given\n"; wxLogTrace( MASK_VRML, " * [INFO] bad model: no base data given\n" );
#endif #endif
return NULL; return NULL;
@ -257,10 +303,10 @@ SGNODE* WRL1FACESET::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp )
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
if( NULL == m_current.coord ) if( NULL == m_current.coord )
std::cerr << " * [INFO] bad model: no vertex set\n"; wxLogTrace( MASK_VRML, " * [INFO] bad model: no vertex set\n" );
if( NULL == m_current.mat ) if( NULL == m_current.mat )
std::cerr << " * [INFO] bad model: no material set\n"; wxLogTrace( MASK_VRML, " * [INFO] bad model: no material set\n" );
#endif #endif
return NULL; return NULL;
@ -275,8 +321,12 @@ SGNODE* WRL1FACESET::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp )
if( coordsize < 3 || vsize < 3 ) if( coordsize < 3 || vsize < 3 )
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
std::cerr << " * [INFO] bad model: coordsize, indexsize = " << coordsize; do {
std::cerr << ", " << vsize << "\n"; std::ostringstream ostr;
ostr << " * [INFO] bad model: coordsize, indexsize = " << coordsize;
ostr << ", " << vsize;
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return NULL; return NULL;
@ -302,7 +352,7 @@ SGNODE* WRL1FACESET::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp )
if( matIndex.empty() ) if( matIndex.empty() )
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
std::cerr << " * [INFO] bad model: per face indexed but no indices\n"; wxLogTrace( MASK_VRML, " * [INFO] bad model: per face indexed but no indices\n" );
#endif #endif
// support bad models by temporarily switching bindings // support bad models by temporarily switching bindings

View File

@ -28,6 +28,8 @@
// simply duplicate the code // simply duplicate the code
#include <iostream> #include <iostream>
#include <sstream>
#include <wx/log.h>
#include "vrml1_base.h" #include "vrml1_base.h"
#include "vrml1_group.h" #include "vrml1_group.h"
@ -57,9 +59,13 @@ WRL1GROUP::WRL1GROUP( NAMEREGISTER* aDictionary, WRL1NODE* aParent ) :
WRL1GROUP::~WRL1GROUP() WRL1GROUP::~WRL1GROUP()
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 )
std::cerr << " * [INFO] Destroying Group with " << m_Children.size(); do {
std::cerr << " children, " << m_Refs.size() << " references and "; std::ostringstream ostr;
std::cerr << m_BackPointers.size() << " backpointers\n"; ostr << " * [INFO] Destroying Group with " << m_Children.size();
ostr << " children, " << m_Refs.size() << " references and ";
ostr << m_BackPointers.size() << " backpointers";
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return; return;
@ -72,8 +78,12 @@ bool WRL1GROUP::Read( WRLPROC& proc, WRL1BASE* aTopNode )
if( NULL == aTopNode ) if( NULL == aTopNode )
{ {
#ifdef DEBUG_VRML1 #ifdef DEBUG_VRML1
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << " * [BUG] aTopNode is NULL\n"; std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] aTopNode is NULL";
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -87,9 +97,13 @@ bool WRL1GROUP::Read( WRLPROC& proc, WRL1BASE* aTopNode )
if( proc.eof() ) if( proc.eof() )
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << " * [INFO] bad file format; unexpected eof at line "; std::ostringstream ostr;
std::cerr << line << ", column " << column << "\n"; ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] bad file format; unexpected eof at line ";
ostr << line << ", column " << column;
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -98,10 +112,14 @@ bool WRL1GROUP::Read( WRLPROC& proc, WRL1BASE* aTopNode )
if( '{' != tok ) if( '{' != tok )
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
std::cerr << proc.GetError() << "\n"; do {
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; std::ostringstream ostr;
std::cerr << " * [INFO] bad file format; expecting '{' but got '" << tok; ostr << proc.GetError() << "\n";
std::cerr << "' at line " << line << ", column " << column << "\n"; ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] bad file format; expecting '{' but got '" << tok;
ostr << "' at line " << line << ", column " << column;
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -123,9 +141,13 @@ bool WRL1GROUP::Read( WRLPROC& proc, WRL1BASE* aTopNode )
if( !aTopNode->ReadNode( proc, this, NULL ) ) if( !aTopNode->ReadNode( proc, this, NULL ) )
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << " * [INFO] bad file format; unexpected eof at line "; std::ostringstream ostr;
std::cerr << line << ", column " << column << "\n"; ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] bad file format; unexpected eof at line ";
ostr << line << ", column " << column;
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -143,17 +165,25 @@ bool WRL1GROUP::Read( WRLPROC& proc, WRL1BASE* aTopNode )
SGNODE* WRL1GROUP::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp ) SGNODE* WRL1GROUP::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp )
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 )
std::cerr << " * [INFO] Translating Group with " << m_Children.size(); do {
std::cerr << " children, " << m_Refs.size() << " references and "; std::ostringstream ostr;
std::cerr << m_BackPointers.size() << " backpointers (total "; ostr << " * [INFO] Translating Group with " << m_Children.size();
std::cerr << m_Items.size() << " items)\n"; ostr << " children, " << m_Refs.size() << " references and ";
ostr << m_BackPointers.size() << " backpointers (total ";
ostr << m_Items.size() << " items)";
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
if( !m_Parent ) if( !m_Parent )
{ {
#ifdef DEBUG #ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << " * [BUG] Group has no parent\n"; std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] Group has no parent";
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return NULL; return NULL;
@ -164,7 +194,7 @@ SGNODE* WRL1GROUP::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp )
if( NULL == sp ) if( NULL == sp )
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
std::cerr << " * [INFO] bad model: no base data given\n"; wxLogTrace( MASK_VRML, " * [INFO] bad model: no base data given\n" );
#endif #endif
return NULL; return NULL;
@ -181,9 +211,13 @@ SGNODE* WRL1GROUP::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp )
if( NULL != aParent && ptype != S3D::SGTYPE_TRANSFORM ) if( NULL != aParent && ptype != S3D::SGTYPE_TRANSFORM )
{ {
#ifdef DEBUG_VRML1 #ifdef DEBUG_VRML1
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << " * [BUG] Group does not have a Transform parent (parent ID: "; std::ostringstream ostr;
std::cerr << ptype << ")\n"; ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] Group does not have a Transform parent (parent ID: ";
ostr << ptype << ")";
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return NULL; return NULL;

View File

@ -23,6 +23,8 @@
#include <iostream> #include <iostream>
#include <sstream>
#include <wx/log.h>
#include "vrml1_base.h" #include "vrml1_base.h"
#include "vrml1_matbinding.h" #include "vrml1_matbinding.h"
@ -54,7 +56,7 @@ WRL1MATBINDING::WRL1MATBINDING( NAMEREGISTER* aDictionary, WRL1NODE* aParent ) :
WRL1MATBINDING::~WRL1MATBINDING() WRL1MATBINDING::~WRL1MATBINDING()
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 )
std::cerr << " * [INFO] Destroying MaterialBinding node\n"; wxLogTrace( MASK_VRML, " * [INFO] Destroying MaterialBinding node\n" );
#endif #endif
return; return;
@ -66,8 +68,12 @@ bool WRL1MATBINDING::AddRefNode( WRL1NODE* aNode )
// this node may not own or reference any other node // this node may not own or reference any other node
#ifdef DEBUG_VRML1 #ifdef DEBUG_VRML1
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << " * [BUG] AddRefNode is not applicable\n"; std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] AddRefNode is not applicable";
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -79,8 +85,12 @@ bool WRL1MATBINDING::AddChildNode( WRL1NODE* aNode )
// this node may not own or reference any other node // this node may not own or reference any other node
#ifdef DEBUG_VRML1 #ifdef DEBUG_VRML1
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << " * [BUG] AddChildNode is not applicable\n"; std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] AddChildNode is not applicable";
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -92,8 +102,12 @@ bool WRL1MATBINDING::Read( WRLPROC& proc, WRL1BASE* aTopNode )
if( NULL == aTopNode ) if( NULL == aTopNode )
{ {
#ifdef DEBUG_VRML1 #ifdef DEBUG_VRML1
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << " * [BUG] aTopNode is NULL\n"; std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] aTopNode is NULL";
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -107,9 +121,13 @@ bool WRL1MATBINDING::Read( WRLPROC& proc, WRL1BASE* aTopNode )
if( proc.eof() ) if( proc.eof() )
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << " * [INFO] bad file format; unexpected eof at line "; std::ostringstream ostr;
std::cerr << line << ", column " << column << "\n"; ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] bad file format; unexpected eof at line ";
ostr << line << ", column " << column;
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -118,10 +136,14 @@ bool WRL1MATBINDING::Read( WRLPROC& proc, WRL1BASE* aTopNode )
if( '{' != tok ) if( '{' != tok )
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
std::cerr << proc.GetError() << "\n"; do {
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; std::ostringstream ostr;
std::cerr << " * [INFO] bad file format; expecting '{' but got '" << tok; ostr << proc.GetError() << "\n";
std::cerr << "' at line " << line << ", column " << column << "\n"; ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] bad file format; expecting '{' but got '" << tok;
ostr << "' at line " << line << ", column " << column;
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -141,8 +163,12 @@ bool WRL1MATBINDING::Read( WRLPROC& proc, WRL1BASE* aTopNode )
if( !proc.ReadName( glob ) ) if( !proc.ReadName( glob ) )
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << proc.GetError() << "\n"; std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << proc.GetError();
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -151,10 +177,14 @@ bool WRL1MATBINDING::Read( WRLPROC& proc, WRL1BASE* aTopNode )
if( glob.compare( "value" ) ) if( glob.compare( "value" ) )
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << " * [INFO] bad MaterialBinding at line " << line << ", column "; std::ostringstream ostr;
std::cerr << column << " (did not find keyword 'value')\n"; ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; ostr << " * [INFO] bad MaterialBinding at line " << line << ", column ";
ostr << column << " (did not find keyword 'value')\n";
ostr << " * [INFO] file: '" << proc.GetFileName();
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -163,8 +193,12 @@ bool WRL1MATBINDING::Read( WRLPROC& proc, WRL1BASE* aTopNode )
if( !proc.ReadName( glob ) ) if( !proc.ReadName( glob ) )
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << proc.GetError() << "\n"; std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << proc.GetError();
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -217,10 +251,14 @@ bool WRL1MATBINDING::Read( WRLPROC& proc, WRL1BASE* aTopNode )
else else
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << " * [INFO] bad MaterialBinding at line " << line << ", column "; std::ostringstream ostr;
std::cerr << column << "\n"; ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; ostr << " * [INFO] bad MaterialBinding at line " << line << ", column ";
ostr << column << "\n";
ostr << " * [INFO] file: '" << proc.GetFileName() << "'";
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
m_binding = BIND_OVERALL; m_binding = BIND_OVERALL;
@ -236,7 +274,7 @@ SGNODE* WRL1MATBINDING::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp )
if( NULL == sp ) if( NULL == sp )
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
std::cerr << " * [INFO] bad model: no base data given\n"; wxLogTrace( MASK_VRML, " * [INFO] bad model: no base data given\n" );
#endif #endif
return NULL; return NULL;

View File

@ -23,6 +23,8 @@
#include <iostream> #include <iostream>
#include <sstream>
#include <wx/log.h>
#include "vrml1_base.h" #include "vrml1_base.h"
#include "vrml1_material.h" #include "vrml1_material.h"
@ -56,7 +58,7 @@ WRL1MATERIAL::WRL1MATERIAL( NAMEREGISTER* aDictionary, WRL1NODE* aParent ) :
WRL1MATERIAL::~WRL1MATERIAL() WRL1MATERIAL::~WRL1MATERIAL()
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 )
std::cerr << " * [INFO] Destroying Material node\n"; wxLogTrace( MASK_VRML, " * [INFO] Destroying Material node\n" );
#endif #endif
// destroy any orphaned color nodes // destroy any orphaned color nodes
@ -65,14 +67,22 @@ WRL1MATERIAL::~WRL1MATERIAL()
if( NULL != colors[i] ) if( NULL != colors[i] )
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 )
std::cerr << " * [INFO] Destroying SGCOLOR #" << i << "\n"; do {
std::ostringstream ostr;
ostr << " * [INFO] Destroying SGCOLOR #" << i;
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
if( NULL == S3D::GetSGNodeParent( colors[i] ) ) if( NULL == S3D::GetSGNodeParent( colors[i] ) )
S3D::DestroyNode( colors[i] ); S3D::DestroyNode( colors[i] );
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 )
std::cerr << " * [INFO] destroyed SGCOLOR #" << i << "\n"; do {
std::ostringstream ostr;
ostr << " * [INFO] destroyed SGCOLOR #" << i;
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
} }
} }
@ -86,8 +96,12 @@ bool WRL1MATERIAL::AddRefNode( WRL1NODE* aNode )
// this node may not own or reference any other node // this node may not own or reference any other node
#ifdef DEBUG_VRML1 #ifdef DEBUG_VRML1
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << " * [BUG] AddRefNode is not applicable\n"; std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] AddRefNode is not applicable";
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -99,8 +113,12 @@ bool WRL1MATERIAL::AddChildNode( WRL1NODE* aNode )
// this node may not own or reference any other node // this node may not own or reference any other node
#ifdef DEBUG_VRML1 #ifdef DEBUG_VRML1
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << " * [BUG] AddChildNode is not applicable\n"; std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] AddChildNode is not applicable";
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -112,8 +130,12 @@ bool WRL1MATERIAL::Read( WRLPROC& proc, WRL1BASE* aTopNode )
if( NULL == aTopNode ) if( NULL == aTopNode )
{ {
#ifdef DEBUG_VRML1 #ifdef DEBUG_VRML1
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << " * [BUG] aTopNode is NULL\n"; std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] aTopNode is NULL";
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -127,9 +149,13 @@ bool WRL1MATERIAL::Read( WRLPROC& proc, WRL1BASE* aTopNode )
if( proc.eof() ) if( proc.eof() )
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << " * [INFO] bad file format; unexpected eof at line "; std::ostringstream ostr;
std::cerr << line << ", column " << column << "\n"; ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] bad file format; unexpected eof at line ";
ostr << line << ", column " << column;
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -138,10 +164,14 @@ bool WRL1MATERIAL::Read( WRLPROC& proc, WRL1BASE* aTopNode )
if( '{' != tok ) if( '{' != tok )
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
std::cerr << proc.GetError() << "\n"; do {
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; std::ostringstream ostr;
std::cerr << " * [INFO] bad file format; expecting '{' but got '" << tok; ostr << proc.GetError() << "\n";
std::cerr << "' at line " << line << ", column " << column << "\n"; ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] bad file format; expecting '{' but got '" << tok;
ostr << "' at line " << line << ", column " << column;
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -161,8 +191,12 @@ bool WRL1MATERIAL::Read( WRLPROC& proc, WRL1BASE* aTopNode )
if( !proc.ReadName( glob ) ) if( !proc.ReadName( glob ) )
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << proc.GetError() << "\n"; std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << proc.GetError();
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -183,11 +217,15 @@ bool WRL1MATERIAL::Read( WRLPROC& proc, WRL1BASE* aTopNode )
if( !proc.ReadMFVec3f( specularColor ) ) if( !proc.ReadMFVec3f( specularColor ) )
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << " * [INFO] invalid specularColor at line " << line << ", column "; std::ostringstream ostr;
std::cerr << column << "\n"; ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; ostr << " * [INFO] invalid specularColor at line " << line << ", column ";
std::cerr << " * [INFO] message: '" << proc.GetError() << "'\n"; ostr << column << "\n";
ostr << " * [INFO] file: '" << proc.GetFileName() << "'\n";
ostr << " * [INFO] message: '" << proc.GetError() << "'";
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -198,11 +236,15 @@ bool WRL1MATERIAL::Read( WRLPROC& proc, WRL1BASE* aTopNode )
if( !proc.ReadMFVec3f( diffuseColor ) ) if( !proc.ReadMFVec3f( diffuseColor ) )
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << " * [INFO] invalid diffuseColor at line " << line << ", column "; std::ostringstream ostr;
std::cerr << column << "\n"; ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; ostr << " * [INFO] invalid diffuseColor at line " << line << ", column ";
std::cerr << " * [INFO] message: '" << proc.GetError() << "'\n"; ostr << column << "\n";
ostr << " * [INFO] file: '" << proc.GetFileName() << "'\n";
ostr << " * [INFO] message: '" << proc.GetError() << "'";
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -213,11 +255,15 @@ bool WRL1MATERIAL::Read( WRLPROC& proc, WRL1BASE* aTopNode )
if( !proc.ReadMFVec3f( emissiveColor ) ) if( !proc.ReadMFVec3f( emissiveColor ) )
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << " * [INFO] invalid emissiveColor at line " << line << ", column "; std::ostringstream ostr;
std::cerr << column << "\n"; ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; ostr << " * [INFO] invalid emissiveColor at line " << line << ", column ";
std::cerr << " * [INFO] message: '" << proc.GetError() << "'\n"; ostr << column << "\n";
ostr << " * [INFO] file: '" << proc.GetFileName() << "'\n";
ostr << " * [INFO] message: '" << proc.GetError() << "'";
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -228,11 +274,15 @@ bool WRL1MATERIAL::Read( WRLPROC& proc, WRL1BASE* aTopNode )
if( !proc.ReadMFFloat( shininess ) ) if( !proc.ReadMFFloat( shininess ) )
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << " * [INFO] invalid shininess at line " << line << ", column "; std::ostringstream ostr;
std::cerr << column << "\n"; ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; ostr << " * [INFO] invalid shininess at line " << line << ", column ";
std::cerr << " * [INFO] message: '" << proc.GetError() << "'\n"; ostr << column << "\n";
ostr << " * [INFO] file: '" << proc.GetFileName() << "'\n";
ostr << " * [INFO] message: '" << proc.GetError() << "'";
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -243,11 +293,15 @@ bool WRL1MATERIAL::Read( WRLPROC& proc, WRL1BASE* aTopNode )
if( !proc.ReadMFFloat( transparency ) ) if( !proc.ReadMFFloat( transparency ) )
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << " * [INFO] invalid transparency at line " << line << ", column "; std::ostringstream ostr;
std::cerr << column << "\n"; ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; ostr << " * [INFO] invalid transparency at line " << line << ", column ";
std::cerr << " * [INFO] message: '" << proc.GetError() << "'\n"; ostr << column << "\n";
ostr << " * [INFO] file: '" << proc.GetFileName() << "'\n";
ostr << " * [INFO] message: '" << proc.GetError() << "'";
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -258,11 +312,15 @@ bool WRL1MATERIAL::Read( WRLPROC& proc, WRL1BASE* aTopNode )
if( !proc.ReadMFVec3f( ambientColor ) ) if( !proc.ReadMFVec3f( ambientColor ) )
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << " * [INFO] invalid ambientColor at line " << line << ", column "; std::ostringstream ostr;
std::cerr << column << "\n"; ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; ostr << " * [INFO] invalid ambientColor at line " << line << ", column ";
std::cerr << " * [INFO] message: '" << proc.GetError() << "'\n"; ostr << column << "\n";
ostr << " * [INFO] file: '" << proc.GetFileName() << "'\n";
ostr << " * [INFO] message: '" << proc.GetError() << "'";
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -271,10 +329,14 @@ bool WRL1MATERIAL::Read( WRLPROC& proc, WRL1BASE* aTopNode )
else else
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << " * [INFO] bad Material at line " << line << ", column "; std::ostringstream ostr;
std::cerr << column << "\n"; ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; ostr << " * [INFO] bad Material at line " << line << ", column ";
ostr << column << "\n";
ostr << " * [INFO] file: '" << proc.GetFileName() << "'";
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -290,7 +352,7 @@ SGNODE* WRL1MATERIAL::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp )
if( NULL == sp ) if( NULL == sp )
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
std::cerr << " * [INFO] bad model: no base data given\n"; wxLogTrace( MASK_VRML, " * [INFO] bad model: no base data given\n" );
#endif #endif
return NULL; return NULL;

View File

@ -29,6 +29,8 @@
#include <cctype> #include <cctype>
#include <iostream> #include <iostream>
#include <algorithm> #include <algorithm>
#include <sstream>
#include <wx/log.h>
#include "vrml1_node.h" #include "vrml1_node.h"
@ -141,9 +143,13 @@ WRL1NODE::WRL1NODE( NAMEREGISTER* aDictionary )
WRL1NODE::~WRL1NODE() WRL1NODE::~WRL1NODE()
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 )
std::cerr << " * [INFO] ^^ Destroying Type " << m_Type << " with " << m_Children.size(); do {
std::cerr << " children, " << m_Refs.size() << " references and "; std::ostringstream ostr;
std::cerr << m_BackPointers.size() << " backpointers\n"; ostr << " * [INFO] ^^ Destroying Type " << m_Type << " with " << m_Children.size();
ostr << " children, " << m_Refs.size() << " references and ";
ostr << m_BackPointers.size() << " backpointers";
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
m_Items.clear(); m_Items.clear();
@ -165,13 +171,21 @@ WRL1NODE::~WRL1NODE()
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 )
++acc; ++acc;
std::cerr << " * [INFO] " << tabs << "Type " << m_Type << " is Unlinking ref #"; do {
std::cerr << acc << "\n"; std::ostringstream ostr;
ostr << " * [INFO] " << tabs << "Type " << m_Type << " is Unlinking ref #";
ostr << acc;
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
(*sBP)->unlinkRefNode( this ); (*sBP)->unlinkRefNode( this );
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 )
std::cerr << " * [INFO] " << tabs << "Type " << m_Type << " has unlinked ref #"; do {
std::cerr << acc << "\n"; std::ostringstream ostr;
ostr << " * [INFO] " << tabs << "Type " << m_Type << " has unlinked ref #";
ostr << acc;
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
++sBP; ++sBP;
} }
@ -190,18 +204,30 @@ WRL1NODE::~WRL1NODE()
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 )
++acc; ++acc;
std::cerr << " * [INFO] " << otabs << "Type " << m_Type << " is Deleting child #"; do {
std::cerr << acc << "\n"; std::ostringstream ostr;
ostr << " * [INFO] " << otabs << "Type " << m_Type << " is Deleting child #";
ostr << acc;
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
(*sC)->SetParent( NULL, false ); (*sC)->SetParent( NULL, false );
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 )
std::cerr << " * [INFO] " << otabs << "Type " << m_Type << " has unlinked child #"; do {
std::cerr << acc << "\n"; std::ostringstream ostr;
ostr << " * [INFO] " << otabs << "Type " << m_Type << " has unlinked child #";
ostr << acc;
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
//delete *sC; delete *sC;
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 )
std::cerr << " * [INFO] " << otabs << "Type " << m_Type << " has deleted child #"; do {
std::cerr << acc << "\n"; std::ostringstream ostr;
ostr << " * [INFO] " << otabs << "Type " << m_Type << " has deleted child #";
ostr << acc;
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
++sC; ++sC;
} }
@ -269,8 +295,12 @@ void WRL1NODE::delNodeRef( WRL1NODE* aNode )
} }
#ifdef DEBUG_VRML1 #ifdef DEBUG_VRML1
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << " * [BUG] delNodeRef() did not find its target\n"; std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] delNodeRef() did not find its target";
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return; return;
@ -303,8 +333,12 @@ bool WRL1NODE::SetName( const std::string& aName )
if( isdigit( aName[0] ) ) if( isdigit( aName[0] ) )
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << " * [INFO] invalid node name '" << aName << "' (begins with digit)\n"; std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] invalid node name '" << aName << "' (begins with digit)";
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -320,9 +354,13 @@ bool WRL1NODE::SetName( const std::string& aName )
|| std::string::npos != aName.find_first_of( BAD_CHARS2 ) ) || std::string::npos != aName.find_first_of( BAD_CHARS2 ) )
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << " * [INFO] invalid node name '" << aName; std::ostringstream ostr;
std::cerr<< "' (contains invalid character)\n"; ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] invalid node name '" << aName;
ostr << "' (contains invalid character)";
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -406,8 +444,12 @@ bool WRL1NODE::AddChildNode( WRL1NODE* aNode )
if( aNode->GetNodeType() == WRL1_BASE ) if( aNode->GetNodeType() == WRL1_BASE )
{ {
#ifdef DEBUG_VRML1 #ifdef DEBUG_VRML1
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << " * [BUG] attempting to add a base node to another node\n"; std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] attempting to add a base node to another node";
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -439,8 +481,12 @@ bool WRL1NODE::AddRefNode( WRL1NODE* aNode )
if( NULL == aNode ) if( NULL == aNode )
{ {
#ifdef DEBUG_VRML1 #ifdef DEBUG_VRML1
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << " * [BUG] NULL passed as node pointer\n"; std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] NULL passed as node pointer";
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -449,8 +495,12 @@ bool WRL1NODE::AddRefNode( WRL1NODE* aNode )
if( aNode->GetNodeType() == WRL1_BASE ) if( aNode->GetNodeType() == WRL1_BASE )
{ {
#ifdef DEBUG_VRML1 #ifdef DEBUG_VRML1
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << " * [BUG] attempting to add a base node ref to another base node\n"; std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] attempting to add a base node ref to another base node";
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;

View File

@ -22,6 +22,8 @@
*/ */
#include <iostream> #include <iostream>
#include <sstream>
#include <wx/log.h>
#include "vrml1_base.h" #include "vrml1_base.h"
#include "vrml1_separator.h" #include "vrml1_separator.h"
@ -51,9 +53,13 @@ WRL1SEPARATOR::WRL1SEPARATOR( NAMEREGISTER* aDictionary, WRL1NODE* aParent ) :
WRL1SEPARATOR::~WRL1SEPARATOR() WRL1SEPARATOR::~WRL1SEPARATOR()
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 )
std::cerr << " * [INFO] Destroying Separator with " << m_Children.size(); do {
std::cerr << " children, " << m_Refs.size() << " references and "; std::ostringstream ostr;
std::cerr << m_BackPointers.size() << " backpointers\n"; ostr << " * [INFO] Destroying Separator with " << m_Children.size();
ostr << " children, " << m_Refs.size() << " references and ";
ostr << m_BackPointers.size() << " backpointers";
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return; return;
@ -66,8 +72,12 @@ bool WRL1SEPARATOR::Read( WRLPROC& proc, WRL1BASE* aTopNode )
if( NULL == aTopNode ) if( NULL == aTopNode )
{ {
#ifdef DEBUG_VRML1 #ifdef DEBUG_VRML1
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << " * [BUG] aTopNode is NULL\n"; std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] aTopNode is NULL";
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -81,9 +91,13 @@ bool WRL1SEPARATOR::Read( WRLPROC& proc, WRL1BASE* aTopNode )
if( proc.eof() ) if( proc.eof() )
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << " * [INFO] bad file format; unexpected eof at line "; std::ostringstream ostr;
std::cerr << line << ", column " << column << "\n"; ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] bad file format; unexpected eof at line ";
ostr << line << ", column " << column;
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -92,10 +106,14 @@ bool WRL1SEPARATOR::Read( WRLPROC& proc, WRL1BASE* aTopNode )
if( '{' != tok ) if( '{' != tok )
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
std::cerr << proc.GetError() << "\n"; do {
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; std::ostringstream ostr;
std::cerr << " * [INFO] bad file format; expecting '{' but got '" << tok; ostr << proc.GetError() << "\n";
std::cerr << "' at line " << line << ", column " << column << "\n"; ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] bad file format; expecting '{' but got '" << tok;
ostr << "' at line " << line << ", column " << column;
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -117,9 +135,13 @@ bool WRL1SEPARATOR::Read( WRLPROC& proc, WRL1BASE* aTopNode )
if( !aTopNode->ReadNode( proc, this, NULL ) ) if( !aTopNode->ReadNode( proc, this, NULL ) )
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << " * [INFO] bad file format; unexpected eof at line "; std::ostringstream ostr;
std::cerr << line << ", column " << column << "\n"; ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] bad file format; unexpected eof at line ";
ostr << line << ", column " << column;
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -137,17 +159,25 @@ bool WRL1SEPARATOR::Read( WRLPROC& proc, WRL1BASE* aTopNode )
SGNODE* WRL1SEPARATOR::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp ) SGNODE* WRL1SEPARATOR::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp )
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 )
std::cerr << " * [INFO] Translating Separator with " << m_Children.size(); do {
std::cerr << " children, " << m_Refs.size() << " references and "; std::ostringstream ostr;
std::cerr << m_BackPointers.size() << " backpointers (total "; ostr << " * [INFO] Translating Separator with " << m_Children.size();
std::cerr << m_Items.size() << " items)\n"; ostr << " children, " << m_Refs.size() << " references and ";
ostr << m_BackPointers.size() << " backpointers (total ";
ostr << m_Items.size() << " items)";
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
if( !m_Parent ) if( !m_Parent )
{ {
#ifdef DEBUG #ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << " * [BUG] Separator has no parent\n"; std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] Separator has no parent";
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return NULL; return NULL;
@ -163,9 +193,13 @@ SGNODE* WRL1SEPARATOR::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp )
if( NULL != aParent && ptype != S3D::SGTYPE_TRANSFORM ) if( NULL != aParent && ptype != S3D::SGTYPE_TRANSFORM )
{ {
#ifdef DEBUG_VRML1 #ifdef DEBUG_VRML1
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << " * [BUG] Separator does not have a Transform parent (parent ID: "; std::ostringstream ostr;
std::cerr << ptype << ")\n"; ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] Separator does not have a Transform parent (parent ID: ";
ostr << ptype << ")";
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return NULL; return NULL;

View File

@ -23,7 +23,9 @@
#include <iostream> #include <iostream>
#include <sstream>
#include <cmath> #include <cmath>
#include <wx/log.h>
#include "vrml1_base.h" #include "vrml1_base.h"
#include "vrml1_shapehints.h" #include "vrml1_shapehints.h"
@ -57,7 +59,7 @@ WRL1SHAPEHINTS::WRL1SHAPEHINTS( NAMEREGISTER* aDictionary, WRL1NODE* aParent ) :
WRL1SHAPEHINTS::~WRL1SHAPEHINTS() WRL1SHAPEHINTS::~WRL1SHAPEHINTS()
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 )
std::cerr << " * [INFO] Destroying ShapeHints node\n"; wxLogTrace( MASK_VRML, " * [INFO] Destroying ShapeHints node\n" );
#endif #endif
return; return;
@ -69,8 +71,12 @@ bool WRL1SHAPEHINTS::AddRefNode( WRL1NODE* aNode )
// this node may not own or reference any other node // this node may not own or reference any other node
#ifdef DEBUG_VRML1 #ifdef DEBUG_VRML1
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << " * [BUG] AddRefNode is not applicable\n"; std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] AddRefNode is not applicable";
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -82,8 +88,12 @@ bool WRL1SHAPEHINTS::AddChildNode( WRL1NODE* aNode )
// this node may not own or reference any other node // this node may not own or reference any other node
#ifdef DEBUG_VRML1 #ifdef DEBUG_VRML1
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << " * [BUG] AddChildNode is not applicable\n"; std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] AddChildNode is not applicable";
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -95,8 +105,12 @@ bool WRL1SHAPEHINTS::Read( WRLPROC& proc, WRL1BASE* aTopNode )
if( NULL == aTopNode ) if( NULL == aTopNode )
{ {
#ifdef DEBUG_VRML1 #ifdef DEBUG_VRML1
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << " * [BUG] aTopNode is NULL\n"; std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] aTopNode is NULL";
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -110,9 +124,13 @@ bool WRL1SHAPEHINTS::Read( WRLPROC& proc, WRL1BASE* aTopNode )
if( proc.eof() ) if( proc.eof() )
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << " * [INFO] bad file format; unexpected eof at line "; std::ostringstream ostr;
std::cerr << line << ", column " << column << "\n"; ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] bad file format; unexpected eof at line ";
ostr << line << ", column " << column;
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -121,10 +139,14 @@ bool WRL1SHAPEHINTS::Read( WRLPROC& proc, WRL1BASE* aTopNode )
if( '{' != tok ) if( '{' != tok )
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
std::cerr << proc.GetError() << "\n"; do {
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; std::ostringstream ostr;
std::cerr << " * [INFO] bad file format; expecting '{' but got '" << tok; ostr << proc.GetError() << "\n";
std::cerr << "' at line " << line << ", column " << column << "\n"; ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] bad file format; expecting '{' but got '" << tok;
ostr << "' at line " << line << ", column " << column;
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -144,8 +166,12 @@ bool WRL1SHAPEHINTS::Read( WRLPROC& proc, WRL1BASE* aTopNode )
if( !proc.ReadName( glob ) ) if( !proc.ReadName( glob ) )
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << proc.GetError() << "\n"; std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << proc.GetError();
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -162,8 +188,12 @@ bool WRL1SHAPEHINTS::Read( WRLPROC& proc, WRL1BASE* aTopNode )
if( !proc.ReadName( glob ) ) if( !proc.ReadName( glob ) )
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << proc.GetError() << "\n"; std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << proc.GetError();
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -178,10 +208,14 @@ bool WRL1SHAPEHINTS::Read( WRLPROC& proc, WRL1BASE* aTopNode )
else else
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << " * [INFO] bad ShapeHints at line " << line << ", column "; std::ostringstream ostr;
std::cerr << column << " (invalid value '" << glob << "')\n"; ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; ostr << " * [INFO] bad ShapeHints at line " << line << ", column ";
ostr << column << " (invalid value '" << glob << "')\n";
ostr << " * [INFO] file: '" << proc.GetFileName() << "'";
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -192,8 +226,12 @@ bool WRL1SHAPEHINTS::Read( WRLPROC& proc, WRL1BASE* aTopNode )
if( !proc.ReadName( glob ) ) if( !proc.ReadName( glob ) )
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << proc.GetError() << "\n"; std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << proc.GetError();
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -208,8 +246,12 @@ bool WRL1SHAPEHINTS::Read( WRLPROC& proc, WRL1BASE* aTopNode )
if( !proc.ReadName( glob ) ) if( !proc.ReadName( glob ) )
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << proc.GetError() << "\n"; std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << proc.GetError();
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -226,8 +268,12 @@ bool WRL1SHAPEHINTS::Read( WRLPROC& proc, WRL1BASE* aTopNode )
if( !proc.ReadSFFloat( tmp ) ) if( !proc.ReadSFFloat( tmp ) )
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << proc.GetError() << "\n"; std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << proc.GetError();
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -243,10 +289,14 @@ bool WRL1SHAPEHINTS::Read( WRLPROC& proc, WRL1BASE* aTopNode )
else else
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << " * [INFO] bad ShapeHints at line " << line << ", column "; std::ostringstream ostr;
std::cerr << column << " (unexpected keyword '" << glob << "')\n"; ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; ostr << " * [INFO] bad ShapeHints at line " << line << ", column ";
ostr << column << " (unexpected keyword '" << glob << "')\n";
ostr << " * [INFO] file: '" << proc.GetFileName() << "'";
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -265,7 +315,7 @@ SGNODE* WRL1SHAPEHINTS::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp )
if( NULL == sp ) if( NULL == sp )
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
std::cerr << " * [INFO] bad model: no base data given\n"; wxLogTrace( MASK_VRML, " * [INFO] bad model: no base data given\n" );
#endif #endif
return NULL; return NULL;

View File

@ -22,7 +22,9 @@
*/ */
#include <iostream> #include <iostream>
#include <sstream>
#include <iterator> #include <iterator>
#include <wx/log.h>
#include "vrml1_base.h" #include "vrml1_base.h"
#include "vrml1_switch.h" #include "vrml1_switch.h"
@ -55,9 +57,13 @@ WRL1SWITCH::WRL1SWITCH( NAMEREGISTER* aDictionary, WRL1NODE* aParent ) :
WRL1SWITCH::~WRL1SWITCH() WRL1SWITCH::~WRL1SWITCH()
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 )
std::cerr << " * [INFO] Destroying Switch with " << m_Children.size(); do {
std::cerr << " children, " << m_Refs.size() << " references and "; std::ostringstream ostr;
std::cerr << m_BackPointers.size() << " backpointers\n"; ostr << " * [INFO] Destroying Switch with " << m_Children.size();
ostr << " children, " << m_Refs.size() << " references and ";
ostr << m_BackPointers.size() << " backpointers";
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return; return;
@ -79,8 +85,12 @@ bool WRL1SWITCH::Read( WRLPROC& proc, WRL1BASE* aTopNode )
if( NULL == aTopNode ) if( NULL == aTopNode )
{ {
#ifdef DEBUG_VRML1 #ifdef DEBUG_VRML1
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << " * [BUG] aTopNode is NULL\n"; std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] aTopNode is NULL";
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -94,9 +104,13 @@ bool WRL1SWITCH::Read( WRLPROC& proc, WRL1BASE* aTopNode )
if( proc.eof() ) if( proc.eof() )
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << " * [INFO] bad file format; unexpected eof at line "; std::ostringstream ostr;
std::cerr << line << ", column " << column << "\n"; ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] bad file format; unexpected eof at line ";
ostr << line << ", column " << column;
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -105,10 +119,14 @@ bool WRL1SWITCH::Read( WRLPROC& proc, WRL1BASE* aTopNode )
if( '{' != tok ) if( '{' != tok )
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
std::cerr << proc.GetError() << "\n"; do {
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; std::ostringstream ostr;
std::cerr << " * [INFO] bad file format; expecting '{' but got '" << tok; ostr << proc.GetError() << "\n";
std::cerr << "' at line " << line << ", column " << column << "\n"; ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] bad file format; expecting '{' but got '" << tok;
ostr << "' at line " << line << ", column " << column;
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -131,8 +149,12 @@ bool WRL1SWITCH::Read( WRLPROC& proc, WRL1BASE* aTopNode )
if( !proc.ReadName( glob ) ) if( !proc.ReadName( glob ) )
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << proc.GetError() << "\n"; std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << proc.GetError();
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -143,11 +165,15 @@ bool WRL1SWITCH::Read( WRLPROC& proc, WRL1BASE* aTopNode )
if( !proc.ReadSFInt( whichChild ) ) if( !proc.ReadSFInt( whichChild ) )
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << " * [INFO] invalid whichChild at line " << line << ", column "; std::ostringstream ostr;
std::cerr << column << "\n"; ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; ostr << " * [INFO] invalid whichChild at line " << line << ", column ";
std::cerr << " * [INFO] message: '" << proc.GetError() << "'\n"; ostr << column << "\n";
ostr << " * [INFO] file: '" << proc.GetFileName() << "'\n";
ostr << " * [INFO] message: '" << proc.GetError() << "'";
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -157,10 +183,14 @@ bool WRL1SWITCH::Read( WRLPROC& proc, WRL1BASE* aTopNode )
} }
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << " * [INFO] invalid Switch at line " << line << ", column "; std::ostringstream ostr;
std::cerr << column << " (expected 'whichChild')\n"; ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; ostr << " * [INFO] invalid Switch at line " << line << ", column ";
ostr << column << " (expected 'whichChild')\n";
ostr << " * [INFO] file: '" << proc.GetFileName() << "'";
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -171,9 +201,13 @@ bool WRL1SWITCH::Read( WRLPROC& proc, WRL1BASE* aTopNode )
if( !aTopNode->ReadNode( proc, this, NULL ) ) if( !aTopNode->ReadNode( proc, this, NULL ) )
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << " * [INFO] bad file format; unexpected eof at line "; std::ostringstream ostr;
std::cerr << line << ", column " << column << "\n"; ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] bad file format; unexpected eof at line ";
ostr << line << ", column " << column;
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -191,10 +225,14 @@ bool WRL1SWITCH::Read( WRLPROC& proc, WRL1BASE* aTopNode )
SGNODE* WRL1SWITCH::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp ) SGNODE* WRL1SWITCH::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp )
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 )
std::cerr << " * [INFO] Translating Switch with " << m_Children.size(); do {
std::cerr << " children, " << m_Refs.size() << " references and "; std::ostringstream ostr;
std::cerr << m_BackPointers.size() << " backpointers (total "; ostr << " * [INFO] Translating Switch with " << m_Children.size();
std::cerr << m_Items.size() << " items)\n"; ostr << " children, " << m_Refs.size() << " references and ";
ostr << m_BackPointers.size() << " backpointers (total ";
ostr << m_Items.size() << " items)";
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
if( m_Items.empty() ) if( m_Items.empty() )

View File

@ -22,6 +22,8 @@
*/ */
#include <iostream> #include <iostream>
#include <sstream>
#include <wx/log.h>
#include "vrml1_base.h" #include "vrml1_base.h"
#include "vrml1_transform.h" #include "vrml1_transform.h"
@ -51,9 +53,13 @@ WRL1TRANSFORM::WRL1TRANSFORM( NAMEREGISTER* aDictionary, WRL1NODE* aParent ) :
WRL1TRANSFORM::~WRL1TRANSFORM() WRL1TRANSFORM::~WRL1TRANSFORM()
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 )
std::cerr << " * [INFO] Destroying Transform with " << m_Children.size(); do {
std::cerr << " children, " << m_Refs.size() << " references and "; std::ostringstream ostr;
std::cerr << m_BackPointers.size() << " backpointers\n"; ostr << " * [INFO] Destroying Transform with " << m_Children.size();
ostr << " children, " << m_Refs.size() << " references and ";
ostr << m_BackPointers.size() << " backpointers";
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return; return;
@ -77,8 +83,12 @@ bool WRL1TRANSFORM::Read( WRLPROC& proc, WRL1BASE* aTopNode )
if( NULL == aTopNode ) if( NULL == aTopNode )
{ {
#ifdef DEBUG_VRML1 #ifdef DEBUG_VRML1
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << " * [BUG] aTopNode is NULL\n"; std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] aTopNode is NULL";
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -109,9 +119,13 @@ bool WRL1TRANSFORM::Read( WRLPROC& proc, WRL1BASE* aTopNode )
if( proc.eof() ) if( proc.eof() )
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << " * [INFO] bad file format; unexpected eof at line "; std::ostringstream ostr;
std::cerr << line << ", column " << column << "\n"; ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] bad file format; unexpected eof at line ";
ostr << line << ", column " << column;
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -120,10 +134,14 @@ bool WRL1TRANSFORM::Read( WRLPROC& proc, WRL1BASE* aTopNode )
if( '{' != tok ) if( '{' != tok )
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
std::cerr << proc.GetError() << "\n"; do {
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; std::ostringstream ostr;
std::cerr << " * [INFO] bad file format; expecting '{' but got '" << tok; ostr << proc.GetError() << "\n";
std::cerr << "' at line " << line << ", column " << column << "\n"; ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] bad file format; expecting '{' but got '" << tok;
ostr << "' at line " << line << ", column " << column;
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -143,8 +161,12 @@ bool WRL1TRANSFORM::Read( WRLPROC& proc, WRL1BASE* aTopNode )
if( !proc.ReadName( glob ) ) if( !proc.ReadName( glob ) )
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << proc.GetError() << "\n"; std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << proc.GetError();
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -164,11 +186,15 @@ bool WRL1TRANSFORM::Read( WRLPROC& proc, WRL1BASE* aTopNode )
if( !proc.ReadSFVec3f( center ) ) if( !proc.ReadSFVec3f( center ) )
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << " * [INFO] invalid center at line " << line << ", column "; std::ostringstream ostr;
std::cerr << column << "\n"; ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; ostr << " * [INFO] invalid center at line " << line << ", column ";
std::cerr << " * [INFO] message: '" << proc.GetError() << "'\n"; ostr << column << "\n";
ostr << " * [INFO] file: '" << proc.GetFileName() << "'\n";
ostr << " * [INFO] message: '" << proc.GetError() << "'";
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -184,11 +210,15 @@ bool WRL1TRANSFORM::Read( WRLPROC& proc, WRL1BASE* aTopNode )
if( !proc.ReadSFRotation( rotation ) ) if( !proc.ReadSFRotation( rotation ) )
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << " * [INFO] invalid rotation at line " << line << ", column "; std::ostringstream ostr;
std::cerr << column << "\n"; ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; ostr << " * [INFO] invalid rotation at line " << line << ", column ";
std::cerr << " * [INFO] message: '" << proc.GetError() << "'\n"; ostr << column << "\n";
ostr << " * [INFO] file: '" << proc.GetFileName() << "'\n";
ostr << " * [INFO] message: '" << proc.GetError() << "'";
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -199,11 +229,15 @@ bool WRL1TRANSFORM::Read( WRLPROC& proc, WRL1BASE* aTopNode )
if( !proc.ReadSFVec3f( scale ) ) if( !proc.ReadSFVec3f( scale ) )
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << " * [INFO] invalid scale at line " << line << ", column "; std::ostringstream ostr;
std::cerr << column << "\n"; ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; ostr << " * [INFO] invalid scale at line " << line << ", column ";
std::cerr << " * [INFO] message: '" << proc.GetError() << "'\n"; ostr << column << "\n";
ostr << " * [INFO] file: '" << proc.GetFileName() << "'\n";
ostr << " * [INFO] message: '" << proc.GetError() << "'";
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -214,11 +248,15 @@ bool WRL1TRANSFORM::Read( WRLPROC& proc, WRL1BASE* aTopNode )
if( !proc.ReadSFRotation( scaleOrientation ) ) if( !proc.ReadSFRotation( scaleOrientation ) )
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << " * [INFO] invalid scaleOrientation at line " << line << ", column "; std::ostringstream ostr;
std::cerr << column << "\n"; ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; ostr << " * [INFO] invalid scaleOrientation at line " << line << ", column ";
std::cerr << " * [INFO] message: '" << proc.GetError() << "'\n"; ostr << column << "\n";
ostr << " * [INFO] file: '" << proc.GetFileName() << "'\n";
ostr << " * [INFO] message: '" << proc.GetError() << "'";
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -229,11 +267,15 @@ bool WRL1TRANSFORM::Read( WRLPROC& proc, WRL1BASE* aTopNode )
if( !proc.ReadSFVec3f( translation ) ) if( !proc.ReadSFVec3f( translation ) )
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << " * [INFO] invalid translation at line " << line << ", column "; std::ostringstream ostr;
std::cerr << column << "\n"; ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; ostr << " * [INFO] invalid translation at line " << line << ", column ";
std::cerr << " * [INFO] message: '" << proc.GetError() << "'\n"; ostr << column << "\n";
ostr << " * [INFO] file: '" << proc.GetFileName() << "'\n";
ostr << " * [INFO] message: '" << proc.GetError() << "'";
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -247,10 +289,14 @@ bool WRL1TRANSFORM::Read( WRLPROC& proc, WRL1BASE* aTopNode )
else else
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << " * [INFO] bad Transform at line " << line << ", column "; std::ostringstream ostr;
std::cerr << column << "\n"; ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; ostr << " * [INFO] bad Transform at line " << line << ", column ";
ostr << column << "\n";
ostr << " * [INFO] file: '" << proc.GetFileName() << "'";
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -266,8 +312,12 @@ bool WRL1TRANSFORM::AddRefNode( WRL1NODE* aNode )
// this node may not own or reference any other node // this node may not own or reference any other node
#ifdef DEBUG_VRML1 #ifdef DEBUG_VRML1
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << " * [BUG] AddRefNode is not applicable\n"; std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] AddRefNode is not applicable";
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -279,8 +329,12 @@ bool WRL1TRANSFORM::AddChildNode( WRL1NODE* aNode )
// this node may not own or reference any other node // this node may not own or reference any other node
#ifdef DEBUG_VRML1 #ifdef DEBUG_VRML1
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << " * [BUG] AddChildNode is not applicable\n"; std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] AddChildNode is not applicable";
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return false; return false;
@ -298,7 +352,7 @@ SGNODE* WRL1TRANSFORM::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp )
if( NULL == sp ) if( NULL == sp )
{ {
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
std::cerr << " * [INFO] bad model: no base data given\n"; wxLogTrace( MASK_VRML, " * [INFO] bad model: no base data given\n" );
#endif #endif
return NULL; return NULL;

View File

@ -32,11 +32,7 @@
*/ */
#include <locale.h> #include <locale.h>
#include <fstream> #include <wx/log.h>
#include <iostream>
#include <cmath>
#include <string>
#include <wx/string.h>
#include <wx/filename.h> #include <wx/filename.h>
#include "richio.h" #include "richio.h"
#include "plugins/3d/3d_plugin.h" #include "plugins/3d/3d_plugin.h"
@ -188,9 +184,7 @@ SCENEGRAPH* LoadVRML( const wxString& aFileName, bool useInline )
} }
catch( IO_ERROR &e ) catch( IO_ERROR &e )
{ {
#ifdef DEBUG wxLogError( _( " * [INFO] load failed: input line too long\n" ) );
std::cerr << " * [INFO] load failed: input line too long\n";
#endif
return NULL; return NULL;
} }
@ -200,9 +194,7 @@ SCENEGRAPH* LoadVRML( const wxString& aFileName, bool useInline )
if( proc.GetVRMLType() == VRML_V1 ) if( proc.GetVRMLType() == VRML_V1 )
{ {
#ifdef DEBUG wxLogTrace( MASK_VRML, " * [INFO] Processing VRML 1.0 file\n" );
std::cerr << " * [INFO] Processing VRML 1.0 file\n";
#endif
WRL1BASE* bp = new WRL1BASE; WRL1BASE* bp = new WRL1BASE;
@ -211,15 +203,11 @@ SCENEGRAPH* LoadVRML( const wxString& aFileName, bool useInline )
if( !bp->Read( proc ) ) if( !bp->Read( proc ) )
{ {
#ifdef DEBUG wxLogTrace( MASK_VRML, " * [INFO] load failed\n" );
std::cerr << " * [INFO] load failed\n";
#endif
} }
else else
{ {
#ifdef DEBUG wxLogTrace( MASK_VRML, " * [INFO] load completed\n" );
std::cerr << " * [INFO] load completed\n";
#endif
scene = (SCENEGRAPH*)bp->TranslateToSG( NULL, NULL ); scene = (SCENEGRAPH*)bp->TranslateToSG( NULL, NULL );
} }
@ -228,9 +216,7 @@ SCENEGRAPH* LoadVRML( const wxString& aFileName, bool useInline )
} }
else else
{ {
#ifdef DEBUG wxLogTrace( MASK_VRML, " * [INFO] Processing VRML 2.0 file\n" );
std::cerr << " * [INFO] Processing VRML 2.0 file\n";
#endif
WRL2BASE* bp = new WRL2BASE; WRL2BASE* bp = new WRL2BASE;
@ -239,15 +225,11 @@ SCENEGRAPH* LoadVRML( const wxString& aFileName, bool useInline )
if( !bp->Read( proc ) ) if( !bp->Read( proc ) )
{ {
#ifdef DEBUG wxLogTrace( MASK_VRML, " * [INFO] load failed\n" );
std::cerr << " * [INFO] load failed\n";
#endif
} }
else else
{ {
#ifdef DEBUG wxLogTrace( MASK_VRML, " * [INFO] load completed\n" );
std::cerr << " * [INFO] load completed\n";
#endif
// for now we recalculate all normals per-vertex per-face // for now we recalculate all normals per-vertex per-face
scene = (SCENEGRAPH*)bp->TranslateToSG( NULL ); scene = (SCENEGRAPH*)bp->TranslateToSG( NULL );

View File

@ -24,6 +24,7 @@
#include <iostream> #include <iostream>
#include <sstream> #include <sstream>
#include <wx/string.h> #include <wx/string.h>
#include <wx/log.h>
#include "wrlproc.h" #include "wrlproc.h"
#define GETLINE do {\ #define GETLINE do {\
@ -374,9 +375,7 @@ bool WRLPROC::DiscardNode( void )
ostr << ", column " << m_bufpos; ostr << ", column " << m_bufpos;
m_error = ostr.str(); m_error = ostr.str();
#ifdef DEBUG wxLogTrace( MASK_VRML, "%s\n", m_error.c_str() );
std::cerr << m_error << "\n";
#endif
return false; return false;
} }

View File

@ -33,6 +33,9 @@
#define GLM_FORCE_RADIANS #define GLM_FORCE_RADIANS
#include <glm/glm.hpp> #include <glm/glm.hpp>
// log mask for wxLogTrace
#define MASK_VRML "PLUGIN_VRML"
// version of the VRML file being parsed // version of the VRML file being parsed
enum WRLVERSION enum WRLVERSION
{ {

View File

@ -23,6 +23,8 @@
#include <iostream> #include <iostream>
#include <sstream>
#include <wx/log.h>
#include <wx/xml/xml.h> #include <wx/xml/xml.h>
#include "x3d_ops.h" #include "x3d_ops.h"
#include "x3d_appearance.h" #include "x3d_appearance.h"
@ -61,7 +63,7 @@ X3DAPP::X3DAPP( X3DNODE* aParent ) : X3DNODE()
X3DAPP::~X3DAPP() X3DAPP::~X3DAPP()
{ {
#if defined( DEBUG_X3D ) && ( DEBUG_X3D > 2 ) #if defined( DEBUG_X3D ) && ( DEBUG_X3D > 2 )
std::cerr << " * [INFO] Destroying Appearance\n"; wxLogTrace( MASK_VRML, " * [INFO] Destroying Appearance\n" );
#endif #endif
if( !m_MatName.empty() && m_Dict ) if( !m_MatName.empty() && m_Dict )
@ -237,18 +239,24 @@ SGNODE* X3DAPP::TranslateToSG( SGNODE* aParent )
if( NULL != aParent && ptype != S3D::SGTYPE_SHAPE ) if( NULL != aParent && ptype != S3D::SGTYPE_SHAPE )
{ {
#ifdef DEBUG_X3D #ifdef DEBUG_X3D
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; std::ostringstream ostr;
std::cerr << " * [BUG] Appearance does not have a Shape parent (parent ID: "; ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << ptype << ")\n"; ostr << " * [BUG] Appearance does not have a Shape parent (parent ID: ";
ostr << ptype << ")";
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
#endif #endif
return NULL; return NULL;
} }
#if defined( DEBUG_X3D ) && ( DEBUG_X3D > 2 ) #if defined( DEBUG_X3D ) && ( DEBUG_X3D > 2 )
std::cerr << " * [INFO] Translating Appearance with " << m_Children.size(); do {
std::cerr << " children, " << m_Refs.size() << " references and "; std::ostringstream ostr;
std::cerr << m_BackPointers.size() << " backpointers\n"; ostr << " * [INFO] Translating Appearance with " << m_Children.size();
ostr << " children, " << m_Refs.size() << " references and ";
ostr << m_BackPointers.size() << " backpointers";
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
if( m_sgNode ) if( m_sgNode )

View File

@ -23,9 +23,12 @@
#include <iostream> #include <iostream>
#include <sstream>
#include <utility> #include <utility>
#include <algorithm> #include <algorithm>
#include <wx/log.h>
#include "x3d_base.h" #include "x3d_base.h"
#include "wrltypes.h"
bool X3D_DICT::AddName( const wxString& aName, X3DNODE* aNode ) bool X3D_DICT::AddName( const wxString& aName, X3DNODE* aNode )
@ -169,8 +172,10 @@ void X3DNODE::delNodeRef( X3DNODE* aNode )
} }
#ifdef DEBUG_X3D #ifdef DEBUG_X3D
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; std::ostringstream ostr;
std::cerr << " * [BUG] delNodeRef() did not find its target\n"; ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] delNodeRef() did not find its target";
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
#endif #endif
return; return;

View File

@ -25,6 +25,7 @@
#include <iostream> #include <iostream>
#include <wx/xml/xml.h> #include <wx/xml/xml.h>
#include <wx/tokenzr.h> #include <wx/tokenzr.h>
#include <wx/log.h>
#include "x3d_ops.h" #include "x3d_ops.h"
#include "x3d_coords.h" #include "x3d_coords.h"
@ -59,7 +60,7 @@ X3DCOORDS::X3DCOORDS( X3DNODE* aParent ) : X3DNODE()
X3DCOORDS::~X3DCOORDS() X3DCOORDS::~X3DCOORDS()
{ {
#if defined( DEBUG_X3D ) && ( DEBUG_X3D > 2 ) #if defined( DEBUG_X3D ) && ( DEBUG_X3D > 2 )
std::cerr << " * [INFO] Destroying Coordinate\n"; wxLogTrace( MASK_VRML, " * [INFO] Destroying Coordinate\n" );
#endif #endif
return; return;
} }

View File

@ -23,7 +23,9 @@
#include <iostream> #include <iostream>
#include <sstream>
#include <cmath> #include <cmath>
#include <wx/log.h>
#include <wx/xml/xml.h> #include <wx/xml/xml.h>
#include <wx/tokenzr.h> #include <wx/tokenzr.h>
#include "x3d_ops.h" #include "x3d_ops.h"
@ -67,7 +69,7 @@ X3DIFACESET::X3DIFACESET( X3DNODE* aParent ) : X3DNODE()
X3DIFACESET::~X3DIFACESET() X3DIFACESET::~X3DIFACESET()
{ {
#if defined( DEBUG_X3D ) && ( DEBUG_X3D > 2 ) #if defined( DEBUG_X3D ) && ( DEBUG_X3D > 2 )
std::cerr << " * [INFO] Destroying IndexedFaceSet\n"; wxLogTrace( MASK_VRML, " * [INFO] Destroying IndexedFaceSet\n" );
#endif #endif
return; return;
@ -241,19 +243,27 @@ SGNODE* X3DIFACESET::TranslateToSG( SGNODE* aParent )
if( NULL != aParent && ptype != S3D::SGTYPE_SHAPE ) if( NULL != aParent && ptype != S3D::SGTYPE_SHAPE )
{ {
#ifdef DEBUG_X3D #ifdef DEBUG_X3D
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << " * [BUG] IndexedFaceSet does not have a Shape parent (parent ID: "; std::ostringstream ostr;
std::cerr << ptype << ")\n"; ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] IndexedFaceSet does not have a Shape parent (parent ID: ";
ostr << ptype << ")";
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return NULL; return NULL;
} }
#if defined( DEBUG_X3D ) && ( DEBUG_X3D > 2 ) #if defined( DEBUG_X3D ) && ( DEBUG_X3D > 2 )
std::cerr << " * [INFO] Translating IndexedFaceSet with " << m_Children.size(); do {
std::cerr << " children, " << m_Refs.size() << " references, "; std::ostringstream ostr;
std::cerr << m_BackPointers.size() << " backpointers and "; ostr << " * [INFO] Translating IndexedFaceSet with " << m_Children.size();
std::cerr << coordIndex.size() << " coord indices\n"; ostr << " children, " << m_Refs.size() << " references, ";
ostr << m_BackPointers.size() << " backpointers and ";
ostr << coordIndex.size() << " coord indices";
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
if( m_sgNode ) if( m_sgNode )

View File

@ -23,13 +23,10 @@
#include <wx/tokenzr.h> #include <wx/tokenzr.h>
#include <wx/xml/xml.h> #include <wx/xml/xml.h>
#include <iostream>
#include "x3d_appearance.h" #include "x3d_appearance.h"
#include "x3d_coords.h" #include "x3d_coords.h"
#include "x3d_ifaceset.h"
#include "x3d_ops.h" #include "x3d_ops.h"
#include "x3d_shape.h"
#include "x3d_transform.h" #include "x3d_transform.h"

View File

@ -23,7 +23,9 @@
#include <iostream> #include <iostream>
#include <sstream>
#include <wx/xml/xml.h> #include <wx/xml/xml.h>
#include <wx/log.h>
#include "x3d_ops.h" #include "x3d_ops.h"
#include "x3d_shape.h" #include "x3d_shape.h"
#include "plugins/3dapi/ifsg_all.h" #include "plugins/3dapi/ifsg_all.h"
@ -63,9 +65,13 @@ X3DSHAPE::X3DSHAPE( X3DNODE* aParent ) : X3DNODE()
X3DSHAPE::~X3DSHAPE() X3DSHAPE::~X3DSHAPE()
{ {
#if defined( DEBUG_X3D ) && ( DEBUG_X3D > 2 ) #if defined( DEBUG_X3D ) && ( DEBUG_X3D > 2 )
std::cerr << " * [INFO] Destroying Shape with " << m_Children.size(); do {
std::cerr << " children, " << m_Refs.size() << " references and "; std::ostringstream ostr;
std::cerr << m_BackPointers.size() << " backpointers\n"; ostr << " * [INFO] Destroying Shape with " << m_Children.size();
ostr << " children, " << m_Refs.size() << " references and ";
ostr << m_BackPointers.size() << " backpointers";
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return; return;
@ -247,9 +253,13 @@ SGNODE* X3DSHAPE::TranslateToSG( SGNODE* aParent )
return NULL; return NULL;
#if defined( DEBUG_X3D ) && ( DEBUG_X3D > 2 ) #if defined( DEBUG_X3D ) && ( DEBUG_X3D > 2 )
std::cerr << " * [INFO] Translating Shape with " << m_Children.size(); do {
std::cerr << " children, " << m_Refs.size() << " references and "; std::ostringstream ostr;
std::cerr << m_BackPointers.size() << " backpointers\n"; ostr << " * [INFO] Translating Shape with " << m_Children.size();
ostr << " children, " << m_Refs.size() << " references and ";
ostr << m_BackPointers.size() << " backpointers";
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
S3D::SGTYPES ptype = S3D::GetSGNodeType( aParent ); S3D::SGTYPES ptype = S3D::GetSGNodeType( aParent );
@ -257,9 +267,13 @@ SGNODE* X3DSHAPE::TranslateToSG( SGNODE* aParent )
if( NULL != aParent && ptype != S3D::SGTYPE_TRANSFORM ) if( NULL != aParent && ptype != S3D::SGTYPE_TRANSFORM )
{ {
#ifdef DEBUG_X3D #ifdef DEBUG_X3D
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << " * [BUG] Shape does not have a Transform parent (parent ID: "; std::ostringstream ostr;
std::cerr << ptype << ")\n"; ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] Shape does not have a Transform parent (parent ID: ";
ostr << ptype << ")";
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return NULL; return NULL;

View File

@ -23,7 +23,9 @@
#include <iostream> #include <iostream>
#include <sstream>
#include <wx/xml/xml.h> #include <wx/xml/xml.h>
#include <wx/log.h>
#include "x3d_ops.h" #include "x3d_ops.h"
#include "x3d_transform.h" #include "x3d_transform.h"
#include "plugins/3dapi/ifsg_all.h" #include "plugins/3dapi/ifsg_all.h"
@ -60,9 +62,13 @@ X3DTRANSFORM::X3DTRANSFORM( X3DNODE* aParent ) : X3DNODE()
X3DTRANSFORM::~X3DTRANSFORM() X3DTRANSFORM::~X3DTRANSFORM()
{ {
#if defined( DEBUG_X3D ) && ( DEBUG_X3D > 2 ) #if defined( DEBUG_X3D ) && ( DEBUG_X3D > 2 )
std::cerr << " * [INFO] Destroying Transform with " << m_Children.size(); do {
std::cerr << " children, " << m_Refs.size() << " references and "; std::ostringstream ostr;
std::cerr << m_BackPointers.size() << " backpointers\n"; ostr << " * [INFO] Destroying Transform with " << m_Children.size();
ostr << " children, " << m_Refs.size() << " references and ";
ostr << m_BackPointers.size() << " backpointers";
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return; return;
@ -265,9 +271,13 @@ bool X3DTRANSFORM::AddRefNode( X3DNODE* aNode )
SGNODE* X3DTRANSFORM::TranslateToSG( SGNODE* aParent ) SGNODE* X3DTRANSFORM::TranslateToSG( SGNODE* aParent )
{ {
#if defined( DEBUG_X3D ) && ( DEBUG_X3D > 2 ) #if defined( DEBUG_X3D ) && ( DEBUG_X3D > 2 )
std::cerr << " * [INFO] Translating Transform with " << m_Children.size(); do {
std::cerr << " children, " << m_Refs.size() << " references and "; std::ostringstream ostr;
std::cerr << m_BackPointers.size() << " backpointers\n"; ostr << " * [INFO] Translating Transform with " << m_Children.size();
ostr << " children, " << m_Refs.size() << " references and ";
ostr << m_BackPointers.size() << " backpointers";
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
if( m_Children.empty() && m_Refs.empty() ) if( m_Children.empty() && m_Refs.empty() )
@ -277,10 +287,14 @@ SGNODE* X3DTRANSFORM::TranslateToSG( SGNODE* aParent )
if( NULL != aParent && ptype != S3D::SGTYPE_TRANSFORM ) if( NULL != aParent && ptype != S3D::SGTYPE_TRANSFORM )
{ {
#ifdef DEBUG_VRML2 #ifdef DEBUG_X3D
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; do {
std::cerr << " * [BUG] Transform does not have a Transform parent (parent ID: "; std::ostringstream ostr;
std::cerr << ptype << ")\n"; ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] Transform does not have a Transform parent (parent ID: ";
ostr << ptype << ")";
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif #endif
return NULL; return NULL;