![]() |
Raven Engine v0.1
|
Vulkan-specific material resource binder. More...
#include <VulkanMaterial.h>
Public Member Functions | |
| VulkanMaterial (const Ref< Shader > &shader) | |
| Constructs a VulkanMaterial using the provided shader. | |
| void | Destroy () |
| Releases all GPU-bound material resources. | |
| void | SetTexture (const std::string &name, const Ref< Texture2D > &texture) override |
| Assigns a 2D texture to the material. | |
| void | SetFloat (const std::string &name, float value) override |
| Assigns a scalar float value to the material. | |
| void | SetFloat3 (const std::string &name, const Crux::vec3 &value) override |
| Assigns a 3-component float vector to the material. | |
| void | SetFloat4 (const std::string &name, const Crux::vec4 &value) override |
| Assigns a 4-component float vector to the material. | |
| void | Bind (const Ref< RenderCommandBuffer > &commandBuffer, void *pipelineLayout) override |
| Binds this material's resources to the GPU pipeline. | |
Additional Inherited Members | |
| Static Public Member Functions inherited from Raven::Material | |
| static Ref< Material > | Create (const Ref< Shader > &shader) |
| Factory method to create a material for the active rendering backend. | |
Vulkan-specific material resource binder.
VulkanMaterial extends Raven::Material and provides Vulkan-native handling of descriptors and shader resource bindings. It maintains maps of textures and uniform values which, when modified, mark the material as "dirty." On the next Bind() call, VulkanMaterial updates its descriptor set before binding it to the current command buffer.
Key Responsibilities:
Usage:
Constructs a VulkanMaterial using the provided shader.
Allocates a descriptor set from the global Vulkan descriptor pool using the layout defined in the shader (set = 2).
| shader | Reference to a VulkanShader instance. |
|
overridevirtual |
Binds this material's resources to the GPU pipeline.
If the material is marked dirty (modified since last bind), this updates the Vulkan descriptor set with all bound textures and the primary sampler. The descriptor set is then bound to the provided command buffer at set = 2.
| commandBuffer | Render command buffer used for issuing Vulkan commands. |
| pipelineLayout | Vulkan pipeline layout to bind against. |
Implements Raven::Material.
| void Raven::VulkanMaterial::Destroy | ( | ) |
Releases all GPU-bound material resources.
This explicitly releases references to textures and the underlying shader. Should be called when the material is no longer needed.
|
overridevirtual |
Assigns a scalar float value to the material.
| name | The shader uniform name. |
| value | The float value to bind. |
Implements Raven::Material.
|
overridevirtual |
Assigns a 3-component float vector to the material.
| name | The shader uniform name. |
| value | The vec3 value to bind. |
Implements Raven::Material.
|
overridevirtual |
Assigns a 4-component float vector to the material.
| name | The shader uniform name. |
| value | The vec4 value to bind. |
Implements Raven::Material.
|
overridevirtual |
Assigns a 2D texture to the material.
| name | The shader resource name (e.g., "u_AlbedoMap"). |
| texture | Reference to a Texture2D resource. |
Implements Raven::Material.