Abstract interface for material resource binding.
More...
#include <Material.h>
Inherits Raven::RefCounted.
Inherited by Raven::VulkanMaterial.
|
| virtual | ~Material ()=default |
| virtual void | SetTexture (const std::string &name, Ref< Texture2D > texture)=0 |
| | Assigns a 2D texture to the material.
|
| virtual void | SetFloat (const std::string &name, float value)=0 |
| | Assigns a scalar float value to the material.
|
| virtual void | SetFloat3 (const std::string &name, const Crux::vec3 &value)=0 |
| | Assigns a 3-component float vector to the material.
|
| virtual void | SetFloat4 (const std::string &name, const Crux::vec4 &value)=0 |
| | Assigns a 4-component float vector to the material.
|
| virtual void | Bind (Ref< RenderCommandBuffer > commandBuffer, void *pipelineLayout)=0 |
| | Binds this material to the GPU pipeline.
|
| virtual void | SetName (const std::string &name)=0 |
| | Sets the name of this material.
|
| virtual const std::string & | GetName () const =0 |
| | Retrieves the name of this material.
|
| | RefCounted () |
| virtual | ~RefCounted () |
| void | IncRefCount () |
| void | DecRefCount () |
| u32 | GetRefCount () const |
Abstract interface for material resource binding.
Materials define the data provided to a shader at draw time, such as textures and uniform values. Derived classes (VulkanMaterial, future backends) implement platform-specific binding logic.
Typical workflow:
- Create a Material using Material::Create(shader).
- Assign properties via SetTexture / SetFloat / SetFloat3 / SetFloat4.
- Call Bind() to apply the material before issuing draw calls.
◆ ~Material()
| virtual Raven::Material::~Material |
( |
| ) |
|
|
virtualdefault |
◆ Bind()
Binds this material to the GPU pipeline.
Backend implementations update GPU state (e.g., descriptor sets in Vulkan) and bind the material's parameters to the command buffer for rendering.
- Parameters
-
| commandBuffer | Command buffer where binding occurs. |
| pipelineLayout | The pipeline layout to bind against (backend-specific). |
Implemented in Raven::VulkanMaterial.
◆ Create()
Factory method to create a material for the active rendering backend.
The specific subclass returned depends on the current renderer API (e.g., VulkanMaterial when using Vulkan).
- Parameters
-
| shader | Shader reference defining this material's binding layout. |
- Returns
- A reference to a newly created Material instance.
◆ GetName()
| virtual const std::string & Raven::Material::GetName |
( |
| ) |
const |
|
pure virtual |
Retrieves the name of this material.
- Returns
- The assigned material name.
Implemented in Raven::VulkanMaterial.
◆ SetFloat()
| virtual void Raven::Material::SetFloat |
( |
const std::string & | name, |
|
|
float | value ) |
|
pure virtual |
Assigns a scalar float value to the material.
- Parameters
-
| name | The shader uniform name. |
| value | The float value to bind. |
Implemented in Raven::VulkanMaterial.
◆ SetFloat3()
| virtual void Raven::Material::SetFloat3 |
( |
const std::string & | name, |
|
|
const Crux::vec3 & | value ) |
|
pure virtual |
Assigns a 3-component float vector to the material.
- Parameters
-
| name | The shader uniform name. |
| value | The vec3 value to bind. |
Implemented in Raven::VulkanMaterial.
◆ SetFloat4()
| virtual void Raven::Material::SetFloat4 |
( |
const std::string & | name, |
|
|
const Crux::vec4 & | value ) |
|
pure virtual |
Assigns a 4-component float vector to the material.
- Parameters
-
| name | The shader uniform name. |
| value | The vec4 value to bind. |
Implemented in Raven::VulkanMaterial.
◆ SetName()
| virtual void Raven::Material::SetName |
( |
const std::string & | name | ) |
|
|
pure virtual |
◆ SetTexture()
| virtual void Raven::Material::SetTexture |
( |
const std::string & | name, |
|
|
Ref< Texture2D > | texture ) |
|
pure virtual |
Assigns a 2D texture to the material.
- Parameters
-
| name | The shader resource name (e.g., "u_AlbedoMap"). |
| texture | Reference to a Texture2D resource. |
Implemented in Raven::VulkanMaterial.
The documentation for this class was generated from the following files: