Split large geometry into smaller objects to improve culling for multi-pipe rendering. More...
#include <Inventor/actions/SoSplitGeometryAction.h>
Public Types | |
typedef void | SoSplitGeometryActionCB(const SoSplitGeometryAction *action, SoNode *objectToSplit, const int objectId, int divAlongX, int divAlongY, int divAlongZ, void *userData) |
User pre-split callback. | |
Public Types inherited from SoAction | |
enum | DistribMode { LOCAL_ONLY , CLUSTER_ONLY , ALL } |
This is used to define the way an action is distributed across a cluster. More... | |
enum | AppliedCode { NODE , PATH , PATH_LIST } |
This enum is used to determine what the action is being applied to. More... | |
enum | PathCode { NO_PATH , IN_PATH , BELOW_PATH , OFF_PATH } |
This enum may be used during traversal of nodes to indicate where the node is with respect to the path being traversed. More... | |
Public Member Functions | |
virtual SoType | getTypeId () const |
Returns the type identifier for this specific instance. | |
SoSplitGeometryAction (int divAlongX, int divAlongY) | |
SoSplitGeometryAction (int divAlongX, int divAlongY, int divAlongZ) | |
void | setNumDivisions (int numX, int numY) |
Specifies the number of divisions for splitting an object in 2D. | |
void | setNumDivisions (int numX, int numY, int numZ) |
Specifies the number of divisions for splitting an object in 3D. | |
void | getNumDivisions (int &numX, int &numY) |
Returns the current division values to split an object in 2D. | |
void | getNumDivisions (int &numX, int &numY, int &numZ) |
Returns the current division values to split an object in 3D. | |
void | setDistinguishSplitParts (SbBool enable) |
Calling this method before applying the action allows you to see how the action has split the objects. | |
SbBool | isDistinguishSplitParts (void) |
Returns TRUE if distinguish split parts is enabled. | |
int | getNumObjFound (void) |
Returns how many objects the action has split. | |
void | 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. | |
SbBool | isKeepOriginalGeometry (void) |
Returns TRUE if keep original geometry is enabled. | |
void | 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. | |
SbBool | isSmartSplitting (void) |
Returns TRUE if smart splitting is enabled. | |
void | setTraverseAllSoSwitchChildren (SbBool enable) |
By default the action will only traverse the active child of SoSwitch nodes. | |
int | isTraverseAllSoSwitchChildren (void) |
Returns TRUE if traverse all SoSwitch children is enabled. | |
void | 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. | |
void | 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. | |
SbBool | isMaintainVertexOrdering (void) |
Returns TRUE if the option to maintain initial vertex ordering is on. | |
virtual void | apply (SoNode *node) |
Initiates an action on the graph defined by a node. | |
virtual void | apply (SoPath *path) |
Initiates an action on the graph defined by a path. | |
virtual void | apply (const SoPathList &path_list, SbBool obeys_rules=FALSE) |
Initiates an action on the graph defined by a list of paths. | |
Public Member Functions inherited from SoAction | |
virtual | ~SoAction () |
Destructor. | |
virtual void | clearApplyResult () |
When applied, an action may reference nodes or create objects (e.g. | |
virtual void | invalidateState () |
Invalidates the current traversal state in the action, forcing it to be recreated when the action is next applied. | |
void | stopActionInBranch () |
This function stops the action in the current Scene Graph branch. | |
SbBool | getContinueActionInBranchFlag () const |
This function indicates if the action must stop in the current branch. | |
void | resetContinueActionInBranchFlag () |
This function resets the continue action flag. | |
void | useAlternateRep (const SbBool enable) |
Tell the action to use alternate representations during traversal when available. | |
SbBool | isUsingAlternateRep () const |
Returns TRUE if current action is using alternate representations. | |
void | setSceneManager (SoSceneManager *mgr) |
Set the scene manager associated with this action (if any ). | |
SoSceneManager * | getSceneManager () const |
Return the SoSceneManager associated with this action. | |
virtual void | forwardTraversal (SoNode *node) |
Traverse a node that is not part of the current scenegraph. | |
virtual void | forwardTraversal (SoPath *path) |
Traverse a path that is not part of the current scenegraph. | |
DistribMode | getDistribMode () const |
Returns the distribution mode of this action across a cluster (ScaleViz-Cluster only). | |
AppliedCode | getWhatAppliedTo () const |
Returns code indicating what action is being applied to. | |
SoNode * | getNodeAppliedTo () const |
Returns the node the action is being applied to. | |
SoPath * | getPathAppliedTo () const |
Returns the path the action is being applied to. | |
const SoPathList * | getPathListAppliedTo () const |
Returns the path list the action is being applied to. | |
const SoPathList * | getOriginalPathListAppliedTo () const |
Returns the original path list the action is being applied to. | |
SbBool | isLastPathListAppliedTo () const |
Returns TRUE if the current list is the last one from the original. | |
PathCode | getPathCode (int &numIndices, const int *&indices) |
Returns path code based on where current node (the node at the end of the current path) lies with respect to the path(s) the action is being applied to. | |
PathCode | getPathCodeMI (int &numIndices, const int *&indices, const int *&instanceIndices) |
Extender API: available to programmers who wish to extend the toolkit | |
void | traverse (SoNode *node) |
Does traversal of a graph rooted by a node. | |
SbBool | hasTerminated () const |
Returns TRUE if the traversal has reached a termination condition. | |
const SoPath * | getCurPath () |
Returns the path accumulated during traversal, i.e., the chain of nodes from the root of the traversed graph to the current node being traversed. | |
SoState * | getState () const |
Gets the state from the action. | |
virtual void | setUpState () |
Creates state if it is NULL or it is no longer valid because new elements have been enabled since it was created. | |
void | setPipeId (int id) |
Sets pipe identifier in the range [1..N] associated to this render action while running a ScaleViz Multipipe configuration. | |
int | getPipeId () const |
Gets pipe identifier in the range [1..N] associated to this render action while running a ScaleViz Multipipe configuration. | |
bool | isBeingApplied () |
Returns TRUE if this action is currently being applied. | |
virtual bool | preDelayedTraversal () |
Method called by SoMultiPassManager before delayed pass traversals. | |
virtual void | postDelayedTraversal () |
Method called by SoMultiPassManager after delayed pass traversals. | |
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 void | setSplitGeometryActionPreCB (SoSplitGeometryActionCB *, void *) |
These add a callback function to call when a node of the given type is encountered during traversal. | |
Static Public Member Functions inherited from SoAction | |
static SoType | getClassTypeId () |
Returns the type identifier for this class. | |
static void | nullAction (SoAction *, SoNode *) |
Null action method that can be stored in lookup table when desired. | |
Static Public Member Functions inherited from SoTypedObject | |
static SoType | getClassTypeId () |
Returns the type identifier for this class. | |
Split large geometry into smaller objects to improve culling for multi-pipe rendering.
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
Definition at line 82 of file SoSplitGeometryAction.h.
typedef void SoSplitGeometryActionCB(const SoSplitGeometryAction *action, SoNode *objectToSplit, const int objectId, int divAlongX, int divAlongY, int divAlongZ, void *userData) |
User pre-split callback.
The action will call this function before splitting each shape.
A pointer to the action and the node to split is given. The action's options may be modified by the callback function. The number of subdivisions can be changed as well.
Definition at line 43 of file SoSplitGeometryAction.h.
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.
|
inlinevirtual |
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.
Definition at line 251 of file SoSplitGeometryAction.h.
|
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.
|
inlinevirtual |
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.
Definition at line 250 of file SoSplitGeometryAction.h.
|
static |
Returns the type identifier for this class.
void SoSplitGeometryAction::getNumDivisions | ( | int & | numX, |
int & | numY | ||
) |
Returns the current division values to split an object in 2D.
void SoSplitGeometryAction::getNumDivisions | ( | int & | numX, |
int & | numY, | ||
int & | numZ | ||
) |
Returns the current division values to split an object in 3D.
int SoSplitGeometryAction::getNumObjFound | ( | void | ) |
Returns how many objects the action has split.
This method must be called after the action has been applied.
|
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 | ||
) |
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::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::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 |
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.