![]() |
TAPs 0.7.7.3
|
00001 /****************************************************************************** 00002 TAPsGLSLShaderPool.hpp 00003 00004 GLSLShaderPool class (hpp file). 00005 00006 SUKITTI PUNAK (02/17/2009) 00007 ******************************************************************************/ 00008 #ifndef TAPs_GLSL_SHADER_POOL_HPP 00009 #define TAPs_GLSL_SHADER_POOL_HPP 00010 00011 //#include "../Core/TAPsStdLib.hpp" 00012 #include "TAPsGLSLFns.hpp" 00013 00014 BEGIN_NAMESPACE_TAPs__OpenGL 00015 00016 //============================================================================= 00020 class GLSLShaderPool { 00021 //============================================================================= 00022 public: 00023 // Member Functions ------------------------------------------------------- 00025 friend std::ostream & operator<< ( std::ostream &output, GLSLShaderPool const &obj ) 00026 { 00027 output << obj.StrInfo(); 00028 return output; 00029 } 00030 //------------------------------------------------------------------------- 00032 GLSLShaderPool (); 00034 //GLSLShaderPool ( GLSLShaderPool const &v ); 00036 ~GLSLShaderPool (); 00038 bool Clear (); 00039 //------------------------------------------------------------------------- 00041 virtual std::string StrInfo () const; 00042 //------------------------------------------------------------------------- 00044 //inline GLSLShaderPool & operator= ( GLSLShaderPool const &v ); 00045 00046 //--------------------------------------------------------------- 00088 //---------------------------------------------------------------- 00089 std::vector< GLSLProgramObject * > & GetListOfShaderPrograms () { 00090 return m_vProgramObjectList; 00091 } 00092 //---------------------------------------------------------------- 00093 std::vector< GLSLProgramObject * > const & GetListOfShaderPrograms () const { 00094 return m_vProgramObjectList; 00095 } 00096 //---------------------------------------------------------------- 00097 //---------------------------------------------------------------- 00098 std::vector< GLSLVertexShader * > & GetListOfVertexShaders () { 00099 return m_vVertexShaderList; 00100 } 00101 //---------------------------------------------------------------- 00102 std::vector< GLSLVertexShader * > const & GetListOfVertexShaders () const { 00103 return m_vVertexShaderList; 00104 } 00105 //---------------------------------------------------------------- 00106 //---------------------------------------------------------------- 00107 std::vector< GLSLGeometryShader * > & GetListOfGeometryShaders () { 00108 return m_vGeometryShaderList; 00109 } 00110 //---------------------------------------------------------------- 00111 std::vector< GLSLGeometryShader * > const & GetListOfGeometryShaders () const { 00112 return m_vGeometryShaderList; 00113 } 00114 //---------------------------------------------------------------- 00115 //---------------------------------------------------------------- 00116 std::vector< GLSLFragmentShader * > & GetListOfFragmentShaders () { 00117 return m_vFragmentShaderList; 00118 } 00119 //---------------------------------------------------------------- 00120 std::vector< GLSLFragmentShader * > const & GetListOfFragmentShaders () const { 00121 return m_vFragmentShaderList; 00122 } 00123 //---------------------------------------------------------------- 00124 00125 00126 00131 bool CreateShaderProgram ( 00132 std::string const & vertexShaderName, 00133 std::string const & vertexShaderFile, 00134 std::string const & geometryShaderName, 00135 std::string const & geometryShaderFile, 00136 std::string const & fragmentShaderName, 00137 std::string const & fragmentShaderFile 00138 ) { return false; }; 00139 00164 00165 GLSLVertexShader * CreateVertexShaderFromFile ( std::string const & vertFile ); 00167 GLSLGeometryShader * CreateGeometryShaderFromFile ( std::string const & geomFile ); 00169 GLSLFragmentShader * CreateFragmentShaderFromFile ( std::string const & fragFile ); 00170 00172 GLSLProgramObject * CreateShaderProgram ( 00173 GLSLVertexShader * vertShader, 00174 GLSLGeometryShader * geomShader, 00175 GLSLFragmentShader * fragShader 00176 ); 00177 00179 bool DeleteShaderProgram ( GLuint assignedID ) { return false; }; 00181 bool DeleteShaderProgram ( std::string const & name ) { return false; }; 00182 00184 bool DeleteVertexShader ( GLuint assignedID ) { return false; }; 00186 bool DeleteVertexShader ( std::string const & name ) { return false; }; 00187 00189 bool DeleteGeometryShader ( GLuint assignedID ) { return false; }; 00191 bool DeleteGeometryShader ( std::string const & name ) { return false; }; 00192 00194 bool DeleteFragmentShader ( GLuint assignedID ) { return false; }; 00196 bool DeleteFragmentShader ( std::string const & name ) { return false; }; 00197 00198 // Data Members ----------------------------------------------------------- 00199 //============================================================================= 00200 protected: 00201 // Member Functions ------------------------------------------------------- 00202 //bool LoadVertexShaderFromFile ( GLSLVertexShader * vertShader, const char * vertFile ); 00203 //bool LoadGeometryShaderFromFile ( GLSLGeometryShader * geomShader, const char * geomFile ); 00204 //bool LoadFragmentShaderFromFile ( GLSLFragmentShader * fragShader, const char * fragFile ); 00205 //bool CompileVertexShaderFromFile ( GLSLVertexShader * vertShader, const char * vertFile ); 00206 //bool CompileGeometryShaderFromFile ( GLSLGeometryShader * geomShader, const char * vertFile ); 00207 //bool CompileFragmentShaderFromFile ( GLSLFragmentShader * fragShader, const char * vertFile ); 00208 // Data Members ----------------------------------------------------------- 00209 //============================================================================= 00210 private: 00211 // Member Functions ------------------------------------------------------- 00212 // Data Members ----------------------------------------------------------- 00213 std::vector< GLSLProgramObject * > m_vProgramObjectList; 00214 std::vector< GLSLVertexShader * > m_vVertexShaderList; 00215 std::vector< GLSLGeometryShader * > m_vGeometryShaderList; 00216 std::vector< GLSLFragmentShader * > m_vFragmentShaderList; 00217 //=============================================================== 00218 //--------------------------------------------------------------- 00219 // For Attributes / Uniform Variables 00220 //=========================================== 00221 // Uniform Variables 00222 //------------------------------------------- 00223 // Scalars 00224 std::vector< float > m_f1Uniform; 00225 std::vector< int > m_i1Uniform; 00226 std::vector< bool > m_b1Uniform; 00227 //------------------------------------------- 00228 // Vectors 00229 std::vector< Vector2<float> > m_f2Uniform; 00230 std::vector< Vector2<int> > m_i2Uniform; 00231 std::vector< Vector2<bool> > m_b2Uniform; 00232 std::vector< Vector3<float> > m_f3Uniform; 00233 std::vector< Vector3<int> > m_i3Uniform; 00234 std::vector< Vector3<bool> > m_b3Uniform; 00235 std::vector< Vector4<float> > m_f4Uniform; 00236 std::vector< Vector4<int> > m_i4Uniform; 00237 std::vector< Vector4<bool> > m_b4Uniform; 00238 //------------------------------------------- 00239 // Matrices 00240 std::vector< ColMatrix2x2<float> > m_m2x2Uniform; 00241 std::vector< ColMatrix3x3<float> > m_m3x3Uniform; 00242 std::vector< ColMatrix4x4<float> > m_m4x4Uniform; 00243 //------------------------------------------- 00244 // Samplers 00245 // -------- 00246 // sampler1D Access a 1D texture 00247 // sampler2D Access a 2D texture 00248 // sampler3D Access a 3D texture 00249 // samplerCube Access a cube-map texture 00250 // sampler1DShadow Access a 1D depth texture with comparison 00251 // sampler2DShadow Access a 2D depth texture with comparison 00252 //------------------------------------------- 00253 //=========================================== 00254 // Attributes 00255 //------------------------------------------- 00256 // Scalars 00257 std::vector< short > m_s1VertexAttrib; 00258 std::vector< float > m_f1VertexAttrib; 00259 std::vector< double > m_d1VertexAttrib; 00260 //------------------------------------------- 00261 // 2D Vectors 00262 std::vector< Vector2<short> > m_s2VertexAttrib; 00263 std::vector< Vector2<float> > m_f2VertexAttrib; 00264 std::vector< Vector2<double> > m_d2VertexAttrib; 00265 // 3D Vectors 00266 std::vector< Vector3<short> > m_s3VertexAttrib; 00267 std::vector< Vector3<float> > m_f3VertexAttrib; 00268 std::vector< Vector3<double> > m_d3VertexAttrib; 00269 // 4D Vectors 00270 std::vector< Vector4<short> > m_s4VertexAttrib; 00271 std::vector< Vector4<float> > m_f4VertexAttrib; 00272 std::vector< Vector4<double> > m_d4VertexAttrib; 00273 std::vector< Vector4<char> > m_b4VertexAttrib; 00274 std::vector< Vector4<int> > m_i4VertexAttrib; 00275 std::vector< Vector4<unsigned char> > m_ub4VertexAttrib; 00276 std::vector< Vector4<unsigned short> > m_us4VertexAttrib; 00277 std::vector< Vector4<unsigned int> > m_ui4VertexAttrib; 00278 //============================================================================= 00279 }; // END CLASS GLSLShaderPool 00280 //============================================================================= 00281 END_NAMESPACE_TAPs__OpenGL 00282 //----------------------------------------------------------------------------- 00283 // If the class is NOT template, use this 00284 #if !defined( TAPs_USE_EXPORT ) 00285 #include "TAPsGLSLShaderPool.cpp" 00286 #endif 00287 00288 //----------------------------------------------------------------------------- 00289 #endif 00290 //34567890123456789012345678901234567890123456789012345678901234567890123456789 00291 //--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----