Visualization Library v1.0.3A lightweight C++ OpenGL middleware for 2D/3D graphics |
[Download] [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 | |
Geometry () | |
Constructor. | |
virtual | ~Geometry () |
Destructor. | |
ref< Geometry > | shallowCopy () const |
Performs a shallow copy of a Geometry. | |
Geometry & | shallowCopyFrom (const Geometry &) |
Performs a shallow copy of the specified Geometry. | |
ref< Geometry > | deepCopy () const |
Performs a deep copy of a Geometry. | |
Geometry & | deepCopyFrom (const Geometry &) |
Performs a deep copy of the specified Geometry. | |
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 | setColorArray (const fvec4 &color) |
Fills the color array with the given color. | |
virtual void | clearArrays (bool clear_draw_calls=true) |
Removes all the previously installed arrays. | |
virtual void | updateDirtyBufferObject (EBufferObjectUpdateMode mode) |
Updates all the vertex buffer objects of both vertex arrays and draw calls that are marked as dirty. | |
virtual void | deleteBufferObject () |
Deletes all the vertex buffer objects of both vertex arrays and draw calls. | |
void | convertToVertexAttribs () |
Converts the fixed function pipeline arrays (vertex array, normal arrays) into the generic ones. | |
void | computeNormals (bool verbose=false) |
Computes the normals in a "smooth" way, i.e. | |
bool | flipNormals () |
Inverts the orientation of the normals. | |
void | fixTriangleWinding () |
Converts all draw calls to triangles and fixes their winding according to the Geometry's normals. | |
void | transform (const mat4 &matr, bool normalize=true) |
Transforms vertices and normals belonging to this geometry. | |
void | convertDrawCallToDrawArrays () |
Converts all the DrawCall objects bound to a Geometry into DrawArrays. | |
DrawCall * | mergeTriangleStrips () |
Merges all the PT_TRIANGLE_STRIP DrawElementsUInt objects into one single PT_TRIANGLE_STRIP DrawElementsUInt. | |
void | mergeDrawCallsWithPrimitiveRestart (EPrimitiveType primitive_type) |
Merges all the draw calls that use the given primitive type into one single draw call using primitive restart. | |
void | mergeDrawCallsWithMultiDrawElements (EPrimitiveType primitive_type) |
Merges all the draw calls that use the given primitive type into one single MultiDrawElements draw call. | |
void | mergeDrawCallsWithTriangles (EPrimitiveType primitive_type) |
Merges all the draw calls that use the given primitive type or PT_TRIANGLES into one single PT_TRIANGLES draw call. | |
void | triangulateDrawCalls () |
Converts PT_QUADS, PT_QUADS_STRIP and PT_POLYGON into PT_TRIANGLE primitives. | |
DrawRangeElements *MultiDrawElements to the best fitting of *UInt UShort UByte taking into instancing and base vertex note Primitive type can be any *void | shrinkDrawCalls () |
void | makeGLESFriendly () |
Calls triangulateDrawCalls(), shrinkDrawCalls() and convertToVertexAttribs(). | |
bool | sortVertices () |
Sorts the vertices of the geometry (position, normals, textures, colors etc.) to maximize vertex-cache coherency. | |
void | regenerateVertices (const std::vector< u32 > &map_new_to_old) |
Regenerates the vertex position and attributes using the given new-to-old map. | |
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 | 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 |
Number of texture coordinate arrays currently present. | |
void | getTexCoordArrayAt (int i, int &out_tex_unit, const ArrayAbstract *&tex_array) const |
Gets the i-th texture coordinate information, where i must be 0 <= i < texCoordArrayCount(). | |
void | setVertexAttribArray (unsigned int attrib_location, ArrayAbstract *data, bool normalize=true, EVertexAttribInterpretation data_behav=VAI_NORMAL) |
void | setVertexAttribArray (const VertexAttribInfo &info) |
Binds a generic vertex attribute. | |
const VertexAttribInfo * | vertexAttribArray (unsigned int attrib_location) const |
Returns a generic vertex attribute's info. | |
VertexAttribInfo * | vertexAttribArray (unsigned int attrib_location) |
Returns a generic vertex attribute's info. | |
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 (u32 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. | |
Public Attributes | |
DrawRangeElements *MultiDrawElements to the best fitting of *UInt UShort UByte taking into | account: primitive restart |
Shrinks DrawElements. | |
Protected Member Functions | |
virtual void | computeBounds_Implementation () |
virtual void | render_Implementation (const Actor *actor, const Shader *shader, const Camera *camera, OpenGLContext *gl_context) const |
Protected Attributes | |
Collection< DrawCall > | mDrawCalls |
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.
Definition at line 67 of file Geometry.hpp.
Geometry::Geometry | ( | ) |
Constructor.
Definition at line 45 of file Geometry.cpp.
References mDrawCalls, mTexCoordArrays, mVertexAttribArrays, vl::Object::setAutomaticDelete(), and VL_DEBUG_SET_OBJECT_NAME.
Referenced by deepCopy(), and shallowCopy().
Geometry::~Geometry | ( | ) | [virtual] |
Destructor.
Definition at line 53 of file Geometry.cpp.
Performs a shallow copy of a Geometry.
Definition at line 140 of file Geometry.cpp.
References Geometry().
Performs a shallow copy of the specified Geometry.
Definition at line 147 of file Geometry.cpp.
References mColorArray, mDrawCalls, mFogCoordArray, mNormalArray, mSecondaryColorArray, mTexCoordArrays, mVertexArray, and mVertexAttribArrays.
Performs a deep copy of a Geometry.
Definition at line 98 of file Geometry.cpp.
References Geometry().
Performs a deep copy of the specified Geometry.
Definition at line 105 of file Geometry.cpp.
References vl::Collection< T >::clear(), vl::ref< T >::get(), mColorArray, mDrawCalls, mFogCoordArray, mNormalArray, mSecondaryColorArray, mTexCoordArrays, mVertexArray, mVertexAttribArrays, NULL, vl::Collection< T >::push_back(), vl::Collection< T >::resize(), and vl::Collection< T >::size().
Collection<DrawCall>* vl::Geometry::drawCalls | ( | ) | [inline] |
Returns the list of DrawCall objects bound to a Geometry.
Definition at line 114 of file Geometry.hpp.
Referenced by colorizePrimitives(), computeBounds_Implementation(), computeNormals(), convertDrawCallToDrawArrays(), deleteBufferObject(), vl::VLXClassWrapper_Geometry::exportGeometry(), vl::EdgeExtractor::extractEdges(), fixTriangleWinding(), vl::VLXClassWrapper_Geometry::importGeometry(), vl::RayIntersector::intersectGeometry(), vl::DaeLoader::load(), vl::STLLoader::loadAscii(), makeGLESFriendly(), mergeDrawCallsWithMultiDrawElements(), mergeDrawCallsWithPrimitiveRestart(), mergeDrawCallsWithTriangles(), mergeTriangleStrips(), vl::DepthSortCallback::onActorRenderStarted(), vl::DoubleVertexRemover::removeDoubles(), render_Implementation(), shrinkDrawCalls(), sortVertices(), vl::TriangleStripGenerator::stripfy(), triangulateDrawCalls(), vl::BezierSurface::updateBezierSurface(), and updateDirtyBufferObject().
const Collection<DrawCall>* vl::Geometry::drawCalls | ( | ) | const [inline] |
Returns the list of DrawCall objects bound to a Geometry.
Definition at line 117 of file Geometry.hpp.
void vl::Geometry::setColorArray | ( | const fvec4 & | color ) | [inline] |
Fills the color array with the given color.
Definition at line 120 of file Geometry.hpp.
References vl::ref< T >::get(), vl::VA_Color, vl::VA_Position, and VL_CHECK.
Referenced by colorizePrimitives(), convertToVertexAttribs(), vl::VLXClassWrapper_Geometry::importGeometry(), and regenerateVertices().
void Geometry::clearArrays | ( | bool | clear_draw_calls = true ) |
[virtual] |
Removes all the previously installed arrays.
Definition at line 259 of file Geometry.cpp.
References vl::Collection< T >::clear(), mColorArray, mDrawCalls, mFogCoordArray, mNormalArray, mSecondaryColorArray, mTexCoordArrays, mVertexArray, mVertexAttribArrays, NULL, and vl::Renderable::setBufferObjectDirty().
void Geometry::updateDirtyBufferObject | ( | EBufferObjectUpdateMode | mode ) | [virtual] |
Updates all the vertex buffer objects of both vertex arrays and draw calls that are marked as dirty.
Implements vl::Renderable.
Definition at line 457 of file Geometry.cpp.
References vl::Collection< T >::at(), vl::BUF_ForceUpdate, vl::VertexAttribInfo::data(), drawCalls(), vl::Has_BufferObject, vl::ArrayAbstract::isBufferObjectDirty(), mColorArray, mFogCoordArray, mNormalArray, mSecondaryColorArray, mTexCoordArrays, mVertexArray, vl::Collection< T >::size(), vl::ArrayAbstract::updateBufferObject(), vl::DrawCall::updateDirtyBufferObject(), and vertexAttribArrays().
void Geometry::deleteBufferObject | ( | ) | [virtual] |
Deletes all the vertex buffer objects of both vertex arrays and draw calls.
Implements vl::Renderable.
Definition at line 426 of file Geometry.cpp.
References vl::Collection< T >::at(), vl::ArrayAbstract::bufferObject(), vl::VertexAttribInfo::data(), vl::BufferObject::deleteBufferObject(), vl::DrawCall::deleteBufferObject(), drawCalls(), vl::Has_BufferObject, mColorArray, mFogCoordArray, mNormalArray, mSecondaryColorArray, mTexCoordArrays, mVertexArray, vl::Collection< T >::size(), and vertexAttribArrays().
void Geometry::convertToVertexAttribs | ( | ) |
Converts the fixed function pipeline arrays (vertex array, normal arrays) into the generic ones.
The generic attribute indices are allocated in the following way:
Definition at line 292 of file Geometry.cpp.
References vl::Collection< T >::clear(), colorArray(), fogCoordArray(), mTexCoordArrays, normalArray(), NULL, secondaryColorArray(), setColorArray(), setFogCoordArray(), setNormalArray(), setSecondaryColorArray(), setVertexArray(), setVertexAttribArray(), vl::Collection< T >::size(), vl::VA_Color, vl::VA_Normal, vl::VA_Position, vl::VA_TexCoord0, vertexArray(), vertexAttribArray(), and vl::Log::warning().
Referenced by makeGLESFriendly().
void Geometry::computeNormals | ( | bool | verbose = false ) |
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.
Definition at line 346 of file Geometry.cpp.
References vl::cross(), vl::VertexAttribInfo::data(), drawCalls(), vl::ref< T >::get(), vl::ArrayAbstract::getAsVec3(), vl::Vector3< T_Scalar >::length(), mDrawCalls, vl::Vector3< T_Scalar >::normalize(), NULL, setNormalArray(), setVertexAttribArray(), vl::Collection< T >::size(), vl::ArrayAbstract::size(), vl::VA_Normal, vl::VA_Position, vertexArray(), vertexAttribArray(), VL_CHECK, and vl::Log::warning().
Referenced by vl::DaeLoader::load().
bool Geometry::flipNormals | ( | ) |
Inverts the orientation of the normals.
Returns true
if the normals could be flipped. The function fails if the normals are defined in a format other than ArrayFloat3.
Definition at line 273 of file Geometry.cpp.
References vl::Object::as(), vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >::at(), vl::VertexAttribInfo::data(), normalArray(), NULL, vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >::size(), vl::VA_Normal, and vertexAttribArray().
void Geometry::fixTriangleWinding | ( | ) |
Converts all draw calls to triangles and fixes their winding according to the Geometry's normals.
Definition at line 802 of file Geometry.cpp.
References vl::Collection< T >::at(), vl::DrawCall::countTriangles(), vl::cross(), vl::VertexAttribInfo::data(), vl::dot(), drawCalls(), vl::Collection< T >::eraseAt(), vl::ArrayAbstract::getAsVec3(), vl::TriangleIterator::hasNext(), normalArray(), vl::normalize(), NULL, vl::DrawCall::primitiveType(), vl::PT_POLYGON, vl::PT_QUAD_STRIP, vl::PT_QUADS, vl::PT_TRIANGLE_FAN, vl::PT_TRIANGLE_STRIP, vl::PT_TRIANGLES, vl::Collection< T >::push_back(), vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >::resize(), vl::ArrayAbstract::size(), vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >::size(), vl::VA_Normal, vl::VA_Position, vertexArray(), vertexAttribArray(), and VL_CHECK.
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
Definition at line 511 of file Geometry.cpp.
References vl::Matrix4< T_Scalar >::as3x3(), vl::VertexAttribInfo::data(), vl::Matrix4< T_Scalar >::invert(), normalArray(), vl::ArrayAbstract::normalize(), NULL, vl::ArrayAbstract::transform(), vl::Matrix4< T_Scalar >::transpose(), vl::VA_Normal, vl::VA_Position, vertexArray(), and vertexAttribArray().
void Geometry::convertDrawCallToDrawArrays | ( | ) |
Converts all the DrawCall objects bound to a Geometry into DrawArrays.
Definition at line 911 of file Geometry.cpp.
References vl::VertexAttribInfo::data(), drawCalls(), vl::Collection< T >::erase(), vl::ref< T >::get(), NULL, vl::Collection< T >::push_back(), regenerateVertices(), vl::Collection< T >::size(), vl::ArrayAbstract::size(), vl::VA_Position, vertexArray(), and vertexAttribArray().
DrawCall * Geometry::mergeTriangleStrips | ( | ) |
Merges all the PT_TRIANGLE_STRIP DrawElementsUInt objects into one single PT_TRIANGLE_STRIP DrawElementsUInt.
Definition at line 557 of file Geometry.cpp.
References vl::Collection< T >::at(), vl::VertexAttribInfo::data(), drawCalls(), vl::Collection< T >::eraseAt(), vl::ref< T >::get(), vl::IndexIterator::hasNext(), vl::IndexIterator::index(), vl::IndexIterator::next(), NULL, vl::PT_TRIANGLE_STRIP, vl::Collection< T >::push_back(), vl::ArrayAbstract::size(), vl::VA_Position, vertexArray(), and vertexAttribArray().
Referenced by vl::DaeLoader::load(), and vl::TriangleStripGenerator::stripfy().
void Geometry::mergeDrawCallsWithPrimitiveRestart | ( | EPrimitiveType | primitive_type ) |
Merges all the draw calls that use the given primitive type into one single draw call using primitive restart.
Definition at line 627 of file Geometry.cpp.
References vl::Collection< T >::at(), vl::DrawCall::countIndices(), vl::VertexAttribInfo::data(), vl::Log::debug(), drawCalls(), vl::Collection< T >::eraseAt(), vl::ref< T >::get(), vl::IndexIterator::hasNext(), NULL, vl::DrawElements< ArrayUInt1 >::primitive_restart_index, vl::Collection< T >::push_back(), vl::VA_Position, vertexArray(), vertexAttribArray(), and VL_CHECK.
void Geometry::mergeDrawCallsWithMultiDrawElements | ( | EPrimitiveType | primitive_type ) |
Merges all the draw calls that use the given primitive type into one single MultiDrawElements draw call.
Definition at line 681 of file Geometry.cpp.
References vl::Collection< T >::at(), vl::DrawCall::countIndices(), vl::VertexAttribInfo::data(), vl::Log::debug(), drawCalls(), vl::Collection< T >::eraseAt(), vl::ref< T >::get(), vl::IndexIterator::hasNext(), NULL, vl::Collection< T >::push_back(), vl::VA_Position, vertexArray(), vertexAttribArray(), and VL_CHECK.
void Geometry::mergeDrawCallsWithTriangles | ( | EPrimitiveType | primitive_type ) |
Merges all the draw calls that use the given primitive type or PT_TRIANGLES into one single PT_TRIANGLES draw call.
Use primitive_type = PT_UNKNOWN to merge all primitive types (with the obvious exclusion of lines, points and adjacency ones).
Definition at line 732 of file Geometry.cpp.
References vl::Collection< T >::at(), vl::DrawCall::countTriangles(), vl::VertexAttribInfo::data(), drawCalls(), vl::Collection< T >::eraseAt(), vl::ref< T >::get(), vl::TriangleIterator::hasNext(), NULL, vl::DrawCall::primitiveType(), vl::PT_POLYGON, vl::PT_QUAD_STRIP, vl::PT_QUADS, vl::PT_TRIANGLE_FAN, vl::PT_TRIANGLE_STRIP, vl::PT_TRIANGLES, vl::PT_UNKNOWN, vl::Collection< T >::push_back(), vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >::resize(), vl::ArrayAbstract::size(), vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >::size(), vl::VA_Position, vertexArray(), vertexAttribArray(), and VL_CHECK.
Referenced by vl::DaeLoader::load().
void Geometry::triangulateDrawCalls | ( | ) |
Converts PT_QUADS, PT_QUADS_STRIP and PT_POLYGON into PT_TRIANGLE primitives.
Definition at line 935 of file Geometry.cpp.
References vl::Collection< T >::at(), vl::DrawCall::countTriangles(), drawCalls(), vl::TriangleIterator::hasNext(), vl::DrawCall::instances(), vl::DrawCall::primitiveType(), vl::PT_POLYGON, vl::PT_QUAD_STRIP, vl::PT_QUADS, vl::PT_TRIANGLES, vl::DrawCall::triangleIterator(), and VL_CHECK.
Referenced by makeGLESFriendly().
void Geometry::shrinkDrawCalls | ( | ) |
Definition at line 968 of file Geometry.cpp.
References vl::Collection< T >::at(), vl::DrawRangeElementsBase::baseVertex(), vl::DrawElementsBase::baseVertex(), vl::MultiDrawElementsBase::baseVertices(), vl::MultiDrawElementsBase::countVector(), vl::VertexAttribInfo::data(), drawCalls(), NULL, vl::DrawRangeElements< ArrayUShort1 >::primitive_restart_index, vl::DrawElements< ArrayUShort1 >::primitive_restart_index, vl::DrawRangeElements< ArrayUByte1 >::primitive_restart_index, vl::DrawElements< ArrayUByte1 >::primitive_restart_index, vl::DrawRangeElementsBase::rangeEnd(), vl::DrawRangeElementsBase::rangeStart(), vl::ArrayAbstract::size(), vl::VA_Position, vertexArray(), vertexAttribArray(), and VL_CHECK.
Referenced by makeGLESFriendly().
void Geometry::makeGLESFriendly | ( | ) |
Calls triangulateDrawCalls(), shrinkDrawCalls() and convertToVertexAttribs().
Definition at line 1159 of file Geometry.cpp.
References vl::Collection< T >::at(), convertToVertexAttribs(), drawCalls(), vl::Log::error(), vl::DrawCall::primitiveType(), vl::PT_LINE_STRIP_ADJACENCY, vl::PT_LINES_ADJACENCY, vl::PT_PATCHES, vl::PT_POLYGON, vl::PT_QUAD_STRIP, vl::PT_QUADS, vl::PT_TRIANGLE_STRIP_ADJACENCY, vl::PT_TRIANGLES_ADJACENCY, vl::DrawCall::setEnabled(), shrinkDrawCalls(), vl::Collection< T >::size(), triangulateDrawCalls(), and VL_TRAP.
Referenced by vl::BezierSurface::updateBezierSurface().
bool Geometry::sortVertices | ( | ) |
Sorts the vertices of the geometry (position, normals, textures, colors etc.) to maximize vertex-cache coherency.
This function will work only if all the DrawCalls are DrawElements* and will generate a new set of DrawElementsUInt. This function will fail if any of the DrawCalls is using primitive restart functionality.
Definition at line 1207 of file Geometry.cpp.
References vl::Object::as(), vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >::at(), vl::Collection< T >::at(), vl::DrawElementsBase::baseVertex(), vl::Collection< T >::clear(), vl::VertexAttribInfo::data(), drawCalls(), vl::Log::error(), vl::DrawElements< arr_type >::indexBuffer(), vl::DrawElementsBase::instances(), NULL, vl::DrawCall::primitiveRestartEnabled(), vl::DrawCall::primitiveType(), vl::Collection< T >::push_back(), regenerateVertices(), vl::ArrayAbstract::size(), vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >::size(), vl::Collection< T >::size(), vl::VA_Position, vertexArray(), vertexAttribArray(), and vl::Log::warning().
void Geometry::regenerateVertices | ( | const std::vector< u32 > & | map_new_to_old ) |
Regenerates the vertex position and attributes using the given new-to-old map.
Where 'map_new_to_old[i] == j' means that the i-th new vertex attribute should take it's value from the old j-th vertex attribute.
Definition at line 884 of file Geometry.cpp.
References vl::Collection< T >::at(), colorArray(), fogCoordArray(), vl::ref< T >::get(), normalArray(), vl::VertexMapper::regenerate(), secondaryColorArray(), setColorArray(), vl::VertexAttribInfo::setData(), setFogCoordArray(), setNormalArray(), setSecondaryColorArray(), setTexCoordArray(), setVertexArray(), vl::Collection< T >::size(), texCoordArray(), vertexArray(), vertexAttribArrays(), and VL_MAX_TEXTURE_UNITS.
Referenced by convertDrawCallToDrawArrays(), vl::DoubleVertexRemover::removeDoubles(), and sortVertices().
void Geometry::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.
Definition at line 1318 of file Geometry.cpp.
References vl::Vector4< T_Scalar >::a(), vl::Vector4< T_Scalar >::b(), vl::VertexAttribInfo::data(), drawCalls(), vl::Vector4< T_Scalar >::g(), vl::ref< T >::get(), NULL, vl::Vector4< T_Scalar >::r(), setColorArray(), setVertexAttribArray(), vl::Collection< T >::size(), vl::ArrayAbstract::size(), vl::VA_Color, vl::VA_Position, vertexArray(), and vertexAttribArray().
void Geometry::computeTangentSpace | ( | u32 | 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. |
Definition at line 1346 of file Geometry.cpp.
References vl::cross(), vl::dot(), vl::TriangleIterator::hasNext(), vl::normalize(), vl::DrawCall::triangleIterator(), VL_CHECK, vl::Vector2< T_Scalar >::x(), vl::Vector3< T_Scalar >::x(), vl::Vector2< T_Scalar >::y(), vl::Vector3< T_Scalar >::y(), and vl::Vector3< T_Scalar >::z().
void Geometry::setVertexArray | ( | ArrayAbstract * | data ) | [virtual] |
Conventional vertex array.
Implements vl::IVertexAttribSet.
Definition at line 165 of file Geometry.cpp.
References vl::ArrayAbstract::glSize(), mVertexArray, and VL_CHECK.
Referenced by convertToVertexAttribs(), vl::VLXClassWrapper_Geometry::importGeometry(), regenerateVertices(), and vl::BezierSurface::updateBezierSurface().
const ArrayAbstract* vl::Geometry::vertexArray | ( | ) | const [inline, virtual] |
Conventional vertex array.
Implements vl::IVertexAttribSet.
Definition at line 268 of file Geometry.hpp.
Referenced by colorizePrimitives(), computeBounds_Implementation(), computeNormals(), convertDrawCallToDrawArrays(), convertToVertexAttribs(), vl::VLXClassWrapper_Geometry::exportGeometry(), vl::EdgeExtractor::extractEdges(), fixTriangleWinding(), vl::RayIntersector::intersectGeometry(), mergeDrawCallsWithMultiDrawElements(), mergeDrawCallsWithPrimitiveRestart(), mergeDrawCallsWithTriangles(), mergeTriangleStrips(), vl::DepthSortCallback::onActorRenderStarted(), regenerateVertices(), vl::DoubleVertexRemover::removeDoubles(), shrinkDrawCalls(), sortVertices(), transform(), and vl::BezierSurface::updateBezierSurface().
ArrayAbstract* vl::Geometry::vertexArray | ( | ) | [inline, virtual] |
Conventional vertex array.
Implements vl::IVertexAttribSet.
Definition at line 270 of file Geometry.hpp.
void Geometry::setNormalArray | ( | ArrayAbstract * | data ) | [virtual] |
Conventional normal array.
Implements vl::IVertexAttribSet.
Definition at line 174 of file Geometry.cpp.
References vl::ArrayAbstract::glSize(), vl::ArrayAbstract::glType(), mNormalArray, and VL_CHECK.
Referenced by computeNormals(), convertToVertexAttribs(), vl::VLXClassWrapper_Geometry::importGeometry(), and regenerateVertices().
const ArrayAbstract* vl::Geometry::normalArray | ( | ) | const [inline, virtual] |
Conventional normal array.
Implements vl::IVertexAttribSet.
Definition at line 274 of file Geometry.hpp.
Referenced by convertToVertexAttribs(), vl::VLXClassWrapper_Geometry::exportGeometry(), fixTriangleWinding(), flipNormals(), vl::DaeLoader::load(), regenerateVertices(), and transform().
ArrayAbstract* vl::Geometry::normalArray | ( | ) | [inline, virtual] |
Conventional normal array.
Implements vl::IVertexAttribSet.
Definition at line 276 of file Geometry.hpp.
void Geometry::setColorArray | ( | ArrayAbstract * | data ) | [virtual] |
Conventional color array.
Implements vl::IVertexAttribSet.
Definition at line 188 of file Geometry.cpp.
References vl::ArrayAbstract::glSize(), vl::ArrayAbstract::glType(), mColorArray, and VL_CHECK.
const ArrayAbstract* vl::Geometry::colorArray | ( | ) | const [inline, virtual] |
Conventional color array.
Implements vl::IVertexAttribSet.
Definition at line 280 of file Geometry.hpp.
Referenced by convertToVertexAttribs(), vl::VLXClassWrapper_Geometry::exportGeometry(), and regenerateVertices().
ArrayAbstract* vl::Geometry::colorArray | ( | ) | [inline, virtual] |
Conventional color array.
Implements vl::IVertexAttribSet.
Definition at line 282 of file Geometry.hpp.
void Geometry::setSecondaryColorArray | ( | ArrayAbstract * | data ) | [virtual] |
Conventional secondary color array.
Implements vl::IVertexAttribSet.
Definition at line 205 of file Geometry.cpp.
References vl::ArrayAbstract::glSize(), vl::ArrayAbstract::glType(), mSecondaryColorArray, and VL_CHECK.
Referenced by convertToVertexAttribs(), vl::VLXClassWrapper_Geometry::importGeometry(), and regenerateVertices().
const ArrayAbstract* vl::Geometry::secondaryColorArray | ( | ) | const [inline, virtual] |
Conventional secondary color array.
Implements vl::IVertexAttribSet.
Definition at line 286 of file Geometry.hpp.
Referenced by convertToVertexAttribs(), vl::VLXClassWrapper_Geometry::exportGeometry(), and regenerateVertices().
ArrayAbstract* vl::Geometry::secondaryColorArray | ( | ) | [inline, virtual] |
Conventional secondary color array.
Implements vl::IVertexAttribSet.
Definition at line 288 of file Geometry.hpp.
void Geometry::setFogCoordArray | ( | ArrayAbstract * | data ) | [virtual] |
Conventional fog array.
Implements vl::IVertexAttribSet.
Definition at line 222 of file Geometry.cpp.
References vl::ArrayAbstract::glSize(), vl::ArrayAbstract::glType(), mFogCoordArray, and VL_CHECK.
Referenced by convertToVertexAttribs(), vl::VLXClassWrapper_Geometry::importGeometry(), and regenerateVertices().
const ArrayAbstract* vl::Geometry::fogCoordArray | ( | ) | const [inline, virtual] |
Conventional fog array.
Implements vl::IVertexAttribSet.
Definition at line 292 of file Geometry.hpp.
Referenced by convertToVertexAttribs(), vl::VLXClassWrapper_Geometry::exportGeometry(), and regenerateVertices().
ArrayAbstract* vl::Geometry::fogCoordArray | ( | ) | [inline, virtual] |
Conventional fog array.
Implements vl::IVertexAttribSet.
Definition at line 294 of file Geometry.hpp.
void Geometry::setTexCoordArray | ( | int | tex_unit, |
ArrayAbstract * | data | ||
) | [virtual] |
Conventional texture coords arrays.
Implements vl::IVertexAttribSet.
Definition at line 232 of file Geometry.cpp.
References vl::Collection< T >::at(), vl::Collection< T >::erase(), vl::ArrayAbstract::glSize(), vl::ArrayAbstract::glType(), mTexCoordArrays, vl::Collection< T >::push_back(), vl::Collection< T >::size(), VL_CHECK, and VL_MAX_TEXTURE_UNITS.
Referenced by vl::VLXClassWrapper_Geometry::importGeometry(), regenerateVertices(), and vl::BezierSurface::updateBezierSurface().
const ArrayAbstract* vl::Geometry::texCoordArray | ( | int | tex_unit ) | const [inline, virtual] |
Conventional texture coords arrays.
Implements vl::IVertexAttribSet.
Definition at line 298 of file Geometry.hpp.
References NULL.
Referenced by vl::VLXClassWrapper_Geometry::exportGeometry(), regenerateVertices(), and vl::BezierSurface::updateBezierSurface().
ArrayAbstract* vl::Geometry::texCoordArray | ( | int | tex_unit ) | [inline, virtual] |
Conventional texture coords arrays.
Implements vl::IVertexAttribSet.
Definition at line 306 of file Geometry.hpp.
References NULL.
int vl::Geometry::texCoordArrayCount | ( | ) | const [inline, virtual] |
Number of texture coordinate arrays currently present.
Implements vl::IVertexAttribSet.
Definition at line 314 of file Geometry.hpp.
void vl::Geometry::getTexCoordArrayAt | ( | int | i, |
int & | out_tex_unit, | ||
const ArrayAbstract *& | tex_array | ||
) | const [inline, virtual] |
Gets the i-th texture coordinate information, where i must be 0 <= i < texCoordArrayCount().
Implements vl::IVertexAttribSet.
Definition at line 316 of file Geometry.hpp.
References VL_CHECK.
void vl::Geometry::setVertexAttribArray | ( | unsigned int | attrib_location, |
ArrayAbstract * | data, | ||
bool | normalize = true , |
||
EVertexAttribInterpretation | data_behav = VAI_NORMAL |
||
) | [inline] |
Definition at line 323 of file Geometry.hpp.
References vl::normalize(), and setVertexAttribArray().
Referenced by colorizePrimitives(), computeNormals(), convertToVertexAttribs(), vl::VLXClassWrapper_Geometry::importGeometry(), and setVertexAttribArray().
void Geometry::setVertexAttribArray | ( | const VertexAttribInfo & | info ) | [virtual] |
Binds a generic vertex attribute.
Implements vl::IVertexAttribSet.
Definition at line 527 of file Geometry.cpp.
References vl::Collection< T >::at(), vl::VertexAttribInfo::attribLocation(), mVertexAttribArrays, vl::Collection< T >::push_back(), vl::Collection< T >::size(), vertexAttribArrays(), and VL_CHECK.
const VertexAttribInfo * Geometry::vertexAttribArray | ( | unsigned int | attrib_location ) | const [virtual] |
Returns a generic vertex attribute's info.
Implements vl::IVertexAttribSet.
Definition at line 541 of file Geometry.cpp.
References vl::Collection< T >::at(), vl::VertexAttribInfo::attribLocation(), NULL, vl::Collection< T >::size(), and vertexAttribArrays().
Referenced by colorizePrimitives(), computeBounds_Implementation(), computeNormals(), convertDrawCallToDrawArrays(), convertToVertexAttribs(), vl::VLXClassWrapper_Geometry::exportGeometry(), vl::EdgeExtractor::extractEdges(), fixTriangleWinding(), flipNormals(), vl::RayIntersector::intersectGeometry(), mergeDrawCallsWithMultiDrawElements(), mergeDrawCallsWithPrimitiveRestart(), mergeDrawCallsWithTriangles(), mergeTriangleStrips(), vl::DepthSortCallback::onActorRenderStarted(), vl::DoubleVertexRemover::removeDoubles(), shrinkDrawCalls(), sortVertices(), and transform().
VertexAttribInfo * Geometry::vertexAttribArray | ( | unsigned int | attrib_location ) | [virtual] |
Returns a generic vertex attribute's info.
Implements vl::IVertexAttribSet.
Definition at line 549 of file Geometry.cpp.
References vl::Collection< T >::at(), vl::VertexAttribInfo::attribLocation(), NULL, vl::Collection< T >::size(), and vertexAttribArrays().
Collection<VertexAttribInfo>* vl::Geometry::vertexAttribArrays | ( | ) | [inline, virtual] |
The list of VertexAttribInfo objects bound to a Geometry.
Implements vl::IVertexAttribSet.
Definition at line 331 of file Geometry.hpp.
Referenced by deleteBufferObject(), regenerateVertices(), setVertexAttribArray(), updateDirtyBufferObject(), and vertexAttribArray().
const Collection<VertexAttribInfo>* vl::Geometry::vertexAttribArrays | ( | ) | const [inline, virtual] |
The list of VertexAttribInfo objects bound to a Geometry.
Implements vl::IVertexAttribSet.
Definition at line 333 of file Geometry.hpp.
void Geometry::computeBounds_Implementation | ( | ) | [protected, virtual] |
Implements vl::Renderable.
Definition at line 57 of file Geometry.cpp.
References vl::Collection< T >::at(), vl::AABB::center(), vl::VertexAttribInfo::data(), vl::Log::debug(), drawCalls(), vl::ArrayAbstract::getAsVec3(), vl::IndexIterator::hasNext(), vl::DrawCall::indexIterator(), vl::Vector3< T_Scalar >::lengthSquared(), NULL, vl::Renderable::setBoundingBox(), vl::Renderable::setBoundingSphere(), vl::Collection< T >::size(), vl::ArrayAbstract::size(), vl::VA_Position, vertexArray(), and vertexAttribArray().
void Geometry::render_Implementation | ( | const Actor * | actor, |
const Shader * | shader, | ||
const Camera * | camera, | ||
OpenGLContext * | gl_context | ||
) | const [protected, virtual] |
Implements vl::Renderable.
Definition at line 493 of file Geometry.cpp.
References vl::Collection< T >::at(), vl::OpenGLContext::bindVAS(), drawCalls(), vl::Has_BufferObject, vl::Renderable::isBufferObjectEnabled(), vl::Renderable::isDisplayListEnabled(), vl::DrawCall::isEnabled(), vl::DrawCall::render(), vl::Collection< T >::size(), and VL_CHECK_OGL.
DrawRangeElements* MultiDrawElements to the best fitting of* UInt UShort UByte taking into vl::Geometry::account |
Shrinks DrawElements.
Definition at line 221 of file Geometry.hpp.
Collection<DrawCall> vl::Geometry::mDrawCalls [protected] |
Definition at line 341 of file Geometry.hpp.
Referenced by clearArrays(), computeNormals(), deepCopyFrom(), Geometry(), and shallowCopyFrom().
ref<ArrayAbstract> vl::Geometry::mVertexArray [protected] |
Definition at line 346 of file Geometry.hpp.
Referenced by clearArrays(), deepCopyFrom(), deleteBufferObject(), setVertexArray(), shallowCopyFrom(), and updateDirtyBufferObject().
ref<ArrayAbstract> vl::Geometry::mNormalArray [protected] |
Definition at line 347 of file Geometry.hpp.
Referenced by clearArrays(), deepCopyFrom(), deleteBufferObject(), setNormalArray(), shallowCopyFrom(), and updateDirtyBufferObject().
ref<ArrayAbstract> vl::Geometry::mColorArray [protected] |
Definition at line 348 of file Geometry.hpp.
Referenced by clearArrays(), deepCopyFrom(), deleteBufferObject(), setColorArray(), shallowCopyFrom(), and updateDirtyBufferObject().
ref<ArrayAbstract> vl::Geometry::mSecondaryColorArray [protected] |
Definition at line 349 of file Geometry.hpp.
Referenced by clearArrays(), deepCopyFrom(), deleteBufferObject(), setSecondaryColorArray(), shallowCopyFrom(), and updateDirtyBufferObject().
ref<ArrayAbstract> vl::Geometry::mFogCoordArray [protected] |
Definition at line 350 of file Geometry.hpp.
Referenced by clearArrays(), deepCopyFrom(), deleteBufferObject(), setFogCoordArray(), shallowCopyFrom(), and updateDirtyBufferObject().
Collection<TextureArray> vl::Geometry::mTexCoordArrays [protected] |
Definition at line 351 of file Geometry.hpp.
Referenced by clearArrays(), convertToVertexAttribs(), deepCopyFrom(), deleteBufferObject(), Geometry(), setTexCoordArray(), shallowCopyFrom(), and updateDirtyBufferObject().
Collection<VertexAttribInfo> vl::Geometry::mVertexAttribArrays [protected] |
Definition at line 353 of file Geometry.hpp.
Referenced by clearArrays(), deepCopyFrom(), Geometry(), setVertexAttribArray(), and shallowCopyFrom().