The SoFCMeshFaceSet class renders the mesh data structure. More...
#include <SoFCMeshFaceSet.h>
Public Member Functions | |
SoFCMeshFaceSet () | |
Static Public Member Functions | |
static void | initClass () |
Public Attributes | |
unsigned int | MaximumTriangles |
Protected Member Functions | |
virtual void | computeBBox (SoAction *action, SbBox3f &box, SbVec3f ¢er) |
Sets the bounding box of the mesh to box and its center to center. | |
virtual SoDetail * | createTriangleDetail (SoRayPickAction *action, const SoPrimitiveVertex *v1, const SoPrimitiveVertex *v2, const SoPrimitiveVertex *v3, SoPickedPoint *pp) |
If the number of triangles exceeds MaximumTriangles 0 is returned. | |
virtual void | generatePrimitives (SoAction *action) |
Sets the point indices, the geometric points and the normal for each triangle. | |
virtual void | getPrimitiveCount (SoGetPrimitiveCountAction *action) |
Adds the number of the triangles to the SoGetPrimitiveCountAction. | |
virtual void | GLRender (SoGLRenderAction *action) |
Either renders the complete mesh or only a subset of the points. | |
virtual void | rayPick (SoRayPickAction *action) |
Calculates picked point based on primitives generated by subclasses. |
The SoFCMeshFaceSet class renders the mesh data structure.
It does basically the same as SoFCMeshNode by rendering directly the FreeCAD mesh structure whereas this class follows more the Inventor way. While SoFCMeshFaceSet has a pointer to the mesh structure as a whole for SoFCMeshFaceSet the mesh is splitted into two nodes: an SoFCMeshVertex has a field that holds a pointer to vertex array and SoFCMeshFacet has a field that holds a pointer to the face array.
The advantage of separating the mesh structure is higher flexibility. E.g. to render open edges the class SoFCMeshOpenEdgeSet just takes the SoFCMeshVertex and SoFCMeshFaceSet nodes from the stack and does the rendering. The client programmer just has to add the an SoFCMeshOpenEdgeSet instance to the Inventor tree -- nothing more. Another advantage is that memory is saved when writing the scene to a file. The actual data is only hold and written by SoFCMeshVertex and SoFCMeshFaceSet. Normally, no shape nodes have to save further data to the file.
Definition at line 121 of file SoFCMeshFaceSet.h.
SoFCMeshFaceSet::SoFCMeshFaceSet | ( | ) |
Definition at line 429 of file SoFCMeshFaceSet.cpp.
void SoFCMeshFaceSet::computeBBox | ( | SoAction * | action, | |
SbBox3f & | box, | |||
SbVec3f & | center | |||
) | [protected, virtual] |
Sets the bounding box of the mesh to box and its center to center.
Definition at line 1025 of file SoFCMeshFaceSet.cpp.
References Base::BoundBox3< _Precision >::CalcCenter(), SketcherExample::f, MeshGui::SoFCMeshVertexElement::get(), Base::BoundBox3< _Precision >::MaxX, Base::BoundBox3< _Precision >::MaxY, Base::BoundBox3< _Precision >::MaxZ, Sketcher::mid, Base::BoundBox3< _Precision >::MinX, Base::BoundBox3< _Precision >::MinY, Base::BoundBox3< _Precision >::MinZ, Base::Vector3< _Precision >::x, Base::Vector3< _Precision >::y, and Base::Vector3< _Precision >::z.
SoDetail * SoFCMeshFaceSet::createTriangleDetail | ( | SoRayPickAction * | action, | |
const SoPrimitiveVertex * | v1, | |||
const SoPrimitiveVertex * | v2, | |||
const SoPrimitiveVertex * | v3, | |||
SoPickedPoint * | pp | |||
) | [protected, virtual] |
If the number of triangles exceeds MaximumTriangles 0 is returned.
This means that the client programmer needs to implement itself to get the index of the picked triangle. If the number of triangles doesn't exceed MaximumTriangles SoShape::createTriangleDetail() gets called. Against the default OpenInventor implementation which returns 0 as well Coin3d fills in the point and face indices.
Definition at line 1004 of file SoFCMeshFaceSet.cpp.
References MaximumTriangles.
void SoFCMeshFaceSet::generatePrimitives | ( | SoAction * | action | ) | [protected, virtual] |
Sets the point indices, the geometric points and the normal for each triangle.
If the number of triangles exceeds MaximumTriangles then only a triangulation of a rough model is filled in instead. This is due to performance issues.
Definition at line 867 of file SoFCMeshFaceSet.cpp.
References Base::Console(), MeshGui::SoFCMeshFacetElement::get(), MeshGui::SoFCMeshVertexElement::get(), sbvec3f(), Base::Vector3< _Precision >::x, Base::Vector3< _Precision >::y, and Base::Vector3< _Precision >::z.
void SoFCMeshFaceSet::getPrimitiveCount | ( | SoGetPrimitiveCountAction * | action | ) | [protected, virtual] |
Adds the number of the triangles to the SoGetPrimitiveCountAction.
Definition at line 1047 of file SoFCMeshFaceSet.cpp.
References MeshGui::SoFCMeshFacetElement::get().
void SoFCMeshFaceSet::GLRender | ( | SoGLRenderAction * | action | ) | [protected, virtual] |
Either renders the complete mesh or only a subset of the points.
Definition at line 606 of file SoFCMeshFaceSet.cpp.
References MeshGui::SoFCMeshFacetElement::get(), MeshGui::SoFCMeshVertexElement::get(), Gui::SoFCInteractiveElement::get(), and MaximumTriangles.
void SoFCMeshFaceSet::initClass | ( | void | ) | [static] |
Definition at line 424 of file SoFCMeshFaceSet.cpp.
void SoFCMeshFaceSet::rayPick | ( | SoRayPickAction * | action | ) | [protected, virtual] |
Calculates picked point based on primitives generated by subclasses.
Definition at line 848 of file SoFCMeshFaceSet.cpp.
unsigned int MeshGui::SoFCMeshFaceSet::MaximumTriangles |
Definition at line 130 of file SoFCMeshFaceSet.h.
Referenced by createTriangleDetail(), and GLRender().