A memory slot for per instance data in a Shader. More...
Public Types | |
enum | DATA_TYPE { DATA_TYPE::UNKNOWN = 0, DATA_TYPE::WORLD_MATRIX, DATA_TYPE::WORLD_MATRIX_INV_TRANSPOSE, DATA_TYPE::CUSTOM } |
Public Member Functions | |
ShaderInstanceMemorySlot (System *system) noexcept | |
virtual | ~ShaderInstanceMemorySlot () |
DATA_TYPE | getType () const |
nkMemory::StringView | getSemanticName () const |
virtual unsigned int | getDataSize () const |
virtual nkMemory::StringView | getDataTypeAsString () const override |
void | setAsWorldMatrix () |
void | setAsWorldMatrixInvTranspose () |
void | setAsCustom (ShaderInstanceCustomSlot *slot) |
virtual void | exportClassToTree (nkExport::Node *rootNode) override |
virtual void | importClassFromTree (nkExport::Node *rootNode) override |
Public Member Functions inherited from nkGraphics::ShaderMemorySlot | |
ShaderMemorySlot () noexcept | |
virtual | ~ShaderMemorySlot () |
nkMemory::StringView | getSlotType () const |
Public Member Functions inherited from nkExport::Exportable | |
Exportable () noexcept | |
virtual | ~Exportable () |
A memory slot for per instance data in a Shader.
These slots are fed within a Shader, and offer the capabilities of feeding per instance data to a Program.
|
strong |
|
noexcept |
Constructor. See Shader::addInstanceMemorySlot().
system | The system the resource should live in. |
|
virtual |
Destructor.
DATA_TYPE nkGraphics::ShaderInstanceMemorySlot::getType | ( | ) | const |
nkMemory::StringView nkGraphics::ShaderInstanceMemorySlot::getSemanticName | ( | ) | const |
|
virtual |
|
overridevirtual |
Implements nkGraphics::ShaderMemorySlot.
void nkGraphics::ShaderInstanceMemorySlot::setAsWorldMatrix | ( | ) |
Prepare the slot to feed world matrices.
This adds a WORLD_MATRIX attribute within the declaration of mesh data. In HLSL, for instance, data can then be accessed like such :
The matrix is provided as row-major, meaning they can be used like :
void nkGraphics::ShaderInstanceMemorySlot::setAsWorldMatrixInvTranspose | ( | ) |
Prepare the slot to feed world matrices, inversed and transposed.
This adds a WORLD_MATRIX_INVERSE_TRANSPOSE attribute within the declaration of mesh data. In HLSL, for instance, data can then be access like such :
The matrix is provided as row-major, meaning they can be used like :
This matrix can be useful to work with normals.
void nkGraphics::ShaderInstanceMemorySlot::setAsCustom | ( | ShaderInstanceCustomSlot * | slot | ) |
Prepares the slot to use a custom slot to feed the data.
slot | The custom slot that should feed the data. |
|
overridevirtual |
Basic exporting capabilities.
rootNode | The tree to export to. |
Reimplemented from nkGraphics::ShaderMemorySlot.
|
overridevirtual |
Basic importing capabilities.
rootNode | The tree to import from. |
Implements nkExport::Exportable.