Unofficial OpenGL Software Development Kit 0.5.0
An object that represents a static collection of mesh data.
Mesh objects are represent static mesh data. Mesh objects are composed of a VAO (which sets up all of the vertex attribute commands) coupled with a series of rendering commands, provided by a RenderCmdList.
A Mesh can have multiple VAOs, each of which has a unique name. These named VAOs are called variants. The main VAO, which is unnamed, will be used when no name is given to render. All of the variants are rendered with the same sequence of rendering commands.
This object owns the VAOs it is provided with, and it will delete them. It can also be given ownership of one or more buffer objects, which it will also delete when it is deleted. It does not use these buffer objects for any purpose other than to delete them.
Rendering with this class (via any call to Render) will affect the following OpenGL state:
GL_PRIMITIVE_RESTARTenable. After the call, it will be disabled.
|Mesh (const std::vector< GLuint > &bufferObjects, GLuint mainVao, const RenderCmdList &renderCmds, const MeshVariantMap &variants=MeshVariantMap())|
|Creates a mesh, given a series of buffer objects, VAOs, and rendering commands. More...|
|Deletes all VAOs and buffer objects owned by this Mesh. The OpenGL context must still exist. |
|void||Render () const|
|Renders the main VAO. Does nothing if there is no main VAO. |
|void||Render (const std::string &variantName) const|
|bool||DoesMainExist () const|
|Returns true if there is a main VAO. |
|bool||DoesVariantExist (const std::string &variantName) const|
|glmesh::Mesh::Mesh||(||const std::vector< GLuint > &||bufferObjects,|
|const RenderCmdList &||renderCmds,|
|const MeshVariantMap &||variants =
Creates a mesh, given a series of buffer objects, VAOs, and rendering commands.
This class claims ownership of all OpenGL objects passed to it. Its destructor will delete every VAO and buffer object it is given. If you want to manage the lifetime of a buffer object elsewhere, do not pass it as a parameter. Your VAOs can still reference those buffers, but this class will not dig through VAOs to delete buffers stored in them.
|bufferObjects||A series of buffer objects to be freed when this Mesh is destroyed. The same buffer object must not be in this array multiple times.|
|mainVao||The primary vertex array object, used when calling Render with no parameters. If it is 0, then the only way to render the mesh is with a named variant.|
|renderCmds||The series of rendering commands to be used to render this object. This sequence will be used for every variant.|
|variants||A std::map of named variants for the Mesh. It is legal to use the same VAOs for the mainVao and one of the variants, or between different variants.|
|bool glmesh::Mesh::DoesVariantExist||(||const std::string &||variantName||)||const|
Returns true if the named variant exists.
|void glmesh::Mesh::Render||(||const std::string &||variantName||)||const|
Renders a named variant. Does nothing if the named VAO does not exist.