|
KiCad PCB EDA Suite
|
Define an indexed face set for a scenegraph. More...
#include <sg_faceset.h>
Public Member Functions | |
| SGFACESET (SGNODE *aParent) | |
| virtual | ~SGFACESET () |
| virtual bool | SetParent (SGNODE *aParent, bool notify=true) override |
| Set the parent SGNODE of this object. | |
| SGNODE * | FindNode (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. | |
| SGNODE * | GetParent (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 | |
| SGCOLORS * | m_Colors |
| SGCOORDS * | m_Coords |
| SGCOORDINDEX * | m_CoordIndices |
| SGNORMALS * | m_Normals |
| SGCOLORS * | m_RColors |
| SGCOORDS * | m_RCoords |
| SGNORMALS * | m_RNormals |
Protected Attributes | |
| std::list< SGNODE * > | m_BackPointers |
| nodes which hold a reference to this. | |
| SGNODE * | m_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. | |
Define an indexed face set for a scenegraph.
Definition at line 42 of file sg_faceset.h.
| SGFACESET::SGFACESET | ( | SGNODE * | aParent | ) |
Definition at line 34 of file sg_faceset.cpp.
References SGNODE::GetNodeType(), m_Colors, m_CoordIndices, m_Coords, m_Normals, m_RColors, m_RCoords, m_RNormals, SGNODE::m_SGtype, SGNODE::SGNODE(), S3D::SGTYPE_FACESET, S3D::SGTYPE_SHAPE, valid, and validated.
|
virtual |
Definition at line 63 of file sg_faceset.cpp.
References m_Colors, m_CoordIndices, m_Coords, m_Normals, m_RColors, m_RCoords, and m_RNormals.
|
overridevirtual |
Implements SGNODE.
Definition at line 403 of file sg_faceset.cpp.
References addNode(), and SGNODE::SGNODE().
|
private |
Definition at line 271 of file sg_faceset.cpp.
References SGNODE::GetName(), SGNODE::GetNodeType(), m_Colors, m_CoordIndices, m_Coords, m_Normals, m_RColors, m_RCoords, m_RNormals, SGNODE::SGNODE(), S3D::SGTYPE_COLORS, S3D::SGTYPE_COORDINDEX, S3D::SGTYPE_COORDS, S3D::SGTYPE_NORMALS, valid, and validated.
Referenced by AddChildNode(), and AddRefNode().
|
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.
| aNode | is the node holding a reference to this object. |
Definition at line 166 of file sg_node.cpp.
References m_BackPointers, and SGNODE().
|
overridevirtual |
Implements SGNODE.
Definition at line 397 of file sg_faceset.cpp.
References addNode(), and SGNODE::SGNODE().
|
noexceptinherited |
Associate this object with a handle to itself.
The handle is typically held by an IFSG* wrapper and the pointer which it refers to is set to NULL upon destruction of this object. This mechanism provides a scheme by which a wrapper can be notified of the destruction of the object which it wraps.
Definition at line 203 of file sg_node.cpp.
References m_Association, and SGNODE().
Referenced by S3D::AssociateSGNodeWrapper().
| bool SGFACESET::CalcNormals | ( | SGNODE ** | aPtr | ) |
Definition at line 971 of file sg_faceset.cpp.
References SGCOORDS::CalcNormals(), SGCOORDS::coords, m_Coords, m_Normals, m_RCoords, m_RNormals, and SGNODE::SGNODE().
|
inherited |
Remove a pointer to a node which references this node, but does not own.
| aNode | is the node holding a reference to this object. |
Definition at line 181 of file sg_node.cpp.
References GetNodeType(), m_BackPointers, m_SGtype, and SGNODE().
Referenced by SGFACESET::unlinkNode(), and SGSHAPE::unlinkNode().
|
noexceptinherited |
Remove the association between an IFSG* wrapper object and this object.
Definition at line 221 of file sg_node.cpp.
References m_Association, and SGNODE().
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().
| aNodeName | is the name of the node to search for. |
| aCaller | is a pointer to the node invoking this function. |
Implements SGNODE.
Definition at line 145 of file sg_faceset.cpp.
References m_Colors, m_CoordIndices, m_Coords, SGNODE::m_Name, m_Normals, SGNODE::m_Parent, and SGNODE::SGNODE().
Referenced by ReadCache().
| 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 964 of file sg_faceset.cpp.
References m_CoordIndices.
Referenced by SGCOORDS::CalcNormals().
|
inherited |
Definition at line 142 of file sg_node.cpp.
References getNodeName(), m_Name, and m_SGtype.
Referenced by SCENEGRAPH::addNode(), SGFACESET::addNode(), SGSHAPE::addNode(), SCENEGRAPH::ReNameNodes(), SGAPPEARANCE::ReNameNodes(), SGCOLORS::ReNameNodes(), SGCOORDS::ReNameNodes(), SGFACESET::ReNameNodes(), SGINDEX::ReNameNodes(), SGNORMALS::ReNameNodes(), SGSHAPE::ReNameNodes(), SCENEGRAPH::WriteCache(), SGAPPEARANCE::WriteCache(), SGCOLORS::WriteCache(), SGCOORDS::WriteCache(), SGFACESET::WriteCache(), SGINDEX::WriteCache(), SGNORMALS::WriteCache(), SGSHAPE::WriteCache(), SCENEGRAPH::WriteVRML(), SGAPPEARANCE::WriteVRML(), SGCOLORS::WriteVRML(), SGCOORDS::WriteVRML(), SGFACESET::WriteVRML(), SGNORMALS::WriteVRML(), and SGSHAPE::WriteVRML().
|
noexceptinherited |
Return the type of this node instance.
Definition at line 100 of file sg_node.cpp.
References m_SGtype.
Referenced by SCENEGRAPH::addNode(), SGFACESET::addNode(), SGSHAPE::addNode(), IFSG_APPEARANCE::Attach(), IFSG_COLORS::Attach(), IFSG_COORDINDEX::Attach(), IFSG_COORDS::Attach(), IFSG_FACESET::Attach(), IFSG_NORMALS::Attach(), IFSG_SHAPE::Attach(), IFSG_TRANSFORM::Attach(), delNodeRef(), S3D::GetMatIndex(), S3D::GetModel(), S3D::GetSGNodeType(), IFSG_APPEARANCE::NewNode(), IFSG_COLORS::NewNode(), IFSG_COORDINDEX::NewNode(), IFSG_COORDS::NewNode(), IFSG_FACESET::NewNode(), IFSG_NORMALS::NewNode(), IFSG_SHAPE::NewNode(), IFSG_TRANSFORM::NewNode(), SCENEGRAPH::ReadCache(), SGFACESET::ReadCache(), SGSHAPE::ReadCache(), SCENEGRAPH::SCENEGRAPH(), SCENEGRAPH::SetParent(), SGAPPEARANCE::SetParent(), SGCOLORS::SetParent(), SGCOORDS::SetParent(), SGFACESET::SetParent(), SGINDEX::SetParent(), SGNORMALS::SetParent(), SGSHAPE::SetParent(), SGAPPEARANCE::SGAPPEARANCE(), SGCOLORS::SGCOLORS(), SGCOORDINDEX::SGCOORDINDEX(), SGCOORDS::SGCOORDS(), SGFACESET::SGFACESET(), SGINDEX::SGINDEX(), SGNORMALS::SGNORMALS(), SGSHAPE::SGSHAPE(), SwapParent(), SCENEGRAPH::unlinkNode(), and S3D::WriteVRML().
|
noexceptinherited |
Definition at line 160 of file sg_node.cpp.
References node_names.
Referenced by IFSG_APPEARANCE::NewNode(), IFSG_COLORS::NewNode(), IFSG_COORDINDEX::NewNode(), IFSG_COORDS::NewNode(), IFSG_FACESET::NewNode(), IFSG_NORMALS::NewNode(), IFSG_SHAPE::NewNode(), and IFSG_TRANSFORM::NewNode().
|
noexceptinherited |
Returns a pointer to the parent SGNODE of this object or NULL if the object has no parent (ie.
top level transform).
Definition at line 106 of file sg_node.cpp.
References m_Parent, and SGNODE().
Referenced by S3D::GetSGNodeParent(), SCENEGRAPH::WriteCache(), SGAPPEARANCE::WriteCache(), SGCOLORS::WriteCache(), SGCOORDS::WriteCache(), SGFACESET::WriteCache(), SGINDEX::WriteCache(), SGNORMALS::WriteCache(), and SGSHAPE::WriteCache().
|
inlinenoexceptinherited |
Return true if the object had already been written to a cache file or VRML file.
For internal use only.
Definition at line 216 of file sg_node.h.
References m_written.
Referenced by SCENEGRAPH::WriteCache().
|
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 597 of file sg_faceset.cpp.
References FindNode(), SGNODE::GetNodeType(), m_Colors, m_CoordIndices, m_Coords, m_Normals, m_RColors, m_RCoords, m_RNormals, name, NITEMS, S3D::ReadTag(), SGNODE::SGNODE(), S3D::SGTYPE_COLORS, S3D::SGTYPE_COORDINDEX, S3D::SGTYPE_COORDS, and S3D::SGTYPE_NORMALS.
|
overridevirtual |
Rename a node and all its child nodes in preparation for write operations.
Implements SGNODE.
Definition at line 409 of file sg_faceset.cpp.
References SGNODE::GetName(), m_Colors, m_CoordIndices, m_Coords, SGNODE::m_Name, m_Normals, and SGNODE::m_written.
|
noexceptinherited |
Reset the global SG* node indices in preparation for write operations.
Definition at line 234 of file sg_node.cpp.
References node_counts, and S3D::SGTYPE_END.
Referenced by S3D::ResetNodeIndex(), SCENEGRAPH::WriteCache(), and S3D::WriteVRML().
|
inherited |
Definition at line 151 of file sg_node.cpp.
References getNodeName(), m_Name, and m_SGtype.
Referenced by SCENEGRAPH::ReadCache().
|
overridevirtual |
Set the parent SGNODE of this object.
| aParent | [in] is the desired parent node |
Implements SGNODE.
Definition at line 115 of file sg_faceset.cpp.
References SGNODE::GetNodeType(), SGNODE::m_Parent, SGNODE::SGNODE(), and S3D::SGTYPE_SHAPE.
|
inherited |
Swap the ownership with the given parent.
This operation may be required when reordering nodes for optimization.
| aNewParent | will become the new parent to the object; it must be the same type as the parent of this instance. |
Definition at line 112 of file sg_node.cpp.
References AddChildNode(), AddRefNode(), GetNodeType(), m_Parent, SGNODE(), and unlinkRefNode().
|
overridevirtual |
Remove references to an owned child.
This is invoked by the child upon destruction to ensure that the parent has no invalid references.
| aNode | is the child which is being deleted. |
Implements SGNODE.
Definition at line 258 of file sg_faceset.cpp.
References SGNODE::SGNODE(), and unlinkNode().
|
private |
Definition at line 195 of file sg_faceset.cpp.
References SGNODE::delNodeRef(), m_Colors, m_CoordIndices, m_Coords, m_Normals, m_RColors, m_RCoords, m_RNormals, SGNODE::SGNODE(), valid, and validated.
Referenced by unlinkChildNode(), and unlinkRefNode().
|
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.
| aNode | is the node which is being deleted. |
Implements SGNODE.
Definition at line 264 of file sg_faceset.cpp.
References SGNODE::SGNODE(), and unlinkNode().
| bool SGFACESET::validate | ( | void | ) |
Definition at line 850 of file sg_faceset.cpp.
References SGCOLORS::GetColorList(), SGCOORDS::GetCoordsList(), SGNORMALS::GetNormalList(), m_Colors, m_CoordIndices, m_Coords, m_Normals, m_RColors, m_RCoords, m_RNormals, valid, and validated.
Referenced by SGSHAPE::Prepare().
|
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 489 of file sg_faceset.cpp.
References SGNODE::GetName(), SGNODE::GetParent(), m_Colors, m_CoordIndices, m_Coords, m_Normals, SGNODE::m_Parent, m_RColors, m_RCoords, m_RNormals, SGNODE::m_written, NITEMS, SGNODE::SGNODE(), and SGNODE::WriteCache().
|
overridevirtual |
Writes this node's data to a VRML file.
This includes all data of child and referenced nodes.
Implements SGNODE.
Definition at line 434 of file sg_faceset.cpp.
References SGNODE::GetName(), m_Colors, m_CoordIndices, m_Coords, m_Normals, m_RColors, m_RCoords, m_RNormals, and SGNODE::m_written.
|
privateinherited |
Handle to the instance held by a wrapper.
Definition at line 229 of file sg_node.h.
Referenced by AssociateWrapper(), DisassociateWrapper(), SGNODE(), and ~SGNODE().
|
protectedinherited |
nodes which hold a reference to this.
Definition at line 222 of file sg_node.h.
Referenced by addNodeRef(), SGCOORDS::CalcNormals(), delNodeRef(), and ~SGNODE().
| SGCOLORS* SGFACESET::m_Colors |
Definition at line 75 of file sg_faceset.h.
Referenced by addNode(), FindNode(), SGSHAPE::Prepare(), ReadCache(), ReNameNodes(), SGFACESET(), unlinkNode(), validate(), WriteCache(), WriteVRML(), and ~SGFACESET().
| SGCOORDINDEX* SGFACESET::m_CoordIndices |
Definition at line 77 of file sg_faceset.h.
Referenced by addNode(), FindNode(), GatherCoordIndices(), SGSHAPE::Prepare(), ReadCache(), ReNameNodes(), SGFACESET(), unlinkNode(), validate(), WriteCache(), WriteVRML(), and ~SGFACESET().
| SGCOORDS* SGFACESET::m_Coords |
Definition at line 76 of file sg_faceset.h.
Referenced by addNode(), CalcNormals(), FindNode(), SGSHAPE::Prepare(), ReadCache(), ReNameNodes(), SGFACESET(), unlinkNode(), validate(), WriteCache(), WriteVRML(), and ~SGFACESET().
|
protectedinherited |
name to use for referencing the entity by name.
Definition at line 225 of file sg_node.h.
Referenced by SCENEGRAPH::FindNode(), SGAPPEARANCE::FindNode(), SGCOLORS::FindNode(), SGCOORDS::FindNode(), SGFACESET::FindNode(), SGINDEX::FindNode(), SGNORMALS::FindNode(), SGSHAPE::FindNode(), GetName(), SCENEGRAPH::ReadCache(), SCENEGRAPH::ReNameNodes(), SGAPPEARANCE::ReNameNodes(), SGCOLORS::ReNameNodes(), SGCOORDS::ReNameNodes(), SGFACESET::ReNameNodes(), SGINDEX::ReNameNodes(), SGNORMALS::ReNameNodes(), SGSHAPE::ReNameNodes(), and SetName().
| SGNORMALS* SGFACESET::m_Normals |
Definition at line 78 of file sg_faceset.h.
Referenced by addNode(), SGCOORDS::CalcNormals(), CalcNormals(), FindNode(), SGSHAPE::Prepare(), ReadCache(), ReNameNodes(), SGFACESET(), unlinkNode(), validate(), WriteCache(), WriteVRML(), and ~SGFACESET().
|
protectedinherited |
Pointer to parent node; may be NULL for top level transform.
Definition at line 223 of file sg_node.h.
Referenced by SGCOORDS::CalcNormals(), SCENEGRAPH::FindNode(), SGFACESET::FindNode(), SGSHAPE::FindNode(), GetParent(), SCENEGRAPH::SetParent(), SGAPPEARANCE::SetParent(), SGCOLORS::SetParent(), SGCOORDS::SetParent(), SGFACESET::SetParent(), SGINDEX::SetParent(), SGNORMALS::SetParent(), SGSHAPE::SetParent(), SGNODE(), SwapParent(), SCENEGRAPH::WriteCache(), SGAPPEARANCE::WriteCache(), SGCOLORS::WriteCache(), SGCOORDS::WriteCache(), SGFACESET::WriteCache(), SGINDEX::WriteCache(), SGNORMALS::WriteCache(), SGSHAPE::WriteCache(), and ~SGNODE().
| SGCOLORS* SGFACESET::m_RColors |
Definition at line 81 of file sg_faceset.h.
Referenced by addNode(), SGSHAPE::Prepare(), ReadCache(), SGFACESET(), unlinkNode(), validate(), WriteCache(), WriteVRML(), and ~SGFACESET().
| SGCOORDS* SGFACESET::m_RCoords |
Definition at line 82 of file sg_faceset.h.
Referenced by addNode(), CalcNormals(), SGSHAPE::Prepare(), ReadCache(), SGFACESET(), unlinkNode(), validate(), WriteCache(), WriteVRML(), and ~SGFACESET().
| SGNORMALS* SGFACESET::m_RNormals |
Definition at line 83 of file sg_faceset.h.
Referenced by addNode(), CalcNormals(), SGSHAPE::Prepare(), ReadCache(), SGFACESET(), unlinkNode(), validate(), WriteCache(), WriteVRML(), and ~SGFACESET().
|
protectedinherited |
Type of Scene Graph node.
Definition at line 224 of file sg_node.h.
Referenced by delNodeRef(), GetName(), GetNodeType(), SCENEGRAPH::SCENEGRAPH(), SetName(), SGAPPEARANCE::SGAPPEARANCE(), SGCOLORS::SGCOLORS(), SGCOORDINDEX::SGCOORDINDEX(), SGCOORDS::SGCOORDS(), SGFACESET::SGFACESET(), SGNODE(), SGNORMALS::SGNORMALS(), SGSHAPE::SGSHAPE(), and SGINDEX::WriteVRML().
|
protectedinherited |
Set to true when the object has been written after a ReNameNodes().
Definition at line 226 of file sg_node.h.
Referenced by isWritten(), SCENEGRAPH::ReNameNodes(), SGAPPEARANCE::ReNameNodes(), SGCOLORS::ReNameNodes(), SGCOORDS::ReNameNodes(), SGFACESET::ReNameNodes(), SGINDEX::ReNameNodes(), SGNORMALS::ReNameNodes(), SGSHAPE::ReNameNodes(), SGNODE(), SCENEGRAPH::WriteCache(), SGAPPEARANCE::WriteCache(), SGCOLORS::WriteCache(), SGCOORDS::WriteCache(), SGFACESET::WriteCache(), SGINDEX::WriteCache(), SGNORMALS::WriteCache(), SGSHAPE::WriteCache(), SCENEGRAPH::WriteVRML(), SGAPPEARANCE::WriteVRML(), SGCOLORS::WriteVRML(), SGCOORDS::WriteVRML(), SGFACESET::WriteVRML(), SGNORMALS::WriteVRML(), and SGSHAPE::WriteVRML().
|
private |
Definition at line 86 of file sg_faceset.h.
Referenced by addNode(), SGFACESET(), unlinkNode(), and validate().
|
private |
Definition at line 87 of file sg_faceset.h.
Referenced by addNode(), SGFACESET(), unlinkNode(), and validate().