|
void | setGeometry (SoNode *wand, const SbVec3f &hotSpot) |
| Sets the inventor geometry used to display the wand in normal state, as well as the top of the wand. More...
|
|
void | setHighlightGeometry (SoNode *wand) |
| Sets the inventor geometry used to display the wand in highlighted state. More...
|
|
void | setWandScale (float scaleFactor) |
| Sets the scale factor applied to the wand geometry. More...
|
|
float | getWandScale () const |
| Returns the scale factor of the wand. More...
|
|
virtual void | setHighlight (bool enable) |
| Highlights the wand. More...
|
|
bool | getButton (int butIdx) const |
| Returns the current state of a button of the VR input device. More...
|
|
int | getButtonStatus () const |
| Returns the current combined state of all buttons of the VR input device. More...
|
|
bool | wasButtonPressed (int butIdx) const |
| Returns true if the specified button was pressed since the. More...
|
|
bool | wasButtonReleased (int butIdx) const |
| Returns true if the specified button was released since the scene graph was traversed the last time by the handle event action. More...
|
|
const SbVec3f & | origin (bool scene=true) const |
| Returns the origin of the 3D wand. More...
|
|
const SbVec3f & | top (bool scene=true) const |
| Returns the top of the 3D wand. More...
|
|
const SbRotation & | orientation (bool scene=true) const |
| Returns the current orientation of the wand. More...
|
|
float | length (bool scene=true) const |
| Returns the length of the wand. More...
|
|
const SbMatrix & | sceneXform () const |
| Returns the matrix which transforms between scene coordinates and VR coordinates, i.e., the coordinates used in the XScreen configuration file. More...
|
|
const SbMatrix & | sceneXformInverse () const |
| Returns the inverse of sceneXform(). More...
|
|
virtual void | update (const SbVec3f &pos, const SbRotation &rot, int butStat) |
| Updates the 3D wand position. More...
|
|
const SbVec3f & | getHotSpot () const |
| Returns the HotSpot. More...
|
|
Base class representing a 3D wand in XScreen.
If you are writing an event callback which reacts on VR events in the application, i.e., on SoTrackerEvent or SoControllerButtonEvent, you can access the wand thanks to the GET_WAND(e) macro:
SoTrackerEvent* e = (SoTrackerEvent*) action->getEvent();
or
SoControllerButtonEvent* e = (SoControllerButtonEvent*) action->getEvent();
You can then ask the wand for its current position or orientation. You can also highlight it in order to give some visual feedback.
In addition, the class provides the two methods sceneXform() and sceneXformInverse(). You can use these methods to convert between the physical coordinates used in an XScreen configuration file and the scene coordinates, e.g., the coordinates a data set is defined in.
const SbRotation& Hx3DWand::orientation |
( |
bool |
scene = true | ) |
const |
|
inline |
Returns the current orientation of the wand.
If scene
is true the orientation is reported relative to the scene coordinate system. Otherwise it is reported relative to the VR coordinate system, i.e., the coordinate system used in the XScreen configuration file. This method can be used to pick and move an object with the wand. In order to do so you need to remember the current wand top position and the current orientation at the time the interaction starts, i.e., when a wand button is pressed:
refRotInverse = wand->orientation().inverse();
refPos = wand->origin();
Then, when the wand position and orientation changes you can compute a transformation matrix as follows:
SbMatrix T1; T1.setTranslate(-refPos);
SbMatrix R; R.setRotate(refRotInverse*wand->orientation());
SbMatrix T2; T2.setTranslate(wand->origin());
SbMatrix deltaXform = T1*R*T2;
For a concrete example see the module MyVRDemo in the XScreen demo package.
- Parameters
-
scene | true for scene orientation, false for VR orientation |
- Returns
- The current orientation of the wand.
const SbVec3f& Hx3DWand::origin |
( |
bool |
scene = true | ) |
const |
|
inline |
Returns the origin of the 3D wand.
If scene
is true the origin is reported in scene coordinates, i.e., the value depends on the current viewing transformation. Otherwise the origin is reported in VR coordinates, i.e., in the same coordinate system used in the XScreen configuration file.
- Parameters
-
scene | true for scene coordinates, false for VR coordinates |
- Returns
- The origin
void Hx3DWand::setWandScale |
( |
float |
scaleFactor | ) |
|
Sets the scale factor applied to the wand geometry.
The wand geometry will be scaled by this factor. The factor allows you to adjust the size of the wand so that it matches the VR coordinates used in the current XScreen configuration file. For example, if your screen width is 200 (cm) and you are using a wand geometry with the hot spot at (0,0,-1), a wand scale factor of 100 makes the wand half as long as your screen
- Parameters
-
scaleFactor | The scale factor |
const SbVec3f& Hx3DWand::top |
( |
bool |
scene = true | ) |
const |
|
inline |
Returns the top of the 3D wand.
If scene
is true the top is reported in scene coordinates, i.e., the value depends on the current viewing transformation. Otherwise the top is reported in VR coordinates, i.e., in the same coordinate system used in the XScreen configuration file.
- Parameters
-
scene | true for scene coordinates, false for VR coordinates |
- Returns
- The top