Split large geometry into smaller objects to improve culling for multi-pipe rendering. More...
#include <Inventor/actions/SoSplitGeometryAction.h>
Public Member Functions | |
virtual SoType | getTypeId () const |
SoSplitGeometryAction (int divAlongX, int divAlongY) | |
SoSplitGeometryAction (int divAlongX, int divAlongY, int divAlongZ) | |
void | setNumDivisions (int numX, int numY) |
void | setNumDivisions (int numX, int numY, int numZ) |
void | getNumDivisions (int &numX, int &numY) |
void | getNumDivisions (int &numX, int &numY, int &numZ) |
void | setDistinguishSplitParts (SbBool enable) |
SbBool | isDistinguishSplitParts (void) |
int | getNumObjFound (void) |
void | setKeepOriginalGeometry (SbBool enable) |
SbBool | isKeepOriginalGeometry (void) |
void | setSmartSplitting (SbBool enable) |
SbBool | isSmartSplitting (void) |
void | setTraverseAllSoSwitchChildren (SbBool enable) |
int | isTraverseAllSoSwitchChildren (void) |
void | setMaximumDivisionWarning (SbBool enable) |
void | setMaintainVertexOrdering (SbBool enable) |
SbBool | isMaintainVertexOrdering (void) |
virtual void | apply (SoNode *node) |
virtual void | apply (SoPath *path) |
virtual void | apply (const SoPathList &path_list, SbBool obeys_rules=FALSE) |
Static Public Member Functions | |
static SoType | getClassTypeId () |
static void | setSplitGeometryActionPreCB (SoSplitGeometryActionCB *, void *) |
View frustum culling, for example using the SoOctreeOrdering node, is an important optimization, especially for multi-pipe rendering. However, a large object implemented as a single geometry node cannot be effectively culled. For each pipe where the object is partially visible, the entire object must be rendered.
This action splits a large object into multiple geometry nodes, without changing the appearance of the object. Culling can then applied to the new nodes individually.
The scene does not need to be subdivided into a large number of parts. Usually, 5 by 5 is enough to reasonably divide work between the threads. The new objects use the same vertex coordinates (and normals, materials,... if specified) as the original geometry. No triangles are added, removed, or split. A small amount of additional memory is required for the coordinate indices in the new objects.
Note: Currently this action applies only to SoIndexedFaceSet and SoIndexedTriangleStripSet nodes. The new object is the same type of node as the original.
Texture Mapping: If the original geometry has explicit texture coordinates, the result will be correct. If texture coordinates are computed by Open Inventor, the texture will be applied separately to each new object.
SoOctreeOrdering, SoIndexedFaceSet, SoIndexedTriangleStripSet, SoShapeHints
SoSplitGeometryAction::SoSplitGeometryAction | ( | int | divAlongX, | |
int | divAlongY | |||
) |
Constructor for splitting geometry along 2 dimensions.
By default, the first and second values specify the number of divisions to be used along the object's x and y bounding box dimensions respectively. The doSmartSplitting method() can be used to change which axes of the object's 2D bounding box these division values are applied to.
SoSplitGeometryAction::SoSplitGeometryAction | ( | int | divAlongX, | |
int | divAlongY, | |||
int | divAlongZ | |||
) |
Constructor for splitting geometry along 3 dimensions.
By default, these values specify the number of divisions to be used along the object's x, y, and z bounding box dimensions respectively. The doSmartSplitting method() can be used to change which axes of the object's 3D bounding box these division values are applied to. NOTE: Do not use this constructor to split a scene containing flat objects.
virtual void SoSplitGeometryAction::apply | ( | const SoPathList & | pathList, | |
SbBool | obeysRules = FALSE | |||
) | [inline, virtual] |
Initiates an action on the graph defined by a list of paths.
TRUE can be passed for the obeysRules flag if the given path list has the following 4 properties:
These rules will be obeyed by path lists returned by picking and by searches for non-group nodes.
Reimplemented from SoAction.
virtual void SoSplitGeometryAction::apply | ( | SoPath * | path | ) | [inline, virtual] |
Initiates an action on the graph defined by a path.
Warning: Most actions call ref() on the path before traversing the scene graph, then call unref() after traversal. If the path's reference count was zero (the default), the call to apply() will cause it to be destroyed.
Reimplemented from SoAction.
virtual void SoSplitGeometryAction::apply | ( | SoNode * | node | ) | [virtual] |
Initiates an action on the graph defined by a node.
Warning: Most actions call ref() on the node before traversing the scene graph, then call unref() after traversal. If the node's reference count was zero (the default), the call to apply() will cause it to be destroyed.
Reimplemented from SoAction.
static SoType SoSplitGeometryAction::getClassTypeId | ( | ) | [static] |
Returns the type identifier for this class.
Reimplemented from SoAction.
void SoSplitGeometryAction::getNumDivisions | ( | int & | numX, | |
int & | numY, | |||
int & | numZ | |||
) |
Returns the current division values to split an object in 3D.
void SoSplitGeometryAction::getNumDivisions | ( | int & | numX, | |
int & | numY | |||
) |
Returns the current division values to split an object in 2D.
int SoSplitGeometryAction::getNumObjFound | ( | void | ) |
Returns how many objects the action has split.
This method must be called after the action has been applied.
virtual SoType SoSplitGeometryAction::getTypeId | ( | ) | const [virtual] |
Returns the type identifier for this specific instance.
Implements SoTypedObject.
SbBool SoSplitGeometryAction::isDistinguishSplitParts | ( | void | ) |
Returns TRUE if distinguish split parts is enabled.
SbBool SoSplitGeometryAction::isKeepOriginalGeometry | ( | void | ) |
Returns TRUE if keep original geometry is enabled.
SbBool SoSplitGeometryAction::isMaintainVertexOrdering | ( | void | ) |
Returns TRUE if the option to maintain initial vertex ordering is on.
SbBool SoSplitGeometryAction::isSmartSplitting | ( | void | ) |
Returns TRUE if smart splitting is enabled.
int SoSplitGeometryAction::isTraverseAllSoSwitchChildren | ( | void | ) |
Returns TRUE if traverse all SoSwitch children is enabled.
void SoSplitGeometryAction::setDistinguishSplitParts | ( | SbBool | enable | ) |
Calling this method before applying the action allows you to see how the action has split the objects.
Each new SoIndexedShape is assigned a unique material. Default is FALSE.
void SoSplitGeometryAction::setKeepOriginalGeometry | ( | SbBool | enable | ) |
By default, the action modifies the scene graph by replacing the original node it has split with a new separator containing all the new nodes.
The behavior can be changed by a call to this method. Instead of replacing the node with a separator, the original node is replaced with an SoSwitch node containing the original node and the separator containing all the new nodes. Each new SoSwitch node added in the scene graph is named "switchX" where X is the Xth object split. For instance, the first object split by the action will have a corresponding switch node named "switch0". Default is FALSE.
void SoSplitGeometryAction::setMaintainVertexOrdering | ( | SbBool | enable | ) |
If the initial geometry is composed of SoIndexedTriangleStripSet and uses an SoShapeHints with a known vertex ordering (SoShapeHints::CLOCKWISE or SoShapeHints::COUNTERCLOCKWISE), the action has to maintain the initial vertex ordering or problems with normals will appear.
A call to this function will maintain initial vertex ordering. Default is TRUE.
void SoSplitGeometryAction::setMaximumDivisionWarning | ( | SbBool | enable | ) |
There is a maximum number of division to divide an object because this object is composed by some primitives (triangles) that cannot be split without changing the geometry.
If one of the arguments specified in the constructor is greater than this maximum division value, then the action will naturally split the object with the maximum division it is possible to. A call to this function enable Inventor warnings to know if you've reached this maximum value. Turning it on will slow the action traversal because, to know if the division value is good or not, the length average of every primitives is calculated. Inventor warnings are Off by default.
void SoSplitGeometryAction::setNumDivisions | ( | int | numX, | |
int | numY, | |||
int | numZ | |||
) |
Specifies the number of divisions for splitting an object in 3D.
By default, these values specify the number of divisions to be used along the object's x, y, and z bounding box dimensions respectively. The doSmartSplitting method() can be used to change which axes of the object's 3D bounding box these division values are applied to.
void SoSplitGeometryAction::setNumDivisions | ( | int | numX, | |
int | numY | |||
) |
Specifies the number of divisions for splitting an object in 2D.
By default, these values specify the number of divisions to be used along the object's x, y, and z bounding box dimensions respectively. The doSmartSplitting method() can be used to change which axes of the object's 3D bounding box these division values are applied to.
void SoSplitGeometryAction::setSmartSplitting | ( | SbBool | enable | ) |
If this option is set before the action is applied, objects will be split by dividing the greatest bounding box side into the largest number of divisions, the next largest side by the next largest number of divisions, and so on.
Otherwise the action will divide objects by using the first division value given in the constructor for the x side of the bounding box, the second for y, and so on. Default is FALSE.
static void SoSplitGeometryAction::setSplitGeometryActionPreCB | ( | SoSplitGeometryActionCB * | , | |
void * | ||||
) | [static] |
These add a callback function to call when a node of the given type is encountered during traversal.
The PreCallback is called just before the node is traversed. For each node to split, you can "customize" how to split it by enabling, or disabling options, changing the division values, etc.
void SoSplitGeometryAction::setTraverseAllSoSwitchChildren | ( | SbBool | enable | ) |
By default the action will only traverse the active child of SoSwitch nodes.
A call to this method tells the action to traverse all children. Default is FALSE.