OgreShaderProgram.h
Go to the documentation of this file.
1/*
2-----------------------------------------------------------------------------
3This source file is part of OGRE
4(Object-oriented Graphics Rendering Engine)
5For the latest info, see http://www.ogre3d.org
6
7Copyright (c) 2000-2013 Torus Knot Software Ltd
8Permission is hereby granted, free of charge, to any person obtaining a copy
9of this software and associated documentation files (the "Software"), to deal
10in the Software without restriction, including without limitation the rights
11to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12copies of the Software, and to permit persons to whom the Software is
13furnished to do so, subject to the following conditions:
14
15The above copyright notice and this permission notice shall be included in
16all copies or substantial portions of the Software.
17
18THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24THE SOFTWARE.
25-----------------------------------------------------------------------------
26*/
27#ifndef _ShaderProgram_
28#define _ShaderProgram_
29
31#include "OgreGpuProgram.h"
32#include "OgreSingleton.h"
33#include "OgreShaderParameter.h"
34#include "OgreShaderFunction.h"
36#include "OgreStringVector.h"
37
38namespace Ogre {
39namespace RTShader {
40
51{
52
53// Interface.
54public:
57
65
74
82
91
101 UniformParameterPtr resolveParameter(GpuConstantType type, int index, uint16 variability, const String& suggestedName, size_t size = 0);
102
108
114
121
124 const UniformParameterList& getParameters() const { return mParameters; };
125
130 Function* createFunction(const String& name, const String& desc, const Function::FunctionType functionType);
131
136
139 const ShaderFunctionList& getFunctions() const { return mFunctions; };
140
144 void setEntryPointFunction(Function* function) { mEntryPointFunction = function; }
145
147 Function* getEntryPointFunction() { return mEntryPointFunction; }
148
154 void addDependency(const String& libFileName);
155
157 size_t getDependencyCount() const;
158
162 const String& getDependency(unsigned int index) const;
163
164
168 void setSkeletalAnimationIncluded(bool value) { mSkeletalAnimation = value; }
169
173 bool getSkeletalAnimationIncluded() const { return mSkeletalAnimation; }
174
186 void setUseColumnMajorMatrices(bool value) { mColumnMajorMatrices = value; }
187
192 bool getUseColumnMajorMatrices() const { return mColumnMajorMatrices; }
193
194// Protected methods.
195protected:
196
201
204
207
210
213
216
217
218// Attributes.
219protected:
220 // Program type. (Vertex, Fragment, Geometry).
222 // Program uniform parameters.
224 // Function list.
226 // Entry point function for this program.
228 // Program dependencies.
230 // Skeletal animation calculation
232 // Whether to pass matrices as column-major.
234private:
235 friend class ProgramManager;
236};
237
241}
242}
243
244#endif
245
#define _OgreRTSSExport
Superclass for all objects that wish to use custom memory allocators when their new / delete operator...
AutoConstantType
Defines the types of automatically updated values that may be bound to GpuProgram parameters,...
A class that represents a shader based program function.
A singleton manager class that manages shader based programs.
A class that represents a shader based program.
const UniformParameterList & getParameters() const
Get the list of uniform parameters of this program.
Program(GpuProgramType type)
Class constructor.
UniformParameterPtr resolveAutoParameterInt(GpuProgramParameters::AutoConstantType autoType, size_t data, size_t size=0)
Resolve uniform auto constant parameter with associated int data of this program.
~Program()
Class destructor.
void setEntryPointFunction(Function *function)
Set the entry point function.
void setSkeletalAnimationIncluded(bool value)
Sets whether a vertex program includes the required instructions to perform skeletal animation.
void destroyFunctions()
Destroy all functions of this program.
ShaderFunctionList mFunctions
UniformParameterPtr resolveParameter(GpuConstantType type, int index, uint16 variability, const String &suggestedName, size_t size=0)
Resolve uniform parameter of this program.
const ShaderFunctionList & getFunctions() const
Get the function list of this program.
Function * getEntryPointFunction()
Get the entry point function of this program.
void removeParameter(UniformParameterPtr parameter)
Remove parameter from this program.
GpuProgramType getType() const
Get the type of this program.
void addDependency(const String &libFileName)
Add dependency for this program.
const String & getDependency(unsigned int index) const
Get the library name of the given index dependency.
size_t getDependencyCount() const
Get the number of external libs this program depends on.
UniformParameterPtr getParameterByName(const String &name)
Get parameter by a given name.
Function * createFunction(const String &name, const String &desc, const Function::FunctionType functionType)
Create new function in this program.
void setUseColumnMajorMatrices(bool value)
Tells Ogre whether auto-bound matrices should be sent in column or row-major order.
void addParameter(UniformParameterPtr parameter)
Add parameter to this program.
Function * getFunctionByName(const String &name)
Get a function by a given name.
UniformParameterPtr getParameterByType(GpuConstantType type, int index)
Get parameter by a given type and index.
void destroyParameters()
Destroy all parameters of this program.
UniformParameterPtr resolveAutoParameterReal(GpuProgramParameters::AutoConstantType autoType, Real data, size_t size=0)
Resolve uniform auto constant parameter with associated real data of this program.
bool getSkeletalAnimationIncluded() const
Returns whether a vertex program includes the required instructions to perform skeletal animation.
UniformParameterList mParameters
bool getUseColumnMajorMatrices() const
Returns whether Ogre will pass auto-bound matrices as column-major.
UniformParameterPtr getParameterByAutoType(GpuProgramParameters::AutoConstantType autoType)
Get parameter by a given auto constant type.
UniformParameterPtr resolveAutoParameterInt(GpuProgramParameters::AutoConstantType autoType, GpuConstantType type, size_t data, size_t size=0)
Resolve uniform auto constant parameter with associated int data of this program.
UniformParameterPtr resolveAutoParameterReal(GpuProgramParameters::AutoConstantType autoType, GpuConstantType type, Real data, size_t size=0)
Resolve uniform auto constant parameter with associated real data of this program.
Reference-counted shared pointer, used for objects where implicit destruction is required.
vector< String >::type StringVector
GpuConstantType
Enumeration of the types of constant we may encounter in programs.
vector< UniformParameterPtr >::type UniformParameterList
vector< Function * >::type ShaderFunctionList
GpuProgramType
Enumerates the types of programs which can run on the GPU.
float Real
Software floating point type.
unsigned short uint16
Definition: OgrePlatform.h:360
_StringBase String

Copyright © 2012 Torus Knot Software Ltd
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.