Traverses the scene graph and collects all the triangles in a single list. More...
#include <Inventor/actions/SoGlobalSimplifyAction.h>
Public Types | |
enum | Strategy { SIMPLIFY_GLOBALLY, SIMPLIFY_BY_SUBGROUP } |
Public Member Functions | |
virtual SoType | getTypeId () const |
SoGlobalSimplifyAction (SoSimplifier *_simplifier) | |
~SoGlobalSimplifyAction () | |
virtual void | clearApplyResult () |
virtual void | apply (SoNode *node) |
virtual void | apply (SoPath *path) |
virtual void | apply (const SoPathList &path_list, SbBool obeys_rules=FALSE) |
void | setSimplificationStrategy (Strategy st) |
Strategy | getSimplificationStrategy () const |
SoSeparator * | getSimplifiedSceneGraph () const |
void | generateNormals (SbBool g) |
SbBool | areNormalGenerated () const |
void | setCatchAllShapesFlag (SbBool c) |
SbBool | areAllShapesCatched () const |
void | addShapeHintsNode (SbBool a) |
SbBool | isShapeHintAdded () const |
Static Public Member Functions | |
static SoType | getClassTypeId () |
This list is then simplified and the result is stored in a new scene graph.
This class traverses the scene graph and collects all the triangles in a single list. This list is then simplified and the result is stored in a new scene graph.
The SoGlobalSimplifyAction provides two simplification strategies:
The default strategy is SIMPLIFY_BY_SUBGROUP.
NOTE: Colors and normal vectors in the existing shapes are not preserved!
Calling generateNormals(TRUE), which is the default, tells Open Inventor to compute per-vertex normal during this action. When disabled (calling generateNormals(FALSE)), objects may appear faceted instead of appearing smooth.
If generateNormals is false, it may be useful to call addShapeHints(TRUE). This tells Open Inventor to add an SoShapeHints node to the result scene graph that will cause normals to be computed during the next render traversal.
By default the SoGlobalSimplifyAction collects all the triangles even if they are part of a simple shape (cube, cone, sphere, text3...). Setting the setCatchAllShapesFlag() flag to FALSE tells the action to collect triangles only if they belong to a complex shape.
The getSimplifiedSceneGraph() method returns the root of the new scene graph after applying the SoGlobalSimplifyAction.
Typically you will pass an instance of SoDecimator to the constructor. Please see SoDecimator for info about which geometry objects can be simplified.
SoAction, SoLevelOfSimplification, SoShapeSimplifyAction, SoSimplifyAction
Strategy.
SIMPLIFY_GLOBALLY |
All triangles are stored in a single list and decimated globally. WARNING: SoTexture (and possibly other properties), will be lost during simplification. Please use the SIMPLIFY_BY_SUBGROUP Strategy to keep SoTexture. |
SIMPLIFY_BY_SUBGROUP |
Triangles are stored in multiple lists based on material, texture and Separator. Each list is simplified. [Default] |
SoGlobalSimplifyAction::SoGlobalSimplifyAction | ( | SoSimplifier * | _simplifier | ) |
Constructor.
The algorithm used for simplifying is defined by the SoSimplifier class that is passed in the constructor.
SoGlobalSimplifyAction::~SoGlobalSimplifyAction | ( | ) |
Destructor.
void SoGlobalSimplifyAction::addShapeHintsNode | ( | SbBool | a | ) | [inline] |
Sets whether a shape hints node is added.
If true, a shapeHints node is added to force smooth normals if they were not generated, and to turn on two-sided lighting. Default is false.
virtual void SoGlobalSimplifyAction::apply | ( | const SoPathList & | pathList, | |
SbBool | obeysRules = FALSE | |||
) | [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 SoGlobalSimplifyAction::apply | ( | SoPath * | path | ) | [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 SoGlobalSimplifyAction::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.
SbBool SoGlobalSimplifyAction::areAllShapesCatched | ( | ) | const [inline] |
Gets the flag that specifies whether simple shapes are simplified.
SbBool SoGlobalSimplifyAction::areNormalGenerated | ( | ) | const [inline] |
Gets the normal generation flag.
If true, per-vertex normals are calculated while simplifying.
virtual void SoGlobalSimplifyAction::clearApplyResult | ( | ) | [virtual] |
When applied, an action may reference nodes or create objects (e.g. SoPath) that reference nodes. This is especially true for SoSearchAction and SoRayPickAction. These references will prevent the nodes from being destroyed and so may appear to be a "memory leak".All references are cleared when the action is destroyed or re-applied. However it may be useful to clear them explicitly to remove references to nodes.
Reimplemented from SoAction.
void SoGlobalSimplifyAction::generateNormals | ( | SbBool | g | ) | [inline] |
Sets the normal generation flag.
If true, per-vertex normals are calculated while simplifying. Default value is TRUE.
static SoType SoGlobalSimplifyAction::getClassTypeId | ( | ) | [static] |
Returns the type identifier for this class.
Reimplemented from SoSimplifyAction.
Strategy SoGlobalSimplifyAction::getSimplificationStrategy | ( | ) | const [inline] |
Gets the strategy used to determine how to group triangles into the simplified shapes.
SoSeparator* SoGlobalSimplifyAction::getSimplifiedSceneGraph | ( | ) | const [inline] |
This returns the new scene graph which contains the simplified result.
virtual SoType SoGlobalSimplifyAction::getTypeId | ( | ) | const [virtual] |
Returns the type identifier for this specific instance.
Reimplemented from SoSimplifyAction.
SbBool SoGlobalSimplifyAction::isShapeHintAdded | ( | ) | const [inline] |
Gets whether a shape hints node will be added.
void SoGlobalSimplifyAction::setCatchAllShapesFlag | ( | SbBool | c | ) | [inline] |
void SoGlobalSimplifyAction::setSimplificationStrategy | ( | Strategy | st | ) | [inline] |
Sets the strategy used to determine how to group triangles into the simplified shapes.
The choices are SIMPLIFY_GLOBALLY and SIMPLIFY_BY_SUBGROUP. Use enum Strategy Default is SIMPLIFY_BY_GROUP.