KGLLib
Public Types | Public Member Functions | Protected Member Functions
KGLLib::GeometryBufferFormat Class Reference

Utility class to represent format of a GeometryBuffer. More...

#include <geometrybuffer.h>

List of all members.

Public Types

enum  Format {
  Vertex3 = 1 << 0, Vertex4 = 1 << 1, Color3 = 1 << 2, Color4 = 1 << 3,
  Normal3 = 1 << 4, Normal = Normal3, TexCoord2 = 1 << 5
}

Public Member Functions

 GeometryBufferFormat ()
 GeometryBufferFormat (int vertexCount, int indexCount=0)
 GeometryBufferFormat (Format fmt, int vertexCount, int indexCount=0)
void addVertices (int size)
void addNormals ()
void addColors (int size)
void addTexCoords (int size)
int vertexSize () const
int colorSize () const
int normalSize () const
int texCoordSize () const
int vertexCount () const
void setVertexCount (int count)
int indexCount () const
void setIndexCount (int count)
bool isIndexed () const

Protected Member Functions

void init (int vertexCount, int indexCount)

Detailed Description

Utility class to represent format of a GeometryBuffer.

GeometryBufferFormat object encapsulates information about a GeometryBuffer object. That information includes which attributes (e.g. vertices, normals, texture coordinates) are stored in the buffer as well as the size (number of components) of each coordinate.


Constructor & Destructor Documentation

KGLLib::GeometryBufferFormat::GeometryBufferFormat ( )

Creates an invalid format.

You will need to specify at least vertex size and count before it can be used.

GeometryBufferFormat


Member Function Documentation

void KGLLib::GeometryBufferFormat::addColors ( int  size) [inline]

Sets number of color components to size.

Referenced by KGLLib::Batch::bestBufferFormat().

void KGLLib::GeometryBufferFormat::addNormals ( ) [inline]

Sets number of normal components to 3 (normals always have 3 components).

Referenced by KGLLib::Batch::bestBufferFormat().

void KGLLib::GeometryBufferFormat::addTexCoords ( int  size) [inline]

Sets number of texture coordinate components to size.

Referenced by KGLLib::Batch::bestBufferFormat().

void KGLLib::GeometryBufferFormat::addVertices ( int  size) [inline]

Sets number of vertex components to size.

This has to be specified before the format is valid and can be used.

Referenced by KGLLib::Batch::bestBufferFormat().

int KGLLib::GeometryBufferFormat::colorSize ( ) const [inline]
Returns:
number of components in a color.

Referenced by KGLLib::GeometryBuffer::bufferSize().

int KGLLib::GeometryBufferFormat::indexCount ( ) const [inline]
Returns:
number of indices.

If this is 0, then non-indexed rendering will be used and all vertices will be used in sequential order. Otherwise indexed rendering will be used and vertices will be used in order specified by indices.

See also:
vertexCount(), isIndexed()

Referenced by KGLLib::GeometryBuffer::indexBufferSize().

bool KGLLib::GeometryBufferFormat::isIndexed ( ) const [inline]
Returns:
whether this is an indexed format or not.
See also:
indexCount()
int KGLLib::GeometryBufferFormat::normalSize ( ) const [inline]
Returns:
number of components in a normal.

Referenced by KGLLib::GeometryBuffer::bufferSize().

int KGLLib::GeometryBufferFormat::texCoordSize ( ) const [inline]
Returns:
number of components in a texture coordinate.

Referenced by KGLLib::GeometryBuffer::bufferSize().

int KGLLib::GeometryBufferFormat::vertexCount ( ) const [inline]
Returns:
number of vertices.
See also:
indexCount()

Referenced by KGLLib::GeometryBuffer::bufferSize().

int KGLLib::GeometryBufferFormat::vertexSize ( ) const [inline]
Returns:
number of components in a vertex.

Referenced by KGLLib::GeometryBuffer::bufferSize().


The documentation for this class was generated from the following files: