Raven Engine v0.1
Loading...
Searching...
No Matches
Raven::Material Class Referenceabstract

Abstract interface for material resource binding. More...

#include <Material.h>

Inheritance diagram for Raven::Material:
Raven::VulkanMaterial

Public Member Functions

virtual void SetTexture (const std::string &name, const 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 (const Ref< RenderCommandBuffer > &commandBuffer, void *pipelineLayout)=0
 Binds this material to the GPU pipeline.

Static Public Member Functions

static Ref< MaterialCreate (const Ref< Shader > &shader)
 Factory method to create a material for the active rendering backend.

Detailed Description

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:

  1. Create a Material using Material::Create(shader).
  2. Assign properties via SetTexture / SetFloat / SetFloat3 / SetFloat4.
  3. Call Bind() to apply the material before issuing draw calls.

Member Function Documentation

◆ Bind()

virtual void Raven::Material::Bind ( const Ref< RenderCommandBuffer > & commandBuffer,
void * pipelineLayout )
pure virtual

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
commandBufferCommand buffer where binding occurs.
pipelineLayoutThe pipeline layout to bind against (backend-specific).

Implemented in Raven::VulkanMaterial.

◆ Create()

Ref< Material > Raven::Material::Create ( const Ref< Shader > & shader)
static

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
shaderShader reference defining this material's binding layout.
Returns
A reference to a newly created Material instance.

◆ SetFloat()

virtual void Raven::Material::SetFloat ( const std::string & name,
float value )
pure virtual

Assigns a scalar float value to the material.

Parameters
nameThe shader uniform name.
valueThe 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
nameThe shader uniform name.
valueThe 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
nameThe shader uniform name.
valueThe vec4 value to bind.

Implemented in Raven::VulkanMaterial.

◆ SetTexture()

virtual void Raven::Material::SetTexture ( const std::string & name,
const Ref< Texture2D > & texture )
pure virtual

Assigns a 2D texture to the material.

Parameters
nameThe shader resource name (e.g., "u_AlbedoMap").
textureReference to a Texture2D resource.

Implemented in Raven::VulkanMaterial.


The documentation for this class was generated from the following files: