KiCad PCB EDA Suite
sg_helpers.h File Reference

defines a number of macro functions 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

 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)
 
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)
 Function ReadTag reads 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

defines a number of macro functions 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

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

Definition at line 113 of file sg_helpers.h.

Referenced by SCENEGRAPH::addNode().

#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( NULL, false ); \
delete *sL; \
++sL; \
} \
aList.clear(); \
} while( 0 )
Class SGNODE represents the base class of all Scene Graph nodes.
Definition: sg_node.h:76

Definition at line 64 of file sg_helpers.h.

Referenced by SCENEGRAPH::~SCENEGRAPH().

#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 )
Class SGNODE represents the base class of all Scene Graph nodes.
Definition: sg_node.h:76

Definition at line 50 of file sg_helpers.h.

Referenced by SCENEGRAPH::~SCENEGRAPH().

#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 = NULL; \
while( sLA != eLA ) { \
if( (SGNODE*)*sLA != aCallingNode ) { \
psg = (SGNODE*) (*sLA)->FindNode( aName, this ); \
if( NULL != psg) \
return psg; \
} \
++sLA; \
} } while ( 0 )
if(dlg.ShowModal()==wxID_OK)
Definition: selcolor.cpp:75
Class SGNODE represents the base class of all Scene Graph nodes.
Definition: sg_node.h:76

Definition at line 149 of file sg_helpers.h.

Referenced by SCENEGRAPH::FindNode().

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

Definition at line 78 of file sg_helpers.h.

Referenced by SCENEGRAPH::unlinkNode().