KiCad PCB EDA Suite
Loading...
Searching...
No Matches
sg_helpers.h File Reference

Define a number of macros to aid in repetitious code which is probably best expressed as a preprocessor macro rather than as a template. More...

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include "plugins/3dapi/sg_base.h"
#include "plugins/3dapi/sg_types.h"
#include <glm/glm.hpp>

Go to the source code of this file.

Namespaces

namespace  S3D
 

Macros

#define DROP_REFS(aType, aList)
 
#define DEL_OBJS(aType, aList)
 
#define UNLINK_NODE(aNodeID, aType, aNode, aOwnedList, aRefList, isChild)
 
#define ADD_NODE(aNodeID, aType, aNode, aOwnedList, aRefList, isChild)
 
#define FIND_NODE(aType, aName, aNodeList, aCallingNode)
 

Functions

bool S3D::degenerate (glm::dvec3 *pts) noexcept
 
bool S3D::CalcTriangleNormals (std::vector< SGPOINT > coords, std::vector< int > &index, std::vector< SGVECTOR > &norms)
 
void S3D::FormatFloat (std::string &result, double value)
 
void S3D::FormatOrientation (std::string &result, const SGVECTOR &axis, double rotation)
 
void S3D::FormatPoint (std::string &result, const SGPOINT &point)
 
void S3D::FormatVector (std::string &result, const SGVECTOR &aVector)
 
void S3D::FormatColor (std::string &result, const SGCOLOR &aColor)
 
bool S3D::WritePoint (std::ostream &aFile, const SGPOINT &aPoint)
 
bool S3D::WriteVector (std::ostream &aFile, const SGVECTOR &aVector)
 
bool S3D::WriteColor (std::ostream &aFile, const SGCOLOR &aColor)
 
S3D::SGTYPES S3D::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. More...
 
bool S3D::ReadPoint (std::istream &aFile, SGPOINT &aPoint)
 
bool S3D::ReadVector (std::istream &aFile, SGVECTOR &aVector)
 
bool S3D::ReadColor (std::istream &aFile, SGCOLOR &aColor)
 

Detailed Description

Define a number of macros to aid in repetitious code which is probably best expressed as a preprocessor macro rather than as a template.

This header also declares a number of functions which are only of use within the sg_* classes.

Definition in file sg_helpers.h.

Macro Definition Documentation

◆ ADD_NODE

#define ADD_NODE (   aNodeID,
  aType,
  aNode,
  aOwnedList,
  aRefList,
  isChild 
)

Definition at line 132 of file sg_helpers.h.

◆ DEL_OBJS

#define DEL_OBJS (   aType,
  aList 
)
Value:
do \
{ \
std::vector<aType*>::iterator sL = aList.begin(); \
std::vector<aType*>::iterator eL = aList.end(); \
while( sL != eL ) \
{ \
( (SGNODE*) *sL )->SetParent( nullptr, false ); \
delete *sL; \
++sL; \
} \
aList.clear(); \
} while( 0 )
The base class of all Scene Graph nodes.
Definition: sg_node.h:75

Definition at line 69 of file sg_helpers.h.

◆ DROP_REFS

#define DROP_REFS (   aType,
  aList 
)
Value:
do \
{ \
std::vector<aType*>::iterator sL = aList.begin(); \
std::vector<aType*>::iterator eL = aList.end(); \
while( sL != eL ) \
{ \
( (SGNODE*) *sL )->delNodeRef( this ); \
++sL; \
} \
aList.clear(); \
} while( 0 )

Definition at line 52 of file sg_helpers.h.

◆ FIND_NODE

#define FIND_NODE (   aType,
  aName,
  aNodeList,
  aCallingNode 
)
Value:
do \
{ \
std::vector<aType*>::iterator sLA = aNodeList.begin(); \
std::vector<aType*>::iterator eLA = aNodeList.end(); \
SGNODE* psg = nullptr; \
while( sLA != eLA ) \
{ \
if( (SGNODE*) *sLA != aCallingNode ) \
{ \
psg = (SGNODE*) ( *sLA )->FindNode( aName, this ); \
if( nullptr != psg ) \
return psg; \
} \
++sLA; \
} \
} while( 0 )
virtual SGNODE * FindNode(const char *aNodeName, const SGNODE *aCaller)=0
Search the tree of linked nodes and return a reference to the first node found with the given name.

Definition at line 173 of file sg_helpers.h.

◆ UNLINK_NODE

#define UNLINK_NODE (   aNodeID,
  aType,
  aNode,
  aOwnedList,
  aRefList,
  isChild 
)

Definition at line 86 of file sg_helpers.h.