SoBrepShape.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef PARTGUI_SOBREPSHAPE_H
00024 #define PARTGUI_SOBREPSHAPE_H
00025
00026 #include <Inventor/fields/SoMFInt32.h>
00027 #include <Inventor/fields/SoSFNode.h>
00028 #include <Inventor/fields/SoSubField.h>
00029 #include <Inventor/nodes/SoSubNode.h>
00030 #include <Inventor/nodes/SoIndexedFaceSet.h>
00031 #include <Inventor/nodes/SoIndexedLineSet.h>
00032 #include <Inventor/nodes/SoPointSet.h>
00033 #include <Inventor/elements/SoLazyElement.h>
00034 #include <Inventor/elements/SoReplacedElement.h>
00035 #include <vector>
00036
00037 class SoGLCoordinateElement;
00038 class SoTextureCoordinateBundle;
00039
00040 namespace PartGui {
00041
00042 class PartGuiExport SoBrepFaceSet : public SoIndexedFaceSet {
00043 typedef SoIndexedFaceSet inherited;
00044
00045 SO_NODE_HEADER(SoBrepFaceSet);
00046
00047 public:
00048 static void initClass();
00049 SoBrepFaceSet();
00050
00051 SoMFInt32 partIndex;
00052 SoSFInt32 highlightIndex;
00053 SoMFInt32 selectionIndex;
00054
00055 protected:
00056 virtual ~SoBrepFaceSet() {};
00057 virtual void GLRender(SoGLRenderAction *action);
00058 virtual void GLRenderBelowPath(SoGLRenderAction * action);
00059 virtual void doAction(SoAction* action);
00060 virtual SoDetail * createTriangleDetail(
00061 SoRayPickAction * action,
00062 const SoPrimitiveVertex * v1,
00063 const SoPrimitiveVertex * v2,
00064 const SoPrimitiveVertex * v3,
00065 SoPickedPoint * pp);
00066
00067 private:
00068 enum Binding {
00069 OVERALL = 0,
00070 PER_PART,
00071 PER_PART_INDEXED,
00072 PER_FACE,
00073 PER_FACE_INDEXED,
00074 PER_VERTEX,
00075 PER_VERTEX_INDEXED,
00076 NONE = OVERALL
00077 };
00078 Binding findMaterialBinding(SoState * const state) const;
00079 Binding findNormalBinding(SoState * const state) const;
00080 void renderShape(const SoGLCoordinateElement * const vertexlist,
00081 const int32_t *vertexindices,
00082 int num_vertexindices,
00083 const int32_t *partindices,
00084 int num_partindices,
00085 const SbVec3f *normals,
00086 const int32_t *normindices,
00087 SoMaterialBundle *const materials,
00088 const int32_t *matindices,
00089 SoTextureCoordinateBundle * const texcoords,
00090 const int32_t *texindices,
00091 const int nbind,
00092 const int mbind,
00093 const int texture);
00094 void renderHighlight(SoGLRenderAction *action);
00095 void renderSelection(SoGLRenderAction *action);
00096
00097 private:
00098 SbColor selectionColor;
00099 SbColor highlightColor;
00100 SoColorPacker colorpacker;
00101 };
00102
00103
00104
00105 class PartGuiExport SoBrepEdgeSet : public SoIndexedLineSet {
00106 typedef SoIndexedLineSet inherited;
00107
00108 SO_NODE_HEADER(SoBrepEdgeSet);
00109
00110 public:
00111 static void initClass();
00112 SoBrepEdgeSet();
00113
00114 SoSFInt32 highlightIndex;
00115 SoMFInt32 selectionIndex;
00116
00117 protected:
00118 virtual ~SoBrepEdgeSet() {};
00119 virtual void GLRender(SoGLRenderAction *action);
00120 virtual void GLRenderBelowPath(SoGLRenderAction * action);
00121 virtual void doAction(SoAction* action);
00122 virtual SoDetail * createLineSegmentDetail(
00123 SoRayPickAction *action,
00124 const SoPrimitiveVertex *v1,
00125 const SoPrimitiveVertex *v2,
00126 SoPickedPoint *pp);
00127 private:
00128 void renderShape(const SoGLCoordinateElement * const vertexlist,
00129 const int32_t *vertexindices,
00130 int num_vertexindices);
00131 void renderHighlight(SoGLRenderAction *action);
00132 void renderSelection(SoGLRenderAction *action);
00133
00134 private:
00135 std::vector<int32_t> hl, sl;
00136 SbColor selectionColor;
00137 SbColor highlightColor;
00138 SoColorPacker colorpacker;
00139 };
00140
00141
00142
00143 class PartGuiExport SoBrepPointSet : public SoPointSet {
00144 typedef SoPointSet inherited;
00145
00146 SO_NODE_HEADER(SoBrepPointSet);
00147
00148 public:
00149 static void initClass();
00150 SoBrepPointSet();
00151
00152 SoSFInt32 highlightIndex;
00153 SoMFInt32 selectionIndex;
00154
00155 protected:
00156 virtual ~SoBrepPointSet() {};
00157 virtual void GLRender(SoGLRenderAction *action);
00158 virtual void GLRenderBelowPath(SoGLRenderAction * action);
00159 virtual void doAction(SoAction* action);
00160
00161 private:
00162 void renderShape(const SoGLCoordinateElement * const vertexlist,
00163 const int32_t *vertexindices,
00164 int num_vertexindices);
00165 void renderHighlight(SoGLRenderAction *action);
00166 void renderSelection(SoGLRenderAction *action);
00167
00168 private:
00169 SbColor selectionColor;
00170 SbColor highlightColor;
00171 SoColorPacker colorpacker;
00172 };
00173
00174 }
00175
00176
00177 #endif // PARTGUI_SOBREPSHAPE_H
00178