gl_Cg_shader_system.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2008 by Kutumov Alexey                                  *
00003  *   ru.pixel@gmail.com                                                    *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  *   This program is distributed in the hope that it will be useful,       *
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00013  *   GNU General Public License for more details.                          *
00014  *                                                                         *
00015  *   You should have received a copy of the GNU General Public License     *
00016  *   along with this program; if not, write to the                         *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
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

Generated on Thu Mar 5 22:36:42 2009 for gpucalc by  doxygen 1.5.6