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_VERTEX_SHAPE_
00051 #define _SO_VERTEX_SHAPE_
00052
00053 #include <Inventor/nodes/SoShape.h>
00054 #include <Inventor/nodes/SoVertexProperty.h>
00055 #include <Inventor/fields/SoSFNode.h>
00056 #include <Inventor/threads/SbThreadSpinlock.h>
00057 #include <Inventor/elements/SoNormalBindingElement.h>
00058 #include <Inventor/elements/SoTangentBindingElement.h>
00059 #include <Inventor/STL/map>
00060 #include <Inventor/SbPImpl.h>
00061 #include <Inventor/nodes/SoVertexShader.h>
00062
00064
00065
00066
00067
00068
00069
00070
00071
00073
00074 class SoGLRenderAction;
00075 class SoNormalBundle;
00076 class SoNormalCache;
00077 class SoTangentBundle;
00078 class SoTangentCache;
00079 class SoShapeStyleElement;
00080 class SoState;
00081 class SoTextureCoordinateBundle;
00082 class SoTextureCoordinate3Bundle;
00083 class SiCoordinateGetter;
00084
00085 SO_PIMPL_PUBLIC_DECLARATION( SoVertexShape )
00086
00087 class SoVertexAttribData;
00088
00089 #ifdef _MSC_VER
00090 #pragma warning( push )
00091 #pragma warning(disable:4251)
00092 #endif
00093
00309 class SoVertexShape : public SoShape {
00310
00311 SO_NODE_ABSTRACT_HEADER(SoVertexShape);
00312 SO_PIMPL_PUBLIC_HEADER(SoVertexShape)
00313
00314 public:
00319 SoSFNode vertexProperty;
00320
00326 SoNormalCache *getNormalCache() const;
00327
00333 SoTangentCache* getTangentCache() const;
00334
00335 private:
00336
00337
00338
00339
00340
00341 virtual void generateDefaultNormals(SoState *state,
00342 const SbVec3f *coords,
00343 int numCoords,
00344 SoNormalBundle *nb,
00345 SbBool storeRef = FALSE);
00346
00347
00348 void commonGenerateDefaultNormals(SoState *state, SoNormalBundle *nb);
00349
00350 virtual SbBool figureNormals(SoState *state, SoNormalBundle *nb);
00351
00358 virtual void generateDefaultTangents( SoState* state,
00359 const SbVec3f* coords,
00360 int numCoords,
00361 SoTangentBundle* tb,
00362 SbBool storeRef = FALSE );
00363
00364
00365 void commonGenerateDefaultTangents( SoState* state, SoTangentBundle* tb );
00366
00367 virtual SbBool figureTangents( SoState* state, SoTangentBundle* tb );
00368
00369 virtual void write(SoWriteAction *writeAction);
00370
00371
00372 virtual void GLRender(SoGLRenderAction *action);
00373
00374 private:
00375 static void initClass();
00376 static void exitClass();
00377
00378
00379 virtual void notify(SoNotList *list);
00380
00381 const SiCoordinateGetter* getCoordinateGetter(const SoState* state, bool ignoreProjectionElementDepth = false);
00382
00383 private:
00384
00385 SoVertexShape();
00386
00387 virtual ~SoVertexShape();
00388
00389
00390
00391
00392 virtual SbBool shouldGLRender(SoGLRenderAction *action,
00393 SbBool isPointsOrLines = FALSE);
00394
00395
00396
00397
00398 virtual void exitRender(SoState *state,int stateFlag,
00399 SoTextureCoordinateBundle *tcb,
00400 SoTextureCoordinate3Bundle *tc3b);
00401
00402
00403
00404
00405 virtual void setupRenderFunctions(SoState *state,int &stateFlag);
00406
00407 virtual void callSetupIndices(SoState* state, const SoShapeStyleElement* shapeStyle,uint32_t useTexCoordsAnyway);
00408
00409
00410 virtual void shouldGenerateTextureCoordinates(SoGLRenderAction *action,
00411 int &stateFlag,
00412 SoShapeStyleElement *&shapeStyle,
00413 uint32_t &useTexCoordsAnyway,
00414 SoTextureCoordinateBundle *&tcb,
00415 SoTextureCoordinate3Bundle *&tc3b);
00416
00417
00418 virtual SbBool shouldGenerateTexture3DCoordinates(){return FALSE;}
00419
00420
00421 virtual void checkAutoCaching(SoGLRenderAction* action, const SoShapeStyleElement* shapeStyle, SbBool settingVPCache);
00422
00423
00424 virtual SbBool checkTex3Coords(){return FALSE;}
00425
00426
00427 virtual void doRendering(SoGLRenderAction *action, const SoShapeStyleElement* shapeStyle);
00428
00429
00430 virtual void render(SoGLRenderAction *action,SbBool isPointsOrLines);
00431
00432
00433 virtual void shouldGenerateNormals(SoGLRenderAction *action,const SoShapeStyleElement *shapeStyle);
00434
00435
00436 virtual void shouldGenerateTangents( SoGLRenderAction* action, const SoShapeStyleElement* shapeStyle );
00437
00438
00439 virtual SbBool shouldCheckShapeHints(){ return FALSE;}
00440
00441 virtual SbBool shapeHintsTest( SoState *state = NULL );
00442
00443
00444 virtual SbBool checkShapeHints(SoGLRenderAction *action);
00445
00446
00447 virtual void setupLazyElement(SoGLRenderAction *action,const SoShapeStyleElement *shapeStyle);
00448
00449
00450 virtual void checkShapeStyle(SoState *state,const SoShapeStyleElement *shapeStyle);
00451
00452
00453
00454
00455 static int32_t* allocateSequential(const int howMany);
00456 static int32_t* getConsecutiveIndices();
00457
00458 virtual bool hasGeneratePrimitiveCache()
00459 {
00460 return false;
00461 }
00462
00463 private:
00464 void commonConstructor();
00465
00466 void setupColorMaterial(SoState* state);
00467 };
00468
00469 inline void
00470 SoVertexShape::generateDefaultNormals(SoState *, const SbVec3f *, int , SoNormalBundle *, SbBool )
00471 {}
00472
00473 inline void
00474 SoVertexShape::generateDefaultTangents( SoState*, const SbVec3f*, int, SoTangentBundle*, SbBool )
00475 {}
00476
00477 inline void
00478 SoVertexShape::setupRenderFunctions(SoState *,int &)
00479 {}
00480
00481 inline void
00482 SoVertexShape::callSetupIndices(SoState*, const SoShapeStyleElement* ,uint32_t )
00483 {}
00484
00485 inline void
00486 SoVertexShape::doRendering(SoGLRenderAction *, const SoShapeStyleElement* )
00487 {}
00488
00489
00490 #ifdef _MSC_VER
00491 #pragma warning( pop )
00492 #endif
00493
00494 #endif
00495
00496