Contents User Forum Source Index APIs by Task APIs by Level Data


G3D::FirstPersonManipulator Class Reference

Uses a First Person (Quake- or World of Warcraft style) mapping to translate keyboard and mouse input into a flying camera position. More...

#include <FirstPersonManipulator.h>

Inherits G3D::Manipulator.

List of all members.

Public Types

enum  MouseMode { MOUSE_DIRECT, MOUSE_DIRECT_RIGHT_BUTTON, MOUSE_SCROLL_AT_EDGE, MOUSE_PUSH_AT_EDGE }
typedef ReferenceCountedPointer<
class Manipulator
Ref

Public Member Functions

bool active () const
virtual void fireEvent (const GEvent &event)
virtual CoordinateFrame frame () const
virtual void getFrame (CoordinateFrame &c) const
void lookAt (const Vector3 &position)
Vector3 lookVector () const
MouseMode mouseMode () const
virtual bool onEvent (const GEvent &event)
virtual void onLogic ()
virtual void onNetwork ()
virtual void onPose (Array< PosedModel::Ref > &p3d, Array< PosedModel2DRef > &p2d)
virtual void onSimulation (RealTime rdt, SimTime sdt, SimTime idt)
virtual void onUserInput (UserInput *ui)
float pitch () const
const Vector3position () const
void ReferenceCountedObject_zeroWeakPointers ()
void reset ()
void setActive (bool a)
void setFrame (const CoordinateFrame &c)
virtual void setManager (WidgetManager *m)
void setMouseMode (MouseMode m)
void setMoveRate (double metersPerSecond)
void setPosition (const Vector3 &t)
void setTurnRate (double radiansPerSecond)
virtual GWindowwindow () const
float yaw () const
virtual ~FirstPersonManipulator ()

Static Public Member Functions

static FirstPersonManipulatorRef create ()

Public Attributes

AtomicInt32 ReferenceCountedObject_refCount
_WeakPtrLinkedListReferenceCountedObject_weakPointer

Protected Attributes

WidgetManagerm_manager


Detailed Description

Uses a First Person (Quake- or World of Warcraft style) mapping to translate keyboard and mouse input into a flying camera position.

The result is an Euler-angle camera controller suitable for games and fly-throughs.

To use without G3D::GApp:

  1. Create a G3D::RenderDevice
  2. Create a UserInput object (set the keyboard controls when creating it)
  3. Create a ManualCameraController
  4. Call ManualCameraController::setActive(true)
  5. Invoke ManualCameraController::doSimulation every time simulation is invoked (e.g. once per rendering iteration)
  6. Use ManualCameraController::getCoordinateFrame() to set the camera's position


Member Typedef Documentation

Reimplemented from G3D::Widget.

Reimplemented in G3D::UprightSplineManipulator.


Member Enumeration Documentation

MOUSE_DIRECT = Shooter/Quake style (default), mouse cursor is hidden and mouse controls yaw/pitch.

MOUSE_DIRECT_RIGHT_BUTTON = RPG/World of Warcraft style, on right mouse button cursor is hidden and mouse controls yaw/pitch. On OS X, ctrl+left and shift+left button are treated as the right mouse button.

MOUSE_SCROLL_AT_EDGE = Leaves mouse cursor visible and rotates while mouse is near the window edge

MOUSE_PUSH_AT_EDGE = Leaves mouse cursor visible and rotates when the mouse is actively pushing against the window edge

Enumerator:
MOUSE_DIRECT 
MOUSE_DIRECT_RIGHT_BUTTON 
MOUSE_SCROLL_AT_EDGE 
MOUSE_PUSH_AT_EDGE 


Constructor & Destructor Documentation

virtual G3D::FirstPersonManipulator::~FirstPersonManipulator (  )  [virtual]

Deactivates the controller.


Member Function Documentation

bool G3D::FirstPersonManipulator::active (  )  const

static FirstPersonManipulatorRef G3D::FirstPersonManipulator::create (  )  [static]

virtual void G3D::Widget::fireEvent ( const GEvent event  )  [virtual, inherited]

Fire an event on the containing window.

Reimplemented in G3D::WidgetManager.

virtual CoordinateFrame G3D::FirstPersonManipulator::frame (  )  const [virtual]

Implements G3D::Manipulator.

virtual void G3D::FirstPersonManipulator::getFrame ( CoordinateFrame c  )  const [virtual]

Implements G3D::Manipulator.

void G3D::FirstPersonManipulator::lookAt ( const Vector3 position  ) 

Vector3 G3D::FirstPersonManipulator::lookVector (  )  const [inline]

MouseMode G3D::FirstPersonManipulator::mouseMode (  )  const

virtual bool G3D::FirstPersonManipulator::onEvent ( const GEvent event  )  [virtual]

Returning true consumes the event and prevents other GModules from seeing it.

Motion events (GEventType::MOUSEMOTION, GEventType::JOYHATMOTION, JGEventType::OYBALLMOTION, and GEventType::JOYAXISMOTION) cannot be cancelled.

Implements G3D::Widget.

virtual void G3D::FirstPersonManipulator::onLogic (  )  [virtual]

Implements G3D::Widget.

virtual void G3D::FirstPersonManipulator::onNetwork (  )  [virtual]

Implements G3D::Widget.

virtual void G3D::FirstPersonManipulator::onPose ( Array< PosedModel::Ref > &  posedArray,
Array< PosedModel2DRef > &  posed2DArray 
) [virtual]

Appends a posed model for this object to the array, if it has a graphic representation.

The posed model appended is allowed to reference the agent and is allowed to mutate if the agent is mutated.

Implements G3D::Widget.

virtual void G3D::FirstPersonManipulator::onSimulation ( RealTime  rdt,
SimTime  sdt,
SimTime  idt 
) [virtual]

Implements G3D::Widget.

virtual void G3D::FirstPersonManipulator::onUserInput ( UserInput ui  )  [virtual]

Implements G3D::Widget.

float G3D::FirstPersonManipulator::pitch (  )  const [inline]

const Vector3& G3D::FirstPersonManipulator::position (  )  const [inline]

Deprecated:
Rename to translation()

void G3D::ReferenceCountedObject::ReferenceCountedObject_zeroWeakPointers (  )  [inline, inherited]

Automatically called immediately before the object is deleted.

This is not called from the destructor because it needs to be invoked before the subclass destructor.

void G3D::FirstPersonManipulator::reset (  ) 

Invoke immediately before entering the main game loop.

void G3D::FirstPersonManipulator::setActive ( bool  a  ) 

When active, the FirstPersonManipulator takes over the mouse.

It turns off the mouse cursor and switches to first person controller style. Use this to toggle between your menu system and first person camera control.

When deactivated, the mouse cursor is restored and the mouse is located where it was when the camera controller was activated.

In release mode, the cursor movement is restricted to the window while the controller is active. This does not occur in debug mode because you might hit a breakpoint while the controller is active and it would be annoying to not be able to move the mouse.

void G3D::FirstPersonManipulator::setFrame ( const CoordinateFrame c  ) 

Sets to the closest legal controller orientation to the coordinate frame.

virtual void G3D::Widget::setManager ( WidgetManager m  )  [inline, virtual, inherited]

Called by the WidgetManager when this module is added to it.

The argument may be NULL

Reimplemented in G3D::DeveloperWindow.

void G3D::FirstPersonManipulator::setMouseMode ( MouseMode  m  ) 

void G3D::FirstPersonManipulator::setMoveRate ( double  metersPerSecond  ) 

Initial value is 10.

void G3D::FirstPersonManipulator::setPosition ( const Vector3 t  )  [inline]

void G3D::FirstPersonManipulator::setTurnRate ( double  radiansPerSecond  ) 

Initial value is PI / 2.

virtual GWindow* G3D::Widget::window (  )  const [virtual, inherited]

Returns the operating system window that is currently rendering this Widget.

Reimplemented in G3D::WidgetManager.

float G3D::FirstPersonManipulator::yaw (  )  const [inline]


Member Data Documentation

WidgetManager* G3D::Widget::m_manager [protected, inherited]

The manager, set by setManager().

This cannot be a reference counted pointer because that would create a cycle between the Widget and its manager.

The long name is to keep this from accidentally conflicting with a subclass's variable name.

Do not use or explicitly manipulate this value--its type may change in the future and is not part of the supported API.

Linked list of all weak pointers that reference this (some may be on the stack!).

Do not use or explicitly manipulate this value.


The documentation for this class was generated from the following file:
Generated on Thu Aug 2 11:40:45 2007 for G3D by doxygen 1.5.2
Hosted by SourceForge.net Logo