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-2014 BY FEI S.A.S, *** 00017 *** BORDEAUX, FRANCE *** 00018 *** ALL RIGHTS RESERVED *** 00019 **=======================================================================*/ 00020 /*======================================================================= 00021 ** Author : VSG (MMM YYYY) 00022 **=======================================================================*/ 00023 #ifndef SOVOLUMEMASKGROUP_H 00024 #define SOVOLUMEMASKGROUP_H 00025 00026 #include <VolumeViz/nodes/SoVolumeRendering.h> 00027 #include <Inventor/nodes/SoGroup.h> 00028 #include <Inventor/nodes/SoSeparator.h> 00029 #include <Inventor/nodes/SoTexture2.h> 00030 #include <Inventor/nodes/SoTextureUnit.h> 00031 00032 class SbVec4ub; 00033 class SoVolumeDataDrawStyle; 00034 class SoTransferFunction; 00035 class SoCache; 00036 00078 class SoVolumeMaskGroup : public SoGroup 00079 { 00080 SO_NODE_HEADER(SoVolumeMaskGroup); 00081 public: 00085 SoVolumeMaskGroup(); 00086 00091 static short TRANSFERFUNCTION_INTERSECTION_ID; 00092 00093 private: 00095 virtual void GLRender(SoGLRenderAction *action); 00097 virtual void doAction(SoAction *action); 00099 virtual void pick(SoPickAction *action); 00100 00101 private: 00102 static void initClass(); 00103 static void exitClass(); 00104 00105 static int getTestTextureUnit(SoGLRenderAction *action); 00106 static int getStyleTextureUnit(SoGLRenderAction *action); 00107 00117 SoSFBool isosurfaceCompliance; 00118 00119 // Size of the vmTex (it is a square texture used to render boundary) 00120 static const int s_vmTexSize; 00121 00122 private: 00124 void updateCache(SoState *state); 00125 00126 ~SoVolumeMaskGroup(); 00127 00128 private: 00129 struct BoundaryPalette 00130 { 00132 BoundaryPalette(); 00133 unsigned char renderStyle; 00134 unsigned char padRenderStyle[3]; 00135 unsigned char diffuse[4]; 00136 unsigned char specular[3]; 00137 unsigned char shininess; 00138 }; 00139 00141 void setupIntersectionDrawStyle(SoAction* state); 00142 00147 SoVolumeDataDrawStyle* getVolumeDataDrawStyle(SoState* state); 00148 00150 void bindVmTexture(SoGLRenderAction* action, const SoLDM::DataSetIdPairList& dsList); 00151 00157 static bool isSupported(SoState* state); 00158 00160 void invalidateVolumeMaskTextures(SoState* state); 00161 00163 SoRef<SoTexture2> m_styleTexture; 00164 SoRef<SoTextureUnit> m_styleTextureUnit; 00165 00167 SoRef<SoTexture2> m_testTexture; 00168 SoRef<SoTextureUnit> m_testTextureUnit; 00169 00171 SoRef<SoTextureUnit> m_emptyTextureUnit; 00172 00173 SoRef<SoGroup> m_internalSceneGraph; 00174 00176 SoCache* m_cacheData; 00177 00179 SoCache* m_cacheStyle; 00180 00182 SoVolumeDataDrawStyle* m_defaultIntersectionDrawStyle; 00183 00185 SoTransferFunction* m_defaultIntersectionTf; 00186 00187 friend struct SetBoundsColorsAndStyles; 00188 }; 00189 00190 #endif 00191 00192 00193