OgreShaderProgram.h
Go to the documentation of this file.

    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-2012 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
    00064     UniformParameterPtr resolveAutoParameterReal(GpuProgramParameters::AutoConstantType autoType, Real data, size_t size = 0);
    00065
    00073     UniformParameterPtr resolveAutoParameterReal(GpuProgramParameters::AutoConstantType autoType, GpuConstantType type, Real data, size_t size = 0);
    00074
    00081     UniformParameterPtr resolveAutoParameterInt(GpuProgramParameters::AutoConstantType autoType, size_t data, size_t size = 0);
    00082
    00090     UniformParameterPtr resolveAutoParameterInt(GpuProgramParameters::AutoConstantType autoType, GpuConstantType type, size_t data, size_t size = 0);
    00091
    00101     UniformParameterPtr resolveParameter(GpuConstantType type, int index, uint16 variability, const String& suggestedName, size_t size = 0);
    00102
    00107     UniformParameterPtr getParameterByName(const String& name);
    00108
    00113     UniformParameterPtr getParameterByAutoType(GpuProgramParameters::AutoConstantType autoType);
    00114
    00120     UniformParameterPtr getParameterByType(GpuConstantType type, int index);
    00121
    00124     const UniformParameterList& getParameters() const { return mParameters; };
    00125
    00130     Function* createFunction(const String& name, const String& desc, const Function::FunctionType functionType);
    00131
    00135     Function* getFunctionByName(const String& name);
    00136
    00139     const ShaderFunctionList& getFunctions() const { return mFunctions; };
    00140
    00144     void setEntryPointFunction(Function* function) { mEntryPointFunction = function; }
    00145
    00147     Function* getEntryPointFunction()                    { return mEntryPointFunction; }
    00148
    00154     void addDependency(const String& libFileName);
    00155
    00157     size_t getDependencyCount() const;
    00158
    00162     const String& getDependency(unsigned int index) const;
    00163
    00164
    00168     void setSkeletalAnimationIncluded(bool value) { mSkeletalAnimation = value; }
    00169
    00173     bool getSkeletalAnimationIncluded() const { return mSkeletalAnimation; }
    00174
    00175 // Protected methods.
    00176 protected:
    00177
    00181     Program(GpuProgramType type);
    00182
    00184     ~Program();
    00185
    00187     void destroyParameters();
    00188
    00190     void destroyFunctions();
    00191
    00193     void addParameter(UniformParameterPtr parameter);
    00194
    00196     void removeParameter(UniformParameterPtr parameter);
    00197
    00198
    00199 // Attributes.
    00200 protected:
    00201     // Program type. (Vertex, Fragment, Geometry).
    00202     GpuProgramType mType;
    00203     // Program uniform parameters.
    00204     UniformParameterList mParameters;
    00205     // Function list.
    00206     ShaderFunctionList mFunctions;
    00207     // Entry point function for this program.
    00208     Function* mEntryPointFunction;
    00209     // Program dependencies.
    00210     StringVector mDependencies;
    00211     // Skeletal animation calculation
    00212     bool mSkeletalAnimation;
    00213 private:
    00214     friend class ProgramManager;
    00215 };
    00216
    00220 }
    00221 }
    00222
    00223 #endif
    00224

Copyright © 2012 Torus Knot Software Ltd
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Last modified Sun Sep 2 2012 07:27:23