ork::AttributeBuffer Class Reference
[render]

A vertex attribute buffer. More...

#include <AttributeBuffer.h>

Inheritance diagram for ork::AttributeBuffer:
ork::Object

List of all members.

Public Member Functions

 AttributeBuffer (int index, int size, AttributeType t, bool norm, ptr< Buffer > b, int stride=0, int offset=0, int divisor=0)
 Creates a new attribute buffer for floating point attributes.
 AttributeBuffer (int index, int size, AttributeType t, ptr< Buffer > b, int stride=0, int offset=0, int divisor=0)
 Creates a new attribute buffer for signed or unsigned integer attributes.
 AttributeBuffer (int index, int size, ptr< Buffer > b, int stride=0, int offset=0, int divisor=0)
 Creates a new attribute buffer for double precision attributes.
virtual ~AttributeBuffer ()
 Destroys this attribute buffer.
int getSize ()
 Returns the number of components in attributes of this kind.
AttributeType getType ()
 Returns the type of each component in attributes of this kind.
int getAttributeSize ()
 Returns the size of one attribute value.
ptr< BuffergetBuffer ()
 Returns the buffer that contains the actual data of this attribute buffer.
void setBuffer (ptr< Buffer > b)
 Sets the buffer that contains the actual data of this attribute buffer.
int getStride ()
 Returns the offset between two consecutive attribute values in this attribute buffer.
int getOffset ()
 Returns the offset of the first attribute value in this attribute buffer.
int getDivisor ()
 Returns the number of times each attribute much be instanced, or 0 if attribute instancing is disabled for this attribute.

Detailed Description

A vertex attribute buffer.

Such a buffer contains the values of one vertex attribute for a list of vertices. A vertex attribute is a vector of one or more components of the same type. Examples of vertex attributes are its position, normal, uv coordinates, color, etc. So, for example, a position attribute buffer contains the positions of a list of vertices, a color attribute buffer contains the colors of a list of vertices, etc.

An AttributeBuffer describes how these values are organized, based on an offset and a stride parameters. The values themselves are stored in a Buffer object. Note that several AttributeBuffer can share the same Buffer object. So several vertex attributes can be stored in a single buffer. For instance all positions, followed by all normals, followed by all colors, etc. Or the position, normal and color of the first vertex, followed by the position, normal and color of the second vertex, and so on.


Constructor & Destructor Documentation

ork::AttributeBuffer::AttributeBuffer ( int  index,
int  size,
AttributeType  t,
bool  norm,
ptr< Buffer b,
int  stride = 0,
int  offset = 0,
int  divisor = 0 
)

Creates a new attribute buffer for floating point attributes.

The attribute is supposed to be declared as floating point in the vertex shader, but its value can be defined from integer values (which can then be normalized to 0..1 or not when converted to floating point).

Parameters:
index a vertex attribute index.
size the number of components in attributes of this kind.
t the type of each component in attributes of this kind.
norm if the attribute components must be normalized to 0..1.
b the buffer containing the actual attribute values.
stride the offset between two consecutive attribute values in b.
offset the offset of the first attribute value in b.
divisor how many times each attribute much be instanced, or 0 to disable attribute instancing.
ork::AttributeBuffer::AttributeBuffer ( int  index,
int  size,
AttributeType  t,
ptr< Buffer b,
int  stride = 0,
int  offset = 0,
int  divisor = 0 
)

Creates a new attribute buffer for signed or unsigned integer attributes.

The attribute is supposed to be declared as signed or unsigned integer type in the vertex shader, and its value must be defined from integer values.

Parameters:
index a vertex attribute index.
size the number of components in attributes of this kind.
t the type of each component in attributes of this kind. Must be a signed or unsigned integer type.
b the buffer containing the actual attribute values.
stride the offset between two consecutive attribute values in b.
offset the offset of the first attribute value in b.
divisor how many times each attribute much be instanced, or 0 to disable attribute instancing.
ork::AttributeBuffer::AttributeBuffer ( int  index,
int  size,
ptr< Buffer b,
int  stride = 0,
int  offset = 0,
int  divisor = 0 
)

Creates a new attribute buffer for double precision attributes.

The attribute is supposed to be declared as double precision floating point type in the vertex shader, and its value must be defined from double values.

Parameters:
index a vertex attribute index.
size the number of components in attributes of this kind.
b the buffer containing the actual attribute values.
stride the offset between two consecutive attribute values in b.
offset the offset of the first attribute value in b.
divisor how many times each attribute much be instanced, or 0 to disable attribute instancing.
virtual ork::AttributeBuffer::~AttributeBuffer (  )  [virtual]

Destroys this attribute buffer.


Member Function Documentation

int ork::AttributeBuffer::getAttributeSize (  ) 

Returns the size of one attribute value.

This size is the number of components per attribute, times the size of each component (which depends on its type: byte, int, float, etc). Except for the packed formats A32I_2_10_10_10_REV and A32UI_2_10_10_10_REV.

ptr<Buffer> ork::AttributeBuffer::getBuffer (  ) 

Returns the buffer that contains the actual data of this attribute buffer.

int ork::AttributeBuffer::getDivisor (  ) 

Returns the number of times each attribute much be instanced, or 0 if attribute instancing is disabled for this attribute.

int ork::AttributeBuffer::getOffset (  ) 

Returns the offset of the first attribute value in this attribute buffer.

int ork::AttributeBuffer::getSize (  ) 

Returns the number of components in attributes of this kind.

int ork::AttributeBuffer::getStride (  ) 

Returns the offset between two consecutive attribute values in this attribute buffer.

AttributeType ork::AttributeBuffer::getType (  ) 

Returns the type of each component in attributes of this kind.

void ork::AttributeBuffer::setBuffer ( ptr< Buffer b  ) 

Sets the buffer that contains the actual data of this attribute buffer.


Generated on Mon Oct 18 09:36:08 2010 for ork by  doxygen 1.6.1