Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes

CEGUI::IrrlichtGeometryBuffer Class Reference

GeometryBuffer implementation for the Irrlicht engine. More...

Inheritance diagram for CEGUI::IrrlichtGeometryBuffer:
Collaboration diagram for CEGUI::IrrlichtGeometryBuffer:

List of all members.

Public Member Functions

 IrrlichtGeometryBuffer (irr::video::IVideoDriver &driver)
 constructor
const irr::core::matrix4 & getMatrix () const
 return the transformation matrix used for this buffer.
irr::video::SMaterial & getMaterial ()
 return reference to the Irrlicht material used with this GeometryBuffer.
const irr::video::SMaterial & getMaterial () const
 return reference to the Irrlicht material used with this GeometryBuffer.
void draw () const
 Draw the geometry buffered within this GeometryBuffer object.
void setTranslation (const Vector3 &v)
 Set the translation to be applied to the geometry in the buffer when it is subsequently rendered.
void setRotation (const Vector3 &r)
 Set the rotations to be applied to the geometry in the buffer when it is subsequently rendered.
void setPivot (const Vector3 &p)
 Set the pivot point to be used when applying the rotations.
void setClippingRegion (const Rect &region)
 Set the clipping region to be used when rendering this buffer.
void appendVertex (const Vertex &vertex)
 Append a single vertex to the buffer.
void appendGeometry (const Vertex *const vbuff, uint vertex_count)
 Append a number of vertices from an array to the GeometryBuffer.
void setActiveTexture (Texture *texture)
 Set the active texture to be used with all subsequently added vertices.
void reset ()
 Clear all buffered data and reset the GeometryBuffer to the default state.
TexturegetActiveTexture () const
 Return a pointer to the currently active Texture object. This may return 0 if no texture is set.
uint getVertexCount () const
 Return the total number of vertices currently held by this GeometryBuffer object.
uint getBatchCount () const
 Return the number of batches of geometry that this GeometryBuffer has split the vertices into.
void setRenderEffect (RenderEffect *effect)
 Set the RenderEffect to be used by this GeometryBuffer.
RenderEffectgetRenderEffect ()
 Return the RenderEffect object that is assigned to this GeometryBuffer or 0 if none.

Protected Types

typedef std::pair
< irr::video::ITexture *, uint > 
BatchInfo
 type to track info for per-texture sub batches of geometry
typedef std::vector< BatchInfoBatchList
 type of container that tracks BatchInfos.
typedef std::vector
< irr::video::S3DVertex > 
VertexList
 type of container used to queue the geometry
typedef std::vector< irr::u16 > IndexList
 type of container used for indexes

Protected Member Functions

void updateMatrix () const
 update cached matrix

Protected Attributes

irr::video::IVideoDriver & d_driver
 Irrlicht video driver we're to use.
IrrlichtTextured_activeTexture
 Texture that is set as active.
irr::video::SMaterial d_material
 material used with the texture for rendering.
Rect d_clipRect
 rectangular clip region
irr::core::vector3d< irr::f32 > d_translation
 translation vector
irr::core::vector3d< irr::f32 > d_rotation
 rotation vector
irr::core::vector3d< irr::f32 > d_pivot
 pivot point for rotation
RenderEffectd_effect
 RenderEffect that will be used by the GeometryBuffer.
irr::core::matrix4 d_matrix
 model matrix cache
bool d_matrixValid
 true when d_matrix is valid and up to date
BatchList d_batches
 list of texture batches added to the geometry buffer
VertexList d_vertices
 container where added geometry vertices are stored.
IndexList d_indices
 container where added geometry indices are stored.
const float d_xViewDir
 a coefficient used to handle OpenGL / D3D projection variations.
const float d_texelOffset
 an offset applied to geometry to get correct texel to pixel mapping.

Detailed Description

GeometryBuffer implementation for the Irrlicht engine.


Member Function Documentation

void CEGUI::IrrlichtGeometryBuffer::appendGeometry ( const Vertex *const   vbuff,
uint  vertex_count 
) [virtual]

Append a number of vertices from an array to the GeometryBuffer.

Parameters:
vbuff Pointer to an array of Vertex objects that describe the vertices that are to be added to the GeometryBuffer.
vertex_count The number of Vertex objects from the array vbuff that are to be added to the GeometryBuffer.

Implements CEGUI::GeometryBuffer.

void CEGUI::IrrlichtGeometryBuffer::appendVertex ( const Vertex vertex  )  [virtual]

Append a single vertex to the buffer.

Parameters:
vertex Vertex object describing the vertex to be added to the GeometryBuffer.

Implements CEGUI::GeometryBuffer.

Texture* CEGUI::IrrlichtGeometryBuffer::getActiveTexture (  )  const [virtual]

Return a pointer to the currently active Texture object. This may return 0 if no texture is set.

Returns:
Pointer the Texture object that is currently active, or 0 if texturing is not being used.

Implements CEGUI::GeometryBuffer.

uint CEGUI::IrrlichtGeometryBuffer::getBatchCount (  )  const [virtual]

Return the number of batches of geometry that this GeometryBuffer has split the vertices into.

Note:
How batching is done will be largely implementation specific, although it would be reasonable to expect that you will have at least one batch of geometry per texture switch.
Returns:
The number of batches of geometry held by the GeometryBuffer.

Implements CEGUI::GeometryBuffer.

uint CEGUI::IrrlichtGeometryBuffer::getVertexCount (  )  const [virtual]

Return the total number of vertices currently held by this GeometryBuffer object.

Returns:
The number of vertices that have been appended to this GeometryBuffer.

Implements CEGUI::GeometryBuffer.

void CEGUI::IrrlichtGeometryBuffer::setActiveTexture ( Texture texture  )  [virtual]

Set the active texture to be used with all subsequently added vertices.

Parameters:
texture Pointer to a Texture object that shall be used for subsequently added vertices. This may be 0, in which case texturing will be disabled for subsequently added vertices.

Implements CEGUI::GeometryBuffer.

void CEGUI::IrrlichtGeometryBuffer::setPivot ( const Vector3 p  )  [virtual]

Set the pivot point to be used when applying the rotations.

Parameters:
p Vector3 describing the location of the pivot point to be used when applying the rotation to the geometry.

Implements CEGUI::GeometryBuffer.

void CEGUI::IrrlichtGeometryBuffer::setRenderEffect ( RenderEffect effect  )  [virtual]

Set the RenderEffect to be used by this GeometryBuffer.

Parameters:
effect Pointer to the RenderEffect to be used during renderng of the GeometryBuffer. May be 0 to remove a previously added RenderEffect.
Note:
When adding a RenderEffect, the GeometryBuffer does not take ownership of, nor make a copy of, the passed RenderEffect - this means you need to be careful not to delete the RenderEffect if it might still be in use!

Implements CEGUI::GeometryBuffer.

void CEGUI::IrrlichtGeometryBuffer::setRotation ( const Vector3 r  )  [virtual]

Set the rotations to be applied to the geometry in the buffer when it is subsequently rendered.

Parameters:
r Vector3 describing the rotation factors to be used.

Implements CEGUI::GeometryBuffer.

void CEGUI::IrrlichtGeometryBuffer::setTranslation ( const Vector3 v  )  [virtual]

Set the translation to be applied to the geometry in the buffer when it is subsequently rendered.

Parameters:
v Vector3 describing the three axis translation vector to be used.

Implements CEGUI::GeometryBuffer.