SoKnot.h
00001 #ifndef COIN_SOKNOT_H
00002 #define COIN_SOKNOT_H
00003
00004 #include <Inventor/nodes/SoSubNode.h>
00005 #include <Inventor/nodes/SoShape.h>
00006 #include <Inventor/fields/SoSFFloat.h>
00007 #include <Inventor/fields/SoSFInt32.h>
00008
00009 #include "../include/Tube.h"
00010
00011 #define SOGL_MATERIAL_PER_PART 0x08
00012 #define SOGL_NEED_NORMALS 0x10
00013 #define SOGL_NEED_TEXCOORDS 0x20
00014 #define SOGL_NEED_3DTEXCOORDS 0x40
00015 #define SOGL_NEED_MULTITEXCOORDS 0x80 // internal
00016
00017 class SoKnot : public SoShape {
00018
00019 SO_NODE_HEADER(SoKnot);
00020
00021 void sogl_render_tube(const float radius,
00022 const int segments,
00023 const int nodes,
00024 const float Tol,
00025 SoMaterialBundle * const material,
00026 const unsigned int flagsin,
00027 SoState * state);
00028
00029 float* sogl_tube_texcoords;
00030 void reset_texcoords(int Width, int Height);
00031
00032 float _old_radius;
00033 int _old_nodes;
00034 int _old_segments;
00035
00036
00037
00038 Tube<Vector3> *original;
00039 Tube<Vector3> *knot;
00040
00041 public:
00042 static void initClass(void);
00043 SoKnot(void);
00044
00045 SoSFFloat radius;
00046 SoSFInt32 nodes;
00047 SoSFInt32 segments;
00048
00049 void setKnot(Tube<Vector3>* t, const float Tol);
00050 void updateMesh(const float Tol);
00051 Tube<Vector3>* getKnot();
00052 void reset();
00053
00054 virtual void GLRender(SoGLRenderAction * action);
00055
00056
00057
00058
00059 virtual void getPrimitiveCount(SoGetPrimitiveCountAction * action);
00060
00061 protected:
00062 virtual ~SoKnot();
00063
00064 virtual void generatePrimitives(SoAction * action) ;
00065 virtual void computeBBox(SoAction * action,
00066 SbBox3f & box,
00067 SbVec3f & center);
00068
00069 };
00070
00071 #endif // !COIN_SOKNOT_H