diff --git a/plugins/3d/vrml/CMakeLists.txt b/plugins/3d/vrml/CMakeLists.txt index 8c2528600e..131b486d3f 100644 --- a/plugins/3d/vrml/CMakeLists.txt +++ b/plugins/3d/vrml/CMakeLists.txt @@ -6,7 +6,7 @@ include_directories( ${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 ${CMAKE_SOURCE_DIR}/common/richio.cpp diff --git a/plugins/3d/vrml/v1/vrml1_base.cpp b/plugins/3d/vrml/v1/vrml1_base.cpp index 8576e6b648..4f2a729f15 100644 --- a/plugins/3d/vrml/v1/vrml1_base.cpp +++ b/plugins/3d/vrml/v1/vrml1_base.cpp @@ -22,6 +22,8 @@ */ #include +#include +#include #include "vrml1_base.h" #include "vrml1_group.h" @@ -48,7 +50,7 @@ WRL1BASE::WRL1BASE() : WRL1NODE( NULL ) WRL1BASE::~WRL1BASE() { #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 cancelDict(); @@ -60,8 +62,12 @@ WRL1BASE::~WRL1BASE() bool WRL1BASE::SetParent( WRL1NODE* aParent ) { #ifdef DEBUG_VRML1 - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] attempting to set parent on WRL1BASE node\n"; + do { + 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 return false; @@ -109,8 +115,12 @@ void WRL1BASE::DelInlineData( const std::string& aName, WRL1INLINE* aObject ) std::string WRL1BASE::GetName( void ) { #ifdef DEBUG_VRML1 - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] attempting to extract name from virtual base node\n"; + do { + 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 return std::string( "" ); @@ -120,8 +130,12 @@ std::string WRL1BASE::GetName( void ) bool WRL1BASE::SetName( const std::string& aName ) { #ifdef DEBUG_VRML1 - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] attempting to set name on virtual base node\n"; + do { + 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 return false; @@ -133,15 +147,18 @@ bool WRL1BASE::Read( WRLPROC& proc ) if( proc.GetVRMLType() != VRML_V1 ) { #ifdef DEBUG_VRML1 - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] no open file or file is not a VRML1 file\n"; + do { + 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 return false; } std::string glob; - WRL1NODES ntype; // Note: according to the VRML1 specification, a file may contain // only one grouping node at the top level. The following code @@ -150,12 +167,19 @@ bool WRL1BASE::Read( WRLPROC& proc ) while( proc.Peek() ) { + size_t line, column; + proc.GetFilePosData( line, column ); + if( !ReadNode( proc, this, NULL ) ) { #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad file format; unexpected eof at line "; - std::cerr << line << ", column " << column << "\n"; + do { + std::ostringstream ostr; + 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 return false; @@ -165,8 +189,12 @@ bool WRL1BASE::Read( WRLPROC& proc ) if( !proc.eof() ) { #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << proc.GetError() << "\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << proc.GetError(); + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -184,8 +212,12 @@ bool WRL1BASE::implementUse( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode if( !aParent ) { #ifdef DEBUG_VRML1 - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] invoked with NULL parent\n"; + do { + 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 return false; @@ -196,8 +228,12 @@ bool WRL1BASE::implementUse( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode if( !proc.ReadName( glob ) ) { #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << proc.GetError() << "\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << proc.GetError(); + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -209,8 +245,12 @@ bool WRL1BASE::implementUse( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode if( NULL == ref ) { #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] node '" << glob << "' not found\n"; + do { + 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 return true; @@ -219,10 +259,14 @@ bool WRL1BASE::implementUse( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode if( !aParent->AddRefNode( ref ) ) { #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] failed to add node '" << glob << "' ("; - std::cerr << ref->GetNodeTypeName( ref->GetNodeType() ) << ") to parent of type "; - std::cerr << aParent->GetNodeTypeName( aParent->GetNodeType() ) << "\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\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 return false; @@ -243,8 +287,12 @@ bool WRL1BASE::implementDef( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode if( NULL == aParent ) { #ifdef DEBUG_VRML1 - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] invalid parent pointer (NULL)\n"; + do { + 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 return false; @@ -256,8 +304,12 @@ bool WRL1BASE::implementDef( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode if( !proc.ReadName( glob ) ) { #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << proc.GetError() << "\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << proc.GetError(); + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -274,11 +326,15 @@ bool WRL1BASE::implementDef( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode if( lnode && !lnode->SetName( glob ) ) { #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) - size_t line, column; - proc.GetFilePosData( line, column ); - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad formatting (invalid name) at line"; - std::cerr << line << ", column " << column << "\n"; + do { + std::ostringstream ostr; + size_t line, column; + proc.GetFilePosData( line, column ); + 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 return false; @@ -310,8 +366,12 @@ bool WRL1BASE::ReadNode( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode ) if( NULL == aParent ) { #ifdef DEBUG_VRML1 - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] invalid parent pointer (NULL)\n"; + do { + 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 return false; @@ -325,8 +385,10 @@ bool WRL1BASE::ReadNode( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) if( !proc.eof() ) { - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - 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() ); } #endif @@ -342,8 +404,12 @@ bool WRL1BASE::ReadNode( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode ) if( !implementUse( proc, aParent, aNode ) ) { #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << proc.GetError() << "\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << proc.GetError(); + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -357,8 +423,12 @@ bool WRL1BASE::ReadNode( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode ) if( !implementDef( proc, aParent, aNode ) ) { #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << proc.GetError() << "\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << proc.GetError(); + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -373,7 +443,11 @@ bool WRL1BASE::ReadNode( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode ) proc.GetFilePosData( line, column ); #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 switch( ntype ) @@ -454,10 +528,14 @@ bool WRL1BASE::ReadNode( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode ) if( !proc.DiscardNode() ) { #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) - std::cerr << proc.GetError() << "\n"; - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] could not discard node at line " << line; - std::cerr << ", column " << column << "\n"; + do { + std::ostringstream ostr; + ostr << proc.GetError() << "\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 return false; @@ -465,8 +543,10 @@ bool WRL1BASE::ReadNode( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode ) #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) else { - std::cerr << " * [INFO] discarded node '" << glob << "' at line "; - std::cerr << line << ", col " << column << " (currently unsupported)\n"; + std::ostringstream ostr; + ostr << " * [INFO] discarded node '" << glob << "' at line "; + ostr << line << ", col " << column << " (currently unsupported)"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); } #endif @@ -481,9 +561,13 @@ bool WRL1BASE::Read( WRLPROC& proc, WRL1BASE* aTopNode ) { // this function makes no sense in the base node #ifdef DEBUG_VRML1 - std::cerr << proc.GetError() << "\n"; - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] this method must never be invoked on a WRL1BASE object\n"; + do { + std::ostringstream ostr; + 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 return false; @@ -670,8 +754,12 @@ bool WRL1BASE::readShapeHints( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNod SGNODE* WRL1BASE::TranslateToSG( SGNODE* aParent, WRL1STATUS* /*sp*/ ) { #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 ) - std::cerr << " * [INFO] Translating VRML1 Base with " << m_Items.size(); - std::cerr << " items\n"; + do { + 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 if( m_Items.empty() ) diff --git a/plugins/3d/vrml/v1/vrml1_coords.cpp b/plugins/3d/vrml/v1/vrml1_coords.cpp index e7ab574885..b6fc79a8f6 100644 --- a/plugins/3d/vrml/v1/vrml1_coords.cpp +++ b/plugins/3d/vrml/v1/vrml1_coords.cpp @@ -23,6 +23,8 @@ #include +#include +#include #include "vrml1_base.h" #include "vrml1_coords.h" @@ -51,7 +53,7 @@ WRL1COORDS::WRL1COORDS( NAMEREGISTER* aDictionary, WRL1NODE* aParent ) : WRL1COORDS::~WRL1COORDS() { #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 ) - std::cerr << " * [INFO] Destroying Coordinate3 node\n"; + wxLogTrace( MASK_VRML, " * [INFO] Destroying Coordinate3 node\n" ); #endif return; @@ -63,8 +65,12 @@ bool WRL1COORDS::AddRefNode( WRL1NODE* aNode ) // this node may not own or reference any other node #ifdef DEBUG_VRML1 - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] AddRefNode is not applicable\n"; + do { + 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 return false; @@ -76,8 +82,12 @@ bool WRL1COORDS::AddChildNode( WRL1NODE* aNode ) // this node may not own or reference any other node #ifdef DEBUG_VRML1 - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] AddChildNode is not applicable\n"; + do { + 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 return false; @@ -94,9 +104,13 @@ bool WRL1COORDS::Read( WRLPROC& proc, WRL1BASE* aTopNode ) if( proc.eof() ) { #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad file format; unexpected eof at line "; - std::cerr << line << ", column " << column << "\n"; + do { + std::ostringstream ostr; + 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 return false; @@ -105,10 +119,14 @@ bool WRL1COORDS::Read( WRLPROC& proc, WRL1BASE* aTopNode ) if( '{' != tok ) { #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) - std::cerr << proc.GetError() << "\n"; - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad file format; expecting '{' but got '" << tok; - std::cerr << "' at line " << line << ", column " << column << "\n"; + do { + std::ostringstream ostr; + ostr << proc.GetError() << "\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 return false; @@ -126,8 +144,12 @@ bool WRL1COORDS::Read( WRLPROC& proc, WRL1BASE* aTopNode ) if( !proc.ReadName( glob ) ) { #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << proc.GetError() << "\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << proc.GetError(); + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -141,11 +163,15 @@ bool WRL1COORDS::Read( WRLPROC& proc, WRL1BASE* aTopNode ) if( !proc.ReadMFVec3f( points ) ) { #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] invalid point set at line " << line << ", column "; - std::cerr << column << "\n"; - std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; - std::cerr << " * [INFO] message: '" << proc.GetError() << "'\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] invalid point set at line " << line << ", column "; + 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 return false; @@ -154,10 +180,14 @@ bool WRL1COORDS::Read( WRLPROC& proc, WRL1BASE* aTopNode ) else { #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad Coordinate at line " << line << ", column "; - std::cerr << column << "\n"; - std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\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 return false; @@ -185,10 +215,14 @@ bool WRL1COORDS::Read( WRLPROC& proc, WRL1BASE* aTopNode ) proc.GetFilePosData( line, column ); #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad Coordinate at line " << line << ", column "; - std::cerr << column << " (no closing brace)\n"; - std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\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 return false; @@ -215,7 +249,7 @@ SGNODE* WRL1COORDS::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp ) if( NULL == sp ) { #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 return NULL; diff --git a/plugins/3d/vrml/v1/vrml1_faceset.cpp b/plugins/3d/vrml/v1/vrml1_faceset.cpp index 8cb0bbf9f2..92f56f9428 100644 --- a/plugins/3d/vrml/v1/vrml1_faceset.cpp +++ b/plugins/3d/vrml/v1/vrml1_faceset.cpp @@ -23,6 +23,8 @@ #include +#include +#include #include "vrml1_base.h" #include "vrml1_faceset.h" @@ -56,9 +58,13 @@ WRL1FACESET::WRL1FACESET( NAMEREGISTER* aDictionary, WRL1NODE* aParent ) : WRL1FACESET::~WRL1FACESET() { #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 ) - std::cerr << " * [INFO] Destroying IndexedFaceSet with " << m_Children.size(); - std::cerr << " children, " << m_Refs.size() << " references and "; - std::cerr << m_BackPointers.size() << " backpointers\n"; + do { + std::ostringstream ostr; + 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 return; @@ -70,8 +76,12 @@ bool WRL1FACESET::AddRefNode( WRL1NODE* aNode ) // this node may not own or reference any other node #ifdef DEBUG_VRML1 - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] AddRefNode is not applicable\n"; + do { + 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 return false; @@ -83,8 +93,12 @@ bool WRL1FACESET::AddChildNode( WRL1NODE* aNode ) // this node may not own or reference any other node #ifdef DEBUG_VRML1 - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] AddChildNode is not applicable\n"; + do { + 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 return false; @@ -101,9 +115,13 @@ bool WRL1FACESET::Read( WRLPROC& proc, WRL1BASE* aTopNode ) if( proc.eof() ) { #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad file format; unexpected eof at line "; - std::cerr << line << ", column " << column << "\n"; + do { + std::ostringstream ostr; + 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 return false; @@ -112,10 +130,14 @@ bool WRL1FACESET::Read( WRLPROC& proc, WRL1BASE* aTopNode ) if( '{' != tok ) { #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) - std::cerr << proc.GetError() << "\n"; - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad file format; expecting '{' but got '" << tok; - std::cerr << "' at line " << line << ", column " << column << "\n"; + do { + std::ostringstream ostr; + ostr << proc.GetError() << "\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 return false; @@ -135,8 +157,12 @@ bool WRL1FACESET::Read( WRLPROC& proc, WRL1BASE* aTopNode ) if( !proc.ReadName( glob ) ) { #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << proc.GetError() << "\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << proc.GetError(); + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -153,11 +179,15 @@ bool WRL1FACESET::Read( WRLPROC& proc, WRL1BASE* aTopNode ) if( !proc.ReadMFInt( coordIndex ) ) { #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] invalid coordIndex at line " << line << ", column "; - std::cerr << column << "\n"; - std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; - std::cerr << " * [INFO] message: '" << proc.GetError() << "'\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] invalid coordIndex at line " << line << ", column "; + 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 return false; @@ -168,11 +198,15 @@ bool WRL1FACESET::Read( WRLPROC& proc, WRL1BASE* aTopNode ) if( !proc.ReadMFInt( matIndex ) ) { #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] invalid materialIndex at line " << line << ", column "; - std::cerr << column << "\n"; - std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; - std::cerr << " * [INFO] message: '" << proc.GetError() << "'\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] invalid materialIndex at line " << line << ", column "; + 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 return false; @@ -183,11 +217,15 @@ bool WRL1FACESET::Read( WRLPROC& proc, WRL1BASE* aTopNode ) if( !proc.ReadMFInt( normIndex ) ) { #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] invalid normalIndex at line " << line << ", column "; - std::cerr << column << "\n"; - std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; - std::cerr << " * [INFO] message: '" << proc.GetError() << "'\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] invalid normalIndex at line " << line << ", column "; + 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 return false; @@ -198,11 +236,15 @@ bool WRL1FACESET::Read( WRLPROC& proc, WRL1BASE* aTopNode ) if( !proc.ReadMFInt( texIndex ) ) { #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] invalid textureCoordIndex at line " << line << ", column "; - std::cerr << column << "\n"; - std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; - std::cerr << " * [INFO] message: '" << proc.GetError() << "'\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] invalid textureCoordIndex at line " << line << ", column "; + 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 return false; @@ -211,10 +253,14 @@ bool WRL1FACESET::Read( WRLPROC& proc, WRL1BASE* aTopNode ) else { #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad IndexedFaceSet at line " << line << ", column "; - std::cerr << column << "\n"; - std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\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 return false; @@ -234,7 +280,7 @@ SGNODE* WRL1FACESET::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp ) if( !m_Parent ) { #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 return NULL; @@ -244,7 +290,7 @@ SGNODE* WRL1FACESET::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp ) if( NULL == sp ) { #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 return NULL; @@ -257,10 +303,10 @@ SGNODE* WRL1FACESET::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp ) { #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) 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 ) - std::cerr << " * [INFO] bad model: no material set\n"; + wxLogTrace( MASK_VRML, " * [INFO] bad model: no material set\n" ); #endif return NULL; @@ -275,8 +321,12 @@ SGNODE* WRL1FACESET::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp ) if( coordsize < 3 || vsize < 3 ) { #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) - std::cerr << " * [INFO] bad model: coordsize, indexsize = " << coordsize; - std::cerr << ", " << vsize << "\n"; + do { + std::ostringstream ostr; + ostr << " * [INFO] bad model: coordsize, indexsize = " << coordsize; + ostr << ", " << vsize; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return NULL; @@ -302,7 +352,7 @@ SGNODE* WRL1FACESET::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp ) if( matIndex.empty() ) { #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 // support bad models by temporarily switching bindings diff --git a/plugins/3d/vrml/v1/vrml1_group.cpp b/plugins/3d/vrml/v1/vrml1_group.cpp index bf2c92533a..a86ef44951 100644 --- a/plugins/3d/vrml/v1/vrml1_group.cpp +++ b/plugins/3d/vrml/v1/vrml1_group.cpp @@ -28,6 +28,8 @@ // simply duplicate the code #include +#include +#include #include "vrml1_base.h" #include "vrml1_group.h" @@ -57,9 +59,13 @@ WRL1GROUP::WRL1GROUP( NAMEREGISTER* aDictionary, WRL1NODE* aParent ) : WRL1GROUP::~WRL1GROUP() { #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 ) - std::cerr << " * [INFO] Destroying Group with " << m_Children.size(); - std::cerr << " children, " << m_Refs.size() << " references and "; - std::cerr << m_BackPointers.size() << " backpointers\n"; + do { + std::ostringstream ostr; + 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 return; @@ -72,8 +78,12 @@ bool WRL1GROUP::Read( WRLPROC& proc, WRL1BASE* aTopNode ) if( NULL == aTopNode ) { #ifdef DEBUG_VRML1 - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] aTopNode is NULL\n"; + do { + 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 return false; @@ -87,9 +97,13 @@ bool WRL1GROUP::Read( WRLPROC& proc, WRL1BASE* aTopNode ) if( proc.eof() ) { #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad file format; unexpected eof at line "; - std::cerr << line << ", column " << column << "\n"; + do { + std::ostringstream ostr; + 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 return false; @@ -98,10 +112,14 @@ bool WRL1GROUP::Read( WRLPROC& proc, WRL1BASE* aTopNode ) if( '{' != tok ) { #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) - std::cerr << proc.GetError() << "\n"; - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad file format; expecting '{' but got '" << tok; - std::cerr << "' at line " << line << ", column " << column << "\n"; + do { + std::ostringstream ostr; + ostr << proc.GetError() << "\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 return false; @@ -123,9 +141,13 @@ bool WRL1GROUP::Read( WRLPROC& proc, WRL1BASE* aTopNode ) if( !aTopNode->ReadNode( proc, this, NULL ) ) { #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad file format; unexpected eof at line "; - std::cerr << line << ", column " << column << "\n"; + do { + std::ostringstream ostr; + 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 return false; @@ -143,17 +165,25 @@ bool WRL1GROUP::Read( WRLPROC& proc, WRL1BASE* aTopNode ) SGNODE* WRL1GROUP::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp ) { #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 ) - std::cerr << " * [INFO] Translating Group with " << m_Children.size(); - std::cerr << " children, " << m_Refs.size() << " references and "; - std::cerr << m_BackPointers.size() << " backpointers (total "; - std::cerr << m_Items.size() << " items)\n"; + do { + std::ostringstream ostr; + ostr << " * [INFO] Translating Group with " << m_Children.size(); + 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 if( !m_Parent ) { #ifdef DEBUG - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] Group has no parent\n"; + do { + 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 return NULL; @@ -164,7 +194,7 @@ SGNODE* WRL1GROUP::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp ) if( NULL == sp ) { #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 return NULL; @@ -181,9 +211,13 @@ SGNODE* WRL1GROUP::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp ) if( NULL != aParent && ptype != S3D::SGTYPE_TRANSFORM ) { #ifdef DEBUG_VRML1 - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] Group does not have a Transform parent (parent ID: "; - std::cerr << ptype << ")\n"; + do { + std::ostringstream ostr; + 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 return NULL; diff --git a/plugins/3d/vrml/v1/vrml1_matbinding.cpp b/plugins/3d/vrml/v1/vrml1_matbinding.cpp index 7d8a3f2df2..8a4379741f 100644 --- a/plugins/3d/vrml/v1/vrml1_matbinding.cpp +++ b/plugins/3d/vrml/v1/vrml1_matbinding.cpp @@ -23,6 +23,8 @@ #include +#include +#include #include "vrml1_base.h" #include "vrml1_matbinding.h" @@ -54,7 +56,7 @@ WRL1MATBINDING::WRL1MATBINDING( NAMEREGISTER* aDictionary, WRL1NODE* aParent ) : WRL1MATBINDING::~WRL1MATBINDING() { #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 ) - std::cerr << " * [INFO] Destroying MaterialBinding node\n"; + wxLogTrace( MASK_VRML, " * [INFO] Destroying MaterialBinding node\n" ); #endif return; @@ -66,8 +68,12 @@ bool WRL1MATBINDING::AddRefNode( WRL1NODE* aNode ) // this node may not own or reference any other node #ifdef DEBUG_VRML1 - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] AddRefNode is not applicable\n"; + do { + 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 return false; @@ -79,8 +85,12 @@ bool WRL1MATBINDING::AddChildNode( WRL1NODE* aNode ) // this node may not own or reference any other node #ifdef DEBUG_VRML1 - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] AddChildNode is not applicable\n"; + do { + 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 return false; @@ -92,8 +102,12 @@ bool WRL1MATBINDING::Read( WRLPROC& proc, WRL1BASE* aTopNode ) if( NULL == aTopNode ) { #ifdef DEBUG_VRML1 - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] aTopNode is NULL\n"; + do { + 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 return false; @@ -107,9 +121,13 @@ bool WRL1MATBINDING::Read( WRLPROC& proc, WRL1BASE* aTopNode ) if( proc.eof() ) { #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad file format; unexpected eof at line "; - std::cerr << line << ", column " << column << "\n"; + do { + std::ostringstream ostr; + 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 return false; @@ -118,10 +136,14 @@ bool WRL1MATBINDING::Read( WRLPROC& proc, WRL1BASE* aTopNode ) if( '{' != tok ) { #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) - std::cerr << proc.GetError() << "\n"; - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad file format; expecting '{' but got '" << tok; - std::cerr << "' at line " << line << ", column " << column << "\n"; + do { + std::ostringstream ostr; + ostr << proc.GetError() << "\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 return false; @@ -141,8 +163,12 @@ bool WRL1MATBINDING::Read( WRLPROC& proc, WRL1BASE* aTopNode ) if( !proc.ReadName( glob ) ) { #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << proc.GetError() << "\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << proc.GetError(); + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -151,10 +177,14 @@ bool WRL1MATBINDING::Read( WRLPROC& proc, WRL1BASE* aTopNode ) if( glob.compare( "value" ) ) { #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad MaterialBinding at line " << line << ", column "; - std::cerr << column << " (did not find keyword 'value')\n"; - std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\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 return false; @@ -163,8 +193,12 @@ bool WRL1MATBINDING::Read( WRLPROC& proc, WRL1BASE* aTopNode ) if( !proc.ReadName( glob ) ) { #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << proc.GetError() << "\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << proc.GetError(); + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -217,10 +251,14 @@ bool WRL1MATBINDING::Read( WRLPROC& proc, WRL1BASE* aTopNode ) else { #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad MaterialBinding at line " << line << ", column "; - std::cerr << column << "\n"; - std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\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 m_binding = BIND_OVERALL; @@ -236,7 +274,7 @@ SGNODE* WRL1MATBINDING::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp ) if( NULL == sp ) { #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 return NULL; diff --git a/plugins/3d/vrml/v1/vrml1_material.cpp b/plugins/3d/vrml/v1/vrml1_material.cpp index 715f0262ec..3fd365606e 100644 --- a/plugins/3d/vrml/v1/vrml1_material.cpp +++ b/plugins/3d/vrml/v1/vrml1_material.cpp @@ -23,6 +23,8 @@ #include +#include +#include #include "vrml1_base.h" #include "vrml1_material.h" @@ -56,7 +58,7 @@ WRL1MATERIAL::WRL1MATERIAL( NAMEREGISTER* aDictionary, WRL1NODE* aParent ) : WRL1MATERIAL::~WRL1MATERIAL() { #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 ) - std::cerr << " * [INFO] Destroying Material node\n"; + wxLogTrace( MASK_VRML, " * [INFO] Destroying Material node\n" ); #endif // destroy any orphaned color nodes @@ -65,14 +67,22 @@ WRL1MATERIAL::~WRL1MATERIAL() if( NULL != colors[i] ) { #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 if( NULL == S3D::GetSGNodeParent( colors[i] ) ) S3D::DestroyNode( colors[i] ); #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 } } @@ -86,8 +96,12 @@ bool WRL1MATERIAL::AddRefNode( WRL1NODE* aNode ) // this node may not own or reference any other node #ifdef DEBUG_VRML1 - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] AddRefNode is not applicable\n"; + do { + 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 return false; @@ -99,8 +113,12 @@ bool WRL1MATERIAL::AddChildNode( WRL1NODE* aNode ) // this node may not own or reference any other node #ifdef DEBUG_VRML1 - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] AddChildNode is not applicable\n"; + do { + 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 return false; @@ -112,8 +130,12 @@ bool WRL1MATERIAL::Read( WRLPROC& proc, WRL1BASE* aTopNode ) if( NULL == aTopNode ) { #ifdef DEBUG_VRML1 - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] aTopNode is NULL\n"; + do { + 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 return false; @@ -127,9 +149,13 @@ bool WRL1MATERIAL::Read( WRLPROC& proc, WRL1BASE* aTopNode ) if( proc.eof() ) { #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad file format; unexpected eof at line "; - std::cerr << line << ", column " << column << "\n"; + do { + std::ostringstream ostr; + 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 return false; @@ -138,10 +164,14 @@ bool WRL1MATERIAL::Read( WRLPROC& proc, WRL1BASE* aTopNode ) if( '{' != tok ) { #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) - std::cerr << proc.GetError() << "\n"; - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad file format; expecting '{' but got '" << tok; - std::cerr << "' at line " << line << ", column " << column << "\n"; + do { + std::ostringstream ostr; + ostr << proc.GetError() << "\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 return false; @@ -161,8 +191,12 @@ bool WRL1MATERIAL::Read( WRLPROC& proc, WRL1BASE* aTopNode ) if( !proc.ReadName( glob ) ) { #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << proc.GetError() << "\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << proc.GetError(); + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -183,11 +217,15 @@ bool WRL1MATERIAL::Read( WRLPROC& proc, WRL1BASE* aTopNode ) if( !proc.ReadMFVec3f( specularColor ) ) { #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] invalid specularColor at line " << line << ", column "; - std::cerr << column << "\n"; - std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; - std::cerr << " * [INFO] message: '" << proc.GetError() << "'\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] invalid specularColor at line " << line << ", column "; + 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 return false; @@ -198,11 +236,15 @@ bool WRL1MATERIAL::Read( WRLPROC& proc, WRL1BASE* aTopNode ) if( !proc.ReadMFVec3f( diffuseColor ) ) { #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] invalid diffuseColor at line " << line << ", column "; - std::cerr << column << "\n"; - std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; - std::cerr << " * [INFO] message: '" << proc.GetError() << "'\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] invalid diffuseColor at line " << line << ", column "; + 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 return false; @@ -213,11 +255,15 @@ bool WRL1MATERIAL::Read( WRLPROC& proc, WRL1BASE* aTopNode ) if( !proc.ReadMFVec3f( emissiveColor ) ) { #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] invalid emissiveColor at line " << line << ", column "; - std::cerr << column << "\n"; - std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; - std::cerr << " * [INFO] message: '" << proc.GetError() << "'\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] invalid emissiveColor at line " << line << ", column "; + 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 return false; @@ -228,11 +274,15 @@ bool WRL1MATERIAL::Read( WRLPROC& proc, WRL1BASE* aTopNode ) if( !proc.ReadMFFloat( shininess ) ) { #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] invalid shininess at line " << line << ", column "; - std::cerr << column << "\n"; - std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; - std::cerr << " * [INFO] message: '" << proc.GetError() << "'\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] invalid shininess at line " << line << ", column "; + 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 return false; @@ -243,11 +293,15 @@ bool WRL1MATERIAL::Read( WRLPROC& proc, WRL1BASE* aTopNode ) if( !proc.ReadMFFloat( transparency ) ) { #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] invalid transparency at line " << line << ", column "; - std::cerr << column << "\n"; - std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; - std::cerr << " * [INFO] message: '" << proc.GetError() << "'\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] invalid transparency at line " << line << ", column "; + 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 return false; @@ -258,11 +312,15 @@ bool WRL1MATERIAL::Read( WRLPROC& proc, WRL1BASE* aTopNode ) if( !proc.ReadMFVec3f( ambientColor ) ) { #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] invalid ambientColor at line " << line << ", column "; - std::cerr << column << "\n"; - std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; - std::cerr << " * [INFO] message: '" << proc.GetError() << "'\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] invalid ambientColor at line " << line << ", column "; + 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 return false; @@ -271,10 +329,14 @@ bool WRL1MATERIAL::Read( WRLPROC& proc, WRL1BASE* aTopNode ) else { #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad Material at line " << line << ", column "; - std::cerr << column << "\n"; - std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\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 return false; @@ -290,7 +352,7 @@ SGNODE* WRL1MATERIAL::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp ) if( NULL == sp ) { #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 return NULL; diff --git a/plugins/3d/vrml/v1/vrml1_node.cpp b/plugins/3d/vrml/v1/vrml1_node.cpp index b22c54b297..2ee1a81c37 100644 --- a/plugins/3d/vrml/v1/vrml1_node.cpp +++ b/plugins/3d/vrml/v1/vrml1_node.cpp @@ -29,6 +29,8 @@ #include #include #include +#include +#include #include "vrml1_node.h" @@ -141,9 +143,13 @@ WRL1NODE::WRL1NODE( NAMEREGISTER* aDictionary ) WRL1NODE::~WRL1NODE() { #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 ) - std::cerr << " * [INFO] ^^ Destroying Type " << m_Type << " with " << m_Children.size(); - std::cerr << " children, " << m_Refs.size() << " references and "; - std::cerr << m_BackPointers.size() << " backpointers\n"; + do { + std::ostringstream ostr; + 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 m_Items.clear(); @@ -165,13 +171,21 @@ WRL1NODE::~WRL1NODE() { #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 ) ++acc; - std::cerr << " * [INFO] " << tabs << "Type " << m_Type << " is Unlinking ref #"; - std::cerr << acc << "\n"; + do { + 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 (*sBP)->unlinkRefNode( this ); #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 ) - std::cerr << " * [INFO] " << tabs << "Type " << m_Type << " has unlinked ref #"; - std::cerr << acc << "\n"; + do { + 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 ++sBP; } @@ -190,18 +204,30 @@ WRL1NODE::~WRL1NODE() { #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 ) ++acc; - std::cerr << " * [INFO] " << otabs << "Type " << m_Type << " is Deleting child #"; - std::cerr << acc << "\n"; + do { + 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 (*sC)->SetParent( NULL, false ); #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 ) - std::cerr << " * [INFO] " << otabs << "Type " << m_Type << " has unlinked child #"; - std::cerr << acc << "\n"; + do { + 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 - //delete *sC; + delete *sC; #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 ) - std::cerr << " * [INFO] " << otabs << "Type " << m_Type << " has deleted child #"; - std::cerr << acc << "\n"; + do { + 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 ++sC; } @@ -269,8 +295,12 @@ void WRL1NODE::delNodeRef( WRL1NODE* aNode ) } #ifdef DEBUG_VRML1 - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] delNodeRef() did not find its target\n"; + do { + 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 return; @@ -303,8 +333,12 @@ bool WRL1NODE::SetName( const std::string& aName ) if( isdigit( aName[0] ) ) { #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] invalid node name '" << aName << "' (begins with digit)\n"; + do { + 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 return false; @@ -320,9 +354,13 @@ bool WRL1NODE::SetName( const std::string& aName ) || std::string::npos != aName.find_first_of( BAD_CHARS2 ) ) { #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] invalid node name '" << aName; - std::cerr<< "' (contains invalid character)\n"; + do { + std::ostringstream ostr; + 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 return false; @@ -406,8 +444,12 @@ bool WRL1NODE::AddChildNode( WRL1NODE* aNode ) if( aNode->GetNodeType() == WRL1_BASE ) { #ifdef DEBUG_VRML1 - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] attempting to add a base node to another node\n"; + do { + 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 return false; @@ -439,8 +481,12 @@ bool WRL1NODE::AddRefNode( WRL1NODE* aNode ) if( NULL == aNode ) { #ifdef DEBUG_VRML1 - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] NULL passed as node pointer\n"; + do { + 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 return false; @@ -449,8 +495,12 @@ bool WRL1NODE::AddRefNode( WRL1NODE* aNode ) if( aNode->GetNodeType() == WRL1_BASE ) { #ifdef DEBUG_VRML1 - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] attempting to add a base node ref to another base node\n"; + do { + 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 return false; diff --git a/plugins/3d/vrml/v1/vrml1_separator.cpp b/plugins/3d/vrml/v1/vrml1_separator.cpp index 5257024bd5..9ad874571b 100644 --- a/plugins/3d/vrml/v1/vrml1_separator.cpp +++ b/plugins/3d/vrml/v1/vrml1_separator.cpp @@ -22,6 +22,8 @@ */ #include +#include +#include #include "vrml1_base.h" #include "vrml1_separator.h" @@ -51,9 +53,13 @@ WRL1SEPARATOR::WRL1SEPARATOR( NAMEREGISTER* aDictionary, WRL1NODE* aParent ) : WRL1SEPARATOR::~WRL1SEPARATOR() { #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 ) - std::cerr << " * [INFO] Destroying Separator with " << m_Children.size(); - std::cerr << " children, " << m_Refs.size() << " references and "; - std::cerr << m_BackPointers.size() << " backpointers\n"; + do { + std::ostringstream ostr; + 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 return; @@ -66,8 +72,12 @@ bool WRL1SEPARATOR::Read( WRLPROC& proc, WRL1BASE* aTopNode ) if( NULL == aTopNode ) { #ifdef DEBUG_VRML1 - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] aTopNode is NULL\n"; + do { + 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 return false; @@ -81,9 +91,13 @@ bool WRL1SEPARATOR::Read( WRLPROC& proc, WRL1BASE* aTopNode ) if( proc.eof() ) { #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad file format; unexpected eof at line "; - std::cerr << line << ", column " << column << "\n"; + do { + std::ostringstream ostr; + 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 return false; @@ -92,10 +106,14 @@ bool WRL1SEPARATOR::Read( WRLPROC& proc, WRL1BASE* aTopNode ) if( '{' != tok ) { #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) - std::cerr << proc.GetError() << "\n"; - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad file format; expecting '{' but got '" << tok; - std::cerr << "' at line " << line << ", column " << column << "\n"; + do { + std::ostringstream ostr; + ostr << proc.GetError() << "\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 return false; @@ -117,9 +135,13 @@ bool WRL1SEPARATOR::Read( WRLPROC& proc, WRL1BASE* aTopNode ) if( !aTopNode->ReadNode( proc, this, NULL ) ) { #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad file format; unexpected eof at line "; - std::cerr << line << ", column " << column << "\n"; + do { + std::ostringstream ostr; + 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 return false; @@ -137,17 +159,25 @@ bool WRL1SEPARATOR::Read( WRLPROC& proc, WRL1BASE* aTopNode ) SGNODE* WRL1SEPARATOR::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp ) { #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 ) - std::cerr << " * [INFO] Translating Separator with " << m_Children.size(); - std::cerr << " children, " << m_Refs.size() << " references and "; - std::cerr << m_BackPointers.size() << " backpointers (total "; - std::cerr << m_Items.size() << " items)\n"; + do { + std::ostringstream ostr; + ostr << " * [INFO] Translating Separator with " << m_Children.size(); + 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 if( !m_Parent ) { #ifdef DEBUG - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] Separator has no parent\n"; + do { + 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 return NULL; @@ -163,9 +193,13 @@ SGNODE* WRL1SEPARATOR::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp ) if( NULL != aParent && ptype != S3D::SGTYPE_TRANSFORM ) { #ifdef DEBUG_VRML1 - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] Separator does not have a Transform parent (parent ID: "; - std::cerr << ptype << ")\n"; + do { + std::ostringstream ostr; + 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 return NULL; diff --git a/plugins/3d/vrml/v1/vrml1_shapehints.cpp b/plugins/3d/vrml/v1/vrml1_shapehints.cpp index 7fda267041..fe0def4c3f 100644 --- a/plugins/3d/vrml/v1/vrml1_shapehints.cpp +++ b/plugins/3d/vrml/v1/vrml1_shapehints.cpp @@ -23,7 +23,9 @@ #include +#include #include +#include #include "vrml1_base.h" #include "vrml1_shapehints.h" @@ -57,7 +59,7 @@ WRL1SHAPEHINTS::WRL1SHAPEHINTS( NAMEREGISTER* aDictionary, WRL1NODE* aParent ) : WRL1SHAPEHINTS::~WRL1SHAPEHINTS() { #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 ) - std::cerr << " * [INFO] Destroying ShapeHints node\n"; + wxLogTrace( MASK_VRML, " * [INFO] Destroying ShapeHints node\n" ); #endif return; @@ -69,8 +71,12 @@ bool WRL1SHAPEHINTS::AddRefNode( WRL1NODE* aNode ) // this node may not own or reference any other node #ifdef DEBUG_VRML1 - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] AddRefNode is not applicable\n"; + do { + 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 return false; @@ -82,8 +88,12 @@ bool WRL1SHAPEHINTS::AddChildNode( WRL1NODE* aNode ) // this node may not own or reference any other node #ifdef DEBUG_VRML1 - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] AddChildNode is not applicable\n"; + do { + 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 return false; @@ -95,8 +105,12 @@ bool WRL1SHAPEHINTS::Read( WRLPROC& proc, WRL1BASE* aTopNode ) if( NULL == aTopNode ) { #ifdef DEBUG_VRML1 - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] aTopNode is NULL\n"; + do { + 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 return false; @@ -110,9 +124,13 @@ bool WRL1SHAPEHINTS::Read( WRLPROC& proc, WRL1BASE* aTopNode ) if( proc.eof() ) { #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad file format; unexpected eof at line "; - std::cerr << line << ", column " << column << "\n"; + do { + std::ostringstream ostr; + 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 return false; @@ -121,10 +139,14 @@ bool WRL1SHAPEHINTS::Read( WRLPROC& proc, WRL1BASE* aTopNode ) if( '{' != tok ) { #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) - std::cerr << proc.GetError() << "\n"; - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad file format; expecting '{' but got '" << tok; - std::cerr << "' at line " << line << ", column " << column << "\n"; + do { + std::ostringstream ostr; + ostr << proc.GetError() << "\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 return false; @@ -144,8 +166,12 @@ bool WRL1SHAPEHINTS::Read( WRLPROC& proc, WRL1BASE* aTopNode ) if( !proc.ReadName( glob ) ) { #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << proc.GetError() << "\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << proc.GetError(); + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -162,8 +188,12 @@ bool WRL1SHAPEHINTS::Read( WRLPROC& proc, WRL1BASE* aTopNode ) if( !proc.ReadName( glob ) ) { #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << proc.GetError() << "\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << proc.GetError(); + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -178,10 +208,14 @@ bool WRL1SHAPEHINTS::Read( WRLPROC& proc, WRL1BASE* aTopNode ) else { #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad ShapeHints at line " << line << ", column "; - std::cerr << column << " (invalid value '" << glob << "')\n"; - std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\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 return false; @@ -192,8 +226,12 @@ bool WRL1SHAPEHINTS::Read( WRLPROC& proc, WRL1BASE* aTopNode ) if( !proc.ReadName( glob ) ) { #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << proc.GetError() << "\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << proc.GetError(); + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -208,8 +246,12 @@ bool WRL1SHAPEHINTS::Read( WRLPROC& proc, WRL1BASE* aTopNode ) if( !proc.ReadName( glob ) ) { #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << proc.GetError() << "\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << proc.GetError(); + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -226,8 +268,12 @@ bool WRL1SHAPEHINTS::Read( WRLPROC& proc, WRL1BASE* aTopNode ) if( !proc.ReadSFFloat( tmp ) ) { #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << proc.GetError() << "\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << proc.GetError(); + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -243,10 +289,14 @@ bool WRL1SHAPEHINTS::Read( WRLPROC& proc, WRL1BASE* aTopNode ) else { #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad ShapeHints at line " << line << ", column "; - std::cerr << column << " (unexpected keyword '" << glob << "')\n"; - std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\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 return false; @@ -265,7 +315,7 @@ SGNODE* WRL1SHAPEHINTS::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp ) if( NULL == sp ) { #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 return NULL; diff --git a/plugins/3d/vrml/v1/vrml1_switch.cpp b/plugins/3d/vrml/v1/vrml1_switch.cpp index cb7a9b93b2..f8a0399868 100644 --- a/plugins/3d/vrml/v1/vrml1_switch.cpp +++ b/plugins/3d/vrml/v1/vrml1_switch.cpp @@ -22,7 +22,9 @@ */ #include +#include #include +#include #include "vrml1_base.h" #include "vrml1_switch.h" @@ -55,9 +57,13 @@ WRL1SWITCH::WRL1SWITCH( NAMEREGISTER* aDictionary, WRL1NODE* aParent ) : WRL1SWITCH::~WRL1SWITCH() { #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 ) - std::cerr << " * [INFO] Destroying Switch with " << m_Children.size(); - std::cerr << " children, " << m_Refs.size() << " references and "; - std::cerr << m_BackPointers.size() << " backpointers\n"; + do { + std::ostringstream ostr; + 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 return; @@ -79,8 +85,12 @@ bool WRL1SWITCH::Read( WRLPROC& proc, WRL1BASE* aTopNode ) if( NULL == aTopNode ) { #ifdef DEBUG_VRML1 - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] aTopNode is NULL\n"; + do { + 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 return false; @@ -94,9 +104,13 @@ bool WRL1SWITCH::Read( WRLPROC& proc, WRL1BASE* aTopNode ) if( proc.eof() ) { #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad file format; unexpected eof at line "; - std::cerr << line << ", column " << column << "\n"; + do { + std::ostringstream ostr; + 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 return false; @@ -105,10 +119,14 @@ bool WRL1SWITCH::Read( WRLPROC& proc, WRL1BASE* aTopNode ) if( '{' != tok ) { #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) - std::cerr << proc.GetError() << "\n"; - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad file format; expecting '{' but got '" << tok; - std::cerr << "' at line " << line << ", column " << column << "\n"; + do { + std::ostringstream ostr; + ostr << proc.GetError() << "\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 return false; @@ -131,8 +149,12 @@ bool WRL1SWITCH::Read( WRLPROC& proc, WRL1BASE* aTopNode ) if( !proc.ReadName( glob ) ) { #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << proc.GetError() << "\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << proc.GetError(); + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -143,11 +165,15 @@ bool WRL1SWITCH::Read( WRLPROC& proc, WRL1BASE* aTopNode ) if( !proc.ReadSFInt( whichChild ) ) { #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] invalid whichChild at line " << line << ", column "; - std::cerr << column << "\n"; - std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; - std::cerr << " * [INFO] message: '" << proc.GetError() << "'\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] invalid whichChild at line " << line << ", column "; + 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 return false; @@ -157,10 +183,14 @@ bool WRL1SWITCH::Read( WRLPROC& proc, WRL1BASE* aTopNode ) } #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] invalid Switch at line " << line << ", column "; - std::cerr << column << " (expected 'whichChild')\n"; - std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\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 return false; @@ -171,9 +201,13 @@ bool WRL1SWITCH::Read( WRLPROC& proc, WRL1BASE* aTopNode ) if( !aTopNode->ReadNode( proc, this, NULL ) ) { #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad file format; unexpected eof at line "; - std::cerr << line << ", column " << column << "\n"; + do { + std::ostringstream ostr; + 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 return false; @@ -191,10 +225,14 @@ bool WRL1SWITCH::Read( WRLPROC& proc, WRL1BASE* aTopNode ) SGNODE* WRL1SWITCH::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp ) { #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 ) - std::cerr << " * [INFO] Translating Switch with " << m_Children.size(); - std::cerr << " children, " << m_Refs.size() << " references and "; - std::cerr << m_BackPointers.size() << " backpointers (total "; - std::cerr << m_Items.size() << " items)\n"; + do { + std::ostringstream ostr; + ostr << " * [INFO] Translating Switch with " << m_Children.size(); + 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 if( m_Items.empty() ) diff --git a/plugins/3d/vrml/v1/vrml1_transform.cpp b/plugins/3d/vrml/v1/vrml1_transform.cpp index 4d6258fb10..629b0ff450 100644 --- a/plugins/3d/vrml/v1/vrml1_transform.cpp +++ b/plugins/3d/vrml/v1/vrml1_transform.cpp @@ -22,6 +22,8 @@ */ #include +#include +#include #include "vrml1_base.h" #include "vrml1_transform.h" @@ -51,9 +53,13 @@ WRL1TRANSFORM::WRL1TRANSFORM( NAMEREGISTER* aDictionary, WRL1NODE* aParent ) : WRL1TRANSFORM::~WRL1TRANSFORM() { #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 ) - std::cerr << " * [INFO] Destroying Transform with " << m_Children.size(); - std::cerr << " children, " << m_Refs.size() << " references and "; - std::cerr << m_BackPointers.size() << " backpointers\n"; + do { + std::ostringstream ostr; + 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 return; @@ -77,8 +83,12 @@ bool WRL1TRANSFORM::Read( WRLPROC& proc, WRL1BASE* aTopNode ) if( NULL == aTopNode ) { #ifdef DEBUG_VRML1 - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] aTopNode is NULL\n"; + do { + 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 return false; @@ -109,9 +119,13 @@ bool WRL1TRANSFORM::Read( WRLPROC& proc, WRL1BASE* aTopNode ) if( proc.eof() ) { #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad file format; unexpected eof at line "; - std::cerr << line << ", column " << column << "\n"; + do { + std::ostringstream ostr; + 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 return false; @@ -120,10 +134,14 @@ bool WRL1TRANSFORM::Read( WRLPROC& proc, WRL1BASE* aTopNode ) if( '{' != tok ) { #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) - std::cerr << proc.GetError() << "\n"; - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad file format; expecting '{' but got '" << tok; - std::cerr << "' at line " << line << ", column " << column << "\n"; + do { + std::ostringstream ostr; + ostr << proc.GetError() << "\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 return false; @@ -143,8 +161,12 @@ bool WRL1TRANSFORM::Read( WRLPROC& proc, WRL1BASE* aTopNode ) if( !proc.ReadName( glob ) ) { #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << proc.GetError() << "\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << proc.GetError(); + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); + } while( 0 ); #endif return false; @@ -164,11 +186,15 @@ bool WRL1TRANSFORM::Read( WRLPROC& proc, WRL1BASE* aTopNode ) if( !proc.ReadSFVec3f( center ) ) { #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] invalid center at line " << line << ", column "; - std::cerr << column << "\n"; - std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; - std::cerr << " * [INFO] message: '" << proc.GetError() << "'\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] invalid center at line " << line << ", column "; + 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 return false; @@ -184,11 +210,15 @@ bool WRL1TRANSFORM::Read( WRLPROC& proc, WRL1BASE* aTopNode ) if( !proc.ReadSFRotation( rotation ) ) { #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] invalid rotation at line " << line << ", column "; - std::cerr << column << "\n"; - std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; - std::cerr << " * [INFO] message: '" << proc.GetError() << "'\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] invalid rotation at line " << line << ", column "; + 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 return false; @@ -199,11 +229,15 @@ bool WRL1TRANSFORM::Read( WRLPROC& proc, WRL1BASE* aTopNode ) if( !proc.ReadSFVec3f( scale ) ) { #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] invalid scale at line " << line << ", column "; - std::cerr << column << "\n"; - std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; - std::cerr << " * [INFO] message: '" << proc.GetError() << "'\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] invalid scale at line " << line << ", column "; + 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 return false; @@ -214,11 +248,15 @@ bool WRL1TRANSFORM::Read( WRLPROC& proc, WRL1BASE* aTopNode ) if( !proc.ReadSFRotation( scaleOrientation ) ) { #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] invalid scaleOrientation at line " << line << ", column "; - std::cerr << column << "\n"; - std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; - std::cerr << " * [INFO] message: '" << proc.GetError() << "'\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] invalid scaleOrientation at line " << line << ", column "; + 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 return false; @@ -229,11 +267,15 @@ bool WRL1TRANSFORM::Read( WRLPROC& proc, WRL1BASE* aTopNode ) if( !proc.ReadSFVec3f( translation ) ) { #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] invalid translation at line " << line << ", column "; - std::cerr << column << "\n"; - std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; - std::cerr << " * [INFO] message: '" << proc.GetError() << "'\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [INFO] invalid translation at line " << line << ", column "; + 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 return false; @@ -247,10 +289,14 @@ bool WRL1TRANSFORM::Read( WRLPROC& proc, WRL1BASE* aTopNode ) else { #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 ) - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [INFO] bad Transform at line " << line << ", column "; - std::cerr << column << "\n"; - std::cerr << " * [INFO] file: '" << proc.GetFileName() << "'\n"; + do { + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\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 return false; @@ -266,8 +312,12 @@ bool WRL1TRANSFORM::AddRefNode( WRL1NODE* aNode ) // this node may not own or reference any other node #ifdef DEBUG_VRML1 - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] AddRefNode is not applicable\n"; + do { + 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 return false; @@ -279,8 +329,12 @@ bool WRL1TRANSFORM::AddChildNode( WRL1NODE* aNode ) // this node may not own or reference any other node #ifdef DEBUG_VRML1 - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] AddChildNode is not applicable\n"; + do { + 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 return false; @@ -298,7 +352,7 @@ SGNODE* WRL1TRANSFORM::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp ) if( NULL == sp ) { #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 return NULL; diff --git a/plugins/3d/vrml/vrml.cpp b/plugins/3d/vrml/vrml.cpp index 4f2f009e89..9769095cfd 100644 --- a/plugins/3d/vrml/vrml.cpp +++ b/plugins/3d/vrml/vrml.cpp @@ -32,11 +32,7 @@ */ #include -#include -#include -#include -#include -#include +#include #include #include "richio.h" #include "plugins/3d/3d_plugin.h" @@ -188,9 +184,7 @@ SCENEGRAPH* LoadVRML( const wxString& aFileName, bool useInline ) } catch( IO_ERROR &e ) { - #ifdef DEBUG - std::cerr << " * [INFO] load failed: input line too long\n"; - #endif + wxLogError( _( " * [INFO] load failed: input line too long\n" ) ); return NULL; } @@ -200,9 +194,7 @@ SCENEGRAPH* LoadVRML( const wxString& aFileName, bool useInline ) if( proc.GetVRMLType() == VRML_V1 ) { - #ifdef DEBUG - std::cerr << " * [INFO] Processing VRML 1.0 file\n"; - #endif + wxLogTrace( MASK_VRML, " * [INFO] Processing VRML 1.0 file\n" ); WRL1BASE* bp = new WRL1BASE; @@ -211,15 +203,11 @@ SCENEGRAPH* LoadVRML( const wxString& aFileName, bool useInline ) if( !bp->Read( proc ) ) { - #ifdef DEBUG - std::cerr << " * [INFO] load failed\n"; - #endif + wxLogTrace( MASK_VRML, " * [INFO] load failed\n" ); } else { - #ifdef DEBUG - std::cerr << " * [INFO] load completed\n"; - #endif + wxLogTrace( MASK_VRML, " * [INFO] load completed\n" ); scene = (SCENEGRAPH*)bp->TranslateToSG( NULL, NULL ); } @@ -228,9 +216,7 @@ SCENEGRAPH* LoadVRML( const wxString& aFileName, bool useInline ) } else { - #ifdef DEBUG - std::cerr << " * [INFO] Processing VRML 2.0 file\n"; - #endif + wxLogTrace( MASK_VRML, " * [INFO] Processing VRML 2.0 file\n" ); WRL2BASE* bp = new WRL2BASE; @@ -239,15 +225,11 @@ SCENEGRAPH* LoadVRML( const wxString& aFileName, bool useInline ) if( !bp->Read( proc ) ) { - #ifdef DEBUG - std::cerr << " * [INFO] load failed\n"; - #endif + wxLogTrace( MASK_VRML, " * [INFO] load failed\n" ); } else { - #ifdef DEBUG - std::cerr << " * [INFO] load completed\n"; - #endif + wxLogTrace( MASK_VRML, " * [INFO] load completed\n" ); // for now we recalculate all normals per-vertex per-face scene = (SCENEGRAPH*)bp->TranslateToSG( NULL ); diff --git a/plugins/3d/vrml/wrlproc.cpp b/plugins/3d/vrml/wrlproc.cpp index 54afce3ca1..38130ae854 100644 --- a/plugins/3d/vrml/wrlproc.cpp +++ b/plugins/3d/vrml/wrlproc.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include "wrlproc.h" #define GETLINE do {\ @@ -374,9 +375,7 @@ bool WRLPROC::DiscardNode( void ) ostr << ", column " << m_bufpos; m_error = ostr.str(); - #ifdef DEBUG - std::cerr << m_error << "\n"; - #endif + wxLogTrace( MASK_VRML, "%s\n", m_error.c_str() ); return false; } diff --git a/plugins/3d/vrml/wrltypes.h b/plugins/3d/vrml/wrltypes.h index 19bd2c637c..30670a3c49 100644 --- a/plugins/3d/vrml/wrltypes.h +++ b/plugins/3d/vrml/wrltypes.h @@ -33,6 +33,9 @@ #define GLM_FORCE_RADIANS #include +// log mask for wxLogTrace +#define MASK_VRML "PLUGIN_VRML" + // version of the VRML file being parsed enum WRLVERSION { diff --git a/plugins/3d/vrml/x3d/x3d_appearance.cpp b/plugins/3d/vrml/x3d/x3d_appearance.cpp index 3cc8536473..f8d6453f7d 100644 --- a/plugins/3d/vrml/x3d/x3d_appearance.cpp +++ b/plugins/3d/vrml/x3d/x3d_appearance.cpp @@ -23,6 +23,8 @@ #include +#include +#include #include #include "x3d_ops.h" #include "x3d_appearance.h" @@ -61,7 +63,7 @@ X3DAPP::X3DAPP( X3DNODE* aParent ) : X3DNODE() X3DAPP::~X3DAPP() { #if defined( DEBUG_X3D ) && ( DEBUG_X3D > 2 ) - std::cerr << " * [INFO] Destroying Appearance\n"; + wxLogTrace( MASK_VRML, " * [INFO] Destroying Appearance\n" ); #endif if( !m_MatName.empty() && m_Dict ) @@ -237,18 +239,24 @@ SGNODE* X3DAPP::TranslateToSG( SGNODE* aParent ) if( NULL != aParent && ptype != S3D::SGTYPE_SHAPE ) { #ifdef DEBUG_X3D - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] Appearance does not have a Shape parent (parent ID: "; - std::cerr << ptype << ")\n"; + std::ostringstream ostr; + ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; + ostr << " * [BUG] Appearance does not have a Shape parent (parent ID: "; + ostr << ptype << ")"; + wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() ); #endif return NULL; } #if defined( DEBUG_X3D ) && ( DEBUG_X3D > 2 ) - std::cerr << " * [INFO] Translating Appearance with " << m_Children.size(); - std::cerr << " children, " << m_Refs.size() << " references and "; - std::cerr << m_BackPointers.size() << " backpointers\n"; + do { + std::ostringstream ostr; + 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 if( m_sgNode ) diff --git a/plugins/3d/vrml/x3d/x3d_base.cpp b/plugins/3d/vrml/x3d/x3d_base.cpp index cfb9ac5bc1..192efd023f 100644 --- a/plugins/3d/vrml/x3d/x3d_base.cpp +++ b/plugins/3d/vrml/x3d/x3d_base.cpp @@ -23,9 +23,12 @@ #include +#include #include #include +#include #include "x3d_base.h" +#include "wrltypes.h" bool X3D_DICT::AddName( const wxString& aName, X3DNODE* aNode ) @@ -169,8 +172,10 @@ void X3DNODE::delNodeRef( X3DNODE* aNode ) } #ifdef DEBUG_X3D - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - 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() ); #endif return; diff --git a/plugins/3d/vrml/x3d/x3d_coords.cpp b/plugins/3d/vrml/x3d/x3d_coords.cpp index 5737305233..51fe3ba0ae 100644 --- a/plugins/3d/vrml/x3d/x3d_coords.cpp +++ b/plugins/3d/vrml/x3d/x3d_coords.cpp @@ -25,6 +25,7 @@ #include #include #include +#include #include "x3d_ops.h" #include "x3d_coords.h" @@ -59,7 +60,7 @@ X3DCOORDS::X3DCOORDS( X3DNODE* aParent ) : X3DNODE() X3DCOORDS::~X3DCOORDS() { #if defined( DEBUG_X3D ) && ( DEBUG_X3D > 2 ) - std::cerr << " * [INFO] Destroying Coordinate\n"; + wxLogTrace( MASK_VRML, " * [INFO] Destroying Coordinate\n" ); #endif return; } diff --git a/plugins/3d/vrml/x3d/x3d_ifaceset.cpp b/plugins/3d/vrml/x3d/x3d_ifaceset.cpp index 8e10371ea2..051b961805 100644 --- a/plugins/3d/vrml/x3d/x3d_ifaceset.cpp +++ b/plugins/3d/vrml/x3d/x3d_ifaceset.cpp @@ -23,7 +23,9 @@ #include +#include #include +#include #include #include #include "x3d_ops.h" @@ -67,7 +69,7 @@ X3DIFACESET::X3DIFACESET( X3DNODE* aParent ) : X3DNODE() X3DIFACESET::~X3DIFACESET() { #if defined( DEBUG_X3D ) && ( DEBUG_X3D > 2 ) - std::cerr << " * [INFO] Destroying IndexedFaceSet\n"; + wxLogTrace( MASK_VRML, " * [INFO] Destroying IndexedFaceSet\n" ); #endif return; @@ -241,19 +243,27 @@ SGNODE* X3DIFACESET::TranslateToSG( SGNODE* aParent ) if( NULL != aParent && ptype != S3D::SGTYPE_SHAPE ) { #ifdef DEBUG_X3D - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] IndexedFaceSet does not have a Shape parent (parent ID: "; - std::cerr << ptype << ")\n"; + do { + std::ostringstream ostr; + 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 return NULL; } #if defined( DEBUG_X3D ) && ( DEBUG_X3D > 2 ) - std::cerr << " * [INFO] Translating IndexedFaceSet with " << m_Children.size(); - std::cerr << " children, " << m_Refs.size() << " references, "; - std::cerr << m_BackPointers.size() << " backpointers and "; - std::cerr << coordIndex.size() << " coord indices\n"; + do { + std::ostringstream ostr; + ostr << " * [INFO] Translating IndexedFaceSet with " << m_Children.size(); + 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 if( m_sgNode ) diff --git a/plugins/3d/vrml/x3d/x3d_ops.cpp b/plugins/3d/vrml/x3d/x3d_ops.cpp index 308feaaa93..4ce5c8c265 100644 --- a/plugins/3d/vrml/x3d/x3d_ops.cpp +++ b/plugins/3d/vrml/x3d/x3d_ops.cpp @@ -23,13 +23,10 @@ #include #include -#include #include "x3d_appearance.h" #include "x3d_coords.h" -#include "x3d_ifaceset.h" #include "x3d_ops.h" -#include "x3d_shape.h" #include "x3d_transform.h" diff --git a/plugins/3d/vrml/x3d/x3d_shape.cpp b/plugins/3d/vrml/x3d/x3d_shape.cpp index 6aa9ffa3df..e71c7f4b4e 100644 --- a/plugins/3d/vrml/x3d/x3d_shape.cpp +++ b/plugins/3d/vrml/x3d/x3d_shape.cpp @@ -23,7 +23,9 @@ #include +#include #include +#include #include "x3d_ops.h" #include "x3d_shape.h" #include "plugins/3dapi/ifsg_all.h" @@ -63,9 +65,13 @@ X3DSHAPE::X3DSHAPE( X3DNODE* aParent ) : X3DNODE() X3DSHAPE::~X3DSHAPE() { #if defined( DEBUG_X3D ) && ( DEBUG_X3D > 2 ) - std::cerr << " * [INFO] Destroying Shape with " << m_Children.size(); - std::cerr << " children, " << m_Refs.size() << " references and "; - std::cerr << m_BackPointers.size() << " backpointers\n"; + do { + std::ostringstream ostr; + 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 return; @@ -247,9 +253,13 @@ SGNODE* X3DSHAPE::TranslateToSG( SGNODE* aParent ) return NULL; #if defined( DEBUG_X3D ) && ( DEBUG_X3D > 2 ) - std::cerr << " * [INFO] Translating Shape with " << m_Children.size(); - std::cerr << " children, " << m_Refs.size() << " references and "; - std::cerr << m_BackPointers.size() << " backpointers\n"; + do { + std::ostringstream ostr; + 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 S3D::SGTYPES ptype = S3D::GetSGNodeType( aParent ); @@ -257,9 +267,13 @@ SGNODE* X3DSHAPE::TranslateToSG( SGNODE* aParent ) if( NULL != aParent && ptype != S3D::SGTYPE_TRANSFORM ) { #ifdef DEBUG_X3D - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] Shape does not have a Transform parent (parent ID: "; - std::cerr << ptype << ")\n"; + do { + std::ostringstream ostr; + 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 return NULL; diff --git a/plugins/3d/vrml/x3d/x3d_transform.cpp b/plugins/3d/vrml/x3d/x3d_transform.cpp index 91e7fa2204..2108349586 100644 --- a/plugins/3d/vrml/x3d/x3d_transform.cpp +++ b/plugins/3d/vrml/x3d/x3d_transform.cpp @@ -23,7 +23,9 @@ #include +#include #include +#include #include "x3d_ops.h" #include "x3d_transform.h" #include "plugins/3dapi/ifsg_all.h" @@ -60,9 +62,13 @@ X3DTRANSFORM::X3DTRANSFORM( X3DNODE* aParent ) : X3DNODE() X3DTRANSFORM::~X3DTRANSFORM() { #if defined( DEBUG_X3D ) && ( DEBUG_X3D > 2 ) - std::cerr << " * [INFO] Destroying Transform with " << m_Children.size(); - std::cerr << " children, " << m_Refs.size() << " references and "; - std::cerr << m_BackPointers.size() << " backpointers\n"; + do { + std::ostringstream ostr; + 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 return; @@ -265,9 +271,13 @@ bool X3DTRANSFORM::AddRefNode( X3DNODE* aNode ) SGNODE* X3DTRANSFORM::TranslateToSG( SGNODE* aParent ) { #if defined( DEBUG_X3D ) && ( DEBUG_X3D > 2 ) - std::cerr << " * [INFO] Translating Transform with " << m_Children.size(); - std::cerr << " children, " << m_Refs.size() << " references and "; - std::cerr << m_BackPointers.size() << " backpointers\n"; + do { + std::ostringstream ostr; + 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 if( m_Children.empty() && m_Refs.empty() ) @@ -277,10 +287,14 @@ SGNODE* X3DTRANSFORM::TranslateToSG( SGNODE* aParent ) if( NULL != aParent && ptype != S3D::SGTYPE_TRANSFORM ) { - #ifdef DEBUG_VRML2 - std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - std::cerr << " * [BUG] Transform does not have a Transform parent (parent ID: "; - std::cerr << ptype << ")\n"; + #ifdef DEBUG_X3D + do { + std::ostringstream ostr; + 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 return NULL;