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. | |
| void | shallowCopy (Geometry *) |
| 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. | |
| void | deepCopy (Geometry *) 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 | render (const Actor *actor, const Shader *shader, const Camera *camera, OpenGLContext *gl_context) const |
| Renders the Renderable. | |
| 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 | setNormal (const fvec3 &normal) |
| Geometry normal used when no normal array is defined. | |
| const fvec3 & | normal () |
| Geometry normal used when no normal array is defined. | |
| void | setColor (const fvec4 &color) |
| Geometry color used when no color array is defined. | |
| const fvec4 & | color () |
| Geometry color used when no color array is defined. | |
| void | setSecondaryColor (const fvec4 &color) |
| Geometry color used when no color array is defined. | |
| const fvec4 & | secondaryColor () |
| Geometry color used when no color array is defined. | |
| void | computeNormals () |
| Computes the normals in a "smooth" way, i.e. | |
| void | transform (const mat4 &matr, bool normalize=true) |
| Transforms vertices and normals belonging to this geometry. | |
| virtual void | clearArrays (bool clear_draw_calls=true) |
| Removes all the previously installed arrays. | |
| void | updateVBOs (bool discard_local_data=false, bool force_update=false) |
| Updates all the vertex buffer objects of both vertex arrays and draw calls. | |
| void | deleteVBOs () |
| Deletes all the vertex buffer objects of both vertex arrays and draw calls. | |
| 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 | setVertexArray (ArrayAbstract *data) |
| Conventional vertex array. | |
| const ArrayAbstract * | vertexArray () const |
| Conventional vertex array. | |
| ArrayAbstract * | vertexArray () |
| Conventional vertex array. | |
| void | setNormalArray (ArrayAbstract *data) |
| Conventional normal array. | |
| const ArrayAbstract * | normalArray () const |
| Conventional normal array. | |
| ArrayAbstract * | normalArray () |
| Conventional normal array. | |
| void | setColorArray (ArrayAbstract *data) |
| Conventional color array. | |
| const ArrayAbstract * | colorArray () const |
| Conventional color array. | |
| ArrayAbstract * | colorArray () |
| Conventional color array. | |
| void | setSecondaryColorArray (ArrayAbstract *data) |
| Conventional secondary color array. | |
| const ArrayAbstract * | secondaryColorArray () const |
| Conventional secondary color array. | |
| ArrayAbstract * | secondaryColorArray () |
| Conventional secondary color array. | |
| void | setFogCoordArray (ArrayAbstract *data) |
| Conventional fog array. | |
| const ArrayAbstract * | fogCoordArray () const |
| Conventional fog array. | |
| ArrayAbstract * | fogCoordArray () |
| Conventional fog array. | |
| void | setTexCoordArray (int tex_unit, ArrayAbstract *data) |
| Conventional texture coords arrays. | |
| const ArrayAbstract * | texCoordArray (int tex_unit) const |
| Conventional texture coords arrays. | |
| ArrayAbstract * | texCoordArray (int tex_unit) |
| Conventional texture coords arrays. | |
| int | texCoordArrayCount () const |
| void | getTexCoordArrayAt (int i, int &out_tex_unit, const ArrayAbstract *&tex_array) const |
| void | setVertexAttribArray (unsigned int attrib_idx, bool normalize, bool pure_integer, ArrayAbstract *data) |
| void | setVertexAttribArray (const VertexAttribInfo &info) |
| Binds a generic vertex attribute. | |
| const ArrayAbstract * | vertexAttrib (unsigned int attrib_idx) const |
| Returns a generic vertex attribute. | |
| ArrayAbstract * | vertexAttrib (unsigned int attrib_idx) |
| Returns a generic vertex attribute. | |
| const VertexAttribInfo * | vertexAttribInfo (unsigned int attrib_idx) const |
| Returns a generic vertex attribute's info. | |
| VertexAttribInfo * | vertexAttribInfo (unsigned int attrib_idx) |
| Returns a generic vertex attribute's info. | |
| ref< VertexAttribInfo > | eraseVertexAttrib (unsigned int attrib_idx) |
| int | vertexAttribInfoCount () const |
| Returns the number of generic vertex attribute arrays bound. | |
| const VertexAttribInfo * | getVertexAttribInfoAt (int i) const |
Returns i-th VertexAttribInfo, where i is not out_attrib_info.attribIndex(). | |
| Collection< VertexAttribInfo > * | vertexAttribArrays () |
| The list of VertexAttribInfo objects bound to a Geometry. | |
| const Collection < VertexAttribInfo > * | vertexAttribArrays () const |
| The list of VertexAttribInfo objects bound to a Geometry. | |
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. | |
Protected Member Functions | |
| virtual void | computeBounds_Implementation () |
Protected Attributes | |
| Collection< DrawCall > | mDrawCalls |
| fvec4 | mColor |
| fvec4 | mSecondaryColor |
| fvec3 | mNormal |
| ref< ArrayAbstract > | mVertexArray |
| ref< ArrayAbstract > | mNormalArray |
| ref< ArrayAbstract > | mColorArray |
| ref< ArrayAbstract > | mSecondaryColorArray |
| ref< ArrayAbstract > | mFogCoordArray |
| Collection< TextureArray > | mTexCoordArrays |
| Collection< VertexAttribInfo > | mVertexAttribArrays |
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.
| void Geometry::shallowCopy | ( | Geometry * | geom ) |
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.
| void Geometry::deepCopy | ( | Geometry * | geom ) | const |
Performs a deep copy (as opposed to a shallow copy) of the specified Geometry.
Performs a shallowCopy() of the Geometry.
| void Geometry::render | ( | const Actor * | actor, |
| const Shader * | shader, | ||
| const Camera * | camera, | ||
| OpenGLContext * | gl_context | ||
| ) | const [virtual] |
Renders the Renderable.
Implements vl::Renderable.
| Collection<DrawCall>* vl::Geometry::drawCalls | ( | ) | [inline] |
| const Collection<DrawCall>* vl::Geometry::drawCalls | ( | ) | const [inline] |
| void vl::Geometry::setNormal | ( | const fvec3 & | normal ) | [inline] |
Geometry normal used when no normal array is defined.
| const fvec3& vl::Geometry::normal | ( | ) | [inline] |
Geometry normal used when no normal array is defined.
| void vl::Geometry::setColor | ( | const fvec4 & | color ) | [inline] |
Geometry color used when no color array is defined.
| void vl::Geometry::setSecondaryColor | ( | const fvec4 & | color ) | [inline] |
Geometry color used when no color array is defined.
| const fvec4& vl::Geometry::secondaryColor | ( | ) | [inline] |
Geometry color used when no color array is defined.
| 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.
| 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::clearArrays | ( | bool | clear_draw_calls = true ) |
[virtual] |
Removes all the previously installed arrays.
| void Geometry::updateVBOs | ( | bool | discard_local_data = false, |
| bool | force_update = false |
||
| ) | [virtual] |
Updates all the vertex buffer objects of both vertex arrays and draw calls.
Implements vl::Renderable.
| void Geometry::deleteVBOs | ( | ) | [virtual] |
Deletes all the vertex buffer objects of both vertex arrays and draw calls.
Reimplemented from vl::Renderable.
| 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 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. |
| void Geometry::setVertexArray | ( | ArrayAbstract * | data ) | [virtual] |
Conventional vertex array.
Implements vl::IVertexAttribSet.
| const ArrayAbstract* vl::Geometry::vertexArray | ( | ) | const [inline, virtual] |
Conventional vertex array.
Implements vl::IVertexAttribSet.
| ArrayAbstract* vl::Geometry::vertexArray | ( | ) | [inline, virtual] |
Conventional vertex array.
Implements vl::IVertexAttribSet.
| void Geometry::setNormalArray | ( | ArrayAbstract * | data ) | [virtual] |
Conventional normal array.
Implements vl::IVertexAttribSet.
| const ArrayAbstract* vl::Geometry::normalArray | ( | ) | const [inline, virtual] |
Conventional normal array.
Implements vl::IVertexAttribSet.
| ArrayAbstract* vl::Geometry::normalArray | ( | ) | [inline, virtual] |
Conventional normal array.
Implements vl::IVertexAttribSet.
| void Geometry::setColorArray | ( | ArrayAbstract * | data ) | [virtual] |
Conventional color array.
Implements vl::IVertexAttribSet.
| const ArrayAbstract* vl::Geometry::colorArray | ( | ) | const [inline, virtual] |
Conventional color array.
Implements vl::IVertexAttribSet.
| ArrayAbstract* vl::Geometry::colorArray | ( | ) | [inline, virtual] |
Conventional color array.
Implements vl::IVertexAttribSet.
| void Geometry::setSecondaryColorArray | ( | ArrayAbstract * | data ) | [virtual] |
Conventional secondary color array.
Implements vl::IVertexAttribSet.
| const ArrayAbstract* vl::Geometry::secondaryColorArray | ( | ) | const [inline, virtual] |
Conventional secondary color array.
Implements vl::IVertexAttribSet.
| ArrayAbstract* vl::Geometry::secondaryColorArray | ( | ) | [inline, virtual] |
Conventional secondary color array.
Implements vl::IVertexAttribSet.
| void Geometry::setFogCoordArray | ( | ArrayAbstract * | data ) | [virtual] |
Conventional fog array.
Implements vl::IVertexAttribSet.
| const ArrayAbstract* vl::Geometry::fogCoordArray | ( | ) | const [inline, virtual] |
Conventional fog array.
Implements vl::IVertexAttribSet.
| ArrayAbstract* vl::Geometry::fogCoordArray | ( | ) | [inline, virtual] |
Conventional fog array.
Implements vl::IVertexAttribSet.
| void Geometry::setTexCoordArray | ( | int | tex_unit, |
| ArrayAbstract * | data | ||
| ) | [virtual] |
Conventional texture coords arrays.
Implements vl::IVertexAttribSet.
| const ArrayAbstract* vl::Geometry::texCoordArray | ( | int | tex_unit ) | const [inline, virtual] |
Conventional texture coords arrays.
Implements vl::IVertexAttribSet.
| ArrayAbstract* vl::Geometry::texCoordArray | ( | int | tex_unit ) | [inline, virtual] |
Conventional texture coords arrays.
Implements vl::IVertexAttribSet.
| int vl::Geometry::texCoordArrayCount | ( | ) | const [inline, virtual] |
Implements vl::IVertexAttribSet.
| void vl::Geometry::getTexCoordArrayAt | ( | int | i, |
| int & | out_tex_unit, | ||
| const ArrayAbstract *& | tex_array | ||
| ) | const [inline, virtual] |
Implements vl::IVertexAttribSet.
| void vl::Geometry::setVertexAttribArray | ( | unsigned int | attrib_idx, |
| bool | normalize, | ||
| bool | pure_integer, | ||
| ArrayAbstract * | data | ||
| ) | [inline] |
| void Geometry::setVertexAttribArray | ( | const VertexAttribInfo & | info ) | [virtual] |
Binds a generic vertex attribute.
Implements vl::IVertexAttribSet.
| const ArrayAbstract * Geometry::vertexAttrib | ( | unsigned int | attrib_idx ) | const [virtual] |
Returns a generic vertex attribute.
Implements vl::IVertexAttribSet.
| ArrayAbstract * Geometry::vertexAttrib | ( | unsigned int | attrib_idx ) | [virtual] |
Returns a generic vertex attribute.
Implements vl::IVertexAttribSet.
| const VertexAttribInfo * Geometry::vertexAttribInfo | ( | unsigned int | attrib_idx ) | const [virtual] |
Returns a generic vertex attribute's info.
Implements vl::IVertexAttribSet.
| VertexAttribInfo * Geometry::vertexAttribInfo | ( | unsigned int | attrib_idx ) | [virtual] |
Returns a generic vertex attribute's info.
Implements vl::IVertexAttribSet.
| ref< VertexAttribInfo > Geometry::eraseVertexAttrib | ( | unsigned int | attrib_idx ) | [virtual] |
Implements vl::IVertexAttribSet.
| int vl::Geometry::vertexAttribInfoCount | ( | ) | const [inline, virtual] |
Returns the number of generic vertex attribute arrays bound.
Implements vl::IVertexAttribSet.
| const VertexAttribInfo* vl::Geometry::getVertexAttribInfoAt | ( | int | i ) | const [inline, virtual] |
Returns i-th VertexAttribInfo, where i is not out_attrib_info.attribIndex().
Implements vl::IVertexAttribSet.
| Collection<VertexAttribInfo>* vl::Geometry::vertexAttribArrays | ( | ) | [inline] |
The list of VertexAttribInfo objects bound to a Geometry.
| const Collection<VertexAttribInfo>* vl::Geometry::vertexAttribArrays | ( | ) | const [inline] |
The list of VertexAttribInfo objects bound to a Geometry.
| void Geometry::computeBounds_Implementation | ( | ) | [protected, virtual] |
Implements vl::Renderable.
Collection<DrawCall> vl::Geometry::mDrawCalls [protected] |
fvec4 vl::Geometry::mColor [protected] |
fvec4 vl::Geometry::mSecondaryColor [protected] |
fvec3 vl::Geometry::mNormal [protected] |
ref<ArrayAbstract> vl::Geometry::mVertexArray [protected] |
ref<ArrayAbstract> vl::Geometry::mNormalArray [protected] |
ref<ArrayAbstract> vl::Geometry::mColorArray [protected] |
ref<ArrayAbstract> vl::Geometry::mSecondaryColorArray [protected] |
ref<ArrayAbstract> vl::Geometry::mFogCoordArray [protected] |
Collection<TextureArray> vl::Geometry::mTexCoordArrays [protected] |
Collection<VertexAttribInfo> vl::Geometry::mVertexAttribArrays [protected] |