GLFX::VertexComponent Struct Reference

#include <glfx.h>

Inheritance diagram for GLFX::VertexComponent:

GLFX::VertexComponentGen< ArrayT, IndexT, CountT, TypeT > GLFX::VertexComponentGen< GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB, IndexT, 1, GL_FLOAT > GLFX::VertexComponentGen< GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB, IndexT, 1, GL_UNSIGNED_BYTE > GLFX::VertexComponentGen< GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB, IndexT, 2, GL_FLOAT > GLFX::VertexComponentGen< GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB, IndexT, 2, GL_UNSIGNED_BYTE > GLFX::VertexComponentGen< GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB, IndexT, 3, GL_FLOAT > GLFX::VertexComponentGen< GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB, IndexT, 3, GL_UNSIGNED_BYTE > GLFX::VertexComponentGen< GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB, IndexT, 4, GL_FLOAT > GLFX::VertexComponentGen< GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB, IndexT, 4, GL_UNSIGNED_BYTE > GLFX::VertexComponentInvalidGen List of all members.

Detailed Description

This class exposes static methods to handle vertex format operations, like calculating size, enabling/disabling OpenGL states and setting pointers.

Sample usage:

   	struct Vert
   	{
   		float pos[3];
   		float normal[3];
   		float texture[2];
   		float attrib;
   		typedef VertexFormat<VC_VERTEX_3F, VC_NORMAL_3F, VC_TEXTURE0_2F, VC_ATTRIBUTE_1F<0> > Format;

   	};

   	Vert verts[100];
fill verts
   	VertexComponent* desc = Vert::Format::Desc();
   	VertexComponent::EnableClientState(desc);
   	VertexComponent::SetPointers(desc, 0, verts);
draw
   	VertexComponent::DisableClientState(desc);
    


Public Member Functions

 VertexComponent ()
 VertexComponent (int arr, int id, int num, int tp)

Static Public Member Functions

static unsigned long GetByteSize (int type, int count)
static unsigned long GetVertexSize (const VertexComponent *desc)
static void EnableClientState (const VertexComponent *desc)
static void DisableClientState (const VertexComponent *desc)
static void SetPointers (const VertexComponent *desc, int stride, void *ptr)
static const VertexComponentFindComponentByArray (const VertexComponent *desc, GLenum array, int index)
static unsigned long ComponentOffset (const VertexComponent *desc, const VertexComponent *component)

Public Attributes

GLenum array
unsigned long index
unsigned long count
GLenum type


Constructor & Destructor Documentation

GLFX::VertexComponent::VertexComponent (  )  [inline]

Default constructor.

GLFX::VertexComponent::VertexComponent ( int  arr,
int  id,
int  num,
int  tp 
) [inline]

Sets vertex component.

Parameters:
arr client array
id texture or attribute identifier
num component count
tp type


Member Function Documentation

static unsigned long GLFX::VertexComponent::GetByteSize ( int  type,
int  count 
) [static]

Returns the size of a vertex component.

Parameters:
type type of component
count number of elements in component
Returns:
size in bytes

static unsigned long GLFX::VertexComponent::GetVertexSize ( const VertexComponent desc  )  [static]

Computes vertex size in bytes.

Parameters:
desc a pointer to VertexComponent array describing vertex format, last element has to be VC_END
Returns:
size in bytes

static void GLFX::VertexComponent::EnableClientState ( const VertexComponent desc  )  [static]

Enables OpenGL client state.

Parameters:
desc a pointer to VertexComponent array describing vertex format, last element has to be VC_END

static void GLFX::VertexComponent::DisableClientState ( const VertexComponent desc  )  [static]

Disables OpenGL client state.

Parameters:
desc a pointer to VertexComponent array describing vertex format, last element has to be VC_END

static void GLFX::VertexComponent::SetPointers ( const VertexComponent desc,
int  stride,
void *  ptr 
) [static]

Sets OpenGL array pointers.

Parameters:
desc a pointer to VertexComponent array describing vertex format, last element has to be VC_END
stride vertex component stride, if 0 assumes that the components are tightly packed.
ptr pointer to vertex array

static const VertexComponent* GLFX::VertexComponent::FindComponentByArray ( const VertexComponent desc,
GLenum  array,
int  index 
) [static]

Find a vertex component of given type.

Parameters:
desc a pointer to VertexComponent array describing vertex format, last element has to be VC_END
array OpenGL array type
index texture or attribute id
Returns:
vertex component of given type or 0 if not found

static unsigned long GLFX::VertexComponent::ComponentOffset ( const VertexComponent desc,
const VertexComponent component 
) [static]

Computes offset in bytes of the vertex component.

Parameters:
desc a pointer to VertexComponent array describing vertex format, last element has to be VC_END
component vertex component of which offset is to be found
Returns:
offset in bytes


Member Data Documentation

GLenum GLFX::VertexComponent::array

OpenGL client array. (GL_*_ARRAY).

unsigned long GLFX::VertexComponent::index

Texture number or vertex attribute identifier.

unsigned long GLFX::VertexComponent::count

Number of elements.

GLenum GLFX::VertexComponent::type

Type of component. (GL_* type).


The documentation for this struct was generated from the following file:
SourceForge.net Logo