Open Inventor Release 2024.1.0
 
Loading...
Searching...
No Matches
SoShapeSimplifyAction.h
Go to the documentation of this file.
1/*=======================================================================
2 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
3 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
4 *** ***
5 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
6 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
7 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
8 *** ***
9 *** RESTRICTED RIGHTS LEGEND ***
10 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
11 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
12 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
13 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
14 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
15 *** ***
16 *** COPYRIGHT (C) 1996-2014 BY FEI S.A.S, ***
17 *** BORDEAUX, FRANCE ***
18 *** ALL RIGHTS RESERVED ***
19**=======================================================================*/
20/*=======================================================================
21** Author : Pascal DOUX (Jan 1998)
22**=======================================================================*/
23
24
25#ifndef _SO_SHAPE_SIMPLIFY_ACTION_
26#define _SO_SHAPE_SIMPLIFY_ACTION_
27
28
29//------------------------------------------------------------------------------
30// Includes
31
41#include <Inventor/SoLists.h>
42
43#include <Inventor/SoType.h>
44
45class SoSimplifier;
46
66{
68
69public:
70
79
84
88 virtual void apply(SoNode *node);
92 virtual void apply(SoPath *path);
105 virtual void apply(const SoPathList &path_list, SbBool obeys_rules=FALSE);
106
107 private:
108
109 static void initClass();
110 static void exitClass();
111 SbBool isDecimated() { return wasDecimated; }
112
113private:
114
115 virtual void beginTraversal(SoNode *) { beginTraversal();}
116 virtual void endTraversal (SoNode *) { endTraversal() ;}
117
118private:
119
120 // Holds enabled-elements counter when state is created; used to
121 // determine whether list of enabled elements is up to date.
122 int enabledElementsCounter;
123
124 SbBool wasDecimated;
125 virtual void prepareAction (SoCallbackAction &action);
126
127 virtual void beginTraversal();
128 virtual void endTraversal ();
129
130 SoNodeList groupStack;
131 SoNodeList deletedNodes;
132 SoNodeList multInstNodes;
133 SoNodeList newNodes;
134
135 SbBool collectTriangles;
136 SbBool hasNormals;
137 SbBool hasColors;
138
139 void pushGroup(const SoNode *node){ groupStack.append(const_cast<SoNode *>(node));}
140 void popGroup () { groupStack.remove(groupStack.getLength()-1);}
141 SoNode *getGroup () const { return groupStack[groupStack.getLength()-1];}
142
144 catchShapeCB ( void* object, SoCallbackAction* action, const SoNode* node)
145 { return ((SoShapeSimplifyAction*) object)->catchShape (action, node); }
146
148 catchShape ( SoCallbackAction* action, const SoNode* node) ;
149
151 catchEndShapeCB ( void* object, SoCallbackAction* action, const SoNode* node)
152 { return ((SoShapeSimplifyAction*) object)->catchEndShape (action, node); }
153
155 catchEndShape ( SoCallbackAction* action, const SoNode* node) ;
156
158 catchGroupNodesCB ( void* object, SoCallbackAction* action, const SoNode* node)
159 { return ((SoShapeSimplifyAction*) object)->catchGroupNodes (action, node); }
160
162 catchGroupNodes ( SoCallbackAction* action, const SoNode* node) ;
163
165 catchEndGroupNodesCB ( void* object, SoCallbackAction* action, const SoNode* node)
166 { return (static_cast<SoShapeSimplifyAction*>(object))->catchEndGroupNodes (action, node); }
167
169 catchEndGroupNodes ( SoCallbackAction* action, const SoNode* node) ;
170
171 void addTriangle (SoCallbackAction *action,
172 const SoPrimitiveVertex *vertex1,
173 const SoPrimitiveVertex *vertex2,
174 const SoPrimitiveVertex *vertex3);
175
176 static void addTriangleCB (void *userData,
177 SoCallbackAction *action,
178 const SoPrimitiveVertex *vertex1,
179 const SoPrimitiveVertex *vertex2,
180 const SoPrimitiveVertex *vertex3) {
181 (static_cast<SoShapeSimplifyAction*>(userData))->addTriangle (action, vertex1, vertex2, vertex3);
182 }
183
184};
185
186#endif // _SO_SHAPE_SIMPLIFY_ACTION_
187
188
189
190
191
192
193
194
195
#define FALSE
Possible value of SbBool.
Definition SbBase.h:75
#define SO_ACTION_HEADER(className)
Definition SoSubAction.h:69
int getLength() const
Returns number of pointers in list.
Definition SbPList.h:125
virtual void remove(int which)
Removes pointer with given index.
Performs a generic traversal of a scene graph or path.
Response
Possible responses from a pre or post callback.
Abstract base class for all database nodes.
Definition SoNode.h:145
Maintains a list of pointers to nodes.
Definition SoNodeList.h:74
void append(SoNode *ptr)
Adds a pointer to the end of the list.
Definition SoNodeList.h:99
Path that points to a list of hierarchical nodes.
Definition SoPath.h:187
Maintains a list of pointers to paths.
Definition SoPathList.h:81
Represents a vertex of a generated primitive.
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Simplify action ...
virtual void apply(SoNode *node)
Initiates an action on the graph defined by a node.
SoShapeSimplifyAction(SoSimplifier *_simplifier)
Constructor.
~SoShapeSimplifyAction()
Destructor.
virtual void apply(const SoPathList &path_list, SbBool obeys_rules=FALSE)
Initiates an action on the graph defined by a list of paths.
virtual void apply(SoPath *path)
Initiates an action on the graph defined by a path.
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Abstract base cl...
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Abstract base cl...
int SbBool
Boolean type.
Definition SbBase.h:87