52#define DROP_REFS( aType, aList ) \
55 std::vector<aType*>::iterator sL = aList.begin(); \
56 std::vector<aType*>::iterator eL = aList.end(); \
59 ( (SGNODE*) *sL )->delNodeRef( this ); \
69#define DEL_OBJS( aType, aList ) \
72 std::vector<aType*>::iterator sL = aList.begin(); \
73 std::vector<aType*>::iterator eL = aList.end(); \
76 ( (SGNODE*) *sL )->SetParent( nullptr, false ); \
86#define UNLINK_NODE( aNodeID, aType, aNode, aOwnedList, aRefList, isChild ) \
89 if( aNodeID == aNode->GetNodeType() ) \
91 std::vector<aType*>* oSL; \
92 std::vector<aType*>::iterator sL; \
93 std::vector<aType*>::iterator eL; \
101 if( (SGNODE*) *sL == aNode ) \
116 if( (SGNODE*) *sL == aNode ) \
118 delNodeRef( this ); \
132#define ADD_NODE( aNodeID, aType, aNode, aOwnedList, aRefList, isChild ) \
135 if( aNodeID == aNode->GetNodeType() ) \
137 std::vector<aType*>::iterator sL; \
138 sL = std::find( aOwnedList.begin(), aOwnedList.end(), aNode ); \
139 if( sL != aOwnedList.end() ) \
141 sL = std::find( aRefList.begin(), aRefList.end(), aNode ); \
142 if( sL != aRefList.end() ) \
146 SGNODE* ppn = (SGNODE*) aNode->GetParent(); \
147 if( nullptr != ppn ) \
151 std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; \
152 std::cerr << " * [BUG] object '" << aNode->GetName(); \
153 std::cerr << "' has multiple parents '" << ppn->GetName() << "', '"; \
154 std::cerr << m_Name << "'\n"; \
158 aOwnedList.push_back( (aType*) aNode ); \
159 aNode->SetParent( this, false ); \
170 aRefList.push_back( (aType*) aNode ); \
171 aNode->addNodeRef( this ); \
179#define FIND_NODE( aType, aName, aNodeList, aCallingNode ) \
182 std::vector<aType*>::iterator sLA = aNodeList.begin(); \
183 std::vector<aType*>::iterator eLA = aNodeList.end(); \
184 SGNODE* psg = nullptr; \
185 while( sLA != eLA ) \
187 if( (SGNODE*) *sLA != aCallingNode ) \
189 psg = (SGNODE*) ( *sLA )->FindNode( aName, this ); \
190 if( nullptr != psg ) \
223 std::vector< SGVECTOR >& norms );
226 void FormatFloat( std::string& result,
double value );
An object to maintain a coordinate index list.
Define a vertex coordinate set for a scenegraph object.
Define a set of vertex normals for a scene graph object.
bool ReadVector(std::istream &aFile, SGVECTOR &aVector)
bool ReadPoint(std::istream &aFile, SGPOINT &aPoint)
bool WritePoint(std::ostream &aFile, const SGPOINT &aPoint)
bool WriteColor(std::ostream &aFile, const SGCOLOR &aColor)
bool CalcTriangleNormals(std::vector< SGPOINT > coords, std::vector< int > &index, std::vector< SGVECTOR > &norms)
void FormatColor(std::string &result, const SGCOLOR &aColor)
void FormatFloat(std::string &result, double value)
S3D::SGTYPES ReadTag(std::istream &aFile, std::string &aName)
Read the text tag of a binary cache file which is the NodeTag and unique ID number combined.
bool WriteVector(std::ostream &aFile, const SGVECTOR &aVector)
void FormatVector(std::string &result, const SGVECTOR &aVector)
void FormatPoint(std::string &result, const SGPOINT &point)
bool degenerate(glm::dvec3 *pts) noexcept
bool ReadColor(std::istream &aFile, SGCOLOR &aColor)
void FormatOrientation(std::string &result, const SGVECTOR &axis, double rotation)
defines the low level classes common to scene graph nodes
defines the types of intermediate scene graph objects