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]
Classes | Public Member Functions | Protected Attributes | List of all members
vl::DepthSortCallback Class Reference

DepthSortCallback sorts the primitives of the Geometry bound to the Actor in which the callback is installed. More...

#include <DepthSortCallback.hpp>

+ Inheritance diagram for vl::DepthSortCallback:

Public Member Functions

 DepthSortCallback ()
 Constructor. More...
 
void onActorDelete (Actor *)
 Event notifying that an Actor is being deleted. More...
 
virtual void onActorRenderStarted (Actor *actor, real, const Camera *cam, Renderable *renderable, const Shader *, int pass)
 Performs the actual sorting. More...
 
template<typename T , typename deT >
void sort (deT *polys, std::vector< Point< T > > &sorted_points, std::vector< Line< T > > &sorted_lines, std::vector< Triangle< T > > &sorted_triangles, std::vector< Quad< T > > &sorted_quads)
 
ESortMode sortMode () const
 
void setSortMode (ESortMode sort_mode)
 
void invalidateCache ()
 Forces sorting at the next rendering. More...
 
- Public Member Functions inherited from vl::ActorEventCallback
 ActorEventCallback ()
 
void setEnabled (bool enabled)
 
bool isEnabled () const
 
- 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 Attributes

std::vector< vec3mEyeSpaceVerts
 
std::vector< PrimitiveZ > mPrimitiveZ
 
std::vector< PointUInt > mSortedPointsUInt
 
std::vector< LineUInt > mSortedLinesUInt
 
std::vector< TriangleUInt > mSortedTrianglesUInt
 
std::vector< QuadUInt > mSortedQuadsUInt
 
std::vector< PointUShort > mSortedPointsUShort
 
std::vector< LineUShort > mSortedLinesUShort
 
std::vector< TriangleUShort > mSortedTrianglesUShort
 
std::vector< QuadUShort > mSortedQuadsUShort
 
std::vector< PointUByte > mSortedPointsUByte
 
std::vector< LineUByte > mSortedLinesUByte
 
std::vector< TriangleUByte > mSortedTrianglesUByte
 
std::vector< QuadUByte > mSortedQuadsUByte
 
vl::mat4 mCacheMatrix
 
ESortMode mSortMode
 
- Protected Attributes inherited from vl::ActorEventCallback
bool mEnabled
 
- Protected Attributes inherited from vl::Object
std::string mObjectName
 
IMutexmRefCountMutex
 
int mReferenceCount
 
bool mAutomaticDelete
 

Additional Inherited Members

- Protected Member Functions inherited from vl::Object
virtual ~Object ()
 

Detailed Description

DepthSortCallback sorts the primitives of the Geometry bound to the Actor in which the callback is installed.

In order to work properly DepthSortCallback requires the following:

Despite the fact that the condition list seems to be quite limiting it actually covers the most common usage cases. Furthermore the use of DrawElements* and the primitive types PT_POINTS, PT_LINES, PT_TRIANGLES, PT_QUADS grants the maximum flexibility.

Note
Remarks
See also
Transparency and Polygon Depth Sorting Tutorial

Definition at line 73 of file DepthSortCallback.hpp.

Constructor & Destructor Documentation

◆ DepthSortCallback()

vl::DepthSortCallback::DepthSortCallback ( )
inline

Constructor.

Definition at line 136 of file DepthSortCallback.hpp.

References setSortMode(), and vl::SM_SortBackToFront.

Member Function Documentation

◆ invalidateCache()

void vl::DepthSortCallback::invalidateCache ( )
inline

Forces sorting at the next rendering.

Definition at line 339 of file DepthSortCallback.hpp.

References mCacheMatrix.

◆ onActorDelete()

void vl::DepthSortCallback::onActorDelete ( Actor actor)
inlinevirtual

Event notifying that an Actor is being deleted.

Implements vl::ActorEventCallback.

Definition at line 142 of file DepthSortCallback.hpp.

◆ onActorRenderStarted()

virtual void vl::DepthSortCallback::onActorRenderStarted ( Actor actor,
real  ,
const Camera cam,
Renderable renderable,
const Shader ,
int  pass 
)
inlinevirtual

◆ setSortMode()

void vl::DepthSortCallback::setSortMode ( ESortMode  sort_mode)
inline

Definition at line 334 of file DepthSortCallback.hpp.

References mSortMode.

Referenced by DepthSortCallback().

◆ sort()

template<typename T , typename deT >
void vl::DepthSortCallback::sort ( deT *  polys,
std::vector< Point< T > > &  sorted_points,
std::vector< Line< T > > &  sorted_lines,
std::vector< Triangle< T > > &  sorted_triangles,
std::vector< Quad< T > > &  sorted_quads 
)
inline

◆ sortMode()

ESortMode vl::DepthSortCallback::sortMode ( ) const
inline

Member Data Documentation

◆ mCacheMatrix

vl::mat4 vl::DepthSortCallback::mCacheMatrix
protected

Definition at line 360 of file DepthSortCallback.hpp.

Referenced by invalidateCache(), and onActorRenderStarted().

◆ mEyeSpaceVerts

std::vector<vec3> vl::DepthSortCallback::mEyeSpaceVerts
protected

Definition at line 342 of file DepthSortCallback.hpp.

Referenced by onActorRenderStarted(), and sort().

◆ mPrimitiveZ

std::vector<PrimitiveZ> vl::DepthSortCallback::mPrimitiveZ
protected

Definition at line 343 of file DepthSortCallback.hpp.

Referenced by sort().

◆ mSortedLinesUByte

std::vector<LineUByte> vl::DepthSortCallback::mSortedLinesUByte
protected

Definition at line 356 of file DepthSortCallback.hpp.

Referenced by onActorRenderStarted().

◆ mSortedLinesUInt

std::vector<LineUInt> vl::DepthSortCallback::mSortedLinesUInt
protected

Definition at line 346 of file DepthSortCallback.hpp.

Referenced by onActorRenderStarted().

◆ mSortedLinesUShort

std::vector<LineUShort> vl::DepthSortCallback::mSortedLinesUShort
protected

Definition at line 351 of file DepthSortCallback.hpp.

Referenced by onActorRenderStarted().

◆ mSortedPointsUByte

std::vector<PointUByte> vl::DepthSortCallback::mSortedPointsUByte
protected

Definition at line 355 of file DepthSortCallback.hpp.

Referenced by onActorRenderStarted().

◆ mSortedPointsUInt

std::vector<PointUInt> vl::DepthSortCallback::mSortedPointsUInt
protected

Definition at line 345 of file DepthSortCallback.hpp.

Referenced by onActorRenderStarted().

◆ mSortedPointsUShort

std::vector<PointUShort> vl::DepthSortCallback::mSortedPointsUShort
protected

Definition at line 350 of file DepthSortCallback.hpp.

Referenced by onActorRenderStarted().

◆ mSortedQuadsUByte

std::vector<QuadUByte> vl::DepthSortCallback::mSortedQuadsUByte
protected

Definition at line 358 of file DepthSortCallback.hpp.

Referenced by onActorRenderStarted().

◆ mSortedQuadsUInt

std::vector<QuadUInt> vl::DepthSortCallback::mSortedQuadsUInt
protected

Definition at line 348 of file DepthSortCallback.hpp.

Referenced by onActorRenderStarted().

◆ mSortedQuadsUShort

std::vector<QuadUShort> vl::DepthSortCallback::mSortedQuadsUShort
protected

Definition at line 353 of file DepthSortCallback.hpp.

Referenced by onActorRenderStarted().

◆ mSortedTrianglesUByte

std::vector<TriangleUByte> vl::DepthSortCallback::mSortedTrianglesUByte
protected

Definition at line 357 of file DepthSortCallback.hpp.

Referenced by onActorRenderStarted().

◆ mSortedTrianglesUInt

std::vector<TriangleUInt> vl::DepthSortCallback::mSortedTrianglesUInt
protected

Definition at line 347 of file DepthSortCallback.hpp.

Referenced by onActorRenderStarted().

◆ mSortedTrianglesUShort

std::vector<TriangleUShort> vl::DepthSortCallback::mSortedTrianglesUShort
protected

Definition at line 352 of file DepthSortCallback.hpp.

Referenced by onActorRenderStarted().

◆ mSortMode

ESortMode vl::DepthSortCallback::mSortMode
protected

Definition at line 362 of file DepthSortCallback.hpp.

Referenced by setSortMode(), and sortMode().


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