41 wxLogTrace( MASK_3D_SG, wxT(
"%s:%s:%d * [BUG] inappropriate parent to SGNORMALS "
43 __FILE__, __FUNCTION__, __LINE__,
72 if(
nullptr == aParent )
91 if(
nullptr == aNodeName || 0 == aNodeName[0] )
94 if( !m_Name.compare( aNodeName ) )
115 wxCHECK(
false,
false );
123 wxCHECK(
false,
false );
134 aNormalList =
nullptr;
138 aListSize =
norms.size();
139 aNormalList = &
norms[0];
148 if( 0 == aListSize ||
nullptr == aNormalList )
151 for(
int i = 0; i < (int)aListSize; ++i )
152 norms.push_back( aNormalList[i] );
158 norms.emplace_back( aXValue, aYValue, aZValue );
164 norms.push_back( aNormal );
187 aFile <<
" normal DEF " <<
GetName() <<
" Normal { vector [\n ";
192 aFile <<
" normal USE " <<
GetName() <<
"\n";
198 aFile <<
" normal Normal { vector [\n ";
202 size_t n =
norms.size();
205 for(
size_t i = 0; i < n; )
236 if(
nullptr == parentNode )
254 wxCHECK( parentNode ==
m_Parent,
false );
258 wxLogTrace( MASK_3D_SG, wxT(
"%s:%s:%d * [INFO] bad stream" ),
259 __FILE__, __FUNCTION__, __LINE__ );
264 aFile <<
"[" <<
GetName() <<
"]";
265 size_t npts =
norms.size();
266 aFile.write( (
char*)&npts,
sizeof(
size_t) );
268 for(
size_t i = 0; i < npts; ++i )
281 wxCHECK(
norms.empty(),
false );
284 aFile.read( (
char*) &npts,
sizeof(
size_t ) );
290 for(
size_t i = 0; i < npts; ++i )
295 norms.push_back( tmp );
The base class of all Scene Graph nodes.
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.
virtual bool AddChildNode(SGNODE *aNode)=0
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.
virtual void unlinkChildNode(const SGNODE *aNode)=0
Remove references to an owned child.
bool m_written
Set to true when the object has been written after a ReNameNodes().
S3D::SGTYPES m_SGtype
Type of Scene Graph node.
virtual bool SetParent(SGNODE *aParent, bool notify=true) override
Set the parent SGNODE of this object.
bool AddChildNode(SGNODE *aNode) noexcept override
void ReNameNodes(void) override
Rename a node and all its child nodes in preparation for write operations.
bool WriteCache(std::ostream &aFile, SGNODE *parentNode) override
Write this node's data to a binary cache file.
void AddNormal(double aXValue, double aYValue, double aZValue)
bool GetNormalList(size_t &aListSize, SGVECTOR *&aNormalList)
bool WriteVRML(std::ostream &aFile, bool aReuseFlag) override
Writes this node's data to a VRML file.
void SetNormalList(size_t aListSize, const SGVECTOR *aNormalList)
bool ReadCache(std::istream &aFile, SGNODE *parentNode) override
Reads binary format data from a cache file.
void unlinkRefNode(const SGNODE *aNode) noexcept override
Remove pointers to a referenced node.
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.
SGNORMALS(SGNODE *aParent)
bool AddRefNode(SGNODE *aNode) noexcept override
void unlinkChildNode(const SGNODE *aNode) noexcept override
Remove references to an owned child.
std::vector< SGVECTOR > norms
bool ReadVector(std::istream &aFile, SGVECTOR &aVector)
bool WriteVector(std::ostream &aFile, const SGVECTOR &aVector)
void FormatVector(std::string &result, const SGVECTOR &aVector)
Define a number of macros to aid in repetitious code which is probably best expressed as a preprocess...