00001 /*======================================================================= 00002 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), *** 00003 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. *** 00004 *** *** 00005 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS *** 00006 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR *** 00007 *** WRITTEN AUTHORIZATION OF FEI S.A.S. *** 00008 *** *** 00009 *** RESTRICTED RIGHTS LEGEND *** 00010 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS *** 00011 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN *** 00012 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT *** 00013 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN *** 00014 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. *** 00015 *** *** 00016 *** COPYRIGHT (C) 1996-2019 BY FEI S.A.S, *** 00017 *** MERIGNAC, FRANCE *** 00018 *** ALL RIGHTS RESERVED *** 00019 **=======================================================================*/ 00020 /*======================================================================= 00021 ** Author : Benjamin GRANGE (Aug 2005) 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 <Inventor/nodes/SoGroup.h> 00037 #include <VolumeViz/nodes/SoVolumeShader.h> 00038 00039 /*----------------------------------------------------------------------------*/ 00040 class SoFragmentShader; 00041 class SoVertexShader; 00042 class SoTransferFunction; 00043 class SoVolumeShader; 00044 class SoNodeDependencies; 00045 00320 class SoVolumeRenderingQuality : public SoVolumeShader { 00321 00322 SO_NODE_HEADER(SoVolumeRenderingQuality); 00323 00324 public: 00326 enum GradientQuality 00327 { 00333 LOW = 0, 00334 00340 MEDIUM, 00341 00347 HIGH, 00348 #ifndef HIDDEN_FROM_DOC 00349 LAST_GRADIENT_QUALITY 00350 #endif 00351 }; 00352 00358 enum EdgeDetect2DMethod { 00360 LUMINANCE = 1, 00361 00363 DEPTH = 1 << 1, 00364 00368 GRADIENT = 1 << 2 00369 }; 00370 00374 SoVolumeRenderingQuality(); 00375 00404 SoSFBool lighting; 00405 00424 SoSFBool preIntegrated; 00425 00438 SoSFBool jittering; 00439 00448 SoSFFloat gradientThreshold; 00449 00461 SoSFBool edgeColoring; 00462 00469 SoSFColor edgeColor; 00470 00479 SoSFFloat edgeThreshold; 00480 00492 SoSFBool boundaryOpacity; 00493 00500 SoSFFloat boundaryOpacityIntensity; 00501 00509 SoSFFloat boundaryOpacityThreshold; 00510 00518 SoSFBool edgeDetect2D; 00519 00527 SoSFFloat edgeDetect2DInnerThreshold; 00528 00536 SoSFFloat edgeDetect2DOuterThreshold; 00537 00548 SoSFBitMask edgeDetect2DMethod; 00549 00558 SoSFEnum gradientQuality; 00559 00573 SoSFBool colorInterpolation; 00574 00585 SoSFFloat surfaceScalarExponent; 00586 00600 SoSFFloat unnormalizedGradientExponent; 00601 00607 SoSFBool segmentedInterpolation; 00608 00615 SoSFFloat segmentedInterpolationThreshold; 00616 00623 SoSFBool voxelizedRendering; 00624 00640 SoSFBool voxelOutline; 00641 00650 SoSFFloat voxelOutlineThreshold; 00651 00658 SoSFFloat voxelOutlineWidth; 00659 00666 SoSFColor voxelOutlineColor; 00667 00681 SoSFBool ambientOcclusion; 00682 00719 SoSFBool deferredLighting; 00720 00721 #if 1 SoDEPRECATED 00731 SoSFBool cubicInterpolation; 00732 00733 #endif 00735 #if 1 SoDEPRECATED enum LightingModel 00739 { 00740 OIV6, 00741 OPENGL 00742 }; 00743 SoDEPRECATED 00753 SoSFEnum lightingModel; 00754 00755 #endif 00757 #ifndef HIDDEN_FROM_DOC 00758 private: 00759 00761 SoSFFloat AORadius; 00763 SoSFFloat AONumSample; 00765 SoSFFloat AOKernelSize; 00767 SoSFBool AOUseNormal; 00769 SoSFBool AOShowAO; 00771 SoSFBool AOShowNormal; 00772 00773 void GLRender(SoGLRenderAction *action); 00774 virtual void doAction(SoAction *action); 00775 virtual void notify(SoNotList* list); 00776 00777 // Initializes the classes. 00778 static void initClass(); 00779 static void exitClass(); 00780 00782 GradientQuality getGradientMethod(SoState* state) const; 00783 00785 SbBool hasEdgeDetect2d(SoState* state) const; 00786 00788 SbBool hasAmbientOcclusion(SoState* state) const; 00789 00791 SbBool hasDeferredLighting(SoState* state) const; 00792 00794 SbBool hasCubicInterpolation(SoState* state) const; 00795 00797 SbBool hasBoundaryOpacity(SoState* state) const; 00798 00800 virtual void installTextures(SoGLRenderAction* action); 00801 00803 virtual SbBool isRaycastingEnabled(SoState* state) const; 00804 00806 virtual void allocateTextureUnit(SoGLRenderAction *action) const; 00807 00809 SbBool isVoxelizedRenderingEnabled(SoState* state) const; 00810 00812 virtual bool isInterpolationActive(SoGLRenderAction* action); 00813 00815 virtual bool isColorInterpolationEnabled(SoState* state); 00816 00818 SbBool isLighted(SoState* state) const; 00819 00821 bool isPreintegratedEnabled(SoState* state) const; 00822 00824 void setRemovePhysicalQuality( bool removePhysicalQuality ); 00825 00827 void setRenderMode( SoVolumeRender::RenderMode renderMode ) { m_renderMode = renderMode; } 00828 private: 00829 00830 virtual ~SoVolumeRenderingQuality(); 00831 00832 #endif 00833 00834 private: 00835 00836 static const float DEFAULT_INNER_EDGE_THRESHOLD; 00837 static const float DEFAULT_OUTTER_EDGE_THRESHOLD; 00838 00840 void checkAndUpdateEdge2DSupport(SoGLRenderAction* action); 00841 00843 SbBool hasEdgeColoring(SoState* state) const; 00844 00849 void clampEdgeDetect2dFields(); 00850 00851 SoNodeDependencies* m_transferFunctionCache; 00852 00856 SoRef<SoGroup> m_preIntegratedScene; 00857 00859 bool m_removePhysicalQuality; 00860 00862 SoVolumeRender::RenderMode m_renderMode; 00863 }; 00864 /*----------------------------------------------------------------------------*/ 00865 00866 #endif /*_SO_VOLUME_QUALITY_H_*/ 00867 00868 00869