NvInputTransformer Class Reference

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

#include <NvInputTransformer.h>

List of all members.

Classes

class  Transform

Public Member Functions

void reset ()
 Reset.
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 (NvCameraXformType::Enum xform=NvCameraXformType::MAIN)
 Get the current modelview transform.
bool isAnimating ()
 Query to determine if the current configuration of the controls is causing animation Can be used in on-demand redraw cases to determine whether continuous redraw is likely to be required.
const nv::vec3f & getRotationVec (NvCameraXformType::Enum xform=NvCameraXformType::MAIN)
 Get the current rotation vector.
void setRotationVec (const nv::vec3f &vec, NvCameraXformType::Enum xform=NvCameraXformType::MAIN)
 Set the current rotation vector.
const nv::vec3f & getTranslationVec (NvCameraXformType::Enum xform=NvCameraXformType::MAIN)
 Get the current translation vector.
void setTranslationVec (const nv::vec3f &vec, NvCameraXformType::Enum xform=NvCameraXformType::MAIN)
 Set the current translation vector.
const float getScale (NvCameraXformType::Enum xform=NvCameraXformType::MAIN)
 Get the current (uniform) scale factor.
void setScale (const float scale, NvCameraXformType::Enum xform=NvCameraXformType::MAIN)
 Set the current (uniform) scale factor.
const nv::vec3f & getRotationVel (NvCameraXformType::Enum xform=NvCameraXformType::MAIN)
 Get the current rotation velocity.
void setRotationVel (const nv::vec3f &vec, NvCameraXformType::Enum xform=NvCameraXformType::MAIN)
 Set the current rotation velocity.
const nv::vec3f & getTranslationVel (NvCameraXformType::Enum xform=NvCameraXformType::MAIN)
 Get the current translation velocity.
void setTranslationVel (const nv::vec3f &vec, NvCameraXformType::Enum xform=NvCameraXformType::MAIN)
 Set the current translation velocity.
float getMaxRotationVel (NvCameraXformType::Enum xform=NvCameraXformType::MAIN)
 Get the current "max" rotation velocity.
void setMaxRotationVel (float maxVel, NvCameraXformType::Enum xform=NvCameraXformType::MAIN)
 Set the current "max" rotation velocity.
float getMaxTranslationVel (NvCameraXformType::Enum xform=NvCameraXformType::MAIN)
 Get the current "max" translation velocity.
void setMaxTranslationVel (float maxVel, NvCameraXformType::Enum xform=NvCameraXformType::MAIN)
 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 (NvCameraXformType::Enum xform=NvCameraXformType::MAIN)
const nv::matrix4f & getTranslationMat (NvCameraXformType::Enum xform=NvCameraXformType::MAIN)
const nv::matrix4f & getScaleMat (NvCameraXformType::Enum xform=NvCameraXformType::MAIN)


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 ( NvCameraXformType::Enum  xform = NvCameraXformType::MAIN  )  [inline]

Get the current "max" rotation velocity.

Parameters:
[in] xform the index of the transform to be referenced. For all modes except DUAL_ORBITAL, this can be left as the default
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 ( NvCameraXformType::Enum  xform = NvCameraXformType::MAIN  )  [inline]

Get the current "max" translation velocity.

Parameters:
[in] xform the index of the transform to be referenced. For all modes except DUAL_ORBITAL, this can be left as the default
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 ( NvCameraXformType::Enum  xform = NvCameraXformType::MAIN  ) 

Get the current modelview transform.

Parameters:
[in] xform the index of the transform to be referenced. For all modes except DUAL_ORBITAL, this can be left as the default
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 ( NvCameraXformType::Enum  xform = NvCameraXformType::MAIN  )  [inline]

Get the component matrices.

Parameters:
[in] xform the index of the transform to be referenced. For all modes except DUAL_ORBITAL, this can be left as the default
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 ( NvCameraXformType::Enum  xform = NvCameraXformType::MAIN  )  [inline]

Get the current rotation vector.

Parameters:
[in] xform the index of the transform to be referenced. For all modes except DUAL_ORBITAL, this can be left as the default
Returns:
the angles (in radians) used to create the rotation component matrix

const nv::vec3f& NvInputTransformer::getRotationVel ( NvCameraXformType::Enum  xform = NvCameraXformType::MAIN  )  [inline]

Get the current rotation velocity.

Parameters:
[in] xform the index of the transform to be referenced. For all modes except DUAL_ORBITAL, this can be left as the default
Returns:
the current rotation velocity about each axis in radians per second

const float NvInputTransformer::getScale ( NvCameraXformType::Enum  xform = NvCameraXformType::MAIN  )  [inline]

Get the current (uniform) scale factor.

Parameters:
[in] xform the index of the transform to be referenced. For all modes except DUAL_ORBITAL, this can be left as the default
Returns:
the factor used to create the scale component matrix

const nv::matrix4f& NvInputTransformer::getScaleMat ( NvCameraXformType::Enum  xform = NvCameraXformType::MAIN  )  [inline]

Get the component matrices.

Parameters:
[in] xform the index of the transform to be referenced. For all modes except DUAL_ORBITAL, this can be left as the default
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 ( NvCameraXformType::Enum  xform = NvCameraXformType::MAIN  )  [inline]

Get the component matrices.

Parameters:
[in] xform the index of the transform to be referenced. For all modes except DUAL_ORBITAL, this can be left as the default
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 ( NvCameraXformType::Enum  xform = NvCameraXformType::MAIN  )  [inline]

Get the current translation vector.

Parameters:
[in] xform the index of the transform to be referenced. For all modes except DUAL_ORBITAL, this can be left as the default
Returns:
the vector used to create the translation component matrix

const nv::vec3f& NvInputTransformer::getTranslationVel ( NvCameraXformType::Enum  xform = NvCameraXformType::MAIN  )  [inline]

Get the current translation velocity.

Parameters:
[in] xform the index of the transform to be referenced. For all modes except DUAL_ORBITAL, this can be left as the default
Returns:
the current translation velocity in units per second

bool NvInputTransformer::isAnimating (  ) 

Query to determine if the current configuration of the controls is causing animation Can be used in on-demand redraw cases to determine whether continuous redraw is likely to be required.

Returns:
True if the current configuration should cause animation, false if the transforms are not changing

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::reset (  ) 

Reset.

Reset all input values to default/starting points, restoring initial view.

void NvInputTransformer::setMaxRotationVel ( float  maxVel,
NvCameraXformType::Enum  xform = NvCameraXformType::MAIN 
) [inline]

Set the current "max" rotation velocity.

Parameters:
[in] maxVel the current "max" rotation velocity (the velocity produced when the
[in] xform the index of the transform to be referenced. For all modes except DUAL_ORBITAL, this can be left as the default corresponding gamepad axis is at full lock) about each axis in radians per second

void NvInputTransformer::setMaxTranslationVel ( float  maxVel,
NvCameraXformType::Enum  xform = NvCameraXformType::MAIN 
) [inline]

Set the current "max" translation velocity.

Parameters:
[in] maxVel the current "max" translation velocity (the velocity produced when the
[in] xform the index of the transform to be referenced. For all modes except DUAL_ORBITAL, this can be left as the default 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,
NvCameraXformType::Enum  xform = NvCameraXformType::MAIN 
) [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
[in] xform the index of the transform to be referenced. For all modes except DUAL_ORBITAL, this can be left as the default

void NvInputTransformer::setRotationVel ( const nv::vec3f &  vec,
NvCameraXformType::Enum  xform = NvCameraXformType::MAIN 
) [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.
[in] xform the index of the transform to be referenced. For all modes except DUAL_ORBITAL, this can be left as the default

void NvInputTransformer::setScale ( const float  scale,
NvCameraXformType::Enum  xform = NvCameraXformType::MAIN 
) [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
[in] xform the index of the transform to be referenced. For all modes except DUAL_ORBITAL, this can be left as the default

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,
NvCameraXformType::Enum  xform = NvCameraXformType::MAIN 
) [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
[in] xform the index of the transform to be referenced. For all modes except DUAL_ORBITAL, this can be left as the default

void NvInputTransformer::setTranslationVel ( const nv::vec3f &  vec,
NvCameraXformType::Enum  xform = NvCameraXformType::MAIN 
) [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.
[in] xform the index of the transform to be referenced. For all modes except DUAL_ORBITAL, this can be left as the default

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: