Switched SG* classes and plugin loader logging code from stderr to wxLogTrace

This commit is contained in:
Cirilo Bernardo 2016-02-23 17:46:22 +11:00
parent d051a8f47e
commit 9195451e12
16 changed files with 896 additions and 515 deletions

View File

@ -316,7 +316,7 @@ PANEL_PREV_3D::~PANEL_PREV_3D()
void PANEL_PREV_3D::View3DISO( wxCommandEvent& event )
{
// XXX - TO BE IMPLEMENTED
std::cout << "Switch to Isometric View\n";
// std::cout << "Switch to Isometric View\n";
return;
}
@ -324,7 +324,7 @@ void PANEL_PREV_3D::View3DISO( wxCommandEvent& event )
void PANEL_PREV_3D::View3DUpdate( wxCommandEvent& event )
{
// XXX - TO BE IMPLEMENTED
std::cout << "Update 3D View\n";
// std::cout << "Update 3D View\n";
// update the model filename if appropriate
if( NULL != m_FileTree )
@ -340,7 +340,7 @@ void PANEL_PREV_3D::View3DUpdate( wxCommandEvent& event )
void PANEL_PREV_3D::View3DLeft( wxCommandEvent& event )
{
// XXX - TO BE IMPLEMENTED
std::cout << "Switch to Left View\n";
// std::cout << "Switch to Left View\n";
return;
}
@ -348,7 +348,7 @@ void PANEL_PREV_3D::View3DLeft( wxCommandEvent& event )
void PANEL_PREV_3D::View3DRight( wxCommandEvent& event )
{
// XXX - TO BE IMPLEMENTED
std::cout << "Switch to Right View\n";
// std::cout << "Switch to Right View\n";
return;
}
@ -356,7 +356,7 @@ void PANEL_PREV_3D::View3DRight( wxCommandEvent& event )
void PANEL_PREV_3D::View3DFront( wxCommandEvent& event )
{
// XXX - TO BE IMPLEMENTED
std::cout << "Switch to Front View\n";
// std::cout << "Switch to Front View\n";
return;
}
@ -364,7 +364,7 @@ void PANEL_PREV_3D::View3DFront( wxCommandEvent& event )
void PANEL_PREV_3D::View3DBack( wxCommandEvent& event )
{
// XXX - TO BE IMPLEMENTED
std::cout << "Switch to Back View\n";
// std::cout << "Switch to Back View\n";
return;
}
@ -372,7 +372,7 @@ void PANEL_PREV_3D::View3DBack( wxCommandEvent& event )
void PANEL_PREV_3D::View3DTop( wxCommandEvent& event )
{
// XXX - TO BE IMPLEMENTED
std::cout << "Switch to Top View\n";
// std::cout << "Switch to Top View\n";
return;
}
@ -380,7 +380,7 @@ void PANEL_PREV_3D::View3DTop( wxCommandEvent& event )
void PANEL_PREV_3D::View3DBottom( wxCommandEvent& event )
{
// XXX - TO BE IMPLEMENTED
std::cout << "Switch to Bottom View\n";
// std::cout << "Switch to Bottom View\n";
return;
}
@ -459,36 +459,15 @@ void PANEL_PREV_3D::UpdateModelName( wxString const& aModelName )
wxString newModelFile;
newModelFile = m_resolver->ResolvePath( aModelName );
if( newModelFile.empty() )
{
#ifdef DEBUG
std::cout << "[3dv] Update Model: (no such file) " << aModelName.ToUTF8() << "\n";
#endif
}
else if( newModelFile.Cmp( currentModelFile ) )
{
if( !newModelFile.empty() && newModelFile.Cmp( currentModelFile ) )
newModel = true;
#ifdef DEBUG
std::cout << "[3dv] Update Model: " << newModelFile.ToUTF8() << "\n";
#endif
}
#ifdef DEBUG
else
{
std::cout << "[3dv] Update Model: [model unchanged]\n";
}
#endif
currentModelFile = newModelFile;
modelInfo.filename = currentModelFile;
}
if( currentModelFile.empty() || newModel )
{
#ifdef DEBUG
std::cout << "[3dv] Update Model: painting black\n";
#endif
if( NULL != canvas )
{
canvas->Clear3DModel();
@ -509,10 +488,6 @@ void PANEL_PREV_3D::UpdateModelName( wxString const& aModelName )
if( NULL == model )
{
#ifdef DEBUG
std::cout << "[3dv] Update Model: no model loaded\n";
#endif
if( NULL != canvas )
{
canvas->Refresh();
@ -522,24 +497,11 @@ void PANEL_PREV_3D::UpdateModelName( wxString const& aModelName )
return;
}
#ifdef DEBUG
std::cout << "[3dv] Update Model: loading preview\n";
#endif
if( NULL == canvas )
{
#ifdef DEBUG
std::cout << "[3dv] Update Model: creating canvas\n";
#endif
canvas = new C3D_MODEL_VIEWER( preview,
COGL_ATT_LIST::GetAttributesList( true ) );
#ifdef DEBUG
if( NULL == canvas )
std::cout << "[3dv] Update Model: canvas creation FAILED\n";
#endif
wxSizer* ws = new wxBoxSizer( wxHORIZONTAL );
canvas->Set3DModel( *model );
ws->Add( canvas, 1, wxEXPAND );

View File

@ -65,8 +65,8 @@ IFSG_SHAPE::IFSG_SHAPE( SGNODE* aParent )
#ifdef DEBUG
std::ostringstream ostr;
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << WrongParent;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << WrongParent;
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
@ -88,8 +88,8 @@ IFSG_SHAPE::IFSG_SHAPE( IFSG_NODE& aParent )
if( ! pp )
{
std::ostringstream ostr;
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << BadParent;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << BadParent;
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
}
#endif
@ -105,8 +105,8 @@ IFSG_SHAPE::IFSG_SHAPE( IFSG_NODE& aParent )
#ifdef DEBUG
std::ostringstream ostr;
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << WrongParent;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << WrongParent;
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
@ -153,10 +153,10 @@ bool IFSG_SHAPE::NewNode( SGNODE* aParent )
{
#ifdef DEBUG
std::ostringstream ostr;
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] invalid SGNODE parent (";
std::cerr << aParent->GetNodeTypeName( aParent->GetNodeType() );
std::cerr << ") to SGSHAPE";
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] invalid SGNODE parent (";
ostr << aParent->GetNodeTypeName( aParent->GetNodeType() );
ostr << ") to SGSHAPE";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
@ -179,8 +179,8 @@ bool IFSG_SHAPE::NewNode( IFSG_NODE& aParent )
{
#ifdef DEBUG
std::ostringstream ostr;
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << BadParent;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << BadParent;
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif

View File

@ -24,9 +24,11 @@
#define GLM_FORCE_RADIANS
#include <iostream>
#include <sstream>
#include <glm/gtx/transform.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/type_ptr.hpp>
#include <wx/log.h>
#include "3d_cache/sg/scenegraph.h"
#include "3d_cache/sg/sg_shape.h"
@ -48,9 +50,11 @@ SCENEGRAPH::SCENEGRAPH( SGNODE* aParent ) : SGNODE( aParent )
m_Parent = NULL;
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] inappropriate parent to SCENEGRAPH (type ";
std::cerr << aParent->GetNodeType() << ")\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] inappropriate parent to SCENEGRAPH (type ";
ostr << aParent->GetNodeType() << ")";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
}
else if( NULL != aParent && S3D::SGTYPE_TRANSFORM == aParent->GetNodeType() )
@ -134,8 +138,12 @@ void SCENEGRAPH::unlinkNode( const SGNODE* aNode, bool isChild )
UNLINK_NODE( S3D::SGTYPE_SHAPE, SGSHAPE, aNode, m_Shape, m_RShape, isChild );
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] unlinkNode() did not find its target\n";
do {
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] unlinkNode() did not find its target";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif
return;
@ -161,8 +169,10 @@ bool SCENEGRAPH::addNode( SGNODE* aNode, bool isChild )
if( NULL == aNode )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] NULL pointer passed for aNode\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] NULL pointer passed for aNode";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -172,9 +182,13 @@ bool SCENEGRAPH::addNode( SGNODE* aNode, bool isChild )
ADD_NODE( S3D::SGTYPE_SHAPE, SGSHAPE, aNode, m_Shape, m_RShape, isChild );
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] object '" << aNode->GetName();
std::cerr << "' is not a valid type for this object (" << aNode->GetNodeType() << ")\n";
do {
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] object '" << aNode->GetName();
ostr << "' is not a valid type for this object (" << aNode->GetNodeType() << ")";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif
return false;
@ -355,8 +369,10 @@ bool SCENEGRAPH::WriteCache( std::ofstream& aFile, SGNODE* parentNode )
if( parentNode != m_Parent )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] corrupt data; parentNode != m_aParent\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] corrupt data; parentNode != m_aParent";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -372,8 +388,10 @@ bool SCENEGRAPH::WriteCache( std::ofstream& aFile, SGNODE* parentNode )
if( aFile.fail() )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] bad stream\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] bad stream";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -406,8 +424,10 @@ bool SCENEGRAPH::WriteCache( std::ofstream& aFile, SGNODE* parentNode )
if( !m_Transforms[i]->WriteCache( aFile, this ) )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] bad stream while writing child transforms\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] bad stream while writing child transforms";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -426,8 +446,10 @@ bool SCENEGRAPH::WriteCache( std::ofstream& aFile, SGNODE* parentNode )
if( !m_Shape[i]->WriteCache( aFile, this ) )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] bad stream while writing child shapes\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] bad stream while writing child shapes";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -452,8 +474,10 @@ bool SCENEGRAPH::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
|| !m_Shape.empty() || !m_RShape.empty() )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] non-empty node\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] non-empty node";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -467,9 +491,11 @@ bool SCENEGRAPH::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
if( S3D::SGTYPE_TRANSFORM != S3D::ReadTag( aFile, name ) )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] corrupt data; tag mismatch at position ";
std::cerr << aFile.tellg() << "\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] corrupt data; tag mismatch at position ";
ostr << aFile.tellg();
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -505,9 +531,11 @@ bool SCENEGRAPH::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
if( S3D::SGTYPE_TRANSFORM != S3D::ReadTag( aFile, name ) )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] corrupt data; bad child transform tag at position ";
std::cerr << aFile.tellg() << "\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] corrupt data; bad child transform tag at position ";
ostr << aFile.tellg();
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -519,9 +547,11 @@ bool SCENEGRAPH::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
if( !sp->ReadCache( aFile, this ) )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] corrupt data while reading transform '";
std::cerr << name << "'\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] corrupt data while reading transform '";
ostr << name << "'";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -534,9 +564,11 @@ bool SCENEGRAPH::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
if( S3D::SGTYPE_TRANSFORM != S3D::ReadTag( aFile, name ) )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] corrupt data; bad ref transform tag at position ";
std::cerr << aFile.tellg() << "\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] corrupt data; bad ref transform tag at position ";
ostr << aFile.tellg();
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -547,9 +579,11 @@ bool SCENEGRAPH::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
if( !sp )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] corrupt data: cannot find ref transform '";
std::cerr << name << "'\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] corrupt data: cannot find ref transform '";
ostr << name << "'";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -558,9 +592,11 @@ bool SCENEGRAPH::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
if( S3D::SGTYPE_TRANSFORM != sp->GetNodeType() )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] corrupt data: type is not TRANSFORM '";
std::cerr << name << "'\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] corrupt data: type is not TRANSFORM '";
ostr << name << "'";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -575,9 +611,11 @@ bool SCENEGRAPH::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
if( S3D::SGTYPE_SHAPE != S3D::ReadTag( aFile, name ) )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] corrupt data; bad child shape tag at position ";
std::cerr << aFile.tellg() << "\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] corrupt data; bad child shape tag at position ";
ostr << aFile.tellg();
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -589,9 +627,11 @@ bool SCENEGRAPH::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
if( !sp->ReadCache( aFile, this ) )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] corrupt data while reading shape '";
std::cerr << name << "'\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] corrupt data while reading shape '";
ostr << name << "'";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -604,9 +644,11 @@ bool SCENEGRAPH::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
if( S3D::SGTYPE_SHAPE != S3D::ReadTag( aFile, name ) )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] corrupt data; bad ref shape tag at position ";
std::cerr << aFile.tellg() << "\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] corrupt data; bad ref shape tag at position ";
ostr << aFile.tellg();
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -617,9 +659,11 @@ bool SCENEGRAPH::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
if( !sp )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] corrupt data: cannot find ref shape '";
std::cerr << name << "'\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] corrupt data: cannot find ref shape '";
ostr << name << "'";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -628,9 +672,11 @@ bool SCENEGRAPH::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
if( S3D::SGTYPE_SHAPE != sp->GetNodeType() )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] corrupt data: type is not SGSHAPE '";
std::cerr << name << "'\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] corrupt data: type is not SGSHAPE '";
ostr << name << "'";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;

View File

@ -23,6 +23,8 @@
#include <iostream>
#include <utility>
#include <sstream>
#include <wx/log.h>
#include "3d_cache/sg/sg_appearance.h"
#include "3d_cache/sg/sg_helpers.h"
@ -42,9 +44,11 @@ SGAPPEARANCE::SGAPPEARANCE( SGNODE* aParent ) : SGNODE( aParent)
m_Parent = NULL;
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] inappropriate parent to SGAPPEARANCE (type ";
std::cerr << aParent->GetNodeType() << ")\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] inappropriate parent to SGAPPEARANCE (type ";
ostr << aParent->GetNodeType() << ")";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
}
else if( NULL != aParent && S3D::SGTYPE_SHAPE == aParent->GetNodeType() )
@ -103,8 +107,10 @@ bool SGAPPEARANCE::SetEmissive( const SGCOLOR* aRGBColor )
if( NULL == aRGBColor )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] NULL pointer passed for aRGBColor\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] NULL pointer passed for aRGBColor";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -131,8 +137,10 @@ bool SGAPPEARANCE::SetDiffuse( const SGCOLOR* aRGBColor )
if( NULL == aRGBColor )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] NULL pointer passed for aRGBColor\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] NULL pointer passed for aRGBColor";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -159,8 +167,10 @@ bool SGAPPEARANCE::SetSpecular( const SGCOLOR* aRGBColor )
if( NULL == aRGBColor )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] NULL pointer passed for aRGBColor\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] NULL pointer passed for aRGBColor";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -186,8 +196,10 @@ bool SGAPPEARANCE::SetAmbient( const SGCOLOR* aRGBColor )
if( NULL == aRGBColor )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] NULL pointer passed for aRGBColor\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] NULL pointer passed for aRGBColor";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -218,8 +230,10 @@ SGNODE* SGAPPEARANCE::FindNode(const char *aNodeName, const SGNODE *aCaller)
void SGAPPEARANCE::unlinkChildNode( const SGNODE* aCaller )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] unexpected code branch; node should have no children or refs\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] unexpected code branch; node should have no children or refs";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return;
@ -229,8 +243,10 @@ void SGAPPEARANCE::unlinkChildNode( const SGNODE* aCaller )
void SGAPPEARANCE::unlinkRefNode( const SGNODE* aCaller )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] unexpected code branch; node should have no children or refs\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] unexpected code branch; node should have no children or refs";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return;
@ -240,8 +256,10 @@ void SGAPPEARANCE::unlinkRefNode( const SGNODE* aCaller )
bool SGAPPEARANCE::AddRefNode( SGNODE* aNode )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] this node does not accept children or refs\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] this node does not accept children or refs";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -251,8 +269,10 @@ bool SGAPPEARANCE::AddRefNode( SGNODE* aNode )
bool SGAPPEARANCE::AddChildNode( SGNODE* aNode )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] this node does not accept children or refs\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] this node does not accept children or refs";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -353,8 +373,10 @@ bool SGAPPEARANCE::WriteCache( std::ofstream& aFile, SGNODE* parentNode )
if( NULL == m_Parent )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] corrupt data; m_aParent is NULL\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] corrupt data; m_aParent is NULL";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -371,8 +393,10 @@ bool SGAPPEARANCE::WriteCache( std::ofstream& aFile, SGNODE* parentNode )
if( parentNode != m_Parent )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] corrupt data; parentNode != m_aParent\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] corrupt data; parentNode != m_aParent";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -381,8 +405,10 @@ bool SGAPPEARANCE::WriteCache( std::ofstream& aFile, SGNODE* parentNode )
if( !aFile.good() )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] bad stream\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] bad stream";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;

View File

@ -22,8 +22,11 @@
*/
#include <iostream>
#include <cmath>
#include <iostream>
#include <sstream>
#include <wx/log.h>
#include "plugins/3dapi/sg_base.h"
@ -41,8 +44,10 @@ SGCOLOR::SGCOLOR( float aRVal, float aGVal, float aBVal )
if( !checkRange( aRVal, aGVal, aBVal ) )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] invalid value passed to constructor\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] invalid value passed to constructor";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
red = 0.0;
green = 0.0;
@ -80,8 +85,10 @@ void SGCOLOR::GetColor( SGCOLOR* aColor ) const
if( NULL == aColor )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] NULL pointer passed for aColor\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] NULL pointer passed for aColor";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return;
@ -121,8 +128,10 @@ bool SGCOLOR::SetColor( const SGCOLOR* aColor )
if( NULL == aColor )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] NULL pointer passed for aColor\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] NULL pointer passed for aColor";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -142,8 +151,10 @@ bool SGCOLOR::checkRange( float aRedVal, float aGreenVal, float aBlueVal ) const
if( aRedVal < 0.0 || aRedVal > 1.0 )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] invalid RED value: " << aRedVal << "\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] invalid RED value: " << aRedVal;
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
ok = false;
}
@ -153,9 +164,9 @@ bool SGCOLOR::checkRange( float aRedVal, float aGreenVal, float aBlueVal ) const
#ifdef DEBUG
if( ok )
{
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
wxLogTrace( MASK_3D_SG, "%s:%s:%d\n", __FILE__, __FUNCTION__, __LINE__ );
}
std::cerr << " * [BUG] invalid GREEN value: " << aGreenVal << "\n";
wxLogTrace( MASK_3D_SG, " * [BUG] invalid GREEN value: %f\n", aGreenVal );
#endif
ok = false;
}
@ -165,9 +176,9 @@ bool SGCOLOR::checkRange( float aRedVal, float aGreenVal, float aBlueVal ) const
#ifdef DEBUG
if( ok )
{
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
wxLogTrace( MASK_3D_SG, "%s:%s:%d\n", __FILE__, __FUNCTION__, __LINE__ );
}
std::cerr << " * [BUG] invalid BLUE value: " << aBlueVal << "\n";
wxLogTrace( MASK_3D_SG, " * [BUG] invalid BLUE value: %f\n", aBlueVal );
#endif
ok = false;
}
@ -216,8 +227,10 @@ void SGPOINT::GetPoint( SGPOINT* aPoint )
if( NULL == aPoint )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] NULL pointer passed for aPoint\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] NULL pointer passed for aPoint";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return;

View File

@ -22,6 +22,9 @@
*/
#include <iostream>
#include <sstream>
#include <wx/log.h>
#include "3d_cache/sg/sg_colors.h"
#include "3d_cache/sg/sg_helpers.h"
@ -34,9 +37,11 @@ SGCOLORS::SGCOLORS( SGNODE* aParent ) : SGNODE( aParent )
m_Parent = NULL;
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] inappropriate parent to SGCOLORS (type ";
std::cerr << aParent->GetNodeType() << ")\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] inappropriate parent to SGCOLORS (type ";
ostr << aParent->GetNodeType() << ")";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
}
else if( NULL != aParent && S3D::SGTYPE_FACESET == aParent->GetNodeType() )
@ -100,8 +105,10 @@ SGNODE* SGCOLORS::FindNode(const char *aNodeName, const SGNODE *aCaller)
void SGCOLORS::unlinkChildNode( const SGNODE* aCaller )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] unexpected code branch; node should have no children or refs\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] unexpected code branch; node should have no children or refs";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return;
@ -111,8 +118,10 @@ void SGCOLORS::unlinkChildNode( const SGNODE* aCaller )
void SGCOLORS::unlinkRefNode( const SGNODE* aCaller )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] unexpected code branch; node should have no children or refs\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] unexpected code branch; node should have no children or refs";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return;
@ -122,8 +131,10 @@ void SGCOLORS::unlinkRefNode( const SGNODE* aCaller )
bool SGCOLORS::AddRefNode( SGNODE* aNode )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] this node does not accept children or refs\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] this node does not accept children or refs";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -133,8 +144,10 @@ bool SGCOLORS::AddRefNode( SGNODE* aNode )
bool SGCOLORS::AddChildNode( SGNODE* aNode )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] this node does not accept children or refs\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] this node does not accept children or refs";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -259,8 +272,10 @@ bool SGCOLORS::WriteCache( std::ofstream& aFile, SGNODE* parentNode )
if( NULL == m_Parent )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] corrupt data; m_aParent is NULL\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] corrupt data; m_aParent is NULL";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -277,8 +292,10 @@ bool SGCOLORS::WriteCache( std::ofstream& aFile, SGNODE* parentNode )
if( parentNode != m_Parent )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] corrupt data; parentNode != m_aParent\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] corrupt data; parentNode != m_aParent";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -287,8 +304,10 @@ bool SGCOLORS::WriteCache( std::ofstream& aFile, SGNODE* parentNode )
if( !aFile.good() )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] bad stream\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] bad stream";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -313,8 +332,10 @@ bool SGCOLORS::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
if( !colors.empty() )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] non-empty node\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] non-empty node";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;

View File

@ -22,6 +22,9 @@
*/
#include <iostream>
#include <sstream>
#include <wx/log.h>
#include "3d_cache/sg/sg_coords.h"
#include "3d_cache/sg/sg_helpers.h"
#include "3d_cache/sg/sg_normals.h"
@ -37,9 +40,11 @@ SGCOORDS::SGCOORDS( SGNODE* aParent ) : SGNODE( aParent )
m_Parent = NULL;
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] inappropriate parent to SGCOORDS (type ";
std::cerr << aParent->GetNodeType() << ")\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] inappropriate parent to SGCOORDS (type ";
ostr << aParent->GetNodeType() << ")";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
}
else if( NULL != aParent && S3D::SGTYPE_FACESET == aParent->GetNodeType() )
@ -103,8 +108,10 @@ SGNODE* SGCOORDS::FindNode(const char *aNodeName, const SGNODE *aCaller)
void SGCOORDS::unlinkChildNode( const SGNODE* aCaller )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] unexpected code branch; node should have no children or refs\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] unexpected code branch; node should have no children or refs";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return;
@ -114,8 +121,10 @@ void SGCOORDS::unlinkChildNode( const SGNODE* aCaller )
void SGCOORDS::unlinkRefNode( const SGNODE* aCaller )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] unexpected code branch; node should have no children or refs\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] unexpected code branch; node should have no children or refs";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return;
@ -125,8 +134,10 @@ void SGCOORDS::unlinkRefNode( const SGNODE* aCaller )
bool SGCOORDS::AddRefNode( SGNODE* aNode )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] this node does not accept children or refs\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] this node does not accept children or refs";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -136,8 +147,10 @@ bool SGCOORDS::AddRefNode( SGNODE* aNode )
bool SGCOORDS::AddChildNode( SGNODE* aNode )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] this node does not accept children or refs\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] this node does not accept children or refs";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -266,8 +279,10 @@ bool SGCOORDS::WriteCache( std::ofstream& aFile, SGNODE* parentNode )
if( NULL == m_Parent )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] corrupt data; m_aParent is NULL\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] corrupt data; m_aParent is NULL";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -284,8 +299,10 @@ bool SGCOORDS::WriteCache( std::ofstream& aFile, SGNODE* parentNode )
if( parentNode != m_Parent )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] corrupt data; parentNode != m_aParent\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] corrupt data; parentNode != m_aParent";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -294,8 +311,10 @@ bool SGCOORDS::WriteCache( std::ofstream& aFile, SGNODE* parentNode )
if( !aFile.good() )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] bad stream\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] bad stream";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -320,8 +339,10 @@ bool SGCOORDS::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
if( !coords.empty() )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] non-empty node\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] non-empty node";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;

View File

@ -23,6 +23,9 @@
#include <iostream>
#include <sstream>
#include <wx/log.h>
#include "3d_cache/sg/sg_faceset.h"
#include "3d_cache/sg/sg_colors.h"
#include "3d_cache/sg/sg_coords.h"
@ -48,9 +51,11 @@ SGFACESET::SGFACESET( SGNODE* aParent ) : SGNODE( aParent )
m_Parent = NULL;
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] inappropriate parent to SGFACESET (type ";
std::cerr << aParent->GetNodeType() << ")\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] inappropriate parent to SGFACESET (type ";
ostr << aParent->GetNodeType() << ")";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
}
else if( NULL != aParent && S3D::SGTYPE_SHAPE == aParent->GetNodeType() )
@ -252,8 +257,12 @@ void SGFACESET::unlinkNode( const SGNODE* aNode, bool isChild )
}
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] unlinkNode() did not find its target\n";
do {
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] unlinkNode() did not find its target";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif
return;
@ -280,8 +289,10 @@ bool SGFACESET::addNode( SGNODE* aNode, bool isChild )
if( NULL == aNode )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] NULL pointer passed for aNode\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] NULL pointer passed for aNode";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -297,8 +308,10 @@ bool SGFACESET::addNode( SGNODE* aNode, bool isChild )
if( aNode != m_Colors && aNode != m_RColors )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] assigning multiple Colors nodes\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] assigning multiple Colors nodes";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -328,8 +341,10 @@ bool SGFACESET::addNode( SGNODE* aNode, bool isChild )
if( aNode != m_Coords && aNode != m_RCoords )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] assigning multiple Coords nodes\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] assigning multiple Coords nodes";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -359,8 +374,10 @@ bool SGFACESET::addNode( SGNODE* aNode, bool isChild )
if( aNode != m_Normals && aNode != m_RNormals )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] assigning multiple Normals nodes\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] assigning multiple Normals nodes";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -390,8 +407,10 @@ bool SGFACESET::addNode( SGNODE* aNode, bool isChild )
if( aNode != m_CoordIndices )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] assigning multiple CoordIndex nodes\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] assigning multiple CoordIndex nodes";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -407,10 +426,14 @@ bool SGFACESET::addNode( SGNODE* aNode, bool isChild )
}
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] object '" << aNode->GetName();
std::cerr << "' (type " << aNode->GetNodeType();
std::cerr << ") is not a valid type for this object (" << aNode->GetNodeType() << ")\n";
do {
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] object '" << aNode->GetName();
ostr << "' (type " << aNode->GetNodeType();
ostr << ") is not a valid type for this object (" << aNode->GetNodeType() << ")";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif
return false;
@ -521,8 +544,10 @@ bool SGFACESET::WriteCache( std::ofstream& aFile, SGNODE* parentNode )
if( NULL == m_Parent )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] corrupt data; m_aParent is NULL\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] corrupt data; m_aParent is NULL";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -539,8 +564,10 @@ bool SGFACESET::WriteCache( std::ofstream& aFile, SGNODE* parentNode )
if( parentNode != m_Parent )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] corrupt data; parentNode != m_aParent\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] corrupt data; parentNode != m_aParent";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -549,8 +576,10 @@ bool SGFACESET::WriteCache( std::ofstream& aFile, SGNODE* parentNode )
if( !aFile.good() )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] bad stream\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] bad stream";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -630,8 +659,10 @@ bool SGFACESET::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
|| m_Normals || m_RNormals )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] non-empty node\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] non-empty node";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -647,9 +678,11 @@ bool SGFACESET::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
|| ( items[5] && items[6] ) )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] corrupt data; multiple item definitions at position ";
std::cerr << aFile.tellg() << "\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] corrupt data; multiple item definitions at position ";
ostr << aFile.tellg();
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -662,9 +695,11 @@ bool SGFACESET::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
if( S3D::SGTYPE_COORDS != S3D::ReadTag( aFile, name ) )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] corrupt data; bad child coords tag at position ";
std::cerr << aFile.tellg() << "\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] corrupt data; bad child coords tag at position ";
ostr << aFile.tellg();
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -676,9 +711,11 @@ bool SGFACESET::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
if( !m_Coords->ReadCache( aFile, this ) )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] corrupt data while reading coords '";
std::cerr << name << "'\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] corrupt data while reading coords '";
ostr << name << "'";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -690,9 +727,11 @@ bool SGFACESET::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
if( S3D::SGTYPE_COORDS != S3D::ReadTag( aFile, name ) )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] corrupt data; bad ref coords tag at position ";
std::cerr << aFile.tellg() << "\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] corrupt data; bad ref coords tag at position ";
ostr << aFile.tellg();
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -703,9 +742,11 @@ bool SGFACESET::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
if( !np )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] corrupt data: cannot find ref coords '";
std::cerr << name << "'\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] corrupt data: cannot find ref coords '";
ostr << name << "'";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -714,9 +755,11 @@ bool SGFACESET::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
if( S3D::SGTYPE_COORDS != np->GetNodeType() )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] corrupt data: type is not SGCOORDS '";
std::cerr << name << "'\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] corrupt data: type is not SGCOORDS '";
ostr << name << "'";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -731,9 +774,11 @@ bool SGFACESET::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
if( S3D::SGTYPE_COORDINDEX != S3D::ReadTag( aFile, name ) )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] corrupt data; bad coord index tag at position ";
std::cerr << aFile.tellg() << "\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] corrupt data; bad coord index tag at position ";
ostr << aFile.tellg();
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -745,9 +790,11 @@ bool SGFACESET::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
if( !m_CoordIndices->ReadCache( aFile, this ) )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] corrupt data while reading coord index '";
std::cerr << name << "'\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] corrupt data while reading coord index '";
ostr << name << "'";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -759,9 +806,11 @@ bool SGFACESET::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
if( S3D::SGTYPE_NORMALS != S3D::ReadTag( aFile, name ) )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] corrupt data; bad child normals tag at position ";
std::cerr << aFile.tellg() << "\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] corrupt data; bad child normals tag at position ";
ostr << aFile.tellg();
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -773,9 +822,11 @@ bool SGFACESET::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
if( !m_Normals->ReadCache( aFile, this ) )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] corrupt data while reading normals '";
std::cerr << name << "'\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] corrupt data while reading normals '";
ostr << name << "'";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -787,9 +838,11 @@ bool SGFACESET::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
if( S3D::SGTYPE_NORMALS != S3D::ReadTag( aFile, name ) )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] corrupt data; bad ref normals tag at position ";
std::cerr << aFile.tellg() << "\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] corrupt data; bad ref normals tag at position ";
ostr << aFile.tellg();
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -800,9 +853,11 @@ bool SGFACESET::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
if( !np )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] corrupt data: cannot find ref normals '";
std::cerr << name << "'\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] corrupt data: cannot find ref normals '";
ostr << name << "'";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -811,9 +866,11 @@ bool SGFACESET::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
if( S3D::SGTYPE_NORMALS != np->GetNodeType() )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] corrupt data: type is not SGNORMALS '";
std::cerr << name << "'\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] corrupt data: type is not SGNORMALS '";
ostr << name << "'";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -828,9 +885,11 @@ bool SGFACESET::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
if( S3D::SGTYPE_COLORS != S3D::ReadTag( aFile, name ) )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] corrupt data; bad child colors tag at position ";
std::cerr << aFile.tellg() << "\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] corrupt data; bad child colors tag at position ";
ostr << aFile.tellg();
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -842,9 +901,11 @@ bool SGFACESET::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
if( !m_Colors->ReadCache( aFile, this ) )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] corrupt data while reading colors '";
std::cerr << name << "'\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] corrupt data while reading colors '";
ostr << name << "'";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -856,9 +917,11 @@ bool SGFACESET::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
if( S3D::SGTYPE_COLORS != S3D::ReadTag( aFile, name ) )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] corrupt data; bad ref colors tag at position ";
std::cerr << aFile.tellg() << "\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] corrupt data; bad ref colors tag at position ";
ostr << aFile.tellg();
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -869,9 +932,11 @@ bool SGFACESET::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
if( !np )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] corrupt data: cannot find ref colors '";
std::cerr << name << "'\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] corrupt data: cannot find ref colors '";
ostr << name << "'";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -880,9 +945,11 @@ bool SGFACESET::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
if( S3D::SGTYPE_COLORS != np->GetNodeType() )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] corrupt data: type is not SGCOLORS '";
std::cerr << name << "'\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] corrupt data: type is not SGCOLORS '";
ostr << name << "'";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -911,8 +978,10 @@ bool SGFACESET::validate( void )
|| (NULL == m_CoordIndices) )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] bad model; no vertices, vertex indices, or normals\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] bad model; no vertices, vertex indices, or normals";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
validated = true;
valid = false;
@ -932,8 +1001,10 @@ bool SGFACESET::validate( void )
if( nCoords < 3 )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] bad model; fewer than 3 vertices\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] bad model; fewer than 3 vertices";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
validated = true;
valid = false;
@ -948,8 +1019,10 @@ bool SGFACESET::validate( void )
if( nCIdx < 3 || ( nCIdx % 3 > 0 ) )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] bad model; no vertex indices or not multiple of 3\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] bad model; no vertex indices or not multiple of 3";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
validated = true;
valid = false;
@ -962,8 +1035,10 @@ bool SGFACESET::validate( void )
if( lCIdx[i] < 0 || lCIdx[i] >= nCoords )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] bad model; vertex index out of bounds\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] bad model; vertex index out of bounds";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
validated = true;
valid = false;
@ -984,9 +1059,11 @@ bool SGFACESET::validate( void )
if( nNorms != nCoords )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] bad model; number of normals (" << nNorms;
std::cerr << ") does not match number of vertices (" << nCoords << ")\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] bad model; number of normals (" << nNorms;
ostr << ") does not match number of vertices (" << nCoords << ")";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
validated = true;
valid = false;

View File

@ -22,13 +22,12 @@
*/
#include <iostream>
#include <sstream>
#include <streambuf>
#include <iomanip>
#include <string>
#include <utility>
#include <iostream>
#include <map>
#include <sstream>
#include <utility>
#include <wx/log.h>
#include "3d_cache/sg/sg_helpers.h"
#include "3d_cache/sg/sg_node.h"
@ -214,9 +213,11 @@ S3D::SGTYPES S3D::ReadTag( std::ifstream& aFile, std::string& aName )
if( '[' != schar )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] corrupt data; missing left bracket at position ";
std::cerr << aFile.tellg() << "\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] corrupt data; missing left bracket at position ";
ostr << aFile.tellg();
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return S3D::SGTYPE_END;
@ -234,8 +235,10 @@ S3D::SGTYPES S3D::ReadTag( std::ifstream& aFile, std::string& aName )
if( schar != ']' )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] corrupt data; could not find right bracket\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] corrupt data; could not find right bracket";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return S3D::SGTYPE_END;
@ -247,9 +250,11 @@ S3D::SGTYPES S3D::ReadTag( std::ifstream& aFile, std::string& aName )
if( std::string::npos == upos )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] corrupt data; no underscore in name '";
std::cerr << name << "'\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] corrupt data; no underscore in name '";
ostr << name << "'";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return S3D::SGTYPE_END;
@ -275,9 +280,13 @@ S3D::SGTYPES S3D::ReadTag( std::ifstream& aFile, std::string& aName )
}
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] corrupt data; no node type matching '";
std::cerr << name << "'\n";
do {
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] corrupt data; no node type matching '";
ostr << name << "'";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif
return S3D::SGTYPE_END;
@ -380,8 +389,10 @@ bool S3D::CalcTriangleNormals( std::vector< SGPOINT > coords,
if( vsize < 3 )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] invalid vertex set (fewer than 3 vertices)\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] invalid vertex set (fewer than 3 vertices)";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -392,8 +403,10 @@ bool S3D::CalcTriangleNormals( std::vector< SGPOINT > coords,
if( 0 != isize % 3 || index.empty() )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] invalid index set (not multiple of 3)\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] invalid index set (not multiple of 3)";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -402,8 +415,10 @@ bool S3D::CalcTriangleNormals( std::vector< SGPOINT > coords,
if( !norms.empty() )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] normals set is not empty\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] normals set is not empty";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -424,8 +439,10 @@ bool S3D::CalcTriangleNormals( std::vector< SGPOINT > coords,
p3 < 0 || p3 >= vsize )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] invalid index set; index out of bounds\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] invalid index set; index out of bounds";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -509,8 +526,10 @@ bool S3D::CalcTriangleNormals( std::vector< SGPOINT > coords,
if( norms.size() != coords.size() )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] number of normals does not equal number of vertices\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] number of normals does not equal number of vertices";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;

View File

@ -21,8 +21,11 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <iostream>
#include <fstream>
#include <iostream>
#include <sstream>
#include <wx/log.h>
#include "3d_cache/sg/sg_index.h"
@ -33,9 +36,11 @@ SGINDEX::SGINDEX( SGNODE* aParent ) : SGNODE( aParent )
m_Parent = NULL;
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] inappropriate parent to SGINDEX (type ";
std::cerr << aParent->GetNodeType() << ")\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] inappropriate parent to SGINDEX (type ";
ostr << aParent->GetNodeType() << ")";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
}
@ -95,8 +100,10 @@ SGNODE* SGINDEX::FindNode(const char *aNodeName, const SGNODE *aCaller)
void SGINDEX::unlinkChildNode( const SGNODE* aCaller )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] unexpected code branch; node should have no children or refs\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] unexpected code branch; node should have no children or refs";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return;
@ -106,8 +113,10 @@ void SGINDEX::unlinkChildNode( const SGNODE* aCaller )
void SGINDEX::unlinkRefNode( const SGNODE* aCaller )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] unexpected code branch; node should have no children or refs\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] unexpected code branch; node should have no children or refs";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return;
@ -117,8 +126,10 @@ void SGINDEX::unlinkRefNode( const SGNODE* aCaller )
bool SGINDEX::AddRefNode( SGNODE* aNode )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] this node does not accept children or refs\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] this node does not accept children or refs";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -128,8 +139,10 @@ bool SGINDEX::AddRefNode( SGNODE* aNode )
bool SGINDEX::AddChildNode( SGNODE* aNode )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] this node does not accept children or refs\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] this node does not accept children or refs";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -201,8 +214,10 @@ bool SGINDEX::writeCoordIndex( std::ofstream& aFile )
if( n % 3 )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] coord index is not divisible by three (violates triangle constraint)\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] coord index is not divisible by three (violates triangle constraint)";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -287,8 +302,10 @@ bool SGINDEX::WriteCache( std::ofstream& aFile, SGNODE* parentNode )
if( NULL == m_Parent )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] corrupt data; m_aParent is NULL\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] corrupt data; m_aParent is NULL";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -305,8 +322,10 @@ bool SGINDEX::WriteCache( std::ofstream& aFile, SGNODE* parentNode )
if( parentNode != m_Parent )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] corrupt data; parentNode != m_aParent\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] corrupt data; parentNode != m_aParent";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -315,8 +334,10 @@ bool SGINDEX::WriteCache( std::ofstream& aFile, SGNODE* parentNode )
if( !aFile.good() )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] bad stream\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] bad stream";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -341,8 +362,10 @@ bool SGINDEX::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
if( !index.empty() )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] non-empty node\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] non-empty node";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;

View File

@ -21,11 +21,12 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <iostream>
#include <sstream>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <sstream>
#include <wx/log.h>
#include "3d_cache/sg/sg_node.h"
#include "plugins/3dapi/c3dmodel.h"
@ -167,8 +168,10 @@ void SGNODE::delNodeRef( SGNODE* aNode )
}
#ifdef DEBUG
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_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return;
@ -180,8 +183,10 @@ void SGNODE::AssociateWrapper( SGNODE** aWrapperRef )
if( NULL == aWrapperRef )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] NULL handle\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] NULL handle";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return;
@ -190,8 +195,10 @@ void SGNODE::AssociateWrapper( SGNODE** aWrapperRef )
if( *aWrapperRef != this )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] handle value does not match this object's pointer\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] handle value does not match this object's pointer";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return;
@ -204,8 +211,10 @@ void SGNODE::AssociateWrapper( SGNODE** aWrapperRef )
*m_Association = NULL;
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [WARNING] association being broken with previous wrapper\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [WARNING] association being broken with previous wrapper";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
}
@ -222,8 +231,10 @@ void SGNODE::DisassociateWrapper( SGNODE** aWrapperRef )
if( !aWrapperRef )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] invalid handle value aWrapperRef\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] invalid handle value aWrapperRef";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return;
@ -232,13 +243,15 @@ void SGNODE::DisassociateWrapper( SGNODE** aWrapperRef )
if( *aWrapperRef != *m_Association || aWrapperRef != m_Association )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] *aWrapperRef (" << *aWrapperRef;
std::cerr << ") does not match *m_Association (" << *m_Association << ") in type ";
std::cerr << node_names[ m_SGtype] << "\n";
std::cerr << " * [INFO] OR aWrapperRef(" << aWrapperRef << ") != m_Association(";
std::cerr << m_Association << ")\n";
std::cerr << " * [INFO] node name: " << GetName() << "\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] *aWrapperRef (" << *aWrapperRef;
ostr << ") does not match *m_Association (" << *m_Association << ") in type ";
ostr << node_names[ m_SGtype] << "\n";
ostr << " * [INFO] OR aWrapperRef(" << aWrapperRef << ") != m_Association(";
ostr << m_Association << ")\n";
ostr << " * [INFO] node name: " << GetName();
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return;
@ -266,16 +279,20 @@ bool S3D::GetMatIndex( MATLIST& aList, SGNODE* aNode, int& aIndex )
if( NULL == aNode || S3D::SGTYPE_APPEARANCE != aNode->GetNodeType() )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__;
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
ostr.str( "" );
if( NULL == aNode )
{
std::cerr << " * [BUG] aNode is NULL\n";
wxLogTrace( MASK_3D_SG, " * [BUG] aNode is NULL\n" );
}
else
{
std::cerr << " * [BUG] invalid node type (" << aNode->GetNodeType();
std::cerr << "), expected " << S3D::SGTYPE_APPEARANCE << "\n";
ostr << " * [BUG] invalid node type (" << aNode->GetNodeType();
ostr << "), expected " << S3D::SGTYPE_APPEARANCE;
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
}
#endif

View File

@ -22,6 +22,9 @@
*/
#include <iostream>
#include <sstream>
#include <wx/log.h>
#include "3d_cache/sg/sg_normals.h"
#include "3d_cache/sg/sg_helpers.h"
@ -35,9 +38,11 @@ SGNORMALS::SGNORMALS( SGNODE* aParent ) : SGNODE( aParent )
m_Parent = NULL;
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] inappropriate parent to SGNORMALS (type ";
std::cerr << aParent->GetNodeType() << ")\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] inappropriate parent to SGNORMALS (type ";
ostr << aParent->GetNodeType() << ")";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
}
else if( NULL != aParent && S3D::SGTYPE_FACESET == aParent->GetNodeType() )
@ -101,8 +106,10 @@ SGNODE* SGNORMALS::FindNode(const char *aNodeName, const SGNODE *aCaller)
void SGNORMALS::unlinkChildNode( const SGNODE* aCaller )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] unexpected code branch; node should have no children or refs\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] unexpected code branch; node should have no children or refs";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return;
@ -112,8 +119,10 @@ void SGNORMALS::unlinkChildNode( const SGNODE* aCaller )
void SGNORMALS::unlinkRefNode( const SGNODE* aCaller )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] unexpected code branch; node should have no children or refs\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] unexpected code branch; node should have no children or refs";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return;
@ -123,8 +132,10 @@ void SGNORMALS::unlinkRefNode( const SGNODE* aCaller )
bool SGNORMALS::AddRefNode( SGNODE* aNode )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] this node does not accept children or refs\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] this node does not accept children or refs";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -134,8 +145,10 @@ bool SGNORMALS::AddRefNode( SGNODE* aNode )
bool SGNORMALS::AddChildNode( SGNODE* aNode )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] this node does not accept children or refs\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] this node does not accept children or refs";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -258,8 +271,10 @@ bool SGNORMALS::WriteCache( std::ofstream& aFile, SGNODE* parentNode )
if( NULL == m_Parent )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] corrupt data; m_aParent is NULL\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] corrupt data; m_aParent is NULL";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -276,8 +291,10 @@ bool SGNORMALS::WriteCache( std::ofstream& aFile, SGNODE* parentNode )
if( parentNode != m_Parent )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] corrupt data; parentNode != m_aParent\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] corrupt data; parentNode != m_aParent";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -286,8 +303,10 @@ bool SGNORMALS::WriteCache( std::ofstream& aFile, SGNODE* parentNode )
if( !aFile.good() )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] bad stream\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] bad stream";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -312,8 +331,10 @@ bool SGNORMALS::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
if( !norms.empty() )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] non-empty node\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] non-empty node";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;

View File

@ -22,8 +22,11 @@
*/
#include <iostream>
#include <fstream>
#include <iostream>
#include <sstream>
#include <wx/log.h>
#include "3d_cache/sg/sg_shape.h"
#include "3d_cache/sg/sg_faceset.h"
#include "3d_cache/sg/sg_appearance.h"
@ -47,9 +50,11 @@ SGSHAPE::SGSHAPE( SGNODE* aParent ) : SGNODE( aParent )
m_Parent = NULL;
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] inappropriate parent to SGSHAPE (type ";
std::cerr << aParent->GetNodeType() << ")\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] inappropriate parent to SGSHAPE (type ";
ostr << aParent->GetNodeType() << ")";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
}
else if( NULL != aParent && S3D::SGTYPE_TRANSFORM == aParent->GetNodeType() )
@ -197,8 +202,12 @@ void SGSHAPE::unlinkNode( const SGNODE* aNode, bool isChild )
}
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] unlinkNode() did not find its target\n";
do {
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] unlinkNode() did not find its target";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif
return;
@ -224,8 +233,10 @@ bool SGSHAPE::addNode( SGNODE* aNode, bool isChild )
if( NULL == aNode )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] NULL pointer passed for aNode\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] NULL pointer passed for aNode";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -238,8 +249,10 @@ bool SGSHAPE::addNode( SGNODE* aNode, bool isChild )
if( aNode != m_Appearance && aNode != m_RAppearance )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] assigning multiple Appearance nodes\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] assigning multiple Appearance nodes";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -269,8 +282,10 @@ bool SGSHAPE::addNode( SGNODE* aNode, bool isChild )
if( aNode != m_FaceSet && aNode != m_RFaceSet )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] assigning multiple FaceSet nodes\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] assigning multiple FaceSet nodes";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -294,9 +309,13 @@ bool SGSHAPE::addNode( SGNODE* aNode, bool isChild )
}
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] object '" << aNode->GetName();
std::cerr << "' is not a valid type for this object (" << aNode->GetNodeType() << ")\n";
do {
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] object '" << aNode->GetName();
ostr << "' is not a valid type for this object (" << aNode->GetNodeType() << ")";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif
return false;
@ -388,8 +407,10 @@ bool SGSHAPE::WriteCache( std::ofstream& aFile, SGNODE* parentNode )
if( NULL == m_Parent )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] corrupt data; m_aParent is NULL\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] corrupt data; m_aParent is NULL";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -406,8 +427,10 @@ bool SGSHAPE::WriteCache( std::ofstream& aFile, SGNODE* parentNode )
if( parentNode != m_Parent )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] corrupt data; parentNode != m_aParent\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] corrupt data; parentNode != m_aParent";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -416,8 +439,10 @@ bool SGSHAPE::WriteCache( std::ofstream& aFile, SGNODE* parentNode )
if( !aFile.good() )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] bad stream\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] bad stream";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -474,8 +499,10 @@ bool SGSHAPE::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
if( m_Appearance || m_RAppearance || m_FaceSet || m_RFaceSet )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] non-empty node\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] non-empty node";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -490,9 +517,11 @@ bool SGSHAPE::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
if( ( items[0] && items[1] ) || ( items[2] && items[3] ) )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] corrupt data; multiple item definitions at position ";
std::cerr << aFile.tellg() << "\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] corrupt data; multiple item definitions at position ";
ostr << aFile.tellg();
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -505,9 +534,11 @@ bool SGSHAPE::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
if( S3D::SGTYPE_APPEARANCE != S3D::ReadTag( aFile, name ) )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] corrupt data; bad child apperance tag at position ";
std::cerr << aFile.tellg() << "\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] corrupt data; bad child apperance tag at position ";
ostr << aFile.tellg();
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -519,9 +550,11 @@ bool SGSHAPE::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
if( !m_Appearance->ReadCache( aFile, this ) )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] corrupt data while reading appearance '";
std::cerr << name << "'\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] corrupt data while reading appearance '";
ostr << name << "'";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -533,9 +566,11 @@ bool SGSHAPE::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
if( S3D::SGTYPE_APPEARANCE != S3D::ReadTag( aFile, name ) )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] corrupt data; bad ref appearance tag at position ";
std::cerr << aFile.tellg() << "\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] corrupt data; bad ref appearance tag at position ";
ostr << aFile.tellg();
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -546,9 +581,11 @@ bool SGSHAPE::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
if( !np )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] corrupt data: cannot find ref appearance '";
std::cerr << name << "'\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] corrupt data: cannot find ref appearance '";
ostr << name << "'";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -557,9 +594,11 @@ bool SGSHAPE::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
if( S3D::SGTYPE_APPEARANCE != np->GetNodeType() )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] corrupt data: type is not SGAPPEARANCE '";
std::cerr << name << "'\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] corrupt data: type is not SGAPPEARANCE '";
ostr << name << "'";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -574,9 +613,11 @@ bool SGSHAPE::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
if( S3D::SGTYPE_FACESET != S3D::ReadTag( aFile, name ) )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] corrupt data; bad child face set tag at position ";
std::cerr << aFile.tellg() << "\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] corrupt data; bad child face set tag at position ";
ostr << aFile.tellg();
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -588,9 +629,11 @@ bool SGSHAPE::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
if( !m_FaceSet->ReadCache( aFile, this ) )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] corrupt data while reading face set '";
std::cerr << name << "'\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] corrupt data while reading face set '";
ostr << name << "'";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -602,9 +645,11 @@ bool SGSHAPE::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
if( S3D::SGTYPE_FACESET != S3D::ReadTag( aFile, name ) )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] corrupt data; bad ref face set tag at position ";
std::cerr << aFile.tellg() << "\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] corrupt data; bad ref face set tag at position ";
ostr << aFile.tellg();
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -615,9 +660,11 @@ bool SGSHAPE::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
if( !np )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] corrupt data: cannot find ref face set '";
std::cerr << name << "'\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] corrupt data: cannot find ref face set '";
ostr << name << "'";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -626,9 +673,11 @@ bool SGSHAPE::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
if( S3D::SGTYPE_FACESET != np->GetNodeType() )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] corrupt data: type is not SGFACESET '";
std::cerr << name << "'\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] corrupt data: type is not SGFACESET '";
ostr << name << "'";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -667,8 +716,10 @@ bool SGSHAPE::Prepare( const glm::dmat4* aTransform,
if( !pf->validate() )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] bad model; inconsistent data\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] bad model; inconsistent data";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return true;
}
@ -721,9 +772,11 @@ bool SGSHAPE::Prepare( const glm::dmat4* aTransform,
if( nColors < nCoords )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] bad model; not enough colors per vertex (";
std::cerr << nColors << " vs " << nCoords << ")\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] bad model; not enough colors per vertex (";
ostr << nColors << " vs " << nCoords << ")";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return true;
}
@ -753,8 +806,10 @@ bool SGSHAPE::Prepare( const glm::dmat4* aTransform,
if( vertices.size() < 3 )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] bad model; not enough vertices\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] bad model; not enough vertices";
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
#endif
return true;
}

View File

@ -21,9 +21,11 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <sstream>
#include <iostream>
#include <sstream>
#include <wx/log.h>
#include <wx/translation.h>
#include "plugins/ldr/3d/pluginldr3D.h"
#define PLUGIN_CLASS_3D "PLUGIN_3D"
@ -72,9 +74,11 @@ bool KICAD_PLUGIN_LDR_3D::Open( const wxString& aFullFileName )
}
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] failed on file " << aFullFileName.ToUTF8() << "\n";
std::cerr << " * [INFO] error: " << m_error << "\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] failed on file " << aFullFileName.ToUTF8() << "\n";
ostr << " * [INFO] error: " << m_error;
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -95,10 +99,12 @@ bool KICAD_PLUGIN_LDR_3D::Open( const wxString& aFullFileName )
if( !m_getNExtensions )
{
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
wxString errmsg = _( "incompatible plugin (missing function 'GetNExtensions')" );
std::cerr << errmsg.ToUTF8() << "\n";
std::cerr << "'" << aFullFileName.ToUTF8() << "'\n";
ostr << errmsg.ToUTF8() << "\n";
ostr << "'" << aFullFileName.ToUTF8() << "'";
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
fail = true;
}
@ -106,16 +112,20 @@ bool KICAD_PLUGIN_LDR_3D::Open( const wxString& aFullFileName )
{
if( !fail )
{
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
wxString errmsg = _( "incompatible plugin (missing function 'GetModelExtension')" );
std::cerr << errmsg.ToUTF8() << "\n";
std::cerr << "'" << aFullFileName.ToUTF8() << "'\n";
ostr << errmsg.ToUTF8() << "\n";
ostr << "'" << aFullFileName.ToUTF8() << "'";
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
fail = true;
}
else
{
std::ostringstream ostr;
wxString errmsg = _( "missing function 'GetModelExtension'" );
std::cerr << errmsg.ToUTF8() << "\n";
ostr << errmsg.ToUTF8();
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
}
}
@ -123,16 +133,20 @@ bool KICAD_PLUGIN_LDR_3D::Open( const wxString& aFullFileName )
{
if( !fail )
{
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
wxString errmsg = _( "incompatible plugin (missing function 'GetNFilters')" );
std::cerr << errmsg.ToUTF8() << "\n";
std::cerr << "'" << aFullFileName.ToUTF8() << "'\n";
ostr << errmsg.ToUTF8() << "\n";
ostr << "'" << aFullFileName.ToUTF8() << "'";
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
fail = true;
}
else
{
std::ostringstream ostr;
wxString errmsg = _( "missing function 'GetNFilters'" );
std::cerr << errmsg.ToUTF8() << "\n";
ostr << errmsg.ToUTF8();
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
}
}
@ -140,16 +154,20 @@ bool KICAD_PLUGIN_LDR_3D::Open( const wxString& aFullFileName )
{
if( !fail )
{
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
wxString errmsg = _( "incompatible plugin (missing function 'GetFileFilter')" );
std::cerr << errmsg.ToUTF8() << "\n";
std::cerr << "'" << aFullFileName.ToUTF8() << "'\n";
ostr << errmsg.ToUTF8() << "\n";
ostr << "'" << aFullFileName.ToUTF8() << "'";
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
fail = true;
}
else
{
std::ostringstream ostr;
wxString errmsg = _( "missing function 'GetFileFilter'" );
std::cerr << errmsg.ToUTF8() << "\n";
ostr << errmsg.ToUTF8();
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
}
}
@ -157,16 +175,20 @@ bool KICAD_PLUGIN_LDR_3D::Open( const wxString& aFullFileName )
{
if( !fail )
{
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
wxString errmsg = _( "incompatible plugin (missing function 'CanRender')" );
std::cerr << errmsg.ToUTF8() << "\n";
std::cerr << "'" << aFullFileName.ToUTF8() << "'\n";
ostr << errmsg.ToUTF8() << "\n";
ostr << "'" << aFullFileName.ToUTF8() << "'";
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
fail = true;
}
else
{
std::ostringstream ostr;
wxString errmsg = _( "missing function 'CanRender'" );
std::cerr << errmsg.ToUTF8() << "\n";
ostr << errmsg.ToUTF8();
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
}
}
@ -174,16 +196,20 @@ bool KICAD_PLUGIN_LDR_3D::Open( const wxString& aFullFileName )
{
if( !fail )
{
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
wxString errmsg = _( "incompatible plugin (missing function 'Load')" );
std::cerr << errmsg.ToUTF8() << "\n";
std::cerr << "'" << aFullFileName.ToUTF8() << "'\n";
ostr << errmsg.ToUTF8() << "\n";
ostr << "'" << aFullFileName.ToUTF8() << "'";
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
fail = true;
}
else
{
std::ostringstream ostr;
wxString errmsg = _( "missing function 'Load'" );
std::cerr << errmsg.ToUTF8() << "\n";
ostr << errmsg.ToUTF8();
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
}
}
@ -211,8 +237,10 @@ void KICAD_PLUGIN_LDR_3D::Close( void )
#ifdef DEBUG
if( ok )
{
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] closing plugin\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] closing plugin";
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
}
#endif
@ -266,8 +294,10 @@ int KICAD_PLUGIN_LDR_3D::GetNExtensions( void )
m_error = "[BUG] GetNExtensions is not linked";
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * " << m_error << "\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * " << m_error;
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
#endif
return 0;
@ -294,8 +324,10 @@ char const* KICAD_PLUGIN_LDR_3D::GetModelExtension( int aIndex )
m_error = "[BUG] GetModelExtension is not linked";
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * " << m_error << "\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * " << m_error;
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
#endif
return NULL;
@ -322,8 +354,10 @@ int KICAD_PLUGIN_LDR_3D::GetNFilters( void )
m_error = "[BUG] GetNFilters is not linked";
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * " << m_error << "\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * " << m_error;
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
#endif
return 0;
@ -350,8 +384,10 @@ char const* KICAD_PLUGIN_LDR_3D::GetFileFilter( int aIndex )
m_error = "[BUG] GetFileFilter is not linked";
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * " << m_error << "\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * " << m_error;
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
#endif
return NULL;
@ -378,8 +414,10 @@ bool KICAD_PLUGIN_LDR_3D::CanRender( void )
m_error = "[BUG] CanRender is not linked";
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * " << m_error << "\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * " << m_error;
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -406,8 +444,10 @@ SCENEGRAPH* KICAD_PLUGIN_LDR_3D::Load( char const* aFileName )
m_error = "[BUG] Load is not linked";
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * " << m_error << "\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * " << m_error;
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
#endif
return NULL;

View File

@ -21,9 +21,10 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <sstream>
#include <iostream>
#include <sstream>
#include <wx/dynload.h>
#include <wx/log.h>
#include <wx/string.h>
#include <wx/translation.h>
@ -67,8 +68,10 @@ bool KICAD_PLUGIN_LDR::open( const wxString& aFullFileName, const char* aPluginC
if( !m_PluginLoader.IsLoaded() )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * could not open file: '" << aFullFileName.ToUTF8() << "'\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * could not open file: '" << aFullFileName.ToUTF8() << "'";
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
#endif
return false;
}
@ -84,10 +87,12 @@ bool KICAD_PLUGIN_LDR::open( const wxString& aFullFileName, const char* aPluginC
if( !m_getPluginClass )
{
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
wxString errmsg = _( "incompatible plugin (missing function 'GetKicadPluginClass')" );
std::cerr << errmsg.ToUTF8() << "\n";
std::cerr << "'" << aFullFileName.ToUTF8() << "'\n";
ostr << errmsg.ToUTF8() << "\n";
ostr << "'" << aFullFileName.ToUTF8() << "'";
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
fail = true;
}
@ -95,16 +100,20 @@ bool KICAD_PLUGIN_LDR::open( const wxString& aFullFileName, const char* aPluginC
{
if( !fail )
{
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
wxString errmsg = _( "incompatible plugin (missing function 'GetClassVersion')" );
std::cerr << errmsg.ToUTF8() << "\n";
std::cerr << "'" << aFullFileName.ToUTF8() << "'\n";
ostr << errmsg.ToUTF8() << "\n";
ostr << "'" << aFullFileName.ToUTF8() << "'";
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
fail = true;
}
else
{
std::ostringstream ostr;
wxString errmsg = _( "missing function 'GetClassVersion'" );
std::cerr << errmsg.ToUTF8() << "\n";
ostr << errmsg.ToUTF8();
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
}
}
@ -112,16 +121,20 @@ bool KICAD_PLUGIN_LDR::open( const wxString& aFullFileName, const char* aPluginC
{
if( !fail )
{
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
wxString errmsg = _( "incompatible plugin (missing function 'CheckClassVersion')" );
std::cerr << errmsg.ToUTF8() << "\n";
std::cerr << "'" << aFullFileName.ToUTF8() << "'\n";
ostr << errmsg.ToUTF8() << "\n";
ostr << "'" << aFullFileName.ToUTF8() << "'";
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
fail = true;
}
else
{
std::ostringstream ostr;
wxString errmsg = _( "missing function 'CheckClassVersion'" );
std::cerr << errmsg.ToUTF8() << "\n";
ostr << errmsg.ToUTF8();
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
}
}
@ -129,16 +142,20 @@ bool KICAD_PLUGIN_LDR::open( const wxString& aFullFileName, const char* aPluginC
{
if( !fail )
{
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
wxString errmsg = _( "incompatible plugin (missing function 'GetKicadPluginName')" );
std::cerr << errmsg.ToUTF8() << "\n";
std::cerr << "'" << aFullFileName.ToUTF8() << "'\n";
ostr << errmsg.ToUTF8() << "\n";
ostr << "'" << aFullFileName.ToUTF8() << "'";
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
fail = true;
}
else
{
std::ostringstream ostr;
wxString errmsg = _( "missing function 'GetKicadPluginName'" );
std::cerr << errmsg.ToUTF8() << "\n";
ostr << errmsg.ToUTF8();
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
}
}
@ -146,16 +163,20 @@ bool KICAD_PLUGIN_LDR::open( const wxString& aFullFileName, const char* aPluginC
{
if( !fail )
{
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
wxString errmsg = _( "incompatible plugin (missing function 'GetVersion')" );
std::cerr << errmsg.ToUTF8() << "\n";
std::cerr << "'" << aFullFileName.ToUTF8() << "'\n";
ostr << errmsg.ToUTF8() << "\n";
ostr << "'" << aFullFileName.ToUTF8() << "'";
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
fail = true;
}
else
{
std::ostringstream ostr;
wxString errmsg = _( "missing function 'GetVersion'" );
std::cerr << errmsg.ToUTF8() << "\n";
ostr << errmsg.ToUTF8() << "\n";
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
}
}
@ -233,11 +254,17 @@ bool KICAD_PLUGIN_LDR::open( const wxString& aFullFileName, const char* aPluginC
m_fileName = aFullFileName;
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] opened plugin " << m_fileName.ToUTF8() << "\n";
do {
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] opened plugin " << m_fileName.ToUTF8();
char const* cp = m_getPluginName();
if( !cp )
std::cerr << " * [INFO] plugin name: '" << cp << "'\n";
ostr << " * [INFO] plugin name: '" << cp << "'\n";
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif
ok = true;
@ -305,8 +332,10 @@ char const* KICAD_PLUGIN_LDR::GetKicadPluginClass( void )
m_error = "[BUG] GetPluginClass is not linked";
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * " << m_error << "\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * " << m_error;
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
#endif
return NULL;
@ -351,8 +380,10 @@ bool KICAD_PLUGIN_LDR::GetClassVersion( unsigned char* Major, unsigned char* Min
m_error = "[BUG] CheckClassVersion is not linked";
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * " << m_error << "\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * " << m_error;
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -394,8 +425,10 @@ bool KICAD_PLUGIN_LDR::CheckClassVersion( unsigned char Major, unsigned char Min
m_error = "[BUG] CheckClassVersion is not linked";
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * " << m_error << "\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * " << m_error;
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
#endif
return false;
@ -422,8 +455,10 @@ const char* KICAD_PLUGIN_LDR::GetKicadPluginName( void )
m_error = "[BUG] GetKicadPluginName is not linked";
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * " << m_error << "\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * " << m_error;
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
#endif
return NULL;
@ -451,8 +486,10 @@ bool KICAD_PLUGIN_LDR::GetVersion( unsigned char* Major, unsigned char* Minor,
m_error = "[BUG] GetKicadPluginName is not linked";
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * " << m_error << "\n";
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * " << m_error;
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
#endif
return false;

View File

@ -31,8 +31,11 @@
#define PLUGINLDR_H
#include <string>
#include <wx/string.h>
#include <wx/dynlib.h>
#include <wx/string.h>
#define MASK_PLUGINLDR "PLUGIN_LOADER"
// helper function to link functions in the plugin
#define LINK_ITEM( funcPtr, funcType, funcName ) \