Vbo.h

From K-3D

Jump to: navigation, search

The file vbo.h contains classes and functions that allow the VBO painters to share data and reuse common operations.

Sharing data

Data sharing batween painters is accomplished using the painter_cache class. This class is templated, with a template argument for the key and for the data. The key should conform to boost::shared_ptr. For each key_type-data_type combination a cache is associated with the document, ensuring only one copy of the data exists for each key. Examples of keys include the mesh point array, face array, ...

Stored data

Currently, the stored data include point positions, edge indices, face indices and normals.

Point positions and edge indices

These are simply stored in a VBO, wrapped by the vbo class.

Face indices

Face geometry is stored in the face class. Simple mapping to a single VBO is not possible, because polygons have an undetermined number of sides and rendering everything using GL_POLYGON would be inefficient. The face class splits the mesh data into separate VBOs for triangles, quads and polygons. Methods are provided for drawing, so clients don't have to worry about the internal representation.

Normal data

A class hierarchy was created for the normal data, with base class normal. The different subclasses allow different implementations of the normal calculation algorithm.

Retrieved from "http://wiki.k-3d.org/Vbo.h"