#include <gls_vertex_array.h>
|
| GlsVertexArray () |
|
virtual | ~GlsVertexArray () |
|
void | Setup (const int nVerts, const bool hasT, const bool hasC, const bool hasN) |
|
void | SetVertices (const Vertex verts[]) |
|
void | SetTexCoords (const Vector verts[]) |
|
void | SetNormals (const Vector verts[]) |
|
void | SetColors (const Vertex verts[]) |
|
void | SetVertex (const unsigned int index, const Vector &v) |
|
void | SetTexCoord (const unsigned int index, const Vector &v) |
|
void | Bake (IGlsStateManager *stateManager) |
|
void | Draw (const unsigned int glPrimitive, IGlsStateManager *stateManager, const bool texture, const bool color, const bool normal) |
|
void | Draw (const unsigned int glPrimitive, const unsigned int offset, const unsigned int count, GlsIndexArray &indexBuffer, IGlsStateManager *stateManager, const bool texture, const bool color, const bool normal) |
|
void | MultiDraw (const unsigned int glPrimitive, const unsigned int offset, const unsigned int count, const unsigned int primitiveSize, GlsIndexArray &indexBuffer, IGlsStateManager *stateManager, const bool texture, const bool color, const bool normal) |
|
|
static const GLuint | VERT_SIZE = sizeof( GL_FLOAT ) * 3 |
| Size of a vertex in bytes.
|
|
static const GLuint | TEX_SIZE = sizeof( GL_FLOAT ) * 2 |
| Size of a texture coordinate in bytes.
|
|
static const GLuint | NORMAL_SIZE = sizeof( GL_FLOAT ) * 3 |
| Size of a normal in bytes.
|
|
static const GLuint | COLOR_SIZE = sizeof( GL_UNSIGNED_BYTE ) * 4 |
| Size of a color in bytes.
|
|
The GlsVertexArray class. This holds a number of Vertex objects in a resizeable buffer.
◆ GlsVertexArray()
◆ ~GlsVertexArray()
◆ AllocateBuffer()
void AllocateBuffer |
( |
const unsigned int |
size | ) |
|
|
protected |
Allocates the buffer data, copying the existing data
- Parameters
-
size | The new size in bytes to allocate |
◆ Bake()
Bake the vertex buffer to a VBO
- Precondition
- _setup == true
- Parameters
-
stateManager | State manager for the OpenGL context to bake the VBO in |
◆ DeallocateBuffer()
void DeallocateBuffer |
( |
| ) |
|
|
protected |
Deallocates the buffer data
◆ Draw() [1/2]
void Draw |
( |
const unsigned int |
glPrimitive, |
|
|
const unsigned int |
offset, |
|
|
const unsigned int |
count, |
|
|
GlsIndexArray & |
indexBuffer, |
|
|
IGlsStateManager * |
stateManager, |
|
|
const bool |
texture, |
|
|
const bool |
color, |
|
|
const bool |
normal |
|
) |
| |
Draw this vertex array
- Precondition
- _setup == true
- Postcondition
- The VBO is drawn
- Parameters
-
glPrimitive | The OpenGL primitive type to draw (e.g. GL_LINE_LOOP) |
offset | Index of the first vertex to draw |
count | Number of primitives to draw |
indexBuffer | Index buffer to use |
stateManager | State manager for the OpenGL context to draw in |
texture | Whether or not to draw with texture |
color | Whether or not to use per vertex colors |
normal | Whether or not to use per vertex normals |
◆ Draw() [2/2]
void Draw |
( |
const unsigned int |
glPrimitive, |
|
|
IGlsStateManager * |
stateManager, |
|
|
const bool |
texture, |
|
|
const bool |
color, |
|
|
const bool |
normal |
|
) |
| |
Draw this vertex array
- Precondition
- _setup == true
- Postcondition
- The VBO is drawn
- Parameters
-
glPrimitive | The OpenGL primitive type to draw (e.g. GL_LINE_LOOP) |
stateManager | State manager for the OpenGL context to draw in |
texture | Whether or not to draw with texture |
color | Whether or not to use per vertex colors |
normal | Whether or not to use per vertex normals |
◆ MultiDraw()
void MultiDraw |
( |
const unsigned int |
glPrimitive, |
|
|
const unsigned int |
offset, |
|
|
const unsigned int |
count, |
|
|
const unsigned int |
primitiveSize, |
|
|
GlsIndexArray & |
indexBuffer, |
|
|
IGlsStateManager * |
stateManager, |
|
|
const bool |
texture, |
|
|
const bool |
color, |
|
|
const bool |
normal |
|
) |
| |
Draw this vertex array
- Precondition
- _setup == true
- Postcondition
- The VBO is drawn
- Parameters
-
glPrimitive | The OpenGL primitive type to draw (e.g. GL_LINE_LOOP) |
offset | Index of the first vertex to draw |
count | Number of primitives to draw |
primitiveSize | Number of vertices per primitive |
indexBuffer | Index buffer to use |
stateManager | State manager for the OpenGL context to draw in |
texture | Whether or not to draw with texture |
color | Whether or not to use per vertex colors |
normal | Whether or not to use per vertex normals |
◆ SetColors()
void SetColors |
( |
const Vertex |
verts[] | ) |
|
Sets the Colors of the array. Note: This takes an array of Vertex for compatibility with DisplayObject. It gets the colors from the color component of the vertices.
- Precondition
- (_setup && _hasC)
- Parameters
-
verts | An array of colors to populate this object with. verts[] must have at least _nVerts elements |
◆ SetNormals()
void SetNormals |
( |
const Vector |
verts[] | ) |
|
Sets the Normals of the array
- Precondition
- (_setup && _hasN)
- Parameters
-
verts | An array of normals to populate this object with. verts[] must have at least _nVerts elements |
◆ SetTexCoord()
void SetTexCoord |
( |
const unsigned int |
index, |
|
|
const Vector & |
v |
|
) |
| |
Sets a single texture coordinate
- Precondition
- _setup && (index < _nVerts) && _hasT
- Parameters
-
index | The index of the texture coordinate to set |
v | The texture coordinate to set |
◆ SetTexCoords()
void SetTexCoords |
( |
const Vector |
verts[] | ) |
|
Sets the texture coordinates of the array
- Precondition
- (_setup && _hasT)
- Parameters
-
verts | An array of texture coords to populate this object with. verts[] must have at least _nVerts elements |
◆ Setup()
void Setup |
( |
const int |
nVerts, |
|
|
const bool |
hasT, |
|
|
const bool |
hasC, |
|
|
const bool |
hasN |
|
) |
| |
Prepare the vertex buffer to be populated. Allocates vertex buffer, sets up component offsets.
- Parameters
-
nVerts | Number of vertices in the array |
hasT | True if array has texture coords |
hasC | True if array has colors |
hasN | True if array has normas |
◆ SetVertex()
void SetVertex |
( |
const unsigned int |
index, |
|
|
const Vector & |
v |
|
) |
| |
Sets a single vertex
- Precondition
- _setup && (index < _nVerts)
- Parameters
-
index | The index of the vertex to set |
v | The vertex to set |
◆ SetVertices()
void SetVertices |
( |
const Vertex |
verts[] | ) |
|
Sets the vertices of the array
- Precondition
- _setup == true
- Parameters
-
verts | An array of vertices to populate this object with. verts[] must have at least _nVerts elements |
◆ _bufferSize
Size of data pointed to by _vertexData
◆ _colorOffset
unsigned int _colorOffset |
|
protected |
Offset of the color from the beginning of a component, in bytes
◆ _componentSize
unsigned int _componentSize |
|
protected |
Size of one element of this array (total size of all components) in bytes
◆ _hasC
True if this object has colors
◆ _hasN
True if this object has normals
◆ _hasT
True if this object has texture coordinates
◆ _normalOffset
unsigned int _normalOffset |
|
protected |
Offset of the normals from the beginning of a component, in bytes
◆ _nVerts
Number of vertices in this object
◆ _setup
True if this object has been setup and can be downloaded to a VBO
◆ _texOffset
Offset of the texture coords from the beginning of a component, in bytes
◆ _vboHandle
◆ _vertexData
unsigned char* _vertexData |
|
protected |
Contains the dynamically allocated, interleaved vertex data that gets sent to the VBO
The documentation for this class was generated from the following file: