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
00051 #ifndef _SO_VRMLINDEXED_FACE_SET_
00052 #define _SO_VRMLINDEXED_FACE_SET_
00053
00054 #include <Inventor/fields/SoSFFloat.h>
00055 #include <Inventor/fields/SoSFBool.h>
00056 #include <Inventor/SbColor.h>
00057 #include <Inventor/fields/SoMFFloat.h>
00058 #include <Inventor/VRMLnodes/SoVRMLIndexedShape.h>
00059
00060
00061 #if defined(OIV_IGNORE_VRML_DEPRECATED)
00062 #include <SoDeprecationRules.h>
00063 #pragma push_macro("SoDEPRECATED_CLASS")
00064 #pragma push_macro("SoDEPRECATED_TYPEDEF")
00065 #undef SoDEPRECATED_CLASS
00066 #undef SoDEPRECATED_TYPEDEF
00067 #define SoDEPRECATED_CLASS(x,y)
00068 #define SoDEPRECATED_TYPEDEF(x,y)
00069 #endif
00070
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00083
00084
00085
00086 #define SO_END_FACE_INDEX (-1)
00087
00088 class SoNormalBundle;
00089 class SoCoordinateElement;
00090 class SoShapeStyleElement;
00091 class SoDEPRECATED SoVRMLIndexedFaceSet : public SoVRMLIndexedShape {
00272
00273 SO_NODE_HEADER(SoVRMLIndexedFaceSet);
00274
00275 public:
00276
00277
00283 SoSFBool ccw;
00289 SoSFBool solid;
00295 SoSFBool convex;
00302 SoSFFloat creaseAngle;
00303
00307 SoVRMLIndexedFaceSet();
00308
00309 private:
00310
00311 virtual void GLRender(SoGLRenderAction *action);
00312 virtual void generatePick(SoRayPickAction *action, SoNode *node);
00313 virtual void getPrimitiveCount(SoGetPrimitiveCountAction *action);
00314
00315
00316
00317
00318 virtual SbBool generateDefaultNormals(SoState *state,
00319 SoNormalBundle *nb);
00320
00321
00322
00323 typedef void (SoVRMLIndexedFaceSet::*PMFS)(SoGLRenderAction *);
00324
00325 private:
00326 static void initClass();
00327 static void exitClass();
00328
00329 private:
00330
00331 enum Binding {
00332 OVERALL, PER_FACE, PER_FACE_INDEXED, PER_VERTEX,
00333 PER_VERTEX_INDEXED
00334 };
00335
00336 virtual void generatePrimitives(SoAction *action);
00337
00338
00339 virtual SoDetail * createTriangleDetail(SoRayPickAction *action,
00340 const SoPrimitiveVertex *v1,
00341 const SoPrimitiveVertex *v2,
00342 const SoPrimitiveVertex *v3,
00343 SoPickedPoint *pp);
00344 ~SoVRMLIndexedFaceSet();
00345
00346 private:
00347
00348 Binding savedNormalBinding;
00349
00350
00351 static Binding getMaterialBinding(SoAction *action);
00352 Binding getNormalBinding(SoAction *action, SoNormalBundle *nb);
00353
00354
00355
00356 SbBool figureNormals(SoState *state, SoNormalBundle *nb);
00357
00358
00359 virtual void notify(SoNotList *list);
00360
00361
00362 void setupNumTrisQuadsFaces();
00363
00364
00365 int numTris, numQuads, numFaces;
00366
00367
00368
00369
00370
00371
00372
00373 void TriOmOn(SoGLRenderAction *); void TriOmOnT(SoGLRenderAction *);
00374 void TriOmFn(SoGLRenderAction *); void TriOmFnT(SoGLRenderAction *);
00375 void TriOmVn(SoGLRenderAction *); void TriOmVnT(SoGLRenderAction *);
00376 void TriFmOn(SoGLRenderAction *); void TriFmOnT(SoGLRenderAction *);
00377 void TriFmFn(SoGLRenderAction *); void TriFmFnT(SoGLRenderAction *);
00378 void TriFmVn(SoGLRenderAction *); void TriFmVnT(SoGLRenderAction *);
00379 void TriVmOn(SoGLRenderAction *); void TriVmOnT(SoGLRenderAction *);
00380 void TriVmFn(SoGLRenderAction *); void TriVmFnT(SoGLRenderAction *);
00381 void TriVmVn(SoGLRenderAction *); void TriVmVnT(SoGLRenderAction *);
00382 void QuadOmOn(SoGLRenderAction *);void QuadOmOnT(SoGLRenderAction *);
00383 void QuadOmFn(SoGLRenderAction *); void QuadOmFnT(SoGLRenderAction *);
00384 void QuadOmVn(SoGLRenderAction *); void QuadOmVnT(SoGLRenderAction *);
00385 void QuadFmOn(SoGLRenderAction *); void QuadFmOnT(SoGLRenderAction *);
00386 void QuadFmFn(SoGLRenderAction *); void QuadFmFnT(SoGLRenderAction *);
00387 void QuadFmVn(SoGLRenderAction *); void QuadFmVnT(SoGLRenderAction *);
00388 void QuadVmOn(SoGLRenderAction *); void QuadVmOnT(SoGLRenderAction *);
00389 void QuadVmFn(SoGLRenderAction *); void QuadVmFnT(SoGLRenderAction *);
00390 void QuadVmVn(SoGLRenderAction *); void QuadVmVnT(SoGLRenderAction *);
00391 void GenOmOn(SoGLRenderAction *); void GenOmOnT(SoGLRenderAction *);
00392 void GenOmFn(SoGLRenderAction *); void GenOmFnT(SoGLRenderAction *);
00393 void GenOmVn(SoGLRenderAction *); void GenOmVnT(SoGLRenderAction *);
00394 void GenFmOn(SoGLRenderAction *); void GenFmOnT(SoGLRenderAction *);
00395 void GenFmFn(SoGLRenderAction *); void GenFmFnT(SoGLRenderAction *);
00396 void GenFmVn(SoGLRenderAction *); void GenFmVnT(SoGLRenderAction *);
00397 void GenVmOn(SoGLRenderAction *); void GenVmOnT(SoGLRenderAction *);
00398 void GenVmFn(SoGLRenderAction *); void GenVmFnT(SoGLRenderAction *);
00399 void GenVmVn(SoGLRenderAction *); void GenVmVnT(SoGLRenderAction *);
00400
00401
00402 static PMFS TriRenderFunc[32];
00403 static PMFS QuadRenderFunc[32];
00404 static PMFS GenRenderFunc[32];
00405
00406 static const int AUTO_CACHE_MIN_WITHOUT_VP;
00407 static const int AUTO_CACHE_MAX;
00408
00409 private:
00410 int va_normal_cache;
00411 int va_flag_normal;
00412 char *va_normalArray;
00413 int va_normalArray_size;
00414
00415 int va_texCoord_cache;
00416 int va_flag_texCoord;
00417 char *va_texCoordArray;
00418 int va_texCoordArray_size;
00419
00420 int va_color_cache;
00421 int va_flag_color;
00422 char *va_color1Array;
00423 int va_color1Array_size;
00424 char *va_color2Array;
00425 int va_color2Array_size;
00426
00427 static int *va_array1;
00428 static int va_array1_size;
00429
00430 void vaCheckTexCoord();
00431 void vaCheckNormal();
00432 void vaCheckTexCoord_Normal();
00433 void vaCheckColor();
00434 void vaCheckTexCoord_Color();
00435 void vaCheckNormal_Color();
00436 void vaCheckTexCoord_Normal_Color();
00437 typedef void (SoVRMLIndexedFaceSet::*va_PMFS)();
00438 static va_PMFS va_RenderFunc[32];
00439 };
00440
00441
00442
00443 #if defined(OIV_IGNORE_VRML_DEPRECATED)
00444 #pragma pop_macro("SoDEPRECATED_TYPEDEF")
00445 #pragma pop_macro("SoDEPRECATED_CLASS")
00446 #endif
00447
00448 #endif
00449