00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050 #ifndef _SO_SHAPE_HINTS_ELEMENT
00051 #define _SO_SHAPE_HINTS_ELEMENT
00052
00053 #include <Inventor/elements/SoReplacedElement.h>
00054
00069 SoEXTENDER_Documented class SoShapeHintsElement : public SoElement {
00070
00071 SO_ELEMENT_HEADER(SoShapeHintsElement);
00072
00073 public:
00077 enum VertexOrdering {
00081 UNKNOWN_ORDERING,
00085 CLOCKWISE,
00089 COUNTERCLOCKWISE,
00093 ORDERING_AS_IS
00094 };
00098 enum ShapeType {
00102 UNKNOWN_SHAPE_TYPE,
00106 SOLID,
00110 SHAPE_TYPE_AS_IS };
00111
00115 enum FaceType {
00119 UNKNOWN_FACE_TYPE,
00123 CONVEX,
00127 FACE_TYPE_AS_IS
00128 };
00129
00133 enum WindingType {
00137 NO_WINDING_TYPE,
00138 ODD_TYPE,
00139 NON_ZERO_TYPE,
00140 POSITIVE_TYPE,
00141 NEGATIVE_TYPE,
00142 ABS_GEQ_TWO_TYPE
00143 };
00144
00149 static void set(SoState *state, VertexOrdering vertexOrdering,
00150 ShapeType shapeType, FaceType faceType);
00151
00156 static void set(SoState *state, WindingType windingType);
00157
00161 static void set(SoState *state, SbBool useVBO) ;
00162
00166 static void set(SoState *state, VertexOrdering vertexOrdering, ShapeType shapeType, FaceType faceType,
00167 WindingType windingType, SbBool useVBO);
00168
00172 static void set(SoState *state, SoNode *,
00173 VertexOrdering vertexOrdering,
00174 ShapeType shapeType, FaceType faceType)
00175 { set(state, vertexOrdering, shapeType, faceType); }
00176
00180 static void set(SoState *state, SoNode *,WindingType windingType)
00181 { set(state,windingType); }
00182
00186 static void set(SoState *state, SoNode *, SbBool useVBO)
00187 { set(state,useVBO); }
00188
00192 static void get(SoState *state,
00193 VertexOrdering &vertexOrdering,
00194 ShapeType &shapeType, FaceType &faceType);
00195
00199 static void get(SoState *state, WindingType &windingType );
00200
00204 static SbBool isVBOUsed(SoState *state) ;
00205
00209 static VertexOrdering getDefaultVertexOrdering()
00210 {
00211 return s_vertexOrderingDefault;
00212 }
00216 static ShapeType getDefaultShapeType()
00217 {
00218 return s_shapeTypeDefault;
00219 }
00223 static FaceType getDefaultFaceType()
00224 {
00225 return s_faceTypeDefault;
00226 }
00230 static WindingType getDefaultWindingType()
00231 {
00232 return s_windingTypeDefault;
00233 }
00237 static SbBool getDefaultVBOUsage()
00238 {
00239 return true;
00240 }
00241
00246 virtual void push(SoState *state);
00247
00251 virtual void print(FILE *fp) const;
00252
00253 private:
00254
00256 virtual void init(SoState *state);
00257
00261 virtual SbBool matches(const SoElement* elt) const;
00262
00266 virtual SoElement* copyMatchInfo() const;
00267
00268 private:
00269
00270 static void initClass();
00271 static void exitClass();
00272
00273 static bool isTwoSidedLighting(SoState *state);
00274 static void setForceTwoSidedLighting( SoState* state, bool forceTwoSidedLighting );
00275
00277 static bool isCulling(SoState *state);
00278
00280 bool isCulling() const;
00281
00283 static bool isCulling( VertexOrdering vertexOrdering, ShapeType shapeType );
00284
00286 static bool isCounterClockwise(SoState *state);
00287
00289 bool isCounterClockwise() const;
00290
00291 private:
00293 virtual void commonInit();
00294
00295
00296 virtual void setElt(VertexOrdering vertexOrdering, ShapeType shapeType, FaceType faceType);
00297
00298 virtual void setElt(WindingType windingType);
00299
00300
00301 virtual void setElt(VertexOrdering vertexOrdering, ShapeType shapeType, FaceType faceType,
00302 WindingType windingType, SbBool useVBO);
00303
00304 VertexOrdering vertexOrdering;
00305 ShapeType shapeType;
00306 FaceType faceType;
00307 WindingType windingType;
00308 SbBool useVBO ;
00309
00310 virtual ~SoShapeHintsElement();
00311
00312 private:
00313 bool isTwoSidedLighting() const;
00314
00315 bool m_forceTwoSidedLighting;
00316
00317 static void initVertexOrdering();
00318 static void initShapeType();
00319 static void initFaceType();
00320 static void initWindingType();
00321
00322 static VertexOrdering s_vertexOrderingDefault;
00323 static ShapeType s_shapeTypeDefault;
00324 static FaceType s_faceTypeDefault;
00325 static WindingType s_windingTypeDefault;
00326 };
00327
00328 #endif
00329
00330