gl_Cg_shader.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00033 #ifndef __gl_Cg_shader__header__
00034 #define __gl_Cg_shader__header__
00035
00036 #include "gpucalc/shader.h"
00037
00038 #include <Cg/cgGL.h>
00039
00040 namespace gpucalc
00041 {
00042
00043 const char _GLCgShaderClassName [] = "GLCgShader";
00044
00045
00046 class _GpuCalcPrivate GLCgShader: public Shader
00047 {
00048
00049
00050 OBJ_DISABLE_COPY(GLCgShader)
00051
00052
00053 friend class GLCgShaderSystem;
00054
00055
00056 public:
00057 GLCgShader(const std::string & ShaderName, CGcontext CgContext, CGprofile CgProfile, ShaderSystem * system);
00058
00059
00060 ~GLCgShader();
00061
00062
00063 void setSource(const std::string & ShaderSource);
00064
00065
00066 std::string getSource() const
00067 {
00068 return mShaderSource;
00069 }
00070
00071
00075 void addUniform(Uniform * uniform);
00076
00077
00078 void removeUniform(Uniform * uniform);
00079
00080
00081 void compile(const std::string & Parameters = std::string());
00082
00083
00084 bool isCompiled() const
00085 {
00086 return mIsCompiled;
00087 }
00088
00089
00090 void validate();
00091
00092
00093 void preCompute();
00094
00095
00096 bool isDebugEnabled() const
00097 {
00098 return mIsDebug;
00099 }
00100
00101
00102 std::string getLanguageID() const
00103 {
00104 return "Cg";
00105 }
00106
00107
00108 private:
00109
00110
00112 CGcontext mCgContextID;
00113
00114
00115 CGprofile mCgFragmentProfileID;
00116
00117
00118 CGprogram mCgFragmentProgramID;
00119
00120
00121 bool mIsCompiled;
00122
00123
00124 bool mIsDebug;
00125
00126
00127 void setUniformVariable(Uniform * uniform);
00128
00129
00130 void setUniformSampler(Uniform * uniform);
00131
00132
00133 std::string mShaderSource;
00134
00135
00136 std::string mShaderCompilerParams;
00137
00138
00139 typedef std::list<Uniform *> UniformVector;
00140 UniformVector mUniformVector;
00141 };
00142 }
00143
00144 #endif