OgreShaderProgram.h
Go to the documentation of this file.
/*
-----------------------------------------------------------------------------
This source file is part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org
Copyright (c) 2000-2013 Torus Knot Software Ltd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-----------------------------------------------------------------------------
*/
#ifndef _ShaderProgram_
#define _ShaderProgram_
#include "OgreShaderPrerequisites.h"
#include "OgreGpuProgram.h"
#include "OgreSingleton.h"
#include "OgreShaderParameter.h"
#include "OgreShaderFunction.h"
#include "OgreShaderFunctionAtom.h"
#include "OgreStringVector.h"
namespace Ogre {
namespace RTShader {
class _OgreRTSSExport Program : public RTShaderSystemAlloc
{
// Interface.
public:
GpuProgramType getType() const;
UniformParameterPtr resolveAutoParameterReal(GpuProgramParameters::AutoConstantType autoType, Real data, size_t size = 0);
UniformParameterPtr resolveAutoParameterReal(GpuProgramParameters::AutoConstantType autoType, GpuConstantType type, Real data, size_t size = 0);
UniformParameterPtr resolveAutoParameterInt(GpuProgramParameters::AutoConstantType autoType, size_t data, size_t size = 0);
UniformParameterPtr resolveAutoParameterInt(GpuProgramParameters::AutoConstantType autoType, GpuConstantType type, size_t data, size_t size = 0);
UniformParameterPtr resolveParameter(GpuConstantType type, int index, uint16 variability, const String& suggestedName, size_t size = 0);
UniformParameterPtr getParameterByName(const String& name);
UniformParameterPtr getParameterByAutoType(GpuProgramParameters::AutoConstantType autoType);
UniformParameterPtr getParameterByType(GpuConstantType type, int index);
const UniformParameterList& getParameters() const { return mParameters; };
Function* createFunction(const String& name, const String& desc, const Function::FunctionType functionType);
Function* getFunctionByName(const String& name);
const ShaderFunctionList& getFunctions() const { return mFunctions; };
void setEntryPointFunction(Function* function) { mEntryPointFunction = function; }
Function* getEntryPointFunction() { return mEntryPointFunction; }
void addDependency(const String& libFileName);
size_t getDependencyCount() const;
const String& getDependency(unsigned int index) const;
void setSkeletalAnimationIncluded(bool value) { mSkeletalAnimation = value; }
bool getSkeletalAnimationIncluded() const { return mSkeletalAnimation; }
void setUseColumnMajorMatrices(bool value) { mColumnMajorMatrices = value; }
bool getUseColumnMajorMatrices() const { return mColumnMajorMatrices; }
// Protected methods.
protected:
Program(GpuProgramType type);
~Program();
void destroyParameters();
void destroyFunctions();
void addParameter(UniformParameterPtr parameter);
void removeParameter(UniformParameterPtr parameter);
// Attributes.
protected:
// Program type. (Vertex, Fragment, Geometry).
GpuProgramType mType;
// Program uniform parameters.
UniformParameterList mParameters;
// Function list.
ShaderFunctionList mFunctions;
// Entry point function for this program.
Function* mEntryPointFunction;
// Program dependencies.
StringVector mDependencies;
// Skeletal animation calculation
bool mSkeletalAnimation;
// Whether to pass matrices as column-major.
bool mColumnMajorMatrices;
private:
friend class ProgramManager;
};
}
}
#endif
Ogre::RTShader::Program::mEntryPointFunction
Function * mEntryPointFunction
Definition: OgreShaderProgram.h:227
Ogre::GpuProgramParameters::AutoConstantType
AutoConstantType
Defines the types of automatically updated values that may be bound to GpuProgram parameters...
Definition: OgreGpuProgramParams.h:708
Ogre::RTShader::Program::getEntryPointFunction
Function * getEntryPointFunction()
Get the entry point function of this program.
Definition: OgreShaderProgram.h:147
Ogre::RTShader::Program::mFunctions
ShaderFunctionList mFunctions
Definition: OgreShaderProgram.h:225
Ogre::Real
float Real
Software floating point type.
Definition: OgrePrerequisites.h:70
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::UniformParameterList
vector< UniformParameterPtr >::type UniformParameterList
Definition: OgreShaderParameter.h:569
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
OgreShaderParameter.h
Ogre::RTShader::Program::getUseColumnMajorMatrices
bool getUseColumnMajorMatrices() const
Returns whether Ogre will pass auto-bound matrices as column-major.
Definition: OgreShaderProgram.h:192
OgreShaderFunction.h
Ogre::RTShader::Program::mParameters
UniformParameterList mParameters
Definition: OgreShaderProgram.h:223
OgreShaderPrerequisites.h
Ogre::RTShader::Function::FunctionType
FunctionType
Definition: OgreShaderFunction.h:50
Ogre::RTShader::Program::getParameters
const UniformParameterList & getParameters() const
Get the list of uniform parameters of this program.
Definition: OgreShaderProgram.h:124
OgreSingleton.h
Ogre::RTShader::ShaderFunctionList
vector< Function * >::type ShaderFunctionList
Definition: OgreShaderFunction.h:221
Ogre::RTShader::Program::mDependencies
StringVector mDependencies
Definition: OgreShaderProgram.h:229
OgreStringVector.h
Ogre::RTShader::Program
A class that represents a shader based program.
Definition: OgreShaderProgram.h:50
Ogre::RTShader::ProgramManager
A singleton manager class that manages shader based programs.
Definition: OgreShaderProgramManager.h:46
Ogre::String
_StringBase String
Definition: OgrePrerequisites.h:439
Ogre::RTShader::Program::setEntryPointFunction
void setEntryPointFunction(Function *function)
Set the entry point function.
Definition: OgreShaderProgram.h:144
Ogre::GpuProgramType
GpuProgramType
Enumerates the types of programs which can run on the GPU.
Definition: OgreGpuProgram.h:50
Ogre::RTShader::Program::getSkeletalAnimationIncluded
bool getSkeletalAnimationIncluded() const
Returns whether a vertex program includes the required instructions to perform skeletal animation...
Definition: OgreShaderProgram.h:173
_OgreRTSSExport
#define _OgreRTSSExport
Definition: OgreShaderPrerequisites.h:108
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
Definition: OgreAndroidLogListener.h:34
Ogre::RTShader::Program::mType
GpuProgramType mType
Definition: OgreShaderProgram.h:221
Ogre::RTShader::Function
A class that represents a shader based program function.
Definition: OgreShaderFunction.h:46
Ogre::RTShader::Program::mColumnMajorMatrices
bool mColumnMajorMatrices
Definition: OgreShaderProgram.h:233
Ogre::SharedPtr
Reference-counted shared pointer, used for objects where implicit destruction is required.
Definition: OgrePrerequisites.h:310
Ogre::GpuConstantType
GpuConstantType
Enumeration of the types of constant we may encounter in programs.
Definition: OgreGpuProgramParams.h:54
OgreShaderFunctionAtom.h
OgreGpuProgram.h
Ogre::uint16
unsigned short uint16
Definition: OgrePlatform.h:360
Ogre::AllocatedObject
Superclass for all objects that wish to use custom memory allocators when their new / delete operator...
Definition: OgreMemoryAllocatedObject.h:58

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