version 3.3

VRS::MappedVertexAttributeShapeGL Class Reference

Shape to store per-vertex values for a vertex attribute name. More...

#include <vrs/opengl/mappedvertexattributeshapegl.h>

Inheritance diagram for VRS::MappedVertexAttributeShapeGL:

VRS::Shape VRS::RenderObj VRS::SharedObj VRS::Visitable EnvironmentRenderer::WaterSurface EnvironmentRenderer::PolygonSetWaterSurface

List of all members.

Public Member Functions

 VRS_TYPEINFO (MappedVertexAttributeShapeGL, Shape)
 VRS_SERIALIZABLE (MappedVertexAttributeShapeGL)
 MappedVertexAttributeShapeGL (const PolygonSet *source, BufferObjectGL::UsagePattern usage=BufferObjectGL::STATIC_DRAW)
SO< PolygonSetconvertToPolygonSet () const
 MappedVertexAttributeShapeGL (const Bounds &bbox=Bounds(), BaseVertexAttributeBufferObjectGL *vertices=NULL, BaseVertexAttributeBufferObjectGL *normals=NULL, BaseVertexAttributeBufferObjectGL *color=NULL, BaseVertexAttributeBufferObjectGL *tex_coord_0=NULL, BaseVertexAttributeBufferObjectGL *index=NULL, BaseVertexAttributeBufferObjectGL *range=NULL, BaseVertexAttributeBufferObjectGL *primitive=NULL)
 MappedVertexAttributeShapeGL (GLenum primitiveType, const Bounds &bbox=Bounds(), BaseVertexAttributeBufferObjectGL *vertices=NULL, BaseVertexAttributeBufferObjectGL *normals=NULL, BaseVertexAttributeBufferObjectGL *color=NULL, BaseVertexAttributeBufferObjectGL *tex_coord_0=NULL, BaseVertexAttributeBufferObjectGL *index=NULL, BaseVertexAttributeBufferObjectGL *range=NULL)
virtual ~MappedVertexAttributeShapeGL ()
BaseVertexAttributeBufferObjectGLgetBufferObject (const ID &vertexAttributeName) const
void setArray (const ID &vertexAttributeName, BaseVertexAttributeBufferObjectGL *content)
 Set and get per-vertex values for a vertex attribute name.
BaseVertexAttributeBufferObjectGLindices () const
void setIndices (BaseVertexAttributeBufferObjectGL *indices)
 Support for indexed vertex array.
BaseVertexAttributeBufferObjectGLranges () const
void setRanges (BaseVertexAttributeBufferObjectGL *ranges)
 Support for several ranges within one vertex array.
BaseVertexAttributeBufferObjectGLprimitives () const
void setPrimitives (BaseVertexAttributeBufferObjectGL *pimitives)
 Support for different primitives types separated by range.
GLenum getPrimitiveType () const
void setPrimitiveType (GLenum primitiveType)
 Primitive type of the shape.
void clear ()
 Throws away all internal data, resulting in an empty object.
UINT usedMemory () const
void setBoundingBox (const Bounds &)
 Sets the bounding box of the mapped vertex attribute shape.
virtual Bounds boundingBox () const
 Shapes define their bounding box in model coordinates.
void enableMirroredData (bool yesNo, bool vec4fCompatible=false)
bool mirroredDataEnabled () const
SO< const
VertexAttributeBufferObjectGL
< Vector3f > > 
getMirroredVertices () const
SO< const
BaseVertexAttributeBufferObjectGL
getMirroredIndices () const
SO< Iterator< ID > > newVertexAttributeNameIterator () const
 Returns all IDs for which vertex data is stored in the MappedVertexAttributeShapeGL.
virtual SO< Iterator< Matrix > > getInstanceTransformationIterator () const
 Returns the transformation matrices for each instance this shape should be rendered for.
virtual void setInstanceTransformationIterator (SO< Iterator< Matrix > > instanceTransforms)
 Sets the transformation matrices for each instance this shape should be renderer for.
virtual SO< Iterator< UINT32 > > getIDIterator () const
 Returns the ID iterator or NULL, if no ID iterator has been specified.
virtual void setIDIterator (const SO< Iterator< UINT32 > > &idIter)
 Sets the ID iterator specifying an ID for each vertex.
virtual bool invertOrientation ()
 Inverts the orientation of all contained triangles.


Detailed Description

Shape to store per-vertex values for a vertex attribute name.

Constructor & Destructor Documentation

VRS::MappedVertexAttributeShapeGL::MappedVertexAttributeShapeGL ( const PolygonSet source,
BufferObjectGL::UsagePattern  usage = BufferObjectGL::STATIC_DRAW 
)

Creates a mapped vertex attribute shape from a given polygon set 'source', which must not be NULL. For the usage parameter see "bufferobjectgl.h". The data of 'source' is copied into buffers objects. For efficiency the data is stored in the following form: > vector data: 3-tuple of floats > color data: 4-tuple of unsigned char

VRS::MappedVertexAttributeShapeGL::MappedVertexAttributeShapeGL ( const Bounds bbox = Bounds(),
BaseVertexAttributeBufferObjectGL vertices = NULL,
BaseVertexAttributeBufferObjectGL normals = NULL,
BaseVertexAttributeBufferObjectGL color = NULL,
BaseVertexAttributeBufferObjectGL tex_coord_0 = NULL,
BaseVertexAttributeBufferObjectGL index = NULL,
BaseVertexAttributeBufferObjectGL range = NULL,
BaseVertexAttributeBufferObjectGL primitive = NULL 
)

VRS::MappedVertexAttributeShapeGL::MappedVertexAttributeShapeGL ( GLenum  primitiveType,
const Bounds bbox = Bounds(),
BaseVertexAttributeBufferObjectGL vertices = NULL,
BaseVertexAttributeBufferObjectGL normals = NULL,
BaseVertexAttributeBufferObjectGL color = NULL,
BaseVertexAttributeBufferObjectGL tex_coord_0 = NULL,
BaseVertexAttributeBufferObjectGL index = NULL,
BaseVertexAttributeBufferObjectGL range = NULL 
)

The shape stores per-vertex values for user-defined vertex attribute names. These names are independent from the underlying OpenGL graphics hardware Due to the mapping provided by the MonoAttribute 'VertexAttributeMap' per-vertex values will be mapped to target data resp. OpenGL registers. Per-vertex values for common names can be added using the constructor. To extend the set of vertex attribute names registrate a new vertex attribute names (see VertexAtributeMap).

Note: If no mapping is available for a vertex name no vertex data will be transfered to graphics hardware. Also, if the target register is not supported by the painter no transfer will be appied.

virtual VRS::MappedVertexAttributeShapeGL::~MappedVertexAttributeShapeGL (  )  [virtual]


Member Function Documentation

VRS::MappedVertexAttributeShapeGL::VRS_TYPEINFO ( MappedVertexAttributeShapeGL  ,
Shape   
)

VRS::MappedVertexAttributeShapeGL::VRS_SERIALIZABLE ( MappedVertexAttributeShapeGL   ) 

SO<PolygonSet> VRS::MappedVertexAttributeShapeGL::convertToPolygonSet (  )  const

BaseVertexAttributeBufferObjectGL* VRS::MappedVertexAttributeShapeGL::getBufferObject ( const ID vertexAttributeName  )  const

void VRS::MappedVertexAttributeShapeGL::setArray ( const ID vertexAttributeName,
BaseVertexAttributeBufferObjectGL content 
)

Set and get per-vertex values for a vertex attribute name.

BaseVertexAttributeBufferObjectGL * VRS::MappedVertexAttributeShapeGL::indices (  )  const [inline]

void VRS::MappedVertexAttributeShapeGL::setIndices ( BaseVertexAttributeBufferObjectGL indices  ) 

Support for indexed vertex array.

BaseVertexAttributeBufferObjectGL * VRS::MappedVertexAttributeShapeGL::ranges (  )  const [inline]

void VRS::MappedVertexAttributeShapeGL::setRanges ( BaseVertexAttributeBufferObjectGL ranges  ) 

Support for several ranges within one vertex array.

BaseVertexAttributeBufferObjectGL * VRS::MappedVertexAttributeShapeGL::primitives (  )  const [inline]

void VRS::MappedVertexAttributeShapeGL::setPrimitives ( BaseVertexAttributeBufferObjectGL pimitives  ) 

Support for different primitives types separated by range.

GLenum VRS::MappedVertexAttributeShapeGL::getPrimitiveType (  )  const [inline]

void VRS::MappedVertexAttributeShapeGL::setPrimitiveType ( GLenum  primitiveType  ) 

Primitive type of the shape.

void VRS::MappedVertexAttributeShapeGL::clear (  ) 

Throws away all internal data, resulting in an empty object.

Note that it is faster to use clear an existing MappedVertexAttributeShapeGL-object than to instantiate a new MappedVertexAttributeShapeGL-object and destruct the old one

UINT VRS::MappedVertexAttributeShapeGL::usedMemory (  )  const

Returns the sum of bytes allocated by all buffer objects belonging to this vertex attribute set.

void VRS::MappedVertexAttributeShapeGL::setBoundingBox ( const Bounds  ) 

Sets the bounding box of the mapped vertex attribute shape.

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

Shapes define their bounding box in model coordinates.

Implements VRS::Shape.

Reimplemented in EnvironmentRenderer::PolygonSetWaterSurface, and EnvironmentRenderer::WaterSurface.

void VRS::MappedVertexAttributeShapeGL::enableMirroredData ( bool  yesNo,
bool  vec4fCompatible = false 
)

For better rendering performance, vertex and index data are usually stored in the graphics card memory and are therefore not efficiently accessible for ray intersection tests. To allow an efficient intersection test, a MappedVertexAttributeShape must keep a copy of the data in main memory (the default behavior). Note: In order to save some main memory disable the data mirror mode!

bool VRS::MappedVertexAttributeShapeGL::mirroredDataEnabled (  )  const

Returns enableMirroredData-flag.

SO<const VertexAttributeBufferObjectGL<Vector3f> > VRS::MappedVertexAttributeShapeGL::getMirroredVertices (  )  const

Ray intersection and other services access a main-memory-side copy of vertex data. This method must not be used if enableMirroredData is false. The BufferObject returned has the type UNCLASSIFIED and is therefore guaranteed to lie in main-memory, so that mapPointer() can be called withhout copying the data. Note: Mirrored vertices does currently only work if the vertex buffer object contains VertexData<3, float> entries.

SO<const BaseVertexAttributeBufferObjectGL> VRS::MappedVertexAttributeShapeGL::getMirroredIndices (  )  const

Returns the main-memory-side copy of the indices. MirroredData must be enabled.

SO<Iterator<ID> > VRS::MappedVertexAttributeShapeGL::newVertexAttributeNameIterator (  )  const

Returns all IDs for which vertex data is stored in the MappedVertexAttributeShapeGL.

virtual SO<Iterator<Matrix> > VRS::MappedVertexAttributeShapeGL::getInstanceTransformationIterator (  )  const [virtual]

Returns the transformation matrices for each instance this shape should be rendered for.

Can return NULL (the default case) if no instancing is used.

virtual void VRS::MappedVertexAttributeShapeGL::setInstanceTransformationIterator ( SO< Iterator< Matrix > >  instanceTransforms  )  [virtual]

Sets the transformation matrices for each instance this shape should be renderer for.

Passing NULL as argument is allowed for disabling instanced rendering.

virtual SO<Iterator<UINT32> > VRS::MappedVertexAttributeShapeGL::getIDIterator (  )  const [virtual]

Returns the ID iterator or NULL, if no ID iterator has been specified.

virtual void VRS::MappedVertexAttributeShapeGL::setIDIterator ( const SO< Iterator< UINT32 > > &  idIter  )  [virtual]

Sets the ID iterator specifying an ID for each vertex.

This IDs can be used for identifying objects during a ray intersection, for example. See also: IDManager.

virtual bool VRS::MappedVertexAttributeShapeGL::invertOrientation (  )  [virtual]

Inverts the orientation of all contained triangles.

Note: This method does only support shapes fulfilling the following properties:

  • It must contain (exclusively) a single range of triangles.
  • If normals are contained, they must be found via NORMAL_ID() and represented as VertexData<3, float> (fulfilled if the MVAS was constructed from a PolygonSet with normals)


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

Generated on Tue May 21 06:00:26 2013 by Doxygen 1.5.6
© 2001-2010 Hasso-Plattner-Institut | Impressum | Contact