OgreShaderFunction.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 _ShaderProgramFunction_
28#define _ShaderProgramFunction_
29
31#include "OgreShaderParameter.h"
33
34namespace Ogre {
35namespace RTShader {
36
47{
48// Interface.
49public:
51 {
52 // internal function (default)
54 // Vertex program main
56 // Pixel shader main
57 FFT_PS_MAIN
58 };
59
61 const String& getName() const { return mName; }
62
64 const String& getDescription() const { return mDescription; }
65
75
76
86
95
104
105
113
122
123
132
134 const ShaderParameterList& getInputParameters() const { return mInputParameters; }
135
137 const ShaderParameterList& getOutputParameters() const { return mOutputParameters; }
138
140 const ShaderParameterList& getLocalParameters() const { return mLocalParameters; }
141
146
151
154
156 FunctionAtomInstanceList& getAtomInstances() { return mAtomInstances; }
157
159 const FunctionAtomInstanceList& getAtomInstances() const { return mAtomInstances; }
160
163
166
169
172
175
178
181
182
183protected:
184
190 Function(const String& name, const String& desc, const FunctionType functionType);
191
194
197
200
201protected:
202 // Function name.
204 // Function description.
206 // Input parameters.
208 // Output parameters.
210 // Local parameters.
212 // Atom instances composing this function.
214 // Function type
216
217private:
218 friend class Program;
219};
220
222typedef ShaderFunctionList::iterator ShaderFunctionIterator;
223typedef ShaderFunctionList::const_iterator ShaderFunctionConstIterator;
224
228}
229}
230
231#endif
#define _OgreRTSSExport
Superclass for all objects that wish to use custom memory allocators when their new / delete operator...
A class that represents an atomic code section of shader based program function.
A class that represents a shader based program function.
const ShaderParameterList & getOutputParameters() const
Return a list of output parameters.
void addParameter(ShaderParameterList &parameterList, ParameterPtr parameter)
Add parameter to given list.
void addInputParameter(ParameterPtr parameter)
Add input parameter to this function.
ShaderParameterList mOutputParameters
Function(const String &name, const String &desc, const FunctionType functionType)
Class constructor.
ShaderParameterList mInputParameters
ParameterPtr resolveLocalParameter(Parameter::Semantic semantic, int index, const String &name, GpuConstantType type)
Resolve local parameter of this function
void sortAtomInstances()
Sort all atom instances of this function.
ParameterPtr resolveLocalParameter(Parameter::Semantic semantic, int index, const Parameter::Content content, GpuConstantType type)
Resolve local parameter of this function
static ParameterPtr getParameterBySemantic(const ShaderParameterList &parameterList, const Parameter::Semantic semantic, int index)
Get parameter by a given semantic and index from the given parameter list.
ParameterPtr getParameterByContent(const ShaderParameterList &parameterList, const Parameter::Content content, GpuConstantType type)
Get parameter by a given content and type from the given parameter list.
FunctionType getFunctionType() const
get function type.
void deleteInputParameter(ParameterPtr parameter)
Delete input parameter from this function.
void deleteAllOutputParameters()
Delete all output parameters from this function.
void deleteAllInputParameters()
Delete all input parameters from this function.
const ShaderParameterList & getInputParameters() const
Return a list of input parameters.
void deleteOutputParameter(ParameterPtr parameter)
Delete output parameter from this function.
ShaderParameterList mLocalParameters
FunctionAtomInstanceList & getAtomInstances()
Return list of atom instances composing this function.
~Function()
Class destructor.
const FunctionAtomInstanceList & getAtomInstances() const
Return list of atom instances composing this function.
const String & getDescription() const
Get the description of this function.
void deleteParameter(ShaderParameterList &parameterList, ParameterPtr parameter)
Delete parameter from a given list.
bool deleteAtomInstance(FunctionAtom *atomInstance)
Delete a function atom instance from this function.
ParameterPtr resolveOutputParameter(Parameter::Semantic semantic, int index, const Parameter::Content content, GpuConstantType type)
Resolve output parameter of this function.
ParameterPtr resolveInputParameter(Parameter::Semantic semantic, int index, const Parameter::Content content, GpuConstantType type)
Resolve input parameter of this function.
FunctionAtomInstanceList mAtomInstances
const ShaderParameterList & getLocalParameters() const
Return a list of local parameters.
static ParameterPtr getParameterByName(const ShaderParameterList &parameterList, const String &name)
Get parameter by a given name from the given parameter list.
void addAtomInstance(FunctionAtom *atomInstance)
Add a function atom instance to this function.
void addOutputParameter(ParameterPtr parameter)
Add output parameter to this function.
const String & getName() const
Get the name of this function.
A class that represents a shader based program.
GpuConstantType
Enumeration of the types of constant we may encounter in programs.
ShaderFunctionList::const_iterator ShaderFunctionConstIterator
vector< Function * >::type ShaderFunctionList
ShaderFunctionList::iterator ShaderFunctionIterator
_StringBase String
std::vector< T, A > type

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