#include <SculptDemoApp.h>
Inheritance diagram for SculptDemoApp:
Public Member Functions | |
SculptDemoApp (int, char **) | |
Constructor takes parameters from the command line. | |
virtual | ~SculptDemoApp () |
Destuctor cleans up memory. | |
SbBox3f | getWorkspaceSize () |
Get the PHANToM's physical workspace size. | |
void | setPhantomOffset (const SbVec3f &) |
Set the PHANToM offset from the CAVE origin. | |
void | addIVFile (char *filename) |
Observer update method is triggered when notified by Subjects. | |
CAVE-related template method callbacks | |
virtual void | buildScene () |
Builds the Inventor and GHOST scene graphs. | |
int | hasOne (float xmin, float ymin, float zmin, float xmax, float ymax, float zmax, int size) |
void | loadFile (char *filename, int siz) |
void | makeCubes (int, int, SbVec3f) |
void | addCube (SbVec3f cur, SbVec3f cen, float size, SculptCube *node, float rad) |
void | reloadOctree () |
void | buildOctree (SbVec3f cen, float size, SculptCube *node, float orgsize) |
void | modifyCube (SbVec3f cur, SbVec3f center, float size, SculptCube *octSculpt, float rad, int flag) |
void | modifyCube (SbVec3f cur, SbVec3f center, float summa, float size, SculptCube *octSculpt) |
void | modifyCuboid (SbVec3f cur, SbVec3f center, float xsize, float ysize, float zsize, SculptCube *octSculpt) |
void | modifyOctree () |
void | deleteOctree (SculptCube *) |
void | modifyOctree (SculptCube *) |
void | sculptSphere (SbBox3f bounds, float rad, SbVec3f curr, float size, SculptCube *node) |
void | loadOctree (char *filename) |
void | loadOctree (SculptCube *, SoTransformSeparator *) |
virtual void | frameUpdate () |
Once-per-frame update will trigger GHOST notification. | |
virtual void | update () |
Update method called from main will check the stylus button. | |
virtual void | handleEvents () |
virtual void | update (Subject *) |
Static Public Member Functions | |
static void | PointerGraphicCB (gstTransform *, void *, void *) |
Callback copies the PHANToM transform to the pointer graphics. | |
static void | HapticTransformCB (gstTransform *nodePtr, void *callbackData, void *userData) |
static void | triangle_cb (void *userdata, SoCallbackAction *action, const SoPrimitiveVertex *v1, const SoPrimitiveVertex *v2, const SoPrimitiveVertex *v3) |
Public Attributes | |
SbBox3f | m_defectBounds |
SbBox3f | m_implantBounds |
SbBox3f | m_toolBounds |
Protected Types | |
enum | SCULPTTools { TRANSLATE_TOOL = 0, ROTATE_TOOL, SCULPT_TOOL, ADDITION_TOOL, RELOAD, RECONSTRUCT, NUM_SCULPT_TOOLS } |
Protected Attributes | |
SoGroup * | m_toolGroup |
SoAsciiText * | m_toolNameText |
SoSwitch * | m_wandSwitch |
CrWandController * | m_wand |
CrGrabberTool * | m_wandPointer |
bool | m_canTranslate |
Whether or not use of the translation manipulator is enabled. | |
bool | m_canRotate |
Whether or not use of the rotation manipulator is enabled. | |
int | m_stylusButtonOn |
Current status of the PHANToM stylus button. | |
int | m_currentTool |
SbString | m_defectFilename |
SoSwitch * | m_hapSwitch |
SoGroup * | m_defectGroup |
IVFile * | m_defectMesh |
SoSwitch * | m_defectSwitch |
SoSeparator * | m_defectSep |
SoTransform * | m_defectFitTransform |
SoTransform * | m_defectTransform |
gstSeparator * | m_hapFitSeparator |
SoSeparator * | catchSeparator |
gstSeparator * | hapdefectSep |
float | defw |
float | defh |
float | defd |
SoSphere * | ptr |
Inventor scene graph elements | |
SoSeparator * | m_ghostSep |
Separator under which the haptic scene is contained. | |
SoSeparator * | newCubeSep |
Separator under which the haptic scene is contained. | |
SoTransformSeparator * | rootOIVSep |
SoTransform * | m_phantomOffset |
Transform of the PHANToM device offset from the CAVE origin. | |
SoTransform * | m_phantomTransform |
Transform representing the PHANToM. | |
GHOST scene graph elements | |
gstScene * | m_hapScene |
GHOST scene graph. | |
gstSeparator * | m_hapRoot |
GHOST scene graph root node. | |
gstSeparator * | m_hapCube |
GHOST scene graph root node. | |
gstSeparator * | m_tempHapRoot |
GHOST scene graph root node. | |
gstSeparator * | rootGHOSTSep |
GHOST scene graph root node. | |
gstPHANToM * | m_phantom |
GHOST PHANToM device instance. | |
gstPHANToM_SCP * | m_phantomSCP |
PHANToM surface contact point. | |
gstTranslateManipulator * | m_translateManip |
GHOST dynamic translation manipulator. | |
gstRotateManipulator * | m_rotateManip |
GHOST dynamic rotation manipulator. | |
SbBox3f | m_workspaceSize |
Box storing the available PHANToM workspace size. | |
gstPoint | currentPosition |
gstPoint | previousPosition |
int | csSize |
float | csize |
SculptCube * | tempCube |
int | nurbed |
int | sculptFlag |
float | maxsize |
int | autoSculpt |
SculptConfig * | m_config |
unsigned char *** | buffer3d |
|
|
|
Constructor takes parameters from the command line. The application constructor initializes several nodes and other variables. The PHANToM instance is initialized here and checked to make sure that a valid construction took place. The initial elements of the GHOST scene graph are created here. Once the PHANToM has been initialized, it is queried to determine the workspace size, and that size is stored for use when constructing the Inventor scene.
|
|
Destuctor cleans up memory. When the application has finished running, it's important to stop the haptic servo loop. The destructor also dumps the Inventor scene graph to a file for debugging purposes. This makes it easy to check the construction of the scene graph. |
|
|
|
Observer update method is triggered when notified by Subjects.
|
|
|
|
Builds the Inventor and GHOST scene graphs. The base OIVAppShell implementation does not create any scene graph nodes to place into the scene. The Inventor graphics are constructed first. A PointLight provides illumination. A Separator is used to localize all haptic elements under a single sub-tree of the scene graph. The details of the scene graph are described in the source code. Reimplemented from OIVAppShell. |
|
|
|
Once-per-frame update will trigger GHOST notification.
Reimplemented from OIVAppShell. |
|
Get the PHANToM's physical workspace size.
|
|
Called once per cycle of the main loop, this function handles checking the PHANToM stylus to manage the use of the translation manipulator. It controls the logic for starting and stopping the manipulator. Reimplemented from OIVAppShell. |
|
Each time the GHOST graphics update is called, this function will copy the PHANToM transform to a passed node.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Callback copies the PHANToM transform to the pointer graphics.
|
|
|
|
|
|
Set the PHANToM offset from the CAVE origin. The origin of the PHANToM work area must be measured from the origin of the CAVELib. This offset is the magic element which makes the haptics appear aligned with the rendering. If this offset is significantly displaced, the misalignment will be clearly evident to the user. This example code merely demonstrates how this offset must be placed into the scene graph. A more robust implementation should provide an interactive method for measuring and adjusting this offset.
|
|
|
|
The Observer Pattern provides a very easy way to update one object as a result of notification sent by another. The Observer is attached to a Subject object. At some point during execution, Subject::notify() will trigger this method. This state of the subject must be pulled by performing a cast and checking for the appropriate information. In this case, the check must determine whether or not the Subject is being touched by the PHANToM. The purpose is to set the m_canTranslate flag as appropriate.
Implements Observer. |
|
Update method called from main will check the stylus button. Called once per cycle of the main loop, this function handles checking the PHANToM stylus to manage the use of the translation manipulator. It controls the logic for starting and stopping the manipulator. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Whether or not use of the rotation manipulator is enabled.
|
|
Whether or not use of the translation manipulator is enabled.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Separator under which the haptic scene is contained.
|
|
GHOST scene graph root node.
|
|
|
|
GHOST scene graph root node.
|
|
GHOST scene graph.
|
|
|
|
|
|
GHOST PHANToM device instance.
|
|
Transform of the PHANToM device offset from the CAVE origin.
|
|
PHANToM surface contact point.
|
|
Transform representing the PHANToM.
|
|
GHOST dynamic rotation manipulator.
|
|
Current status of the PHANToM stylus button.
|
|
GHOST scene graph root node.
|
|
|
|
|
|
|
|
GHOST dynamic translation manipulator.
|
|
|
|
|
|
|
|
Box storing the available PHANToM workspace size.
|
|
|
|
Separator under which the haptic scene is contained.
|
|
|
|
|
|
|
|
GHOST scene graph root node.
|
|
|
|
|
|
|