Basic Image AlgorithmS Library
2.8.0
|
A vertex format describes the attributes of a vertex. More...
#include <OpenGLFramework/Base/glfVertexFormat.hh>
Public Types | |
enum | Attribute { ATTRIB_POSITION, ATTRIB_NORMAL, ATTRIB_COLOR, ATTRIB_TEXCOORD, ATTRIB_GENERIC } |
Possible attributes of a vertex. More... | |
Public Member Functions | |
void | AddAttribute (Attribute attrib, int index, GLenum type, int size, bool normalized=false) |
Adds a vertex attribute to the format. More... | |
void | AddAttribute (Attribute attrib, GLenum type, int size) |
Convenience wrapper for other glfVertexFormat::AddAttribute method if no additional attribute index is required. More... | |
void | Bind (const void *data) const |
Binds a vertex buffer or vertex array in OpenGL using this vertex format. More... | |
bool | GetAttributeInfo (Attribute attrib, int index, int &offset, GLenum &type, int &size) const |
Retrieves information about a vertex attribute inside the vertex structure. More... | |
int | GetVertexSize () const |
Returns the size in bytes of a single vertex. More... | |
glfVertexFormat () | |
bool | HasAttribute (Attribute attrib, int index=0) const |
Returns true iff the given attribute is part of the format. More... | |
glfVertexFormat & | operator= (const glfVertexFormat &v2) |
~glfVertexFormat () | |
A vertex format describes the attributes of a vertex.
A list of vertices with the same format are stored in a vertex buffer.
Definition at line 40 of file glfVertexFormat.hh.
Possible attributes of a vertex.
Note that ATTRIB_TEXCOORD and ATTRIB_GENERIC require an additional index, i.e. there can be multiple of them.
Enumerator | |
---|---|
ATTRIB_POSITION | |
ATTRIB_NORMAL | |
ATTRIB_COLOR | |
ATTRIB_TEXCOORD | |
ATTRIB_GENERIC |
Definition at line 50 of file glfVertexFormat.hh.
glfVertexFormat::glfVertexFormat | ( | ) |
Definition at line 30 of file glfVertexFormat.cpp.
glfVertexFormat::~glfVertexFormat | ( | ) |
Definition at line 35 of file glfVertexFormat.cpp.
void glfVertexFormat::AddAttribute | ( | Attribute | attrib, |
int | index, | ||
GLenum | type, | ||
int | size, | ||
bool | normalized = false |
||
) |
Adds a vertex attribute to the format.
attrib | The attribute to be added. |
index | Additional index for ATTRIB_TEXCOORD and ATTRIB_GENERIC. |
type | Data type for this attribute. Can be GL_BYTE, GL_UNSIGNED_BYTE, GL_SHORT, GL_UNSIGNED_SHORT, GL_INT, GL_UNSIGNED_INT, GL_FLOAT, or GL_DOUBLE. |
size | Number of components for this attribute, i.e. 3 for a 3-dimensional vector. |
normalized | True if values should be normalized. Only for ATTRIB_GENERIC. |
Definition at line 49 of file glfVertexFormat.cpp.
References ATTRIB_GENERIC, ATTRIB_TEXCOORD, and HasAttribute().
Referenced by BIAS::Primitives::AddRelativeQuadPatches(), BIAS::Primitives::AddRelativeQuadPatchOverImageLine(), BIAS::clfTrimmedICP::clfTrimmedICP(), BIAS::Primitives::LocalNormalizedVertexCloud(), BIAS::Primitives::LocalPerspectivePatches(), BIAS::Primitives::LocalPerspectivePatchOverLine(), BIAS::Primitives::LocalPerspectiveQuad(), BIAS::Primitives::PlainQuad2DWithTexture2D(), and BIAS::PMDWarp::SetupDefaultPrimitiveRendering_().
|
inline |
Convenience wrapper for other glfVertexFormat::AddAttribute method if no additional attribute index is required.
This can be used for all attributes except ATTRIB_TEXCOORD and ATTRIB_GENERIC.
Definition at line 80 of file glfVertexFormat.hh.
void glfVertexFormat::Bind | ( | const void * | data | ) | const |
Binds a vertex buffer or vertex array in OpenGL using this vertex format.
Definition at line 237 of file glfVertexFormat.cpp.
References ATTRIB_COLOR, ATTRIB_GENERIC, ATTRIB_NORMAL, ATTRIB_POSITION, and ATTRIB_TEXCOORD.
Referenced by BIAS::glfVertexBuffer::Bind().
bool glfVertexFormat::GetAttributeInfo | ( | Attribute | attrib, |
int | index, | ||
int & | offset, | ||
GLenum & | type, | ||
int & | size | ||
) | const |
Retrieves information about a vertex attribute inside the vertex structure.
Returns false
if the vertex attribute is not part of this format.
Definition at line 110 of file glfVertexFormat.cpp.
References ATTRIB_GENERIC, and ATTRIB_TEXCOORD.
int glfVertexFormat::GetVertexSize | ( | ) | const |
Returns the size in bytes of a single vertex.
Definition at line 93 of file glfVertexFormat.cpp.
Referenced by BIAS::clfBuffer::AllocateFromVertexBuffer(), and BIAS::glfVertexBuffer::Create().
bool glfVertexFormat::HasAttribute | ( | Attribute | attrib, |
int | index = 0 |
||
) | const |
Returns true
iff the given attribute is part of the format.
Definition at line 98 of file glfVertexFormat.cpp.
References ATTRIB_GENERIC, and ATTRIB_TEXCOORD.
Referenced by AddAttribute().
glfVertexFormat & glfVertexFormat::operator= | ( | const glfVertexFormat & | v2 | ) |
Definition at line 40 of file glfVertexFormat.cpp.