![]() |
TAPs 0.7.7.3
|
00001 /****************************************************************************** 00002 TAPsModelDeformableGLSL_Visualization_3DTexture.hpp 00003 ******************************************************************************/ 00008 /****************************************************************************** 00009 SUKITTI PUNAK (05/12/2007) 00010 UPDATE (07/21/2007) 00011 ******************************************************************************/ 00012 #ifndef TAPs_MODEL_DEFORMABLE_GLSL_VISUALIZATION_3D_TEXTURE_HPP 00013 #define TAPs_MODEL_DEFORMABLE_GLSL_VISUALIZATION_3D_TEXTURE_HPP 00014 00015 //#include "../GLSL/TAPsGLSLFns.hpp" 00016 #include "TAPsModelDeformableGLSL.hpp" 00017 00018 BEGIN_NAMESPACE_TAPs__OpenGL 00019 //============================================================================= 00020 template <typename T> class ModelDeformableGLSL; // class forward 00021 //============================================================================= 00022 template <typename T> 00023 class ModelDeformableGLSL_Visualization_3DTexture { 00024 //----------------------------------------------------------------------------- 00025 // Member Functions ----------------------------------------------------------- 00026 public: 00027 //------------------------------------------------------------------------- 00028 // default constructor 00029 //ModelDeformableGLSL_Visualization_3DTexture (); 00030 //------------------------------------------------------------------------- 00031 // constructor 00032 ModelDeformableGLSL_Visualization_3DTexture ( 00033 ModelDeformableGLSL<T> * simDomain ); 00034 //------------------------------------------------------------------------- 00035 // destructor 00036 virtual ~ModelDeformableGLSL_Visualization_3DTexture (); 00037 //------------------------------------------------------------------------- 00038 virtual void Default (); 00039 virtual void Clear (); 00040 //------------------------------------------------------------------------- 00041 // Get/Set Fn(s) 00042 //------------------------------------------- 00043 // Ret OpenGL Texture Objects 00044 Texture * RetObject3DTextureVisualization () 00045 { return m_3DTextureVisualization; } 00046 Texture * RetObject1DTextureTransferFnLUT () 00047 { return m_1DTextureTransferFnLUT; } 00048 //------------------------------------------- 00049 // Get OpenGL Texture Names 00050 GLuint Get3DTextureVisualization () 00051 { 00052 if ( !m_3DTextureVisualization ) return 0; 00053 return m_3DTextureVisualization->GetTexture(0); 00054 } 00055 GLuint Get1DTextureTransferFnLUT () 00056 { 00057 if ( !m_1DTextureTransferFnLUT ) return 0; 00058 return m_1DTextureTransferFnLUT->GetTexture(0); 00059 } 00060 //------------------------------------------------------------------------- 00061 //========================================================================= 00062 // For Initializations & Setups 00063 //------------------------------------------------------------------------- 00067 bool SetupVisualization ( 00068 int resolutionX, int resolutionY, int resolutionZ, 00069 enum GridGenerator<T>::VertexFlag *** pFlagDataForXYZVoxels 00070 ) 00071 { 00072 if ( !Setup3DTextureForVisualization( 00073 resolutionX, resolutionY, resolutionZ, 00074 pFlagDataForXYZVoxels ) ) { 00075 return false; 00076 } 00077 if ( !Setup1DTextureForTransferFnLUT() ) { 00078 return false; 00079 } 00080 if ( !SetupFBOAndTextureForAlignedSliceDrawDirection() ) { 00081 return false; 00082 } 00083 if ( !SetupShadersFor3DTextureDrawDirectionAndDrawing() ) { 00084 return false; 00085 } 00086 return true; 00087 } 00091 bool Setup3DTextureForVisualization ( 00092 int resolutionX, int resolutionY, int resolutionZ, 00093 enum GridGenerator<T>::VertexFlag *** pFlagDataForXYZVoxels 00094 ); 00098 bool Setup1DTextureForTransferFnLUT (); 00102 bool SetupFBOAndTextureForAlignedSliceDrawDirection (); 00106 bool SetupShadersFor3DTextureDrawDirectionAndDrawing (); 00110 // bool Load1DTextureForTransferFnLUT ( 00111 // GLubyte const * lookupTableData // size of 256x4 00112 // ); 00113 //------------------------------------------------------------------------- 00114 //========================================================================= 00115 //------------------------------------------------------------------------- 00116 //virtual void DrawByGL ( DrawType drawType = POSITION_TEXTURE ); 00117 //virtual void DrawByGLSL ( DrawType drawType = POSITION_TEXTURE ); 00118 virtual void DrawByGL ( int iSubdivision = 1 ); 00119 virtual void DrawByGLSL ( int iSubdivision = 1 ); 00120 //------------------------------------------------------------------------- 00121 //========================================================================= 00122 00123 //========================================================================= 00124 //------------------------------------------------------------------------- 00125 // Calculation(s) 00126 void CalAndRecordFreqsOfHistogramRange_0_255_ToArray ( GLubyte freqs[256] ); 00127 //------------------------------------------------------------------------- 00128 //========================================================================= 00129 00130 //========================================================================= 00131 // Simulation/Animation Fn(s) 00132 //------------------------------------------------------------------------- 00133 //------------------------------------------------------------------------- 00134 //========================================================================= 00135 00136 //----------------------------------------------------------------------------- 00137 // Data Members -------------------------------------------------------------- 00138 protected: 00139 //========================================================================= 00140 // GPU 00141 //------------------------------------------------------------------------- 00142 // For OpenGL Shading Language 00143 GLSLShaderManager m_glslShaderManager; 00144 // For Finding 3D Texture Draw Direction 00145 GLSLProgramObject * m_glslProgramObjectFor3DTextureDrawDirection; 00146 // Display Deformed Model by 3D Texture 00147 GLSLProgramObject * m_glslProgramObjectFor3DTextureDrawing; 00148 //--------------------------------------------------------------- 00149 // For Drawing (3D) Object-Aligned Slices 00150 GLuint m_glslFBO_v3DObjAlignedSliceDrawDirection; 00151 GLuint m_glui2DTextureFor3DObjAlignedSliceDrawDirection; 00152 //------------------------------------------------------------------------- 00157 Texture * m_3DTextureVisualization; 00158 //------------------------------------------------------------------------- 00162 Texture * m_1DTextureTransferFnLUT; 00163 //------------------------------------------------------------------------- 00164 ModelDeformableGLSL<T> * m_SimDomain; 00165 //========================================================================= 00166 // Helper Fn(s) 00167 //------------------------------------------------------------------------- 00168 //------------------------------------------------------------------------- 00169 //========================================================================= 00170 //------------------------------------------------------------------------- 00171 //========================================================================= 00172 //------------------------------------------------------------------------- 00173 }; // CLASS END: ModelDeformableGLSL_Visualization_3DTexture ****************** 00174 //============================================================================= 00175 END_NAMESPACE_TAPs__OpenGL 00176 //----------------------------------------------------------------------------- 00177 // Include definition if TAPs_USE_EXPORT is not defined 00178 //#if !defined( TAPs_USE_EXPORT ) 00179 #include "TAPsModelDeformableGLSL_Visualization_3DTexture.cpp" 00180 //#endif 00181 //----------------------------------------------------------------------------- 00182 #endif 00183 //34567890123456789012345678901234567890123456789012345678901234567890123456789 00184 //--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----