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 #ifndef _SO_VOLUME_QUALITY_H_
00026 #define _SO_VOLUME_QUALITY_H_
00027
00028
00029 #include <Inventor/SbBasic.h>
00030 #include <Inventor/fields/SoMFNode.h>
00031 #include <Inventor/fields/SoSFBitMask.h>
00032 #include <Inventor/fields/SoSFColor.h>
00033 #include <Inventor/fields/SoSFFloat.h>
00034 #include <Inventor/nodes/SoNode.h>
00035 #include <Inventor/nodes/SoSubNode.h>
00036 #include <VolumeViz/nodes/SoVolumeShader.h>
00037
00038
00039 class SoFragmentShader;
00040 class SoVertexShader;
00041 class SoTransferFunction;
00042 class SoVolumeShader;
00043
00335 class SoVolumeRenderingQuality : public SoVolumeShader {
00336
00337 SO_NODE_HEADER(SoVolumeRenderingQuality);
00338
00339 public:
00341 enum GradientQuality
00342 {
00348 LOW = SoVolumeShader::GRADIENT_FORWARD_DIFF,
00349
00355 MEDIUM = SoVolumeShader::GRADIENT_CENTRAL_DIFF,
00356
00362 HIGH = SoVolumeShader::GRADIENT_SOBEL,
00363 #ifndef HIDDEN_FROM_DOC
00364 LAST_GRADIENT_QUALITY
00365 #endif
00366 };
00367
00369 enum LightingModel
00370 {
00375 OIV6 = SoVolumeShader::OIV6,
00383 OPENGL = SoVolumeShader::OPENGL
00384 };
00385
00391 enum EdgeDetect2DMethod {
00393 LUMINANCE = 1,
00394
00396 DEPTH = 1 << 1,
00397
00401 GRADIENT = 1 << 2
00402 };
00403
00407 SoVolumeRenderingQuality();
00408
00437 SoSFBool lighting;
00438
00457 SoSFBool preIntegrated;
00458
00471 SoSFBool jittering;
00472
00481 SoSFFloat gradientThreshold;
00482
00494 SoSFBool edgeColoring;
00495
00502 SoSFColor edgeColor;
00503
00512 SoSFFloat edgeThreshold;
00513
00525 SoSFBool boundaryOpacity;
00526
00533 SoSFFloat boundaryOpacityIntensity;
00534
00542 SoSFFloat boundaryOpacityThreshold;
00543
00551 SoSFBool edgeDetect2D;
00552
00560 SoSFFloat edgeDetect2DInnerThreshold;
00561
00569 SoSFFloat edgeDetect2DOuterThreshold;
00570
00581 SoSFBitMask edgeDetect2DMethod;
00582
00591 SoSFEnum gradientQuality;
00592
00601 SoSFEnum lightingModel;
00602
00616 SoSFBool colorInterpolation;
00617
00628 SoSFFloat surfaceScalarExponent;
00629
00643 SoSFFloat unnormalizedGradientExponent;
00644
00650 SoSFBool segmentedInterpolation;
00651
00658 SoSFFloat segmentedInterpolationThreshold;
00659
00669 SoSFBool voxelizedRendering;
00670
00686 SoSFBool voxelOutline;
00687
00696 SoSFFloat voxelOutlineThreshold;
00697
00704 SoSFFloat voxelOutlineWidth;
00705
00712 SoSFColor voxelOutlineColor;
00713
00727 SoSFBool ambientOcclusion;
00728
00767 SoSFBool deferredLighting;
00768
00769 #if 1 SoDEPRECATED
00779 SoSFBool cubicInterpolation;
00780
00781 #endif
00783 #ifndef HIDDEN_FROM_DOC
00784 private:
00785
00787 SoSFFloat AORadius;
00789 SoSFFloat AONumSample;
00791 SoSFFloat AOKernelSize;
00793 SoSFBool AOUseNormal;
00795 SoSFBool AOShowAO;
00797 SoSFBool AOShowNormal;
00798
00799 void GLRender(SoGLRenderAction *action);
00800 virtual void doAction(SoAction *action);
00801 virtual void notify(SoNotList* list);
00802
00803
00804 static void initClass();
00805 static void exitClass();
00806
00808 SoVolumeShader::GradientMethod getGradientMethod(SoState* state) const;
00809
00811 SbBool hasEdgeDetect2d(SoState* state) const;
00812
00814 SbBool hasAmbientOcclusion(SoState* state) const;
00815
00817 SbBool hasDeferredLighting(SoState* state) const;
00818
00820 SbBool hasCubicInterpolation(SoState* state) const;
00821
00823 SbBool hasBoundaryOpacity(SoState* state) const;
00824
00826 virtual void installTextures(SoGLRenderAction* action);
00827
00829 virtual SbString getRenderingModeFragmentName(SoState* state);
00830
00832 virtual SbString getNeededFragmentMainFilename(SoState* state);
00833
00835 virtual SbString getNeededVertexMainFilename(SoState* state);
00836
00838 virtual SbBool isRaycastingEnabled(SoState* state) const;
00839
00841 virtual void allocateTextureUnit(SoGLRenderAction *action) const;
00842
00844 SbBool isVoxelizedRenderingEnabled(SoState* state) const;
00845
00847 bool isPreintegratedEnabled(SoState* state) const;
00848
00850 void setRemovePhysicalQuality( bool removePhysicalQuality );
00851
00853 void setRenderMode( SoVolumeRender::RenderMode renderMode ) { m_renderMode = renderMode; }
00854 private:
00856 virtual bool isInterpolationActive(SoGLRenderAction* action);
00857
00858 virtual ~SoVolumeRenderingQuality();
00859
00860 #endif
00861
00862 private:
00863
00864 enum FragMainPos
00865 {
00866 FRAG_VOLUME_RENDERING = 0,
00867 FRAG_VOLUME_RENDERING_PREINTEGRATED,
00868 FRAG_VOLUME_RENDERING_PREINTEGRATED_LIGHTED,
00869 FRAG_VOLUME_RENDERING_LIGHTED,
00870 FRAG_LAST
00871 };
00872
00873 static const float DEFAULT_INNER_EDGE_THRESHOLD;
00874 static const float DEFAULT_OUTTER_EDGE_THRESHOLD;
00875
00877 void checkAndUpdateEdge2DSupport(SoGLRenderAction* action);
00878
00880 bool updateTransferFunctionCache(SoGLRenderAction* action);
00881
00883 SbBool isLighted(SoState* state) const;
00884
00886 SbBool hasEdgeColoring(SoState* state) const;
00887
00888
00889 SoFragmentShader* m_fragMains[FRAG_LAST];
00890
00895 SoFragmentShader* getFragmentMain(SoState* state);
00896
00901 void clampEdgeDetect2dFields();
00902
00904 void setupBoundedFields(SoState *state);
00905
00906 SoCache *m_tfCache;
00907 void addCacheDependencies(SoCache *cache, SoState *state);
00908
00909 bool m_needUpdate;
00910
00911 SoGLTexture *m_texPreIntegrated;
00912
00913
00914 void createPreIntegratedTexture(SoState *state);
00915
00917 bool m_removePhysicalQuality;
00918
00920 SoVolumeRender::RenderMode m_renderMode;
00921 };
00922
00923
00924 #endif
00925
00926
00927