CObjectModel Class Reference

List of all members.

Detailed Description

Scene object model consisting only of SoIndexedFaceSet.

This model is created to be able generate shadow volumes independently of scene object plygon type. Model is created by addTriangleCallback called for every triangle. Model must be updated when the object shape changes or object's scale is updated.

Definition at line 68 of file ObjectModel.h.

Public Member Functions

 CObjectModel ()
 Constructor.
 ~CObjectModel ()
 Destructor.
void createFaceModel (SoSeparator *object)
 Create indexed Face Set model of the object in it's local coordinates.
SoSeparator * getFaceModelNode ()
 Returns the model root node.
int32_t getTrianglesCount ()
 Returns number of model triangles.

Public Attributes

SoCoordinate3 * modelCoord3
 Object model coordinates.
SoIndexedFaceSet * modelIfs
 Object model polygon indices.
SoNormal * modelNormal
 Object model normals.
int coord3idx
 Object model polygon index.

Static Public Attributes

static SbVec3f prevNormal
 Previous normal.

Static Private Member Functions

static SbVec3f faceNormal (const SbVec3f p1, const SbVec3f p2, const SbVec3f p3)
 Computes the triangle normal vector from its verteces.
static void TriangleCB (void *userdata, SoCallbackAction *action, const SoPrimitiveVertex *v1, const SoPrimitiveVertex *v2, const SoPrimitiveVertex *v3)
 Creates a SoIndexedFaceSet model of a an object.

Private Attributes

SoSeparator * objectModelRoot
 Object model.
int32_t nTriangles
 Number of triangles of the object.


Constructor & Destructor Documentation

CObjectModel::CObjectModel  ) 
 

Constructor.

Definition at line 44 of file ObjectModel.cpp.

References modelCoord3, modelIfs, nTriangles, and objectModelRoot.

CObjectModel::~CObjectModel  ) 
 

Destructor.

Definition at line 56 of file ObjectModel.cpp.

References objectModelRoot.


Member Function Documentation

SbVec3f CObjectModel::faceNormal const SbVec3f  p1,
const SbVec3f  p2,
const SbVec3f  p3
[static, private]
 

Computes the triangle normal vector from its verteces.

Counterclockwise orientation.

Parameters:
p1 point 1
p2 point 2
p3 point 3
Returns:
face normal vector

Definition at line 73 of file ObjectModel.cpp.

References ONDEBUG.

Referenced by TriangleCB().

void CObjectModel::TriangleCB void *  userdata,
SoCallbackAction *  action,
const SoPrimitiveVertex *  v1,
const SoPrimitiveVertex *  v2,
const SoPrimitiveVertex *  v3
[static, private]
 

Creates a SoIndexedFaceSet model of a an object.

This CB is called for every polygon in scene graph.

Parameters:
userdata Pointer to the object model.
action Pointer to callback action.
v1 Pointer to vertex 1.
v2 Pointer to vertex 2.
v3 Pointer to vertex 3.

Definition at line 114 of file ObjectModel.cpp.

References coord3idx, faceNormal(), modelCoord3, modelIfs, modelNormal, and nTriangles.

Referenced by createFaceModel().

void CObjectModel::createFaceModel SoSeparator *  object  ) 
 

Create indexed Face Set model of the object in it's local coordinates.

Parameters:
object Pointer to the object node.

Definition at line 186 of file ObjectModel.cpp.

References coord3idx, modelCoord3, modelIfs, modelNormal, nTriangles, objectModelRoot, ONDEBUG, and TriangleCB().

Referenced by SoShadowCaster::createFaceModel().

SoSeparator * CObjectModel::getFaceModelNode  ) 
 

Returns the model root node.

Definition at line 233 of file ObjectModel.cpp.

References objectModelRoot.

Referenced by SoShadowCaster::showFaceModel().

int32_t CObjectModel::getTrianglesCount  ) 
 

Returns number of model triangles.

Definition at line 242 of file ObjectModel.cpp.

References nTriangles.


Member Data Documentation

SoSeparator* CObjectModel::objectModelRoot [private]
 

Object model.

Definition at line 72 of file ObjectModel.h.

Referenced by CObjectModel(), createFaceModel(), getFaceModelNode(), and ~CObjectModel().

int32_t CObjectModel::nTriangles [private]
 

Number of triangles of the object.

Definition at line 74 of file ObjectModel.h.

Referenced by CObjectModel(), createFaceModel(), getTrianglesCount(), and TriangleCB().

SoCoordinate3* CObjectModel::modelCoord3
 

Object model coordinates.

Definition at line 85 of file ObjectModel.h.

Referenced by CObjectModel(), createFaceModel(), and TriangleCB().

SoIndexedFaceSet* CObjectModel::modelIfs
 

Object model polygon indices.

Definition at line 87 of file ObjectModel.h.

Referenced by CObjectModel(), createFaceModel(), and TriangleCB().

SoNormal* CObjectModel::modelNormal
 

Object model normals.

Definition at line 89 of file ObjectModel.h.

Referenced by createFaceModel(), and TriangleCB().

int CObjectModel::coord3idx
 

Object model polygon index.

Definition at line 91 of file ObjectModel.h.

Referenced by createFaceModel(), and TriangleCB().

SbVec3f CObjectModel::prevNormal [static]
 

Previous normal.

Definition at line 94 of file ObjectModel.h.


The documentation for this class was generated from the following files:
Generated on Wed May 17 17:27:52 2006 for Shadow Engine by  doxygen 1.4.6-NO