dtAnim::SubmeshDrawable Class Reference

Adapter that converts cal3d submeshes into osg::Drawables. More...

#include <submesh.h>

List of all members.

Public Member Functions

 SubmeshDrawable (Cal3DModelWrapper *wrapper, unsigned mesh, unsigned submesh)
 Creates a submesh for one model given the mesh and submesh of this mesh.
virtual void drawImplementation (osg::RenderInfo &renderInfo) const
 Draws the geometry.
virtual bool supports (osg::PrimitiveFunctor &) const
 Accept PrimitiveVisitor, in this case a TriangleVisitor.
virtual void accept (osg::PrimitiveFunctor &pf) const
 Accept a PrimitiveFunctor and call its methods to tell it about the interal primitives that this Drawable has.
virtual osg::Object * cloneType () const
virtual osg::Object * clone (const osg::CopyOp &) const
unsigned int GetMeshID () const
unsigned int GetSubmeshID () const
Cal3DModelWrapperGetModelWrapper ()
const Cal3DModelWrapperGetModelWrapper () const
LODOptionsGetLODOptions ()
const LODOptionsGetLODOptions () const
float GetCurrentLOD () const
void SetCurrentLOD (float lod)

Static Public Attributes

static const unsigned LOD_COUNT = 4

Protected Member Functions

 ~SubmeshDrawable ()
void InitVertexBuffers (osg::State &state) const


Detailed Description

Adapter that converts cal3d submeshes into osg::Drawables.

The easy way would be to draw all the character (CalModel) in a single Drawable, but this approach lacks from state sorting. Each submesh of each mesh of a model can have different state attributes. With the current approach, if you have 1000 soldiers with two different textures each one, there will be only two state changes per frame, and not 2000.

Users of the osgCal library doesn't need to know about this class, it is internal.


Constructor & Destructor Documentation

dtAnim::SubmeshDrawable::SubmeshDrawable ( Cal3DModelWrapper wrapper,
unsigned  mesh,
unsigned  submesh 
)

Creates a submesh for one model given the mesh and submesh of this mesh.

dtAnim::SubmeshDrawable::~SubmeshDrawable ( void   )  [protected]


Member Function Documentation

void dtAnim::SubmeshDrawable::drawImplementation ( osg::RenderInfo &  renderInfo  )  const [virtual]

Draws the geometry.

the inverse of ((index + 1) / LOD_COUNT) = lodfloat as seen in InitVertexBuffers.

quantify the lod floating point number.

offset into the vbo to fill the correct lod.

virtual bool dtAnim::SubmeshDrawable::supports ( osg::PrimitiveFunctor &   )  const [inline, virtual]

Accept PrimitiveVisitor, in this case a TriangleVisitor.

Return true, SubMesh does support accept(PrimitiveFunctor&).

void dtAnim::SubmeshDrawable::accept ( osg::PrimitiveFunctor &  pf  )  const [virtual]

Accept a PrimitiveFunctor and call its methods to tell it about the interal primitives that this Drawable has.

this processes the lowest LOD at the moment, because that's what's loaded at the front of the VBO.

osg::Object * dtAnim::SubmeshDrawable::cloneType (  )  const [virtual]

osg::Object * dtAnim::SubmeshDrawable::clone ( const osg::CopyOp &   )  const [virtual]

unsigned int dtAnim::SubmeshDrawable::GetMeshID (  )  const [inline]

unsigned int dtAnim::SubmeshDrawable::GetSubmeshID (  )  const [inline]

Cal3DModelWrapper& dtAnim::SubmeshDrawable::GetModelWrapper (  )  [inline]

const Cal3DModelWrapper& dtAnim::SubmeshDrawable::GetModelWrapper (  )  const [inline]

LODOptions& dtAnim::SubmeshDrawable::GetLODOptions (  )  [inline]

const LODOptions& dtAnim::SubmeshDrawable::GetLODOptions (  )  const [inline]

float dtAnim::SubmeshDrawable::GetCurrentLOD (  )  const [inline]

void dtAnim::SubmeshDrawable::SetCurrentLOD ( float  lod  )  [inline]

void dtAnim::SubmeshDrawable::InitVertexBuffers ( osg::State &  state  )  const [protected]

Fill the index and vertex VBOs once for each level of detail

offset into the vbo to fill the correct lod.


Member Data Documentation

const unsigned dtAnim::SubmeshDrawable::LOD_COUNT = 4 [static]


http://www.delta3d.org
2.0.0 generated 14 Feb 2008