[AE Engine logo] Public API Reference
Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

aeVertexBuffer Class Reference

A vertex buffer. More...

#include <vertexbuffer.h>

List of all members.

Public Member Functions

 aeVertexBuffer (unsigned int vertexBufferSize, bool normals=false, bool colors=false, bool texcoords=false)
 Create a new vertex buffer given the initial size for the buffer(s).

unsigned int getVertexBufferSize () const
 Get the size of this vertex buffer.

float * getVertexData () const
 Get the vertex buffer as float array of size (3 * sizeof(float)) * number of vertices.

float * getNormalData () const
 Get the vertex normal buffer as float array of size (3 * sizeof(float)) * number of vertex normals.

float * getColorData () const
 Get the vertex color buffer as float array of size (4 * sizeof(float)) * vertex.

float * getTexCoordData () const
 Get the vertex texture coordinate buffer as float array of size (2 * sizeof(float)) * number of vertices.

bool hasNormals () const
 See if this buffer contains vertex normals.

bool hasColors () const
 See if this buffer contains vertex colors.

bool hasTexCoords () const
 See if this buffer contains vertex texture coordinates.

 getVertexCount () const
 Get the number of vertices in this buffer.

 getNormalCount () const
 Get the number of vertex normals in this buffer.

 getColorCount () const
 Get the number of vertex colors in this buffer.

 getTexCoordCount () const
 Get the number of vertex texture coordinates in this buffer.

void addVertex (aeVector3 &v)
 Add a vertex to this buffer.

void addVertex (float x, float y, float z)
 Add a vertex to this buffer.

void addNormal (aeVector3 &n)
 Add a vertex normal to this buffer.

void addNormal (float x, float y, float z)
 Add a vertex normal to this buffer.

void addColor (aeColor4 &c)
 Add a vertex color to this buffer.

void addColor (float r, float g, float b, float a)
 Add a vertex color to this buffer.

void addTexCoord (aeTexCoord2 &tc)
 Add a vertex texture coordinate to this buffer.

void addTexCoord (float s, float t)
 Add a vertex texture coordinate to this buffer.


Private Attributes

unsigned int vertexBufSize
 Size of this vertex buffer.

float * vertexBuffer
 Vertex buffer.

float * normalBuffer
 Vertex normal buffer.

float * colorBuffer
 Vertex color buffer.

float * texcoordBuffer
 Vertex texture coordinate buffer.

bool normalBufEnabled
 Is vertex normal buffer enabled.

bool colorBufEnabled
 Is vertex color buffer enabled.

bool texcoordBufEnabled
 Is vertex texture coordinate buffer enabled.

unsigned int vertexCount
 Number of vertices in this buffer.

unsigned int normalCount
 Number of vertex normals in this buffer.

unsigned int colorCount
 Number of vertex colors in this buffer.

unsigned int texcoordCount
 Number of vertex texture coordinates in this buffer.


Detailed Description

A vertex buffer.

This vertex buffer also has buffers for vertex colors, vertex normals, and vertex texture coordinates.

Definition at line 34 of file vertexbuffer.h.


Constructor & Destructor Documentation

aeVertexBuffer::aeVertexBuffer unsigned int    vertexBufferSize,
bool    normals = false,
bool    colors = false,
bool    texcoords = false
 

Create a new vertex buffer given the initial size for the buffer(s).

The normal, color and texture coordinate booleans can be set to true to enable those buffers. An enabled buffer will have the same initial size as the vertexBuffer. For example, if you enable the texcoord buffer, its size will be set to hold vertexBufSize pairs of 2D texture coordinates (s, t), ie. vertexBufSize * (2 * sizeof(float)).

Parameters:
vertexBufSize How many vertices this buffer is going to hold.
normals Enable/disable vertex normal buffer.
colors Enable/disable vertex color buffer.
texcoords Enable/disable vertex texture coordinate buffer.


Member Function Documentation

void aeVertexBuffer::addColor float    r,
float    g,
float    b,
float    a
 

Add a vertex color to this buffer.

Parameters:
r Red.
g Green.
b Blue.
a Alpha.

void aeVertexBuffer::addColor aeColor4   c
 

Add a vertex color to this buffer.

Parameters:
n Vertex color to add.

void aeVertexBuffer::addNormal float    x,
float    y,
float    z
 

Add a vertex normal to this buffer.

Parameters:
x The X coordinate of the vertex normal.
y The Y coordinate of the vertex normal.
z The Z coordinate of the vertex normal.

void aeVertexBuffer::addNormal aeVector3   n
 

Add a vertex normal to this buffer.

Parameters:
n Vertex normal to add.

void aeVertexBuffer::addTexCoord float    s,
float    t
 

Add a vertex texture coordinate to this buffer.

Parameters:
s The S coordinate of the vertex texcoord.
t The T coordinate of the vertex texcoord.

void aeVertexBuffer::addTexCoord aeTexCoord2   tc
 

Add a vertex texture coordinate to this buffer.

Parameters:
tc Texture coordinate to add.

void aeVertexBuffer::addVertex float    x,
float    y,
float    z
 

Add a vertex to this buffer.

Parameters:
x The X coordinate of the vertex.
y The Y coordinate of the vertex.
z The Z coordinate of the vertex.

void aeVertexBuffer::addVertex aeVector3   v
 

Add a vertex to this buffer.

Parameters:
v Vertex to add.

aeVertexBuffer::getColorCount   const [inline]
 

Get the number of vertex colors in this buffer.

Returns:
The number of vertex colors in this buffer.

Definition at line 155 of file vertexbuffer.h.

float* aeVertexBuffer::getColorData   const [inline]
 

Get the vertex color buffer as float array of size (4 * sizeof(float)) * vertex.

Returns:
The vertex color buffer.

Definition at line 105 of file vertexbuffer.h.

aeVertexBuffer::getNormalCount   const [inline]
 

Get the number of vertex normals in this buffer.

Returns:
The number of vertex normals in this buffer.

Definition at line 148 of file vertexbuffer.h.

float* aeVertexBuffer::getNormalData   const [inline]
 

Get the vertex normal buffer as float array of size (3 * sizeof(float)) * number of vertex normals.

Returns:
The vertex normal buffer.

Definition at line 98 of file vertexbuffer.h.

aeVertexBuffer::getTexCoordCount   const [inline]
 

Get the number of vertex texture coordinates in this buffer.

Returns:
The number of vertex texture coordinates in this buffer.

Definition at line 162 of file vertexbuffer.h.

float* aeVertexBuffer::getTexCoordData   const [inline]
 

Get the vertex texture coordinate buffer as float array of size (2 * sizeof(float)) * number of vertices.

Returns:
The vertex buffer.

Definition at line 113 of file vertexbuffer.h.

unsigned int aeVertexBuffer::getVertexBufferSize   const [inline]
 

Get the size of this vertex buffer.

Returns:
The size of this vertex buffer.

Definition at line 83 of file vertexbuffer.h.

aeVertexBuffer::getVertexCount   const [inline]
 

Get the number of vertices in this buffer.

Returns:
The number of vertices in this buffer.

Definition at line 141 of file vertexbuffer.h.

float* aeVertexBuffer::getVertexData   const [inline]
 

Get the vertex buffer as float array of size (3 * sizeof(float)) * number of vertices.

Returns:
The vertex buffer.

Definition at line 90 of file vertexbuffer.h.

bool aeVertexBuffer::hasColors   const [inline]
 

See if this buffer contains vertex colors.

Returns:
True if this buffer contains vertex colors, false if not.

Definition at line 127 of file vertexbuffer.h.

bool aeVertexBuffer::hasNormals   const [inline]
 

See if this buffer contains vertex normals.

Returns:
True if this buffer contains vertex normals, false if not.

Definition at line 120 of file vertexbuffer.h.

bool aeVertexBuffer::hasTexCoords   const [inline]
 

See if this buffer contains vertex texture coordinates.

Returns:
True if this buffer contains vertex texture coordinates, false if not.

Definition at line 134 of file vertexbuffer.h.


The documentation for this class was generated from the following file:
AE Engine Public API Reference
Generated on Wed Apr 9 09:43:41 2003 by Doxygen.