OGRE 14.3
Object-Oriented Graphics Rendering Engine
|
This class makes the usage of a vertex and fragment programs (low-level or high-level), with a given set of parameters, explicit. More...
#include <OgreGpuProgramUsage.h>
Public Member Functions | |
GpuProgramUsage (const GpuProgramUsage &rhs, Pass *newparent) | |
Copy constructor. | |
GpuProgramUsage (GpuProgramType gptype, Pass *parent) | |
Default constructor. | |
~GpuProgramUsage () | |
void | _load (void) |
Load this usage (and ensure program is loaded) | |
void | _unload (void) |
Unload this usage. | |
size_t | calculateSize (void) const |
const GpuProgramParametersSharedPtr & | getParameters (void) const |
Gets the parameters being used here. | |
const GpuProgramPtr & | getProgram () const |
Gets the program being used. | |
const String & | getProgramName (void) const |
Gets the program being used. | |
GpuProgramType | getType (void) const |
Gets the type of program we're trying to link to. | |
void | loadingComplete (Resource *prog) override |
Called whenever the resource finishes loading. | |
void | setParameters (const GpuProgramParametersSharedPtr ¶ms) |
Sets the program parameters that should be used; because parameters can be shared between multiple usages for efficiency, this method is here for you to register externally created parameter objects. | |
void | setProgram (const GpuProgramPtr &prog, bool resetParams=true) |
Sets the program to use. | |
void | setProgramName (const String &name, bool resetParams=true) |
Sets the name of the program to use. | |
void | unloadingComplete (Resource *prog) override |
Called whenever the resource has been unloaded. | |
Public Member Functions inherited from Ogre::Resource::Listener | |
virtual | ~Listener () |
virtual void | preparingComplete (Resource *) |
Called whenever the resource finishes preparing (paging into memory). | |
Static Public Member Functions | |
static GpuProgramPtr | _getProgramByName (const String &name, const String &group, GpuProgramType type) |
This class makes the usage of a vertex and fragment programs (low-level or high-level), with a given set of parameters, explicit.
Using a vertex or fragment program can get fairly complex; besides the fairly rudimentary process of binding a program to the GPU for rendering, managing usage has few complications, such as:
This class packages up those details so you don't have to worry about them. For example, this class lets you define a high-level program and set up the parameters for it, without having loaded the program (which you normally could not do). When the program is loaded and compiled, this class will then validate the parameters you supplied earlier and turn them into runtime parameters.
Ogre::GpuProgramUsage::GpuProgramUsage | ( | GpuProgramType | gptype, |
Pass * | parent | ||
) |
Default constructor.
gptype | The type of program to link to |
parent |
Ogre::GpuProgramUsage::GpuProgramUsage | ( | const GpuProgramUsage & | rhs, |
Pass * | newparent | ||
) |
Copy constructor.
Ogre::GpuProgramUsage::~GpuProgramUsage | ( | ) |
|
inline |
Gets the type of program we're trying to link to.
Sets the name of the program to use.
name | The name of the program to use |
resetParams | If true, this will create a fresh set of parameters from the new program being linked, so if you had previously set parameters you will have to set them again. If you set this to false, you must be absolutely sure that the parameters match perfectly, and in the case of named parameters refers to the indexes underlying them, not just the names. |
void Ogre::GpuProgramUsage::setProgram | ( | const GpuProgramPtr & | prog, |
bool | resetParams = true |
||
) |
Sets the program to use.
Note that this will create a fresh set of parameters from the new program being linked, so if you had previously set parameters you will have to set them again.
|
inline |
Gets the program being used.
Gets the program being used.
References Ogre::Resource::getName().
void Ogre::GpuProgramUsage::setParameters | ( | const GpuProgramParametersSharedPtr & | params | ) |
Sets the program parameters that should be used; because parameters can be shared between multiple usages for efficiency, this method is here for you to register externally created parameter objects.
Otherwise, the parameters will be created for you when a program is linked.
const GpuProgramParametersSharedPtr & Ogre::GpuProgramUsage::getParameters | ( | void | ) | const |
Gets the parameters being used here.
Called whenever the resource has been unloaded.
Reimplemented from Ogre::Resource::Listener.
Called whenever the resource finishes loading.
If a Resource has been marked as background loaded (
Reimplemented from Ogre::Resource::Listener.
|
static |