Visualization Library 2.0.0
A lightweight C++ OpenGL middleware for 2D/3D graphics
|
[Download] [Tutorials] [All Classes] [Grouped Classes] |
The MorphingCallback class implements a simple morphing animation mechanism using the GPU acceleration where available. More...
#include <MorphingCallback.hpp>
Public Member Functions | |
MorphingCallback () | |
~MorphingCallback () | |
virtual void | onActorRenderStarted (Actor *actor, real frame_clock, const Camera *cam, Renderable *renderable, const Shader *, int pass) |
Event generated just before an Actor is rendered but after the render states are ready and setup. More... | |
virtual void | onActorDelete (Actor *) |
Event notifying that an Actor is being deleted. More... | |
void | bindActor (Actor *actor) |
void | init (ResourceDatabase *res_db) |
Initializes a MorphingCallback from a ResourceDatabase. More... | |
void | blendFrames (int a, int b, float t) |
void | setAnimation (int start, int end, float period) |
void | startAnimation (real time=-1) |
void | stopAnimation () |
void | initFrom (MorphingCallback *morph_cb) |
void | resetGLSLBindings () |
bool | glslVertexBlendEnabled () const |
void | setGLSLVertexBlendEnabled (bool enable) |
Geometry * | geometry () |
const Geometry * | geometry () const |
bool | animationStarted () const |
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... | |
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... | |
Protected Attributes | |
ref< Geometry > | mGeometry |
ref< ArrayFloat3 > | mVertices |
ref< ArrayFloat3 > | mNormals |
std::vector< ref< ArrayFloat3 > > | mVertexFrames |
std::vector< ref< ArrayFloat3 > > | mNormalFrames |
real | mLastUpdate |
real | mElapsedTime |
real | mAnimationStartTime |
int | mAnimationStart |
int | mAnimationEnd |
float | mAnimationPeriod |
bool | mAnimationStarted |
int | mFrame1 |
int | mFrame2 |
bool | mGLSLVertexBlendEnabled |
int | mVertex2_Binding |
int | mNormal2_Binding |
int | mAnim_t_Binding |
float | mAnim_t |
Protected Attributes inherited from vl::ActorEventCallback | |
bool | mEnabled |
Protected Attributes inherited from vl::Object | |
std::string | mObjectName |
IMutex * | mRefCountMutex |
int | mReferenceCount |
bool | mAutomaticDelete |
Additional Inherited Members | |
Protected Member Functions inherited from vl::Object | |
virtual | ~Object () |
The MorphingCallback class implements a simple morphing animation mechanism using the GPU acceleration where available.
Definition at line 44 of file MorphingCallback.hpp.
MorphingCallback::MorphingCallback | ( | ) |
Definition at line 41 of file MorphingCallback.cpp.
References mAnim_t, mFrame1, mFrame2, mGeometry, mLastUpdate, resetGLSLBindings(), setAnimation(), and setGLSLVertexBlendEnabled().
MorphingCallback::~MorphingCallback | ( | ) |
Definition at line 56 of file MorphingCallback.cpp.
|
inline |
Definition at line 89 of file MorphingCallback.hpp.
void MorphingCallback::bindActor | ( | Actor * | actor | ) |
Definition at line 168 of file MorphingCallback.cpp.
References vl::Actor::actorEventCallbacks(), mGeometry, and vl::Actor::setLod().
void MorphingCallback::blendFrames | ( | int | a, |
int | b, | ||
float | t | ||
) |
Definition at line 230 of file MorphingCallback.cpp.
References vl::BU_DYNAMIC_DRAW, vl::Has_BufferObject, mGeometry, mNormalFrames, mNormals, mVertexFrames, and mVertices.
Referenced by onActorRenderStarted().
|
inline |
Definition at line 86 of file MorphingCallback.hpp.
Referenced by init().
|
inline |
Definition at line 87 of file MorphingCallback.hpp.
|
inline |
Definition at line 83 of file MorphingCallback.hpp.
Referenced by onActorRenderStarted().
void MorphingCallback::init | ( | ResourceDatabase * | res_db | ) |
Initializes a MorphingCallback from a ResourceDatabase.
The given ResourceDatabase must contain a Geometry with all the desired DrawCalls and vertex attributes setup with the exception of the vertex position array and vertex normal array since they are automatically generated in realtime time during the rendering from the vertex and normal frames specified below. In addition ResourceDatabase must contain:
Definition at line 174 of file MorphingCallback.cpp.
References vl::ResourceDatabase::count(), vl::Log::error(), geometry(), vl::ResourceDatabase::get(), mGeometry, mNormalFrames, mNormals, mVertexFrames, mVertices, NULL, and vl::Object::objectName().
void MorphingCallback::initFrom | ( | MorphingCallback * | morph_cb | ) |
Definition at line 289 of file MorphingCallback.cpp.
References mGeometry, mNormalFrames, mNormals, mVertexFrames, mVertices, NULL, and setAnimation().
|
inlinevirtual |
Event notifying that an Actor is being deleted.
Implements vl::ActorEventCallback.
Definition at line 55 of file MorphingCallback.hpp.
|
virtual |
Event generated just before an Actor is rendered but after the render states are ready and setup.
Reimplement to react to this event.
actor | The Actor bound to this rendering callback. |
frame_clock | The current rendering frame time, usually used for animation purposes. |
cam | The camera used for the current rendering. |
renderable | The currently selected Actor LOD. |
shader | The currently active Shader. |
pass | The current Actor[s] rendering pass. |
Implements vl::ActorEventCallback.
Definition at line 60 of file MorphingCallback.cpp.
References blendFrames(), vl::BUM_KeepRamBuffer, vl::GLSLProgram::getAttribLocation(), vl::GLSLProgram::getUniformLocation(), vl::Shader::glslProgram(), glslVertexBlendEnabled(), mAnim_t, mAnim_t_Binding, mAnimationEnd, mAnimationPeriod, mAnimationStart, mAnimationStarted, mAnimationStartTime, mElapsedTime, mFrame1, mFrame2, mGeometry, mLastUpdate, mNormal2_Binding, mNormalFrames, mNormals, mVertex2_Binding, mVertexFrames, mVertices, NULL, and VL_CHECK.
void MorphingCallback::resetGLSLBindings | ( | ) |
Definition at line 322 of file MorphingCallback.cpp.
References mAnim_t_Binding, mNormal2_Binding, and mVertex2_Binding.
Referenced by MorphingCallback().
void MorphingCallback::setAnimation | ( | int | start, |
int | end, | ||
float | period | ||
) |
Definition at line 261 of file MorphingCallback.cpp.
References mAnimationEnd, mAnimationPeriod, mAnimationStart, mAnimationStarted, mAnimationStartTime, mElapsedTime, mFrame1, mFrame2, and mLastUpdate.
Referenced by initFrom(), and MorphingCallback().
|
inline |
Definition at line 84 of file MorphingCallback.hpp.
Referenced by MorphingCallback().
void MorphingCallback::startAnimation | ( | real | time = -1 | ) |
Definition at line 274 of file MorphingCallback.cpp.
References mAnimationStarted, mAnimationStartTime, mElapsedTime, mFrame1, mFrame2, and mLastUpdate.
void MorphingCallback::stopAnimation | ( | ) |
Definition at line 284 of file MorphingCallback.cpp.
References mAnimationStarted.
|
protected |
Definition at line 112 of file MorphingCallback.hpp.
Referenced by MorphingCallback(), and onActorRenderStarted().
|
protected |
Definition at line 111 of file MorphingCallback.hpp.
Referenced by onActorRenderStarted(), and resetGLSLBindings().
|
protected |
Definition at line 102 of file MorphingCallback.hpp.
Referenced by onActorRenderStarted(), and setAnimation().
|
protected |
Definition at line 103 of file MorphingCallback.hpp.
Referenced by onActorRenderStarted(), and setAnimation().
|
protected |
Definition at line 101 of file MorphingCallback.hpp.
Referenced by onActorRenderStarted(), and setAnimation().
|
protected |
Definition at line 104 of file MorphingCallback.hpp.
Referenced by onActorRenderStarted(), setAnimation(), startAnimation(), and stopAnimation().
|
protected |
Definition at line 100 of file MorphingCallback.hpp.
Referenced by onActorRenderStarted(), setAnimation(), and startAnimation().
|
protected |
Definition at line 99 of file MorphingCallback.hpp.
Referenced by onActorRenderStarted(), setAnimation(), and startAnimation().
|
protected |
Definition at line 105 of file MorphingCallback.hpp.
Referenced by MorphingCallback(), onActorRenderStarted(), setAnimation(), and startAnimation().
|
protected |
Definition at line 106 of file MorphingCallback.hpp.
Referenced by MorphingCallback(), onActorRenderStarted(), setAnimation(), and startAnimation().
Definition at line 92 of file MorphingCallback.hpp.
Referenced by bindActor(), blendFrames(), init(), initFrom(), MorphingCallback(), and onActorRenderStarted().
|
protected |
Definition at line 108 of file MorphingCallback.hpp.
|
protected |
Definition at line 98 of file MorphingCallback.hpp.
Referenced by MorphingCallback(), onActorRenderStarted(), setAnimation(), and startAnimation().
|
protected |
Definition at line 110 of file MorphingCallback.hpp.
Referenced by onActorRenderStarted(), and resetGLSLBindings().
|
protected |
Definition at line 96 of file MorphingCallback.hpp.
Referenced by blendFrames(), init(), initFrom(), and onActorRenderStarted().
|
protected |
Definition at line 94 of file MorphingCallback.hpp.
Referenced by blendFrames(), init(), initFrom(), and onActorRenderStarted().
|
protected |
Definition at line 109 of file MorphingCallback.hpp.
Referenced by onActorRenderStarted(), and resetGLSLBindings().
|
protected |
Definition at line 95 of file MorphingCallback.hpp.
Referenced by blendFrames(), init(), initFrom(), and onActorRenderStarted().
|
protected |
Definition at line 93 of file MorphingCallback.hpp.
Referenced by blendFrames(), init(), initFrom(), and onActorRenderStarted().
Visualization Library 2.0.0 Reference Documentation
Updated on Wed Dec 23 2020 12:44:09.
© Copyright Michele Bosi. All rights reserved.