KiCad PCB EDA Suite
Loading...
Searching...
No Matches
SGFACESET Class Reference

Define an indexed face set for a scenegraph. More...

#include <sg_faceset.h>

Inheritance diagram for SGFACESET:
SGNODE

Public Member Functions

 SGFACESET (SGNODE *aParent)
 
virtual ~SGFACESET ()
 
virtual bool SetParent (SGNODE *aParent, bool notify=true) override
 Set the parent SGNODE of this object.
 
SGNODEFindNode (const char *aNodeName, const SGNODE *aCaller) override
 Search the tree of linked nodes and return a reference to the first node found with the given name.
 
bool AddRefNode (SGNODE *aNode) override
 
bool AddChildNode (SGNODE *aNode) override
 
bool CalcNormals (SGNODE **aPtr)
 
void ReNameNodes (void) override
 Rename a node and all its child nodes in preparation for write operations.
 
bool WriteVRML (std::ostream &aFile, bool aReuseFlag) override
 Writes this node's data to a VRML file.
 
bool WriteCache (std::ostream &aFile, SGNODE *parentNode) override
 Write this node's data to a binary cache file.
 
bool ReadCache (std::istream &aFile, SGNODE *parentNode) override
 Reads binary format data from a cache file.
 
void GatherCoordIndices (std::vector< int > &aIndexList)
 Add all internal coordinate indices to the given list in preparation for a normals calculation.
 
void unlinkChildNode (const SGNODE *aNode) override
 Remove references to an owned child.
 
void unlinkRefNode (const SGNODE *aNode) override
 Remove pointers to a referenced node.
 
bool validate (void)
 
S3D::SGTYPES GetNodeType (void) const noexcept
 Return the type of this node instance.
 
SGNODEGetParent (void) const noexcept
 Returns a pointer to the parent SGNODE of this object or NULL if the object has no parent (ie.
 
bool SwapParent (SGNODE *aNewParent)
 Swap the ownership with the given parent.
 
const char * GetName (void)
 
void SetName (const char *aName)
 
const char * GetNodeTypeName (S3D::SGTYPES aNodeType) const noexcept
 
void AssociateWrapper (SGNODE **aWrapperRef) noexcept
 Associate this object with a handle to itself.
 
void DisassociateWrapper (SGNODE **aWrapperRef) noexcept
 Remove the association between an IFSG* wrapper object and this object.
 
void ResetNodeIndex (void) noexcept
 Reset the global SG* node indices in preparation for write operations.
 
void addNodeRef (SGNODE *aNode)
 Add a pointer to a node which references this node, but does not own.
 
void delNodeRef (const SGNODE *aNode)
 Remove a pointer to a node which references this node, but does not own.
 
bool isWritten (void) noexcept
 Return true if the object had already been written to a cache file or VRML file.
 

Public Attributes

SGCOLORSm_Colors
 
SGCOORDSm_Coords
 
SGCOORDINDEXm_CoordIndices
 
SGNORMALSm_Normals
 
SGCOLORSm_RColors
 
SGCOORDSm_RCoords
 
SGNORMALSm_RNormals
 

Protected Attributes

std::list< SGNODE * > m_BackPointers
 nodes which hold a reference to this.
 
SGNODEm_Parent
 Pointer to parent node; may be NULL for top level transform.
 
S3D::SGTYPES m_SGtype
 Type of Scene Graph node.
 
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().
 

Private Member Functions

void unlinkNode (const SGNODE *aNode, bool isChild)
 
bool addNode (SGNODE *aNode, bool isChild)
 

Private Attributes

bool valid
 
bool validated
 
SGNODE ** m_Association
 Handle to the instance held by a wrapper.
 

Detailed Description

Define an indexed face set for a scenegraph.

Definition at line 46 of file sg_faceset.h.

Constructor & Destructor Documentation

◆ SGFACESET()

◆ ~SGFACESET()

Member Function Documentation

◆ AddChildNode()

bool SGFACESET::AddChildNode ( SGNODE aNode)
overridevirtual

Implements SGNODE.

Definition at line 407 of file sg_faceset.cpp.

References addNode().

◆ addNode()

◆ addNodeRef()

void SGNODE::addNodeRef ( SGNODE aNode)
inherited

Add a pointer to a node which references this node, but does not own.

Such back-pointers are required to ensure that invalidated references are removed when a node is deleted.

Parameters
aNodeis the node holding a reference to this object.

Definition at line 170 of file sg_node.cpp.

References SGNODE::m_BackPointers.

Referenced by addNode(), SGSHAPE::addNode(), ReadCache(), and SGSHAPE::ReadCache().

◆ AddRefNode()

bool SGFACESET::AddRefNode ( SGNODE aNode)
overridevirtual

Implements SGNODE.

Definition at line 401 of file sg_faceset.cpp.

References addNode().

◆ AssociateWrapper()

void SGNODE::AssociateWrapper ( SGNODE **  aWrapperRef)
noexceptinherited

◆ CalcNormals()

bool SGFACESET::CalcNormals ( SGNODE **  aPtr)

◆ delNodeRef()

void SGNODE::delNodeRef ( const SGNODE aNode)
inherited

Remove a pointer to a node which references this node, but does not own.

Parameters
aNodeis the node holding a reference to this object.

Definition at line 185 of file sg_node.cpp.

References SGNODE::GetNodeType(), SGNODE::m_BackPointers, and SGNODE::m_SGtype.

Referenced by unlinkNode(), SGSHAPE::unlinkNode(), ~SGFACESET(), and SGSHAPE::~SGSHAPE().

◆ DisassociateWrapper()

◆ FindNode()

SGNODE * SGFACESET::FindNode ( const char *  aNodeName,
const SGNODE aCaller 
)
overridevirtual

Search the tree of linked nodes and return a reference to the first node found with the given name.

The reference is then typically added to another node via AddRefNode().

Parameters
aNodeNameis the name of the node to search for.
aCalleris a pointer to the node invoking this function.
Returns
is a valid node pointer on success, otherwise NULL.

Implements SGNODE.

Definition at line 149 of file sg_faceset.cpp.

References SGCOLORS::FindNode(), SGCOORDS::FindNode(), SGINDEX::FindNode(), SGNORMALS::FindNode(), SGNODE::FindNode(), m_Colors, m_CoordIndices, m_Coords, SGNODE::m_Name, m_Normals, and SGNODE::m_Parent.

Referenced by SGSHAPE::FindNode(), and ReadCache().

◆ GatherCoordIndices()

void SGFACESET::GatherCoordIndices ( std::vector< int > &  aIndexList)

Add all internal coordinate indices to the given list in preparation for a normals calculation.

Definition at line 968 of file sg_faceset.cpp.

References SGCOORDINDEX::GatherCoordIndices(), and m_CoordIndices.

Referenced by SGCOORDS::CalcNormals().

◆ GetName()

◆ GetNodeType()

◆ GetNodeTypeName()

◆ GetParent()

◆ isWritten()

bool SGNODE::isWritten ( void  )
inlinenoexceptinherited

Return true if the object had already been written to a cache file or VRML file.

For internal use only.

Definition at line 220 of file sg_node.h.

References SGNODE::m_written.

Referenced by SCENEGRAPH::WriteCache(), WriteCache(), and SGSHAPE::WriteCache().

◆ ReadCache()

bool SGFACESET::ReadCache ( std::istream &  aFile,
SGNODE parentNode 
)
overridevirtual

Reads binary format data from a cache file.

To read a cache file, open the file for reading and invoke this function from a new SCENEGRAPH node.

Implements SGNODE.

Definition at line 601 of file sg_faceset.cpp.

References SGNODE::addNodeRef(), FindNode(), SGNODE::GetNodeType(), m_Colors, m_CoordIndices, m_Coords, m_Normals, m_RColors, m_RCoords, m_RNormals, name, NITEMS, SGCOLORS::ReadCache(), SGCOORDS::ReadCache(), SGINDEX::ReadCache(), SGNORMALS::ReadCache(), S3D::ReadTag(), SGNODE::SetName(), S3D::SGTYPE_COLORS, S3D::SGTYPE_COORDINDEX, S3D::SGTYPE_COORDS, and S3D::SGTYPE_NORMALS.

Referenced by SGSHAPE::ReadCache().

◆ ReNameNodes()

void SGFACESET::ReNameNodes ( void  )
overridevirtual

Rename a node and all its child nodes in preparation for write operations.

Implements SGNODE.

Definition at line 413 of file sg_faceset.cpp.

References SGNODE::GetName(), m_Colors, m_CoordIndices, m_Coords, SGNODE::m_Name, m_Normals, SGNODE::m_written, SGCOLORS::ReNameNodes(), SGCOORDS::ReNameNodes(), SGINDEX::ReNameNodes(), and SGNORMALS::ReNameNodes().

Referenced by SGSHAPE::ReNameNodes().

◆ ResetNodeIndex()

void SGNODE::ResetNodeIndex ( void  )
noexceptinherited

Reset the global SG* node indices in preparation for write operations.

Definition at line 238 of file sg_node.cpp.

References node_counts, and S3D::SGTYPE_END.

Referenced by S3D::ResetNodeIndex(), SCENEGRAPH::WriteCache(), and S3D::WriteVRML().

◆ SetName()

void SGNODE::SetName ( const char *  aName)
inherited

◆ SetParent()

bool SGFACESET::SetParent ( SGNODE aParent,
bool  notify = true 
)
overridevirtual

Set the parent SGNODE of this object.

Parameters
aParent[in] is the desired parent node
Returns
true if the operation succeeds; false if the given node is not allowed to be a parent to the derived object.

Implements SGNODE.

Definition at line 119 of file sg_faceset.cpp.

References SGNODE::AddChildNode(), SGNODE::GetNodeType(), SGNODE::m_Parent, S3D::SGTYPE_SHAPE, and SGNODE::unlinkChildNode().

Referenced by SGSHAPE::addNode(), and SGSHAPE::~SGSHAPE().

◆ SwapParent()

bool SGNODE::SwapParent ( SGNODE aNewParent)
inherited

Swap the ownership with the given parent.

This operation may be required when reordering nodes for optimization.

Parameters
aNewParentwill become the new parent to the object; it must be the same type as the parent of this instance.

Definition at line 116 of file sg_node.cpp.

References SGNODE::AddChildNode(), SGNODE::AddRefNode(), SGNODE::GetNodeType(), SGNODE::m_Parent, SGNODE::unlinkChildNode(), and SGNODE::unlinkRefNode().

Referenced by WriteCache(), and SGSHAPE::WriteCache().

◆ unlinkChildNode()

void SGFACESET::unlinkChildNode ( const SGNODE aNode)
overridevirtual

Remove references to an owned child.

This is invoked by the child upon destruction to ensure that the parent has no invalid references.

Parameters
aNodeis the child which is being deleted.

Implements SGNODE.

Definition at line 262 of file sg_faceset.cpp.

References unlinkNode().

◆ unlinkNode()

void SGFACESET::unlinkNode ( const SGNODE aNode,
bool  isChild 
)
private

◆ unlinkRefNode()

void SGFACESET::unlinkRefNode ( const SGNODE aNode)
overridevirtual

Remove pointers to a referenced node.

This is invoked by the referenced node upon destruction to ensure that the referring node has no invalid references.

Parameters
aNodeis the node which is being deleted.

Implements SGNODE.

Definition at line 268 of file sg_faceset.cpp.

References unlinkNode().

◆ validate()

◆ WriteCache()

bool SGFACESET::WriteCache ( std::ostream &  aFile,
SGNODE parentNode 
)
overridevirtual

Write this node's data to a binary cache file.

The data includes all data of children and references to children. If this function is invoked by the user, parentNode must be set to NULL in order to ensure coherent data.

Implements SGNODE.

Definition at line 493 of file sg_faceset.cpp.

References SGNODE::GetName(), SGNODE::GetParent(), SGNODE::isWritten(), m_Colors, m_CoordIndices, m_Coords, m_Normals, SGNODE::m_Parent, m_RColors, m_RCoords, m_RNormals, SGNODE::m_written, NITEMS, SGNODE::SwapParent(), SGCOLORS::WriteCache(), SGCOORDS::WriteCache(), SGINDEX::WriteCache(), SGNORMALS::WriteCache(), and SGNODE::WriteCache().

Referenced by SGSHAPE::WriteCache().

◆ WriteVRML()

bool SGFACESET::WriteVRML ( std::ostream &  aFile,
bool  aReuseFlag 
)
overridevirtual

Writes this node's data to a VRML file.

This includes all data of child and referenced nodes.

Implements SGNODE.

Definition at line 438 of file sg_faceset.cpp.

References SGNODE::GetName(), m_Colors, m_CoordIndices, m_Coords, m_Normals, m_RColors, m_RCoords, m_RNormals, SGNODE::m_written, SGCOLORS::WriteVRML(), SGCOORDS::WriteVRML(), SGINDEX::WriteVRML(), and SGNORMALS::WriteVRML().

Referenced by SGSHAPE::WriteVRML().

Member Data Documentation

◆ m_Association

SGNODE** SGNODE::m_Association
privateinherited

Handle to the instance held by a wrapper.

Definition at line 233 of file sg_node.h.

Referenced by SGNODE::SGNODE(), and SGNODE::~SGNODE().

◆ m_BackPointers

std::list< SGNODE* > SGNODE::m_BackPointers
protectedinherited

nodes which hold a reference to this.

Definition at line 226 of file sg_node.h.

Referenced by SGNODE::addNodeRef(), SGCOORDS::CalcNormals(), SGNODE::delNodeRef(), and SGNODE::~SGNODE().

◆ m_Colors

◆ m_CoordIndices

◆ m_Coords

◆ m_Name

◆ m_Normals

◆ m_Parent

◆ m_RColors

SGCOLORS* SGFACESET::m_RColors

◆ m_RCoords

◆ m_RNormals

◆ m_SGtype

◆ m_written

◆ valid

bool SGFACESET::valid
private

Definition at line 90 of file sg_faceset.h.

Referenced by addNode(), SGFACESET(), unlinkNode(), and validate().

◆ validated

bool SGFACESET::validated
private

Definition at line 91 of file sg_faceset.h.

Referenced by addNode(), SGFACESET(), unlinkNode(), and validate().


The documentation for this class was generated from the following files: