Work in progress: checking debug output messages, internationalizing user info messages

This commit is contained in:
Cirilo Bernardo 2016-01-12 17:09:04 +11:00
parent 217a5f39e1
commit 3a5110f74a
25 changed files with 771 additions and 51 deletions

View File

@ -101,8 +101,10 @@ static bool isMD5null( const unsigned char* aMD5Sum )
{
if( NULL == aMD5Sum )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] NULL passed for aMD5Sum\n";
#endif
return false;
}
@ -160,8 +162,10 @@ void S3D_CACHE_ENTRY::SetMD5( const unsigned char* aMD5Sum )
{
if( NULL == aMD5Sum )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] NULL passed for aMD5Sum\n";
#endif
return;
}
@ -258,16 +262,17 @@ SCENEGRAPH* S3D_CACHE::checkCache( const wxString& aFileName, S3D_CACHE_ENTRY**
if( m_CacheMap.insert( std::pair< wxString, S3D_CACHE_ENTRY* >
( aFileName, ep ) ).second == false )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] duplicate entry in map file; key = ";
std::cerr << aFileName.ToUTF8() << "\n";
#endif
m_CacheList.pop_back();
delete ep;
}
else
{
std::cerr << " * [3D Model] [0] added cached name '" << aFileName.ToUTF8() << "'\n";
if( aCachePtr )
*aCachePtr = ep;
@ -282,17 +287,16 @@ SCENEGRAPH* S3D_CACHE::checkCache( const wxString& aFileName, S3D_CACHE_ENTRY**
if( m_CacheMap.insert( std::pair< wxString, S3D_CACHE_ENTRY* >
( aFileName, ep ) ).second == false )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] duplicate entry in map file; key = ";
std::cerr << aFileName.ToUTF8() << "\n";
#endif
m_CacheList.pop_back();
delete ep;
return NULL;
}
else
{
std::cerr << " * [3D Model] [1] added cached name '" << aFileName.ToUTF8() << "'\n";
}
if( aCachePtr )
*aCachePtr = ep;
@ -321,25 +325,28 @@ bool S3D_CACHE::getMD5( const wxString& aFileName, unsigned char* aMD5Sum )
{
if( aFileName.empty() )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] empty filename\n";
#endif
return false;
}
if( NULL == aMD5Sum )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] NULL pointer passed for aMD5Sum\n";
#endif
return false;
}
FILE* fp = fopen( aFileName.ToUTF8(), "rb" );
if( !fp )
{
std::cerr << " * [3dmodel] could not open file '" << aFileName.ToUTF8() << "'\n";
return false;
}
struct md5_ctx msum;
md5_init_ctx( &msum );
@ -348,7 +355,10 @@ bool S3D_CACHE::getMD5( const wxString& aFileName, unsigned char* aMD5Sum )
if( 0 != res )
{
#ifdef DEBUG
std::cerr << " * [3dmodel] md5 calculation failed on file '" << aFileName.ToUTF8() << "'\n";
#endif
return false;
}
@ -362,13 +372,18 @@ bool S3D_CACHE::loadCacheData( S3D_CACHE_ENTRY* aCacheItem )
if( bname.empty() )
{
#ifdef DEBUG
std::cerr << " * [3D model] cannot load cached model; no md5 hash available\n";
#endif
return false;
}
if( m_CacheDir.empty() )
{
std::cerr << " * [3D model] cannot load cached model; config directory unknown\n";
wxString errmsg = _( "cannot load cached model; config directory unknown" );
std::cerr << " * [3D model] " << errmsg.ToUTF8() << "\n";
return false;
}
@ -376,7 +391,8 @@ bool S3D_CACHE::loadCacheData( S3D_CACHE_ENTRY* aCacheItem )
if( !wxFileName::FileExists( fname ) )
{
std::cerr << " * [3D model] cannot open file '";
wxString errmsg = _( "cannot open file" );
std::cerr << " * [3D model] " << errmsg.ToUTF8() << " '";
std::cerr << fname.ToUTF8() << "'\n";
return false;
}
@ -397,15 +413,21 @@ bool S3D_CACHE::saveCacheData( S3D_CACHE_ENTRY* aCacheItem )
{
if( NULL == aCacheItem )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * NULL passed for aCacheItem\n";
#endif
return false;
}
if( NULL == aCacheItem->sceneData )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * aCacheItem has no valid scene data\n";
#endif
return false;
}
@ -413,13 +435,18 @@ bool S3D_CACHE::saveCacheData( S3D_CACHE_ENTRY* aCacheItem )
if( bname.empty() )
{
#ifdef DEBUG
std::cerr << " * [3D model] cannot load cached model; no md5 hash available\n";
#endif
return false;
}
if( m_CacheDir.empty() )
{
std::cerr << " * [3D model] cannot load cached model; config directory unknown\n";
wxString errmsg = _( "cannot load cached model; config directory unknown" );
std::cerr << " * [3D model] " << errmsg.ToUTF8() << "\n";
return false;
}
@ -435,8 +462,10 @@ bool S3D_CACHE::saveCacheData( S3D_CACHE_ENTRY* aCacheItem )
if( !S_ISREG( info.st_mode ) )
{
std::cerr << " * [3D model] path exists but is not a regular file: '";
wxString errmsg = _( "path exists but is not a regular file" );
std::cerr << " * [3D model] " << errmsg.ToUTF8() << " '";
std::cerr << fname.ToUTF8() << "'\n";
return false;
}
@ -463,9 +492,12 @@ bool S3D_CACHE::Set3DConfigDir( const wxString& aConfigDir )
if( !cfgdir.DirExists() )
{
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * failed to create 3D configuration directory\n";
std::cerr << " * config directory: '";
wxString errmsg = _( "failed to create 3D configuration directory" );
std::cerr << " * " << errmsg.ToUTF8() << "\n";
errmsg = _( "config directory" );
std::cerr << " * " << errmsg.ToUTF8() << " '";
std::cerr << cfgdir.GetPath().ToUTF8() << "'\n";
return false;
}
}
@ -475,9 +507,11 @@ bool S3D_CACHE::Set3DConfigDir( const wxString& aConfigDir )
// inform the file resolver of the config directory
if( !m_FNResolver->Set3DConfigDir( m_ConfigDir ) )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * could not set 3D Config Directory on filename resolver\n";
std::cerr << " * config directory: '" << m_ConfigDir.ToUTF8() << "'\n";
#endif
}
cfgdir.AppendDir( wxT( "cache" ) );
@ -489,9 +523,12 @@ bool S3D_CACHE::Set3DConfigDir( const wxString& aConfigDir )
if( !cfgdir.DirExists() )
{
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * failed to create 3D cache directory\n";
std::cerr << " * cache directory: '";
wxString errmsg = _( "failed to create 3D cache directory" );
std::cerr << " * " << errmsg.ToUTF8() << "\n";
errmsg = _( "cache directory" );
std::cerr << " * " << errmsg.ToUTF8() << " '";
std::cerr << cfgdir.GetPath().ToUTF8() << "'\n";
return false;
}
}
@ -543,8 +580,10 @@ wxString S3D_CACHE::Get3DConfigDir( bool createDefault )
if( !cfgpath.DirExists() )
{
wxString errmsg = _( "failed to create 3D configuration directory" );
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * failed to create 3D configuration directory\n";
std::cerr << " * " << errmsg.ToUTF8() << "\n";
return wxT( "" );
}
@ -636,8 +675,11 @@ S3DMODEL* S3D_CACHE::GetModel( const wxString& aModelFileName )
if( !cp )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] model loaded with no associated S3D_CACHE_ENTRY\n";
#endif
return NULL;
}

View File

@ -160,14 +160,6 @@ bool S3D_FILENAME_RESOLVER::UpdatePathList( std::vector< wxString >& aPathList )
for( size_t i = 0; i < nI; ++i )
addPath( aPathList[i] );
#ifdef DEBUG
std::cerr << "* S3D_FILENAME_RESOLVER::UpdatePathList()\n";
std::cerr << "NItems: " << aPathList.size() << "\n";
for( size_t i = 0; i < aPathList.size(); ++i )
std::cerr << "Item #" << i << ": " << aPathList[i].ToUTF8() << "\n";
#endif
return writePathList();
}
@ -235,7 +227,8 @@ wxString S3D_FILENAME_RESOLVER::ResolvePath( const wxString& aFileName )
++sPL;
}
std::cerr << " * [3D Model] filename could not be resolved: '";
wxString errmsg = _( "filename could not be resolved" );
std::cerr << " * [3D Model] " << errmsg.ToUTF8() << " '";
std::cerr << aFileName.ToUTF8() << "'\n";
return wxEmptyString;
@ -269,7 +262,9 @@ bool S3D_FILENAME_RESOLVER::addPath( const wxString& aPath )
if( !path.DirExists() )
{
std::cerr << " * [3D Model] invalid path: '" << path.GetPath().ToUTF8() << "'\n";
wxString errmsg = _( "invalid path" );
std::cerr << " * [3D Model] " << errmsg.ToUTF8() << " '" << path.GetPath().ToUTF8() << "'\n";
return false;
}
@ -295,7 +290,8 @@ bool S3D_FILENAME_RESOLVER::readPathList( void )
if( m_ConfigDir.empty() )
{
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * 3D configuration directory is unknown\n";
wxString errmsg = _( "3D configuration directory is unknown" );
std::cerr << " * " << errmsg.ToUTF8() << "\n";
return false;
}
@ -311,7 +307,8 @@ bool S3D_FILENAME_RESOLVER::readPathList( void )
if( !wxFileName::Exists( cfgname ) )
{
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * no 3D configuration file: '";
wxString errmsg = _( "no 3D configuration file" );
std::cerr << " * " << errmsg.ToUTF8() << " '";
std::cerr << cfgname.ToUTF8() << "'\n";
return false;
}
@ -321,7 +318,8 @@ bool S3D_FILENAME_RESOLVER::readPathList( void )
if( !cfgFile.is_open() )
{
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * could not open configuration file '" << cfgname.ToUTF8() << "'\n";
wxString errmsg = _( "could not open configuration file" );
std::cerr << " * " << errmsg.ToUTF8() << " '" << cfgname.ToUTF8() << "'\n";
return false;
}
@ -347,8 +345,8 @@ bool S3D_FILENAME_RESOLVER::readPathList( void )
if( std::string::npos == spos )
{
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * bad config entry in config file '" << cfgname.ToUTF8() << "'\n";
std::cerr << " line " << lineno << " [missing opening quote mark]\n";
wxString errmsg = _( "missing opening quote mark in config file" );
std::cerr << " * " << errmsg.ToUTF8() << " '" << cfgname.ToUTF8() << "'\n";
}
cfgLine.erase( 0, spos + 1 );
@ -358,8 +356,8 @@ bool S3D_FILENAME_RESOLVER::readPathList( void )
if( std::string::npos == spos )
{
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * bad config entry in config file '" << cfgname.ToUTF8() << "'\n";
std::cerr << " line " << lineno << " [missing closing quote mark]\n";
wxString errmsg = _( "missing closing quote mark in config file" );
std::cerr << " * " << errmsg.ToUTF8() << " '" << cfgname.ToUTF8() << "'\n";
}
cfgLine.erase( spos );
@ -367,9 +365,8 @@ bool S3D_FILENAME_RESOLVER::readPathList( void )
if( !addPath( cfgLine ) )
{
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * bad config entry in config file '" << cfgname.ToUTF8() << "'\n";
std::cerr << " line " << lineno << " [not a valid path]: '";
std::cerr << cfgLine << "'\n";
wxString errmsg = _( "invalid path in config file" );
std::cerr << " * " << errmsg.ToUTF8() << " '" << cfgname.ToUTF8() << "'\n";
mod = true;
}
}
@ -391,7 +388,8 @@ bool S3D_FILENAME_RESOLVER::writePathList( void )
if( m_ConfigDir.empty() )
{
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * 3D configuration directory is unknown\n";
wxString errmsg = _( "3D configuration directory is unknown" );
std::cerr << " * " << errmsg.ToUTF8() << "\n";
return false;
}
@ -407,7 +405,8 @@ bool S3D_FILENAME_RESOLVER::writePathList( void )
if( !cfgFile.is_open() )
{
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * could not open configuration file '" << cfgname.ToUTF8() << "'\n";
wxString errmsg = _( "could not open configuration file " );
std::cerr << " * " << errmsg.ToUTF8() << " '" << cfgname.ToUTF8() << "'\n";
return false;
}

View File

@ -24,8 +24,8 @@
#include <3d_model_viewer/c3d_model_viewer.h>
#include <3d_rendering/3d_render_ogl_legacy/c_ogl_3dmodel.h>
#include <common_ogl/cogl_att_list.h>
#include <iostream>
#include <cstdlib>
#include <wx/log.h>
#include <wx/sizer.h>
#include <wx/valnum.h>
#include <wx/choice.h>
@ -701,8 +701,9 @@ void PANEL_PREV_3D::getOrientationVars( SGPOINT& scale, SGPOINT& rotation, SGPOI
if( 0.001 > scale.x || 0.001 > scale.y || 0.001 > scale.z )
{
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] invalid scale values; setting all to 1.0\n";
wxString errmsg = _("[INFO] invalid scale values; setting all to 1.0");
wxLogMessage( "%s", errmsg.ToUTF8() );
scale.x = 1.0;
scale.y = 1.0;
scale.z = 1.0;

View File

@ -44,7 +44,9 @@
#include "plugins/3dapi/c3dmodel.h"
#ifdef DEBUG
static char BadNode[] = " * [BUG] NULL pointer passed for aNode\n";
#endif
static void formatMaterial( SMATERIAL& mat, SGAPPEARANCE const* app )
{
@ -111,15 +113,21 @@ bool S3D::WriteVRML( const wxString& filename, bool overwrite, SGNODE* aTopNode,
if( NULL == aTopNode )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] NULL pointer passed for aTopNode\n";
#endif
return false;
}
if( S3D::SGTYPE_TRANSFORM != aTopNode->GetNodeType() )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] aTopNode is not a SCENEGRAPH object\n";
#endif
return false;
}
@ -131,7 +139,8 @@ bool S3D::WriteVRML( const wxString& filename, bool overwrite, SGNODE* aTopNode,
if( !op.is_open() )
{
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] failed to open file '" << filename.ToUTF8() << "'\n";
wxString errmsg = _( "failed to open file" );
std::cerr << " * [INFO] " << errmsg.ToUTF8() << " '" << filename.ToUTF8() << "'\n";
return false;
}
@ -152,8 +161,11 @@ bool S3D::WriteVRML( const wxString& filename, bool overwrite, SGNODE* aTopNode,
}
op.close();
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] problems encountered writing file '" << filename.ToUTF8() << "'\n";
wxString errmsg = _( "problems encountered writing file" );
std::cerr << " * [INFO] " << errmsg.ToUTF8() << " '" << filename.ToUTF8() << "'\n";
return false;
}
@ -162,8 +174,11 @@ void S3D::ResetNodeIndex( SGNODE* aNode )
{
if( NULL == aNode )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << BadNode;
#endif
return;
}
@ -177,8 +192,11 @@ void S3D::RenameNodes( SGNODE* aNode )
{
if( NULL == aNode )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << BadNode;
#endif
return;
}
@ -192,8 +210,11 @@ void S3D::DestroyNode( SGNODE* aNode )
{
if( NULL == aNode )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << BadNode;
#endif
return;
}
@ -207,8 +228,11 @@ bool S3D::WriteCache( const wxString& aFileName, bool overwrite, SGNODE* aNode )
{
if( NULL == aNode )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << BadNode;
#endif
return false;
}
@ -218,7 +242,8 @@ bool S3D::WriteCache( const wxString& aFileName, bool overwrite, SGNODE* aNode )
if( !overwrite )
{
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] file exists; not overwriting: '";
wxString errmsg = _( "file exists; not overwriting" );
std::cerr << " * [INFO] " << errmsg.ToUTF8() << " '";
std::cerr << aFileName.ToUTF8() << "'\n";
return false;
}
@ -227,7 +252,8 @@ bool S3D::WriteCache( const wxString& aFileName, bool overwrite, SGNODE* aNode )
if( !wxFileName::FileExists( aFileName ) )
{
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] specified path is a directory: '";
wxString errmsg = _( "specified path is a directory" );
std::cerr << " * [INFO] " << errmsg.ToUTF8() << " '";
std::cerr << aFileName.ToUTF8() << "'\n";
return false;
}
@ -240,19 +266,22 @@ bool S3D::WriteCache( const wxString& aFileName, bool overwrite, SGNODE* aNode )
if( !output.is_open() )
{
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] failed to open file '" << aFileName.ToUTF8() << "'\n";
wxString errmsg = _( "failed to open file" );
std::cerr << " * [INFO] " << errmsg.ToUTF8() << " '" << aFileName.ToUTF8() << "'\n";
return false;
}
bool rval = aNode->WriteCache( output, NULL );
output.close();
#ifdef DEBUG
if( !rval )
{
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] problems encountered writing cache file '";
std::cerr << aFileName.ToUTF8() << "'\n";
}
#endif
return rval;
}
@ -263,7 +292,8 @@ SGNODE* S3D::ReadCache( const wxString& aFileName )
if( !wxFileName::FileExists( aFileName ) )
{
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] no such file: '";
wxString errmsg = _( "no such file" );
std::cerr << " * [INFO] " << errmsg.ToUTF8() << " '";
std::cerr << aFileName.ToUTF8() << "'\n";
}
@ -271,8 +301,10 @@ SGNODE* S3D::ReadCache( const wxString& aFileName )
if( NULL == np )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] failed to instantiate SCENEGRAPH\n";
#endif
return NULL;
}
@ -283,7 +315,8 @@ SGNODE* S3D::ReadCache( const wxString& aFileName )
{
delete np;
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] failed to open file '";
wxString errmsg = _( "failed to open file" );
std::cerr << " * [INFO] " << " '";
std::cerr << aFileName.ToUTF8() << "'\n";
return NULL;
}
@ -295,7 +328,8 @@ SGNODE* S3D::ReadCache( const wxString& aFileName )
{
delete np;
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] problems encountered reading cache file '";
wxString errmsg = _( "problems encountered reading cache file" );
std::cerr << " * [INFO] " << errmsg.ToUTF8() << " '";
std::cerr << aFileName.ToUTF8() << "'\n";
return NULL;
}

View File

@ -59,8 +59,12 @@ IFSG_APPEARANCE::IFSG_APPEARANCE( SGNODE* aParent )
{
delete m_node;
m_node = NULL;
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << WrongParent << "\n";
#endif
return;
}
@ -75,11 +79,13 @@ IFSG_APPEARANCE::IFSG_APPEARANCE( IFSG_NODE& aParent )
{
SGNODE* pp = aParent.GetRawPtr();
#ifdef DEBUG
if( ! pp )
{
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << BadParent << "\n";
}
#endif
m_node = new SGAPPEARANCE( NULL );
@ -89,8 +95,12 @@ IFSG_APPEARANCE::IFSG_APPEARANCE( IFSG_NODE& aParent )
{
delete m_node;
m_node = NULL;
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << WrongParent << "\n";
#endif
return;
}
@ -132,10 +142,13 @@ bool IFSG_APPEARANCE::NewNode( SGNODE* aParent )
if( aParent != m_node->GetParent() )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] invalid SGNODE parent (";
std::cerr << aParent->GetNodeTypeName( aParent->GetNodeType() );
std::cerr << ") to SGAPPEARANCE\n";
#endif
delete m_node;
m_node = NULL;
return false;
@ -153,8 +166,11 @@ bool IFSG_APPEARANCE::NewNode( IFSG_NODE& aParent )
if( NULL == np )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << BadParent << "\n";
#endif
return false;
}
@ -166,8 +182,11 @@ bool IFSG_APPEARANCE::SetEmissive( float aRVal, float aGVal, float aBVal )
{
if( NULL == m_node )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << BadObject << "\n";
#endif
return false;
}
@ -179,8 +198,11 @@ bool IFSG_APPEARANCE::SetEmissive( const SGCOLOR* aRGBColor )
{
if( NULL == m_node )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << BadObject << "\n";
#endif
return false;
}
@ -192,8 +214,11 @@ bool IFSG_APPEARANCE::SetEmissive( const SGCOLOR& aRGBColor )
{
if( NULL == m_node )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << BadObject << "\n";
#endif
return false;
}
@ -205,8 +230,11 @@ bool IFSG_APPEARANCE::SetDiffuse( float aRVal, float aGVal, float aBVal )
{
if( NULL == m_node )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << BadObject << "\n";
#endif
return false;
}
@ -218,8 +246,11 @@ bool IFSG_APPEARANCE::SetDiffuse( const SGCOLOR* aRGBColor )
{
if( NULL == m_node )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << BadObject << "\n";
#endif
return false;
}
@ -231,8 +262,11 @@ bool IFSG_APPEARANCE::SetDiffuse( const SGCOLOR& aRGBColor )
{
if( NULL == m_node )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << BadObject << "\n";
#endif
return false;
}
@ -244,8 +278,11 @@ bool IFSG_APPEARANCE::SetSpecular( float aRVal, float aGVal, float aBVal )
{
if( NULL == m_node )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << BadObject << "\n";
#endif
return false;
}
@ -257,8 +294,11 @@ bool IFSG_APPEARANCE::SetSpecular( const SGCOLOR* aRGBColor )
{
if( NULL == m_node )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << BadObject << "\n";
#endif
return false;
}
@ -270,8 +310,11 @@ bool IFSG_APPEARANCE::SetSpecular( const SGCOLOR& aRGBColor )
{
if( NULL == m_node )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << BadObject << "\n";
#endif
return false;
}
@ -283,15 +326,21 @@ bool IFSG_APPEARANCE::SetAmbient( float aAmbientLight )
{
if( NULL == m_node )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << BadObject << "\n";
#endif
return false;
}
if( aAmbientLight < 0 || aAmbientLight > 1.0 )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] ambient intensity out of range [0..1]\n";
#endif
return false;
}
@ -304,15 +353,21 @@ bool IFSG_APPEARANCE::SetShininess( float aShininess )
{
if( NULL == m_node )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << BadObject << "\n";
#endif
return false;
}
if( aShininess < 0 || aShininess > 1.0 )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] shininess out of range [0..1]\n";
#endif
return false;
}
@ -326,15 +381,21 @@ bool IFSG_APPEARANCE::SetTransparency( float aTransparency )
{
if( NULL == m_node )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << BadObject << "\n";
#endif
return false;
}
if( aTransparency < 0 || aTransparency > 1.0 )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] shininess out of range [0..1]\n";
#endif
return false;
}

View File

@ -57,8 +57,12 @@ IFSG_COLORS::IFSG_COLORS( SGNODE* aParent )
{
delete m_node;
m_node = NULL;
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << WrongParent << "\n";
#endif
return;
}
@ -73,11 +77,13 @@ IFSG_COLORS::IFSG_COLORS( IFSG_NODE& aParent )
{
SGNODE* pp = aParent.GetRawPtr();
#ifdef DEBUG
if( ! pp )
{
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << BadParent << "\n";
}
#endif
m_node = new SGCOLORS( NULL );
@ -87,8 +93,12 @@ IFSG_COLORS::IFSG_COLORS( IFSG_NODE& aParent )
{
delete m_node;
m_node = NULL;
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << WrongParent << "\n";
#endif
return;
}
@ -130,10 +140,13 @@ bool IFSG_COLORS::NewNode( SGNODE* aParent )
if( aParent != m_node->GetParent() )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] invalid SGNODE parent (";
std::cerr << aParent->GetNodeTypeName( aParent->GetNodeType() );
std::cerr << ") to SGCOLORS\n";
#endif
delete m_node;
m_node = NULL;
return false;
@ -151,8 +164,11 @@ bool IFSG_COLORS::NewNode( IFSG_NODE& aParent )
if( NULL == np )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << BadParent << "\n";
#endif
return false;
}
@ -164,8 +180,11 @@ bool IFSG_COLORS::GetColorList( size_t& aListSize, SGCOLOR*& aColorList )
{
if( NULL == m_node )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << BadObject << "\n";
#endif
return false;
}
@ -177,8 +196,11 @@ bool IFSG_COLORS::SetColorList( size_t aListSize, const SGCOLOR* aColorList )
{
if( NULL == m_node )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << BadObject << "\n";
#endif
return false;
}
@ -192,8 +214,11 @@ bool IFSG_COLORS::AddColor( double aRedValue, double aGreenValue, double aBlueVa
{
if( NULL == m_node )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << BadObject << "\n";
#endif
return false;
}
@ -207,8 +232,11 @@ bool IFSG_COLORS::AddColor( const SGCOLOR& aColor )
{
if( NULL == m_node )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << BadObject << "\n";
#endif
return false;
}

View File

@ -58,8 +58,12 @@ IFSG_COORDINDEX::IFSG_COORDINDEX( SGNODE* aParent )
{
delete m_node;
m_node = NULL;
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << WrongParent << "\n";
#endif
return;
}
@ -75,8 +79,11 @@ IFSG_COORDINDEX::IFSG_COORDINDEX( IFSG_NODE& aParent )
if( !pp )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << BadParent << "\n";
#endif
return;
}
@ -84,8 +91,11 @@ IFSG_COORDINDEX::IFSG_COORDINDEX( IFSG_NODE& aParent )
if( !m_node->SetParent( pp ) )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << WrongParent << "\n";
#endif
delete m_node;
m_node = NULL;
return;
@ -128,10 +138,13 @@ bool IFSG_COORDINDEX::NewNode( SGNODE* aParent )
if( aParent != m_node->GetParent() )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] invalid SGNODE parent (";
std::cerr << aParent->GetNodeTypeName( aParent->GetNodeType() );
std::cerr << ") to SGCOORDINDEX\n";
#endif
delete m_node;
m_node = NULL;
return false;
@ -149,8 +162,11 @@ bool IFSG_COORDINDEX::NewNode( IFSG_NODE& aParent )
if( NULL == np )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << BadParent << "\n";
#endif
return false;
}

View File

@ -57,8 +57,12 @@ IFSG_COORDS::IFSG_COORDS( SGNODE* aParent )
{
delete m_node;
m_node = NULL;
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << WrongParent << "\n";
#endif
return;
}
@ -73,11 +77,13 @@ IFSG_COORDS::IFSG_COORDS( IFSG_NODE& aParent )
{
SGNODE* pp = aParent.GetRawPtr();
#ifdef DEBUG
if( ! pp )
{
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << BadParent << "\n";
}
#endif
m_node = new SGCOORDS( NULL );
@ -87,8 +93,12 @@ IFSG_COORDS::IFSG_COORDS( IFSG_NODE& aParent )
{
delete m_node;
m_node = NULL;
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << WrongParent << "\n";
#endif
return;
}
@ -130,10 +140,13 @@ bool IFSG_COORDS::NewNode( SGNODE* aParent )
if( aParent != m_node->GetParent() )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] invalid SGNODE parent (";
std::cerr << aParent->GetNodeTypeName( aParent->GetNodeType() );
std::cerr << ") to SGCOORDS\n";
#endif
delete m_node;
m_node = NULL;
return false;
@ -151,8 +164,11 @@ bool IFSG_COORDS::NewNode( IFSG_NODE& aParent )
if( NULL == np )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << BadParent << "\n";
#endif
return false;
}
@ -164,8 +180,11 @@ bool IFSG_COORDS::GetCoordsList( size_t& aListSize, SGPOINT*& aCoordsList )
{
if( NULL == m_node )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << BadObject << "\n";
#endif
return false;
}
@ -177,8 +196,11 @@ bool IFSG_COORDS::SetCoordsList( size_t aListSize, const SGPOINT* aCoordsList )
{
if( NULL == m_node )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << BadObject << "\n";
#endif
return false;
}
@ -192,8 +214,11 @@ bool IFSG_COORDS::AddCoord( double aXValue, double aYValue, double aZValue )
{
if( NULL == m_node )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << BadObject << "\n";
#endif
return false;
}
@ -207,8 +232,11 @@ bool IFSG_COORDS::AddCoord( const SGPOINT& aPoint )
{
if( NULL == m_node )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << BadObject << "\n";
#endif
return false;
}

View File

@ -58,8 +58,12 @@ IFSG_FACESET::IFSG_FACESET( SGNODE* aParent )
{
delete m_node;
m_node = NULL;
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << WrongParent << "\n";
#endif
return;
}
@ -74,11 +78,13 @@ IFSG_FACESET::IFSG_FACESET( IFSG_NODE& aParent )
{
SGNODE* pp = aParent.GetRawPtr();
#ifdef DEBUG
if( ! pp )
{
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << BadParent << "\n";
}
#endif
m_node = new SGFACESET( NULL );
@ -88,8 +94,12 @@ IFSG_FACESET::IFSG_FACESET( IFSG_NODE& aParent )
{
delete m_node;
m_node = NULL;
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << WrongParent << "\n";
#endif
return;
}
@ -131,10 +141,13 @@ bool IFSG_FACESET::NewNode( SGNODE* aParent )
if( aParent != m_node->GetParent() )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] invalid SGNODE parent (";
std::cerr << aParent->GetNodeTypeName( aParent->GetNodeType() );
std::cerr << ") to SGFACESET\n";
#endif
delete m_node;
m_node = NULL;
return false;
@ -152,8 +165,11 @@ bool IFSG_FACESET::NewNode( IFSG_NODE& aParent )
if( NULL == np )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << BadParent << "\n";
#endif
return false;
}

View File

@ -43,8 +43,11 @@ bool IFSG_INDEX::GetIndices( size_t& nIndices, int*& aIndexList )
{
if( NULL == m_node )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << BadObject << "\n";
#endif
return false;
}
@ -56,8 +59,11 @@ bool IFSG_INDEX::SetIndices( size_t nIndices, int* aIndexList )
{
if( NULL == m_node )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << BadObject << "\n";
#endif
return false;
}
@ -71,8 +77,11 @@ bool IFSG_INDEX::AddIndex( int aIndex )
{
if( NULL == m_node )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << BadObject << "\n";
#endif
return false;
}

View File

@ -70,8 +70,11 @@ S3D::SGTYPES IFSG_NODE::GetNodeType( void ) const
{
if( NULL == m_node )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << BadObject << "\n";
#endif
return S3D::SGTYPE_END;
}
@ -83,8 +86,11 @@ SGNODE* IFSG_NODE::GetParent( void ) const
{
if( NULL == m_node )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << BadObject << "\n";
#endif
return NULL;
}
@ -96,8 +102,11 @@ bool IFSG_NODE::SetParent( SGNODE* aParent )
{
if( NULL == m_node )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << BadObject << "\n";
#endif
return false;
}
@ -109,8 +118,11 @@ const char* IFSG_NODE::GetName( void )
{
if( NULL == m_node )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << BadObject << "\n";
#endif
return NULL;
}
@ -122,8 +134,11 @@ bool IFSG_NODE::SetName( const char *aName )
{
if( NULL == m_node )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << BadObject << "\n";
#endif
return false;
}
@ -136,8 +151,11 @@ const char * IFSG_NODE::GetNodeTypeName( S3D::SGTYPES aNodeType ) const
{
if( NULL == m_node )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << BadObject << "\n";
#endif
return NULL;
}
@ -149,8 +167,11 @@ SGNODE* IFSG_NODE::FindNode( const char *aNodeName )
{
if( NULL == m_node )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << BadObject << "\n";
#endif
return NULL;
}
@ -162,8 +183,11 @@ bool IFSG_NODE::AddRefNode( SGNODE* aNode )
{
if( NULL == m_node )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << BadObject << "\n";
#endif
return false;
}
@ -175,8 +199,11 @@ bool IFSG_NODE::AddRefNode( IFSG_NODE& aNode )
{
if( NULL == m_node )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << BadObject << "\n";
#endif
return false;
}
@ -184,8 +211,11 @@ bool IFSG_NODE::AddRefNode( IFSG_NODE& aNode )
if( NULL == np )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << BadOperand << "\n";
#endif
return false;
}
@ -197,8 +227,11 @@ bool IFSG_NODE::AddChildNode( SGNODE* aNode )
{
if( NULL == m_node )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << BadObject << "\n";
#endif
return false;
}
@ -210,8 +243,11 @@ bool IFSG_NODE::AddChildNode( IFSG_NODE& aNode )
{
if( NULL == m_node )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << BadObject << "\n";
#endif
return false;
}
@ -219,8 +255,11 @@ bool IFSG_NODE::AddChildNode( IFSG_NODE& aNode )
if( NULL == np )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << BadOperand << "\n";
#endif
return false;
}

View File

@ -59,8 +59,12 @@ IFSG_NORMALS::IFSG_NORMALS( SGNODE* aParent )
{
delete m_node;
m_node = NULL;
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << WrongParent << "\n";
#endif
return;
}
@ -75,11 +79,13 @@ IFSG_NORMALS::IFSG_NORMALS( IFSG_NODE& aParent )
{
SGNODE* pp = aParent.GetRawPtr();
#ifdef DEBUG
if( ! pp )
{
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << BadParent << "\n";
}
#endif
m_node = new SGNORMALS( NULL );
@ -89,8 +95,12 @@ IFSG_NORMALS::IFSG_NORMALS( IFSG_NODE& aParent )
{
delete m_node;
m_node = NULL;
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << WrongParent << "\n";
#endif
return;
}
@ -132,10 +142,13 @@ bool IFSG_NORMALS::NewNode( SGNODE* aParent )
if( aParent != m_node->GetParent() )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] invalid SGNODE parent (";
std::cerr << aParent->GetNodeTypeName( aParent->GetNodeType() );
std::cerr << ") to SGNORMALS\n";
#endif
delete m_node;
m_node = NULL;
return false;
@ -153,8 +166,11 @@ bool IFSG_NORMALS::NewNode( IFSG_NODE& aParent )
if( NULL == np )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << BadParent << "\n";
#endif
return false;
}
@ -166,8 +182,11 @@ bool IFSG_NORMALS::GetNormalList( size_t& aListSize, SGVECTOR*& aNormalList )
{
if( NULL == m_node )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << BadObject << "\n";
#endif
return false;
}
@ -179,8 +198,11 @@ bool IFSG_NORMALS::SetNormalList( size_t aListSize, const SGVECTOR* aNormalList
{
if( NULL == m_node )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << BadObject << "\n";
#endif
return false;
}
@ -193,8 +215,11 @@ bool IFSG_NORMALS::AddNormal( double aXValue, double aYValue, double aZValue )
{
if( NULL == m_node )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << BadObject << "\n";
#endif
return false;
}
@ -207,8 +232,11 @@ bool IFSG_NORMALS::AddNormal( const SGVECTOR& aNormal )
{
if( NULL == m_node )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << BadObject << "\n";
#endif
return false;
}

View File

@ -59,8 +59,12 @@ IFSG_SHAPE::IFSG_SHAPE( SGNODE* aParent )
{
delete m_node;
m_node = NULL;
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << WrongParent << "\n";
#endif
return;
}
@ -75,11 +79,13 @@ IFSG_SHAPE::IFSG_SHAPE( IFSG_NODE& aParent )
{
SGNODE* pp = aParent.GetRawPtr();
#ifdef DEBUG
if( ! pp )
{
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << BadParent << "\n";
}
#endif
m_node = new SGSHAPE( NULL );
@ -89,8 +95,12 @@ IFSG_SHAPE::IFSG_SHAPE( IFSG_NODE& aParent )
{
delete m_node;
m_node = NULL;
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << WrongParent << "\n";
#endif
return;
}
@ -132,10 +142,13 @@ bool IFSG_SHAPE::NewNode( SGNODE* aParent )
if( aParent != m_node->GetParent() )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] invalid SGNODE parent (";
std::cerr << aParent->GetNodeTypeName( aParent->GetNodeType() );
std::cerr << ") to SGSHAPE\n";
#endif
delete m_node;
m_node = NULL;
return false;
@ -153,8 +166,11 @@ bool IFSG_SHAPE::NewNode( IFSG_NODE& aParent )
if( NULL == np )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << BadParent << "\n";
#endif
return false;
}

View File

@ -58,8 +58,12 @@ IFSG_TRANSFORM::IFSG_TRANSFORM( SGNODE* aParent )
{
delete m_node;
m_node = NULL;
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << WrongParent << "\n";
#endif
return;
}
@ -101,10 +105,13 @@ bool IFSG_TRANSFORM::NewNode( SGNODE* aParent )
if( aParent != m_node->GetParent() )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] invalid SGNODE parent (";
std::cerr << aParent->GetNodeTypeName( aParent->GetNodeType() );
std::cerr << ") to SCENEGRAPH\n";
#endif
delete m_node;
m_node = NULL;
return false;
@ -122,8 +129,11 @@ bool IFSG_TRANSFORM::NewNode( IFSG_NODE& aParent )
if( NULL == np )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << BadParent << "\n";
#endif
return false;
}
@ -135,8 +145,11 @@ bool IFSG_TRANSFORM::SetRotation( const SGVECTOR& aRotationAxis, double aAngle )
{
if( NULL == m_node )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << BadObject << "\n";
#endif
return false;
}
@ -151,8 +164,11 @@ bool IFSG_TRANSFORM::SetScale( const SGPOINT& aScale )
{
if( NULL == m_node )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << BadObject << "\n";
#endif
return false;
}
@ -166,15 +182,21 @@ bool IFSG_TRANSFORM::SetScale( double aScale )
{
if( NULL == m_node )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << BadObject << "\n";
#endif
return false;
}
if( aScale < 1e-8 && aScale > -1e-8 )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] |scale| is < 1e-8 - this seems strange\n";
#endif
return false;
}
@ -188,8 +210,11 @@ bool IFSG_TRANSFORM::SetTranslation( const SGPOINT& aTranslation )
{
if( NULL == m_node )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << BadObject << "\n";
#endif
return false;
}
@ -203,8 +228,11 @@ bool IFSG_TRANSFORM::SetScaleOrientation( const SGVECTOR& aScaleAxis, double aAn
{
if( NULL == m_node )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << BadObject << "\n";
#endif
return false;
}
@ -219,8 +247,11 @@ bool IFSG_TRANSFORM::SetCenter( const SGPOINT& aCenter )
{
if( NULL == m_node )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << BadObject << "\n";
#endif
return false;
}

View File

@ -132,8 +132,10 @@ void SCENEGRAPH::unlinkNode( const SGNODE* aNode, bool isChild )
UNLINK_NODE( S3D::SGTYPE_TRANSFORM, SCENEGRAPH, aNode, m_Transforms, m_RTransforms, isChild );
UNLINK_NODE( S3D::SGTYPE_SHAPE, SGSHAPE, aNode, m_Shape, m_RShape, isChild );
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] unlinkNode() did not find its target\n";
#endif
return;
}
@ -157,17 +159,23 @@ bool SCENEGRAPH::addNode( SGNODE* aNode, bool isChild )
{
if( NULL == aNode )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] NULL pointer passed for aNode\n";
#endif
return false;
}
ADD_NODE( S3D::SGTYPE_TRANSFORM, SCENEGRAPH, aNode, m_Transforms, m_RTransforms, isChild );
ADD_NODE( S3D::SGTYPE_SHAPE, SGSHAPE, aNode, m_Shape, m_RShape, isChild );
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] object '" << aNode->GetName();
std::cerr << "' is not a valid type for this object (" << aNode->GetNodeType() << ")\n";
#endif
return false;
}
@ -333,8 +341,11 @@ bool SCENEGRAPH::WriteCache( std::ofstream& aFile, SGNODE* parentNode )
if( parentNode != m_Parent )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] corrupt data; parentNode != m_aParent\n";
#endif
return false;
}
@ -347,8 +358,11 @@ bool SCENEGRAPH::WriteCache( std::ofstream& aFile, SGNODE* parentNode )
if( aFile.fail() )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] bad stream\n";
#endif
return false;
}
@ -378,8 +392,11 @@ bool SCENEGRAPH::WriteCache( std::ofstream& aFile, SGNODE* parentNode )
{
if( !m_Transforms[i]->WriteCache( aFile, this ) )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] bad stream while writing child transforms\n";
#endif
return false;
}
}
@ -395,8 +412,11 @@ bool SCENEGRAPH::WriteCache( std::ofstream& aFile, SGNODE* parentNode )
{
if( !m_Shape[i]->WriteCache( aFile, this ) )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] bad stream while writing child shapes\n";
#endif
return false;
}
}
@ -418,8 +438,11 @@ bool SCENEGRAPH::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
if( !m_Transforms.empty() || !m_RTransforms.empty()
|| !m_Shape.empty() || !m_RShape.empty() )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] non-empty node\n";
#endif
return false;
}
@ -430,9 +453,12 @@ bool SCENEGRAPH::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
// we need to read the tag and verify its type
if( S3D::SGTYPE_TRANSFORM != S3D::ReadTag( aFile, name ) )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] corrupt data; tag mismatch at position ";
std::cerr << aFile.tellg() << "\n";
#endif
return false;
}
@ -465,9 +491,12 @@ bool SCENEGRAPH::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
{
if( S3D::SGTYPE_TRANSFORM != S3D::ReadTag( aFile, name ) )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] corrupt data; bad child transform tag at position ";
std::cerr << aFile.tellg() << "\n";
#endif
return false;
}
@ -476,9 +505,12 @@ bool SCENEGRAPH::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
if( !sp->ReadCache( aFile, this ) )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] corrupt data while reading transform '";
std::cerr << name << "'\n";
#endif
return false;
}
}
@ -488,9 +520,12 @@ bool SCENEGRAPH::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
{
if( S3D::SGTYPE_TRANSFORM != S3D::ReadTag( aFile, name ) )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] corrupt data; bad ref transform tag at position ";
std::cerr << aFile.tellg() << "\n";
#endif
return false;
}
@ -498,17 +533,23 @@ bool SCENEGRAPH::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
if( !sp )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] corrupt data: cannot find ref transform '";
std::cerr << name << "'\n";
#endif
return false;
}
if( S3D::SGTYPE_TRANSFORM != sp->GetNodeType() )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] corrupt data: type is not TRANSFORM '";
std::cerr << name << "'\n";
#endif
return false;
}
@ -520,9 +561,12 @@ bool SCENEGRAPH::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
{
if( S3D::SGTYPE_SHAPE != S3D::ReadTag( aFile, name ) )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] corrupt data; bad child shape tag at position ";
std::cerr << aFile.tellg() << "\n";
#endif
return false;
}
@ -531,9 +575,12 @@ bool SCENEGRAPH::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
if( !sp->ReadCache( aFile, this ) )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] corrupt data while reading shape '";
std::cerr << name << "'\n";
#endif
return false;
}
}
@ -543,9 +590,12 @@ bool SCENEGRAPH::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
{
if( S3D::SGTYPE_SHAPE != S3D::ReadTag( aFile, name ) )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] corrupt data; bad ref shape tag at position ";
std::cerr << aFile.tellg() << "\n";
#endif
return false;
}
@ -553,17 +603,23 @@ bool SCENEGRAPH::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
if( !sp )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] corrupt data: cannot find ref shape '";
std::cerr << name << "'\n";
#endif
return false;
}
if( S3D::SGTYPE_SHAPE != sp->GetNodeType() )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] corrupt data: type is not SGSHAPE '";
std::cerr << name << "'\n";
#endif
return false;
}

View File

@ -102,8 +102,11 @@ bool SGAPPEARANCE::SetEmissive( const SGCOLOR* aRGBColor )
{
if( NULL == aRGBColor )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] NULL pointer passed for aRGBColor\n";
#endif
return false;
}
@ -127,8 +130,11 @@ bool SGAPPEARANCE::SetDiffuse( const SGCOLOR* aRGBColor )
{
if( NULL == aRGBColor )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] NULL pointer passed for aRGBColor\n";
#endif
return false;
}
@ -152,8 +158,11 @@ bool SGAPPEARANCE::SetSpecular( const SGCOLOR* aRGBColor )
{
if( NULL == aRGBColor )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] NULL pointer passed for aRGBColor\n";
#endif
return false;
}
@ -180,32 +189,44 @@ SGNODE* SGAPPEARANCE::FindNode(const char *aNodeName, const SGNODE *aCaller)
void SGAPPEARANCE::unlinkChildNode( const SGNODE* aCaller )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] unexpected code branch; node should have no children or refs\n";
#endif
return;
}
void SGAPPEARANCE::unlinkRefNode( const SGNODE* aCaller )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] unexpected code branch; node should have no children or refs\n";
#endif
return;
}
bool SGAPPEARANCE::AddRefNode( SGNODE* aNode )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] this node does not accept children or refs\n";
#endif
return false;
}
bool SGAPPEARANCE::AddChildNode( SGNODE* aNode )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] this node does not accept children or refs\n";
#endif
return false;
}
@ -289,8 +310,11 @@ bool SGAPPEARANCE::WriteCache( std::ofstream& aFile, SGNODE* parentNode )
{
if( NULL == m_Parent )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] corrupt data; m_aParent is NULL\n";
#endif
return false;
}
@ -304,15 +328,21 @@ bool SGAPPEARANCE::WriteCache( std::ofstream& aFile, SGNODE* parentNode )
if( parentNode != m_Parent )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] corrupt data; parentNode != m_aParent\n";
#endif
return false;
}
if( !aFile.good() )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] bad stream\n";
#endif
return false;
}

View File

@ -79,8 +79,11 @@ void SGCOLOR::GetColor( SGCOLOR* aColor ) const
{
if( NULL == aColor )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] NULL pointer passed for aColor\n";
#endif
return;
}
@ -117,8 +120,11 @@ bool SGCOLOR::SetColor( const SGCOLOR* aColor )
{
if( NULL == aColor )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] NULL pointer passed for aColor\n";
#endif
return false;
}
@ -209,8 +215,11 @@ void SGPOINT::GetPoint( SGPOINT* aPoint )
{
if( NULL == aPoint )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] NULL pointer passed for aPoint\n";
#endif
return;
}

View File

@ -99,32 +99,44 @@ SGNODE* SGCOLORS::FindNode(const char *aNodeName, const SGNODE *aCaller)
void SGCOLORS::unlinkChildNode( const SGNODE* aCaller )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] unexpected code branch; node should have no children or refs\n";
#endif
return;
}
void SGCOLORS::unlinkRefNode( const SGNODE* aCaller )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] unexpected code branch; node should have no children or refs\n";
#endif
return;
}
bool SGCOLORS::AddRefNode( SGNODE* aNode )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] this node does not accept children or refs\n";
#endif
return false;
}
bool SGCOLORS::AddChildNode( SGNODE* aNode )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] this node does not accept children or refs\n";
#endif
return false;
}
@ -246,8 +258,11 @@ bool SGCOLORS::WriteCache( std::ofstream& aFile, SGNODE* parentNode )
{
if( NULL == m_Parent )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] corrupt data; m_aParent is NULL\n";
#endif
return false;
}
@ -261,15 +276,21 @@ bool SGCOLORS::WriteCache( std::ofstream& aFile, SGNODE* parentNode )
if( parentNode != m_Parent )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] corrupt data; parentNode != m_aParent\n";
#endif
return false;
}
if( !aFile.good() )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] bad stream\n";
#endif
return false;
}
@ -291,8 +312,11 @@ bool SGCOLORS::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
{
if( !colors.empty() )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] non-empty node\n";
#endif
return false;
}

View File

@ -102,32 +102,44 @@ SGNODE* SGCOORDS::FindNode(const char *aNodeName, const SGNODE *aCaller)
void SGCOORDS::unlinkChildNode( const SGNODE* aCaller )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] unexpected code branch; node should have no children or refs\n";
#endif
return;
}
void SGCOORDS::unlinkRefNode( const SGNODE* aCaller )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] unexpected code branch; node should have no children or refs\n";
#endif
return;
}
bool SGCOORDS::AddRefNode( SGNODE* aNode )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] this node does not accept children or refs\n";
#endif
return false;
}
bool SGCOORDS::AddChildNode( SGNODE* aNode )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] this node does not accept children or refs\n";
#endif
return false;
}
@ -247,8 +259,11 @@ bool SGCOORDS::WriteCache( std::ofstream& aFile, SGNODE* parentNode )
{
if( NULL == m_Parent )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] corrupt data; m_aParent is NULL\n";
#endif
return false;
}
@ -262,15 +277,21 @@ bool SGCOORDS::WriteCache( std::ofstream& aFile, SGNODE* parentNode )
if( parentNode != m_Parent )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] corrupt data; parentNode != m_aParent\n";
#endif
return false;
}
if( !aFile.good() )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] bad stream\n";
#endif
return false;
}
@ -292,8 +313,11 @@ bool SGCOORDS::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
{
if( !coords.empty() )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] non-empty node\n";
#endif
return false;
}

View File

@ -251,8 +251,10 @@ void SGFACESET::unlinkNode( const SGNODE* aNode, bool isChild )
}
}
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] unlinkNode() did not find its target\n";
#endif
return;
}
@ -277,8 +279,11 @@ bool SGFACESET::addNode( SGNODE* aNode, bool isChild )
{
if( NULL == aNode )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] NULL pointer passed for aNode\n";
#endif
return false;
}
@ -291,8 +296,11 @@ bool SGFACESET::addNode( SGNODE* aNode, bool isChild )
{
if( aNode != m_Colors && aNode != m_RColors )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] assigning multiple Colors nodes\n";
#endif
return false;
}
@ -319,8 +327,11 @@ bool SGFACESET::addNode( SGNODE* aNode, bool isChild )
{
if( aNode != m_Coords && aNode != m_RCoords )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] assigning multiple Coords nodes\n";
#endif
return false;
}
@ -347,8 +358,11 @@ bool SGFACESET::addNode( SGNODE* aNode, bool isChild )
{
if( aNode != m_Normals && aNode != m_RNormals )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] assigning multiple Normals nodes\n";
#endif
return false;
}
@ -375,8 +389,11 @@ bool SGFACESET::addNode( SGNODE* aNode, bool isChild )
{
if( aNode != m_CoordIndices )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] assigning multiple CoordIndex nodes\n";
#endif
return false;
}
@ -389,10 +406,12 @@ bool SGFACESET::addNode( SGNODE* aNode, bool isChild )
return true;
}
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] object '" << aNode->GetName();
std::cerr << "' (type " << aNode->GetNodeType();
std::cerr << ") is not a valid type for this object (" << aNode->GetNodeType() << ")\n";
#endif
return false;
}
@ -501,8 +520,11 @@ bool SGFACESET::WriteCache( std::ofstream& aFile, SGNODE* parentNode )
{
if( NULL == m_Parent )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] corrupt data; m_aParent is NULL\n";
#endif
return false;
}
@ -516,15 +538,21 @@ bool SGFACESET::WriteCache( std::ofstream& aFile, SGNODE* parentNode )
if( parentNode != m_Parent )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] corrupt data; parentNode != m_aParent\n";
#endif
return false;
}
if( !aFile.good() )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] bad stream\n";
#endif
return false;
}
@ -601,8 +629,11 @@ bool SGFACESET::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
|| m_Colors || m_RColors
|| m_Normals || m_RNormals )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] non-empty node\n";
#endif
return false;
}
@ -615,9 +646,12 @@ bool SGFACESET::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
if( ( items[0] && items[1] ) || ( items[3] && items[4] )
|| ( items[5] && items[6] ) )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] corrupt data; multiple item definitions at position ";
std::cerr << aFile.tellg() << "\n";
#endif
return false;
}
@ -627,9 +661,12 @@ bool SGFACESET::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
{
if( S3D::SGTYPE_COORDS != S3D::ReadTag( aFile, name ) )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] corrupt data; bad child coords tag at position ";
std::cerr << aFile.tellg() << "\n";
#endif
return false;
}
@ -638,9 +675,12 @@ bool SGFACESET::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
if( !m_Coords->ReadCache( aFile, this ) )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] corrupt data while reading coords '";
std::cerr << name << "'\n";
#endif
return false;
}
}
@ -649,9 +689,12 @@ bool SGFACESET::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
{
if( S3D::SGTYPE_COORDS != S3D::ReadTag( aFile, name ) )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] corrupt data; bad ref coords tag at position ";
std::cerr << aFile.tellg() << "\n";
#endif
return false;
}
@ -659,17 +702,23 @@ bool SGFACESET::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
if( !np )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] corrupt data: cannot find ref coords '";
std::cerr << name << "'\n";
#endif
return false;
}
if( S3D::SGTYPE_COORDS != np->GetNodeType() )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] corrupt data: type is not SGCOORDS '";
std::cerr << name << "'\n";
#endif
return false;
}
@ -681,9 +730,12 @@ bool SGFACESET::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
{
if( S3D::SGTYPE_COORDINDEX != S3D::ReadTag( aFile, name ) )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] corrupt data; bad coord index tag at position ";
std::cerr << aFile.tellg() << "\n";
#endif
return false;
}
@ -692,9 +744,12 @@ bool SGFACESET::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
if( !m_CoordIndices->ReadCache( aFile, this ) )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] corrupt data while reading coord index '";
std::cerr << name << "'\n";
#endif
return false;
}
}
@ -703,9 +758,12 @@ bool SGFACESET::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
{
if( S3D::SGTYPE_NORMALS != S3D::ReadTag( aFile, name ) )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] corrupt data; bad child normals tag at position ";
std::cerr << aFile.tellg() << "\n";
#endif
return false;
}
@ -714,9 +772,12 @@ bool SGFACESET::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
if( !m_Normals->ReadCache( aFile, this ) )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] corrupt data while reading normals '";
std::cerr << name << "'\n";
#endif
return false;
}
}
@ -725,9 +786,12 @@ bool SGFACESET::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
{
if( S3D::SGTYPE_NORMALS != S3D::ReadTag( aFile, name ) )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] corrupt data; bad ref normals tag at position ";
std::cerr << aFile.tellg() << "\n";
#endif
return false;
}
@ -735,17 +799,23 @@ bool SGFACESET::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
if( !np )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] corrupt data: cannot find ref normals '";
std::cerr << name << "'\n";
#endif
return false;
}
if( S3D::SGTYPE_NORMALS != np->GetNodeType() )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] corrupt data: type is not SGNORMALS '";
std::cerr << name << "'\n";
#endif
return false;
}
@ -757,9 +827,12 @@ bool SGFACESET::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
{
if( S3D::SGTYPE_COLORS != S3D::ReadTag( aFile, name ) )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] corrupt data; bad child colors tag at position ";
std::cerr << aFile.tellg() << "\n";
#endif
return false;
}
@ -768,9 +841,12 @@ bool SGFACESET::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
if( !m_Colors->ReadCache( aFile, this ) )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] corrupt data while reading colors '";
std::cerr << name << "'\n";
#endif
return false;
}
}
@ -779,9 +855,12 @@ bool SGFACESET::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
{
if( S3D::SGTYPE_COLORS != S3D::ReadTag( aFile, name ) )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] corrupt data; bad ref colors tag at position ";
std::cerr << aFile.tellg() << "\n";
#endif
return false;
}
@ -789,17 +868,23 @@ bool SGFACESET::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
if( !np )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] corrupt data: cannot find ref colors '";
std::cerr << name << "'\n";
#endif
return false;
}
if( S3D::SGTYPE_COLORS != np->GetNodeType() )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] corrupt data: type is not SGCOLORS '";
std::cerr << name << "'\n";
#endif
return false;
}

View File

@ -208,9 +208,12 @@ S3D::SGTYPES S3D::ReadTag( std::ifstream& aFile, std::string& aName )
if( '[' != schar )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] corrupt data; missing left bracket at position ";
std::cerr << aFile.tellg() << "\n";
#endif
return S3D::SGTYPE_END;
}
@ -225,8 +228,11 @@ S3D::SGTYPES S3D::ReadTag( std::ifstream& aFile, std::string& aName )
if( schar != ']' )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] corrupt data; could not find right bracket\n";
#endif
return S3D::SGTYPE_END;
}
@ -235,9 +241,12 @@ S3D::SGTYPES S3D::ReadTag( std::ifstream& aFile, std::string& aName )
if( std::string::npos == upos )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] corrupt data; no underscore in name '";
std::cerr << name << "'\n";
#endif
return S3D::SGTYPE_END;
}
@ -260,9 +269,12 @@ S3D::SGTYPES S3D::ReadTag( std::ifstream& aFile, std::string& aName )
return types[i];
}
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] corrupt data; no node type matching '";
std::cerr << name << "'\n";
#endif
return S3D::SGTYPE_END;
}
@ -491,8 +503,11 @@ bool S3D::CalcTriangleNormals( std::vector< SGPOINT > coords,
if( norms.size() != coords.size() )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] number of normals does not equal number of vertices\n";
#endif
return false;
}

View File

@ -94,32 +94,44 @@ SGNODE* SGINDEX::FindNode(const char *aNodeName, const SGNODE *aCaller)
void SGINDEX::unlinkChildNode( const SGNODE* aCaller )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] unexpected code branch; node should have no children or refs\n";
#endif
return;
}
void SGINDEX::unlinkRefNode( const SGNODE* aCaller )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] unexpected code branch; node should have no children or refs\n";
#endif
return;
}
bool SGINDEX::AddRefNode( SGNODE* aNode )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] this node does not accept children or refs\n";
#endif
return false;
}
bool SGINDEX::AddChildNode( SGNODE* aNode )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] this node does not accept children or refs\n";
#endif
return false;
}
@ -188,8 +200,11 @@ bool SGINDEX::writeCoordIndex( std::ofstream& aFile )
if( n % 3 )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] coord index is not divisible by three (violates triangle constraint)\n";
#endif
return false;
}
@ -271,8 +286,11 @@ bool SGINDEX::WriteCache( std::ofstream& aFile, SGNODE* parentNode )
{
if( NULL == m_Parent )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] corrupt data; m_aParent is NULL\n";
#endif
return false;
}
@ -286,15 +304,21 @@ bool SGINDEX::WriteCache( std::ofstream& aFile, SGNODE* parentNode )
if( parentNode != m_Parent )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] corrupt data; parentNode != m_aParent\n";
#endif
return false;
}
if( !aFile.good() )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] bad stream\n";
#endif
return false;
}
@ -316,8 +340,11 @@ bool SGINDEX::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
{
if( !index.empty() )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] non-empty node\n";
#endif
return false;
}

View File

@ -166,8 +166,10 @@ void SGNODE::delNodeRef( SGNODE* aNode )
return;
}
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] delNodeRef() did not find its target\n";
#endif
return;
}
@ -177,15 +179,21 @@ void SGNODE::AssociateWrapper( SGNODE** aWrapperRef )
{
if( NULL == aWrapperRef )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] NULL handle\n";
#endif
return;
}
if( *aWrapperRef != this )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] handle value does not match this object's pointer\n";
#endif
return;
}
@ -194,8 +202,11 @@ void SGNODE::AssociateWrapper( SGNODE** aWrapperRef )
if( m_Association )
{
*m_Association = NULL;
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [WARNING] association being broken with previous wrapper\n";
#endif
}
m_Association = aWrapperRef;
@ -210,13 +221,17 @@ void SGNODE::DisassociateWrapper( SGNODE** aWrapperRef )
if( !aWrapperRef )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] invalid handle value aWrapperRef\n";
#endif
return;
}
if( *aWrapperRef != *m_Association || aWrapperRef != m_Association )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] *aWrapperRef (" << *aWrapperRef;
std::cerr << ") does not match *m_Association (" << *m_Association << ") in type ";
@ -224,6 +239,8 @@ void SGNODE::DisassociateWrapper( SGNODE** aWrapperRef )
std::cerr << " * [INFO] OR aWrapperRef(" << aWrapperRef << ") != m_Association(";
std::cerr << m_Association << ")\n";
std::cerr << " * [INFO] node name: " << GetName() << "\n";
#endif
return;
}
@ -248,6 +265,7 @@ bool S3D::GetMatIndex( MATLIST& aList, SGNODE* aNode, int& aIndex )
if( NULL == aNode || S3D::SGTYPE_APPEARANCE != aNode->GetNodeType() )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
if( NULL == aNode )
@ -259,6 +277,7 @@ bool S3D::GetMatIndex( MATLIST& aList, SGNODE* aNode, int& aIndex )
std::cerr << " * [BUG] invalid node type (" << aNode->GetNodeType();
std::cerr << "), expected " << S3D::SGTYPE_APPEARANCE << "\n";
}
#endif
return false;
}

View File

@ -100,32 +100,44 @@ SGNODE* SGNORMALS::FindNode(const char *aNodeName, const SGNODE *aCaller)
void SGNORMALS::unlinkChildNode( const SGNODE* aCaller )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] unexpected code branch; node should have no children or refs\n";
#endif
return;
}
void SGNORMALS::unlinkRefNode( const SGNODE* aCaller )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] unexpected code branch; node should have no children or refs\n";
#endif
return;
}
bool SGNORMALS::AddRefNode( SGNODE* aNode )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] this node does not accept children or refs\n";
#endif
return false;
}
bool SGNORMALS::AddChildNode( SGNODE* aNode )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] this node does not accept children or refs\n";
#endif
return false;
}
@ -245,8 +257,11 @@ bool SGNORMALS::WriteCache( std::ofstream& aFile, SGNODE* parentNode )
{
if( NULL == m_Parent )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] corrupt data; m_aParent is NULL\n";
#endif
return false;
}
@ -260,15 +275,21 @@ bool SGNORMALS::WriteCache( std::ofstream& aFile, SGNODE* parentNode )
if( parentNode != m_Parent )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] corrupt data; parentNode != m_aParent\n";
#endif
return false;
}
if( !aFile.good() )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] bad stream\n";
#endif
return false;
}
@ -290,8 +311,11 @@ bool SGNORMALS::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
{
if( !norms.empty() )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] non-empty node\n";
#endif
return false;
}

View File

@ -196,8 +196,10 @@ void SGSHAPE::unlinkNode( const SGNODE* aNode, bool isChild )
}
}
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] unlinkNode() did not find its target\n";
#endif
return;
}
@ -221,8 +223,11 @@ bool SGSHAPE::addNode( SGNODE* aNode, bool isChild )
{
if( NULL == aNode )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] NULL pointer passed for aNode\n";
#endif
return false;
}
@ -232,8 +237,11 @@ bool SGSHAPE::addNode( SGNODE* aNode, bool isChild )
{
if( aNode != m_Appearance && aNode != m_RAppearance )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] assigning multiple Appearance nodes\n";
#endif
return false;
}
@ -260,8 +268,11 @@ bool SGSHAPE::addNode( SGNODE* aNode, bool isChild )
{
if( aNode != m_FaceSet && aNode != m_RFaceSet )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] assigning multiple FaceSet nodes\n";
#endif
return false;
}
@ -282,9 +293,12 @@ bool SGSHAPE::addNode( SGNODE* aNode, bool isChild )
return true;
}
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] object '" << aNode->GetName();
std::cerr << "' is not a valid type for this object (" << aNode->GetNodeType() << ")\n";
#endif
return false;
}
@ -373,8 +387,11 @@ bool SGSHAPE::WriteCache( std::ofstream& aFile, SGNODE* parentNode )
{
if( NULL == m_Parent )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] corrupt data; m_aParent is NULL\n";
#endif
return false;
}
@ -388,15 +405,21 @@ bool SGSHAPE::WriteCache( std::ofstream& aFile, SGNODE* parentNode )
if( parentNode != m_Parent )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] corrupt data; parentNode != m_aParent\n";
#endif
return false;
}
if( !aFile.good() )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] bad stream\n";
#endif
return false;
}
@ -450,8 +473,11 @@ bool SGSHAPE::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
{
if( m_Appearance || m_RAppearance || m_FaceSet || m_RFaceSet )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [BUG] non-empty node\n";
#endif
return false;
}
@ -463,9 +489,12 @@ bool SGSHAPE::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
if( ( items[0] && items[1] ) || ( items[2] && items[3] ) )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] corrupt data; multiple item definitions at position ";
std::cerr << aFile.tellg() << "\n";
#endif
return false;
}
@ -475,9 +504,12 @@ bool SGSHAPE::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
{
if( S3D::SGTYPE_APPEARANCE != S3D::ReadTag( aFile, name ) )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] corrupt data; bad child apperance tag at position ";
std::cerr << aFile.tellg() << "\n";
#endif
return false;
}
@ -486,9 +518,12 @@ bool SGSHAPE::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
if( !m_Appearance->ReadCache( aFile, this ) )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] corrupt data while reading appearance '";
std::cerr << name << "'\n";
#endif
return false;
}
}
@ -497,9 +532,12 @@ bool SGSHAPE::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
{
if( S3D::SGTYPE_APPEARANCE != S3D::ReadTag( aFile, name ) )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] corrupt data; bad ref appearance tag at position ";
std::cerr << aFile.tellg() << "\n";
#endif
return false;
}
@ -507,17 +545,23 @@ bool SGSHAPE::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
if( !np )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] corrupt data: cannot find ref appearance '";
std::cerr << name << "'\n";
#endif
return false;
}
if( S3D::SGTYPE_APPEARANCE != np->GetNodeType() )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] corrupt data: type is not SGAPPEARANCE '";
std::cerr << name << "'\n";
#endif
return false;
}
@ -529,9 +573,12 @@ bool SGSHAPE::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
{
if( S3D::SGTYPE_FACESET != S3D::ReadTag( aFile, name ) )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] corrupt data; bad child face set tag at position ";
std::cerr << aFile.tellg() << "\n";
#endif
return false;
}
@ -540,9 +587,12 @@ bool SGSHAPE::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
if( !m_FaceSet->ReadCache( aFile, this ) )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] corrupt data while reading face set '";
std::cerr << name << "'\n";
#endif
return false;
}
}
@ -551,9 +601,12 @@ bool SGSHAPE::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
{
if( S3D::SGTYPE_FACESET != S3D::ReadTag( aFile, name ) )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] corrupt data; bad ref face set tag at position ";
std::cerr << aFile.tellg() << "\n";
#endif
return false;
}
@ -561,17 +614,23 @@ bool SGSHAPE::ReadCache( std::ifstream& aFile, SGNODE* parentNode )
if( !np )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] corrupt data: cannot find ref face set '";
std::cerr << name << "'\n";
#endif
return false;
}
if( S3D::SGTYPE_FACESET != np->GetNodeType() )
{
#ifdef DEBUG
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
std::cerr << " * [INFO] corrupt data: type is not SGFACESET '";
std::cerr << name << "'\n";
#endif
return false;
}