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

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