Physics::MeshHandler Class Reference

GeometryHandler for meshes - Somewhat tested, quite stable, but still experimental. More...

#include <GeometryHandlers.h>

Inheritance diagram for Physics::MeshHandler:

Inheritance graph
[legend]

List of all members.

Public Member Functions

 MeshHandler (const osg::Geometry *pGfxGeometry)
 Builds a mesh handler from an existing geometry (do not copy data).
 MeshHandler (osg::Node *pModel)
 Convinience constructor that builds a mesh handler using a copy of the first geometry of the given node.
 MeshHandler (const osg::HeightField *pGfxHeightField)
 Builds a mesh handler by copying a height field into an internal geometry.
virtual EGeomType type () const
const osg::Geometry * getGeometry () const
osg::Geometry * DEBUG_getOwnGeometry ()
 ONLY TO DEBUG HEIGHTFIELDS - MUST NOT BE USED FOR ANYTHING ELSE THAN DEBUG.
void clearCache ()
 Should be called each step (before world step) for trimesh collisions.
virtual UINT getADOverrideFlag ()
 Gets the auto-disable override flag (default is no override - can be overloaded in derivates). The method returns which parameters can be overriden by the geometry.
virtual UINT getADSteps ()
virtual UINT getADSamplesCount ()
virtual dReal getADLinearThreshold ()
virtual dReal getADAngularThreshold ()
virtual GeometryHandlerclone () const

Protected Types

typedef
osg::TemplateIndexArray
< GLuint,
osg::Array::UIntArrayType,
sizeof(GLuint),
GL_UNSIGNED_INT > 
TIndexArray

Protected Member Functions

virtual dGeomID create (dSpaceID spaceId)
template<class TDrawElements >
void indexAdd (const osg::PrimitiveSet *pPrimitive)
void indexTriangles (UINT lengthPrimitive, UINT offset)
void indexTriangleStrip (UINT lengthPrimitive, UINT offset)
void indexTriangleFan (UINT lengthPrimitive, UINT offset)
void indexQuads (UINT lengthPrimitive, UINT offset)
void indexQuadStrip (UINT lengthPrimitive, UINT offset)
template<class TDrawElements >
void indexTriangles (const TDrawElements *pPrimitive)
template<class TDrawElements >
void indexTriangleStrip (const TDrawElements *pPrimitive)
template<class TDrawElements >
void indexTriangleFan (const TDrawElements *pPrimitive)
template<class TDrawElements >
void indexQuads (const TDrawElements *pPrimitive)
template<class TDrawElements >
void indexQuadStrip (const TDrawElements *pPrimitive)
template<class TDrawElements >
void indexByType (const osg::PrimitiveSet *pPrimitive)
 Calls appropriate index*<>(const TDrawElements *).
virtual ~MeshHandler ()

Protected Attributes

const osg::Geometry * pGeo
dTriMeshDataID meshDataId
osg::ref_ptr< TIndexArraypLocalIndexArray

Private Attributes

osg::ref_ptr< osg::Geometry > pOwnGeo


Detailed Description

GeometryHandler for meshes - Somewhat tested, quite stable, but still experimental.

Author:
Sukender
Version:
0.2.0 - Quite good but it seems to still have problems using trimeshes with ODE

Definition at line 389 of file GeometryHandlers.h.


Member Typedef Documentation

typedef osg::TemplateIndexArray< GLuint, osg::Array::UIntArrayType, sizeof(GLuint), GL_UNSIGNED_INT > Physics::MeshHandler::TIndexArray [protected]

Definition at line 439 of file GeometryHandlers.h.


Constructor & Destructor Documentation

Physics::MeshHandler::MeshHandler ( const osg::Geometry *  pGfxGeometry  )  [inline]

Builds a mesh handler from an existing geometry (do not copy data).

Definition at line 392 of file GeometryHandlers.h.

Physics::MeshHandler::MeshHandler ( osg::Node *  pModel  ) 

Convinience constructor that builds a mesh handler using a copy of the first geometry of the given node.

Dev note: Sorry but the Node * cannot be const since the constructor uses a visitor and OSG doesn't implement accept() for const nodes.

Definition at line 384 of file GeometryHandlers.cpp.

References meshDataId, pGeo, pOwnGeo, THROW_TRACED_EXCEPTION, and FindGeometriesVisitor::vFoundGeometries.

Physics::MeshHandler::MeshHandler ( const osg::HeightField *  pGfxHeightField  ) 

Builds a mesh handler by copying a height field into an internal geometry.

Deprecated:
Use the HeightFieldHandler instead of the mesh handler for height field terrains.

Definition at line 395 of file GeometryHandlers.cpp.

References meshDataId, pGeo, pOwnGeo, and V.

virtual Physics::MeshHandler::~MeshHandler (  )  [inline, protected, virtual]

Definition at line 468 of file GeometryHandlers.h.


Member Function Documentation

void Physics::MeshHandler::clearCache (  )  [inline]

Should be called each step (before world step) for trimesh collisions.

Definition at line 410 of file GeometryHandlers.h.

virtual GeometryHandler* Physics::MeshHandler::clone (  )  const [inline, virtual]

Implements Physics::GeometryHandler.

Definition at line 430 of file GeometryHandlers.h.

References THROW_TRACED_EXCEPTION.

dGeomID Physics::MeshHandler::create ( dSpaceID  spaceId  )  [protected, virtual]

Todo:
check if ALL primitive sets are triangles (list, strip, or fan) => use direct data. If not (Quads or mixed) => rebuild data or use no data.

Todo:
interpret BIND_PER_VERTEX by doing a sum + normalization (what about quads !? use 4-vertices or 3-vertices ?)

Implements Physics::GeometryHandler.

Definition at line 260 of file GeometryHandlers.cpp.

References ASSERT, indexQuads(), indexQuadStrip(), indexTriangleFan(), indexTriangles(), indexTriangleStrip(), LOG_INFO, LOG_NOTICE, LOG_WARN, meshDataId, pGeo, pLocalIndexArray, and THROW_TRACED_EXCEPTION.

osg::Geometry* Physics::MeshHandler::DEBUG_getOwnGeometry (  )  [inline]

ONLY TO DEBUG HEIGHTFIELDS - MUST NOT BE USED FOR ANYTHING ELSE THAN DEBUG.

Definition at line 405 of file GeometryHandlers.h.

dReal Physics::MeshHandler::getADAngularThreshold (  )  [virtual]

Reimplemented from Physics::GeometryHandler.

Definition at line 488 of file GeometryHandlers.cpp.

dReal Physics::MeshHandler::getADLinearThreshold (  )  [virtual]

Reimplemented from Physics::GeometryHandler.

Definition at line 487 of file GeometryHandlers.cpp.

UINT Physics::MeshHandler::getADOverrideFlag (  )  [virtual]

Gets the auto-disable override flag (default is no override - can be overloaded in derivates). The method returns which parameters can be overriden by the geometry.

Reimplemented from Physics::GeometryHandler.

Definition at line 483 of file GeometryHandlers.cpp.

References Physics::GeometryHandler::AD_ANGULAR, Physics::GeometryHandler::AD_LINEAR, Physics::GeometryHandler::AD_SAMPLES_COUNT, and Physics::GeometryHandler::AD_STEPS.

UINT Physics::MeshHandler::getADSamplesCount (  )  [virtual]

Reimplemented from Physics::GeometryHandler.

Definition at line 486 of file GeometryHandlers.cpp.

UINT Physics::MeshHandler::getADSteps (  )  [virtual]

Reimplemented from Physics::GeometryHandler.

Definition at line 485 of file GeometryHandlers.cpp.

const osg::Geometry* Physics::MeshHandler::getGeometry (  )  const [inline]

Definition at line 402 of file GeometryHandlers.h.

References ASSERT.

template<class TDrawElements >
void Physics::MeshHandler::indexAdd ( const osg::PrimitiveSet *  pPrimitive  )  [inline, protected]

template<class TDrawElements >
void Physics::MeshHandler::indexByType ( const osg::PrimitiveSet *  pPrimitive  )  [inline, protected]

Calls appropriate index*<>(const TDrawElements *).

Definition at line 246 of file GeometryHandlers.cpp.

References THROW_TRACED_EXCEPTION.

template<class TDrawElements >
void Physics::MeshHandler::indexQuads ( const TDrawElements *  pPrimitive  )  [inline, protected]

Definition at line 175 of file GeometryHandlers.cpp.

References ASSERT, and pLocalIndexArray.

void Physics::MeshHandler::indexQuads ( UINT  lengthPrimitive,
UINT  offset 
) [protected]

Definition at line 159 of file GeometryHandlers.cpp.

References pLocalIndexArray.

Referenced by create().

template<class TDrawElements >
void Physics::MeshHandler::indexQuadStrip ( const TDrawElements *  pPrimitive  )  [inline, protected]

Definition at line 217 of file GeometryHandlers.cpp.

References ASSERT, and pLocalIndexArray.

void Physics::MeshHandler::indexQuadStrip ( UINT  lengthPrimitive,
UINT  offset 
) [protected]

Definition at line 201 of file GeometryHandlers.cpp.

References pLocalIndexArray.

Referenced by create().

template<class TDrawElements >
void Physics::MeshHandler::indexTriangleFan ( const TDrawElements *  pPrimitive  )  [inline, protected]

Definition at line 139 of file GeometryHandlers.cpp.

References ASSERT, and pLocalIndexArray.

void Physics::MeshHandler::indexTriangleFan ( UINT  lengthPrimitive,
UINT  offset 
) [protected]

Definition at line 127 of file GeometryHandlers.cpp.

References pLocalIndexArray.

Referenced by create().

template<class TDrawElements >
void Physics::MeshHandler::indexTriangles ( const TDrawElements *  pPrimitive  )  [inline, protected]

Definition at line 74 of file GeometryHandlers.cpp.

References pLocalIndexArray.

void Physics::MeshHandler::indexTriangles ( UINT  lengthPrimitive,
UINT  offset 
) [protected]

Definition at line 66 of file GeometryHandlers.cpp.

References pLocalIndexArray.

Referenced by create().

template<class TDrawElements >
void Physics::MeshHandler::indexTriangleStrip ( const TDrawElements *  pPrimitive  )  [inline, protected]

Definition at line 100 of file GeometryHandlers.cpp.

References ASSERT, and pLocalIndexArray.

void Physics::MeshHandler::indexTriangleStrip ( UINT  lengthPrimitive,
UINT  offset 
) [protected]

Definition at line 81 of file GeometryHandlers.cpp.

References pLocalIndexArray.

Referenced by create().

virtual EGeomType Physics::MeshHandler::type (  )  const [inline, virtual]

Implements Physics::GeometryHandler.

Definition at line 400 of file GeometryHandlers.h.


Member Data Documentation

dTriMeshDataID Physics::MeshHandler::meshDataId [protected]

Definition at line 437 of file GeometryHandlers.h.

Referenced by create(), and MeshHandler().

const osg::Geometry* Physics::MeshHandler::pGeo [protected]

Definition at line 436 of file GeometryHandlers.h.

Referenced by create(), and MeshHandler().

osg::ref_ptr<osg::Geometry> Physics::MeshHandler::pOwnGeo [private]

Definition at line 471 of file GeometryHandlers.h.

Referenced by MeshHandler().


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

Generated on Sun Jan 17 11:39:36 2010 for PVLE (Pro-Vocation Light Engine) by  doxygen 1.5.9