Controller

From Moviesandbox

Revision as of 19:05, 18 March 2009 by Fiezi (Talk | contribs)
(diff) ←Older revision | Current revision (diff) | Newer revision→ (diff)
Jump to: navigation, search

Contents

[edit] class Controller

derived from: Actor

The Controller allows the User to control certain Actors with mouse and keyboard through states. It also controls when to start or to stop a scene and manages the node trees in a scene. The Controller can "possess" actors and will use the possessed actors' position and rotation as the viewport camera.

[edit] Members:

[edit] static bool bRunning

Static variable that determines is the scene is running or not. Can be accessed from everywhere.

[edit] static vector <Node *> nodeList

A list of all the nodes in the scene.

[edit] static vector<Node *> nodeTree

A list of all the node Trees starting Nodes in the scene. Node tree starting nodes (Root Nodes) are RootNode and KeyInputNode.

[edit] Actor *controlledActor

The Actor this controller is currently controlling - also serves as the viewLocation for the Renderer.

[edit] NavButton *navBtn

A reference to the navigation button, used for view Rotation.

[edit] Vector3f lookPoint

A point that is 1 unit away from the controlledactor's location in the direction of the controlledactor's rotation. Is used for viewport.

[edit] int state

Can be either MOVECURSORSTATE or MOVECAMERASTATE, defines if we change the viewpoint with mouse/keyboard or just move the cursor around.

[edit] int moveMode

Can be FLYINGCAMERA or WALKINGCAMERA. Currently only supports FLYINGCAMERA.

[edit] Actor * cameraActor

The viewport position reference. Also the Actor that gets moved when in MOVECAMERASTATE.

[edit] Functions:

[edit] void update(double deltaTime)

called from: Renderer::update() (as part of ActorList)

checks the state variable and calls processMove if we're in MOVECAMERASTATE. Also calls updateNodes() if the scene is running (bRunning is true).

[edit] void processMove (double deltaTime)

called from: Controller::update(double deltaTime)

This function takes mouse movement and keyPresses from NavBtn and Input and changes the controlledActor's location, rotation and calculates the lookPoint location.

[edit] void confineMouse()

[edit] void switchMode()

[edit] void start()

[edit] void stop()


See also: Input, Actor

Personal tools
Moviesandbox for UT2004