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 namespace inventor
00089 {
00090 namespace helper
00091 {
00092 class GPUPicking;
00093 }
00094 }
00095
00096 #ifdef _MSC_VER
00097 #pragma warning( push )
00098 #pragma warning(disable:4251)
00099 #endif
00100
00316 class SoVertexShape : public SoShape {
00317
00318 SO_NODE_ABSTRACT_HEADER(SoVertexShape);
00319 SO_PIMPL_PUBLIC_HEADER(SoVertexShape)
00320
00321 public:
00326 SoSFNode vertexProperty;
00327
00333 SoNormalCache *getNormalCache() const;
00334
00340 SoTangentCache* getTangentCache() const;
00341
00342 private:
00343
00344
00345
00346
00347
00348 virtual void generateDefaultNormals(SoState *state,
00349 const SbVec3f *coords,
00350 int numCoords,
00351 SoNormalBundle *nb,
00352 SbBool storeRef = FALSE);
00353
00354
00355 void commonGenerateDefaultNormals(SoState *state, SoNormalBundle *nb);
00356
00357 virtual SbBool figureNormals(SoState *state, SoNormalBundle *nb);
00358
00365 virtual void generateDefaultTangents( SoState* state,
00366 const SbVec3f* coords,
00367 int numCoords,
00368 SoTangentBundle* tb,
00369 SbBool storeRef = FALSE );
00370
00371
00372 void commonGenerateDefaultTangents( SoState* state, SoTangentBundle* tb );
00373
00374 virtual SbBool figureTangents( SoState* state, SoTangentBundle* tb );
00375
00376 virtual void write(SoWriteAction *writeAction);
00377
00378
00379 virtual void GLRender(SoGLRenderAction *action);
00380
00381 private:
00382 static void initClass();
00383 static void exitClass();
00384
00385
00386 virtual void notify(SoNotList *list);
00387
00388 const SiCoordinateGetter* getCoordinateGetter(const SoState* state, bool ignoreProjectionElementDepth = false);
00389
00399 virtual SoVertexShaderParameterBufferObject* createPrimitiveIdentifierVertexShaderParameter( SoState* state );
00400
00401 private:
00402
00403 SoVertexShape();
00404
00405 virtual ~SoVertexShape();
00406
00407
00408
00409
00410 virtual SbBool shouldGLRender(SoGLRenderAction *action,
00411 SbBool isPointsOrLines = FALSE);
00412
00413
00414
00415
00416 virtual void exitRender(SoState *state,int stateFlag,
00417 SoTextureCoordinateBundle *tcb,
00418 SoTextureCoordinate3Bundle *tc3b);
00419
00420
00421
00422
00423 virtual void setupRenderFunctions(SoState *state,int &stateFlag);
00424
00425 virtual void callSetupIndices(SoState* state, const SoShapeStyleElement* shapeStyle,uint32_t useTexCoordsAnyway);
00426
00427
00428 virtual void shouldGenerateTextureCoordinates(SoGLRenderAction *action,
00429 int &stateFlag,
00430 SoShapeStyleElement *&shapeStyle,
00431 uint32_t &useTexCoordsAnyway,
00432 SoTextureCoordinateBundle *&tcb,
00433 SoTextureCoordinate3Bundle *&tc3b);
00434
00435
00436 virtual SbBool shouldGenerateTexture3DCoordinates(){return FALSE;}
00437
00438
00439 virtual void checkAutoCaching(SoGLRenderAction* action, const SoShapeStyleElement* shapeStyle, SbBool settingVPCache);
00440
00441
00442 virtual SbBool checkTex3Coords(){return FALSE;}
00443
00444
00445 virtual void doRendering(SoGLRenderAction *action, const SoShapeStyleElement* shapeStyle);
00446
00447
00448 virtual void render(SoGLRenderAction *action,SbBool isPointsOrLines);
00449
00450
00451 virtual void shouldGenerateNormals(SoGLRenderAction *action,const SoShapeStyleElement *shapeStyle);
00452
00453
00454 virtual void shouldGenerateTangents( SoGLRenderAction* action, const SoShapeStyleElement* shapeStyle );
00455
00456
00457 virtual SbBool shouldCheckShapeHints(){ return FALSE;}
00458
00459 virtual SbBool shapeHintsTest( SoState *state = NULL );
00460
00461
00462 virtual SbBool checkShapeHints(SoGLRenderAction *action);
00463
00464
00465 virtual void setupLazyElement(SoGLRenderAction *action,const SoShapeStyleElement *shapeStyle);
00466
00467
00468 virtual void checkShapeStyle(SoState *state,const SoShapeStyleElement *shapeStyle);
00469
00470
00471
00472
00473 static int32_t* allocateSequential(const int howMany);
00474 static int32_t* getConsecutiveIndices();
00475
00479 virtual bool canUseGPUPicking( SoRayPickAction* action );
00480 virtual bool hasGeneratePrimitiveCache()
00481 {
00482 return false;
00483 }
00484
00485
00486 inventor::helper::GPUPicking* m_pickingHelper;
00487
00488 static const int s_minVerticesForGPUPicking;
00489
00490 private:
00491 void commonConstructor();
00492
00493 void setupColorMaterial(SoState* state);
00494 };
00495
00496 inline void
00497 SoVertexShape::generateDefaultNormals(SoState *, const SbVec3f *, int , SoNormalBundle *, SbBool )
00498 {}
00499
00500 inline void
00501 SoVertexShape::generateDefaultTangents( SoState*, const SbVec3f*, int, SoTangentBundle*, SbBool )
00502 {}
00503
00504 inline void
00505 SoVertexShape::setupRenderFunctions(SoState *,int &)
00506 {}
00507
00508 inline void
00509 SoVertexShape::callSetupIndices(SoState*, const SoShapeStyleElement* ,uint32_t )
00510 {}
00511
00512 inline void
00513 SoVertexShape::doRendering(SoGLRenderAction *, const SoShapeStyleElement* )
00514 {}
00515
00516
00517 #ifdef _MSC_VER
00518 #pragma warning( pop )
00519 #endif
00520
00521 #endif
00522
00523