Switched SG* classes and plugin loader logging code from stderr to wxLogTrace
This commit is contained in:
parent
d051a8f47e
commit
9195451e12
|
@ -316,7 +316,7 @@ PANEL_PREV_3D::~PANEL_PREV_3D()
|
||||||
void PANEL_PREV_3D::View3DISO( wxCommandEvent& event )
|
void PANEL_PREV_3D::View3DISO( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
// XXX - TO BE IMPLEMENTED
|
// XXX - TO BE IMPLEMENTED
|
||||||
std::cout << "Switch to Isometric View\n";
|
// std::cout << "Switch to Isometric View\n";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -324,7 +324,7 @@ void PANEL_PREV_3D::View3DISO( wxCommandEvent& event )
|
||||||
void PANEL_PREV_3D::View3DUpdate( wxCommandEvent& event )
|
void PANEL_PREV_3D::View3DUpdate( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
// XXX - TO BE IMPLEMENTED
|
// XXX - TO BE IMPLEMENTED
|
||||||
std::cout << "Update 3D View\n";
|
// std::cout << "Update 3D View\n";
|
||||||
|
|
||||||
// update the model filename if appropriate
|
// update the model filename if appropriate
|
||||||
if( NULL != m_FileTree )
|
if( NULL != m_FileTree )
|
||||||
|
@ -340,7 +340,7 @@ void PANEL_PREV_3D::View3DUpdate( wxCommandEvent& event )
|
||||||
void PANEL_PREV_3D::View3DLeft( wxCommandEvent& event )
|
void PANEL_PREV_3D::View3DLeft( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
// XXX - TO BE IMPLEMENTED
|
// XXX - TO BE IMPLEMENTED
|
||||||
std::cout << "Switch to Left View\n";
|
// std::cout << "Switch to Left View\n";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -348,7 +348,7 @@ void PANEL_PREV_3D::View3DLeft( wxCommandEvent& event )
|
||||||
void PANEL_PREV_3D::View3DRight( wxCommandEvent& event )
|
void PANEL_PREV_3D::View3DRight( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
// XXX - TO BE IMPLEMENTED
|
// XXX - TO BE IMPLEMENTED
|
||||||
std::cout << "Switch to Right View\n";
|
// std::cout << "Switch to Right View\n";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -356,7 +356,7 @@ void PANEL_PREV_3D::View3DRight( wxCommandEvent& event )
|
||||||
void PANEL_PREV_3D::View3DFront( wxCommandEvent& event )
|
void PANEL_PREV_3D::View3DFront( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
// XXX - TO BE IMPLEMENTED
|
// XXX - TO BE IMPLEMENTED
|
||||||
std::cout << "Switch to Front View\n";
|
// std::cout << "Switch to Front View\n";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -364,7 +364,7 @@ void PANEL_PREV_3D::View3DFront( wxCommandEvent& event )
|
||||||
void PANEL_PREV_3D::View3DBack( wxCommandEvent& event )
|
void PANEL_PREV_3D::View3DBack( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
// XXX - TO BE IMPLEMENTED
|
// XXX - TO BE IMPLEMENTED
|
||||||
std::cout << "Switch to Back View\n";
|
// std::cout << "Switch to Back View\n";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -372,7 +372,7 @@ void PANEL_PREV_3D::View3DBack( wxCommandEvent& event )
|
||||||
void PANEL_PREV_3D::View3DTop( wxCommandEvent& event )
|
void PANEL_PREV_3D::View3DTop( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
// XXX - TO BE IMPLEMENTED
|
// XXX - TO BE IMPLEMENTED
|
||||||
std::cout << "Switch to Top View\n";
|
// std::cout << "Switch to Top View\n";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -380,7 +380,7 @@ void PANEL_PREV_3D::View3DTop( wxCommandEvent& event )
|
||||||
void PANEL_PREV_3D::View3DBottom( wxCommandEvent& event )
|
void PANEL_PREV_3D::View3DBottom( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
// XXX - TO BE IMPLEMENTED
|
// XXX - TO BE IMPLEMENTED
|
||||||
std::cout << "Switch to Bottom View\n";
|
// std::cout << "Switch to Bottom View\n";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -459,36 +459,15 @@ void PANEL_PREV_3D::UpdateModelName( wxString const& aModelName )
|
||||||
wxString newModelFile;
|
wxString newModelFile;
|
||||||
newModelFile = m_resolver->ResolvePath( aModelName );
|
newModelFile = m_resolver->ResolvePath( aModelName );
|
||||||
|
|
||||||
if( newModelFile.empty() )
|
if( !newModelFile.empty() && newModelFile.Cmp( currentModelFile ) )
|
||||||
{
|
|
||||||
#ifdef DEBUG
|
|
||||||
std::cout << "[3dv] Update Model: (no such file) " << aModelName.ToUTF8() << "\n";
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
else if( newModelFile.Cmp( currentModelFile ) )
|
|
||||||
{
|
|
||||||
newModel = true;
|
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;
|
currentModelFile = newModelFile;
|
||||||
modelInfo.filename = currentModelFile;
|
modelInfo.filename = currentModelFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( currentModelFile.empty() || newModel )
|
if( currentModelFile.empty() || newModel )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
|
||||||
std::cout << "[3dv] Update Model: painting black\n";
|
|
||||||
#endif
|
|
||||||
if( NULL != canvas )
|
if( NULL != canvas )
|
||||||
{
|
{
|
||||||
canvas->Clear3DModel();
|
canvas->Clear3DModel();
|
||||||
|
@ -509,10 +488,6 @@ void PANEL_PREV_3D::UpdateModelName( wxString const& aModelName )
|
||||||
|
|
||||||
if( NULL == model )
|
if( NULL == model )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
|
||||||
std::cout << "[3dv] Update Model: no model loaded\n";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if( NULL != canvas )
|
if( NULL != canvas )
|
||||||
{
|
{
|
||||||
canvas->Refresh();
|
canvas->Refresh();
|
||||||
|
@ -522,24 +497,11 @@ void PANEL_PREV_3D::UpdateModelName( wxString const& aModelName )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
std::cout << "[3dv] Update Model: loading preview\n";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if( NULL == canvas )
|
if( NULL == canvas )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
|
||||||
std::cout << "[3dv] Update Model: creating canvas\n";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
canvas = new C3D_MODEL_VIEWER( preview,
|
canvas = new C3D_MODEL_VIEWER( preview,
|
||||||
COGL_ATT_LIST::GetAttributesList( true ) );
|
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 );
|
wxSizer* ws = new wxBoxSizer( wxHORIZONTAL );
|
||||||
canvas->Set3DModel( *model );
|
canvas->Set3DModel( *model );
|
||||||
ws->Add( canvas, 1, wxEXPAND );
|
ws->Add( canvas, 1, wxEXPAND );
|
||||||
|
|
|
@ -65,8 +65,8 @@ IFSG_SHAPE::IFSG_SHAPE( SGNODE* aParent )
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
std::cerr << WrongParent;
|
ostr << WrongParent;
|
||||||
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -88,8 +88,8 @@ IFSG_SHAPE::IFSG_SHAPE( IFSG_NODE& aParent )
|
||||||
if( ! pp )
|
if( ! pp )
|
||||||
{
|
{
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
std::cerr << BadParent;
|
ostr << BadParent;
|
||||||
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -105,8 +105,8 @@ IFSG_SHAPE::IFSG_SHAPE( IFSG_NODE& aParent )
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
std::cerr << WrongParent;
|
ostr << WrongParent;
|
||||||
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -153,10 +153,10 @@ bool IFSG_SHAPE::NewNode( SGNODE* aParent )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
std::cerr << " * [BUG] invalid SGNODE parent (";
|
ostr << " * [BUG] invalid SGNODE parent (";
|
||||||
std::cerr << aParent->GetNodeTypeName( aParent->GetNodeType() );
|
ostr << aParent->GetNodeTypeName( aParent->GetNodeType() );
|
||||||
std::cerr << ") to SGSHAPE";
|
ostr << ") to SGSHAPE";
|
||||||
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -179,8 +179,8 @@ bool IFSG_SHAPE::NewNode( IFSG_NODE& aParent )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
std::cerr << BadParent;
|
ostr << BadParent;
|
||||||
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -24,9 +24,11 @@
|
||||||
#define GLM_FORCE_RADIANS
|
#define GLM_FORCE_RADIANS
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <sstream>
|
||||||
#include <glm/gtx/transform.hpp>
|
#include <glm/gtx/transform.hpp>
|
||||||
#include <glm/gtc/matrix_transform.hpp>
|
#include <glm/gtc/matrix_transform.hpp>
|
||||||
#include <glm/gtc/type_ptr.hpp>
|
#include <glm/gtc/type_ptr.hpp>
|
||||||
|
#include <wx/log.h>
|
||||||
|
|
||||||
#include "3d_cache/sg/scenegraph.h"
|
#include "3d_cache/sg/scenegraph.h"
|
||||||
#include "3d_cache/sg/sg_shape.h"
|
#include "3d_cache/sg/sg_shape.h"
|
||||||
|
@ -48,9 +50,11 @@ SCENEGRAPH::SCENEGRAPH( SGNODE* aParent ) : SGNODE( aParent )
|
||||||
m_Parent = NULL;
|
m_Parent = NULL;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [BUG] inappropriate parent to SCENEGRAPH (type ";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
std::cerr << aParent->GetNodeType() << ")\n";
|
ostr << " * [BUG] inappropriate parent to SCENEGRAPH (type ";
|
||||||
|
ostr << aParent->GetNodeType() << ")";
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else if( NULL != aParent && S3D::SGTYPE_TRANSFORM == aParent->GetNodeType() )
|
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 );
|
UNLINK_NODE( S3D::SGTYPE_SHAPE, SGSHAPE, aNode, m_Shape, m_RShape, isChild );
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
do {
|
||||||
std::cerr << " * [BUG] unlinkNode() did not find its target\n";
|
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
|
#endif
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -161,8 +169,10 @@ bool SCENEGRAPH::addNode( SGNODE* aNode, bool isChild )
|
||||||
if( NULL == aNode )
|
if( NULL == aNode )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [BUG] NULL pointer passed for aNode\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
ostr << " * [BUG] NULL pointer passed for aNode";
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
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 );
|
ADD_NODE( S3D::SGTYPE_SHAPE, SGSHAPE, aNode, m_Shape, m_RShape, isChild );
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
do {
|
||||||
std::cerr << " * [BUG] object '" << aNode->GetName();
|
std::ostringstream ostr;
|
||||||
std::cerr << "' is not a valid type for this object (" << aNode->GetNodeType() << ")\n";
|
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
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -355,8 +369,10 @@ bool SCENEGRAPH::WriteCache( std::ofstream& aFile, SGNODE* parentNode )
|
||||||
if( parentNode != m_Parent )
|
if( parentNode != m_Parent )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [BUG] corrupt data; parentNode != m_aParent\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
ostr << " * [BUG] corrupt data; parentNode != m_aParent";
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -372,8 +388,10 @@ bool SCENEGRAPH::WriteCache( std::ofstream& aFile, SGNODE* parentNode )
|
||||||
if( aFile.fail() )
|
if( aFile.fail() )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [INFO] bad stream\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
ostr << " * [INFO] bad stream";
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -406,8 +424,10 @@ bool SCENEGRAPH::WriteCache( std::ofstream& aFile, SGNODE* parentNode )
|
||||||
if( !m_Transforms[i]->WriteCache( aFile, this ) )
|
if( !m_Transforms[i]->WriteCache( aFile, this ) )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [INFO] bad stream while writing child transforms\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
ostr << " * [INFO] bad stream while writing child transforms";
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -426,8 +446,10 @@ bool SCENEGRAPH::WriteCache( std::ofstream& aFile, SGNODE* parentNode )
|
||||||
if( !m_Shape[i]->WriteCache( aFile, this ) )
|
if( !m_Shape[i]->WriteCache( aFile, this ) )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [INFO] bad stream while writing child shapes\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
ostr << " * [INFO] bad stream while writing child shapes";
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -452,8 +474,10 @@ bool SCENEGRAPH::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
|
||||||
|| !m_Shape.empty() || !m_RShape.empty() )
|
|| !m_Shape.empty() || !m_RShape.empty() )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [BUG] non-empty node\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
ostr << " * [BUG] non-empty node";
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -467,9 +491,11 @@ bool SCENEGRAPH::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
|
||||||
if( S3D::SGTYPE_TRANSFORM != S3D::ReadTag( aFile, name ) )
|
if( S3D::SGTYPE_TRANSFORM != S3D::ReadTag( aFile, name ) )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [INFO] corrupt data; tag mismatch at position ";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
std::cerr << aFile.tellg() << "\n";
|
ostr << " * [INFO] corrupt data; tag mismatch at position ";
|
||||||
|
ostr << aFile.tellg();
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -505,9 +531,11 @@ bool SCENEGRAPH::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
|
||||||
if( S3D::SGTYPE_TRANSFORM != S3D::ReadTag( aFile, name ) )
|
if( S3D::SGTYPE_TRANSFORM != S3D::ReadTag( aFile, name ) )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [INFO] corrupt data; bad child transform tag at position ";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
std::cerr << aFile.tellg() << "\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
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -519,9 +547,11 @@ bool SCENEGRAPH::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
|
||||||
if( !sp->ReadCache( aFile, this ) )
|
if( !sp->ReadCache( aFile, this ) )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [INFO] corrupt data while reading transform '";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
std::cerr << name << "'\n";
|
ostr << " * [INFO] corrupt data while reading transform '";
|
||||||
|
ostr << name << "'";
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -534,9 +564,11 @@ bool SCENEGRAPH::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
|
||||||
if( S3D::SGTYPE_TRANSFORM != S3D::ReadTag( aFile, name ) )
|
if( S3D::SGTYPE_TRANSFORM != S3D::ReadTag( aFile, name ) )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [INFO] corrupt data; bad ref transform tag at position ";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
std::cerr << aFile.tellg() << "\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
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -547,9 +579,11 @@ bool SCENEGRAPH::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
|
||||||
if( !sp )
|
if( !sp )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [INFO] corrupt data: cannot find ref transform '";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
std::cerr << name << "'\n";
|
ostr << " * [INFO] corrupt data: cannot find ref transform '";
|
||||||
|
ostr << name << "'";
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -558,9 +592,11 @@ bool SCENEGRAPH::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
|
||||||
if( S3D::SGTYPE_TRANSFORM != sp->GetNodeType() )
|
if( S3D::SGTYPE_TRANSFORM != sp->GetNodeType() )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [INFO] corrupt data: type is not TRANSFORM '";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
std::cerr << name << "'\n";
|
ostr << " * [INFO] corrupt data: type is not TRANSFORM '";
|
||||||
|
ostr << name << "'";
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -575,9 +611,11 @@ bool SCENEGRAPH::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
|
||||||
if( S3D::SGTYPE_SHAPE != S3D::ReadTag( aFile, name ) )
|
if( S3D::SGTYPE_SHAPE != S3D::ReadTag( aFile, name ) )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [INFO] corrupt data; bad child shape tag at position ";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
std::cerr << aFile.tellg() << "\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
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -589,9 +627,11 @@ bool SCENEGRAPH::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
|
||||||
if( !sp->ReadCache( aFile, this ) )
|
if( !sp->ReadCache( aFile, this ) )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [INFO] corrupt data while reading shape '";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
std::cerr << name << "'\n";
|
ostr << " * [INFO] corrupt data while reading shape '";
|
||||||
|
ostr << name << "'";
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -604,9 +644,11 @@ bool SCENEGRAPH::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
|
||||||
if( S3D::SGTYPE_SHAPE != S3D::ReadTag( aFile, name ) )
|
if( S3D::SGTYPE_SHAPE != S3D::ReadTag( aFile, name ) )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [INFO] corrupt data; bad ref shape tag at position ";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
std::cerr << aFile.tellg() << "\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
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -617,9 +659,11 @@ bool SCENEGRAPH::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
|
||||||
if( !sp )
|
if( !sp )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [INFO] corrupt data: cannot find ref shape '";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
std::cerr << name << "'\n";
|
ostr << " * [INFO] corrupt data: cannot find ref shape '";
|
||||||
|
ostr << name << "'";
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -628,9 +672,11 @@ bool SCENEGRAPH::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
|
||||||
if( S3D::SGTYPE_SHAPE != sp->GetNodeType() )
|
if( S3D::SGTYPE_SHAPE != sp->GetNodeType() )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [INFO] corrupt data: type is not SGSHAPE '";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
std::cerr << name << "'\n";
|
ostr << " * [INFO] corrupt data: type is not SGSHAPE '";
|
||||||
|
ostr << name << "'";
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -23,6 +23,8 @@
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
#include <sstream>
|
||||||
|
#include <wx/log.h>
|
||||||
|
|
||||||
#include "3d_cache/sg/sg_appearance.h"
|
#include "3d_cache/sg/sg_appearance.h"
|
||||||
#include "3d_cache/sg/sg_helpers.h"
|
#include "3d_cache/sg/sg_helpers.h"
|
||||||
|
@ -42,9 +44,11 @@ SGAPPEARANCE::SGAPPEARANCE( SGNODE* aParent ) : SGNODE( aParent)
|
||||||
m_Parent = NULL;
|
m_Parent = NULL;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [BUG] inappropriate parent to SGAPPEARANCE (type ";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
std::cerr << aParent->GetNodeType() << ")\n";
|
ostr << " * [BUG] inappropriate parent to SGAPPEARANCE (type ";
|
||||||
|
ostr << aParent->GetNodeType() << ")";
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else if( NULL != aParent && S3D::SGTYPE_SHAPE == aParent->GetNodeType() )
|
else if( NULL != aParent && S3D::SGTYPE_SHAPE == aParent->GetNodeType() )
|
||||||
|
@ -103,8 +107,10 @@ bool SGAPPEARANCE::SetEmissive( const SGCOLOR* aRGBColor )
|
||||||
if( NULL == aRGBColor )
|
if( NULL == aRGBColor )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [BUG] NULL pointer passed for aRGBColor\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
ostr << " * [BUG] NULL pointer passed for aRGBColor";
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -131,8 +137,10 @@ bool SGAPPEARANCE::SetDiffuse( const SGCOLOR* aRGBColor )
|
||||||
if( NULL == aRGBColor )
|
if( NULL == aRGBColor )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [BUG] NULL pointer passed for aRGBColor\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
ostr << " * [BUG] NULL pointer passed for aRGBColor";
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -159,8 +167,10 @@ bool SGAPPEARANCE::SetSpecular( const SGCOLOR* aRGBColor )
|
||||||
if( NULL == aRGBColor )
|
if( NULL == aRGBColor )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [BUG] NULL pointer passed for aRGBColor\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
ostr << " * [BUG] NULL pointer passed for aRGBColor";
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -186,8 +196,10 @@ bool SGAPPEARANCE::SetAmbient( const SGCOLOR* aRGBColor )
|
||||||
if( NULL == aRGBColor )
|
if( NULL == aRGBColor )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [BUG] NULL pointer passed for aRGBColor\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
ostr << " * [BUG] NULL pointer passed for aRGBColor";
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -218,8 +230,10 @@ SGNODE* SGAPPEARANCE::FindNode(const char *aNodeName, const SGNODE *aCaller)
|
||||||
void SGAPPEARANCE::unlinkChildNode( const SGNODE* aCaller )
|
void SGAPPEARANCE::unlinkChildNode( const SGNODE* aCaller )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [BUG] unexpected code branch; node should have no children or refs\n";
|
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
|
#endif
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -229,8 +243,10 @@ void SGAPPEARANCE::unlinkChildNode( const SGNODE* aCaller )
|
||||||
void SGAPPEARANCE::unlinkRefNode( const SGNODE* aCaller )
|
void SGAPPEARANCE::unlinkRefNode( const SGNODE* aCaller )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [BUG] unexpected code branch; node should have no children or refs\n";
|
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
|
#endif
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -240,8 +256,10 @@ void SGAPPEARANCE::unlinkRefNode( const SGNODE* aCaller )
|
||||||
bool SGAPPEARANCE::AddRefNode( SGNODE* aNode )
|
bool SGAPPEARANCE::AddRefNode( SGNODE* aNode )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [BUG] this node does not accept children or refs\n";
|
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
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -251,8 +269,10 @@ bool SGAPPEARANCE::AddRefNode( SGNODE* aNode )
|
||||||
bool SGAPPEARANCE::AddChildNode( SGNODE* aNode )
|
bool SGAPPEARANCE::AddChildNode( SGNODE* aNode )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [BUG] this node does not accept children or refs\n";
|
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
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -353,8 +373,10 @@ bool SGAPPEARANCE::WriteCache( std::ofstream& aFile, SGNODE* parentNode )
|
||||||
if( NULL == m_Parent )
|
if( NULL == m_Parent )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [BUG] corrupt data; m_aParent is NULL\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
ostr << " * [BUG] corrupt data; m_aParent is NULL";
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -371,8 +393,10 @@ bool SGAPPEARANCE::WriteCache( std::ofstream& aFile, SGNODE* parentNode )
|
||||||
if( parentNode != m_Parent )
|
if( parentNode != m_Parent )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [BUG] corrupt data; parentNode != m_aParent\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
ostr << " * [BUG] corrupt data; parentNode != m_aParent";
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -381,8 +405,10 @@ bool SGAPPEARANCE::WriteCache( std::ofstream& aFile, SGNODE* parentNode )
|
||||||
if( !aFile.good() )
|
if( !aFile.good() )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [INFO] bad stream\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
ostr << " * [INFO] bad stream";
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -22,8 +22,11 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
#include <iostream>
|
||||||
|
#include <sstream>
|
||||||
|
#include <wx/log.h>
|
||||||
|
|
||||||
#include "plugins/3dapi/sg_base.h"
|
#include "plugins/3dapi/sg_base.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -41,8 +44,10 @@ SGCOLOR::SGCOLOR( float aRVal, float aGVal, float aBVal )
|
||||||
if( !checkRange( aRVal, aGVal, aBVal ) )
|
if( !checkRange( aRVal, aGVal, aBVal ) )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [BUG] invalid value passed to constructor\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
ostr << " * [BUG] invalid value passed to constructor";
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
red = 0.0;
|
red = 0.0;
|
||||||
green = 0.0;
|
green = 0.0;
|
||||||
|
@ -80,8 +85,10 @@ void SGCOLOR::GetColor( SGCOLOR* aColor ) const
|
||||||
if( NULL == aColor )
|
if( NULL == aColor )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [BUG] NULL pointer passed for aColor\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
ostr << " * [BUG] NULL pointer passed for aColor";
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -121,8 +128,10 @@ bool SGCOLOR::SetColor( const SGCOLOR* aColor )
|
||||||
if( NULL == aColor )
|
if( NULL == aColor )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [BUG] NULL pointer passed for aColor\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
ostr << " * [BUG] NULL pointer passed for aColor";
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -142,8 +151,10 @@ bool SGCOLOR::checkRange( float aRedVal, float aGreenVal, float aBlueVal ) const
|
||||||
if( aRedVal < 0.0 || aRedVal > 1.0 )
|
if( aRedVal < 0.0 || aRedVal > 1.0 )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [BUG] invalid RED value: " << aRedVal << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
ostr << " * [BUG] invalid RED value: " << aRedVal;
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
ok = false;
|
ok = false;
|
||||||
}
|
}
|
||||||
|
@ -153,9 +164,9 @@ bool SGCOLOR::checkRange( float aRedVal, float aGreenVal, float aBlueVal ) const
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
if( ok )
|
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
|
#endif
|
||||||
ok = false;
|
ok = false;
|
||||||
}
|
}
|
||||||
|
@ -165,9 +176,9 @@ bool SGCOLOR::checkRange( float aRedVal, float aGreenVal, float aBlueVal ) const
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
if( ok )
|
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
|
#endif
|
||||||
ok = false;
|
ok = false;
|
||||||
}
|
}
|
||||||
|
@ -216,8 +227,10 @@ void SGPOINT::GetPoint( SGPOINT* aPoint )
|
||||||
if( NULL == aPoint )
|
if( NULL == aPoint )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [BUG] NULL pointer passed for aPoint\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
ostr << " * [BUG] NULL pointer passed for aPoint";
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -22,6 +22,9 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <sstream>
|
||||||
|
#include <wx/log.h>
|
||||||
|
|
||||||
#include "3d_cache/sg/sg_colors.h"
|
#include "3d_cache/sg/sg_colors.h"
|
||||||
#include "3d_cache/sg/sg_helpers.h"
|
#include "3d_cache/sg/sg_helpers.h"
|
||||||
|
|
||||||
|
@ -34,9 +37,11 @@ SGCOLORS::SGCOLORS( SGNODE* aParent ) : SGNODE( aParent )
|
||||||
m_Parent = NULL;
|
m_Parent = NULL;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [BUG] inappropriate parent to SGCOLORS (type ";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
std::cerr << aParent->GetNodeType() << ")\n";
|
ostr << " * [BUG] inappropriate parent to SGCOLORS (type ";
|
||||||
|
ostr << aParent->GetNodeType() << ")";
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else if( NULL != aParent && S3D::SGTYPE_FACESET == aParent->GetNodeType() )
|
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 )
|
void SGCOLORS::unlinkChildNode( const SGNODE* aCaller )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [BUG] unexpected code branch; node should have no children or refs\n";
|
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
|
#endif
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -111,8 +118,10 @@ void SGCOLORS::unlinkChildNode( const SGNODE* aCaller )
|
||||||
void SGCOLORS::unlinkRefNode( const SGNODE* aCaller )
|
void SGCOLORS::unlinkRefNode( const SGNODE* aCaller )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [BUG] unexpected code branch; node should have no children or refs\n";
|
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
|
#endif
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -122,8 +131,10 @@ void SGCOLORS::unlinkRefNode( const SGNODE* aCaller )
|
||||||
bool SGCOLORS::AddRefNode( SGNODE* aNode )
|
bool SGCOLORS::AddRefNode( SGNODE* aNode )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [BUG] this node does not accept children or refs\n";
|
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
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -133,8 +144,10 @@ bool SGCOLORS::AddRefNode( SGNODE* aNode )
|
||||||
bool SGCOLORS::AddChildNode( SGNODE* aNode )
|
bool SGCOLORS::AddChildNode( SGNODE* aNode )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [BUG] this node does not accept children or refs\n";
|
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
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -259,8 +272,10 @@ bool SGCOLORS::WriteCache( std::ofstream& aFile, SGNODE* parentNode )
|
||||||
if( NULL == m_Parent )
|
if( NULL == m_Parent )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [BUG] corrupt data; m_aParent is NULL\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
ostr << " * [BUG] corrupt data; m_aParent is NULL";
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -277,8 +292,10 @@ bool SGCOLORS::WriteCache( std::ofstream& aFile, SGNODE* parentNode )
|
||||||
if( parentNode != m_Parent )
|
if( parentNode != m_Parent )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [BUG] corrupt data; parentNode != m_aParent\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
ostr << " * [BUG] corrupt data; parentNode != m_aParent";
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -287,8 +304,10 @@ bool SGCOLORS::WriteCache( std::ofstream& aFile, SGNODE* parentNode )
|
||||||
if( !aFile.good() )
|
if( !aFile.good() )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [INFO] bad stream\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
ostr << " * [INFO] bad stream";
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -313,8 +332,10 @@ bool SGCOLORS::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
|
||||||
if( !colors.empty() )
|
if( !colors.empty() )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [BUG] non-empty node\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
ostr << " * [BUG] non-empty node";
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -22,6 +22,9 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <sstream>
|
||||||
|
#include <wx/log.h>
|
||||||
|
|
||||||
#include "3d_cache/sg/sg_coords.h"
|
#include "3d_cache/sg/sg_coords.h"
|
||||||
#include "3d_cache/sg/sg_helpers.h"
|
#include "3d_cache/sg/sg_helpers.h"
|
||||||
#include "3d_cache/sg/sg_normals.h"
|
#include "3d_cache/sg/sg_normals.h"
|
||||||
|
@ -37,9 +40,11 @@ SGCOORDS::SGCOORDS( SGNODE* aParent ) : SGNODE( aParent )
|
||||||
m_Parent = NULL;
|
m_Parent = NULL;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [BUG] inappropriate parent to SGCOORDS (type ";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
std::cerr << aParent->GetNodeType() << ")\n";
|
ostr << " * [BUG] inappropriate parent to SGCOORDS (type ";
|
||||||
|
ostr << aParent->GetNodeType() << ")";
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else if( NULL != aParent && S3D::SGTYPE_FACESET == aParent->GetNodeType() )
|
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 )
|
void SGCOORDS::unlinkChildNode( const SGNODE* aCaller )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [BUG] unexpected code branch; node should have no children or refs\n";
|
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
|
#endif
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -114,8 +121,10 @@ void SGCOORDS::unlinkChildNode( const SGNODE* aCaller )
|
||||||
void SGCOORDS::unlinkRefNode( const SGNODE* aCaller )
|
void SGCOORDS::unlinkRefNode( const SGNODE* aCaller )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [BUG] unexpected code branch; node should have no children or refs\n";
|
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
|
#endif
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -125,8 +134,10 @@ void SGCOORDS::unlinkRefNode( const SGNODE* aCaller )
|
||||||
bool SGCOORDS::AddRefNode( SGNODE* aNode )
|
bool SGCOORDS::AddRefNode( SGNODE* aNode )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [BUG] this node does not accept children or refs\n";
|
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
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -136,8 +147,10 @@ bool SGCOORDS::AddRefNode( SGNODE* aNode )
|
||||||
bool SGCOORDS::AddChildNode( SGNODE* aNode )
|
bool SGCOORDS::AddChildNode( SGNODE* aNode )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [BUG] this node does not accept children or refs\n";
|
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
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -266,8 +279,10 @@ bool SGCOORDS::WriteCache( std::ofstream& aFile, SGNODE* parentNode )
|
||||||
if( NULL == m_Parent )
|
if( NULL == m_Parent )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [BUG] corrupt data; m_aParent is NULL\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
ostr << " * [BUG] corrupt data; m_aParent is NULL";
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -284,8 +299,10 @@ bool SGCOORDS::WriteCache( std::ofstream& aFile, SGNODE* parentNode )
|
||||||
if( parentNode != m_Parent )
|
if( parentNode != m_Parent )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [BUG] corrupt data; parentNode != m_aParent\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
ostr << " * [BUG] corrupt data; parentNode != m_aParent";
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -294,8 +311,10 @@ bool SGCOORDS::WriteCache( std::ofstream& aFile, SGNODE* parentNode )
|
||||||
if( !aFile.good() )
|
if( !aFile.good() )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [INFO] bad stream\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
ostr << " * [INFO] bad stream";
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -320,8 +339,10 @@ bool SGCOORDS::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
|
||||||
if( !coords.empty() )
|
if( !coords.empty() )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [BUG] non-empty node\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
ostr << " * [BUG] non-empty node";
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -23,6 +23,9 @@
|
||||||
|
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <sstream>
|
||||||
|
#include <wx/log.h>
|
||||||
|
|
||||||
#include "3d_cache/sg/sg_faceset.h"
|
#include "3d_cache/sg/sg_faceset.h"
|
||||||
#include "3d_cache/sg/sg_colors.h"
|
#include "3d_cache/sg/sg_colors.h"
|
||||||
#include "3d_cache/sg/sg_coords.h"
|
#include "3d_cache/sg/sg_coords.h"
|
||||||
|
@ -48,9 +51,11 @@ SGFACESET::SGFACESET( SGNODE* aParent ) : SGNODE( aParent )
|
||||||
m_Parent = NULL;
|
m_Parent = NULL;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [BUG] inappropriate parent to SGFACESET (type ";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
std::cerr << aParent->GetNodeType() << ")\n";
|
ostr << " * [BUG] inappropriate parent to SGFACESET (type ";
|
||||||
|
ostr << aParent->GetNodeType() << ")";
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else if( NULL != aParent && S3D::SGTYPE_SHAPE == aParent->GetNodeType() )
|
else if( NULL != aParent && S3D::SGTYPE_SHAPE == aParent->GetNodeType() )
|
||||||
|
@ -252,8 +257,12 @@ void SGFACESET::unlinkNode( const SGNODE* aNode, bool isChild )
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
do {
|
||||||
std::cerr << " * [BUG] unlinkNode() did not find its target\n";
|
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
|
#endif
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -280,8 +289,10 @@ bool SGFACESET::addNode( SGNODE* aNode, bool isChild )
|
||||||
if( NULL == aNode )
|
if( NULL == aNode )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [BUG] NULL pointer passed for aNode\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
ostr << " * [BUG] NULL pointer passed for aNode";
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -297,8 +308,10 @@ bool SGFACESET::addNode( SGNODE* aNode, bool isChild )
|
||||||
if( aNode != m_Colors && aNode != m_RColors )
|
if( aNode != m_Colors && aNode != m_RColors )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [BUG] assigning multiple Colors nodes\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
ostr << " * [BUG] assigning multiple Colors nodes";
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -328,8 +341,10 @@ bool SGFACESET::addNode( SGNODE* aNode, bool isChild )
|
||||||
if( aNode != m_Coords && aNode != m_RCoords )
|
if( aNode != m_Coords && aNode != m_RCoords )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [BUG] assigning multiple Coords nodes\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
ostr << " * [BUG] assigning multiple Coords nodes";
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -359,8 +374,10 @@ bool SGFACESET::addNode( SGNODE* aNode, bool isChild )
|
||||||
if( aNode != m_Normals && aNode != m_RNormals )
|
if( aNode != m_Normals && aNode != m_RNormals )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [BUG] assigning multiple Normals nodes\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
ostr << " * [BUG] assigning multiple Normals nodes";
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -390,8 +407,10 @@ bool SGFACESET::addNode( SGNODE* aNode, bool isChild )
|
||||||
if( aNode != m_CoordIndices )
|
if( aNode != m_CoordIndices )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [BUG] assigning multiple CoordIndex nodes\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
ostr << " * [BUG] assigning multiple CoordIndex nodes";
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -407,10 +426,14 @@ bool SGFACESET::addNode( SGNODE* aNode, bool isChild )
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
do {
|
||||||
std::cerr << " * [BUG] object '" << aNode->GetName();
|
std::ostringstream ostr;
|
||||||
std::cerr << "' (type " << aNode->GetNodeType();
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
std::cerr << ") is not a valid type for this object (" << aNode->GetNodeType() << ")\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
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -521,8 +544,10 @@ bool SGFACESET::WriteCache( std::ofstream& aFile, SGNODE* parentNode )
|
||||||
if( NULL == m_Parent )
|
if( NULL == m_Parent )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [BUG] corrupt data; m_aParent is NULL\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
ostr << " * [BUG] corrupt data; m_aParent is NULL";
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -539,8 +564,10 @@ bool SGFACESET::WriteCache( std::ofstream& aFile, SGNODE* parentNode )
|
||||||
if( parentNode != m_Parent )
|
if( parentNode != m_Parent )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [BUG] corrupt data; parentNode != m_aParent\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
ostr << " * [BUG] corrupt data; parentNode != m_aParent";
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -549,8 +576,10 @@ bool SGFACESET::WriteCache( std::ofstream& aFile, SGNODE* parentNode )
|
||||||
if( !aFile.good() )
|
if( !aFile.good() )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [INFO] bad stream\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
ostr << " * [INFO] bad stream";
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -630,8 +659,10 @@ bool SGFACESET::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
|
||||||
|| m_Normals || m_RNormals )
|
|| m_Normals || m_RNormals )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [BUG] non-empty node\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
ostr << " * [BUG] non-empty node";
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -647,9 +678,11 @@ bool SGFACESET::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
|
||||||
|| ( items[5] && items[6] ) )
|
|| ( items[5] && items[6] ) )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [INFO] corrupt data; multiple item definitions at position ";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
std::cerr << aFile.tellg() << "\n";
|
ostr << " * [INFO] corrupt data; multiple item definitions at position ";
|
||||||
|
ostr << aFile.tellg();
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -662,9 +695,11 @@ bool SGFACESET::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
|
||||||
if( S3D::SGTYPE_COORDS != S3D::ReadTag( aFile, name ) )
|
if( S3D::SGTYPE_COORDS != S3D::ReadTag( aFile, name ) )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [INFO] corrupt data; bad child coords tag at position ";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
std::cerr << aFile.tellg() << "\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
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -676,9 +711,11 @@ bool SGFACESET::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
|
||||||
if( !m_Coords->ReadCache( aFile, this ) )
|
if( !m_Coords->ReadCache( aFile, this ) )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [INFO] corrupt data while reading coords '";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
std::cerr << name << "'\n";
|
ostr << " * [INFO] corrupt data while reading coords '";
|
||||||
|
ostr << name << "'";
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -690,9 +727,11 @@ bool SGFACESET::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
|
||||||
if( S3D::SGTYPE_COORDS != S3D::ReadTag( aFile, name ) )
|
if( S3D::SGTYPE_COORDS != S3D::ReadTag( aFile, name ) )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [INFO] corrupt data; bad ref coords tag at position ";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
std::cerr << aFile.tellg() << "\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
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -703,9 +742,11 @@ bool SGFACESET::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
|
||||||
if( !np )
|
if( !np )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [INFO] corrupt data: cannot find ref coords '";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
std::cerr << name << "'\n";
|
ostr << " * [INFO] corrupt data: cannot find ref coords '";
|
||||||
|
ostr << name << "'";
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -714,9 +755,11 @@ bool SGFACESET::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
|
||||||
if( S3D::SGTYPE_COORDS != np->GetNodeType() )
|
if( S3D::SGTYPE_COORDS != np->GetNodeType() )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [INFO] corrupt data: type is not SGCOORDS '";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
std::cerr << name << "'\n";
|
ostr << " * [INFO] corrupt data: type is not SGCOORDS '";
|
||||||
|
ostr << name << "'";
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -731,9 +774,11 @@ bool SGFACESET::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
|
||||||
if( S3D::SGTYPE_COORDINDEX != S3D::ReadTag( aFile, name ) )
|
if( S3D::SGTYPE_COORDINDEX != S3D::ReadTag( aFile, name ) )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [INFO] corrupt data; bad coord index tag at position ";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
std::cerr << aFile.tellg() << "\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
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -745,9 +790,11 @@ bool SGFACESET::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
|
||||||
if( !m_CoordIndices->ReadCache( aFile, this ) )
|
if( !m_CoordIndices->ReadCache( aFile, this ) )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [INFO] corrupt data while reading coord index '";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
std::cerr << name << "'\n";
|
ostr << " * [INFO] corrupt data while reading coord index '";
|
||||||
|
ostr << name << "'";
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -759,9 +806,11 @@ bool SGFACESET::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
|
||||||
if( S3D::SGTYPE_NORMALS != S3D::ReadTag( aFile, name ) )
|
if( S3D::SGTYPE_NORMALS != S3D::ReadTag( aFile, name ) )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [INFO] corrupt data; bad child normals tag at position ";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
std::cerr << aFile.tellg() << "\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
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -773,9 +822,11 @@ bool SGFACESET::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
|
||||||
if( !m_Normals->ReadCache( aFile, this ) )
|
if( !m_Normals->ReadCache( aFile, this ) )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [INFO] corrupt data while reading normals '";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
std::cerr << name << "'\n";
|
ostr << " * [INFO] corrupt data while reading normals '";
|
||||||
|
ostr << name << "'";
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -787,9 +838,11 @@ bool SGFACESET::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
|
||||||
if( S3D::SGTYPE_NORMALS != S3D::ReadTag( aFile, name ) )
|
if( S3D::SGTYPE_NORMALS != S3D::ReadTag( aFile, name ) )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [INFO] corrupt data; bad ref normals tag at position ";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
std::cerr << aFile.tellg() << "\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
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -800,9 +853,11 @@ bool SGFACESET::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
|
||||||
if( !np )
|
if( !np )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [INFO] corrupt data: cannot find ref normals '";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
std::cerr << name << "'\n";
|
ostr << " * [INFO] corrupt data: cannot find ref normals '";
|
||||||
|
ostr << name << "'";
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -811,9 +866,11 @@ bool SGFACESET::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
|
||||||
if( S3D::SGTYPE_NORMALS != np->GetNodeType() )
|
if( S3D::SGTYPE_NORMALS != np->GetNodeType() )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [INFO] corrupt data: type is not SGNORMALS '";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
std::cerr << name << "'\n";
|
ostr << " * [INFO] corrupt data: type is not SGNORMALS '";
|
||||||
|
ostr << name << "'";
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -828,9 +885,11 @@ bool SGFACESET::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
|
||||||
if( S3D::SGTYPE_COLORS != S3D::ReadTag( aFile, name ) )
|
if( S3D::SGTYPE_COLORS != S3D::ReadTag( aFile, name ) )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [INFO] corrupt data; bad child colors tag at position ";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
std::cerr << aFile.tellg() << "\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
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -842,9 +901,11 @@ bool SGFACESET::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
|
||||||
if( !m_Colors->ReadCache( aFile, this ) )
|
if( !m_Colors->ReadCache( aFile, this ) )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [INFO] corrupt data while reading colors '";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
std::cerr << name << "'\n";
|
ostr << " * [INFO] corrupt data while reading colors '";
|
||||||
|
ostr << name << "'";
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -856,9 +917,11 @@ bool SGFACESET::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
|
||||||
if( S3D::SGTYPE_COLORS != S3D::ReadTag( aFile, name ) )
|
if( S3D::SGTYPE_COLORS != S3D::ReadTag( aFile, name ) )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [INFO] corrupt data; bad ref colors tag at position ";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
std::cerr << aFile.tellg() << "\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
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -869,9 +932,11 @@ bool SGFACESET::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
|
||||||
if( !np )
|
if( !np )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [INFO] corrupt data: cannot find ref colors '";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
std::cerr << name << "'\n";
|
ostr << " * [INFO] corrupt data: cannot find ref colors '";
|
||||||
|
ostr << name << "'";
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -880,9 +945,11 @@ bool SGFACESET::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
|
||||||
if( S3D::SGTYPE_COLORS != np->GetNodeType() )
|
if( S3D::SGTYPE_COLORS != np->GetNodeType() )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [INFO] corrupt data: type is not SGCOLORS '";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
std::cerr << name << "'\n";
|
ostr << " * [INFO] corrupt data: type is not SGCOLORS '";
|
||||||
|
ostr << name << "'";
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -911,8 +978,10 @@ bool SGFACESET::validate( void )
|
||||||
|| (NULL == m_CoordIndices) )
|
|| (NULL == m_CoordIndices) )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [INFO] bad model; no vertices, vertex indices, or normals\n";
|
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
|
#endif
|
||||||
validated = true;
|
validated = true;
|
||||||
valid = false;
|
valid = false;
|
||||||
|
@ -932,8 +1001,10 @@ bool SGFACESET::validate( void )
|
||||||
if( nCoords < 3 )
|
if( nCoords < 3 )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [INFO] bad model; fewer than 3 vertices\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
ostr << " * [INFO] bad model; fewer than 3 vertices";
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
validated = true;
|
validated = true;
|
||||||
valid = false;
|
valid = false;
|
||||||
|
@ -948,8 +1019,10 @@ bool SGFACESET::validate( void )
|
||||||
if( nCIdx < 3 || ( nCIdx % 3 > 0 ) )
|
if( nCIdx < 3 || ( nCIdx % 3 > 0 ) )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [INFO] bad model; no vertex indices or not multiple of 3\n";
|
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
|
#endif
|
||||||
validated = true;
|
validated = true;
|
||||||
valid = false;
|
valid = false;
|
||||||
|
@ -962,8 +1035,10 @@ bool SGFACESET::validate( void )
|
||||||
if( lCIdx[i] < 0 || lCIdx[i] >= nCoords )
|
if( lCIdx[i] < 0 || lCIdx[i] >= nCoords )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [INFO] bad model; vertex index out of bounds\n";
|
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
|
#endif
|
||||||
validated = true;
|
validated = true;
|
||||||
valid = false;
|
valid = false;
|
||||||
|
@ -984,9 +1059,11 @@ bool SGFACESET::validate( void )
|
||||||
if( nNorms != nCoords )
|
if( nNorms != nCoords )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [INFO] bad model; number of normals (" << nNorms;
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
std::cerr << ") does not match number of vertices (" << nCoords << ")\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
|
#endif
|
||||||
validated = true;
|
validated = true;
|
||||||
valid = false;
|
valid = false;
|
||||||
|
|
|
@ -22,13 +22,12 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
#include <sstream>
|
|
||||||
#include <streambuf>
|
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include <string>
|
#include <iostream>
|
||||||
#include <utility>
|
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <sstream>
|
||||||
|
#include <utility>
|
||||||
|
#include <wx/log.h>
|
||||||
|
|
||||||
#include "3d_cache/sg/sg_helpers.h"
|
#include "3d_cache/sg/sg_helpers.h"
|
||||||
#include "3d_cache/sg/sg_node.h"
|
#include "3d_cache/sg/sg_node.h"
|
||||||
|
@ -214,9 +213,11 @@ S3D::SGTYPES S3D::ReadTag( std::ifstream& aFile, std::string& aName )
|
||||||
if( '[' != schar )
|
if( '[' != schar )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [INFO] corrupt data; missing left bracket at position ";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
std::cerr << aFile.tellg() << "\n";
|
ostr << " * [INFO] corrupt data; missing left bracket at position ";
|
||||||
|
ostr << aFile.tellg();
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return S3D::SGTYPE_END;
|
return S3D::SGTYPE_END;
|
||||||
|
@ -234,8 +235,10 @@ S3D::SGTYPES S3D::ReadTag( std::ifstream& aFile, std::string& aName )
|
||||||
if( schar != ']' )
|
if( schar != ']' )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [INFO] corrupt data; could not find right bracket\n";
|
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
|
#endif
|
||||||
|
|
||||||
return S3D::SGTYPE_END;
|
return S3D::SGTYPE_END;
|
||||||
|
@ -247,9 +250,11 @@ S3D::SGTYPES S3D::ReadTag( std::ifstream& aFile, std::string& aName )
|
||||||
if( std::string::npos == upos )
|
if( std::string::npos == upos )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [INFO] corrupt data; no underscore in name '";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
std::cerr << name << "'\n";
|
ostr << " * [INFO] corrupt data; no underscore in name '";
|
||||||
|
ostr << name << "'";
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return S3D::SGTYPE_END;
|
return S3D::SGTYPE_END;
|
||||||
|
@ -275,9 +280,13 @@ S3D::SGTYPES S3D::ReadTag( std::ifstream& aFile, std::string& aName )
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
do {
|
||||||
std::cerr << " * [INFO] corrupt data; no node type matching '";
|
std::ostringstream ostr;
|
||||||
std::cerr << name << "'\n";
|
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
|
#endif
|
||||||
|
|
||||||
return S3D::SGTYPE_END;
|
return S3D::SGTYPE_END;
|
||||||
|
@ -380,8 +389,10 @@ bool S3D::CalcTriangleNormals( std::vector< SGPOINT > coords,
|
||||||
if( vsize < 3 )
|
if( vsize < 3 )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [INFO] invalid vertex set (fewer than 3 vertices)\n";
|
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
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -392,8 +403,10 @@ bool S3D::CalcTriangleNormals( std::vector< SGPOINT > coords,
|
||||||
if( 0 != isize % 3 || index.empty() )
|
if( 0 != isize % 3 || index.empty() )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [INFO] invalid index set (not multiple of 3)\n";
|
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
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -402,8 +415,10 @@ bool S3D::CalcTriangleNormals( std::vector< SGPOINT > coords,
|
||||||
if( !norms.empty() )
|
if( !norms.empty() )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [INFO] normals set is not empty\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
ostr << " * [INFO] normals set is not empty";
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -424,8 +439,10 @@ bool S3D::CalcTriangleNormals( std::vector< SGPOINT > coords,
|
||||||
p3 < 0 || p3 >= vsize )
|
p3 < 0 || p3 >= vsize )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [INFO] invalid index set; index out of bounds\n";
|
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
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -509,8 +526,10 @@ bool S3D::CalcTriangleNormals( std::vector< SGPOINT > coords,
|
||||||
if( norms.size() != coords.size() )
|
if( norms.size() != coords.size() )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [BUG] number of normals does not equal number of vertices\n";
|
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
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -21,8 +21,11 @@
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
#include <iostream>
|
||||||
|
#include <sstream>
|
||||||
|
#include <wx/log.h>
|
||||||
|
|
||||||
#include "3d_cache/sg/sg_index.h"
|
#include "3d_cache/sg/sg_index.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -33,9 +36,11 @@ SGINDEX::SGINDEX( SGNODE* aParent ) : SGNODE( aParent )
|
||||||
m_Parent = NULL;
|
m_Parent = NULL;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [BUG] inappropriate parent to SGINDEX (type ";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
std::cerr << aParent->GetNodeType() << ")\n";
|
ostr << " * [BUG] inappropriate parent to SGINDEX (type ";
|
||||||
|
ostr << aParent->GetNodeType() << ")";
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,8 +100,10 @@ SGNODE* SGINDEX::FindNode(const char *aNodeName, const SGNODE *aCaller)
|
||||||
void SGINDEX::unlinkChildNode( const SGNODE* aCaller )
|
void SGINDEX::unlinkChildNode( const SGNODE* aCaller )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [BUG] unexpected code branch; node should have no children or refs\n";
|
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
|
#endif
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -106,8 +113,10 @@ void SGINDEX::unlinkChildNode( const SGNODE* aCaller )
|
||||||
void SGINDEX::unlinkRefNode( const SGNODE* aCaller )
|
void SGINDEX::unlinkRefNode( const SGNODE* aCaller )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [BUG] unexpected code branch; node should have no children or refs\n";
|
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
|
#endif
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -117,8 +126,10 @@ void SGINDEX::unlinkRefNode( const SGNODE* aCaller )
|
||||||
bool SGINDEX::AddRefNode( SGNODE* aNode )
|
bool SGINDEX::AddRefNode( SGNODE* aNode )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [BUG] this node does not accept children or refs\n";
|
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
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -128,8 +139,10 @@ bool SGINDEX::AddRefNode( SGNODE* aNode )
|
||||||
bool SGINDEX::AddChildNode( SGNODE* aNode )
|
bool SGINDEX::AddChildNode( SGNODE* aNode )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [BUG] this node does not accept children or refs\n";
|
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
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -201,8 +214,10 @@ bool SGINDEX::writeCoordIndex( std::ofstream& aFile )
|
||||||
if( n % 3 )
|
if( n % 3 )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [BUG] coord index is not divisible by three (violates triangle constraint)\n";
|
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
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -287,8 +302,10 @@ bool SGINDEX::WriteCache( std::ofstream& aFile, SGNODE* parentNode )
|
||||||
if( NULL == m_Parent )
|
if( NULL == m_Parent )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [BUG] corrupt data; m_aParent is NULL\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
ostr << " * [BUG] corrupt data; m_aParent is NULL";
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -305,8 +322,10 @@ bool SGINDEX::WriteCache( std::ofstream& aFile, SGNODE* parentNode )
|
||||||
if( parentNode != m_Parent )
|
if( parentNode != m_Parent )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [BUG] corrupt data; parentNode != m_aParent\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
ostr << " * [BUG] corrupt data; parentNode != m_aParent";
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -315,8 +334,10 @@ bool SGINDEX::WriteCache( std::ofstream& aFile, SGNODE* parentNode )
|
||||||
if( !aFile.good() )
|
if( !aFile.good() )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [INFO] bad stream\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
ostr << " * [INFO] bad stream";
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -341,8 +362,10 @@ bool SGINDEX::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
|
||||||
if( !index.empty() )
|
if( !index.empty() )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [BUG] non-empty node\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
ostr << " * [BUG] non-empty node";
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -21,11 +21,12 @@
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <iostream>
|
#include <algorithm>
|
||||||
#include <sstream>
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <algorithm>
|
#include <iostream>
|
||||||
|
#include <sstream>
|
||||||
|
#include <wx/log.h>
|
||||||
|
|
||||||
#include "3d_cache/sg/sg_node.h"
|
#include "3d_cache/sg/sg_node.h"
|
||||||
#include "plugins/3dapi/c3dmodel.h"
|
#include "plugins/3dapi/c3dmodel.h"
|
||||||
|
@ -167,8 +168,10 @@ void SGNODE::delNodeRef( SGNODE* aNode )
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [BUG] delNodeRef() did not find its target\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
ostr << " * [BUG] delNodeRef() did not find its target";
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -180,8 +183,10 @@ void SGNODE::AssociateWrapper( SGNODE** aWrapperRef )
|
||||||
if( NULL == aWrapperRef )
|
if( NULL == aWrapperRef )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [BUG] NULL handle\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
ostr << " * [BUG] NULL handle";
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -190,8 +195,10 @@ void SGNODE::AssociateWrapper( SGNODE** aWrapperRef )
|
||||||
if( *aWrapperRef != this )
|
if( *aWrapperRef != this )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [BUG] handle value does not match this object's pointer\n";
|
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
|
#endif
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -204,8 +211,10 @@ void SGNODE::AssociateWrapper( SGNODE** aWrapperRef )
|
||||||
*m_Association = NULL;
|
*m_Association = NULL;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [WARNING] association being broken with previous wrapper\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
ostr << " * [WARNING] association being broken with previous wrapper";
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -222,8 +231,10 @@ void SGNODE::DisassociateWrapper( SGNODE** aWrapperRef )
|
||||||
if( !aWrapperRef )
|
if( !aWrapperRef )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [BUG] invalid handle value aWrapperRef\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
ostr << " * [BUG] invalid handle value aWrapperRef";
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -232,13 +243,15 @@ void SGNODE::DisassociateWrapper( SGNODE** aWrapperRef )
|
||||||
if( *aWrapperRef != *m_Association || aWrapperRef != m_Association )
|
if( *aWrapperRef != *m_Association || aWrapperRef != m_Association )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [BUG] *aWrapperRef (" << *aWrapperRef;
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
std::cerr << ") does not match *m_Association (" << *m_Association << ") in type ";
|
ostr << " * [BUG] *aWrapperRef (" << *aWrapperRef;
|
||||||
std::cerr << node_names[ m_SGtype] << "\n";
|
ostr << ") does not match *m_Association (" << *m_Association << ") in type ";
|
||||||
std::cerr << " * [INFO] OR aWrapperRef(" << aWrapperRef << ") != m_Association(";
|
ostr << node_names[ m_SGtype] << "\n";
|
||||||
std::cerr << m_Association << ")\n";
|
ostr << " * [INFO] OR aWrapperRef(" << aWrapperRef << ") != m_Association(";
|
||||||
std::cerr << " * [INFO] node name: " << GetName() << "\n";
|
ostr << m_Association << ")\n";
|
||||||
|
ostr << " * [INFO] node name: " << GetName();
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -266,16 +279,20 @@ bool S3D::GetMatIndex( MATLIST& aList, SGNODE* aNode, int& aIndex )
|
||||||
if( NULL == aNode || S3D::SGTYPE_APPEARANCE != aNode->GetNodeType() )
|
if( NULL == aNode || S3D::SGTYPE_APPEARANCE != aNode->GetNodeType() )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#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 )
|
if( NULL == aNode )
|
||||||
{
|
{
|
||||||
std::cerr << " * [BUG] aNode is NULL\n";
|
wxLogTrace( MASK_3D_SG, " * [BUG] aNode is NULL\n" );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::cerr << " * [BUG] invalid node type (" << aNode->GetNodeType();
|
ostr << " * [BUG] invalid node type (" << aNode->GetNodeType();
|
||||||
std::cerr << "), expected " << S3D::SGTYPE_APPEARANCE << "\n";
|
ostr << "), expected " << S3D::SGTYPE_APPEARANCE;
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,9 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <sstream>
|
||||||
|
#include <wx/log.h>
|
||||||
|
|
||||||
#include "3d_cache/sg/sg_normals.h"
|
#include "3d_cache/sg/sg_normals.h"
|
||||||
#include "3d_cache/sg/sg_helpers.h"
|
#include "3d_cache/sg/sg_helpers.h"
|
||||||
|
|
||||||
|
@ -35,9 +38,11 @@ SGNORMALS::SGNORMALS( SGNODE* aParent ) : SGNODE( aParent )
|
||||||
m_Parent = NULL;
|
m_Parent = NULL;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [BUG] inappropriate parent to SGNORMALS (type ";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
std::cerr << aParent->GetNodeType() << ")\n";
|
ostr << " * [BUG] inappropriate parent to SGNORMALS (type ";
|
||||||
|
ostr << aParent->GetNodeType() << ")";
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else if( NULL != aParent && S3D::SGTYPE_FACESET == aParent->GetNodeType() )
|
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 )
|
void SGNORMALS::unlinkChildNode( const SGNODE* aCaller )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [BUG] unexpected code branch; node should have no children or refs\n";
|
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
|
#endif
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -112,8 +119,10 @@ void SGNORMALS::unlinkChildNode( const SGNODE* aCaller )
|
||||||
void SGNORMALS::unlinkRefNode( const SGNODE* aCaller )
|
void SGNORMALS::unlinkRefNode( const SGNODE* aCaller )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [BUG] unexpected code branch; node should have no children or refs\n";
|
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
|
#endif
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -123,8 +132,10 @@ void SGNORMALS::unlinkRefNode( const SGNODE* aCaller )
|
||||||
bool SGNORMALS::AddRefNode( SGNODE* aNode )
|
bool SGNORMALS::AddRefNode( SGNODE* aNode )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [BUG] this node does not accept children or refs\n";
|
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
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -134,8 +145,10 @@ bool SGNORMALS::AddRefNode( SGNODE* aNode )
|
||||||
bool SGNORMALS::AddChildNode( SGNODE* aNode )
|
bool SGNORMALS::AddChildNode( SGNODE* aNode )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [BUG] this node does not accept children or refs\n";
|
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
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -258,8 +271,10 @@ bool SGNORMALS::WriteCache( std::ofstream& aFile, SGNODE* parentNode )
|
||||||
if( NULL == m_Parent )
|
if( NULL == m_Parent )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [BUG] corrupt data; m_aParent is NULL\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
ostr << " * [BUG] corrupt data; m_aParent is NULL";
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -276,8 +291,10 @@ bool SGNORMALS::WriteCache( std::ofstream& aFile, SGNODE* parentNode )
|
||||||
if( parentNode != m_Parent )
|
if( parentNode != m_Parent )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [BUG] corrupt data; parentNode != m_aParent\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
ostr << " * [BUG] corrupt data; parentNode != m_aParent";
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -286,8 +303,10 @@ bool SGNORMALS::WriteCache( std::ofstream& aFile, SGNODE* parentNode )
|
||||||
if( !aFile.good() )
|
if( !aFile.good() )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [INFO] bad stream\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
ostr << " * [INFO] bad stream";
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -312,8 +331,10 @@ bool SGNORMALS::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
|
||||||
if( !norms.empty() )
|
if( !norms.empty() )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [BUG] non-empty node\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
ostr << " * [BUG] non-empty node";
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -22,8 +22,11 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
#include <iostream>
|
||||||
|
#include <sstream>
|
||||||
|
#include <wx/log.h>
|
||||||
|
|
||||||
#include "3d_cache/sg/sg_shape.h"
|
#include "3d_cache/sg/sg_shape.h"
|
||||||
#include "3d_cache/sg/sg_faceset.h"
|
#include "3d_cache/sg/sg_faceset.h"
|
||||||
#include "3d_cache/sg/sg_appearance.h"
|
#include "3d_cache/sg/sg_appearance.h"
|
||||||
|
@ -47,9 +50,11 @@ SGSHAPE::SGSHAPE( SGNODE* aParent ) : SGNODE( aParent )
|
||||||
m_Parent = NULL;
|
m_Parent = NULL;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [BUG] inappropriate parent to SGSHAPE (type ";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
std::cerr << aParent->GetNodeType() << ")\n";
|
ostr << " * [BUG] inappropriate parent to SGSHAPE (type ";
|
||||||
|
ostr << aParent->GetNodeType() << ")";
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else if( NULL != aParent && S3D::SGTYPE_TRANSFORM == aParent->GetNodeType() )
|
else if( NULL != aParent && S3D::SGTYPE_TRANSFORM == aParent->GetNodeType() )
|
||||||
|
@ -197,8 +202,12 @@ void SGSHAPE::unlinkNode( const SGNODE* aNode, bool isChild )
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
do {
|
||||||
std::cerr << " * [BUG] unlinkNode() did not find its target\n";
|
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
|
#endif
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -224,8 +233,10 @@ bool SGSHAPE::addNode( SGNODE* aNode, bool isChild )
|
||||||
if( NULL == aNode )
|
if( NULL == aNode )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [BUG] NULL pointer passed for aNode\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
ostr << " * [BUG] NULL pointer passed for aNode";
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -238,8 +249,10 @@ bool SGSHAPE::addNode( SGNODE* aNode, bool isChild )
|
||||||
if( aNode != m_Appearance && aNode != m_RAppearance )
|
if( aNode != m_Appearance && aNode != m_RAppearance )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [BUG] assigning multiple Appearance nodes\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
ostr << " * [BUG] assigning multiple Appearance nodes";
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -269,8 +282,10 @@ bool SGSHAPE::addNode( SGNODE* aNode, bool isChild )
|
||||||
if( aNode != m_FaceSet && aNode != m_RFaceSet )
|
if( aNode != m_FaceSet && aNode != m_RFaceSet )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [BUG] assigning multiple FaceSet nodes\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
ostr << " * [BUG] assigning multiple FaceSet nodes";
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -294,9 +309,13 @@ bool SGSHAPE::addNode( SGNODE* aNode, bool isChild )
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
do {
|
||||||
std::cerr << " * [BUG] object '" << aNode->GetName();
|
std::ostringstream ostr;
|
||||||
std::cerr << "' is not a valid type for this object (" << aNode->GetNodeType() << ")\n";
|
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
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -388,8 +407,10 @@ bool SGSHAPE::WriteCache( std::ofstream& aFile, SGNODE* parentNode )
|
||||||
if( NULL == m_Parent )
|
if( NULL == m_Parent )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [BUG] corrupt data; m_aParent is NULL\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
ostr << " * [BUG] corrupt data; m_aParent is NULL";
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -406,8 +427,10 @@ bool SGSHAPE::WriteCache( std::ofstream& aFile, SGNODE* parentNode )
|
||||||
if( parentNode != m_Parent )
|
if( parentNode != m_Parent )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [BUG] corrupt data; parentNode != m_aParent\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
ostr << " * [BUG] corrupt data; parentNode != m_aParent";
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -416,8 +439,10 @@ bool SGSHAPE::WriteCache( std::ofstream& aFile, SGNODE* parentNode )
|
||||||
if( !aFile.good() )
|
if( !aFile.good() )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [INFO] bad stream\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
ostr << " * [INFO] bad stream";
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -474,8 +499,10 @@ bool SGSHAPE::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
|
||||||
if( m_Appearance || m_RAppearance || m_FaceSet || m_RFaceSet )
|
if( m_Appearance || m_RAppearance || m_FaceSet || m_RFaceSet )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [BUG] non-empty node\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
ostr << " * [BUG] non-empty node";
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -490,9 +517,11 @@ bool SGSHAPE::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
|
||||||
if( ( items[0] && items[1] ) || ( items[2] && items[3] ) )
|
if( ( items[0] && items[1] ) || ( items[2] && items[3] ) )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [INFO] corrupt data; multiple item definitions at position ";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
std::cerr << aFile.tellg() << "\n";
|
ostr << " * [INFO] corrupt data; multiple item definitions at position ";
|
||||||
|
ostr << aFile.tellg();
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -505,9 +534,11 @@ bool SGSHAPE::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
|
||||||
if( S3D::SGTYPE_APPEARANCE != S3D::ReadTag( aFile, name ) )
|
if( S3D::SGTYPE_APPEARANCE != S3D::ReadTag( aFile, name ) )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [INFO] corrupt data; bad child apperance tag at position ";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
std::cerr << aFile.tellg() << "\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
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -519,9 +550,11 @@ bool SGSHAPE::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
|
||||||
if( !m_Appearance->ReadCache( aFile, this ) )
|
if( !m_Appearance->ReadCache( aFile, this ) )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [INFO] corrupt data while reading appearance '";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
std::cerr << name << "'\n";
|
ostr << " * [INFO] corrupt data while reading appearance '";
|
||||||
|
ostr << name << "'";
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -533,9 +566,11 @@ bool SGSHAPE::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
|
||||||
if( S3D::SGTYPE_APPEARANCE != S3D::ReadTag( aFile, name ) )
|
if( S3D::SGTYPE_APPEARANCE != S3D::ReadTag( aFile, name ) )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [INFO] corrupt data; bad ref appearance tag at position ";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
std::cerr << aFile.tellg() << "\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
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -546,9 +581,11 @@ bool SGSHAPE::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
|
||||||
if( !np )
|
if( !np )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [INFO] corrupt data: cannot find ref appearance '";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
std::cerr << name << "'\n";
|
ostr << " * [INFO] corrupt data: cannot find ref appearance '";
|
||||||
|
ostr << name << "'";
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -557,9 +594,11 @@ bool SGSHAPE::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
|
||||||
if( S3D::SGTYPE_APPEARANCE != np->GetNodeType() )
|
if( S3D::SGTYPE_APPEARANCE != np->GetNodeType() )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [INFO] corrupt data: type is not SGAPPEARANCE '";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
std::cerr << name << "'\n";
|
ostr << " * [INFO] corrupt data: type is not SGAPPEARANCE '";
|
||||||
|
ostr << name << "'";
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -574,9 +613,11 @@ bool SGSHAPE::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
|
||||||
if( S3D::SGTYPE_FACESET != S3D::ReadTag( aFile, name ) )
|
if( S3D::SGTYPE_FACESET != S3D::ReadTag( aFile, name ) )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [INFO] corrupt data; bad child face set tag at position ";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
std::cerr << aFile.tellg() << "\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
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -588,9 +629,11 @@ bool SGSHAPE::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
|
||||||
if( !m_FaceSet->ReadCache( aFile, this ) )
|
if( !m_FaceSet->ReadCache( aFile, this ) )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [INFO] corrupt data while reading face set '";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
std::cerr << name << "'\n";
|
ostr << " * [INFO] corrupt data while reading face set '";
|
||||||
|
ostr << name << "'";
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -602,9 +645,11 @@ bool SGSHAPE::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
|
||||||
if( S3D::SGTYPE_FACESET != S3D::ReadTag( aFile, name ) )
|
if( S3D::SGTYPE_FACESET != S3D::ReadTag( aFile, name ) )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [INFO] corrupt data; bad ref face set tag at position ";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
std::cerr << aFile.tellg() << "\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
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -615,9 +660,11 @@ bool SGSHAPE::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
|
||||||
if( !np )
|
if( !np )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [INFO] corrupt data: cannot find ref face set '";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
std::cerr << name << "'\n";
|
ostr << " * [INFO] corrupt data: cannot find ref face set '";
|
||||||
|
ostr << name << "'";
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -626,9 +673,11 @@ bool SGSHAPE::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
|
||||||
if( S3D::SGTYPE_FACESET != np->GetNodeType() )
|
if( S3D::SGTYPE_FACESET != np->GetNodeType() )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [INFO] corrupt data: type is not SGFACESET '";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
std::cerr << name << "'\n";
|
ostr << " * [INFO] corrupt data: type is not SGFACESET '";
|
||||||
|
ostr << name << "'";
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -667,8 +716,10 @@ bool SGSHAPE::Prepare( const glm::dmat4* aTransform,
|
||||||
if( !pf->validate() )
|
if( !pf->validate() )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [INFO] bad model; inconsistent data\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
ostr << " * [INFO] bad model; inconsistent data";
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -721,9 +772,11 @@ bool SGSHAPE::Prepare( const glm::dmat4* aTransform,
|
||||||
if( nColors < nCoords )
|
if( nColors < nCoords )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [INFO] bad model; not enough colors per vertex (";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
std::cerr << nColors << " vs " << nCoords << ")\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
|
#endif
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -753,8 +806,10 @@ bool SGSHAPE::Prepare( const glm::dmat4* aTransform,
|
||||||
if( vertices.size() < 3 )
|
if( vertices.size() < 3 )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [INFO] bad model; not enough vertices\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
ostr << " * [INFO] bad model; not enough vertices";
|
||||||
|
wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,9 +21,11 @@
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sstream>
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <sstream>
|
||||||
|
#include <wx/log.h>
|
||||||
#include <wx/translation.h>
|
#include <wx/translation.h>
|
||||||
|
|
||||||
#include "plugins/ldr/3d/pluginldr3D.h"
|
#include "plugins/ldr/3d/pluginldr3D.h"
|
||||||
|
|
||||||
#define PLUGIN_CLASS_3D "PLUGIN_3D"
|
#define PLUGIN_CLASS_3D "PLUGIN_3D"
|
||||||
|
@ -72,9 +74,11 @@ bool KICAD_PLUGIN_LDR_3D::Open( const wxString& aFullFileName )
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [INFO] failed on file " << aFullFileName.ToUTF8() << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
std::cerr << " * [INFO] error: " << m_error << "\n";
|
ostr << " * [INFO] failed on file " << aFullFileName.ToUTF8() << "\n";
|
||||||
|
ostr << " * [INFO] error: " << m_error;
|
||||||
|
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -95,10 +99,12 @@ bool KICAD_PLUGIN_LDR_3D::Open( const wxString& aFullFileName )
|
||||||
|
|
||||||
if( !m_getNExtensions )
|
if( !m_getNExtensions )
|
||||||
{
|
{
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
wxString errmsg = _( "incompatible plugin (missing function 'GetNExtensions')" );
|
wxString errmsg = _( "incompatible plugin (missing function 'GetNExtensions')" );
|
||||||
std::cerr << errmsg.ToUTF8() << "\n";
|
ostr << errmsg.ToUTF8() << "\n";
|
||||||
std::cerr << "'" << aFullFileName.ToUTF8() << "'\n";
|
ostr << "'" << aFullFileName.ToUTF8() << "'";
|
||||||
|
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
||||||
fail = true;
|
fail = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,16 +112,20 @@ bool KICAD_PLUGIN_LDR_3D::Open( const wxString& aFullFileName )
|
||||||
{
|
{
|
||||||
if( !fail )
|
if( !fail )
|
||||||
{
|
{
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
wxString errmsg = _( "incompatible plugin (missing function 'GetModelExtension')" );
|
wxString errmsg = _( "incompatible plugin (missing function 'GetModelExtension')" );
|
||||||
std::cerr << errmsg.ToUTF8() << "\n";
|
ostr << errmsg.ToUTF8() << "\n";
|
||||||
std::cerr << "'" << aFullFileName.ToUTF8() << "'\n";
|
ostr << "'" << aFullFileName.ToUTF8() << "'";
|
||||||
|
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
||||||
fail = true;
|
fail = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
std::ostringstream ostr;
|
||||||
wxString errmsg = _( "missing function 'GetModelExtension'" );
|
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 )
|
if( !fail )
|
||||||
{
|
{
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
wxString errmsg = _( "incompatible plugin (missing function 'GetNFilters')" );
|
wxString errmsg = _( "incompatible plugin (missing function 'GetNFilters')" );
|
||||||
std::cerr << errmsg.ToUTF8() << "\n";
|
ostr << errmsg.ToUTF8() << "\n";
|
||||||
std::cerr << "'" << aFullFileName.ToUTF8() << "'\n";
|
ostr << "'" << aFullFileName.ToUTF8() << "'";
|
||||||
|
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
||||||
fail = true;
|
fail = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
std::ostringstream ostr;
|
||||||
wxString errmsg = _( "missing function 'GetNFilters'" );
|
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 )
|
if( !fail )
|
||||||
{
|
{
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
wxString errmsg = _( "incompatible plugin (missing function 'GetFileFilter')" );
|
wxString errmsg = _( "incompatible plugin (missing function 'GetFileFilter')" );
|
||||||
std::cerr << errmsg.ToUTF8() << "\n";
|
ostr << errmsg.ToUTF8() << "\n";
|
||||||
std::cerr << "'" << aFullFileName.ToUTF8() << "'\n";
|
ostr << "'" << aFullFileName.ToUTF8() << "'";
|
||||||
|
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
||||||
fail = true;
|
fail = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
std::ostringstream ostr;
|
||||||
wxString errmsg = _( "missing function 'GetFileFilter'" );
|
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 )
|
if( !fail )
|
||||||
{
|
{
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
wxString errmsg = _( "incompatible plugin (missing function 'CanRender')" );
|
wxString errmsg = _( "incompatible plugin (missing function 'CanRender')" );
|
||||||
std::cerr << errmsg.ToUTF8() << "\n";
|
ostr << errmsg.ToUTF8() << "\n";
|
||||||
std::cerr << "'" << aFullFileName.ToUTF8() << "'\n";
|
ostr << "'" << aFullFileName.ToUTF8() << "'";
|
||||||
|
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
||||||
fail = true;
|
fail = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
std::ostringstream ostr;
|
||||||
wxString errmsg = _( "missing function 'CanRender'" );
|
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 )
|
if( !fail )
|
||||||
{
|
{
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
wxString errmsg = _( "incompatible plugin (missing function 'Load')" );
|
wxString errmsg = _( "incompatible plugin (missing function 'Load')" );
|
||||||
std::cerr << errmsg.ToUTF8() << "\n";
|
ostr << errmsg.ToUTF8() << "\n";
|
||||||
std::cerr << "'" << aFullFileName.ToUTF8() << "'\n";
|
ostr << "'" << aFullFileName.ToUTF8() << "'";
|
||||||
|
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
||||||
fail = true;
|
fail = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
std::ostringstream ostr;
|
||||||
wxString errmsg = _( "missing function 'Load'" );
|
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
|
#ifdef DEBUG
|
||||||
if( ok )
|
if( ok )
|
||||||
{
|
{
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * [INFO] closing plugin\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
ostr << " * [INFO] closing plugin";
|
||||||
|
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -266,8 +294,10 @@ int KICAD_PLUGIN_LDR_3D::GetNExtensions( void )
|
||||||
m_error = "[BUG] GetNExtensions is not linked";
|
m_error = "[BUG] GetNExtensions is not linked";
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * " << m_error << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
ostr << " * " << m_error;
|
||||||
|
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -294,8 +324,10 @@ char const* KICAD_PLUGIN_LDR_3D::GetModelExtension( int aIndex )
|
||||||
m_error = "[BUG] GetModelExtension is not linked";
|
m_error = "[BUG] GetModelExtension is not linked";
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * " << m_error << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
ostr << " * " << m_error;
|
||||||
|
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -322,8 +354,10 @@ int KICAD_PLUGIN_LDR_3D::GetNFilters( void )
|
||||||
m_error = "[BUG] GetNFilters is not linked";
|
m_error = "[BUG] GetNFilters is not linked";
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * " << m_error << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
ostr << " * " << m_error;
|
||||||
|
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -350,8 +384,10 @@ char const* KICAD_PLUGIN_LDR_3D::GetFileFilter( int aIndex )
|
||||||
m_error = "[BUG] GetFileFilter is not linked";
|
m_error = "[BUG] GetFileFilter is not linked";
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * " << m_error << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
ostr << " * " << m_error;
|
||||||
|
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -378,8 +414,10 @@ bool KICAD_PLUGIN_LDR_3D::CanRender( void )
|
||||||
m_error = "[BUG] CanRender is not linked";
|
m_error = "[BUG] CanRender is not linked";
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * " << m_error << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
ostr << " * " << m_error;
|
||||||
|
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -406,8 +444,10 @@ SCENEGRAPH* KICAD_PLUGIN_LDR_3D::Load( char const* aFileName )
|
||||||
m_error = "[BUG] Load is not linked";
|
m_error = "[BUG] Load is not linked";
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * " << m_error << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
ostr << " * " << m_error;
|
||||||
|
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -21,9 +21,10 @@
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sstream>
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <sstream>
|
||||||
#include <wx/dynload.h>
|
#include <wx/dynload.h>
|
||||||
|
#include <wx/log.h>
|
||||||
#include <wx/string.h>
|
#include <wx/string.h>
|
||||||
#include <wx/translation.h>
|
#include <wx/translation.h>
|
||||||
|
|
||||||
|
@ -67,8 +68,10 @@ bool KICAD_PLUGIN_LDR::open( const wxString& aFullFileName, const char* aPluginC
|
||||||
if( !m_PluginLoader.IsLoaded() )
|
if( !m_PluginLoader.IsLoaded() )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * could not open file: '" << aFullFileName.ToUTF8() << "'\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
ostr << " * could not open file: '" << aFullFileName.ToUTF8() << "'";
|
||||||
|
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -84,10 +87,12 @@ bool KICAD_PLUGIN_LDR::open( const wxString& aFullFileName, const char* aPluginC
|
||||||
|
|
||||||
if( !m_getPluginClass )
|
if( !m_getPluginClass )
|
||||||
{
|
{
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
wxString errmsg = _( "incompatible plugin (missing function 'GetKicadPluginClass')" );
|
wxString errmsg = _( "incompatible plugin (missing function 'GetKicadPluginClass')" );
|
||||||
std::cerr << errmsg.ToUTF8() << "\n";
|
ostr << errmsg.ToUTF8() << "\n";
|
||||||
std::cerr << "'" << aFullFileName.ToUTF8() << "'\n";
|
ostr << "'" << aFullFileName.ToUTF8() << "'";
|
||||||
|
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
||||||
fail = true;
|
fail = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,16 +100,20 @@ bool KICAD_PLUGIN_LDR::open( const wxString& aFullFileName, const char* aPluginC
|
||||||
{
|
{
|
||||||
if( !fail )
|
if( !fail )
|
||||||
{
|
{
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
wxString errmsg = _( "incompatible plugin (missing function 'GetClassVersion')" );
|
wxString errmsg = _( "incompatible plugin (missing function 'GetClassVersion')" );
|
||||||
std::cerr << errmsg.ToUTF8() << "\n";
|
ostr << errmsg.ToUTF8() << "\n";
|
||||||
std::cerr << "'" << aFullFileName.ToUTF8() << "'\n";
|
ostr << "'" << aFullFileName.ToUTF8() << "'";
|
||||||
|
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
||||||
fail = true;
|
fail = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
std::ostringstream ostr;
|
||||||
wxString errmsg = _( "missing function 'GetClassVersion'" );
|
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 )
|
if( !fail )
|
||||||
{
|
{
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
wxString errmsg = _( "incompatible plugin (missing function 'CheckClassVersion')" );
|
wxString errmsg = _( "incompatible plugin (missing function 'CheckClassVersion')" );
|
||||||
std::cerr << errmsg.ToUTF8() << "\n";
|
ostr << errmsg.ToUTF8() << "\n";
|
||||||
std::cerr << "'" << aFullFileName.ToUTF8() << "'\n";
|
ostr << "'" << aFullFileName.ToUTF8() << "'";
|
||||||
|
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
||||||
fail = true;
|
fail = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
std::ostringstream ostr;
|
||||||
wxString errmsg = _( "missing function 'CheckClassVersion'" );
|
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 )
|
if( !fail )
|
||||||
{
|
{
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
wxString errmsg = _( "incompatible plugin (missing function 'GetKicadPluginName')" );
|
wxString errmsg = _( "incompatible plugin (missing function 'GetKicadPluginName')" );
|
||||||
std::cerr << errmsg.ToUTF8() << "\n";
|
ostr << errmsg.ToUTF8() << "\n";
|
||||||
std::cerr << "'" << aFullFileName.ToUTF8() << "'\n";
|
ostr << "'" << aFullFileName.ToUTF8() << "'";
|
||||||
|
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
||||||
fail = true;
|
fail = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
std::ostringstream ostr;
|
||||||
wxString errmsg = _( "missing function 'GetKicadPluginName'" );
|
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 )
|
if( !fail )
|
||||||
{
|
{
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
wxString errmsg = _( "incompatible plugin (missing function 'GetVersion')" );
|
wxString errmsg = _( "incompatible plugin (missing function 'GetVersion')" );
|
||||||
std::cerr << errmsg.ToUTF8() << "\n";
|
ostr << errmsg.ToUTF8() << "\n";
|
||||||
std::cerr << "'" << aFullFileName.ToUTF8() << "'\n";
|
ostr << "'" << aFullFileName.ToUTF8() << "'";
|
||||||
|
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
||||||
fail = true;
|
fail = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
std::ostringstream ostr;
|
||||||
wxString errmsg = _( "missing function 'GetVersion'" );
|
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;
|
m_fileName = aFullFileName;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
do {
|
||||||
std::cerr << " * [INFO] opened plugin " << m_fileName.ToUTF8() << "\n";
|
std::ostringstream ostr;
|
||||||
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
ostr << " * [INFO] opened plugin " << m_fileName.ToUTF8();
|
||||||
char const* cp = m_getPluginName();
|
char const* cp = m_getPluginName();
|
||||||
|
|
||||||
if( !cp )
|
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
|
#endif
|
||||||
|
|
||||||
ok = true;
|
ok = true;
|
||||||
|
@ -305,8 +332,10 @@ char const* KICAD_PLUGIN_LDR::GetKicadPluginClass( void )
|
||||||
m_error = "[BUG] GetPluginClass is not linked";
|
m_error = "[BUG] GetPluginClass is not linked";
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * " << m_error << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
ostr << " * " << m_error;
|
||||||
|
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -351,8 +380,10 @@ bool KICAD_PLUGIN_LDR::GetClassVersion( unsigned char* Major, unsigned char* Min
|
||||||
m_error = "[BUG] CheckClassVersion is not linked";
|
m_error = "[BUG] CheckClassVersion is not linked";
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * " << m_error << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
ostr << " * " << m_error;
|
||||||
|
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -394,8 +425,10 @@ bool KICAD_PLUGIN_LDR::CheckClassVersion( unsigned char Major, unsigned char Min
|
||||||
m_error = "[BUG] CheckClassVersion is not linked";
|
m_error = "[BUG] CheckClassVersion is not linked";
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * " << m_error << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
ostr << " * " << m_error;
|
||||||
|
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -422,8 +455,10 @@ const char* KICAD_PLUGIN_LDR::GetKicadPluginName( void )
|
||||||
m_error = "[BUG] GetKicadPluginName is not linked";
|
m_error = "[BUG] GetKicadPluginName is not linked";
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * " << m_error << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
ostr << " * " << m_error;
|
||||||
|
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -451,8 +486,10 @@ bool KICAD_PLUGIN_LDR::GetVersion( unsigned char* Major, unsigned char* Minor,
|
||||||
m_error = "[BUG] GetKicadPluginName is not linked";
|
m_error = "[BUG] GetKicadPluginName is not linked";
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
std::ostringstream ostr;
|
||||||
std::cerr << " * " << m_error << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
ostr << " * " << m_error;
|
||||||
|
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -31,8 +31,11 @@
|
||||||
#define PLUGINLDR_H
|
#define PLUGINLDR_H
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <wx/string.h>
|
|
||||||
#include <wx/dynlib.h>
|
#include <wx/dynlib.h>
|
||||||
|
#include <wx/string.h>
|
||||||
|
|
||||||
|
#define MASK_PLUGINLDR "PLUGIN_LOADER"
|
||||||
|
|
||||||
|
|
||||||
// helper function to link functions in the plugin
|
// helper function to link functions in the plugin
|
||||||
#define LINK_ITEM( funcPtr, funcType, funcName ) \
|
#define LINK_ITEM( funcPtr, funcType, funcName ) \
|
||||||
|
|
Loading…
Reference in New Issue