vtlib library
Public Member Functions | List of all members
vtEngine Class Reference
Inheritance diagram for vtEngine:
Inheritance graph
[legend]

Public Member Functions

osg::Referenced * GetTarget (uint which=0)
 
void AddTarget (osg::Referenced *ptr)
 
void RemoveTarget (osg::Referenced *ptr)
 
uint NumTargets ()
 Return the number of targets for this engine.
 
virtual void OnMouse (vtMouseEvent &event)
 Virtual handler, to catch mouse events, can be overridden by your engine class.
 
virtual void OnKey (int key, int flags)
 Virtual handler, to catch keyboard events, can be overridden by your engine class.
 
virtual void OnWindowSize (int width, int height)
 Virtual handler, to catch resize events, can be overridden by your engine class.
 
virtual void Eval ()
 

Detailed Description

The vtEngine class represents an Engine, which is a convenient way to encapsulate an application behavior which occurs every frame. An Engine typically has a target, which is another object which it affects. The Engine's method Eval() is called each frame, at which point it can do whatever simulation or computation it desires, and then update its target.

For example, you may have a node in your scene graph which represents a fish. You could then create a Engine class (e.g. FishEngine, subclass of vtEngine) which simulates the behavior of a fish. For each fish you create, you would also create a FishEngine and set the Engine's target to be the fish.

Member Function Documentation

void vtEngine::AddTarget ( osg::Referenced *  ptr)
inline

Adds a target to the engine.

void vtEngine::Eval ( )
virtual

Virtual handler, will be called every frame to do the work of the engine. You must override this if you want your engine to be useful.

Reimplemented in vtTrackball, vtHeightConstrain, vtAnimPathEngine, QuakeFlyer, VFlyer, vtSimpleBillboardEngine, vtTinFlyer, vtPanoFlyer, vtTerrainFlyer, vtOrthoFlyer, vtFlyer, GlobePicker, vtTimeEngine, MapOverviewEngine, and TerrainPicker.

osg::Referenced * vtEngine::GetTarget ( uint  which = 0)

Get a target from the engine. Most engines will have only a single target.

Parameters
whichThe number of the target (default 0).
void vtEngine::RemoveTarget ( osg::Referenced *  ptr)

Removes a target from the engine.