#include <CameraManipulator.h>
Inheritance diagram for nvui::CameraManipulator:
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 Member Functions | |
NVSG_API | CameraManipulator (void) |
Default Constructor. | |
virtual NVSG_API | ~CameraManipulator (void) |
Destructor. | |
virtual NVSG_API void | apply ()=0 |
Apply the states to the camera. | |
virtual NVSG_API void | keyDown (UINT key) |
Handle key down. | |
virtual NVSG_API void | keyUp (UINT key) |
Handle key up. | |
virtual NVSG_API void | keyRepeat () |
Handle key repeats. | |
virtual NVSG_API void | mouseButtonDown (UINT btn, int x, int y) |
Handle mouse button down. | |
virtual NVSG_API void | mouseButtonUp (UINT btn, int x, int y) |
Handle mouse button up. | |
virtual NVSG_API void | mouseMotion (int x, int y) |
Handle mouse motion. | |
UINT | getKeyState (void) const |
Determine the key state. | |
void | resetKeyState (void) |
Reset the current button state. | |
UINT | getButtonState (void) const |
Determine the button state. | |
void | resetButtonState (void) |
Reset the current button state. | |
void | attach (const nvsg::Camera *pCamera) |
Attach camera to manipulator. | |
const nvsg::Camera * | getAttachedCamera (void) |
Get the attached camera. | |
void | setViewportSize (size_t width, size_t height) |
Set the viewport size. | |
Protected Member Functions | |
virtual NVSG_API UINT | convertKey (UINT key) |
Convert the key. | |
virtual NVSG_API UINT | convertMouseButton (UINT btn) |
Convert the mouse button. | |
Protected Attributes | |
bool | m_dragAndThrowAnim |
Drag & Throw animation flag (Not implemented yet). | |
UINT | m_buttonState |
Current button mask. | |
UINT | m_keyState |
Current key mask. | |
const nvsg::Camera * | m_camera |
Attached camera. Could be NULL. | |
int | m_mouseX |
Current mouse x position. | |
int | m_mouseY |
Current mouse y position. | |
int | m_mouseXlast |
Last mouse x position. | |
int | m_mouseYlast |
Last mouse y position. | |
int | m_mouseXstart |
Mouse start x position. Set in mouse button pressed handler. | |
int | m_mouseYstart |
Mouse start y position. Set in mouse button pressed handler. | |
size_t | m_vpWidth |
Current viewport width. | |
size_t | m_vpHeight |
Current viewport height. |
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.
|
Key and button definitions. These values are used for the button/key state handling of the manipulator. |
|
Default Constructor.
|
|
Destructor.
|
|
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. |
|
Handle key down. Adapt key pressed events (shift, ...)
|
|
Handle key up. Adapt key release events (shift, ...)
|
|
Handle key repeats. Adapt key repeats. Reimplemented in nvui::FlightCamManip, and nvui::WalkCamManip. |
|
Handle mouse button down. Adapt mouse button pressed events.
|
|
Handle mouse button up. Adapt mouse button release events.
|
|
Handle mouse motion. Adapt mouse motion events while mouse buttons are pressed.
|
|
Determine the key state. Return the current key state mask.
|
|
Reset the current button state.
|
|
Determine the button state. Return the current button state mask.
|
|
Reset the current button state.
|
|
Attach camera to manipulator. Attach a camera to this manipulator. Attach to NULL to detach.
|
|
Get the attached camera. Return the currently attached camera object.
|
|
Set the viewport size. Adapt resize of the render area.
Reimplemented in nvui::TrackballCamManip. |
|
Convert the key. Translate a key to the CameraManipulator key.
Reimplemented in nvui::FlightCamManip, and nvui::WalkCamManip. |
|
Convert the mouse button. Translate a button to the CameraManipulator mouse button.
|
|
Drag & Throw animation flag (Not implemented yet).
|
|
Current button mask.
|
|
Current key mask.
|
|
Attached camera. Could be NULL.
|
|
Current mouse x position.
|
|
Current mouse y position.
|
|
Last mouse x position.
|
|
Last mouse y position.
|
|
Mouse start x position. Set in mouse button pressed handler.
|
|
Mouse start y position. Set in mouse button pressed handler.
|
|
Current viewport width.
|
|
Current viewport height.
|