Visualization Library 2.0.0

A lightweight C++ OpenGL middleware for 2D/3D graphics

VL     Star     Watch     Fork     Issue

[Download] [Tutorials] [All Classes] [Grouped Classes]
Public Member Functions | Protected Member Functions | List of all members
vl::Renderable Class Referenceabstract

An abstract class that represents all the objects that can be rendered. More...

#include <Renderable.hpp>

+ Inheritance diagram for vl::Renderable:

Public Member Functions

 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 AABBboundingBox () const
 Returns the bounding box of a Renderable without recomputing the bounds if dirty. More...
 
const SphereboundingSphere () const
 Returns the bounding sphere of a Renderable without recomputing the bounds if dirty. More...
 
const AABBboundingBox ()
 Returns the bounding box of a Renderable recomputing the bounds if dirty. More...
 
const SphereboundingSphere ()
 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...
 
virtual void updateDirtyBufferObject (EBufferObjectUpdateMode)=0
 Uploads the data stored in the local buffers on the GPU memory. More...
 
virtual void deleteBufferObject ()=0
 Destroys the BufferObject (vertex buffer objects) associated to this a Renderable. 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...
 
Objectoperator= (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...
 
IMutexrefCountMutex ()
 The mutex used to protect the reference counting of an Object across multiple threads. More...
 
const IMutexrefCountMutex () 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...
 

Protected Member Functions

virtual void computeBounds_Implementation ()=0
 
virtual void render_Implementation (const Actor *actor, const Shader *shader, const Camera *camera, OpenGLContext *gl_context) const =0
 
- Protected Member Functions inherited from vl::Object
virtual ~Object ()
 

Additional Inherited Members

- Protected Attributes inherited from vl::Object
std::string mObjectName
 
IMutexmRefCountMutex
 
int mReferenceCount
 
bool mAutomaticDelete
 

Detailed Description

An abstract class that represents all the objects that can be rendered.

In order to render a Renderable you have to bind it to an Actor. An Actor glues together a Renderable, an Effect and eventually a Transform. Note that the same Renderable can be associated to more than one Actor.

See also
Actor, Effect, Shader, Transform, Geometry

Definition at line 58 of file Renderable.hpp.

Constructor & Destructor Documentation

◆ Renderable()

vl::Renderable::Renderable ( )
inline

Constructor.

Definition at line 69 of file Renderable.hpp.

◆ ~Renderable()

virtual vl::Renderable::~Renderable ( )
inlinevirtual

Destructor.

Definition at line 73 of file Renderable.hpp.

Member Function Documentation

◆ boundingBox() [1/2]

const AABB& vl::Renderable::boundingBox ( ) const
inline

◆ boundingBox() [2/2]

const AABB& vl::Renderable::boundingBox ( )
inline

Returns the bounding box of a Renderable recomputing the bounds if dirty.

Definition at line 167 of file Renderable.hpp.

◆ boundingSphere() [1/2]

const Sphere& vl::Renderable::boundingSphere ( ) const
inline

Returns the bounding sphere of a Renderable without recomputing the bounds if dirty.

Definition at line 159 of file Renderable.hpp.

References vl::Log::warning().

Referenced by vlX::VLXClassWrapper_Renderable::exportRenderable().

◆ boundingSphere() [2/2]

const Sphere& vl::Renderable::boundingSphere ( )
inline

Returns the bounding sphere of a Renderable recomputing the bounds if dirty.

Definition at line 175 of file Renderable.hpp.

◆ boundsDirty()

bool vl::Renderable::boundsDirty ( ) const
inline

Returns whether the bounding sphere or bounding box are "dirty", that is, meant to be recomputed.

Definition at line 126 of file Renderable.hpp.

Referenced by vl::Actor::boundsDirty(), vl::Actor::computeBounds(), and vlX::VLXClassWrapper_Renderable::exportRenderable().

◆ boundsUpdateTick()

long long vl::Renderable::boundsUpdateTick ( ) const
inline

Returns the bounds-update-tick which is a counter incremented every time the bounding box or bounding sphere is updated.

Definition at line 120 of file Renderable.hpp.

Referenced by vl::Actor::boundsDirty(), and vl::Actor::computeBounds().

◆ computeBounds()

void vl::Renderable::computeBounds ( )
inline

Recomputes the bounding box and bounding sphere of a Renderable.

Definition at line 117 of file Renderable.hpp.

◆ computeBounds_Implementation()

virtual void vl::Renderable::computeBounds_Implementation ( )
protectedpure virtual

◆ deleteBufferObject()

virtual void vl::Renderable::deleteBufferObject ( )
pure virtual

Destroys the BufferObject (vertex buffer objects) associated to this a Renderable.

Note
This function does not touch the local (non GPU) data stored in the buffers associated to the vertex attributes and DrawCall.

Implemented in vl::DrawPixels, vl::CoreText, vl::Text, vl::Geometry, and vl::Clear.

◆ deleteDisplayList()

void vl::Renderable::deleteDisplayList ( )
inline

Deletes the display list currently associated to a Renderable.

Definition at line 221 of file Renderable.hpp.

◆ displayList()

unsigned int vl::Renderable::displayList ( ) const
inline

Returns the display list associated to a Renderable or 0 (zero) if no display list is associated.

Definition at line 183 of file Renderable.hpp.

◆ displayListDirty()

bool vl::Renderable::displayListDirty ( ) const
inline

Whether the display list associated to a Renderable should be recompiled at the next rendering.

Definition at line 195 of file Renderable.hpp.

◆ isBufferObjectDirty()

bool vl::Renderable::isBufferObjectDirty ( ) const
inline

Whether BufferObjects associated to a Renderable should be recomputed on the next rendering.

Definition at line 207 of file Renderable.hpp.

◆ isBufferObjectEnabled()

bool vl::Renderable::isBufferObjectEnabled ( ) const
inline

Returns true if BufferObject (vertex buffer object) are enabled for a Renderable (enabled by default).

Definition at line 201 of file Renderable.hpp.

Referenced by vlX::VLXClassWrapper_Renderable::exportRenderable(), and vl::Geometry::render_Implementation().

◆ isDisplayListEnabled()

bool vl::Renderable::isDisplayListEnabled ( ) const
inline

Returns true if display lists are enabled for a Renderable (disabled by default).

Definition at line 189 of file Renderable.hpp.

Referenced by vlX::VLXClassWrapper_Renderable::exportRenderable(), and vl::Geometry::render_Implementation().

◆ render()

void vl::Renderable::render ( const Actor actor,
const Shader shader,
const Camera camera,
OpenGLContext gl_context 
)
inline

Renders the Renderable and if necessary compiles the display list and updates the BufferObjects.

Definition at line 76 of file Renderable.hpp.

References vl::BUM_KeepRamBuffer, VL_CHECK, and VL_CHECK_OGL.

Referenced by vl::Renderer::renderRaw(), and vl::EdgeRenderer::renderSolids().

◆ render_Implementation()

virtual void vl::Renderable::render_Implementation ( const Actor actor,
const Shader shader,
const Camera camera,
OpenGLContext gl_context 
) const
protectedpure virtual

◆ setBoundingBox()

void vl::Renderable::setBoundingBox ( const AABB aabb)
inline

◆ setBoundingSphere()

void vl::Renderable::setBoundingSphere ( const Sphere sphere)
inline

◆ setBoundsDirty()

void vl::Renderable::setBoundsDirty ( bool  dirty)
inline

Marks the bounding box and bounding sphere as dirty in order to be recomputed at the next rendering.

Definition at line 123 of file Renderable.hpp.

Referenced by vl::TrackballManipulator::adjustView(), and vl::Terrain::init().

◆ setBufferObjectDirty()

void vl::Renderable::setBufferObjectDirty ( bool  dirty = true)
inline

Whether BufferObjects associated to a Renderable should be recomputed on the next rendering.

Definition at line 210 of file Renderable.hpp.

Referenced by vl::Geometry::clearArrays(), and vl::DepthSortCallback::onActorRenderStarted().

◆ setBufferObjectEnabled()

void vl::Renderable::setBufferObjectEnabled ( bool  enabled)
inline

Enable/disable BufferObject (vertex buffer object) (enabled by default).

Definition at line 204 of file Renderable.hpp.

Referenced by vl::EdgeExtractor::generateEdgeGeometry(), vlX::VLXClassWrapper_Renderable::importRenderable(), and vl::VolumePlot::setupLabels().

◆ setDisplayList()

void vl::Renderable::setDisplayList ( unsigned int  disp_list)
inline

Manually assciates a display list to a Renderable (to be used with care).

Definition at line 186 of file Renderable.hpp.

◆ setDisplayListDirty()

void vl::Renderable::setDisplayListDirty ( bool  dirty)
inline

Whether the display list associated to a Renderable should be recompiled at the next rendering.

Definition at line 198 of file Renderable.hpp.

Referenced by vl::DepthSortCallback::onActorRenderStarted().

◆ setDisplayListEnabled()

void vl::Renderable::setDisplayListEnabled ( bool  enabled)
inline

Enable/disable display lists (disabled by default).

Definition at line 192 of file Renderable.hpp.

Referenced by vlX::VLXClassWrapper_Renderable::importRenderable(), and vl::VolumePlot::setupLabels().

◆ updateDirtyBufferObject()

virtual void vl::Renderable::updateDirtyBufferObject ( EBufferObjectUpdateMode  )
pure 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.

Implemented in vl::DrawPixels, vl::CoreText, vl::Text, vl::Geometry, and vl::Clear.


The documentation for this class was generated from the following file: