Visualization LibraryA lightweight C++ OpenGL middleware for 2D/3D graphics |
[Home] [Tutorials] [All Classes] [Grouped Classes] |
The Geometry class is a Renderable that implements a polygonal mesh made of polygons, lines and points. More...
#include <Geometry.hpp>
Classes | |
| class | TextureArray |
Public Member Functions | |
| virtual const char * | className () |
| Returns the name of the class. | |
| Geometry () | |
| Constructor. | |
| virtual | ~Geometry () |
| Destructor. | |
| ref< Geometry > | shallowCopy () |
| Performs a shallow copy (as opposed to a deep copy) of the specified Geometry. | |
| ref< Geometry > | deepCopy () const |
| Performs a deep copy (as opposed to a shallow copy) of the specified Geometry. | |
| Geometry & | operator= (const Geometry &other) |
| Performs a shallowCopy() of the Geometry. | |
| virtual void | computeBounds_Implementation () |
| void | computeNormals () |
| Computes the normals in a "smooth" way, i.e. | |
| virtual void | render (const Actor *, const Camera *) const |
| Renders the Renderable. | |
| virtual void | clearArrays (bool clear_draw_calls=true) |
| Removes all the previously installed arrays. | |
| void | setColorArray (const fvec4 &col) |
| Filles the color array with a single color. | |
| void | setVertexArray (ArrayAbstract *data) |
| void | setNormalArray (ArrayAbstract *data) |
| void | setColorArray (ArrayAbstract *data) |
| void | setSecondaryColorArray (ArrayAbstract *data) |
| void | setFogCoordArray (ArrayAbstract *data) |
| void | setTexCoordArray (int tex_unit, ArrayAbstract *data) |
| const ArrayAbstract * | vertexArray () const |
| ArrayAbstract * | vertexArray () |
| const ArrayAbstract * | normalArray () const |
| ArrayAbstract * | normalArray () |
| const ArrayAbstract * | colorArray () const |
| ArrayAbstract * | colorArray () |
| const ArrayAbstract * | secondaryColorArray () const |
| ArrayAbstract * | secondaryColorArray () |
| const ArrayAbstract * | fogCoordArray () const |
| ArrayAbstract * | fogCoordArray () |
| const ArrayAbstract * | texCoordArray (int tex_unit) const |
| ArrayAbstract * | texCoordArray (int tex_unit) |
| Collection < VertexAttributeArray > * | vertexAttributeArrays () |
| Returns the list of VertexAttributeArray objects bound to a Geometry. | |
| const Collection < VertexAttributeArray > * | vertexAttributeArrays () const |
| Returns the list of VertexAttributeArray objects bound to a Geometry. | |
| void | setVertexAttributeArray (unsigned int name, bool normalize, bool pure_integer, ArrayAbstract *data) |
| void | setVertexAttributeArray (const VertexAttributeArray &info) |
| const VertexAttributeArray * | findVertexAttribute (unsigned int name) const |
| VertexAttributeArray * | findVertexAttribute (unsigned int name) |
| void | eraseVertexAttributeByName (unsigned int name) |
| Collection< DrawCall > * | drawCalls () |
| Returns the list of DrawCall objects bound to a Geometry. | |
| const Collection< DrawCall > * | drawCalls () const |
| Returns the list of DrawCall objects bound to a Geometry. | |
| void | updateVBOs (bool discard_local_data=false) |
| Uploads the data stored in the local buffers on the GPU memory. | |
| void | deleteVBOs () |
| Destroyes the VBO (VertexBufferObjects) associated to this Geometry attributes. | |
| void | transform (const mat4 &matr, bool normalize=true) |
| Transforms vertices and normals belonging to this geometry. | |
| void | mergeTriangleStrips () |
| Merges all the PT_TRIANGLE_STRIP DrawElementsUInt objects into one single PT_TRIANGLE_STRIP DrawElementsUInt. | |
| void | convertDrawCallToDrawArrays () |
| Converts all the DrawCall objects bound to a Geometry into DrawArrays. | |
| bool | sortVertices () |
| Sorts the vertices of the geometry to maximize vertex-cache coherency. | |
| void | colorizePrimitives () |
| Assigns a random color to each vertex of each DrawCall object. If a vertex is shared among more than one DrawCall object its color is undefined. | |
| void | regenerateVertices (const std::vector< size_t > &map_new_to_old) |
| void | updateVBOs () |
| Updates the vertex buffer objects. | |
Static Public Member Functions | |
| static void | computeTangentSpace (size_t vert_count, const vl::fvec3 *vertex, const vl::fvec3 *normal, const vl::fvec2 *texcoord, const vl::DrawCall *primitives, vl::fvec3 *tangent, vl::fvec3 *bitangent) |
| Computes the tangent (and optionally bitangent) vectors used to form a TBN matrix to be used for bumpmapping. | |
The Geometry class is a Renderable that implements a polygonal mesh made of polygons, lines and points.
| Geometry::Geometry | ( | ) |
Constructor.
| Geometry::~Geometry | ( | ) | [virtual] |
Destructor.
| virtual const char* vl::Geometry::className | ( | ) | [inline, virtual] |
Returns the name of the class.
Reimplemented from vl::Renderable.
Reimplemented in vl::BezierSurface.
Performs a shallow copy (as opposed to a deep copy) of the specified Geometry.
Performs a deep copy (as opposed to a shallow copy) of the specified Geometry.
Performs a shallowCopy() of the Geometry.
| void Geometry::computeBounds_Implementation | ( | ) | [virtual] |
Implements vl::Renderable.
| void Geometry::computeNormals | ( | ) |
Computes the normals in a "smooth" way, i.e.
averaging the normals of those polygons that share one or more vertices.
This function computes smoothed normals for triangle primitives and leaves unchanged the normals of line and point primitives when possible, i.e. when they don't share vertices with the polygonal primitives.
Renders the Renderable.
Implements vl::Renderable.
| void Geometry::clearArrays | ( | bool | clear_draw_calls = true ) |
[virtual] |
Removes all the previously installed arrays.
| void Geometry::setColorArray | ( | const fvec4 & | col ) |
Filles the color array with a single color.
If the color array has been already defined it must be of one of the following types: ArrayFVec3, ArrayFVec4, ArrayUByte3, ArrayUBVec4 If no color array has been defined a new ArrayUBVec4 is installed and filled.
| void Geometry::setVertexArray | ( | ArrayAbstract * | data ) |
| void Geometry::setNormalArray | ( | ArrayAbstract * | data ) |
| void Geometry::setColorArray | ( | ArrayAbstract * | data ) |
| void Geometry::setSecondaryColorArray | ( | ArrayAbstract * | data ) |
| void Geometry::setFogCoordArray | ( | ArrayAbstract * | data ) |
| void Geometry::setTexCoordArray | ( | int | tex_unit, |
| ArrayAbstract * | data | ||
| ) |
| const ArrayAbstract* vl::Geometry::vertexArray | ( | ) | const [inline] |
| ArrayAbstract* vl::Geometry::vertexArray | ( | ) | [inline] |
| const ArrayAbstract* vl::Geometry::normalArray | ( | ) | const [inline] |
| ArrayAbstract* vl::Geometry::normalArray | ( | ) | [inline] |
| const ArrayAbstract* vl::Geometry::colorArray | ( | ) | const [inline] |
| ArrayAbstract* vl::Geometry::colorArray | ( | ) | [inline] |
| const ArrayAbstract* vl::Geometry::secondaryColorArray | ( | ) | const [inline] |
| ArrayAbstract* vl::Geometry::secondaryColorArray | ( | ) | [inline] |
| const ArrayAbstract* vl::Geometry::fogCoordArray | ( | ) | const [inline] |
| ArrayAbstract* vl::Geometry::fogCoordArray | ( | ) | [inline] |
| const ArrayAbstract* vl::Geometry::texCoordArray | ( | int | tex_unit ) | const [inline] |
| ArrayAbstract* vl::Geometry::texCoordArray | ( | int | tex_unit ) | [inline] |
| Collection<VertexAttributeArray>* vl::Geometry::vertexAttributeArrays | ( | ) | [inline] |
Returns the list of VertexAttributeArray objects bound to a Geometry.
| const Collection<VertexAttributeArray>* vl::Geometry::vertexAttributeArrays | ( | ) | const [inline] |
Returns the list of VertexAttributeArray objects bound to a Geometry.
| void vl::Geometry::setVertexAttributeArray | ( | unsigned int | name, |
| bool | normalize, | ||
| bool | pure_integer, | ||
| ArrayAbstract * | data | ||
| ) | [inline] |
| void Geometry::setVertexAttributeArray | ( | const VertexAttributeArray & | info ) |
| const VertexAttributeArray * Geometry::findVertexAttribute | ( | unsigned int | name ) | const |
| VertexAttributeArray * Geometry::findVertexAttribute | ( | unsigned int | name ) |
| void Geometry::eraseVertexAttributeByName | ( | unsigned int | name ) |
| Collection<DrawCall>* vl::Geometry::drawCalls | ( | ) | [inline] |
| const Collection<DrawCall>* vl::Geometry::drawCalls | ( | ) | const [inline] |
| void Geometry::updateVBOs | ( | bool | = false ) |
[virtual] |
Uploads the data stored in the local buffers on the GPU memory.
If 'discard_local_data' is set to true the memory used by the local buffers is released.
Reimplemented from vl::Renderable.
| void Geometry::deleteVBOs | ( | ) | [virtual] |
Destroyes the VBO (VertexBufferObjects) associated to this Geometry attributes.
If 'clear_primitives' all the VBOs associated the DrawCall objects are also deleted.
Reimplemented from vl::Renderable.
| void Geometry::transform | ( | const mat4 & | matr, |
| bool | normalize = true |
||
| ) |
Transforms vertices and normals belonging to this geometry.
If 'normalize' == true the normals are normalized after being transformed
| void Geometry::mergeTriangleStrips | ( | ) |
Merges all the PT_TRIANGLE_STRIP DrawElementsUInt objects into one single PT_TRIANGLE_STRIP DrawElementsUInt.
| void Geometry::convertDrawCallToDrawArrays | ( | ) |
Converts all the DrawCall objects bound to a Geometry into DrawArrays.
| bool Geometry::sortVertices | ( | ) |
Sorts the vertices of the geometry to maximize vertex-cache coherency.
This function will work only if all the DrawCall are DrawElements.
| void Geometry::colorizePrimitives | ( | ) |
| void Geometry::regenerateVertices | ( | const std::vector< size_t > & | map_new_to_old ) |
| void vl::Geometry::updateVBOs | ( | ) |
Updates the vertex buffer objects.
| void Geometry::computeTangentSpace | ( | size_t | vert_count, |
| const vl::fvec3 * | vertex, | ||
| const vl::fvec3 * | normal, | ||
| const vl::fvec2 * | texcoord, | ||
| const vl::DrawCall * | primitives, | ||
| vl::fvec3 * | tangent, | ||
| vl::fvec3 * | bitangent | ||
| ) | [static] |
Computes the tangent (and optionally bitangent) vectors used to form a TBN matrix to be used for bumpmapping.
| vert_count | The number of elements stored in vertex, normal, texcoord, tangent and bitangent. |
| vertex | Array containing the vertex positions. |
| normal | Array containing the normals of the vertices. |
| texcoord | Array containing the 2d texture coordinates of the bumpmap. |
| primitives | The triangles, quads etc. defining the geometry of the object. |
| tangent | [out] Returns the tangent vector of the vertices. This parameter is mandatory. |
| bitangent | [out] Returns the bitangent vector of the vertics. This parameter can be NULL. |