38 wxLogTrace( MASK_3D_SG, wxT(
"%s:%s:%d * [BUG] inappropriate parent to SGINDEX (type "
40 __FILE__, __FUNCTION__, __LINE__,
65 if(
nullptr == aParent )
84 if(
nullptr == aNodeName || 0 == aNodeName[0] )
87 if( !m_Name.compare( aNodeName ) )
111 wxCHECK(
false,
false );
120 wxCHECK(
false,
false );
131 aIndexList =
nullptr;
135 nIndices =
index.size();
136 aIndexList = &
index[0];
145 if( 0 == nIndices ||
nullptr == aIndexList )
148 for(
size_t i = 0; i < nIndices; ++i )
149 index.push_back( aIndexList[i] );
157 index.push_back( aIndex );
185 size_t n =
index.size();
187 wxCHECK_MSG( n % 3 == 0,
false, wxT(
"Coordinate index is not divisible by three (violates "
188 "triangle constraint)" ) );
190 aFile <<
" coordIndex [\n ";
196 for(
size_t i = 0; i < n; )
228 aFile <<
" colorIndex [\n ";
237 size_t n =
index.size();
239 for(
size_t i = 0; i < n; )
264 if(
nullptr == parentNode )
282 wxCHECK( parentNode ==
m_Parent,
false );
286 wxLogTrace( MASK_3D_SG, wxT(
"%s:%s:%d * [INFO] bad stream" ),
287 __FILE__, __FUNCTION__, __LINE__ );
292 aFile <<
"[" <<
GetName() <<
"]";
293 size_t npts =
index.size();
294 aFile.write( (
char*)&npts,
sizeof(
size_t) );
296 for(
size_t i = 0; i < npts; ++i )
297 aFile.write( (
char*)&
index[i],
sizeof(
int) );
309 wxCHECK(
index.empty(),
false );
312 aFile.read( (
char*)&npts,
sizeof(
size_t) );
318 for(
size_t i = 0; i < npts; ++i )
320 aFile.read( (
char*) &tmp,
sizeof(
int ) );
325 index.push_back( tmp );
bool AddChildNode(SGNODE *aNode) noexcept override
void unlinkChildNode(const SGNODE *aCaller) noexcept override
Remove references to an owned child.
void unlinkRefNode(const SGNODE *aCaller) noexcept override
Remove pointers to a referenced node.
bool writeCoordIndex(std::ostream &aFile)
bool GetIndices(size_t &nIndices, int *&aIndexList)
Retrieve the number of indices and a pointer to the list.
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.
void AddIndex(int aIndex)
Add a single index to the list.
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 writeColorIndex(std::ostream &aFile)
void ReNameNodes(void) override
Rename a node and all its child nodes in preparation for write operations.
void SetIndices(size_t nIndices, int *aIndexList)
Set the number of indices and creates a copy of the given index data.
virtual bool SetParent(SGNODE *aParent, bool notify=true) override
Set the parent SGNODE of this object.
bool WriteCache(std::ostream &aFile, SGNODE *parentNode) override
Write this node's data to a binary cache file.
bool writeIndexList(std::ostream &aFile)
bool AddRefNode(SGNODE *aNode) noexcept override
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.