boxClip DSO

This DSO is under development.

Introduction

The boxClip DSO clips world node objects ot an axis-aligned box that can be changed in real time.

What it is

The boxClip DSO uses GL calls in the preDraw callback attached to the "world" node to clip all objects under the world node against a 3D box. The box can change for each frame.

Here is an example of the boxClip DSO being used in conjunction with the rubberbandBox DSO. All of the data outside of the smaller box is being clipped out.

How to use it

The coordinates of the 3D box are obtained from an area of memory pointed to by a pointer provided by a call to getRubberbandBoxPtr(). This call is currently only provided by the rubberbandBox DSO; see the rubberbandBox DSO documentation. These coordinates are obtained every frame during the postFrame callback. Note that this scheme results in some problems associated with frame accuracy (synchronization).

Note that the boxCull DSO is designed to be used in conjunction with the boxClip DSO in order to enhance performance. The boxCull DSO should be used when applying clipping to models with many polygons.

Example

Here is a fragment of a shell script for running savgfly (diversifly) using this DSO. It actually uses a collection of DSOs working together: rubberbandBox, slb, boxClip, boxCull, and noClipWorldNode.

 
   export SLB_1="rubberbandBoxButton"

   export DF_DSO=":noClipWorldNode:slb:rubberbandBox:boxClip:boxCull"

   savgfly -$device box.savg  P01.sge

The slb DSO will put button presses for wand button 1 into the dtk shared memory named rubberbandBoxButton, which is where the DSO rubberbandBox will look for it. The rubberbandBox DSO will display its wireframe model of the box under the noClip scene graph node because the noClipWorldNode DSO has been loaded.

The boxClip and boxCull DSOs will pick up the box coordinates by calling a routine provided by the rubberbandBox DSO.

In this example the file P01.sge looks like this:
 
    LOAD hugeModel.pfb bigNode
    ON P01 world

When the shell script is run, the models in box.savg and hugeModel.pfb are displayed and are clipped to the 3D box generated by rubberbandBox. The user can interactive change the box using the wand position and button 1 on the wand.

If the model in the file hugeModel.pfb is causing performance to be too slow, the user can issue the shell command:


    dtk-writeLine BoxCullCmdShm 1000 "cull bigNode"

to apply culling to that object. This puts the string "cull bigNode" into dtk shared memory where it will be read and acted upon by the boxCull DSO. Of course, this shell command could also be issued indirectly by a mechanism like a menu selection.

See also

DSOs: boxCull, rubberbandBox, boxVolSlice


Last revision: John Hagedorn, May 9, 2005