Public Member Functions | |
CVertexStream (int numVertices) | |
Construcs a vertex stream objecct with space for a given number of vertices. | |
void | coumputeTangentVectors (void) |
Computes tangent space vectors 'tangent' and 'bitangent'. | |
float | computeBoundingRadius (void) |
Computes the bounding radius. | |
void | render (int primitiveType, const vec4_t *overrideColor, const VertexAttribLocations *attribs) |
Sends the stream to OpenGL. | |
void | renderNormals (void) |
Draws the normals of all vertices. | |
void | renderTangentVectors (void) |
Draw the basis vectors of the tangent space for all vertices. | |
vec3_t * | v (void) |
Returns the vertex position array. | |
vec3_t * | n (void) |
Returns the normal array. | |
vec2_t * | t (void) |
Returns the tex coord array. | |
vec4_t * | c (void) |
Returns the primary color array. | |
vec3_t * | tan1 (void) |
Returns the tangent array. | |
vec3_t * | tan2 (void) |
Returns the bitangent array. | |
Classes | |
struct | tanSpace_s |
The custom vertex attributes, currently ony the tangent space vectors. |
The methods work like described in IVertexStream.
CVertexStream::CVertexStream | ( | int | numVertices | ) |
Construcs a vertex stream objecct with space for a given number of vertices.
numVertices | Number of vertices this stream can contains. |
void CVertexStream::coumputeTangentVectors | ( | void | ) | [virtual] |
Computes tangent space vectors 'tangent' and 'bitangent'.
Implements IVertexStream.
float CVertexStream::computeBoundingRadius | ( | void | ) | [virtual] |
Computes the bounding radius.
It simply returns the maximum length of all vertex positions stored in the stream.
Implements IVertexStream.
void CVertexStream::render | ( | int | primitiveType, | |
const vec4_t * | overrideColor, | |||
const VertexAttribLocations * | attribs | |||
) | [virtual] |
Sends the stream to OpenGL.
It setups OpenGL client state, binds vertex arrays, draws the complete array and cleans up the GL client state.
primitiveType | The primitive type that is passed to OpenGL. | |
overrideColor | If != NULL, this color will be passed to OpenGL instead of the colors stored in the stream. | |
attribs | If != NULL the custom vertex attributes are send to the locations defined in the parameter. |
Implements IVertexStream.
void CVertexStream::renderNormals | ( | void | ) | [virtual] |
Draws the normals of all vertices.
It loops through all vertices and draws a colored line starting at the vertex position and pointing into the normal's direction. The colors are chosen from the largest component: x == red, Y == green, Z == blue.
Implements IVertexStream.
void CVertexStream::renderTangentVectors | ( | void | ) | [virtual] |
Draw the basis vectors of the tangent space for all vertices.
It draws a line from the vertex position in the direction of each tangent space vector. Tangent == red, Bitangent == green, Normal == blue.
Implements IVertexStream.