SPIN Framework
|
Represents a user in the scene. More...
#include <UserNode.h>
Public Member Functions | |
UserNode (SceneManager *sceneManager, const char *initID) | |
virtual void | callbackUpdate (osg::NodeVisitor *nv) |
virtual void | updateNodePath (bool updateChildren) |
void | setDescription (const char *s) |
const char * | getDescription () const |
osg::PositionAttitudeTransform * | getCameraAttachmentNode () const |
osg::PositionAttitudeTransform * | getCameraOffsetNode () const |
void | setHome (float x, float y, float z, float pitch, float roll, float yaw) |
void | goHome () |
void | setCameraOffset (float x, float y, float z) |
osg::Vec3 | getCameraOffset () const |
void | setCameraOrientation (float pitch, float roll, float yaw) |
osg::Vec3 | getCameraOrientation () const |
void | setCameraOrientationQuat (float x, float y, float z, float w) |
osg::Quat | getCameraOrientationQuat () const |
void | ping () |
osg::Timer_t | getLastPing () const |
virtual std::vector< lo_message > | getState () const |
Public Attributes | |
bool | nodepathUpdate |
Represents a user in the scene.
This class is used to differentiate users from scene content. its main use is to control a camera for viewing the scene The subgraph may contain:
It is important to note that anything attached to a UserNode's subgraph will not be saved with the scene.
void spin::UserNode::callbackUpdate | ( | osg::NodeVisitor * | nv | ) | [virtual] |
The UserNode needs an update callback to check if ping messages are still being received. If not, the node and it's subgraph should be removed. Please note that if the user node NEVER sends a ping, not even once, then it will be excluded from this obligation.
Reimplemented from spin::ConstraintsNode.
osg::PositionAttitudeTransform* spin::UserNode::getCameraAttachmentNode | ( | ) | const [inline] |
This is where you attach cameras for the user.
The standard ViewerManipulator for SPIN derives from OSG's NodeTrackerManipulator, which tracks (points to) the center of a subgraph's bounding sphere. We want to keep that bound empty so that we may effectively place the camera right at the UserNode's location. If we attach geometry under this, the camera will point at the center of that geometry instead.
const char* spin::UserNode::getDescription | ( | ) | const [inline] |
Returns a string containing the user-entered description for this node.
osg::Timer_t spin::UserNode::getLastPing | ( | ) | const [inline] |
Returns the timestamp of the last ping in unsigned long long format.
std::vector< lo_message > spin::UserNode::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::ConstraintsNode.
void spin::UserNode::goHome | ( | ) |
Send the user to his (or her) home position
void spin::UserNode::ping | ( | ) |
Pings the server.
void spin::UserNode::setCameraOffset | ( | float | x, |
float | y, | ||
float | z | ||
) |
Set the camera offset (from the UserNode's local origin). The default is (0,0,0), meaning that the camera position is exactly aligned with the UserNode.
void spin::UserNode::setCameraOrientation | ( | float | pitch, |
float | roll, | ||
float | yaw | ||
) |
Set's the (local) orientation of the camera. The default is looking along the +Y axis with +Z up and +X to the right.
void spin::UserNode::setCameraOrientationQuat | ( | float | x, |
float | y, | ||
float | z, | ||
float | w | ||
) |
Provides a mechanism to set the orientation with a quaternion
void spin::UserNode::setDescription | ( | const char * | s | ) |
Sets a user-entered description for the node.
void spin::UserNode::setHome | ( | float | x, |
float | y, | ||
float | z, | ||
float | pitch, | ||
float | roll, | ||
float | yaw | ||
) |
The home position is the pose that the user returns to when sent home
void spin::UserNode::updateNodePath | ( | bool | updateChildren | ) | [virtual] |
The UserNode is used by OSG's NodeTrackerManipulator to position a camera for the user. However, NodeTrackerManipulator doesn't check if the nodepath has changed, so we override updateNodePath() and set a nodepathUpdate flag for the manipulator to see.
Reimplemented from spin::GroupNode.