Om  1.0.0
A universal framework for multimedia simulation
Public Types | Public Member Functions | List of all members
om::graphics::buffers::IndexedPrimitiveType Class Reference

A class that is used to specify the type of an indexed primitive. More...

#include <omGraphicsIndexedPrimitiveType.h>

Public Types

enum  Enum {
  UNDEFINED = 0, POINTS = 1, LINES = 2, LINE_STRIP = 3,
  LINE_LOOP = 4, TRIANGLES = 5, TRIANGLE_STRIP = 6, TRIANGLE_FAN = 7,
  QUADS = 8, QUAD_STRIP = 9, POLYGON = 10
}
 An enum representing the type of indexed primitive. More...
 

Public Member Functions

 IndexedPrimitiveType ()
 Create a default indexed primitive type with the UNDEFINED primitive type enum value. More...
 
 IndexedPrimitiveType (Enum newType)
 Create a new indexed primitive type with the specified indexed primitive type enum value. More...
 
 IndexedPrimitiveType (Size vertexCount)
 Create a new indexed primitive type for the specified vertex count. More...
 
 operator Enum () const
 Convert this indexed primitive type to an enum value. More...
 
Size getMinimumVertexCount () const
 Return the minimum number of vertices needed to define an instance of this primitive type. More...
 
Size getVertexCount () const
 Return the number of vertices needed to define an instance of this primitive type after the first primitive. More...
 
Size getPrimitiveVertexCount (Size numVertices) const
 Return the number of vertices that should be used to define primitives from a list of the given vertex count. More...
 
String toString () const
 Return a string representation of the indexed primitive type. More...
 
 operator String () const
 Convert this indexed primitive type into a string representation. More...
 

Detailed Description

A class that is used to specify the type of an indexed primitive.

This class is used to tell the GPU what kind of primitives are represented by an index buffer. For instance, one could specify a list of indexed points, lines, triangles, or quads.

Member Enumeration Documentation

An enum representing the type of indexed primitive.

Enumerator
UNDEFINED 

An undefined indexed primitive type.

POINTS 

An indexed primitive type where every index represents a point to draw.

LINES 

An indexed primitive type where every 2 indices represent a line segment to draw.

LINE_STRIP 

An indexed primitive type where all of the indices in a buffer represent a set of connected line segments to draw.

The first index indicates the starting vertex and each additional index indicates the next vertex in a connected set of line segments.

LINE_LOOP 

An indexed primitive type where all of the indices in a buffer represent a set of connected line segments to draw.

The first index indicates the starting vertex and each additional index indicates the next vertex in a connected set of line segments. At the end of the list, a line is drawn between the first and last vertex, creating a closed loop.

TRIANGLES 

An indexed primitive type where every 3 indices represent a triangle to draw.

TRIANGLE_STRIP 

An indexed primitive type where all of the indices in a buffer represent a set of connected triangles to draw.

The first index indicates the starting vertex, the next vertex indicates the end of the first side of the first triangle, and the third vertex completes the first triangle. Each additional vertex after that creates a triangle with the last three vertices specified.

TRIANGLE_FAN 

An indexed primitive type where all of the indices in a buffer represent a set of connected triangles to draw.

The first index indicates the starting vertex, the next vertex indicates the end of the first side of the first triangle, and the third vertex completes the first triangle. Each additional index after that creates a triangle with the first vertex and the last vertex, resulting in a so-called 'fan' of triangles.

QUADS 

An indexed primitive type where every 4 indices represent a quad to draw.

QUAD_STRIP 

An indexed primitive type where all of the indices in a buffer represent a set of connected quads to draw.

The first index indicates the starting vertex, the next vertex indicates the end of the first side of the first quad, and the third and fourth vertices completes the first quad. Each additional 2 indices after that creates a quad with the last four vertices specified.

POLYGON 

A polygon with 3 or more vertices.

For an index buffer with this type, all of the indices in the buffer define the vertices of the polygon.

This primitive type may not be supported on all hardware but is provided for completeness.

Constructor & Destructor Documentation

om::graphics::buffers::IndexedPrimitiveType::IndexedPrimitiveType ( )
inline

Create a default indexed primitive type with the UNDEFINED primitive type enum value.

om::graphics::buffers::IndexedPrimitiveType::IndexedPrimitiveType ( Enum  newType)
inline

Create a new indexed primitive type with the specified indexed primitive type enum value.

om::graphics::buffers::IndexedPrimitiveType::IndexedPrimitiveType ( Size  vertexCount)
inline

Create a new indexed primitive type for the specified vertex count.

The constructor guesses the primitive type from the given vertex count.

Member Function Documentation

om::graphics::buffers::IndexedPrimitiveType::operator Enum ( ) const
inline

Convert this indexed primitive type to an enum value.

Size om::graphics::buffers::IndexedPrimitiveType::getMinimumVertexCount ( ) const

Return the minimum number of vertices needed to define an instance of this primitive type.

Size om::graphics::buffers::IndexedPrimitiveType::getVertexCount ( ) const

Return the number of vertices needed to define an instance of this primitive type after the first primitive.

Size om::graphics::buffers::IndexedPrimitiveType::getPrimitiveVertexCount ( Size  numVertices) const

Return the number of vertices that should be used to define primitives from a list of the given vertex count.

If there are not enough vertices to completely define every primitive, the number of vertices that is returned is modulo those extra vertices that are unable to define the last primitive.

String om::graphics::buffers::IndexedPrimitiveType::toString ( ) const

Return a string representation of the indexed primitive type.

om::graphics::buffers::IndexedPrimitiveType::operator String ( ) const
inline

Convert this indexed primitive type into a string representation.


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