NvInputTransformer Class Reference

Automatic mapping of input devices to camera movements. More...

#include <NvInputTransformer.h>

List of all members.

Public Member Functions

void setScreenSize (int32_t width, int32_t height)
 Set screen size.
void setMotionMode (NvCameraMotionType::Enum mode)
 Set motion mode.
NvCameraMotionType::Enum getMotionMode ()
 Get motion mode.
nv::matrix4f getModelViewMat ()
 Get the current modelview transform.
const nv::vec3f & getRotationVec ()
 Get the current rotation vector.
void setRotationVec (const nv::vec3f &vec)
 Set the current rotation vector.
const nv::vec3f & getTranslationVec ()
 Get the current translation vector.
void setTranslationVec (const nv::vec3f &vec)
 Set the current translation vector.
const float getScale ()
 Get the current (uniform) scale factor.
void setScale (const float scale)
 Set the current (uniform) scale factor.
const nv::vec3f & getRotationVel ()
 Get the current rotation velocity.
void setRotationVel (const nv::vec3f &vec)
 Set the current rotation velocity.
const nv::vec3f & getTranslationVel ()
 Get the current translation velocity.
void setTranslationVel (const nv::vec3f &vec)
 Set the current translation velocity.
float getMaxRotationVel ()
 Get the current "max" rotation velocity.
void setMaxRotationVel (float maxVel)
 Set the current "max" rotation velocity.
float getMaxTranslationVel ()
 Get the current "max" translation velocity.
void setMaxTranslationVel (float maxVel)
 Set the current "max" translation velocity.
void update (float deltaTime)
 Update the matrices.
bool processPointer (NvInputDeviceType::Enum device, NvPointerActionType::Enum action, uint32_t modifiers, int32_t count, NvPointerEvent *points)
 Pointer event input.
bool processGamepad (uint32_t changedPadFlags, NvGamepad &pad)
 Gamepad event input.
bool processKey (uint32_t code, NvKeyActionType::Enum action)
 Key event input.
const nv::matrix4f & getRotationMat ()
const nv::matrix4f & getTranslationMat ()
const nv::matrix4f & getScaleMat ()


Detailed Description

Automatic mapping of input devices to camera movements.

Maps touch, mouse and gamepad into useful camera movements as represented by a modelview transform. Lower-level matrices are also available for custom interaction.


Member Function Documentation

float NvInputTransformer::getMaxRotationVel (  )  [inline]

Get the current "max" rotation velocity.

Returns:
the current "max" rotation velocity (the velocity produced when the corresponding gamepad axis is at full lock) about each axis in radians per second

float NvInputTransformer::getMaxTranslationVel (  )  [inline]

Get the current "max" translation velocity.

Returns:
the current "max" translation velocity (the velocity produced when the corresponding gamepad axis is at full lock) in units per second

nv::matrix4f NvInputTransformer::getModelViewMat (  ) 

Get the current modelview transform.

Returns:
the current combined transform matrix for the given mapping mode. This matrix should be placed between the scene's modelview matrix and the camera projection matrix: FinalMat = Projection X getModelViewMat() X ModelView

NvCameraMotionType::Enum NvInputTransformer::getMotionMode (  )  [inline]

Get motion mode.

Get the current input-to-motion mapping

Returns:
the current mapping mode

const nv::matrix4f& NvInputTransformer::getRotationMat (  )  [inline]

Get the component matrices.

Returns:
the given basic component matrix for the current mode and settings. Most apps will not need these components, but will instead use getModelViewMat

const nv::vec3f& NvInputTransformer::getRotationVec (  )  [inline]

Get the current rotation vector.

Returns:
the angles (in radians) used to create the rotation component matrix

const nv::vec3f& NvInputTransformer::getRotationVel (  )  [inline]

Get the current rotation velocity.

Returns:
the current rotation velocity about each axis in radians per second

const float NvInputTransformer::getScale (  )  [inline]

Get the current (uniform) scale factor.

Returns:
the factor used to create the scale component matrix

const nv::matrix4f& NvInputTransformer::getScaleMat (  )  [inline]

Get the component matrices.

Returns:
the given basic component matrix for the current mode and settings. Most apps will not need these components, but will instead use getModelViewMat

const nv::matrix4f& NvInputTransformer::getTranslationMat (  )  [inline]

Get the component matrices.

Returns:
the given basic component matrix for the current mode and settings. Most apps will not need these components, but will instead use getModelViewMat

const nv::vec3f& NvInputTransformer::getTranslationVec (  )  [inline]

Get the current translation vector.

Returns:
the vector used to create the translation component matrix

const nv::vec3f& NvInputTransformer::getTranslationVel (  )  [inline]

Get the current translation velocity.

Returns:
the current translation velocity in units per second

bool NvInputTransformer::processGamepad ( uint32_t  changedPadFlags,
NvGamepad pad 
)

Gamepad event input.

Used to pass gamepad state to the transformer. The signature explicitly matches that of the input callbacks used to provide input to an app or app framework for ease of calling

Parameters:
[in] changedPadFlags the changes pad flags
[in] pad the gamepad device
Returns:
true if the event was used and "eaten" by the input transformer and should not be processed by any other input system.

bool NvInputTransformer::processKey ( uint32_t  code,
NvKeyActionType::Enum  action 
)

Key event input.

Used to pass key input events to the transformer. The signature explicitly matches that of the input callbacks used to provide input to an app or app framework for ease of calling

Parameters:
[in] code the input keycode
[in] action the input action
Returns:
true if the event was used and "eaten" by the input transformer and should not be processed by any other input system.

bool NvInputTransformer::processPointer ( NvInputDeviceType::Enum  device,
NvPointerActionType::Enum  action,
uint32_t  modifiers,
int32_t  count,
NvPointerEvent points 
)

Pointer event input.

Used to pass pointer input events to the transformer. The signature explicitly matches that of the input callbacks used to provide input to an app or app framework for ease of calling

Parameters:
[in] device the input device
[in] action the input action
[in] modifiers the input modifiers
[in] count the number of elements in the points array
[in] points the input event points
Returns:
true if the event was used and "eaten" by the input transformer and should not be processed by any other input system.

void NvInputTransformer::setMaxRotationVel ( float  maxVel  )  [inline]

Set the current "max" rotation velocity.

Parameters:
[in] maxVel the current "max" rotation velocity (the velocity produced when the corresponding gamepad axis is at full lock) about each axis in radians per second

void NvInputTransformer::setMaxTranslationVel ( float  maxVel  )  [inline]

Set the current "max" translation velocity.

Parameters:
[in] maxVel the current "max" translation velocity (the velocity produced when the corresponding gamepad axis is at full lock) in units per second

void NvInputTransformer::setMotionMode ( NvCameraMotionType::Enum  mode  )  [inline]

Set motion mode.

Set the desired input-to-motion mapping mode

Parameters:
[in] mode the desired mapping mode

void NvInputTransformer::setRotationVec ( const nv::vec3f &  vec  )  [inline]

Set the current rotation vector.

Set the rotation angles. Very useful for setting the initial view at application start.

Parameters:
[in] vec the angles (in radians) used to create the rotation component matrix

void NvInputTransformer::setRotationVel ( const nv::vec3f &  vec  )  [inline]

Set the current rotation velocity.

Note this this velocity will be overwritten by gamepad axis motion. It is mainly useful for adding an initial rotation animation on the camera before the user has provided input

Parameters:
[in] vec the current rotation velocity about each axis in radians per second.

void NvInputTransformer::setScale ( const float  scale  )  [inline]

Set the current (uniform) scale factor.

Set the scaling. Very useful for setting the initial view at application start.

Parameters:
[in] scale the scale factor used to create the scale component matrix

void NvInputTransformer::setScreenSize ( int32_t  width,
int32_t  height 
) [inline]

Set screen size.

Set the current screen size, so that the touch/mouse mapping methods scale correctly. Failure to keep this up to date with the screen size can lead to wildly incorrect mouse/touch mappings

Parameters:
[in] width the new window/screen width
[in] height the new window/screen height

void NvInputTransformer::setTranslationVec ( const nv::vec3f &  vec  )  [inline]

Set the current translation vector.

Set the translation. Very useful for setting the initial view at application start.

Parameters:
[in] vec the translation used to create the rotation component matrix

void NvInputTransformer::setTranslationVel ( const nv::vec3f &  vec  )  [inline]

Set the current translation velocity.

Note this this velocity will be overwritten by gamepad axis motion. It is mainly useful for adding an initial translation animation on the camera before the user has provided input

Parameters:
[in] vec the current translation velocity in units per second.

void NvInputTransformer::update ( float  deltaTime  ) 

Update the matrices.

Update the matrices based on the current inputs, velocities, and delta time.

Parameters:
[in] deltaTime the time since the last call to update, in seconds


The documentation for this class was generated from the following file: