gl_Cg_shader_system.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_system__header__
00034 #define __gl_Cg_shader_system__header__
00035
00036 #include "gpucalc/shader_system.h"
00037 #include "gpucalc/graphic_core.h"
00038
00039 #include <Cg/cgGL.h>
00040
00041 namespace gpucalc
00042 {
00043 const char _GLCgShaderSystemObjectName [] = "GLCgShaderSystem";
00044
00045 class _GpuCalcPrivate GLCgShaderSystem: public ShaderSystem
00046 {
00047
00048 OBJ_DISABLE_COPY(GLCgShaderSystem)
00049
00050
00051 public:
00052 GLCgShaderSystem();
00053
00054
00055 ~GLCgShaderSystem();
00056
00057
00058 Shader * create(const std::string & ShaderName);
00059
00060
00061 Shader * getShaderByName(const std::string & Shadername) const;
00062
00063
00064 bool isShaderCreated(const std::string & ShaderName) const;
00065
00066
00067 Uniform * create(const Data & data);
00068
00069
00070 Uniform * create(Texture * texture);
00071
00072
00073 Uniform * getUniformByName(const std::string & UniformName) const;
00074
00075
00076 bool isUniformCreated(const std::string & UniformName) const;
00077
00078
00079 void destroy(Uniform * uniform);
00080
00081
00082 void destroy(Shader * shader);
00083
00084
00085 void bind(Shader * shader);
00086
00087
00088 void unbind(Shader * shader);
00089
00090
00091 Shader * getActiveShader() const;
00092
00093
00094 bool isAcceptCore(const GraphicCore * Core) const;
00095
00096
00097 void start();
00098
00099
00100 void stop();
00101
00102
00103 bool isAcceptFileExtension(const std::string & FileExtension) const;
00104
00105
00106 void addAcceptableGraphicCoreID(const std::string & GraphicCoreID);
00107
00108
00109 debugger::CodeInstructor * getCodeInstructor() const;
00110
00111
00112 private:
00113 CGcontext mCgContextID;
00114
00115
00116 CGprofile mCgFragmentProfileID;
00117
00118
00119 bool mIsStarted;
00120
00121
00122 Shader * mActiveShader;
00123
00124
00125 typedef std::map<std::string, Shader *> ShaderMap;
00126 ShaderMap mShaderMap;
00127
00128
00129 typedef std::map<std::string, Uniform *> UniformMap;
00130 UniformMap mUniformMap;
00131
00132
00133 typedef std::set<std::string> AcceptableGraphicCoreIDset;
00134 AcceptableGraphicCoreIDset mAcceptableGraphicCoreIDset;
00135
00136
00137 debugger::CodeInstructor * mCodeInstructor;
00138 };
00139 }
00140
00141 #endif