Clipping a volume with a 3D object. More...
#include <VolumeViz/nodes/SoVolumeClippingGroup.h>
Public Types | |
typedef void | SoVolumeClippingGroupCB(SoVolumeClippingGroup *mgr, void *userData) |
Callback prototype. | |
Public Member Functions | |
virtual SoType | getTypeId () const |
Returns the type identifier for this specific instance. | |
SoVolumeClippingGroup () | |
Default constructor. | |
void | setNotEnoughPassCallback (SoVolumeClippingGroupCB *f, void *userData) |
Set a callback to be called when there are not enough passes (see numPasses) to properly apply the clipping. | |
Public Member Functions inherited from SoGroup | |
SoGroup () | |
Creates an empty group node. | |
SoGroup (int nChildren) | |
Constructor that takes approximate number of children. | |
virtual void | addChild (SoNode *child) |
Adds a child as last one in group. | |
virtual void | insertChild (SoNode *child, int newChildIndex) |
Adds a child so that it becomes the one with the given index. | |
virtual SoNode * | getChild (int index) const |
Returns pointer the child node with the given index. | |
virtual int | findChild (const SoNode *child) const |
Finds index of given child within group. | |
virtual int | getNumChildren () const |
Returns number of children. | |
virtual void | removeChild (int index) |
Removes child with given index from group. | |
virtual void | removeChild (SoNode *child) |
Removes first instance of given child from group. | |
virtual void | removeAllChildren () |
Removes all children from group. | |
virtual void | replaceChild (int index, SoNode *newChild) |
Replaces child with given index with new child. | |
virtual void | replaceChild (SoNode *oldChild, SoNode *newChild) |
Replaces first instance of given child with new child. | |
Public Member Functions inherited from SoNode | |
virtual void | setOverride (const SbBool state) |
Turns the override flag on or off. | |
virtual SbBool | isOverride () const |
Returns the state of the override flag. | |
virtual SoNode * | copy (SbBool copyConnections=FALSE) const |
Creates and returns an exact copy of the node. | |
virtual SbBool | affectsState () const |
Returns TRUE if a node has an effect on the state during traversal. | |
virtual void | touch () |
Marks an instance as modified, simulating a change to it. | |
Public Member Functions inherited from SoFieldContainer | |
void | setToDefaults () |
Sets all fields in this object to their default values. | |
SbBool | hasDefaultValues () const |
Returns TRUE if all of the object's fields have their default values. | |
SbBool | fieldsAreEqual (const SoFieldContainer *fc) const |
Returns TRUE if this object's fields are exactly equal to fc's fields. | |
void | copyFieldValues (const SoFieldContainer *fc, SbBool copyConnections=FALSE) |
Copies the contents of fc's fields into this object's fields. | |
SoNONUNICODE SbBool | set (const char *fieldDataString) |
Sets one or more fields in this object to the values specified in the given string, which should be a string in the Open Inventor file format. | |
SbBool | set (const SbString &fieldDataString) |
Sets one or more fields in this object to the values specified in the given string, which should be a string in the Open Inventor file format. | |
void | get (SbString &fieldDataString) |
Returns the values of the fields of this object in the Open Inventor ASCII file format in the given string. | |
virtual int | getFields (SoFieldList &list) const |
Appends references to all of this object's fields to resultList, and returns the number of fields appended. | |
virtual int | getAllFields (SoFieldList &list) const |
Returns a list of fields, including the eventIn's and eventOut's. | |
virtual SoField * | getField (const SbName &fieldName) const |
Returns a the field of this object whose name is fieldName. | |
virtual SoField * | getEventIn (const SbName &fieldName) const |
Returns a the eventIn with the given name. | |
virtual SoField * | getEventOut (const SbName &fieldName) const |
Returns the eventOut with the given name. | |
SbBool | getFieldName (const SoField *field, SbName &fieldName) const |
Returns the name of the given field in the fieldName argument. | |
SbBool | enableNotify (SbBool flag) |
Notification at this Field Container is enabled (if flag == TRUE) or disabled (if flag == FALSE). | |
SbBool | isNotifyEnabled () const |
Notification is the process of telling interested objects that this object has changed. | |
virtual void | setUserData (void *data) |
Sets application data. | |
void * | getUserData (void) const |
Gets user application data. | |
Public Member Functions inherited from SoBase | |
virtual SbName | getName () const |
Returns the name of an instance. | |
virtual void | setName (const SbName &name) |
Sets the name of an instance. | |
void | setSynchronizable (const bool b) |
Sets this to be a ScaleViz synchronizable object. | |
bool | isSynchronizable () const |
Gets the ScaleViz synchronizable state of this object. | |
Public Member Functions inherited from SoRefCounter | |
void | ref () const |
Adds a reference to an instance. | |
void | unref () const |
Removes a reference from an instance. | |
void | unrefNoDelete () const |
unrefNoDelete() should be called when it is desired to decrement the reference count, but not delete the instance if this brings the reference count to zero. | |
int | getRefCount () const |
Returns current reference count. | |
void | lock () const |
lock this instance. | |
void | unlock () const |
unlock this instance. | |
Public Member Functions inherited from SoTypedObject | |
SbBool | isOfType (const SoType &type) const |
Returns TRUE if this object is of the type specified in type or is derived from that type. | |
template<typename TypedObjectClass > | |
SbBool | isOfType () const |
Returns TRUE if this object is of the type of class TypedObjectClass or is derived from that class. | |
Static Public Member Functions | |
static SoType | getClassTypeId () |
Returns the type identifier for this class. | |
static unsigned int | getMaxNumPasses () |
Returns the maximum number of passes supported by the hardware. | |
Static Public Member Functions inherited from SoGroup | |
static SoType | getClassTypeId () |
Returns the type identifier for this class. | |
Static Public Member Functions inherited from SoNode | |
static SoType | getClassTypeId () |
Returns the type identifier for this class. | |
static SoNode * | getByName (const SbName &name) |
A node's name can be set using SoBase::setName(). | |
static int | getByName (const SbName &name, SoNodeList &list) |
A node's name can be set using SoBase::setName(). | |
Static Public Member Functions inherited from SoFieldContainer | |
static SoType | getClassTypeId () |
Returns the type of this class. | |
Static Public Member Functions inherited from SoBase | |
static SoType | getClassTypeId () |
Returns type identifier for this class. | |
Static Public Member Functions inherited from SoTypedObject | |
static SoType | getClassTypeId () |
Returns the type identifier for this class. | |
Public Attributes | |
SoSFInt32 | numPasses |
Number of passes used to do the clipping. | |
SoSFBool | clipOutside |
If TRUE, voxels inside the clipping object will be drawn, voxels outside will be clipped. | |
Public Attributes inherited from SoGroup | |
SoSFBool | boundingBoxIgnoring |
Whether to ignore this node during bounding box traversal. | |
Clipping a volume with a 3D object.
VolumeViz supports clipping a volume against any closed 3D polygonal shape defined by standard Open Inventor geometry. This is done using the SoVolumeClippingGroup node. Polygon clipping can remove the voxels outside the shape or the voxels inside the shape. Polygon clipping can be used in seismic applications to clip outside a fault block or geobody, in medical applications to cut away an arbitrary region, in core sample applications to apply cylindrical clipping and many other uses.
When this node is in the scene graph before a VolumeViz rendering node, all shapes under the SoVolumeClippingGroup will be used to clip the volume. These shapes will not be displayed.
The geometry defined under SoVolumeClippingGroup must represent a set of closed surfaces otherwise the result is unpredictable.
The clipping group may include transform nodes, e.g. SoTransform, to scale, rotate and translate the geometry. The transformed geometry will be used for clipping.
In general, do not put draggers or manipulators, e.g. SoTabBoxDragger, in the clipping group. The geometry of the dragger will also be used for clipping and the results may be unexpected. One exception is if the dragger is configured to use the clipping shape as "proxy" geometry (see SoInteractionKit::setPartAsPath()). A better solution is to put the dragger in the scene graph outside the clipping group, add a transform node to the clipping group and connect the fields of the dragger to the fields of the transform node (see SoField::connectFrom()).
The clipping result is based on the odd-winding rule, so the result is not simply the union or the intersection of the closed surfaces. If the goal is to define a clipping shape which is the result of the intersection/union of multiple closed surfaces, consider using the SoCSGShape node as a child of SoVolumeClippingGroup.
In some cases the number of passes specified may not be enough to clip correctly with the specified geometry. The numPasses field allows you to increase the clipping quality, for example when using shapes with a lot of concavity. To query the maximum allowed number of passes, which depends on your graphics card, use the static method getMaxNumPasses(). The setNotEnoughPassCallback() method allows the application to be notified when numPasses is not sufficient.
Standard clipplanes (see SoClipPlane) affect VolumeViz rendering nodes, but the VolumeViz specific clipping nodes generally provide better performance and allow much more complex clipping. Simple axis-aligned clipping can be done more efficiently using the SoROI node. The SoUniformGridClipping or SoUniformGridProjectionClipping nodes clip against height-field surfaces (e.g. seismic horizons). The SoVolumeMask node clips against a boolean mask volume on a per-voxel basis.
Notes:
When using a custom SoVolumeShader with this node and redefining the main() function, you must call VVizClipVoxel() in the main() function if you are writing a fragment shader. If you don't do this you will get a GLSL compilation error or clipping won't work.
Because this node uses special textures, all texture units between IVVR_FIRST_RESERVED_TEXTURE_UNIT (or SoFragmentShader::getMaxTextureImageUnit()-SoShaderProgram::getNumReservedTextures() if this variable is not set) and IVVR_FIRST_RESERVED_TEXTURE_UNIT-2 are reserved.
Because this node requires closed geometry, clipping planes (SoClipPlane) are automatically disabled when computing the clipping shape.
Clipping object | Clipping applied to a volume |
|
|
numPasses | 2 |
clipOutside | TRUE |
SoVolumeRender, SoUniformGridClipping, SoShaderProgram, SoVolumeRenderingQuality, SoVolumeIsosurface, SoCSGShape, SoPreferences
Definition at line 169 of file SoVolumeClippingGroup.h.
typedef void SoVolumeClippingGroup::SoVolumeClippingGroupCB(SoVolumeClippingGroup *mgr, void *userData) |
Callback prototype.
Definition at line 199 of file SoVolumeClippingGroup.h.
SoVolumeClippingGroup::SoVolumeClippingGroup | ( | ) |
Default constructor.
|
static |
Returns the type identifier for this class.
|
static |
Returns the maximum number of passes supported by the hardware.
|
virtual |
Returns the type identifier for this specific instance.
Reimplemented from SoGroup.
void SoVolumeClippingGroup::setNotEnoughPassCallback | ( | SoVolumeClippingGroupCB * | f, |
void * | userData | ||
) |
Set a callback to be called when there are not enough passes (see numPasses) to properly apply the clipping.
SoSFBool SoVolumeClippingGroup::clipOutside |
If TRUE, voxels inside the clipping object will be drawn, voxels outside will be clipped.
Default is TRUE. Note that if the VolumeClippingGroup is empty, setting clipOutside to TRUE will clip everything and setting it to FALSE will clip nothing.
Definition at line 191 of file SoVolumeClippingGroup.h.
SoSFInt32 SoVolumeClippingGroup::numPasses |
Number of passes used to do the clipping.
Increasing this number increases the image quality but decreases performance. Default is 2 and maximum is SoVolumeClippingGroup::getMaxNumPasses().
Definition at line 183 of file SoVolumeClippingGroup.h.