Open Inventor Release 2024.2.0
 
Loading...
Searching...
No Matches
SoControllerButtonEvent Class Reference

VSG extension Controller button press and release event. More...

#include <Inventor/events/SoControllerButtonEvent.h>

+ Inheritance diagram for SoControllerButtonEvent:

Public Types

enum  Button {
  ANY = 0 ,
  BUTTON1 = 1 ,
  BUTTON2 = 2 ,
  BUTTON3 = 3
}
 Button. More...
 
- Public Types inherited from SoButtonEvent
enum  State {
  UP ,
  DOWN ,
  DBCLK ,
  UNKNOWN
}
 State. More...
 

Public Member Functions

virtual SoType getTypeId () const
 Returns the type identifier for this specific instance.
 
 SoControllerButtonEvent ()
 Constructor.
 
void setButton (SoControllerButtonEvent::Button b)
 Set which button generated the event.
 
SoControllerButtonEvent::Button getButton () const
 Get which button generated the event.
 
void setPosition3 (const SbVec3f &p)
 Set position of associated tracker in world coordinates.
 
const SbVec3fgetPosition3 () const
 Get position of associated tracker in world coordinates.
 
void setOrientation (float x, float y, float z)
 Set orientation value of associated tracker from Euler angles in radians (using the trackd convention Z*X*Y).
 
void setOrientation (SbRotation orientation)
 Set orientation value of associated tracker from an SbRotation.
 
void setOrientation (const SbVec3f &axis, float angle)
 Set orientation value of associated tracker from axis and angle in radians.
 
const SbRotationgetOrientation () const
 Get orientation of associated tracker as a standard Open Inventor rotation (quaternion).
 
const SbLine getRay () const
 Get a ray for picking/intersecting.
 
virtual const SbTrackerInfogetTrackerInfo () const
 Returns the SbTrackerInfo object.
 
virtual const SbTrackerInfotrackerInfo () const
 Get the SbTrackerInfo object.
 
virtual const SbTrackerInfogetTrackerInfo () const
 Gets whether an event object has associated tracker information.
 
SbTrackerInfogetTrackerInfo ()
 Gets whether an event object has associated tracker information.
 
- Public Member Functions inherited from SoButtonEvent
 SoButtonEvent ()
 Constructor.
 
void setState (SoButtonEvent::State s)
 Sets the state of the button.
 
SoButtonEvent::State getState () const
 Gets the state of the button.
 
- Public Member Functions inherited from SoEvent
 SoEvent ()
 Constructor.
 
virtual ~SoEvent ()
 Destructor.
 
virtual void setTime (SbTime t)
 Sets the time at which the event occurred.
 
SbTime getTime () const
 Gets the time at which the event occurred.
 
virtual void setPosition (const SbVec2s &p)
 Sets the window pixel location of the cursor when the event occurred.
 
virtual void setPosition (const SbVec2f &p)
 Float version of setPosition(const SbVec2s &p).
 
const SbVec2sgetPosition () const
 Returns the window pixel location of the cursor when the event occurred as integer values.
 
const SbVec2fgetPositionFloat () const
 Returns the window pixel location of the cursor when the event occurred as float values.
 
const SbVec2sgetPosition (const SbViewportRegion &vpRgn) const
 Gets the viewport pixel location of the cursor when the event occurred, relative to the origin of the specified viewport region, as integer values.
 
const SbVec2fgetPositionFloat (const SbViewportRegion &vpRgn) const
 Gets the viewport pixel location of the cursor when the event occurred, relative to the origin of the specified viewport region, as float values.
 
const SbVec2fgetNormalizedPosition (const SbViewportRegion &vpRgn) const
 Gets the normalized location of the cursor when the event occurred, relative to the specified viewport region.
 
void setShiftDown (SbBool isDown)
 Sets whether the shift key was down when the event occurred.
 
void setCtrlDown (SbBool isDown)
 Sets whether the CTRL key was down when the event occurred.
 
void setAltDown (SbBool isDown)
 Sets whether the ALT key was down when the event occurred.
 
void setButton1Down (SbBool isDown)
 Sets whether mouse Button 1 was down when the event occurred.
 
SbBool wasShiftDown () const
 Returns true if the shift key was down when the event occurred.
 
SbBool wasCtrlDown () const
 Returns true if the CTRL key was down when the event occurred.
 
SbBool wasAltDown () const
 Returns true if the ALT key was down when the event occurred.
 
SbBool wasButton1Down () const
 Returns true if mouse button 1 was down when the event occurred.
 
SbTrackerInfogetTrackerInfo ()
 Gets whether an event object has associated tracker information.
 
- Public Member Functions inherited from SoTypedObject
SbBool isOfType (const SoType &type) const
 Returns TRUE if this object is of the type specified in type or is derived from that type.
 
template<typename TypedObjectClass >
SbBool isOfType () const
 Returns TRUE if this object is of the type of class TypedObjectClass or is derived from that class.
 

Static Public Member Functions

static SoType getClassTypeId ()
 Returns the type identifier for this class.
 
static SbBool isButtonPressEvent (const SoEvent *e, SoControllerButtonEvent::Button whichButton)
 Convenience function to see if an SoEvent is a press of the passed mouse button.
 
static SbBool isButtonReleaseEvent (const SoEvent *e, SoControllerButtonEvent::Button whichButton)
 Convenience function to see if an SoEvent is a release of the passed mouse button.
 
- Static Public Member Functions inherited from SoButtonEvent
static SoType getClassTypeId ()
 Returns the type identifier for this class.
 
- Static Public Member Functions inherited from SoEvent
static SoType getClassTypeId ()
 Returns the type id for the SoEvent class.
 
- Static Public Member Functions inherited from SoTypedObject
static SoType getClassTypeId ()
 Returns the type identifier for this class.
 

Detailed Description

VSG extension Controller button press and release event.

SoControllerButtonEvent represents controller button press and release events in the Open Inventor event model. A controller device generally has associated 3D tracker information.

A "tracker" is any device whose position and orientation are dynamically tracked in 3D, typically for immersive VR applications. For example: a head tracker. A "controller" is an input device which typically has buttons and/or valuators (e.g. a joystick). Many controllers have an associated tracker. For example, the commonly used "wand" input device has three buttons, a two-axis joystick (two valuators), and an associated tracker.

The virtual method SoEvent::getTrackerInfo() can be used to determine if an event object has associated tracker information. Traditional 2D events like SoMouseButtonEvent and SoLocation2Event return NULL. 3D events like SoTrackerEvent and SoControllerButtonEvent return a their associated tracker information (SbTrackerInfo).

Many controller devices generate a continuous stream of data, so strictly speaking there are no "events". However Open Inventor classes that recognize the SoControllerButtonEvent interpret it as notification of a change in the button state (press or release). The application (or other software above Open Inventor) is responsible for deciding when to actually create an SoControllerButtonEvent.

Some convenience macros for determining if an event matches

  • SO_CONTROLLER_PRESS_EVENT(EVENT,BUTTON)
  • SO_CONTROLLER_RELEASE_EVENT(EVENT,BUTTON)

SEE ALSO

SbTrackerInfo, SoEvent, SoTrackerEvent

Definition at line 82 of file SoControllerButtonEvent.h.

Member Enumeration Documentation

◆ Button

Button.

Enumerator
ANY 
BUTTON1 

Controller button 1.

BUTTON2 

Controller button 2.

BUTTON3 

Controller button 3.

Definition at line 89 of file SoControllerButtonEvent.h.

Constructor & Destructor Documentation

◆ SoControllerButtonEvent()

SoControllerButtonEvent::SoControllerButtonEvent ( )

Constructor.

Member Function Documentation

◆ getButton()

SoControllerButtonEvent::Button SoControllerButtonEvent::getButton ( ) const
inline

Get which button generated the event.

Definition at line 120 of file SoControllerButtonEvent.h.

◆ getClassTypeId()

static SoType SoControllerButtonEvent::getClassTypeId ( )
static

Returns the type identifier for this class.


◆ getOrientation()

const SbRotation & SoControllerButtonEvent::getOrientation ( ) const
inline

Get orientation of associated tracker as a standard Open Inventor rotation (quaternion).

Definition at line 157 of file SoControllerButtonEvent.h.

◆ getPosition3()

const SbVec3f & SoControllerButtonEvent::getPosition3 ( ) const
inline

Get position of associated tracker in world coordinates.

Definition at line 131 of file SoControllerButtonEvent.h.

◆ getRay()

const SbLine SoControllerButtonEvent::getRay ( ) const
inline

Get a ray for picking/intersecting.

This is a convenience function.

Definition at line 163 of file SoControllerButtonEvent.h.

◆ getTrackerInfo() [1/3]

SbTrackerInfo * SoEvent::getTrackerInfo ( )
inline

Gets whether an event object has associated tracker information.

Definition at line 262 of file SoEvent.h.

◆ getTrackerInfo() [2/3]

virtual const SbTrackerInfo * SoEvent::getTrackerInfo ( ) const
inlinevirtual

Gets whether an event object has associated tracker information.

Reimplemented from SoEvent.

Definition at line 255 of file SoEvent.h.

◆ getTrackerInfo() [3/3]

virtual const SbTrackerInfo * SoControllerButtonEvent::getTrackerInfo ( ) const
inlinevirtual

Returns the SbTrackerInfo object.

Can be used as a quick check if an SoEvent has tracker info associated with it.

Reimplemented from SoEvent.

Definition at line 176 of file SoControllerButtonEvent.h.

◆ getTypeId()

virtual SoType SoControllerButtonEvent::getTypeId ( ) const
virtual

Returns the type identifier for this specific instance.

Reimplemented from SoButtonEvent.

◆ isButtonPressEvent()

static SbBool SoControllerButtonEvent::isButtonPressEvent ( const SoEvent e,
SoControllerButtonEvent::Button  whichButton 
)
static

Convenience function to see if an SoEvent is a press of the passed mouse button.

◆ isButtonReleaseEvent()

static SbBool SoControllerButtonEvent::isButtonReleaseEvent ( const SoEvent e,
SoControllerButtonEvent::Button  whichButton 
)
static

Convenience function to see if an SoEvent is a release of the passed mouse button.

◆ setButton()

void SoControllerButtonEvent::setButton ( SoControllerButtonEvent::Button  b)
inline

Set which button generated the event.

Definition at line 116 of file SoControllerButtonEvent.h.

◆ setOrientation() [1/3]

void SoControllerButtonEvent::setOrientation ( const SbVec3f axis,
float  angle 
)
inline

Set orientation value of associated tracker from axis and angle in radians.

Definition at line 150 of file SoControllerButtonEvent.h.

◆ setOrientation() [2/3]

void SoControllerButtonEvent::setOrientation ( float  x,
float  y,
float  z 
)
inline

Set orientation value of associated tracker from Euler angles in radians (using the trackd convention Z*X*Y).

Definition at line 138 of file SoControllerButtonEvent.h.

◆ setOrientation() [3/3]

void SoControllerButtonEvent::setOrientation ( SbRotation  orientation)
inline

Set orientation value of associated tracker from an SbRotation.

Definition at line 144 of file SoControllerButtonEvent.h.

◆ setPosition3()

void SoControllerButtonEvent::setPosition3 ( const SbVec3f p)
inline

Set position of associated tracker in world coordinates.

Definition at line 125 of file SoControllerButtonEvent.h.

◆ trackerInfo()

virtual const SbTrackerInfo & SoControllerButtonEvent::trackerInfo ( ) const
inlinevirtual

Get the SbTrackerInfo object.

Definition at line 182 of file SoControllerButtonEvent.h.


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