00001 /* 00002 ----------------------------------------------------------------------------- 00003 This source file is part of OGRE 00004 (Object-oriented Graphics Rendering Engine) 00005 For the latest info, see http://www.ogre3d.org 00006 00007 Copyright (c) 2000-2011 Torus Knot Software Ltd 00008 Permission is hereby granted, free of charge, to any person obtaining a copy 00009 of this software and associated documentation files (the "Software"), to deal 00010 in the Software without restriction, including without limitation the rights 00011 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 00012 copies of the Software, and to permit persons to whom the Software is 00013 furnished to do so, subject to the following conditions: 00014 00015 The above copyright notice and this permission notice shall be included in 00016 all copies or substantial portions of the Software. 00017 00018 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 00019 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00020 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 00021 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00022 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00023 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 00024 THE SOFTWARE. 00025 ----------------------------------------------------------------------------- 00026 */ 00027 #ifndef _ShaderProgram_ 00028 #define _ShaderProgram_ 00029 00030 #include "OgreShaderPrerequisites.h" 00031 #include "OgreGpuProgram.h" 00032 #include "OgreSingleton.h" 00033 #include "OgreShaderParameter.h" 00034 #include "OgreShaderFunction.h" 00035 #include "OgreShaderFunctionAtom.h" 00036 #include "OgreStringVector.h" 00037 00038 namespace Ogre { 00039 namespace RTShader { 00040 00050 class _OgreRTSSExport Program : public RTShaderSystemAlloc 00051 { 00052 00053 // Interface. 00054 public: 00056 GpuProgramType getType () const; 00057 00063 UniformParameterPtr resolveAutoParameterReal (GpuProgramParameters::AutoConstantType autoType, Real data); 00064 00070 UniformParameterPtr resolveAutoParameterInt (GpuProgramParameters::AutoConstantType autoType, size_t data); 00071 00080 UniformParameterPtr resolveParameter (GpuConstantType type, int index, uint16 variability, const String& suggestedName); 00081 00086 UniformParameterPtr getParameterByName (const String& name); 00087 00092 UniformParameterPtr getParameterByAutoType (GpuProgramParameters::AutoConstantType autoType); 00093 00099 UniformParameterPtr getParameterByType (GpuConstantType type, int index); 00100 00103 const UniformParameterList& getParameters () const { return mParameters; }; 00104 00109 Function* createFunction (const String& name, const String& desc, const Function::FunctionType functionType); 00110 00114 Function* getFunctionByName (const String& name); 00115 00118 const ShaderFunctionList& getFunctions () const { return mFunctions; }; 00119 00123 void setEntryPointFunction (Function* function) { mEntryPointFunction = function; } 00124 00126 Function* getEntryPointFunction () { return mEntryPointFunction; } 00127 00133 void addDependency (const String& libFileName); 00134 00136 size_t getDependencyCount () const; 00137 00141 const String& getDependency (unsigned int index) const; 00142 00143 00144 // Protected methods. 00145 protected: 00146 00150 Program (GpuProgramType type); 00151 00153 ~Program (); 00154 00156 void destroyParameters (); 00157 00159 void destroyFunctions (); 00160 00162 void addParameter (UniformParameterPtr parameter); 00163 00165 void removeParameter (UniformParameterPtr parameter); 00166 00167 00168 // Attributes. 00169 protected: 00170 GpuProgramType mType; // Program type. (Vertex, Fragment, Geometry). 00171 UniformParameterList mParameters; // Program uniform parameters. 00172 ShaderFunctionList mFunctions; // Function list. 00173 Function* mEntryPointFunction; // Entry point function for this program. 00174 StringVector mDependencies; // Program dependencies. 00175 00176 private: 00177 friend class ProgramManager; 00178 }; 00179 00183 } 00184 } 00185 00186 #endif 00187
Copyright © 2008 Torus Knot Software Ltd
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Last modified Sat Jan 14 2012 18:40:44