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-2021 BY FEI S.A.S, *** 00017 *** BORDEAUX, FRANCE *** 00018 *** ALL RIGHTS RESERVED *** 00019 =================================================================================*/ 00020 #ifndef _SO_OFFSCREEN_VOLUME_RENDER_H_ 00021 #define _SO_OFFSCREEN_VOLUME_RENDER_H_ 00022 00023 #include <Inventor/SbPImpl.h> 00024 #include <Inventor/nodes/SoNode.h> 00025 00026 #include <Inventor/fields/SoSFNode.h> 00027 #include <Inventor/fields/SoSFBool.h> 00028 #include <Inventor/fields/SoSFFloat.h> 00029 #include <Inventor/fields/SoSFVec3i32.h> 00030 #include <Inventor/fields/SoSFPath.h> 00031 #include <Inventor/fields/SoSFMatrix.h> 00032 #include <Inventor/fields/SoSFEnum.h> 00033 00034 #include <VolumeViz/nodes/SoVolumeData.h> 00035 00036 class SoBufferObject; 00037 class SoCamera; 00038 class SoFrameBufferObject; 00039 class SoSceneManager; 00040 00041 SO_PIMPL_PUBLIC_DECLARATION( SoOffscreenVolumeRender ) 00042 00043 00092 class SoOffscreenVolumeRender : public SoNode 00093 { 00094 SO_NODE_ABSTRACT_HEADER(SoOffscreenVolumeRender); 00095 00096 SO_PIMPL_PUBLIC_HEADER( SoOffscreenVolumeRender ) 00097 00098 public: 00099 00101 SoOffscreenVolumeRender(); 00102 00104 SoSFNode volumerenderSceneGraph; 00105 00107 SoSFNode bboxSceneGraph; 00108 00110 SoSFVec3i32 boxSize; 00111 00115 SoSFBool trigger; 00116 00120 SoSFFloat opacityThreshold; 00121 00123 enum Components 00124 { 00126 ALPHA, 00128 RGBA 00129 }; 00130 00135 SoSFEnum components; 00136 00141 SbVec3i32 getMaxBoxSize( SoState* state = NULL ); 00142 00143 00147 SbBox3d ijkToXyzBox( const SbBox3i32& ijkBox ); 00148 00189 SoSFMatrix dataSpaceMatrix; 00190 00198 bool synchronousExtraction( SoSceneManager* sceneManager ); 00199 00200 SoEXTENDER_Documented private: 00206 virtual SbBool getNextSubBox( SbBox3i32& box ) = 0; 00207 00214 virtual void boxComputed( SoGLRenderAction* action, SoBufferObject* data, const SbBox3i32& box ) = 0; 00215 00216 private: 00217 00219 virtual void GLRender( SoGLRenderAction* action ); 00220 00221 private: 00222 00230 SoSFPath volumerenderPath; 00231 00232 // Internal: 00233 static void initClass(); 00234 static void exitClass(); 00235 00236 SbBox3f getBoundingBox( SoAction* action ); 00237 00238 void setSliceNumber( SoState* state, int slice ); 00239 00244 bool needClearTarget( SoState* state, int slice ); 00245 00246 void beginOffscreenRendering( SoState* state ); 00247 void endOffscreenRendering( SoState* state ); 00248 virtual void notify( SoNotList* list ); 00249 00250 // check that the not is OK to do SoVolumeRender offscreen operation 00251 bool isReady() const; 00252 00253 private: 00255 virtual ~SoOffscreenVolumeRender(); 00256 00259 SbBox3i32 m_currentSubBox; 00260 00263 int m_currentSliceNumberInSubBox; 00264 00268 int m_currentSubBoxNumber; 00269 00270 private : 00271 00272 void commonConstructor(); 00273 00274 }; 00275 00276 #endif //_SO_OFFSCREEN_VOLUME_RENDER_H_ 00277 00278 00279