#include <NurbsBall.h>
Inheritance diagram for NurbsBall:
Public Member Functions | |
NurbsBall () | |
Default constructor creates nodes with default values. | |
NurbsBall (SculptNurbs *sn, int) | |
virtual | ~NurbsBall () |
Destructor dereferences all nodes. | |
SoTransformSeparator * | getOIVNode () |
Returns the Open Inventor separator containing the sphere. | |
gstSeparator * | getGHOSTNode () |
Returns the GHOST separator containing the touchable sphere. | |
int | isTouched () |
Returns whether or not the ball is being touched by the PHANToM. | |
void | setDiffuseColor (const SbVec3f &) |
Sets the color of the sphere. | |
void | updatePoint (int index, SbVec3f trans) |
void | setRadius (const float &) |
Sets the radius of the sphere. | |
void | setIndexVal (int i) |
void | setTransform (const SbMatrix &) |
Sets the transform for the object. | |
void | setTransparency (const float &) |
Sets the transparency for the ball. | |
Static Public Member Functions | |
static void | EventCB (gstTransform *, void *, void *) |
GHOST event callback is called when the shape is touched. | |
static void | GraphicCB (gstTransform *, void *, void *) |
GHOST graphic callback copies transform to Inventor graphics nodes. | |
Public Attributes | |
int | indexval |
Protected Attributes | |
Inventor scene nodes | |
SculptNurbs * | parent |
SoMaterial * | material |
Material node for the ball's appearance. | |
SoTransformSeparator * | separator |
Separator under which the ball is placed. | |
SoSphere * | sphere |
Sphere node representing the ball itself. | |
SoMatrixTransform * | transform |
Current transform for the ball. | |
GHOST API scene nodes | |
gstSeparator * | hapticSeparator |
GHOST separator containing the ball. | |
gstSphere * | hapticSphere |
GHOST sphere geometry node. |
|
Default constructor creates nodes with default values.
|
|
The constructor must allocate memory for all internal scene graph nodes used by an NurbsBall instance. It creates the Inventor material, separator, sphere, and transform nodes and calls ref() on each of them. The GHOST hapticSeparator and hapticSphere nodes are created here as well. The separators for each scene graph are assembled with all required children. |
|
Destructor dereferences all nodes. The important thing to keep in mind for any destructor is that Inventor uses a references counting scheme to manage when nodes should be cleaned up. GHOST does not have this automatic management scheme, but when delete is called on a gstScene, all nodes in that scene should be properly destroyed (this according to the support people at SensAble). |
|
GHOST event callback is called when the shape is touched. The event callback is triggered to signal when the ball object has been touched. Touching objects triggers a gstEvent with information specific to the gstShape which was touched. This callback is called when the gstScene::updateEvents() is called.
|
|
Returns the GHOST separator containing the touchable sphere.
|
|
Returns the Open Inventor separator containing the sphere.
|
|
GHOST graphic callback copies transform to Inventor graphics nodes. The graphics callback is triggered to manually copy a GHOST transformation matrix into an Inventor matrix. The Inventor node should be passed as an argument. The callback simply gets the current GHOST matrix and copied it into an Inventor SbMatrix structure. That new matrix is applied to the passed SoTransform node.
|
|
Returns whether or not the ball is being touched by the PHANToM. Because the Observer Pattern is used to send notifications when the ball is touched by the PHANToM, this method is used for querying the state of the ball within the context of that notification. The query is to determine whether or not the ball is being touched. The result is determined by using gstShape::isInContact().
|
|
Sets the color of the sphere. The current lighting model uses the standard Inventor Material node. Different colors may be specified for diffuse, ambient, and specular lightning. This method sets only the ball's material's diffuse color.
|
|
|
|
Sets the radius of the sphere. It is important to make sure that the objects have identical representations in both scene graphs. This method will set the radius values for both the Inventor and GHOST spheres.
|
|
Sets the transform for the object. Just as the sphere radius must be consistent across the scene graphs, so must the transformation matrix. Because the representation for Inventor's matrix class is easier to work with, it is used as the base type. This method will internally convert it to a gstTransformMatrix for application within the GHOST scene graph.
|
|
Sets the transparency for the ball. One component of an Inventor material node is the transparency. This method will set the transparency value for the balls' Material node.
|
|
|
|
GHOST separator containing the ball.
|
|
GHOST sphere geometry node.
|
|
|
|
Material node for the ball's appearance.
|
|
|
|
Separator under which the ball is placed.
|
|
Sphere node representing the ball itself.
|
|
Current transform for the ball.
|