Loading...
Searching...
No Matches
Ogre::RTShader::Program Class Reference
Optional Components » RTShaderSystem

A class that represents a shader based program. More...

`#include <OgreShaderProgram.h>`

Inheritance diagram for Ogre::RTShader::Program:
[legend]

## Public Member Functions

| ~Program ()
| Class destructor.
void | addDependency (const String &libFileName)
| Add dependency for this program.
void | addPreprocessorDefines (const String &defines)
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.
Function * | getEntryPointFunction ()
bool | getInstancingIncluded (void) const
| Returns whether a vertex program can do instancing.
Function * | getMain ()
UniformParameterPtr | getParameterByAutoType (GpuProgramParameters::AutoConstantType autoType)
| Get parameter by a given auto constant type.
UniformParameterPtr | getParameterByName (const String &name)
| Get parameter by a given name.
UniformParameterPtr | getParameterByType (GpuConstantType type, int index)
| Get parameter by a given type and index.
const UniformParameterList & | getParameters () const
| Get the list of uniform parameters of this program.
const String & | getPreprocessorDefines () const
bool | getSkeletalAnimationIncluded () const
| Returns whether a vertex program can do skeletal animation.
GpuProgramType | getType () const
| Get the type of this program.
bool | getUseColumnMajorMatrices () const
| Returns whether Ogre will pass auto-bound matrices as column-major.
bool | getUseLinearColours () const
UniformParameterPtr | resolveAutoParameterInt (GpuProgramParameters::AutoConstantType autoType, GpuConstantType type, uint32 data, size_t size=0)
| Resolve uniform auto constant parameter with associated int data of this program.
UniformParameterPtr | resolveAutoParameterReal (GpuProgramParameters::AutoConstantType autoType, GpuConstantType type, float data, size_t size=0)
| Resolve uniform auto constant parameter with associated real data 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.
UniformParameterPtr | resolveParameter (GpuConstantType type, const String &name, int index=-1)
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
UniformParameterPtr | resolveParameter (GpuConstantType type, int index, uint16 variability, const String &suggestedName, size_t size=0)
| Resolve uniform parameter of this program.
UniformParameterPtr | resolveParameter (GpuProgramParameters::AutoConstantType autoType, uint32 data=0)
| Resolve uniform auto constant parameter.
void | setInstancingIncluded (bool included)
| Sets whether a vertex program can do instancing.
void | setSkeletalAnimationIncluded (bool value)
| Sets whether a vertex program can do skeletal animation.
void | setUseColumnMajorMatrices (bool value)
| Tells Ogre whether auto-bound matrices should be sent in column or row-major order.
void | setUseLinearColours (bool useLinear)

## Detailed Description

A class that represents a shader based program.

## Constructor & Destructor Documentation

## ~Program()

Ogre::RTShader::Program::~Program | ( |  | ) |

Class destructor.

## Member Function Documentation

## getType()

GpuProgramType Ogre::RTShader::Program::getType | ( |  | ) | const

Get the type of this program.

## resolveAutoParameterReal() [1/2]

UniformParameterPtr Ogre::RTShader::Program::resolveAutoParameterReal | ( | GpuProgramParameters::AutoConstantType | autoType,
|  | Real | data,
|  | size_t | size = 0 )

Resolve uniform auto constant parameter with associated real data of this program.

Parameters

  autoType | The auto type of the desired parameter.
  data | The data to associate with the auto parameter.
  size | number of elements in the parameter.

Returns
  parameter instance in case of that resolve operation succeeded.

## resolveAutoParameterReal() [2/2]

UniformParameterPtr Ogre::RTShader::Program::resolveAutoParameterReal | ( | GpuProgramParameters::AutoConstantType | autoType,
|  | GpuConstantType | type,
|  | float | data,
|  | size_t | size = 0 )

Resolve uniform auto constant parameter with associated real data of this program.

Parameters

  autoType | The auto type of the desired parameter.
  type | The desired data type of the auto parameter.
  data | The data to associate with the auto parameter.
  size | number of elements in the parameter.

Returns
  parameter instance in case of that resolve operation succeeded.

## resolveAutoParameterInt()

UniformParameterPtr Ogre::RTShader::Program::resolveAutoParameterInt | ( | GpuProgramParameters::AutoConstantType | autoType,
|  | GpuConstantType | type,
|  | uint32 | data,
|  | size_t | size = 0 )

Resolve uniform auto constant parameter with associated int data of this program.

Parameters

  autoType | The auto type of the desired parameter.
  type | The desired data type of the auto parameter.
  data | The data to associate with the auto parameter.
  size | number of elements in the parameter.

Returns
  parameter instance in case of that resolve operation succeeded.

## resolveParameter() [1/3]

UniformParameterPtr Ogre::RTShader::Program::resolveParameter | ( | GpuConstantType | type,
|  | int | index,
|  | uint16 | variability,
|  | const String & | suggestedName,
|  | size_t | size = 0 )

Resolve uniform parameter of this program.

Parameters

  type | The type of the desired parameter.
  index | The index of the desired parameter.
  suggestedName | The suggested name for the parameter in case new one should be create.
  variability | How this parameter varies (bitwise combination of GpuProgramVariability).
  size | number of elements in the parameter.

Returns
  parameter instance in case of that resolve operation succeeded.

Remarks
  Pass -1 as index parameter to create a new parameter with the desired type and index.

Referenced by resolveParameter().

## resolveParameter() [2/3]

UniformParameterPtr Ogre::RTShader::Program::resolveParameter | ( | GpuConstantType | type,
|  | const String & | name,
|  | int | index = -1 )

inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

References Ogre::GPV_GLOBAL, and resolveParameter().

## resolveParameter() [3/3]

UniformParameterPtr Ogre::RTShader::Program::resolveParameter | ( | GpuProgramParameters::AutoConstantType | autoType,
|  | uint32 | data = 0 )

Resolve uniform auto constant parameter.

Parameters

  autoType | The auto type of the desired parameter
  data | The data to associate with the auto parameter.

Returns
  parameter instance in case of that resolve operation succeeded.

## getParameterByName()

UniformParameterPtr Ogre::RTShader::Program::getParameterByName | ( | const String & | name | ) |

Get parameter by a given name.

Parameters

  name | The name of the parameter to search for.

Remarks
  Return NULL if no matching parameter found.

## getParameterByAutoType()

UniformParameterPtr Ogre::RTShader::Program::getParameterByAutoType | ( | GpuProgramParameters::AutoConstantType | autoType | ) |

Get parameter by a given auto constant type.

Parameters

  autoType | The auto type of the parameter to search for.

Remarks
  Return NULL if no matching parameter found.

## getParameterByType()

UniformParameterPtr Ogre::RTShader::Program::getParameterByType | ( | GpuConstantType | type,
|  | int | index )

Get parameter by a given type and index.

Parameters

  type | The type of the parameter to search for.
  index | The index of the parameter to search for.

Remarks
  Return NULL if no matching parameter found.

## getParameters()

const UniformParameterList & Ogre::RTShader::Program::getParameters | ( |  | ) | const

inline

Get the list of uniform parameters of this program.

## getEntryPointFunction()

Function * Ogre::RTShader::Program::getEntryPointFunction | ( |  | ) |

inline

Deprecated
  use getMain()

## getMain()

Function * Ogre::RTShader::Program::getMain | ( |  | ) |

inline

## addDependency()

void Ogre::RTShader::Program::addDependency | ( | const String & | libFileName | ) |

Add dependency for this program.

Basically a filename that will be included in this program and provide predefined shader functions code. One should verify that the given library file he provides can be reached by the resource manager. This step can be achieved using the ResourceGroupManager::addResourceLocation method.

## getDependencyCount()

size_t Ogre::RTShader::Program::getDependencyCount | ( |  | ) | const

Get the number of external libs this program depends on.

## getDependency()

const String & Ogre::RTShader::Program::getDependency | ( | unsigned int | index | ) | const

Get the library name of the given index dependency.

Parameters

  index | The index of the dependecy.

## setSkeletalAnimationIncluded()

void Ogre::RTShader::Program::setSkeletalAnimationIncluded | ( | bool | value | ) |

inline

Sets whether a vertex program can do skeletal animation.

If this is set to true, OGRE will not blend the geometry according to skeletal animation, it will expect the vertex program to do it.

## getSkeletalAnimationIncluded()

bool Ogre::RTShader::Program::getSkeletalAnimationIncluded | ( |  | ) | const

inline

Returns whether a vertex program can do skeletal animation.

If this returns true, OGRE will not blend the geometry according to skeletal animation, it will expect the vertex program to do it.

## setInstancingIncluded()

void Ogre::RTShader::Program::setInstancingIncluded | ( | bool | included | ) |

inline

Sets whether a vertex program can do instancing.

If this is set to true, OGRE will provide an instance buffer holding the World Matrix of each instance to the vertex program.

## getInstancingIncluded()

bool Ogre::RTShader::Program::getInstancingIncluded | ( | void |  | ) | const

inline

Returns whether a vertex program can do instancing.

## setUseColumnMajorMatrices()

void Ogre::RTShader::Program::setUseColumnMajorMatrices | ( | bool | value | ) |

inline

Tells Ogre whether auto-bound matrices should be sent in column or row-major order.

This method has the same effect as column_major_matrices option used when declaring manually written hlsl program. You want to use this method only when you use float3x4 type in a shader, e.g. for bone matrices. In mentioned case you should call this method with false as parameter.

  For more detail see OGRE Manual, section 3.1.6 DirectX9 HLSL.

Note
  This setting has any effect only when the target language is HLSL.

Parameters

  value | Should Ogre pass auto-bound matrices as column-major? The default is true.

## getUseColumnMajorMatrices()

bool Ogre::RTShader::Program::getUseColumnMajorMatrices | ( |  | ) | const

inline

Returns whether Ogre will pass auto-bound matrices as column-major.

Returns
  true, when the matrices will be passed in column-major order, false, when they will be passed as row-major.

## addPreprocessorDefines()

void Ogre::RTShader::Program::addPreprocessorDefines | ( | const String & | defines | ) |

## getPreprocessorDefines()

const String & Ogre::RTShader::Program::getPreprocessorDefines | ( |  | ) | const

inline

## setUseLinearColours()

void Ogre::RTShader::Program::setUseLinearColours | ( | bool | useLinear | ) |

inline

## getUseLinearColours()

bool Ogre::RTShader::Program::getUseLinearColours | ( |  | ) | const

inline

The documentation for this class was generated from the following file:

- OgreShaderProgram.h