Visualization Library 2.0.0
A 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>
Public Member Functions | |
Geometry () | |
Constructor. More... | |
virtual | ~Geometry () |
Destructor. More... | |
ref< Geometry > | shallowCopy () const |
Performs a shallow copy of a Geometry. More... | |
Geometry & | shallowCopyFrom (const Geometry &) |
Performs a shallow copy of the specified Geometry. More... | |
ref< Geometry > | deepCopy () const |
Performs a deep copy of a Geometry. More... | |
Geometry & | deepCopyFrom (const Geometry &) |
Performs a deep copy of the specified Geometry. More... | |
Collection< DrawCall > & | drawCalls () |
Returns the list of DrawCall objects bound to a Geometry. More... | |
const Collection< DrawCall > & | drawCalls () const |
Returns the list of DrawCall objects bound to a Geometry. More... | |
void | setColorArray (const fvec4 &color) |
Fills the color array with the given color. More... | |
virtual void | clearArrays (bool clear_draw_calls=true) |
Removes all the previously installed arrays. More... | |
virtual void | updateDirtyBufferObject (EBufferObjectUpdateMode mode) |
Updates all the vertex buffer objects of both vertex arrays and draw calls that are marked as dirty. More... | |
virtual void | deleteBufferObject () |
Deletes all the vertex buffer objects of both vertex arrays and draw calls. More... | |
void | computeNormals (bool verbose=false) |
Computes the normals in a "smooth" way, i.e. More... | |
bool | flipNormals () |
Inverts the orientation of the normals. More... | |
void | fixTriangleWinding () |
Converts all draw calls to triangles and fixes their winding according to the Geometry's normals. More... | |
void | transform (const mat4 &matr, bool normalize=true) |
Transforms vertices and normals belonging to this geometry. More... | |
void | convertDrawCallToDrawArrays () |
Converts all the DrawCall objects bound to a Geometry into DrawArrays. More... | |
DrawCall * | mergeTriangleStrips () |
Merges all the PT_TRIANGLE_STRIP DrawElementsUInt objects into one single PT_TRIANGLE_STRIP DrawElementsUInt. More... | |
void | mergeDrawCallsWithPrimitiveRestart (EPrimitiveType primitive_type) |
Merges all the draw calls that use the given primitive type into one single draw call using primitive restart. More... | |
void | mergeDrawCallsWithMultiDrawElements (EPrimitiveType primitive_type) |
Merges all the draw calls that use the given primitive type into one single MultiDrawElements draw call. More... | |
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. More... | |
void | triangulateDrawCalls () |
Converts PT_QUADS, PT_QUADS_STRIP and PT_POLYGON into PT_TRIANGLE primitives. More... | |
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() and shrinkDrawCalls(). More... | |
bool | sortVertices () |
Sorts the vertices of the geometry (position, normals, textures, colors etc.) to maximize vertex-cache coherency. More... | |
void | regenerateVertices (const std::vector< u32 > &map_new_to_old) |
Regenerates the vertex position and attributes using the given new-to-old map. More... | |
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. More... | |
void | setVertexArray (ArrayAbstract *data) |
Conventional vertex array. More... | |
const ArrayAbstract * | vertexArray () const |
Conventional vertex array. More... | |
ArrayAbstract * | vertexArray () |
Conventional vertex array. More... | |
void | setNormalArray (ArrayAbstract *data) |
Conventional normal array. More... | |
const ArrayAbstract * | normalArray () const |
Conventional normal array. More... | |
ArrayAbstract * | normalArray () |
Conventional normal array. More... | |
void | setColorArray (ArrayAbstract *data) |
Conventional color array. More... | |
const ArrayAbstract * | colorArray () const |
Conventional color array. More... | |
ArrayAbstract * | colorArray () |
Conventional color array. More... | |
void | setSecondaryColorArray (ArrayAbstract *data) |
Conventional secondary color array. More... | |
const ArrayAbstract * | secondaryColorArray () const |
Conventional secondary color array. More... | |
ArrayAbstract * | secondaryColorArray () |
Conventional secondary color array. More... | |
void | setFogCoordArray (ArrayAbstract *data) |
Conventional fog array. More... | |
const ArrayAbstract * | fogCoordArray () const |
Conventional fog array. More... | |
ArrayAbstract * | fogCoordArray () |
Conventional fog array. More... | |
void | setTexCoordArray (int tex_unit, ArrayAbstract *data) |
Conventional texture coords arrays. More... | |
const ArrayAbstract * | texCoordArray (int tex_unit) const |
Conventional texture coords arrays. More... | |
ArrayAbstract * | texCoordArray (int tex_unit) |
Conventional texture coords arrays. More... | |
void | setVertexAttribArray (int attrib_location, const ArrayAbstract *info) |
Binds a generic vertex attribute. More... | |
const ArrayAbstract * | vertexAttribArray (int attrib_location) const |
Returns a generic vertex attribute's info. More... | |
ArrayAbstract * | vertexAttribArray (int attrib_location) |
Returns a generic vertex attribute's info. More... | |
Public Member Functions inherited from vl::Renderable | |
Renderable () | |
Constructor. More... | |
virtual | ~Renderable () |
Destructor. More... | |
void | render (const Actor *actor, const Shader *shader, const Camera *camera, OpenGLContext *gl_context) |
Renders the Renderable and if necessary compiles the display list and updates the BufferObjects. More... | |
void | computeBounds () |
Recomputes the bounding box and bounding sphere of a Renderable. More... | |
long long | boundsUpdateTick () const |
Returns the bounds-update-tick which is a counter incremented every time the bounding box or bounding sphere is updated. More... | |
void | setBoundsDirty (bool dirty) |
Marks the bounding box and bounding sphere as dirty in order to be recomputed at the next rendering. More... | |
bool | boundsDirty () const |
Returns whether the bounding sphere or bounding box are "dirty", that is, meant to be recomputed. More... | |
void | setBoundingBox (const AABB &aabb) |
Sets the bounding box of a Renderable. More... | |
void | setBoundingSphere (const Sphere &sphere) |
Sets the bounding sphere of a Renderable. More... | |
const AABB & | boundingBox () const |
Returns the bounding box of a Renderable without recomputing the bounds if dirty. More... | |
const Sphere & | boundingSphere () const |
Returns the bounding sphere of a Renderable without recomputing the bounds if dirty. More... | |
const AABB & | boundingBox () |
Returns the bounding box of a Renderable recomputing the bounds if dirty. More... | |
const Sphere & | boundingSphere () |
Returns the bounding sphere of a Renderable recomputing the bounds if dirty. More... | |
unsigned int | displayList () const |
Returns the display list associated to a Renderable or 0 (zero) if no display list is associated. More... | |
void | setDisplayList (unsigned int disp_list) |
Manually assciates a display list to a Renderable (to be used with care). More... | |
bool | isDisplayListEnabled () const |
Returns true if display lists are enabled for a Renderable (disabled by default). More... | |
void | setDisplayListEnabled (bool enabled) |
Enable/disable display lists (disabled by default). More... | |
bool | displayListDirty () const |
Whether the display list associated to a Renderable should be recompiled at the next rendering. More... | |
void | setDisplayListDirty (bool dirty) |
Whether the display list associated to a Renderable should be recompiled at the next rendering. More... | |
bool | isBufferObjectEnabled () const |
Returns true if BufferObject (vertex buffer object) are enabled for a Renderable (enabled by default). More... | |
void | setBufferObjectEnabled (bool enabled) |
Enable/disable BufferObject (vertex buffer object) (enabled by default). More... | |
bool | isBufferObjectDirty () const |
Whether BufferObjects associated to a Renderable should be recomputed on the next rendering. More... | |
void | setBufferObjectDirty (bool dirty=true) |
Whether BufferObjects associated to a Renderable should be recomputed on the next rendering. More... | |
void | deleteDisplayList () |
Deletes the display list currently associated to a Renderable. More... | |
Public Member Functions inherited from vl::Object | |
Object () | |
Constructor. More... | |
Object (const Object &other) | |
Copy constructor: copies the name, ref count mutex and user data. More... | |
Object & | operator= (const Object &other) |
Copy operator: copies the object's name, ref count mutex and user data. More... | |
const std::string & | objectName () const |
The name of the object, by default set to the object's class name. More... | |
void | setObjectName (const char *name) |
The name of the object, by default set to the object's class name in debug builds. More... | |
void | setObjectName (const std::string &name) |
The name of the object, by default set to the object's class name in debug builds. More... | |
void | setRefCountMutex (IMutex *mutex) |
The mutex used to protect the reference counting of an Object across multiple threads. More... | |
IMutex * | refCountMutex () |
The mutex used to protect the reference counting of an Object across multiple threads. More... | |
const IMutex * | refCountMutex () const |
The mutex used to protect the reference counting of an Object across multiple threads. More... | |
int | referenceCount () const |
Returns the number of references of an object. More... | |
void | incReference () const |
Increments the reference count of an object. More... | |
void | decReference () |
Decrements the reference count of an object and deletes it if both automaticDelete() is true the count reaches 0. More... | |
void | setAutomaticDelete (bool autodel_on) |
If set to true the Object is deleted when its reference count reaches 0. More... | |
bool | automaticDelete () const |
If set to true the Object is deleted when its reference count reaches 0. More... | |
template<class T > | |
T * | as () |
Casts an Object to the specified class. More... | |
template<class T > | |
const T * | as () const |
Casts an Object to the specified class. More... | |
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. More... | |
Public Attributes | |
DrawRangeElements *MultiDrawElements *to the best fitting of *UInt UShort UByte *taking into | account: primitive restart |
Shrinks DrawElements. More... | |
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 Member Functions inherited from vl::Object | |
virtual | ~Object () |
Protected Attributes | |
Collection< DrawCall > | mDrawCalls |
ref< ArrayAbstract > | mVertexAttribArrays [VA_MaxAttribCount] |
Protected Attributes inherited from vl::Object | |
std::string | mObjectName |
IMutex * | mRefCountMutex |
int | mReferenceCount |
bool | mAutomaticDelete |
The Geometry class is a Renderable that implements a polygonal mesh made of polygons, lines and points.
Definition at line 66 of file Geometry.hpp.
Geometry::Geometry | ( | ) |
Constructor.
Definition at line 45 of file Geometry.cpp.
References mDrawCalls.
Referenced by deepCopy(), and shallowCopy().
|
virtual |
Destructor.
Definition at line 51 of file Geometry.cpp.
|
virtual |
Removes all the previously installed arrays.
Definition at line 237 of file Geometry.cpp.
References mDrawCalls, mVertexAttribArrays, NULL, vl::Renderable::setBufferObjectDirty(), and vl::VA_MaxAttribCount.
|
inlinevirtual |
Conventional color array.
Implements vl::IVertexAttribSet.
Definition at line 260 of file Geometry.hpp.
References vl::VA_Color.
Referenced by vlX::VLXClassWrapper_Geometry::exportGeometry().
|
inlinevirtual |
Conventional color array.
Implements vl::IVertexAttribSet.
Definition at line 262 of file Geometry.hpp.
References vl::VA_Color.
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 1168 of file Geometry.cpp.
References vl::Vector4< T_Scalar >::a(), vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >::at(), vl::Vector4< T_Scalar >::b(), drawCalls(), vl::Vector4< T_Scalar >::g(), vl::ref< T >::get(), vl::Vector4< T_Scalar >::r(), vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >::resize(), setColorArray(), vl::ArrayAbstract::size(), and vertexArray().
|
protectedvirtual |
Implements vl::Renderable.
Definition at line 55 of file Geometry.cpp.
References vl::AABB::center(), vl::Log::debug(), drawCalls(), vl::ArrayAbstract::getAsVec3(), vl::Vector3< T_Scalar >::lengthSquared(), NULL, vl::Renderable::setBoundingBox(), vl::Renderable::setBoundingSphere(), vl::ArrayAbstract::size(), and vertexArray().
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 269 of file Geometry.cpp.
References vl::cross(), drawCalls(), vl::ref< T >::get(), vl::ArrayAbstract::getAsVec3(), vl::Vector3< T_Scalar >::length(), mDrawCalls, vl::Vector3< T_Scalar >::normalize(), vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >::resize(), setNormalArray(), vl::ArrayAbstract::size(), vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >::size(), vertexArray(), VL_CHECK, and vl::Log::warning().
Referenced by vl::Extrusion::extrude(), vl::Extrusions::extrude(), vl::DaeLoader::load(), vl::loadMD2(), vl::MarchingCubes::run(), and vl::Tessellator::tessellateGeometry().
|
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 1193 of file Geometry.cpp.
References vl::cross(), vl::dot(), vl::TriangleIterator::hasNext(), vl::normalize(), vl::DrawCall::triangleIterator(), VL_CHECK, vl::Vector3< T_Scalar >::x(), vl::Vector2< T_Scalar >::x(), vl::Vector3< T_Scalar >::y(), vl::Vector2< T_Scalar >::y(), and vl::Vector3< T_Scalar >::z().
void Geometry::convertDrawCallToDrawArrays | ( | ) |
Converts all the DrawCall objects bound to a Geometry into DrawArrays.
Definition at line 766 of file Geometry.cpp.
References drawCalls(), vl::ref< T >::get(), regenerateVertices(), vl::ArrayAbstract::size(), and vertexArray().
Referenced by vl::Extrusion::extrude(), and vl::Extrusions::extrude().
Performs a deep copy of a Geometry.
Definition at line 96 of file Geometry.cpp.
References deepCopyFrom(), and Geometry().
Performs a deep copy of the specified Geometry.
Definition at line 103 of file Geometry.cpp.
References mDrawCalls, mVertexAttribArrays, NULL, and vl::VA_MaxAttribCount.
Referenced by deepCopy().
|
virtual |
Deletes all the vertex buffer objects of both vertex arrays and draw calls.
Implements vl::Renderable.
Definition at line 346 of file Geometry.cpp.
References drawCalls(), vl::Has_BufferObject, mVertexAttribArrays, and vl::VA_MaxAttribCount.
|
inline |
Returns the list of DrawCall objects bound to a Geometry.
Definition at line 102 of file Geometry.hpp.
Referenced by colorizePrimitives(), computeBounds_Implementation(), computeNormals(), convertDrawCallToDrawArrays(), deleteBufferObject(), vl::VectorGraphics::drawLineLoop(), vl::VectorGraphics::drawLines(), vl::VectorGraphics::drawLineStrip(), vl::VectorGraphics::drawPoints(), vlX::VLXClassWrapper_Geometry::exportGeometry(), vl::AdjacencyExtractor::extract(), vl::EdgeExtractor::extractEdges(), vl::Extrusion::extrude(), vl::Extrusions::extrude(), vl::VectorGraphics::fillPolygon(), vl::VectorGraphics::fillQuad(), vl::VectorGraphics::fillQuads(), vl::VectorGraphics::fillQuadStrip(), vl::VectorGraphics::fillTriangleFan(), vl::VectorGraphics::fillTriangles(), vl::VectorGraphics::fillTriangleStrip(), fixTriangleWinding(), vl::EdgeExtractor::generateEdgeGeometry(), vl::Molecule::generateRings(), vlX::VLXClassWrapper_Geometry::importGeometry(), vl::RayIntersector::intersectGeometry(), vl::DaeLoader::load(), vl::load3DS(), vl::loadAC3D(), vl::STLLoader::loadAscii(), vl::STLLoader::loadBinary(), vl::loadMD2(), vl::ObjLoader::loadOBJ(), vl::PlyLoader::loadPly(), vl::makeBox(), vl::makeCapsule(), vl::makeCircle(), vl::makeCone(), vl::makeCylinder(), makeGLESFriendly(), vl::makeGrid(), vl::makeIcosahedron(), vl::makeIcosphere(), vl::makePoints(), vl::makePyramid(), makeScales(), vl::makeTorus(), vl::makeUVSphere(), mergeDrawCallsWithMultiDrawElements(), mergeDrawCallsWithPrimitiveRestart(), mergeDrawCallsWithTriangles(), mergeTriangleStrips(), vl::DepthSortCallback::onActorRenderStarted(), vl::DoubleVertexRemover::removeDoubles(), render_Implementation(), vl::SceneManagerPortals::renderPortal(), vl::MarchingCubes::run(), shrinkDrawCalls(), sortVertices(), vl::TriangleStripGenerator::stripfy(), vl::Tessellator::tessellateGeometry(), triangulateDrawCalls(), updateDirtyBufferObject(), and vl::Molecule::wireframeStyle().
|
inline |
Returns the list of DrawCall objects bound to a Geometry.
Definition at line 105 of file Geometry.hpp.
void Geometry::fixTriangleWinding | ( | ) |
Converts all draw calls to triangles and fixes their winding according to the Geometry's normals.
Definition at line 675 of file Geometry.cpp.
References vl::DrawCall::countTriangles(), vl::cross(), vl::dot(), drawCalls(), vl::ArrayAbstract::getAsVec3(), 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::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(), vertexArray(), and VL_CHECK.
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 250 of file Geometry.cpp.
References vl::Object::as(), vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >::at(), normalArray(), and vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >::size().
|
inlinevirtual |
Conventional fog array.
Implements vl::IVertexAttribSet.
Definition at line 272 of file Geometry.hpp.
References vl::VA_FogCoord.
Referenced by vlX::VLXClassWrapper_Geometry::exportGeometry().
|
inlinevirtual |
Conventional fog array.
Implements vl::IVertexAttribSet.
Definition at line 274 of file Geometry.hpp.
References vl::VA_FogCoord.
void Geometry::makeGLESFriendly | ( | ) |
Calls triangulateDrawCalls() and shrinkDrawCalls().
Definition at line 1014 of file Geometry.cpp.
References 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(), triangulateDrawCalls(), and VL_TRAP.
Referenced by vl::makeBox(), vl::makeCapsule(), vl::makeCircle(), vl::makeCone(), vl::makeCylinder(), vl::makeGrid(), vl::makeIcosahedron(), vl::makeIcosphere(), vl::makePoints(), vl::makePyramid(), vl::makeTeapot(), vl::makeTorus(), and vl::makeUVSphere().
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 554 of file Geometry.cpp.
References vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >::begin(), vl::Log::debug(), drawCalls(), vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >::end(), vl::ref< T >::get(), vl::MultiDrawElements< arr_type >::indexBuffer(), vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >::resize(), vl::MultiDrawElementsBase::setCountVector(), and VL_CHECK.
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 500 of file Geometry.cpp.
References vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >::begin(), vl::Log::debug(), drawCalls(), vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >::end(), vl::ref< T >::get(), vl::DrawElements< arr_type >::indexBuffer(), vl::DrawElements< ArrayUInt1 >::primitive_restart_index, vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >::resize(), vl::DrawElementsBase::setPrimitiveRestartEnabled(), 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 605 of file Geometry.cpp.
References vl::DrawCall::countTriangles(), drawCalls(), vl::ref< T >::get(), vl::DrawElements< arr_type >::indexBuffer(), 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::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >::resize(), vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >::size(), and VL_CHECK.
Referenced by vl::DaeLoader::load().
DrawCall * Geometry::mergeTriangleStrips | ( | ) |
Merges all the PT_TRIANGLE_STRIP DrawElementsUInt objects into one single PT_TRIANGLE_STRIP DrawElementsUInt.
Definition at line 430 of file Geometry.cpp.
References drawCalls(), vl::ref< T >::get(), vl::IndexIterator::index(), vl::DrawElements< arr_type >::indexBuffer(), vl::IndexIterator::next(), NULL, vl::DrawCall::primitiveType(), vl::PT_TRIANGLE_STRIP, vl::ArrayAbstract::ptr(), vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >::resize(), vl::ArrayAbstract::size(), and vertexArray().
Referenced by vl::DaeLoader::load(), and vl::TriangleStripGenerator::stripfy().
|
inlinevirtual |
Conventional normal array.
Implements vl::IVertexAttribSet.
Definition at line 254 of file Geometry.hpp.
References vl::VA_Normal.
Referenced by vlX::VLXClassWrapper_Geometry::exportGeometry(), vl::AdjacencyExtractor::extract(), fixTriangleWinding(), flipNormals(), vl::DaeLoader::load(), vl::loadMD2(), vl::MarchingCubes::run(), and transform().
|
inlinevirtual |
Conventional normal array.
Implements vl::IVertexAttribSet.
Definition at line 256 of file Geometry.hpp.
References vl::VA_Normal.
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 757 of file Geometry.cpp.
References vl::VertexMapper::regenerate(), setVertexAttribArray(), vl::VA_MaxAttribCount, and vertexAttribArray().
Referenced by convertDrawCallToDrawArrays(), vl::DoubleVertexRemover::removeDoubles(), and sortVertices().
|
protectedvirtual |
Implements vl::Renderable.
Definition at line 379 of file Geometry.cpp.
References vl::OpenGLContext::bindVAS(), drawCalls(), vl::Has_BufferObject, vl::Renderable::isBufferObjectEnabled(), vl::Renderable::isDisplayListEnabled(), and VL_CHECK_OGL.
|
inlinevirtual |
Conventional secondary color array.
Implements vl::IVertexAttribSet.
Definition at line 266 of file Geometry.hpp.
References vl::VA_SecondaryColor.
Referenced by vlX::VLXClassWrapper_Geometry::exportGeometry().
|
inlinevirtual |
Conventional secondary color array.
Implements vl::IVertexAttribSet.
Definition at line 268 of file Geometry.hpp.
References vl::VA_SecondaryColor.
|
inline |
Fills the color array with the given color.
Definition at line 108 of file Geometry.hpp.
References vl::ref< T >::get(), vl::normalize(), and VL_CHECK.
Referenced by colorizePrimitives(), vl::Extrusions::extrude(), vl::Extrusion::extrude(), vl::Molecule::generateRings(), vlX::VLXClassWrapper_Geometry::importGeometry(), vl::Terrain::init(), vl::PlyLoader::loadPly(), vl::makeCapsule(), vl::makePoints(), and vl::Molecule::wireframeStyle().
|
virtual |
Conventional color array.
Implements vl::IVertexAttribSet.
Definition at line 178 of file Geometry.cpp.
References vl::ArrayAbstract::glSize(), vl::ArrayAbstract::glType(), mVertexAttribArrays, vl::VA_Color, and VL_CHECK.
|
virtual |
Conventional fog array.
Implements vl::IVertexAttribSet.
Definition at line 212 of file Geometry.cpp.
References vl::ArrayAbstract::glSize(), vl::ArrayAbstract::glType(), mVertexAttribArrays, vl::VA_FogCoord, and VL_CHECK.
Referenced by vlX::VLXClassWrapper_Geometry::importGeometry().
|
virtual |
Conventional normal array.
Implements vl::IVertexAttribSet.
Definition at line 164 of file Geometry.cpp.
References vl::ArrayAbstract::glSize(), vl::ArrayAbstract::glType(), mVertexAttribArrays, vl::VA_Normal, and VL_CHECK.
Referenced by computeNormals(), vlX::VLXClassWrapper_Geometry::importGeometry(), vl::STLLoader::loadBinary(), vl::loadMD2(), vl::ObjLoader::loadOBJ(), vl::PlyLoader::loadPly(), vl::makeIcosphere(), vl::makeTorus(), and vl::DaeLoader::setupLights().
|
virtual |
Conventional secondary color array.
Implements vl::IVertexAttribSet.
Definition at line 195 of file Geometry.cpp.
References vl::ArrayAbstract::glSize(), vl::ArrayAbstract::glType(), mVertexAttribArrays, vl::VA_SecondaryColor, and VL_CHECK.
Referenced by vlX::VLXClassWrapper_Geometry::importGeometry().
|
virtual |
Conventional texture coords arrays.
Implements vl::IVertexAttribSet.
Definition at line 222 of file Geometry.cpp.
References vl::ArrayAbstract::glSize(), vl::ArrayAbstract::glType(), mVertexAttribArrays, vl::VA_MaxTexCoordCount, vl::VA_TexCoord0, and VL_CHECK.
Referenced by vl::VectorGraphics::drawLines(), vlX::VLXClassWrapper_Geometry::importGeometry(), vl::Terrain::init(), vl::load3DS(), vl::loadAC3D(), vl::loadMD2(), vl::ObjLoader::loadOBJ(), vl::makeBox(), vl::makeGrid(), vl::makeTorus(), and vl::VectorGraphics::popScissor().
|
virtual |
Conventional vertex array.
Implements vl::IVertexAttribSet.
Definition at line 155 of file Geometry.cpp.
References vl::ArrayAbstract::glSize(), mVertexAttribArrays, vl::VA_Position, and VL_CHECK.
Referenced by vl::VectorGraphics::drawPoints(), vl::Extrusion::extrude(), vl::Extrusions::extrude(), vl::EdgeExtractor::generateEdgeGeometry(), vl::Molecule::generateRings(), vlX::VLXClassWrapper_Geometry::importGeometry(), vl::load3DS(), vl::loadAC3D(), vl::STLLoader::loadBinary(), vl::loadMD2(), vl::ObjLoader::loadOBJ(), vl::PlyLoader::loadPly(), vl::makeBox(), vl::makeCapsule(), vl::makeCircle(), vl::makeCone(), vl::makeCylinder(), vl::makeGrid(), vl::makeIcosahedron(), vl::makeIcosphere(), vl::makePoints(), vl::makePyramid(), makeScales(), vl::makeTorus(), vl::makeUVSphere(), vl::VectorGraphics::popScissor(), vl::SceneManagerPortals::renderPortal(), vl::MarchingCubes::run(), vl::Tessellator::tessellateGeometry(), and vl::Molecule::wireframeStyle().
|
virtual |
Binds a generic vertex attribute.
Implements vl::IVertexAttribSet.
Definition at line 415 of file Geometry.cpp.
References mVertexAttribArrays.
Referenced by vl::Extrusions::extrude(), and regenerateVertices().
Performs a shallow copy of a Geometry.
Definition at line 127 of file Geometry.cpp.
References Geometry(), and shallowCopyFrom().
Performs a shallow copy of the specified Geometry.
Definition at line 134 of file Geometry.cpp.
References mDrawCalls, mVertexAttribArrays, NULL, and vl::VA_MaxAttribCount.
Referenced by shallowCopy().
void Geometry::shrinkDrawCalls | ( | ) |
Definition at line 823 of file Geometry.cpp.
References vl::Object::as(), vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >::at(), vl::DrawElementsBase::baseVertex(), vl::DrawRangeElementsBase::baseVertex(), vl::MultiDrawElementsBase::baseVertices(), vl::MultiDrawElementsBase::countVector(), drawCalls(), vl::IndexIterator::hasNext(), vl::MultiDrawElements< arr_type >::indexBuffer(), vl::DrawElements< arr_type >::indexBuffer(), vl::DrawRangeElements< arr_type >::indexBuffer(), vl::DrawCall::indexIterator(), vl::DrawCall::instances(), vl::DrawElements< ArrayUShort1 >::primitive_restart_index, vl::DrawElements< ArrayUByte1 >::primitive_restart_index, vl::DrawRangeElements< ArrayUShort1 >::primitive_restart_index, vl::DrawRangeElements< ArrayUByte1 >::primitive_restart_index, vl::DrawCall::primitiveRestartEnabled(), vl::DrawCall::primitiveRestartIndex(), vl::DrawCall::primitiveType(), vl::DrawRangeElementsBase::rangeEnd(), vl::DrawRangeElementsBase::rangeStart(), vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >::resize(), vl::DrawElementsBase::setBaseVertex(), vl::DrawRangeElementsBase::setBaseVertex(), vl::MultiDrawElementsBase::setBaseVertices(), vl::MultiDrawElementsBase::setCountVector(), vl::MultiDrawElementsBase::setPrimitiveRestartEnabled(), vl::DrawElementsBase::setPrimitiveRestartEnabled(), vl::DrawRangeElementsBase::setPrimitiveRestartEnabled(), vl::DrawRangeElementsBase::setRangeEnd(), vl::DrawRangeElementsBase::setRangeStart(), vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >::size(), and VL_CHECK.
Referenced by makeGLESFriendly().
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 1057 of file Geometry.cpp.
References vl::Object::as(), vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >::at(), vl::DrawElementsBase::baseVertex(), drawCalls(), vl::Log::error(), vl::DrawElements< arr_type >::indexBuffer(), vl::DrawElementsBase::instances(), vl::DrawCall::primitiveRestartEnabled(), vl::DrawCall::primitiveType(), regenerateVertices(), 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(), vertexArray(), and vl::Log::warning().
|
inlinevirtual |
Conventional texture coords arrays.
Implements vl::IVertexAttribSet.
Definition at line 278 of file Geometry.hpp.
References vl::VA_TexCoord0.
Referenced by vlX::VLXClassWrapper_Geometry::exportGeometry(), and vl::loadMD2().
|
inlinevirtual |
Conventional texture coords arrays.
Implements vl::IVertexAttribSet.
Definition at line 280 of file Geometry.hpp.
References vl::VA_TexCoord0.
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 399 of file Geometry.cpp.
References vl::Matrix4< T_Scalar >::as3x3(), vl::Matrix4< T_Scalar >::invert(), normalArray(), vl::ArrayAbstract::normalize(), vl::ArrayAbstract::transform(), vl::Matrix4< T_Scalar >::transpose(), and vertexArray().
Referenced by vl::loadAC3D(), vl::makeTeapot(), and vl::DaeLoader::setupLights().
void Geometry::triangulateDrawCalls | ( | ) |
Converts PT_QUADS, PT_QUADS_STRIP and PT_POLYGON into PT_TRIANGLE primitives.
Definition at line 790 of file Geometry.cpp.
References vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >::begin(), vl::DrawCall::countTriangles(), drawCalls(), vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >::end(), vl::TriangleIterator::hasNext(), vl::DrawElements< arr_type >::indexBuffer(), vl::DrawCall::instances(), vl::DrawCall::primitiveType(), vl::PT_POLYGON, vl::PT_QUAD_STRIP, vl::PT_QUADS, vl::PT_TRIANGLES, vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >::resize(), vl::DrawCall::triangleIterator(), and VL_CHECK.
Referenced by makeGLESFriendly().
|
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 362 of file Geometry.cpp.
References vl::BUF_ForceUpdate, drawCalls(), vl::Has_BufferObject, mVertexAttribArrays, and vl::VA_MaxAttribCount.
|
inlinevirtual |
Conventional vertex array.
Implements vl::IVertexAttribSet.
Definition at line 248 of file Geometry.hpp.
References vl::VA_Position.
Referenced by colorizePrimitives(), computeBounds_Implementation(), computeNormals(), convertDrawCallToDrawArrays(), vl::VectorGraphics::drawLines(), vlX::VLXClassWrapper_Geometry::exportGeometry(), vl::AdjacencyExtractor::extract(), vl::EdgeExtractor::extractEdges(), vl::Extrusion::extrude(), vl::Extrusions::extrude(), vl::VectorGraphics::fillPolygon(), fixTriangleWinding(), vl::Terrain::init(), vl::RayIntersector::intersectGeometry(), vl::loadMD2(), vl::makeUVSphere(), mergeTriangleStrips(), vl::DepthSortCallback::onActorRenderStarted(), vl::VectorGraphics::popScissor(), vl::DoubleVertexRemover::removeDoubles(), sortVertices(), and transform().
|
inlinevirtual |
Conventional vertex array.
Implements vl::IVertexAttribSet.
Definition at line 250 of file Geometry.hpp.
References vl::VA_Position.
|
virtual |
Returns a generic vertex attribute's info.
Implements vl::IVertexAttribSet.
Definition at line 420 of file Geometry.cpp.
References mVertexAttribArrays.
Referenced by regenerateVertices().
|
virtual |
Returns a generic vertex attribute's info.
Implements vl::IVertexAttribSet.
Definition at line 425 of file Geometry.cpp.
References mVertexAttribArrays.
DrawRangeElements* MultiDrawElements* to the best fitting of* UInt UShort UByte* taking into vl::Geometry::account |
Shrinks DrawElements.
Definition at line 201 of file Geometry.hpp.
|
protected |
Definition at line 294 of file Geometry.hpp.
Referenced by clearArrays(), computeNormals(), deepCopyFrom(), Geometry(), and shallowCopyFrom().
|
protected |
Definition at line 297 of file Geometry.hpp.
Referenced by clearArrays(), deepCopyFrom(), deleteBufferObject(), setColorArray(), setFogCoordArray(), setNormalArray(), setSecondaryColorArray(), setTexCoordArray(), setVertexArray(), setVertexAttribArray(), shallowCopyFrom(), updateDirtyBufferObject(), and vertexAttribArray().
Visualization Library 2.0.0 Reference Documentation
Updated on Wed Dec 23 2020 12:44:08.
© Copyright Michele Bosi. All rights reserved.