KiCad PCB EDA Suite
|
Classes | |
struct | MATLIST |
Enumerations | |
enum | SGTYPES { SGTYPE_TRANSFORM = 0 , SGTYPE_APPEARANCE , SGTYPE_COLORS , SGTYPE_COLORINDEX , SGTYPE_FACESET , SGTYPE_COORDS , SGTYPE_COORDINDEX , SGTYPE_NORMALS , SGTYPE_SHAPE , SGTYPE_END } |
Functions | |
bool | degenerate (glm::dvec3 *pts) noexcept |
bool | CalcTriangleNormals (std::vector< SGPOINT > coords, std::vector< int > &index, std::vector< SGVECTOR > &norms) |
void | FormatFloat (std::string &result, double value) |
void | FormatOrientation (std::string &result, const SGVECTOR &axis, double rotation) |
void | FormatPoint (std::string &result, const SGPOINT &point) |
void | FormatVector (std::string &result, const SGVECTOR &aVector) |
void | FormatColor (std::string &result, const SGCOLOR &aColor) |
bool | WritePoint (std::ostream &aFile, const SGPOINT &aPoint) |
bool | WriteVector (std::ostream &aFile, const SGVECTOR &aVector) |
bool | WriteColor (std::ostream &aFile, const SGCOLOR &aColor) |
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 | ReadPoint (std::istream &aFile, SGPOINT &aPoint) |
bool | ReadVector (std::istream &aFile, SGVECTOR &aVector) |
bool | ReadColor (std::istream &aFile, SGCOLOR &aColor) |
char const * | GetNodeTypeName (S3D::SGTYPES aType) noexcept |
Return the name of the given type of node. | |
bool | GetMatIndex (MATLIST &aList, SGNODE *aNode, int &aIndex) |
void | INIT_SMATERIAL (SMATERIAL &aMaterial) |
void | INIT_SMESH (SMESH &aMesh) noexcept |
void | INIT_S3DMODEL (S3DMODEL &aModel) noexcept |
void | FREE_SMESH (SMESH &aMesh) noexcept |
void | FREE_S3DMODEL (S3DMODEL &aModel) |
SGLIB_API void | GetLibVersion (unsigned char *Major, unsigned char *Minor, unsigned char *Patch, unsigned char *Revision) noexcept |
Function GetLibVersion retrieves version information of the kicad_3dsg library. | |
SGLIB_API S3D::SGTYPES | GetSGNodeType (SGNODE *aNode) |
SGLIB_API SGNODE * | GetSGNodeParent (SGNODE *aNode) |
SGLIB_API bool | AddSGNodeRef (SGNODE *aParent, SGNODE *aChild) |
SGLIB_API bool | AddSGNodeChild (SGNODE *aParent, SGNODE *aChild) |
SGLIB_API void | AssociateSGNodeWrapper (SGNODE *aObject, SGNODE **aRefPtr) |
SGLIB_API SGVECTOR | CalcTriNorm (const SGPOINT &p1, const SGPOINT &p2, const SGPOINT &p3) |
Function CalcTriNorm returns the normal vector of a triangle described by vertices p1, p2, p3. | |
SGLIB_API bool | WriteCache (const char *aFileName, bool overwrite, SGNODE *aNode, const char *aPluginInfo) |
Function WriteCache writes the SGNODE tree to a binary cache file. | |
SGLIB_API SGNODE * | ReadCache (const char *aFileName, void *aPluginMgr, bool(*aTagCheck)(const char *, void *)) |
Function ReadCache reads a binary cache file and creates an SGNODE tree. | |
SGLIB_API bool | WriteVRML (const char *filename, bool overwrite, SGNODE *aTopNode, bool reuse, bool renameNodes) |
Function WriteVRML writes out the given node and its subnodes to a VRML2 file. | |
SGLIB_API void | ResetNodeIndex (SGNODE *aNode) |
Function ResetNodeIndex resets the global SG* class indices. | |
SGLIB_API void | RenameNodes (SGNODE *aNode) |
Function RenameNodes renames a node and all children nodes based on the current values of the global SG* class indices. | |
SGLIB_API void | DestroyNode (SGNODE *aNode) noexcept |
Function DestroyNode deletes the given SG* class node. | |
SGLIB_API S3DMODEL * | GetModel (SCENEGRAPH *aNode) |
Function GetModel creates an S3DMODEL representation of aNode (raw data, no transforms) | |
SGLIB_API void | Destroy3DModel (S3DMODEL **aModel) |
Function Destroy3DModel frees memory used by an S3DMODEL structure and sets the pointer to the structure to NULL. | |
SGLIB_API void | Free3DModel (S3DMODEL &aModel) |
Function Free3DModel frees memory used internally by an S3DMODEL structure. | |
SGLIB_API void | Free3DMesh (SMESH &aMesh) |
Function Free3DMesh frees memory used internally by an SMESH structure. | |
SGLIB_API S3DMODEL * | New3DModel (void) |
Function New3DModel creates and initializes an S3DMODEL struct. | |
SGLIB_API void | Init3DMaterial (SMATERIAL &aMat) |
Function Init3DMaterial initializes an SMATERIAL struct. | |
SGLIB_API void | Init3DMesh (SMESH &aMesh) |
Function Init3DMesh creates and initializes an SMESH struct. | |
enum S3D::SGTYPES |
Enumerator | |
---|---|
SGTYPE_TRANSFORM | |
SGTYPE_APPEARANCE | |
SGTYPE_COLORS | |
SGTYPE_COLORINDEX | |
SGTYPE_FACESET | |
SGTYPE_COORDS | |
SGTYPE_COORDINDEX | |
SGTYPE_NORMALS | |
SGTYPE_SHAPE | |
SGTYPE_END |
Definition at line 34 of file sg_types.h.
Definition at line 512 of file ifsg_api.cpp.
References SGNODE::AddChildNode().
Referenced by addItems(), processFace(), WRL2APPEARANCE::TranslateToSG(), WRL2BASE::TranslateToSG(), WRL2BOX::TranslateToSG(), WRL2FACESET::TranslateToSG(), WRL2INLINE::TranslateToSG(), WRL2MATERIAL::TranslateToSG(), WRL2SHAPE::TranslateToSG(), WRL2TRANSFORM::TranslateToSG(), X3DAPP::TranslateToSG(), X3DIFACESET::TranslateToSG(), X3DSHAPE::TranslateToSG(), and X3DTRANSFORM::TranslateToSG().
Definition at line 503 of file ifsg_api.cpp.
References SGNODE::AddRefNode().
Referenced by addItems(), processFace(), WRL2APPEARANCE::TranslateToSG(), WRL2BASE::TranslateToSG(), WRL2BOX::TranslateToSG(), WRL2FACESET::TranslateToSG(), WRL2INLINE::TranslateToSG(), WRL2MATERIAL::TranslateToSG(), WRL2SHAPE::TranslateToSG(), WRL2TRANSFORM::TranslateToSG(), X3DAPP::TranslateToSG(), X3DIFACESET::TranslateToSG(), X3DSHAPE::TranslateToSG(), and X3DTRANSFORM::TranslateToSG().
Definition at line 521 of file ifsg_api.cpp.
References SGNODE::AssociateWrapper().
bool S3D::CalcTriangleNormals | ( | std::vector< SGPOINT > | coords, |
std::vector< int > & | index, | ||
std::vector< SGVECTOR > & | norms | ||
) |
Definition at line 353 of file sg_helpers.cpp.
References calcTriad().
Referenced by SGCOORDS::CalcNormals().
Function CalcTriNorm returns the normal vector of a triangle described by vertices p1, p2, p3.
Definition at line 464 of file ifsg_api.cpp.
References degenerate(), SGPOINT::x, SGPOINT::y, and SGPOINT::z.
Referenced by EXPORTER_PCB_VRML::create_vrml_shell(), and vrmlToSG().
|
noexcept |
Definition at line 310 of file sg_helpers.cpp.
Referenced by calcTriad(), and CalcTriNorm().
void S3D::Destroy3DModel | ( | S3DMODEL ** | aModel | ) |
Function Destroy3DModel frees memory used by an S3DMODEL structure and sets the pointer to the structure to NULL.
Definition at line 403 of file ifsg_api.cpp.
References FREE_S3DMODEL().
Referenced by S3D_CACHE::load(), and S3D_CACHE_ENTRY::~S3D_CACHE_ENTRY().
|
noexcept |
Function DestroyNode deletes the given SG* class node.
This function makes it possible to safely delete an SG* node without associating the node with its corresponding IFSG* wrapper.
Definition at line 149 of file ifsg_api.cpp.
Referenced by S3D_CACHE::load(), S3D_CACHE::loadCacheData(), WRL1MATERIAL::Reclaim(), DATA::~DATA(), EXPORTER_PCB_VRML::~EXPORTER_PCB_VRML(), WRL1MATERIAL::~WRL1MATERIAL(), and WRL2BASE::~WRL2BASE().
void S3D::FormatColor | ( | std::string & | result, |
const SGCOLOR & | aColor | ||
) |
Definition at line 135 of file sg_helpers.cpp.
References FormatFloat(), G, and SGCOLOR::GetColor().
Referenced by SGCOLORS::WriteVRML().
void S3D::FormatFloat | ( | std::string & | result, |
double | value | ||
) |
Definition at line 37 of file sg_helpers.cpp.
Referenced by FormatColor(), FormatOrientation(), FormatPoint(), FormatVector(), and SGAPPEARANCE::WriteVRML().
void S3D::FormatOrientation | ( | std::string & | result, |
const SGVECTOR & | axis, | ||
double | rotation | ||
) |
Definition at line 82 of file sg_helpers.cpp.
References FormatFloat(), and SGVECTOR::GetVector().
Referenced by SCENEGRAPH::WriteVRML().
void S3D::FormatPoint | ( | std::string & | result, |
const SGPOINT & | point | ||
) |
Definition at line 103 of file sg_helpers.cpp.
References FormatFloat(), SGPOINT::x, SGPOINT::y, and SGPOINT::z.
Referenced by SCENEGRAPH::WriteVRML(), and SGCOORDS::WriteVRML().
void S3D::FormatVector | ( | std::string & | result, |
const SGVECTOR & | aVector | ||
) |
Definition at line 118 of file sg_helpers.cpp.
References FormatFloat(), SGVECTOR::GetVector(), and X.
Referenced by SGNORMALS::WriteVRML().
void S3D::Free3DMesh | ( | SMESH & | aMesh | ) |
Function Free3DMesh frees memory used internally by an SMESH structure.
Definition at line 421 of file ifsg_api.cpp.
References FREE_SMESH().
Referenced by GetModel().
Function Free3DModel frees memory used internally by an S3DMODEL structure.
void S3D::FREE_S3DMODEL | ( | S3DMODEL & | aModel | ) |
Definition at line 326 of file sg_node.cpp.
References FREE_SMESH(), S3DMODEL::m_Materials, S3DMODEL::m_MaterialsSize, S3DMODEL::m_Meshes, and S3DMODEL::m_MeshesSize.
Referenced by Destroy3DModel(), and Free3DModel().
|
noexcept |
Definition at line 288 of file sg_node.cpp.
Referenced by Free3DMesh(), and FREE_S3DMODEL().
|
noexcept |
Function GetLibVersion retrieves version information of the kicad_3dsg library.
Definition at line 447 of file ifsg_api.cpp.
References KICADSG_VERSION_MAJOR, KICADSG_VERSION_MINOR, KICADSG_VERSION_PATCH, and KICADSG_VERSION_REVISION.
Definition at line 245 of file sg_node.cpp.
References SGNODE::GetNodeType(), S3D::MATLIST::matmap, S3D::MATLIST::matorder, and SGTYPE_APPEARANCE.
Referenced by SGSHAPE::Prepare().
S3DMODEL * S3D::GetModel | ( | SCENEGRAPH * | aNode | ) |
Function GetModel creates an S3DMODEL representation of aNode (raw data, no transforms)
aNode | is the node to be transcribed into an S3DMODEL representation |
Definition at line 338 of file ifsg_api.cpp.
References SGAPPEARANCE::ambient, SGAPPEARANCE::diffuse, formatMaterial(), Free3DMesh(), SGNODE::GetNodeType(), S3DMODEL::m_Materials, S3DMODEL::m_MaterialsSize, S3DMODEL::m_Meshes, S3DMODEL::m_MeshesSize, S3D::MATLIST::matmap, S3D::MATLIST::matorder, New3DModel(), SCENEGRAPH::Prepare(), SGTYPE_TRANSFORM, SGAPPEARANCE::shininess, SGAPPEARANCE::specular, and SGAPPEARANCE::transparency.
Referenced by S3D_CACHE::GetModel().
|
noexcept |
Return the name of the given type of node.
Definition at line 53 of file sg_node.cpp.
References node_names.
Referenced by ReadTag().
Definition at line 494 of file ifsg_api.cpp.
References SGNODE::GetParent().
Referenced by addItems(), SHAPE::CalcShape(), EXPORTER_PCB_VRML::create_vrml_plane(), EXPORTER_PCB_VRML::create_vrml_shell(), EXPORTER_PCB_VRML::ExportVrmlFootprint(), processFace(), WRL1MATERIAL::Reclaim(), WRL2APPEARANCE::TranslateToSG(), WRL2BASE::TranslateToSG(), WRL2BOX::TranslateToSG(), WRL2FACESET::TranslateToSG(), WRL2INLINE::TranslateToSG(), WRL2MATERIAL::TranslateToSG(), WRL2SHAPE::TranslateToSG(), WRL2TRANSFORM::TranslateToSG(), X3DAPP::TranslateToSG(), X3DIFACESET::TranslateToSG(), X3DSHAPE::TranslateToSG(), X3DTRANSFORM::TranslateToSG(), DATA::~DATA(), EXPORTER_PCB_VRML::~EXPORTER_PCB_VRML(), WRL1MATERIAL::~WRL1MATERIAL(), and WRL2BASE::~WRL2BASE().
S3D::SGTYPES S3D::GetSGNodeType | ( | SGNODE * | aNode | ) |
Definition at line 485 of file ifsg_api.cpp.
References SGNODE::GetNodeType(), and SGTYPE_END.
Referenced by WRL2APPEARANCE::TranslateToSG(), WRL2BOX::TranslateToSG(), WRL2FACESET::TranslateToSG(), WRL2INLINE::TranslateToSG(), WRL2MATERIAL::TranslateToSG(), WRL2SHAPE::TranslateToSG(), WRL2SWITCH::TranslateToSG(), WRL2TRANSFORM::TranslateToSG(), X3DAPP::TranslateToSG(), X3DIFACESET::TranslateToSG(), X3DSHAPE::TranslateToSG(), X3DTRANSFORM::TranslateToSG(), WRL1GROUP::TranslateToSG(), and WRL1SEPARATOR::TranslateToSG().
void S3D::Init3DMaterial | ( | SMATERIAL & | aMat | ) |
Function Init3DMaterial initializes an SMATERIAL struct.
Definition at line 435 of file ifsg_api.cpp.
References INIT_SMATERIAL().
void S3D::Init3DMesh | ( | SMESH & | aMesh | ) |
Function Init3DMesh creates and initializes an SMESH struct.
Definition at line 441 of file ifsg_api.cpp.
References INIT_SMESH().
|
noexcept |
Definition at line 282 of file sg_node.cpp.
Referenced by New3DModel().
void S3D::INIT_SMATERIAL | ( | SMATERIAL & | aMaterial | ) |
Definition at line 270 of file sg_node.cpp.
Referenced by Init3DMaterial().
|
noexcept |
Definition at line 276 of file sg_node.cpp.
Referenced by Init3DMesh(), and SGSHAPE::Prepare().
S3DMODEL * S3D::New3DModel | ( | void | ) |
Function New3DModel creates and initializes an S3DMODEL struct.
Definition at line 427 of file ifsg_api.cpp.
References INIT_S3DMODEL().
Referenced by GetModel().
SGNODE * S3D::ReadCache | ( | const char * | aFileName, |
void * | aPluginMgr, | ||
bool(*)(const char *, void *) | aTagCheck | ||
) |
Function ReadCache reads a binary cache file and creates an SGNODE tree.
aFileName | is the name of the binary cache file to be read |
Definition at line 221 of file ifsg_api.cpp.
References CLOSE_STREAM, name, OPEN_ISTREAM, and SG_VERSION_TAG.
Referenced by S3D_CACHE::loadCacheData().
bool S3D::ReadColor | ( | std::istream & | aFile, |
SGCOLOR & | aColor | ||
) |
Definition at line 295 of file sg_helpers.cpp.
References SGCOLOR::SetColor().
Referenced by SGAPPEARANCE::ReadCache(), and SGCOLORS::ReadCache().
bool S3D::ReadPoint | ( | std::istream & | aFile, |
SGPOINT & | aPoint | ||
) |
Definition at line 267 of file sg_helpers.cpp.
References SGPOINT::x, SGPOINT::y, and SGPOINT::z.
Referenced by SCENEGRAPH::ReadCache(), and SGCOORDS::ReadCache().
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.
aFile | is a binary file open for reading. |
aName | will hold the tag name on successful return. |
Definition at line 195 of file sg_helpers.cpp.
References GetNodeTypeName(), name, SGTYPE_APPEARANCE, SGTYPE_COLORINDEX, SGTYPE_COLORS, SGTYPE_COORDINDEX, SGTYPE_COORDS, SGTYPE_END, SGTYPE_FACESET, SGTYPE_NORMALS, SGTYPE_SHAPE, and SGTYPE_TRANSFORM.
Referenced by SCENEGRAPH::ReadCache(), SGFACESET::ReadCache(), and SGSHAPE::ReadCache().
bool S3D::ReadVector | ( | std::istream & | aFile, |
SGVECTOR & | aVector | ||
) |
Definition at line 280 of file sg_helpers.cpp.
References SGVECTOR::SetVector().
Referenced by SCENEGRAPH::ReadCache(), and SGNORMALS::ReadCache().
void S3D::RenameNodes | ( | SGNODE * | aNode | ) |
Function RenameNodes renames a node and all children nodes based on the current values of the global SG* class indices.
aNode | is a top level node |
Definition at line 141 of file ifsg_api.cpp.
References SGNODE::ReNameNodes().
void S3D::ResetNodeIndex | ( | SGNODE * | aNode | ) |
Function ResetNodeIndex resets the global SG* class indices.
aNode | may be any valid SGNODE |
Definition at line 133 of file ifsg_api.cpp.
References SGNODE::ResetNodeIndex().
bool S3D::WriteCache | ( | const char * | aFileName, |
bool | overwrite, | ||
SGNODE * | aNode, | ||
const char * | aPluginInfo | ||
) |
Function WriteCache writes the SGNODE tree to a binary cache file.
aFileName | is the name of the file to write |
overwrite | must be set to true to overwrite an existing file |
aNode | is any node within the node tree which is to be written |
Definition at line 157 of file ifsg_api.cpp.
References CLOSE_STREAM, OPEN_OSTREAM, SG_VERSION_TAG, and SGNODE::WriteCache().
Referenced by S3D_CACHE::saveCacheData().
bool S3D::WriteColor | ( | std::ostream & | aFile, |
const SGCOLOR & | aColor | ||
) |
Definition at line 180 of file sg_helpers.cpp.
References SGCOLOR::GetColor().
Referenced by SGAPPEARANCE::WriteCache(), and SGCOLORS::WriteCache().
bool S3D::WritePoint | ( | std::ostream & | aFile, |
const SGPOINT & | aPoint | ||
) |
Definition at line 152 of file sg_helpers.cpp.
References SGPOINT::x, SGPOINT::y, and SGPOINT::z.
Referenced by SCENEGRAPH::WriteCache(), and SGCOORDS::WriteCache().
bool S3D::WriteVector | ( | std::ostream & | aFile, |
const SGVECTOR & | aVector | ||
) |
Definition at line 165 of file sg_helpers.cpp.
References SGVECTOR::GetVector().
Referenced by SCENEGRAPH::WriteCache(), and SGNORMALS::WriteCache().
bool S3D::WriteVRML | ( | const char * | filename, |
bool | overwrite, | ||
SGNODE * | aTopNode, | ||
bool | reuse, | ||
bool | renameNodes | ||
) |
Function WriteVRML writes out the given node and its subnodes to a VRML2 file.
filename | is the name of the output file |
overwrite | should be set to true to overwrite an existing VRML file |
aTopNode | is a pointer to a SCENEGRAPH object representing the VRML scene |
reuse | should be set to true to make use of VRML DEF/USE features |
Definition at line 77 of file ifsg_api.cpp.
References CLOSE_STREAM, SGNODE::GetNodeType(), OPEN_OSTREAM, SGNODE::ReNameNodes(), SGNODE::ResetNodeIndex(), SGTYPE_TRANSFORM, and SGNODE::WriteVRML().
Referenced by EXPORTER_PCB_VRML::ExportVrmlFootprint(), Load(), LoadModel(), LoadVRML(), and EXPORTER_PCB_VRML::writeLayers().