MeshGui::SoFCMeshFaceSet Class Reference

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 &center)
 Sets the bounding box of the mesh to box and its center to center. More...
 
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. More...
 
virtual void generatePrimitives (SoAction *action)
 Sets the point indices, the geometric points and the normal for each triangle. More...
 
virtual void getPrimitiveCount (SoGetPrimitiveCountAction *action)
 Adds the number of the triangles to the SoGetPrimitiveCountAction. More...
 
virtual void GLRender (SoGLRenderAction *action)
 Either renders the complete mesh or only a subset of the points. More...
 
virtual void rayPick (SoRayPickAction *action)
 Calculates picked point based on primitives generated by subclasses. More...
 

Detailed Description

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 split 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.

Author
Werner Mayer

Constructor & Destructor Documentation

◆ SoFCMeshFaceSet()

SoFCMeshFaceSet::SoFCMeshFaceSet ( )

Member Function Documentation

◆ computeBBox()

void SoFCMeshFaceSet::computeBBox ( SoAction action,
SbBox3f &  box,
SbVec3f &  center 
)
protectedvirtual

◆ createTriangleDetail()

SoDetail * SoFCMeshFaceSet::createTriangleDetail ( SoRayPickAction *  action,
const SoPrimitiveVertex *  v1,
const SoPrimitiveVertex *  v2,
const SoPrimitiveVertex *  v3,
SoPickedPoint *  pp 
)
protectedvirtual

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.

References MaximumTriangles.

◆ generatePrimitives()

void SoFCMeshFaceSet::generatePrimitives ( SoAction action)
protectedvirtual

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.

See also
createTriangleDetail().

References Base::Console(), MeshGui::SoFCMeshFacetElement::get(), MeshGui::SoFCMeshVertexElement::get(), and Base::ConsoleSingleton::Log().

◆ getPrimitiveCount()

void SoFCMeshFaceSet::getPrimitiveCount ( SoGetPrimitiveCountAction *  action)
protectedvirtual

Adds the number of the triangles to the SoGetPrimitiveCountAction.

References MeshGui::SoFCMeshFacetElement::get().

◆ GLRender()

void SoFCMeshFaceSet::GLRender ( SoGLRenderAction action)
protectedvirtual

Either renders the complete mesh or only a subset of the points.

References Gui::SoFCInteractiveElement::get(), MeshGui::SoFCMeshFacetElement::get(), and MeshGui::SoFCMeshVertexElement::get().

◆ initClass()

void SoFCMeshFaceSet::initClass ( void  )
static

◆ rayPick()

void SoFCMeshFaceSet::rayPick ( SoRayPickAction *  action)
protectedvirtual

Calculates picked point based on primitives generated by subclasses.

Member Data Documentation

◆ MaximumTriangles

unsigned int MeshGui::SoFCMeshFaceSet::MaximumTriangles

Referenced by createTriangleDetail().


The documentation for this class was generated from the following files: