00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 #ifndef _SO_BEVEL_ACTION
00024 #define _SO_BEVEL_ACTION
00025 
00026 #include <Inventor/actions/SoCallbackAction.h>
00027 #include <Inventor/SbBasic.h>
00028 
00029 class IntArray;
00030 class VertexArray;
00031 class GroupArray;
00032 
00033 class SoGroup;
00034 class SoNode;
00035 class SoPrimitiveVertex;
00036 class SoBevelData;
00037 
00038 class SoFaceSet;
00039 class SoIndexedFaceSet;
00040 class SoVRMLIndexedFaceSet;
00041 class SoTriangleStripSet;
00042 class SoIndexedTriangleStripSet;
00043 class SoQuadMesh;
00044 class SoCube;
00045 class SoVRMLBox;
00046 class SoCone;
00047 class SoVRMLCone;
00048 class SoCylinder;
00049 class SoVRMLCylinder;
00050 
00051 class BevelMaterial;
00052 
00054 
00055 
00056 
00057 
00058 
00059 
00060 
00061 
00062 
00063 
00064 
00066 
00099 class  SoBevelAction : public SoAction
00100 {
00101   SO_ACTION_HEADER(SoBevelAction);
00102 
00103  public:
00107   SoBevelAction();
00111   virtual ~SoBevelAction();
00112 
00117   void                  setAngle(float angle);
00122   float                 getAngle() const;
00126   void                  setRadius(float radius);
00130   float                 getRadius() const;
00137   void                  enableAbsoluteRadius(SbBool flag = TRUE);
00141   SbBool                isAbsoluteRadiusEnabled() const;
00142 
00143 #if 1             SoDEPRECATED
00148   SbBool                isOutputVRML() const;SoDEPRECATED
00155   void                  setOutputVRML(SbBool flag = TRUE);
00156 #endif 
00160   SbBool                isCoplanarTestEnabled() const;
00161 
00165   SbBool                isDuplicateTestEnabled() const;
00169   SbBool                isOrderingTestEnabled() const;
00181   void                  enableCoplanarTest(SbBool flag = TRUE);
00189   void                  enableDuplicateTest(SbBool flag = TRUE);
00195   void                  enableOrderingTest(SbBool flag = TRUE);
00196 
00197   
00198   virtual void          apply(SoNode *node);
00199   virtual void          apply(SoPath *path);
00200   virtual void          apply(const SoPathList &pathList,
00201                               SbBool obeysRules = FALSE);
00202 
00207   SoGroup *             getSceneGraph();
00208 
00209  private:
00210   static void           initClass();
00211   static void           exitClass();
00212 
00213  private:
00214   
00215   SoCallbackAction      callbackAction;
00216 
00217   
00218   float                 angle;
00219   float                 radius;
00220   SbBool                absoluteRadius;
00221   int                   _tests_to_do;
00222   SbBool                _vrml_output;
00223 
00224  private:
00225 
00226   BevelMaterial*                        m_material;
00227 
00228   VertexArray                           *_generatedPoints;
00229   IntArray                              *_generatedTriangles;
00230 
00231   GroupArray                            *_groups;
00232   SoNode*                               _modifiedNode;
00233   SoGroup*                              _beveledObject;
00234 
00235   void                                  _bevel(SoBevelData *);
00236   SoBevelData*                          _getData(SoNode *) {return NULL;}
00237 
00238   static SoCallbackAction::Response     _beforeGroup(void *, SoCallbackAction *action, const SoNode *node);
00239   static SoCallbackAction::Response     _afterNode(void *, SoCallbackAction *action, const SoNode *node);
00240   static SoCallbackAction::Response     _afterGroup(void *, SoCallbackAction *action, const SoNode *node);
00241 
00242   SoBevelData*                          _getData(SoFaceSet *);
00243   SoBevelData*                          _getData(SoIndexedFaceSet *);
00244   SoBevelData*                          _getData(SoVRMLIndexedFaceSet *);
00245   SoBevelData*                          _getData(SoTriangleStripSet *);
00246   SoBevelData*                          _getData(SoIndexedTriangleStripSet *);
00247   SoBevelData*                          _getData(SoQuadMesh *);
00248   SoBevelData*                          _getData(SoCube *);
00249   SoBevelData*                          _getData(SoVRMLBox *);
00250   SoBevelData*                          _getData(SoCone *);
00251   SoBevelData*                          _getData(SoVRMLCone *);
00252   SoBevelData*                          _getData(SoCylinder *);
00253   SoBevelData*                          _getData(SoVRMLCylinder *);
00254   static SoCallbackAction::Response     _afterFS(void *, SoCallbackAction *, const SoNode *);
00255   static SoCallbackAction::Response     _afterIFS(void *, SoCallbackAction *, const SoNode *);
00256   static SoCallbackAction::Response     _afterVIFS(void *, SoCallbackAction *, const SoNode *);
00257   static SoCallbackAction::Response     _afterTSS(void *, SoCallbackAction *, const SoNode *);
00258   static SoCallbackAction::Response     _afterITSS(void *, SoCallbackAction *, const SoNode *);
00259   static SoCallbackAction::Response     _afterQM(void *, SoCallbackAction *, const SoNode *);
00260   static SoCallbackAction::Response     _afterCube(void *, SoCallbackAction *, const SoNode *);
00261   static SoCallbackAction::Response     _afterVBox(void *, SoCallbackAction *, const SoNode *);
00262   static SoCallbackAction::Response     _afterCone(void *, SoCallbackAction *, const SoNode *);
00263   static SoCallbackAction::Response     _afterVCone(void *, SoCallbackAction *, const SoNode *);
00264   static SoCallbackAction::Response     _afterCylinder(void *, SoCallbackAction *, const SoNode *);
00265   static SoCallbackAction::Response     _afterVCylinder(void *, SoCallbackAction *, const SoNode *);
00266 
00267   
00268 
00269 
00270 
00271 
00272 
00273 
00274 
00275 
00276 
00277 
00278   void                                  getCoords(const SoNode &, SbVec3f *&, int &) const;
00279 
00280   static SoCallbackAction::Response     _setColors(void *, SoCallbackAction *action, const SoNode *node);
00281   static SoCallbackAction::Response     _setVRMLColors(void *, SoCallbackAction *action, const SoNode *node);
00282 
00283 };
00284 
00285 #endif
00286 
00287