00001 //============================================================================= 00016 #ifndef __SHADER_H_ICNLDUDED__ 00017 #define __SHADER_H_ICNLDUDED__ 00018 00019 #include <QtCore/QString> 00020 00021 #include "uniform.h" 00022 00023 // forward declarations 00024 class VertexAttribLocations; 00025 00026 00027 //============================================================================= 00028 // IShader - collects user defined shader state 00029 //============================================================================= 00030 00037 class IShader : public IUniformState 00038 { 00039 public: 00044 static IShader* create( void ); 00045 virtual ~IShader( void ) {} 00046 00047 00052 virtual bool init( void ) = 0; 00053 00054 00057 virtual void shutdown( void ) = 0; 00058 00059 00068 virtual bool bindState( VertexAttribLocations & attribs ) = 0; 00069 00070 00077 virtual bool compileAndLink( void ) = 0; 00078 00079 00084 virtual void deactivateProgram( void ) = 0; 00085 00086 00093 virtual QString getBuildLog( void ) = 0; 00094 00095 00104 virtual void setShaderSource( int shaderType, const QString & source ) = 0; 00105 00106 00115 virtual void setGeometryInputType( int type ) = 0; // geometry shader only 00116 00117 00126 virtual void setGeometryOutputType( int type ) = 0; 00127 00128 00134 virtual bool isShaderTypeAvailable( int type ) = 0; 00135 00141 static QString getShaderTypeName( int type ); 00142 00146 enum shaderType_e 00147 { 00148 TYPE_VERTEX = 0, 00149 TYPE_GEOMETRY = 1, 00150 TYPE_FRAGMENT = 2, 00151 00152 MAX_SHADER_TYPES = 3, 00153 }; 00154 }; 00155 00156 00157 00158 #endif // __SHADER_H_ICNLDUDED__ 00159