TAPs 0.7.7.3
TAPsModelDeformableCPU_Visualization_RTGenMesh.hpp
Go to the documentation of this file.
00001 /******************************************************************************
00002 TAPsModelDeformableCPU_Visualization_RTGenMesh.hpp
00003 ******************************************************************************/
00008 /******************************************************************************
00009 SUKITTI PUNAK   (08/04/2007)
00010 UPDATE          (08/05/2007)
00011 ******************************************************************************/
00012 #ifndef TAPs_MODEL_DEFORMABLE_CPU_VISUALIZATION_RT_GEN_MESH_HPP
00013 #define TAPs_MODEL_DEFORMABLE_CPU_VISUALIZATION_RT_GEN_MESH_HPP
00014 
00015 //#include "../GLSL/TAPsGLSLFns.hpp"
00016 #include "TAPsModelDeformableCPU.hpp"
00017 
00018 #include <TAPs/CG/TAPsPNTriangle.hpp>
00019 
00020 //=============================================================================
00021 //-----------------------------------------------------------------------------
00026 //-----------------------------------------------------------------------------
00027 //#define TAPs_MODEL_DEFORMABLE_VISUALIZATION_NOT_USE_BUFFERS
00028 //#define TAPs_MODEL_DEFORMABLE_VISUALIZATION_USE_BUFFERS           // default
00029 //-----------------------------------------------------------------------------
00030 #if defined   ( TAPs_MODEL_DEFORMABLE_VISUALIZATION_NOT_USE_BUFFERS )
00031     #define TAPs_MODEL_DEFORMABLE_VISUALIZATION_RT_GEN_MESH_NOT_USE_BUFFERS
00032 #elif defined ( TAPs_MODEL_DEFORMABLE_VISUALIZATION_USE_BUFFERS )
00033     #define TAPs_MODEL_DEFORMABLE_VISUALIZATION_RT_GEN_MESH_USE_BUFFERS
00034 #else
00035     #define TAPs_MODEL_DEFORMABLE_VISUALIZATION_RT_GEN_MESH_USE_BUFFERS
00036 #endif
00037 //-----------------------------------------------------------------------------
00038 //=============================================================================
00039 
00040 BEGIN_NAMESPACE_TAPs__OpenGL
00041 //=============================================================================
00042 template <typename T> class ModelDeformableCPU; // class forward
00043 //=============================================================================
00044 template <typename T>
00045 class ModelDeformableCPU_Visualization_RTGenMesh {
00046 //-----------------------------------------------------------------------------
00047 // Member Functions -----------------------------------------------------------
00048 public:
00049     //-------------------------------------------------------------------------
00050     // default constructor
00051     //ModelDeformableCPU_Visualization_RTGenMesh ();
00052     //-------------------------------------------------------------------------
00053     // constructor
00054     ModelDeformableCPU_Visualization_RTGenMesh ( 
00055         ModelDeformableCPU<T> * simDomain );
00056     //-------------------------------------------------------------------------
00057     // destructor
00058     virtual ~ModelDeformableCPU_Visualization_RTGenMesh ();
00059     //-------------------------------------------------------------------------
00060     virtual void Default ();
00061     virtual void Clear ();
00062     //-------------------------------------------------------------------------
00063     // Get/Set Fn(s)
00064     //-------------------------------------------
00065     // Ret OpenGL Texture Objects
00066     //Texture * RetObject3DTextureVisualization ()
00067     //  { return m_3DTextureVisualization; }
00068     //-------------------------------------------
00069     // Get OpenGL Texture Names
00070     GLuint  Get3DTexture () const   { return m_3DTexture; }
00071     void    Set3DTexture ( GLuint texName ) { m_3DTexture = texName; }
00072     //-------------------------------------------
00073     //===========================================
00074     // Get/Set Adjustable Parameters
00075     //-------------------------------------------
00076     bool    GetUseGlobalInterpolationValue () const     { return m_bUseGlobalInterpolationVal; }
00077     void    SetUseGlobalInterpolationValue ( bool b )   { m_bUseGlobalInterpolationVal = b; }
00078     T       GetGlobalInterpolationValue () const    { return m_tGlobalInterpolationVal; }
00079     void    SetGlobalInterpolationValue ( T val )
00080     {
00081         if      ( val < 0.0 ) val = 0.0;
00082         else if ( 1.0 < val ) val = 1.0;
00083         m_tGlobalInterpolationVal = val;
00084     }
00085     //-------------
00086     bool    GetStatusDrawnWithPNTriangle () const   { return m_bDrawPNTriangle; }
00087     void    SetStatusDrawnWithPNTriangle ( bool b ) { m_bDrawPNTriangle = b; }
00088     //
00089     int     GetPNTriangleSmoothness () const    { 
00090         return static_cast<int>( m_PNTriangleSmoothness );
00091     }
00092     void    SetPNTriangleSmoothness ( int i ) {
00093         if      ( i < 1 )   i = 1;
00094         else if ( 255 < i ) i = 255;
00095         m_PNTriangleSmoothness = static_cast<unsigned char>( i );
00096     }
00097     //-------------------------------------------
00098     //===========================================
00099     //-------------------------------------------------------------------------
00100     //=========================================================================
00101     // For Initializations & Setups
00102     //-------------------------------------------------------------------------
00106     bool SetupVisualization ( 
00107         int resolutionX, int resolutionY, int resolutionZ, 
00108         enum GridGenerator<T>::VertexFlag *** pFlagDataForXYZVoxels 
00109     );
00110 protected:
00114 //  bool SetupShadersForDrawing ();
00118 //  bool Setup3DTexture ( 
00119         //int resolutionX, int resolutionY, int resolutionZ, 
00120         //enum GridGenerator<T>::VertexFlag *** pFlagDataForXYZVoxels 
00121 //  );
00125     //bool SetupShadersFor3DTextureDrawDirectionAndDrawing ();
00129 //  bool Load1DTextureForTransferFnLUT ( 
00130 //      GLubyte const * lookupTableData     // size of 256x4
00131 //  );
00132     //-------------------------------------------------------------------------
00133     //=========================================================================
00134     //-------------------------------------------------------------------------
00135 public:
00136     //virtual void DrawByGL ( DrawType drawType = POSITION_TEXTURE );
00137     virtual void DrawByGL   ( int iSubdivision = 1 );
00138     //-------------------------------------------------------------------------
00139     //=========================================================================
00140 
00141     //=========================================================================
00142     // Simulation/Animation Fn(s)
00143     //-------------------------------------------------------------------------
00144     //-------------------------------------------------------------------------
00145     //=========================================================================
00146 
00147 //-----------------------------------------------------------------------------
00148 // Data Members  --------------------------------------------------------------
00149 protected:
00150     //=========================================================================
00151     // GPU
00152     //-------------------------------------------------------------------------
00172 //#ifdef TAPs_MODEL_DEFORMABLE_VISUALIZATION_RT_GEN_MESH_USE_BUFFERS
00173 //  GLuint  m_vboVerticesAsTexCoords;
00174 //  bool    GenerateTheVBOForTextureCoordinates ( Vector3<int> const & vGridSize );
00175 //#endif // TAPs_MODEL_DEFORMABLE_VISUALIZATION_RT_GEN_MESH_NOT_USE_BUFFERS
00176     //-------------------------------------------------------------------------
00177     // For OpenGL Shading Language
00178 //  GLSLShaderManager       m_glslShaderManager;
00179     // Display Deformed Model
00180 //  GLSLProgramObject *     m_glslProgramObject;
00181     //---------------------------------------------------------------
00182     // For Drawing (3D) Object-Aligned Slices
00183     //GLuint        m_glslFBO_v3DObjAlignedSliceDrawDirection;
00184     //GLuint        m_glui2DTextureFor3DObjAlignedSliceDrawDirection;
00185     //-------------------------------------------------------------------------
00190     GLuint  m_3DTexture;    // texture name
00191     //-------------------------------------------------------------------------
00192     ModelDeformableCPU<T> * m_SimDomain;
00193     //=========================================================================
00194     // Static Data
00195     //-------------------------------------------------------------------------
00196     static unsigned short   EdgeTable[256];
00197     static char             TriTable[256][16];
00198     //-------------------------------------------------------------------------
00199     //=========================================================================
00200     // Adjustable Parameters
00201     //-------------------------------------------------------------------------
00210     T       m_tGlobalInterpolationVal;
00211     bool    m_bUseGlobalInterpolationVal;
00218     bool            m_bDrawPNTriangle;
00219     unsigned char   m_PNTriangleSmoothness;
00220     //-------------------------------------------------------------------------
00221     //=========================================================================
00222     //-------------------------------------------------------------------------
00223     //=========================================================================
00224     //-------------------------------------------------------------------------
00225 }; // CLASS END: ModelDeformableCPU_Visualization_3DTexture ******************
00226 //=============================================================================
00227 END_NAMESPACE_TAPs__OpenGL
00228 //-----------------------------------------------------------------------------
00229 // Include definition if TAPs_USE_EXPORT is not defined
00230 //#if !defined( TAPs_USE_EXPORT )
00231     #include "TAPsModelDeformableCPU_Visualization_RTGenMesh.cpp"
00232 //#endif
00233 //-----------------------------------------------------------------------------
00234 #endif
00235 //34567890123456789012345678901234567890123456789012345678901234567890123456789
00236 //--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines