Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

nvui::CameraManipulator Class Reference

Camera manipulator base class. More...

#include <CameraManipulator.h>

Inheritance diagram for nvui::CameraManipulator:

Inheritance graph
[legend]
Collaboration diagram for nvui::CameraManipulator:

Collaboration graph
[legend]
List of all members.

Public Types

enum  {
  _NO_BTN_KEY = 0x0000, _LEFT_MOUSE_BTN = 0x0001, _MIDDLE_MOUSE_BTN = 0x0002, _RIGHT_MOUSE_BTN = 0x0004,
  _SHIFT_KEY = 0x0100, _CONTROL_KEY = 0x0200
}
 Key and button definitions. More...


Public Methods

NVSG_API CameraManipulator (void)
 Default Constructor. More...

virtual NVSG_API ~CameraManipulator (void)
 Destructor. More...

virtual NVSG_API void apply ()=0
 Apply the states to the camera. More...

virtual NVSG_API void keyDown (UINT key)
 Handle key down. More...

virtual NVSG_API void keyUp (UINT key)
 Handle key up. More...

virtual NVSG_API void keyRepeat ()
 Handle key repeats. More...

virtual NVSG_API void mouseButtonDown (UINT btn, int x, int y)
 Handle mouse button down. More...

virtual NVSG_API void mouseButtonUp (UINT btn, int x, int y)
 Handle mouse button up. More...

virtual NVSG_API void mouseMotion (int x, int y)
 Handle mouse motion. More...

UINT getKeyState (void) const
 Determine the key state. More...

void resetKeyState (void)
 Reset the current button state. More...

UINT getButtonState (void) const
 Determine the button state. More...

void resetButtonState (void)
 Reset the current button state. More...

void attach (const nvsg::Camera *pCamera)
 Attach camera to manipulator. More...

const nvsg::CameragetAttachedCamera (void)
 Get the attached camera. More...

void setViewportSize (size_t width, size_t height)
 Set the viewport size. More...


Protected Methods

virtual NVSG_API UINT convertKey (UINT key)
 Convert the key. More...

virtual NVSG_API UINT convertMouseButton (UINT btn)
 Convert the mouse button. More...


Protected Attributes

bool m_dragAndThrowAnim
 Drag & Throw animation flag (Not implemented yet). More...

UINT m_buttonState
 Current button mask. More...

UINT m_keyState
 Current key mask. More...

const nvsg::Cameram_camera
 Attached camera. Could be NULL. More...

int m_mouseX
 Current mouse x position. More...

int m_mouseY
 Current mouse y position. More...

int m_mouseXlast
 Last mouse x position. More...

int m_mouseYlast
 Last mouse y position. More...

int m_mouseXstart
 Mouse start x position. Set in mouse button pressed handler. More...

int m_mouseYstart
 Mouse start y position. Set in mouse button pressed handler. More...

size_t m_vpWidth
 Current viewport width. More...

size_t m_vpHeight
 Current viewport height. More...


Detailed Description

Camera manipulator base class.

This class should be used as a base class for your own camera manipulators. A camera manipulater is an object that controls the camera in a very specific way Trackball, walk, flight, and animation are examples of camera controls. You can attach a camera to the manipulator and the manipulator converts actions, such as the movement of the mouse or button events, into camera data. You can also write manipulators that work with other kinds of inputs and input devices.


Member Enumeration Documentation

anonymous enum
 

Key and button definitions.

These values are used for the button/key state handling of the manipulator.

Enumeration values:
_NO_BTN_KEY  No key or button.
_LEFT_MOUSE_BTN  Left mouse button.
_MIDDLE_MOUSE_BTN  Middle mouse button.
_RIGHT_MOUSE_BTN  Right mouse button.
_SHIFT_KEY  Shift key.
_CONTROL_KEY  Control key.


Constructor & Destructor Documentation

NVSG_API nvui::CameraManipulator::CameraManipulator void   
 

Default Constructor.

virtual NVSG_API nvui::CameraManipulator::~CameraManipulator void    [virtual]
 

Destructor.


Member Function Documentation

virtual NVSG_API void nvui::CameraManipulator::apply   [pure virtual]
 

Apply the states to the camera.

Recalculate the camera with respect to the manipulator states.

Implemented in nvui::AnimationCamManip, nvui::FlightCamManip, nvui::TrackballCamManip, and nvui::WalkCamManip.

virtual NVSG_API void nvui::CameraManipulator::keyDown UINT    key [virtual]
 

Handle key down.

Adapt key pressed events (shift, ...)

Note:
Calls keyReapeat()
Parameters:
key  Pressed key (e.g. _SHIFT_KEY or _CONTROL_KEY)

virtual NVSG_API void nvui::CameraManipulator::keyUp UINT    key [virtual]
 

Handle key up.

Adapt key release events (shift, ...)

Parameters:
key  Released key (e.g. _SHIFT_KEY or _CONTROL_KEY)

virtual NVSG_API void nvui::CameraManipulator::keyRepeat   [virtual]
 

Handle key repeats.

Adapt key repeats.

Reimplemented in nvui::FlightCamManip, and nvui::WalkCamManip.

virtual NVSG_API void nvui::CameraManipulator::mouseButtonDown UINT    btn,
int    x,
int    y
[virtual]
 

Handle mouse button down.

Adapt mouse button pressed events.

Parameters:
btn  Pressed button (e.g. _LEFT_MOUSE_BTN|_MIDDLE_MOUSE_BTN)
x  Position of the mouse.
y  Position of the mouse.

virtual NVSG_API void nvui::CameraManipulator::mouseButtonUp UINT    btn,
int    x,
int    y
[virtual]
 

Handle mouse button up.

Adapt mouse button release events.

Parameters:
btn  Released buttons (e.g. _LEFT_MOUSE_BTN|_MIDDLE_MOUSE_BTN)
x  Position of the mouse.
y  Position of the mouse.

virtual NVSG_API void nvui::CameraManipulator::mouseMotion int    x,
int    y
[virtual]
 

Handle mouse motion.

Adapt mouse motion events while mouse buttons are pressed.

Parameters:
x  Position of the mouse.
y  Position of the mouse.

UINT nvui::CameraManipulator::getKeyState void    const [inline]
 

Determine the key state.

Return the current key state mask.

Returns:
Concatenation of the current key states

void nvui::CameraManipulator::resetKeyState void    [inline]
 

Reset the current button state.

UINT nvui::CameraManipulator::getButtonState void    const [inline]
 

Determine the button state.

Return the current button state mask.

Returns:
Concatenation of the current button states

void nvui::CameraManipulator::resetButtonState void    [inline]
 

Reset the current button state.

void nvui::CameraManipulator::attach const nvsg::Camera   pCamera [inline]
 

Attach camera to manipulator.

Attach a camera to this manipulator. Attach to NULL to detach.

Parameters:
pCamera  camera to work with. Manipulator takes care of ref/deref-ing the camera object.

const nvsg::Camera * nvui::CameraManipulator::getAttachedCamera void    [inline]
 

Get the attached camera.

Return the currently attached camera object.

Returns:
Pointer to the attached camera. This pointer could be NULL. If you want to use this camera, make sure to ref/deref the camera.

void nvui::CameraManipulator::setViewportSize size_t    width,
size_t    height
[inline]
 

Set the viewport size.

Adapt resize of the render area.

Note:
Call this method on every resize, or if you create/initialize the manipulator.
Parameters:
width  viewport width
height  viewport height

Reimplemented in nvui::TrackballCamManip.

virtual NVSG_API UINT nvui::CameraManipulator::convertKey UINT    key [protected, virtual]
 

Convert the key.

Translate a key to the CameraManipulator key.

Returns:
Corresponding key id.
Parameters:
key  Currently pressed mouse button (e.g. MK_LBUTTON)

Reimplemented in nvui::FlightCamManip, and nvui::WalkCamManip.

virtual NVSG_API UINT nvui::CameraManipulator::convertMouseButton UINT    btn [protected, virtual]
 

Convert the mouse button.

Translate a button to the CameraManipulator mouse button.

Returns:
Corresponding mouse button id.
Parameters:
btn  Currently pressed mouse button (e.g. MK_LBUTTON)


Member Data Documentation

bool nvui::CameraManipulator::m_dragAndThrowAnim [protected]
 

Drag & Throw animation flag (Not implemented yet).

UINT nvui::CameraManipulator::m_buttonState [protected]
 

Current button mask.

UINT nvui::CameraManipulator::m_keyState [protected]
 

Current key mask.

const nvsg::Camera* nvui::CameraManipulator::m_camera [protected]
 

Attached camera. Could be NULL.

int nvui::CameraManipulator::m_mouseX [protected]
 

Current mouse x position.

int nvui::CameraManipulator::m_mouseY [protected]
 

Current mouse y position.

int nvui::CameraManipulator::m_mouseXlast [protected]
 

Last mouse x position.

int nvui::CameraManipulator::m_mouseYlast [protected]
 

Last mouse y position.

int nvui::CameraManipulator::m_mouseXstart [protected]
 

Mouse start x position. Set in mouse button pressed handler.

int nvui::CameraManipulator::m_mouseYstart [protected]
 

Mouse start y position. Set in mouse button pressed handler.

size_t nvui::CameraManipulator::m_vpWidth [protected]
 

Current viewport width.

size_t nvui::CameraManipulator::m_vpHeight [protected]
 

Current viewport height.


The documentation for this class was generated from the following file:
Generated on Tue Mar 1 13:20:42 2005 for NVSGSDK by NVIDIA