Visualization Library v1.0.3A 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>
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(), setGLSLVertexBlendEnabled(), and VL_DEBUG_SET_OBJECT_NAME.
MorphingCallback::~MorphingCallback | ( | ) |
Definition at line 56 of file MorphingCallback.cpp.
void MorphingCallback::onActorRenderStarted | ( | Actor * | actor, |
real | frame_clock, | ||
const Camera * | cam, | ||
Renderable * | renderable, | ||
const Shader * | shader, | ||
int | pass | ||
) | [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::ref< T >::get(), 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.
virtual void vl::MorphingCallback::onActorDelete | ( | Actor * | actor ) | [inline, virtual] |
Event notifying that an Actor is being deleted.
Implements vl::ActorEventCallback.
Definition at line 55 of file MorphingCallback.hpp.
void MorphingCallback::bindActor | ( | Actor * | actor ) |
Definition at line 168 of file MorphingCallback.cpp.
References vl::Actor::actorEventCallbacks(), vl::ref< T >::get(), mGeometry, vl::Collection< T >::push_back(), and vl::Actor::setLod().
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::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().
void MorphingCallback::setAnimation | ( | int | start, |
int | end, | ||
float | period | ||
) |
Definition at line 264 of file MorphingCallback.cpp.
References mAnimationEnd, mAnimationPeriod, mAnimationStart, mAnimationStarted, mAnimationStartTime, mElapsedTime, mFrame1, mFrame2, and mLastUpdate.
Referenced by initFrom(), and MorphingCallback().
void MorphingCallback::startAnimation | ( | real | time = -1 ) |
Definition at line 277 of file MorphingCallback.cpp.
References mAnimationStarted, mAnimationStartTime, mElapsedTime, mFrame1, mFrame2, and mLastUpdate.
void MorphingCallback::stopAnimation | ( | ) |
Definition at line 287 of file MorphingCallback.cpp.
References mAnimationStarted.
void MorphingCallback::initFrom | ( | MorphingCallback * | morph_cb ) |
Definition at line 292 of file MorphingCallback.cpp.
References mGeometry, mNormalFrames, mNormals, mVertexFrames, mVertices, NULL, and setAnimation().
void MorphingCallback::resetGLSLBindings | ( | ) |
Definition at line 325 of file MorphingCallback.cpp.
References mAnim_t_Binding, mNormal2_Binding, and mVertex2_Binding.
Referenced by MorphingCallback().
bool vl::MorphingCallback::glslVertexBlendEnabled | ( | ) | const [inline] |
Definition at line 83 of file MorphingCallback.hpp.
Referenced by onActorRenderStarted().
void vl::MorphingCallback::setGLSLVertexBlendEnabled | ( | bool | enable ) | [inline] |
Definition at line 84 of file MorphingCallback.hpp.
Referenced by MorphingCallback().
Geometry* vl::MorphingCallback::geometry | ( | ) | [inline] |
Definition at line 86 of file MorphingCallback.hpp.
Referenced by init().
const Geometry* vl::MorphingCallback::geometry | ( | ) | const [inline] |
Definition at line 87 of file MorphingCallback.hpp.
bool vl::MorphingCallback::animationStarted | ( | ) | const [inline] |
Definition at line 89 of file MorphingCallback.hpp.
ref<Geometry> vl::MorphingCallback::mGeometry [protected] |
Definition at line 92 of file MorphingCallback.hpp.
Referenced by bindActor(), blendFrames(), init(), initFrom(), MorphingCallback(), and onActorRenderStarted().
ref<ArrayFloat3> vl::MorphingCallback::mVertices [protected] |
Definition at line 93 of file MorphingCallback.hpp.
Referenced by blendFrames(), init(), initFrom(), and onActorRenderStarted().
ref<ArrayFloat3> vl::MorphingCallback::mNormals [protected] |
Definition at line 94 of file MorphingCallback.hpp.
Referenced by blendFrames(), init(), initFrom(), and onActorRenderStarted().
std::vector< ref<ArrayFloat3> > vl::MorphingCallback::mVertexFrames [protected] |
Definition at line 95 of file MorphingCallback.hpp.
Referenced by blendFrames(), init(), initFrom(), and onActorRenderStarted().
std::vector< ref<ArrayFloat3> > vl::MorphingCallback::mNormalFrames [protected] |
Definition at line 96 of file MorphingCallback.hpp.
Referenced by blendFrames(), init(), initFrom(), and onActorRenderStarted().
real vl::MorphingCallback::mLastUpdate [protected] |
Definition at line 98 of file MorphingCallback.hpp.
Referenced by MorphingCallback(), onActorRenderStarted(), setAnimation(), and startAnimation().
real vl::MorphingCallback::mElapsedTime [protected] |
Definition at line 99 of file MorphingCallback.hpp.
Referenced by onActorRenderStarted(), setAnimation(), and startAnimation().
real vl::MorphingCallback::mAnimationStartTime [protected] |
Definition at line 100 of file MorphingCallback.hpp.
Referenced by onActorRenderStarted(), setAnimation(), and startAnimation().
int vl::MorphingCallback::mAnimationStart [protected] |
Definition at line 101 of file MorphingCallback.hpp.
Referenced by onActorRenderStarted(), and setAnimation().
int vl::MorphingCallback::mAnimationEnd [protected] |
Definition at line 102 of file MorphingCallback.hpp.
Referenced by onActorRenderStarted(), and setAnimation().
float vl::MorphingCallback::mAnimationPeriod [protected] |
Definition at line 103 of file MorphingCallback.hpp.
Referenced by onActorRenderStarted(), and setAnimation().
bool vl::MorphingCallback::mAnimationStarted [protected] |
Definition at line 104 of file MorphingCallback.hpp.
Referenced by onActorRenderStarted(), setAnimation(), startAnimation(), and stopAnimation().
int vl::MorphingCallback::mFrame1 [protected] |
Definition at line 105 of file MorphingCallback.hpp.
Referenced by MorphingCallback(), onActorRenderStarted(), setAnimation(), and startAnimation().
int vl::MorphingCallback::mFrame2 [protected] |
Definition at line 106 of file MorphingCallback.hpp.
Referenced by MorphingCallback(), onActorRenderStarted(), setAnimation(), and startAnimation().
bool vl::MorphingCallback::mGLSLVertexBlendEnabled [protected] |
Definition at line 108 of file MorphingCallback.hpp.
int vl::MorphingCallback::mVertex2_Binding [protected] |
Definition at line 109 of file MorphingCallback.hpp.
Referenced by onActorRenderStarted(), and resetGLSLBindings().
int vl::MorphingCallback::mNormal2_Binding [protected] |
Definition at line 110 of file MorphingCallback.hpp.
Referenced by onActorRenderStarted(), and resetGLSLBindings().
int vl::MorphingCallback::mAnim_t_Binding [protected] |
Definition at line 111 of file MorphingCallback.hpp.
Referenced by onActorRenderStarted(), and resetGLSLBindings().
float vl::MorphingCallback::mAnim_t [protected] |
Definition at line 112 of file MorphingCallback.hpp.
Referenced by MorphingCallback(), and onActorRenderStarted().