Open Inventor Release 2024.1.3
 
Loading...
Searching...
No Matches
SoBevelAction.h
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-2017 BY FEI S.A.S, ***
17 *** BORDEAUX, FRANCE ***
18 *** ALL RIGHTS RESERVED ***
19**=======================================================================*/
20/*=======================================================================
21** Author : VSG (MMM YYYY)
22**=======================================================================*/
23#ifndef _SO_BEVEL_ACTION
24#define _SO_BEVEL_ACTION
25
26#include <Inventor/actions/SoCallbackAction.h>
27#include <Inventor/SbBasic.h>
28
29class IntArray;
30class VertexArray;
31class GroupArray;
32
33class SoGroup;
34class SoNode;
36class SoBevelData;
37
38class SoFaceSet;
42class SoQuadMesh;
43class SoCube;
44class SoCone;
45class SoCylinder;
46
47class BevelMaterial;
48
50//
51// Class: SoBevelAction
52//
53// For beveling nodes in a scene graph or a path list. This action traverses
54// a scene graph or a path list, and constructs another scene-graph where the
55// shapes are beveled.
56// The beveling properties can be set directly in this action as default
57// behaviour, or inserted in the scene-graph using a SoBevelProperties node.
58// Specific vertices and edges can be beveled / not beveled using the
59// SoEdgeFlag an SoVertexFlag nodes.
60//
62
94class SoBevelAction : public SoAction
95{
96 SO_ACTION_HEADER(SoBevelAction);
97
98 public:
106 virtual ~SoBevelAction();
107
112 void setAngle(float angle);
117 float getAngle() const;
121 void setRadius(float radius);
125 float getRadius() const;
132 void enableAbsoluteRadius(SbBool flag = TRUE);
161 void enableCoplanarTest(SbBool flag = TRUE);
169 void enableDuplicateTest(SbBool flag = TRUE);
175 void enableOrderingTest(SbBool flag = TRUE);
176
177 // As for other actions, the beveling action can be applied on nodes or paths
178 virtual void apply(SoNode *node);
179 virtual void apply(SoPath *path);
180 virtual void apply(const SoPathList &pathList,
181 SbBool obeysRules = FALSE);
182
188
189 private:
190 static void initClass();
191 static void exitClass();
192
193 private:
194 // The beveling action uses a callback action to traverse the source scene-graph
195 SoCallbackAction callbackAction;
196
197 // These fields are used for defining the default behaviour of the beveling
198 float angle;
199 float radius;
200 SbBool absoluteRadius;
201 int _tests_to_do;
202
203 private:
204
205 BevelMaterial* m_material;
206
207 VertexArray *_generatedPoints;
208 IntArray *_generatedTriangles;
209
210 GroupArray *_groups;
211 SoNode* _modifiedNode;
212 SoGroup* _beveledObject;
213
214 void _bevel(SoBevelData *);
215 SoBevelData* _getData(SoNode *) {return NULL;}
216
217 static SoCallbackAction::Response _beforeGroup(void *, SoCallbackAction *action, const SoNode *node);
218 static SoCallbackAction::Response _afterNode(void *, SoCallbackAction *action, const SoNode *node);
219 static SoCallbackAction::Response _afterGroup(void *, SoCallbackAction *action, const SoNode *node);
220
221 SoBevelData* _getData(SoFaceSet *);
222 SoBevelData* _getData(SoIndexedFaceSet *);
223 SoBevelData* _getData(SoTriangleStripSet *);
224 SoBevelData* _getData(SoIndexedTriangleStripSet *);
225 SoBevelData* _getData(SoQuadMesh *);
226 SoBevelData* _getData(SoCube *);
227 SoBevelData* _getData(SoCone *);
228 SoBevelData* _getData(SoCylinder *);
229 static SoCallbackAction::Response _afterFS(void *, SoCallbackAction *, const SoNode *);
230 static SoCallbackAction::Response _afterIFS(void *, SoCallbackAction *, const SoNode *);
231 static SoCallbackAction::Response _afterTSS(void *, SoCallbackAction *, const SoNode *);
232 static SoCallbackAction::Response _afterITSS(void *, SoCallbackAction *, const SoNode *);
233 static SoCallbackAction::Response _afterQM(void *, SoCallbackAction *, const SoNode *);
234 static SoCallbackAction::Response _afterCube(void *, SoCallbackAction *, const SoNode *);
235 static SoCallbackAction::Response _afterCone(void *, SoCallbackAction *, const SoNode *);
236 static SoCallbackAction::Response _afterCylinder(void *, SoCallbackAction *, const SoNode *);
237
238 /* removed on 02-25-00 : was previously used to compute cone, cube and cylinder geometry
239 static SoCallbackAction::Response _beforeTriangles(void *,
240 SoCallbackAction *,
241 const SoNode *);
242 static void _getTriangles(void *,
243 SoCallbackAction *,
244 const SoPrimitiveVertex *,
245 const SoPrimitiveVertex *,
246 const SoPrimitiveVertex *);
247 void _insertTrianglePoint(const SoPrimitiveVertex *);
248 */
249 void getCoords(const SoNode &, SbVec3f *&, int &) const;
250
251 static SoCallbackAction::Response _setColors(void *, SoCallbackAction *action, const SoNode *node);
252
253};
254
255#endif
3D vector class.
Definition SbVec.h:932
Abstract base class for all actions.
Definition SoAction.h:132
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Creates a scene ...
SbBool isDuplicateTestEnabled() const
If TRUE, a test is performed to remove duplicate faces in the shapes being beveled.
virtual ~SoBevelAction()
Destructor.
float getAngle() const
Returns the minimum angle (in radians) between two adjacent face normals required to bevel the edge c...
virtual void apply(SoNode *node)
Initiates an action on the graph defined by a node.
float getRadius() const
Returns the bevel radius.
void enableCoplanarTest(SbBool flag=TRUE)
If TRUE, a coplanar test is performed on each shape before beveling it.
void enableDuplicateTest(SbBool flag=TRUE)
If TRUE, examine each shape to bevel, removing duplicate faces if found.
virtual void apply(const SoPathList &pathList, SbBool obeysRules=FALSE)
Initiates an action on the graph defined by a list of paths.
SbBool isAbsoluteRadiusEnabled() const
Returns TRUE if the radius is absolute, FALSE if it is relative to the shape.
void enableOrderingTest(SbBool flag=TRUE)
If TRUE, each shape to bevel is re-ordered so that each face is oriented like the first face of the s...
SbBool isCoplanarTestEnabled() const
Returns TRUE if a coplanar test is performed before the beveling.
SoGroup * getSceneGraph()
This method returns the scene graph containing the beveled shapes created by the action.
void enableAbsoluteRadius(SbBool flag=TRUE)
Sets the absolute radius flag.
virtual void apply(SoPath *path)
Initiates an action on the graph defined by a path.
void setAngle(float angle)
Sets the minimum angle (in radians) between two adjacent face normals required to bevel the edge comm...
SoBevelAction()
Constructor.
void setRadius(float radius)
Sets the bevel radius.
SbBool isOrderingTestEnabled() const
Returns TRUE if the shapes are re-ordered before being beveled.
Performs a generic traversal of a scene graph or path.
Response
Possible responses from a pre or post callback.
Cone shape node.
Definition SoCone.h:143
Cube shape node.
Definition SoCube.h:123
Cylinder shape node.
Definition SoCylinder.h:146
Polygonal face shape node.
Definition SoFaceSet.h:229
Base class for all group nodes.
Definition SoGroup.h:122
Indexed polygonal face shape node.
Indexed triangle strip set shape node.
Abstract base class for all database nodes.
Definition SoNode.h:145
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.
Quadrilateral mesh shape node.
Definition SoQuadMesh.h:159
Triangle strip set shape node.
int SbBool
Boolean type.
Definition SbBase.h:87