39    ambient.SetColor( 0.05317f, 0.17879f, 0.01804f );
 
   42    diffuse.SetColor( 0.8f, 0.8f, 0.8f );
 
   48        wxLogTrace( MASK_3D_SG,
 
   49                    wxT( 
"%s:%s:%d * [BUG] inappropriate parent to SGAPPEARANCE (type %s )" ),
 
   50                    __FILE__, __FUNCTION__, __LINE__, aParent->GetNodeType() );
 
   54        m_Parent->AddChildNode( this );
 
 
   77        if( 
nullptr == aParent )
 
 
   96    return emissive.SetColor( aRVal, aGVal, aBVal );
 
 
  102    wxCHECK_MSG( aRGBColor, 
false, wxT( 
"NULL pointer passed for aRGBColor" ) );
 
  104    return emissive.SetColor( aRGBColor );
 
 
  110    return emissive.SetColor( aRGBColor );
 
 
  116    return diffuse.SetColor( aRVal, aGVal, aBVal );
 
 
  122    wxCHECK_MSG( aRGBColor, 
false, wxT( 
"NULL pointer passed for aRGBColor" ) );
 
  124    return diffuse.SetColor( aRGBColor );
 
 
  130    return diffuse.SetColor( aRGBColor );
 
 
  136    return specular.SetColor( aRVal, aGVal, aBVal );
 
 
  142    wxCHECK_MSG( aRGBColor, 
false, wxT( 
"NULL pointer passed for aRGBColor" ) );
 
  144    return specular.SetColor( aRGBColor );
 
 
  149    return specular.SetColor( aRGBColor );
 
 
  155    return ambient.SetColor( aRVal, aGVal, aBVal );
 
 
  161    wxCHECK_MSG( aRGBColor, 
false, wxT( 
"NULL pointer passed for aRGBColor" ) );
 
  163    return ambient.SetColor( aRGBColor );
 
 
  169    return ambient.SetColor( aRGBColor );
 
 
  175    if( 
nullptr == aNodeName || 0 == aNodeName[0] )
 
  178    if( !
m_Name.compare( aNodeName ) )
 
 
  187    wxCHECK_MSG( aCaller, ,
 
  188                 wxT( 
"unexpected code branch; node should have no children or refs" ) );
 
 
  194    wxCHECK_MSG( aCaller, ,
 
  195                 wxT( 
"unexpected code branch; node should have no children or refs" ) );
 
 
  201    wxCHECK_MSG( aNode, 
false, wxT( 
"this node does not accept children or refs" ) );
 
 
  210    wxCHECK_MSG( aNode, 
false, wxT( 
"this node does not accept children or refs" ) );
 
 
  233            aFile << 
" appearance DEF " << 
GetName() << 
" Appearance {\n";
 
  238            aFile << 
" appearance USE " << 
GetName() << 
"\n";
 
  244        aFile << 
" appearance Appearance {\n";
 
  247    aFile << 
"  material Material {\n";
 
  250    float ambr, ambg, ambb;
 
  251    ambient.GetColor( ambr, ambg, ambb );
 
  252    float amb = ( 0.212671 * ambr + 0.71516 * ambg + 0.072169 * ambb );
 
  253    diffuse.GetColor( ambr, ambg, ambb );
 
  254    float den = ( 0.212671 * ambr + 0.71516 * ambg + 0.072169 * ambb );
 
  265    aFile << 
"   ambientIntensity " << tmp << 
"\n";
 
  267    float red, green, blue;
 
  270    aFile << 
"   diffuseColor " << tmp << 
" ";
 
  274    aFile << tmp << 
"\n";
 
  278    aFile << 
"   emissiveColor " << tmp << 
" ";
 
  282    aFile << tmp << 
"\n";
 
  285    aFile << 
"   shininess " << tmp << 
"\n";
 
  289    aFile << 
"   specularColor " << tmp << 
" ";
 
  293    aFile << tmp << 
"\n";
 
  296    aFile << 
"   transparency " << tmp << 
"\n";
 
 
  306    if( 
nullptr == parentNode )
 
  308        wxCHECK_MSG( 
m_Parent, 
false, wxT( 
"corrupt data; m_aParent is NULL" ) );
 
  324    wxCHECK_MSG( parentNode == 
m_Parent, 
false, wxT( 
"corrupt data; parentNode != m_aParent" ) );
 
  328        wxLogTrace( MASK_3D_SG, wxT( 
"%s:%s:%d * [INFO] bad stream" ),
 
  329                    __FILE__, __FUNCTION__, __LINE__ );
 
  334    aFile << 
"[" << 
GetName() << 
"]";
 
 
SGNODE * FindNode(const char *aNodeName, const SGNODE *aCaller) noexcept override
Search the tree of linked nodes and return a reference to the first node found with the given name.
 
bool AddRefNode(SGNODE *aNode) noexcept override
 
bool SetSpecular(float aRVal, float aGVal, float aBVal)
 
void unlinkRefNode(const SGNODE *aNode) noexcept override
Remove pointers to a referenced node.
 
bool AddChildNode(SGNODE *aNode) noexcept override
 
void unlinkChildNode(const SGNODE *aNode) noexcept override
Remove references to an owned child.
 
SGAPPEARANCE(SGNODE *aParent)
 
bool SetEmissive(float aRVal, float aGVal, float aBVal)
 
bool WriteVRML(std::ostream &aFile, bool aReuseFlag) override
Writes this node's data to a VRML file.
 
bool ReadCache(std::istream &aFile, SGNODE *parentNode) override
Reads binary format data from a cache file.
 
bool SetDiffuse(float aRVal, float aGVal, float aBVal)
 
bool SetAmbient(float aRVal, float aGVal, float aBVal)
 
bool WriteCache(std::ostream &aFile, SGNODE *parentNode) override
Write this node's data to a binary cache file.
 
void ReNameNodes(void) override
Rename a node and all its child nodes in preparation for write operations.
 
virtual bool SetParent(SGNODE *aParent, bool notify=true) override
Set the parent SGNODE of this object.
 
virtual bool WriteCache(std::ostream &aFile, SGNODE *parentNode)=0
Write this node's data to a binary cache file.
 
const char * GetName(void)
 
SGNODE * GetParent(void) const noexcept
Returns a pointer to the parent SGNODE of this object or NULL if the object has no parent (ie.
 
S3D::SGTYPES GetNodeType(void) const noexcept
Return the type of this node instance.
 
SGNODE * m_Parent
Pointer to parent node; may be NULL for top level transform.
 
std::string m_Name
name to use for referencing the entity by name.
 
bool m_written
Set to true when the object has been written after a ReNameNodes().
 
S3D::SGTYPES m_SGtype
Type of Scene Graph node.
 
bool WriteColor(std::ostream &aFile, const SGCOLOR &aColor)
 
void FormatFloat(std::string &result, double value)
 
bool ReadColor(std::istream &aFile, SGCOLOR &aColor)
 
Define a number of macros to aid in repetitious code which is probably best expressed as a preprocess...