70 std::ostringstream ostr;
98 (*sBP)->unlinkRefNode(
this );
121 if(
nullptr == aNewParent )
157 if(
nullptr == aName || 0 == aName[0] )
172 if(
nullptr == aNode )
175 std::list< SGNODE* >::iterator np =
187 if(
nullptr == aNode )
190 std::list< SGNODE* >::iterator np =
199 wxLogTrace( MASK_3D_SG, wxT(
"%s:%s:%d * [BUG] delNodeRef() did not find its target, this "
200 "node type %d, referenced node type %d" ),
201 __FILE__, __FUNCTION__, __LINE__,
209 wxCHECK( aWrapperRef && *aWrapperRef ==
this, );
215 *m_Association =
nullptr;
217 wxLogTrace( MASK_3D_SG, wxT(
"%s:%s:%d * [WARNING] association being broken with "
218 "previous wrapper" ),
219 __FILE__, __FUNCTION__, __LINE__ );
222 m_Association = aWrapperRef;
230 wxCHECK( aWrapperRef, );
232 wxCHECK( *aWrapperRef == *m_Association && aWrapperRef == m_Association, );
234 m_Association =
nullptr;
253 std::map< SGAPPEARANCE const*, int >::iterator it = aList.
matmap.find( node );
255 if( it != aList.
matmap.end() )
261 int idx = (int)aList.
matorder.size();
263 aList.
matmap.emplace( node, idx );
290 if(
nullptr != aMesh.m_Positions )
292 delete [] aMesh.m_Positions;
293 aMesh.m_Positions =
nullptr;
296 if(
nullptr != aMesh.m_Normals )
298 delete [] aMesh.m_Normals;
299 aMesh.m_Normals =
nullptr;
302 if(
nullptr != aMesh.m_Texcoords )
304 delete [] aMesh.m_Texcoords;
305 aMesh.m_Texcoords =
nullptr;
308 if(
nullptr != aMesh.m_Color )
310 delete [] aMesh.m_Color;
311 aMesh.m_Color =
nullptr;
314 if(
nullptr != aMesh.m_FaceIdx )
316 delete [] aMesh.m_FaceIdx;
317 aMesh.m_FaceIdx =
nullptr;
320 aMesh.m_VertexSize = 0;
321 aMesh.m_FaceIdxSize = 0;
322 aMesh.m_MaterialIdx = 0;
define an internal structure to be used by the 3D renders
Defines the generic material appearance of a scenegraph object.
The base class of all Scene Graph nodes.
void SetName(const char *aName)
void ResetNodeIndex(void) noexcept
Reset the global SG* node indices in preparation for write operations.
virtual bool AddRefNode(SGNODE *aNode)=0
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_Association
Handle to the instance held by a wrapper.
void AssociateWrapper(SGNODE **aWrapperRef) noexcept
Associate this object with a handle to itself.
std::list< SGNODE * > m_BackPointers
nodes which hold a reference to this.
const char * GetNodeTypeName(S3D::SGTYPES aNodeType) const noexcept
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.
void addNodeRef(SGNODE *aNode)
Add a pointer to a node which references this node, but does not own.
virtual void unlinkChildNode(const SGNODE *aNode)=0
Remove references to an owned child.
void DisassociateWrapper(SGNODE **aWrapperRef) noexcept
Remove the association between an IFSG* wrapper object and this object.
void delNodeRef(const SGNODE *aNode)
Remove a pointer to a node which references this node, but does not own.
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 SwapParent(SGNODE *aNewParent)
Swap the ownership with the given parent.
virtual void unlinkRefNode(const SGNODE *aNode)=0
Remove pointers to a referenced node.
void INIT_SMESH(SMESH &aMesh) noexcept
char const * GetNodeTypeName(S3D::SGTYPES aType) noexcept
Return the name of the given type of node.
bool GetMatIndex(MATLIST &aList, SGNODE *aNode, int &aIndex)
void INIT_SMATERIAL(SMATERIAL &aMaterial)
void FREE_SMESH(SMESH &aMesh) noexcept
void INIT_S3DMODEL(S3DMODEL &aModel) noexcept
void FREE_S3DMODEL(S3DMODEL &aModel)
static const std::string node_names[S3D::SGTYPE_END+1]
static unsigned int node_counts[S3D::SGTYPE_END]
static void getNodeName(S3D::SGTYPES nodeType, std::string &aName)
Store the a model based on meshes and materials.
SMATERIAL * m_Materials
The materials list of this model.
unsigned int m_MeshesSize
Number of meshes in the array.
SMESH * m_Meshes
The meshes list of this model.
unsigned int m_MaterialsSize
Number of materials in the material array.
std::vector< SGAPPEARANCE const * > matorder
std::map< SGAPPEARANCE const *, int > matmap
Per-vertex normal/color/texcoors structure.