Controller
From Moviesandbox
Line 5: | Line 5: | ||
<h3>Members:</h3> | <h3>Members:</h3> | ||
+ | |||
+ | <h4>static bool bRunning</h4> | ||
+ | Static variable that determines is the scene is running or not. Can be accessed from everywhere. | ||
+ | |||
+ | <h4>static vector <[[Node]] *> nodeList</h4> | ||
+ | A list of all the nodes in the scene. | ||
+ | |||
+ | <h4>static vector<[[Node]] *> nodeTree</h4> | ||
+ | A list of all the node Trees starting Nodes in the scene. Node tree starting nodes (Root Nodes) are [[RootNode]] and [[KeyInputNode]]. | ||
+ | |||
+ | <h4>[[Actor]] *controlledActor</h4> | ||
+ | The [[Actor]] this controller is currently controlling - also serves as the viewLocation for the [[Renderer]]. | ||
+ | |||
+ | <h4>[[NavButton]] *navBtn</h4> | ||
+ | A reference to the navigation button, used for view Rotation. | ||
+ | |||
+ | <h4>Vector3f lookPoint</h4> | ||
+ | A point that is 1 unit away from the controlledactor's location in the direction of the controlledactor's rotation. Is used for viewport. | ||
+ | |||
+ | <h4>int state</h4> | ||
+ | Can be either MOVECURSORSTATE or MOVECAMERASTATE, defines if we change the viewpoint with mouse/keyboard or just move the cursor around. | ||
+ | |||
+ | <h4>int moveMode</h4> | ||
+ | Can be FLYINGCAMERA or WALKINGCAMERA. Currently only supports FLYINGCAMERA. | ||
<h4>[[Actor]] * cameraActor</h4> | <h4>[[Actor]] * cameraActor</h4> | ||
Line 12: | Line 36: | ||
<h3>Functions:</h3> | <h3>Functions:</h3> | ||
- | <h4> | + | <h4>void update(double deltaTime)</h4> |
+ | ''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). | ||
+ | |||
+ | <h4>void processMove (double deltaTime)</h4> | ||
+ | ''called from:'' Controller::update(double deltaTime) | ||
+ | |||
+ | This function takes mouse movement and keyPresses from [[NavButton|NavBtn]] and [[Input]] and changes the controlledActor's location, rotation and calculates the lookPoint location. | ||
+ | |||
+ | <h4>void confineMouse()</h4> | ||
+ | |||
+ | <h4>void switchMode()</h4> | ||
+ | |||
+ | <h4>void start()</h4> | ||
+ | |||
+ | <h4>void stop()</h4> | ||
+ | |||
See also: [[Input]], [[Actor]] | See also: [[Input]], [[Actor]] | ||
[[Category:Code Index]] | [[Category:Code Index]] |
Current revision
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.