|
Axmol 3.0.0-89d6d9a
|
A program state object can create or reuse a program. More...
#include <ProgramState.h>
Inherits Object.
Classes | |
| class | AutoBindingResolver |
| An abstract base class that can be extended to support custom material auto bindings. More... | |
Public Member Functions | |
| ProgramState (Program *program) | |
| virtual | ~ProgramState () |
| destructor | |
| ProgramState * | clone () const |
| Creates a deep copy of the current ProgramState. | |
| rhi::Program * | getProgram () const |
| Get the program object. | |
| void | setUniform (const rhi::UniformLocation &uniformLocation, const void *data, size_t size) |
| Specify the value of a uniform variable for the current program state object. | |
| bool | setUniformBlock (ShaderStage stage, std::string_view blockName, const void *data, size_t size) |
| Writes an active uniform block selected by shader stage and source block name. | |
| rhi::UniformLocation | getUniformLocation (std::string_view name) const |
| Get uniform location in given uniform name. | |
| rhi::UniformLocation | getUniformLocation (rhi::Uniform kind) const |
| Get uniform location in a more efficient way by the given built-in uniform name. | |
| void | setCallbackUniform (const rhi::UniformLocation &, const UniformCallback &) |
| A callback to update unifrom. | |
| const std::unordered_map< UniformLocation, UniformCallback, UniformLocationHash > & | getCallbackUniforms () const |
| Get the uniform callback function. | |
| void | setTexture (rhi::Texture *texture) |
| Set texture. | |
| void | setTextureArray (const rhi::UniformLocation &uniformLocation, std::span< TextureBinding > units) |
| Set texture array in shader 'uniform sampler2D xxx[4];' unlikely sampoler2DArray, the array will use multi texture units. | |
| const std::unordered_map< int, TextureBindingSet > & | getTextureBindingSets () const |
| Get vertex texture informations. | |
| void | setParameterAutoBinding (std::string_view uniformName, std::string_view autoBinding) |
| Sets a uniform auto-binding. | |
| Public Member Functions inherited from Object | |
| void | retain () |
| Retains the ownership. | |
| void | release () |
| Releases the ownership immediately. | |
| Object * | autorelease () |
| Releases the ownership sometime soon automatically. | |
| unsigned int | getReferenceCount () const |
| Returns the Object's current reference count. | |
| uint64_t | getObjectID () const noexcept |
| Returns the process-local diagnostic identifier assigned at construction. | |
| virtual | ~Object () |
| Destructor. | |
A program state object can create or reuse a program.
Each program state object keep its own unifroms and textures data.
| ProgramState | ( | Program * | program | ) |
| program | Specifies the program. |
| ProgramState * clone | ( | ) | const |
Creates a deep copy of the current ProgramState.
Unlike other clone methods, this function does not use autorelease. The returned object is allocated on the heap, and the caller is responsible for managing its lifetime and explicitly releasing it when no longer needed.
| void setUniform | ( | const rhi::UniformLocation & | uniformLocation, |
| const void * | data, | ||
| size_t | size ) |
Specify the value of a uniform variable for the current program state object.
| uniformLocation | Specifies the uniform location. |
| data | Specifies the new values to be used for the specified uniform variable. |
| size | Specifies the uniform data size. |
| rhi::UniformLocation getUniformLocation | ( | std::string_view | name | ) | const |
Get uniform location in given uniform name.
| uniform | Specifies the uniform name. |
| rhi::UniformLocation getUniformLocation | ( | rhi::Uniform | kind | ) | const |
Get uniform location in a more efficient way by the given built-in uniform name.
| uniform | Specifies the engin built-in uniform name. |
| void setCallbackUniform | ( | const rhi::UniformLocation & | , |
| const UniformCallback & | ) |
A callback to update unifrom.
| uniformLocation | Specifies the uniform location. |
| unifromCallback | Specifies a callback function to update the uniform. |
|
inline |
Get the uniform callback function.
| void setTexture | ( | rhi::Texture * | texture | ) |
Set texture.
| uniformLocation | Specifies texture location. |
| texture | Specifies a pointer to backend texture. |
|
inline |
Get vertex texture informations.
| void setParameterAutoBinding | ( | std::string_view | uniformName, |
| std::string_view | autoBinding ) |
Sets a uniform auto-binding.
This method parses the passed in autoBinding string and attempts to convert it to an enumeration value. If it matches to one of the predefined strings, it will create a callback to get the correct value at runtime.
| uniformName | The name of the material parameter to store an auto-binding for. |
| autoBinding | A string matching one of the built-in AutoBinding enum constants. |