version 3.3

VRS::BatchGeometryGL Class Reference

BatchGeometry combines multiple MappedVertexAttributeShapes into a single large one. More...

#include <vrs/opengl/batchgeometrygl.h>

Inheritance diagram for VRS::BatchGeometryGL:

VRS::Shape VRS::RenderObj VRS::SharedObj VRS::Visitable

List of all members.

Public Member Functions

 BatchGeometryGL ()
 Creates an empty instance.
SO< Iterator< unsigned int > > changeSubshapes (SO< Iterator< unsigned int > > shapesToRemove=NULL, SO< Iterator< SO< MappedVertexAttributeShapeGL > > > newShapes=NULL, BufferObjectGL::UsagePattern usagePattern=BufferObjectGL::STATIC_DRAW)
 NOTE: inserted shapes must be mergeable with each other and with the previously inserted shapes! (see mergeable()-method) Inserts new shapes and remove some old ones.
SO< MappedVertexAttributeShapeGLextractSubshapes (SO< Iterator< unsigned int > > subshapeNumbers, BufferObjectGL::UsagePattern usagePattern=BufferObjectGL::STATIC_DRAW) const
 Extracts certain subshapes from the batch geometry.
SO< MappedVertexAttributeShapeGLgetGeometry () const
 Returns the combined shape. It must not be changed from outside!
SO< Iterator< unsigned int > > getVertexOffsets () const
 Returns an iterator containing the summed numbers of vertices of all sub-shapes that are combined in the batch object.
SO< Iterator< unsigned int > > getIndexOffsets () const
 If the subshapes are indexed, we need index offsets as well.
unsigned int getNumberOfSubshapes () const
bool insertable (SO< Iterator< SO< MappedVertexAttributeShapeGL > > > shapes, bool assertionMode=false)
 insertable() works as mergeable, but checks also whether the shapes can be added to the current BatchGeometryGL instance.
unsigned int findSubshape (unsigned int primitiveNumber) const
 Given a primitive number this method finds the corresponding subshape that contains it.
virtual Bounds boundingBox () const
 Shapes define their bounding box in model coordinates.
 VRS_TYPEINFO (BatchGeometryGL, Shape)

Static Public Member Functions

static bool mergeable (SO< Iterator< SO< MappedVertexAttributeShapeGL > > > shapes, bool assertionMode=false)
 You can only merge compatible MappedVertexAttributeShapeGLs, i.e.
static SO
< MappedVertexAttributeShapeGL
merge (SO< Iterator< SO< MappedVertexAttributeShapeGL > > > shapes, BufferObjectGL::UsagePattern usagePattern=BufferObjectGL::STATIC_DRAW)
 'mergeableWithoutRanges' is either known from the construction of the shapes or can be checked using the above method.

Static Public Attributes

static const unsigned int InvalidIndex


Detailed Description

BatchGeometry combines multiple MappedVertexAttributeShapes into a single large one.

This improves rendering performance. If you are not going to change the geometry anymore, you can simply use the static merge method. If you want to change parts of the scene, you need a BatchGeometry instance. Each shape must at least contain a vertex iterator!


Constructor & Destructor Documentation

VRS::BatchGeometryGL::BatchGeometryGL (  ) 

Creates an empty instance.


Member Function Documentation

SO<Iterator<unsigned int> > VRS::BatchGeometryGL::changeSubshapes ( SO< Iterator< unsigned int > >  shapesToRemove = NULL,
SO< Iterator< SO< MappedVertexAttributeShapeGL > > >  newShapes = NULL,
BufferObjectGL::UsagePattern  usagePattern = BufferObjectGL::STATIC_DRAW 
)

NOTE: inserted shapes must be mergeable with each other and with the previously inserted shapes! (see mergeable()-method) Inserts new shapes and remove some old ones.

The latter are specified via their indices in the BatchGeometry. The returned iterator defines a mapping from old indices to the new ones. The subshape numbers of the new shapes are always at the end. I.e. after a change you access the first new shape via the number getVertexOffsets() - newShapes->size(). At the positions of removed shapes, it contains InvalidIndex 'determines' the way how the memory is allocated for the changed batch (see bufferobjectgl.h) NOTE: If no shapes are removed, the result is NULL.

SO<MappedVertexAttributeShapeGL> VRS::BatchGeometryGL::extractSubshapes ( SO< Iterator< unsigned int > >  subshapeNumbers,
BufferObjectGL::UsagePattern  usagePattern = BufferObjectGL::STATIC_DRAW 
) const

Extracts certain subshapes from the batch geometry.

SO<MappedVertexAttributeShapeGL> VRS::BatchGeometryGL::getGeometry (  )  const

Returns the combined shape. It must not be changed from outside!

SO<Iterator<unsigned int> > VRS::BatchGeometryGL::getVertexOffsets (  )  const

Returns an iterator containing the summed numbers of vertices of all sub-shapes that are combined in the batch object.

The size of the iterator is the number of combined subshapes + 1. The last element equals the number of vertices in the combined shape.

SO<Iterator<unsigned int> > VRS::BatchGeometryGL::getIndexOffsets (  )  const

If the subshapes are indexed, we need index offsets as well.

unsigned int VRS::BatchGeometryGL::getNumberOfSubshapes (  )  const

static bool VRS::BatchGeometryGL::mergeable ( SO< Iterator< SO< MappedVertexAttributeShapeGL > > >  shapes,
bool  assertionMode = false 
) [static]

You can only merge compatible MappedVertexAttributeShapeGLs, i.e.

  • They must define the same vertex attributes
  • They must be all indexed or all not indexed, but not mixed You can check this using mergeable():

Note: This method returns also 'false' if the shapes or shape combination is currently not supported yet by the implementation:

  • All shapes must have the same primitive type
  • The shapes must not contain ranges or multiple primitive types
  • Only primitive types of fixed size are supported: POINTS, LINES, TRIANGLES, and QUADS
  • No EdgeFlags If 'assertionMode' is true, it is assumed that the shapes should be mergeable. If they are not, an VRS_InternalError() is caused.

bool VRS::BatchGeometryGL::insertable ( SO< Iterator< SO< MappedVertexAttributeShapeGL > > >  shapes,
bool  assertionMode = false 
)

insertable() works as mergeable, but checks also whether the shapes can be added to the current BatchGeometryGL instance.

static SO<MappedVertexAttributeShapeGL> VRS::BatchGeometryGL::merge ( SO< Iterator< SO< MappedVertexAttributeShapeGL > > >  shapes,
BufferObjectGL::UsagePattern  usagePattern = BufferObjectGL::STATIC_DRAW 
) [static]

'mergeableWithoutRanges' is either known from the construction of the shapes or can be checked using the above method.

unsigned int VRS::BatchGeometryGL::findSubshape ( unsigned int  primitiveNumber  )  const

Given a primitive number this method finds the corresponding subshape that contains it.

If primitveNumber is invalid, InvalidIndex is returned.

virtual Bounds VRS::BatchGeometryGL::boundingBox (  )  const [virtual]

Shapes define their bounding box in model coordinates.

Implements VRS::Shape.

VRS::BatchGeometryGL::VRS_TYPEINFO ( BatchGeometryGL  ,
Shape   
)


Member Data Documentation

const unsigned int VRS::BatchGeometryGL::InvalidIndex [static]


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

Generated on Fri May 18 06:00:21 2012 by Doxygen 1.5.6
© 2001-2010 Hasso-Plattner-Institut | Impressum | Contact