Open Inventor Release 2024.1.1
 
Loading...
Searching...
No Matches
SoGlobalSimplifyAction Class Reference

VSG extension Traverses the scene graph and collects all the triangles in a single list. More...

#include <Inventor/actions/SoGlobalSimplifyAction.h>

+ Inheritance diagram for SoGlobalSimplifyAction:

Public Types

enum  Strategy {
  SIMPLIFY_GLOBALLY ,
  SIMPLIFY_BY_SUBGROUP
}
 Strategy. More...
 
- 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.
 
 SoGlobalSimplifyAction (SoSimplifier *_simplifier)
 Constructor.
 
 ~SoGlobalSimplifyAction ()
 Destructor.
 
virtual void clearApplyResult ()
 When applied, an action may reference nodes or create objects (e.g.
 
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.
 
void setSimplificationStrategy (Strategy st)
 Sets the strategy used to determine how to group triangles into the simplified shapes.
 
Strategy getSimplificationStrategy () const
 Gets the strategy used to determine how to group triangles into the simplified shapes.
 
SoSeparatorgetSimplifiedSceneGraph () const
 This returns the new scene graph which contains the simplified result.
 
void generateNormals (SbBool g)
 Sets the normal generation flag.
 
SbBool areNormalGenerated () const
 Gets the normal generation flag.
 
void setCatchAllShapesFlag (SbBool c)
 Sets the flag that specifies whether simple shapes are simplified.
 
SbBool areAllShapesCatched () const
 Gets the flag that specifies whether simple shapes are simplified.
 
void addShapeHintsNode (SbBool a)
 Sets whether a shape hints node is added.
 
SbBool isShapeHintAdded () const
 Gets whether a shape hints node will be added.
 
- Public Member Functions inherited from SoSimplifyAction
 SoSimplifyAction (SoSimplifier *_simplifier)
 Constructor.
 
 ~SoSimplifyAction ()
 Destructor.
 
void setSimplificationLevels (int num, const float levels[])
 Sets number of levels of detail to produce and what percentage to produce at each level.
 
const float * getSimplificationLevels () const
 Gets percentages to produce at each level of detail.
 
int getNumSimplificationLevels () const
 Gets number of levels of detail to produce.
 
void setRanges (int num, const float newRanges[])
 Sets the ranges that will be used in the LevelOfSimplification node to decide which level of detail to display.
 
const float * getRanges () const
 Gets the ranges that will be used in the LevelOfSimplification node to decide which level of detail to display.
 
int getNumRanges () const
 Gets the number of ranges that will be used in the LevelOfSimplification node to decide which level of detail to display.
 
void setSizeFactor (float size)
 Sets the scale factor to use to decide what values of ranges to use in the LevelOfSimplification node.
 
float getSizeFactor () const
 Gets the scale factor to use to decide what values of ranges to use in the LevelOfSimplification node.
 
void setInlineLOD (SbBool i)
 Sets inlineLOD flag.
 
SbBool isInlineLOD () const
 Gets inlineLOD flag.
 
void setUrlName (const SbString name)
 Sets the name used when creating Inline files for each simplified child.
 
SbString getUrlName () const
 Gets the name used when creating Inline files for each simplified child.
 
void setVerbosity (SbBool v)
 Sets verbosity flag.
 
SbBool isVerbose () const
 Gets verbosity flag.
 
void setMinTriangles (int mt)
 Sets the minimum number of triangles for a simplified child; if a given percentage would create a simplified version that went below this minimum, no simplified chld is produced for this level.
 
int getMinTriangles () const
 Gets the minimum number of triangles for a simplified child.
 
void setRenderCulling (SbBool r)
 Sets render culling flag.
 
int isRenderCulling () const
 Gets render culling flag.
 
- Public Member Functions inherited from SoAction
virtual ~SoAction ()
 Destructor.
 
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 ).
 
SoSceneManagergetSceneManager () 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.
 
SoNodegetNodeAppliedTo () const
 Returns the node the action is being applied to.
 
SoPathgetPathAppliedTo () const
 Returns the path the action is being applied to.
 
const SoPathListgetPathListAppliedTo () const
 Returns the path list the action is being applied to.
 
const SoPathListgetOriginalPathListAppliedTo () 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 SoPathgetCurPath ()
 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.
 
SoStategetState () 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 Public Member Functions inherited from SoSimplifyAction
static SoType getClassTypeId ()
 Returns the type identifier for this class.
 
- 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.
 

Detailed Description

VSG extension 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.

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:

  • SIMPLIFY_GLOBALLY: all the triangles found in the scene graph are collected in a single object. Then this object is simplified.
  • SIMPLIFY_BY_SUBGROUP: triangles are collected until a material change or a separator is found.

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.

SEE ALSO

SoAction, SoLevelOfSimplification, SoShapeSimplifyAction, SoSimplifyAction

Definition at line 94 of file SoGlobalSimplifyAction.h.

Member Enumeration Documentation

◆ Strategy

Strategy.

Enumerator
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]

Definition at line 115 of file SoGlobalSimplifyAction.h.

Constructor & Destructor Documentation

◆ SoGlobalSimplifyAction()

SoGlobalSimplifyAction::SoGlobalSimplifyAction ( SoSimplifier _simplifier)

Constructor.

The algorithm used for simplifying is defined by the SoSimplifier class that is passed in the constructor.

◆ ~SoGlobalSimplifyAction()

SoGlobalSimplifyAction::~SoGlobalSimplifyAction ( )

Destructor.

Member Function Documentation

◆ addShapeHintsNode()

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.

Definition at line 178 of file SoGlobalSimplifyAction.h.

◆ apply() [1/3]

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:

  1. All paths have the same head node.
  2. Paths are sorted in traversal order.
  3. If one path ends at node A, no other path continues through A.
  4. No two paths are the same.

These rules will be obeyed by path lists returned by picking and by searches for non-group nodes.

Reimplemented from SoAction.

◆ apply() [2/3]

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.

◆ apply() [3/3]

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.

◆ areAllShapesCatched()

SbBool SoGlobalSimplifyAction::areAllShapesCatched ( ) const
inline

Gets the flag that specifies whether simple shapes are simplified.

Definition at line 171 of file SoGlobalSimplifyAction.h.

◆ areNormalGenerated()

SbBool SoGlobalSimplifyAction::areNormalGenerated ( ) const
inline

Gets the normal generation flag.

If true, per-vertex normals are calculated while simplifying.

Definition at line 160 of file SoGlobalSimplifyAction.h.

◆ clearApplyResult()

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.

◆ generateNormals()

void SoGlobalSimplifyAction::generateNormals ( SbBool  g)
inline

Sets the normal generation flag.

If true, per-vertex normals are calculated while simplifying. Default value is TRUE.

Definition at line 155 of file SoGlobalSimplifyAction.h.

◆ getClassTypeId()

static SoType SoGlobalSimplifyAction::getClassTypeId ( )
static

Returns the type identifier for this class.


◆ getSimplificationStrategy()

Strategy SoGlobalSimplifyAction::getSimplificationStrategy ( ) const
inline

Gets the strategy used to determine how to group triangles into the simplified shapes.

Definition at line 143 of file SoGlobalSimplifyAction.h.

◆ getSimplifiedSceneGraph()

SoSeparator * SoGlobalSimplifyAction::getSimplifiedSceneGraph ( ) const
inline

This returns the new scene graph which contains the simplified result.

Definition at line 148 of file SoGlobalSimplifyAction.h.

◆ getTypeId()

virtual SoType SoGlobalSimplifyAction::getTypeId ( ) const
virtual

Returns the type identifier for this specific instance.

Reimplemented from SoSimplifyAction.

◆ isShapeHintAdded()

SbBool SoGlobalSimplifyAction::isShapeHintAdded ( ) const
inline

Gets whether a shape hints node will be added.

Definition at line 182 of file SoGlobalSimplifyAction.h.

◆ setCatchAllShapesFlag()

void SoGlobalSimplifyAction::setCatchAllShapesFlag ( SbBool  c)
inline

Sets the flag that specifies whether simple shapes are simplified.

If true, simple shapes such as SoSphere, SoCone, etc, are faceted and simplified also. If false, then they are ignored. Default is true.

Definition at line 167 of file SoGlobalSimplifyAction.h.

◆ setSimplificationStrategy()

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.

Definition at line 138 of file SoGlobalSimplifyAction.h.


The documentation for this class was generated from the following file: