Visualization Library v1.0.3

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

VL     Star     Watch     Fork     Issue

[Download] [Tutorials] [All Classes] [Grouped Classes]
Public Member Functions | Protected Attributes

vl::MorphingCallback Class Reference

The MorphingCallback class implements a simple morphing animation mechanism using the GPU acceleration where available. More...

#include <MorphingCallback.hpp>

Inheritance diagram for vl::MorphingCallback:
vl::ActorEventCallback vl::Object

List of all members.

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.
virtual void onActorDelete (Actor *)
 Event notifying that an Actor is being deleted.
void bindActor (Actor *actor)
void init (ResourceDatabase *res_db)
 Initializes a MorphingCallback from a ResourceDatabase.
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)
Geometrygeometry ()
const Geometrygeometry () const
bool animationStarted () const

Protected Attributes

ref< GeometrymGeometry
ref< ArrayFloat3mVertices
ref< ArrayFloat3mNormals
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

Detailed Description

The MorphingCallback class implements a simple morphing animation mechanism using the GPU acceleration where available.

Definition at line 44 of file MorphingCallback.hpp.


Constructor & Destructor Documentation

MorphingCallback::MorphingCallback (  )
MorphingCallback::~MorphingCallback (  )

Definition at line 56 of file MorphingCallback.cpp.


Member Function Documentation

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.

Parameters:
actorThe Actor bound to this rendering callback.
frame_clockThe current rendering frame time, usually used for animation purposes.
camThe camera used for the current rendering.
renderableThe currently selected Actor LOD.
shaderThe currently active Shader.
passThe 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 )
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:

  • N ArrayFloat3 objects named 'vertex_frame' containing the vertex position for every frame
  • N ArrayFloat3 objects named 'normal_frame' containing the vertex normal for every frame where N is the number of animation frames.

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 
)
void MorphingCallback::setAnimation ( int  start,
int  end,
float  period 
)
void MorphingCallback::startAnimation ( real  time = -1 )
void MorphingCallback::stopAnimation (  )

Definition at line 287 of file MorphingCallback.cpp.

References mAnimationStarted.

void MorphingCallback::initFrom ( MorphingCallback morph_cb )
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.


Member Data Documentation

Definition at line 93 of file MorphingCallback.hpp.

Referenced by blendFrames(), init(), initFrom(), and onActorRenderStarted().

Definition at line 94 of file MorphingCallback.hpp.

Referenced by blendFrames(), init(), initFrom(), and onActorRenderStarted().

Definition at line 95 of file MorphingCallback.hpp.

Referenced by blendFrames(), init(), initFrom(), and onActorRenderStarted().

Definition at line 96 of file MorphingCallback.hpp.

Referenced by blendFrames(), init(), initFrom(), and onActorRenderStarted().

Definition at line 99 of file MorphingCallback.hpp.

Referenced by onActorRenderStarted(), setAnimation(), and startAnimation().

Definition at line 100 of file MorphingCallback.hpp.

Referenced by onActorRenderStarted(), setAnimation(), and startAnimation().

Definition at line 101 of file MorphingCallback.hpp.

Referenced by onActorRenderStarted(), and setAnimation().

Definition at line 102 of file MorphingCallback.hpp.

Referenced by onActorRenderStarted(), and setAnimation().

Definition at line 103 of file MorphingCallback.hpp.

Referenced by onActorRenderStarted(), and setAnimation().

Definition at line 108 of file MorphingCallback.hpp.

Definition at line 109 of file MorphingCallback.hpp.

Referenced by onActorRenderStarted(), and resetGLSLBindings().

Definition at line 110 of file MorphingCallback.hpp.

Referenced by onActorRenderStarted(), and resetGLSLBindings().

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().


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

Visualization Library v1.0.3 Reference Documentation
Copyright Michele Bosi. All rights reserved.
Updated on Tue Feb 7 2017 00:55:10.
Permission is granted to use this page to write and publish articles regarding Visualization Library.