SPIN Framework
Public Types | Public Member Functions | Protected Member Functions

spin::PointerNode Class Reference

An interaction node that reports intersections with other nodes in the scene (only those that are have interactionMode > 0) More...

#include <PointerNode.h>

Inheritance diagram for spin::PointerNode:
spin::RayNode spin::GroupNode spin::ReferencedNode

List of all members.

Public Types

enum  GrabMode { ORIENTATION_LOCK, RELATIVE }

Public Member Functions

 PointerNode (SceneManager *sceneManager, const char *initID)
virtual void callbackUpdate (osg::NodeVisitor *nv)
GroupNodegetNodeFromIntersections (int index)
osgManipulator::Dragger * getDraggerFromIntersections ()
void manipulate (int b)
int getManipulate () const
void lockToTarget (const char *nodeToLock)
void setManipulator (const char *manipulatorType)
void setGrabMode (GrabMode mode)
int getGrabMode () const
void grab (int b)
void translateOnPointer (float f)
void rotateOnPointer (float f)
int getGrab () const
virtual std::vector< lo_message > getState () const

Protected Member Functions

void applyManipulation (osg::Matrix mat, osg::Vec3 start, osg::Vec3 end)
void applyGrab (osg::Matrix mat)
void reportIntersections ()

Detailed Description

An interaction node that reports intersections with other nodes in the scene (only those that are have interactionMode > 0)

PointerNode reports a list of all nodes with which the ray is intersecting (in order of closest to furthest). It can also be used to grab and manipulate nodes. The grabber allows the first node to be "grabbed" and moved around, while the manipulate method checks the intersection for draggers in the scene and invokes a motion command on a dragger.


Member Function Documentation

void spin::PointerNode::applyManipulation ( osg::Matrix  mat,
osg::Vec3  start,
osg::Vec3  end 
) [protected]

Checks intersections for draggers and if so, we apply the drag events

void spin::PointerNode::callbackUpdate ( osg::NodeVisitor *  nv) [virtual]

For nodes that require regular programmatic control, there is a callback that is evaluated with every refresh. This function can thus be used for animations, or any other periodic updates.

Note that changes to the scene graph structure (eg, moving/deleting nodes should NOT be done within this callback because traversals stacks will become corrupted. The technique is rather to enable a flag and then do the actual change in the SceneManager::updateGraph() method.

Reimplemented from spin::GroupNode.

osgManipulator::Dragger * spin::PointerNode::getDraggerFromIntersections ( )

return the first dragger in the intersection list

int spin::PointerNode::getGrab ( ) const [inline]
Returns:
Whether there is a valid node that is currently 'grabbed'
GroupNode * spin::PointerNode::getNodeFromIntersections ( int  index)

Get the first GroupNode encountered with interaction mode greater than passthru

std::vector< lo_message > spin::PointerNode::getState ( ) const [virtual]

For each subclass of ReferencedNode, we override the getState() method to fill the vector with the correct set of methods for this particular node

Reimplemented from spin::RayNode.

void spin::PointerNode::grab ( int  b)

The grab method selects the closest intersected node and temporarily attaches it to the pointer, allowing it to inherit any translation or rotation offsets.

Notes:

  • Only nodes derived from GroupNode can be grabbed.
  • If no node is intersected, the grab won't do anything.
  • The node is re-attached to it's original parent when released, so don't delete the parent in the meantime
Parameters:
bA boolean grab indicator (1 to grab, 0 to release)
void spin::PointerNode::lockToTarget ( const char *  nodeToLock)

This looks to see if there is a node being pointed at, and if so, it tells the nodeToLock to lock it's orientation to always point at that target. Useful for cameras.

void spin::PointerNode::manipulate ( int  b)
void spin::PointerNode::reportIntersections ( ) [protected]

Reports the list of intersected nodes (server-side only)

void spin::PointerNode::rotateOnPointer ( float  f)

Rotates the currently grabbed node (if there is one) around the pointer axis.

Parameters:
fThe amount by which to rotate around the pointer ray (in degrees)
void spin::PointerNode::setGrabMode ( GrabMode  mode)

Set the OrientationMode of the node, which will be applied after every transformation.

void spin::PointerNode::setManipulator ( const char *  manipulatorType) [virtual]

We can call setManipulator and pass the name of a dragger, and the pointer will enable the dragger on the current GroupNode that it is currently pointing at. If the pointer is not intersecting with any node, this will set the dragger on the last manipulated node; this was found to be a desired behaviour instead of constantly ensuring an intersection whenever the user wanted to use a different manipulator.

Reimplemented from spin::GroupNode.

void spin::PointerNode::translateOnPointer ( float  f)

Slides the currently grabbed node (if there is one) along the pointer axis (ie, increasing or decreasing the distance).

Parameters:
fThe amount by which to slide (positive values slide the attached node AWAY from the pointer

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