Raven Engine v0.1
A modern 3D Game Engine
Loading...
Searching...
No Matches
Raven::Material Class Referenceabstract

Abstract interface for material resource binding. More...

#include <Material.h>

Inherits Raven::RefCounted.

Inherited by Raven::VulkanMaterial.

Public Member Functions

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.
Public Member Functions inherited from Raven::RefCounted
 RefCounted ()
virtual ~RefCounted ()
void IncRefCount ()
void DecRefCount ()
u32 GetRefCount () const

Static Public Member Functions

static Ref< MaterialCreate (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.

Constructor & Destructor Documentation

◆ ~Material()

virtual Raven::Material::~Material ( )
virtualdefault

Member Function Documentation

◆ Bind()

virtual void Raven::Material::Bind ( 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 ( 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.

◆ 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
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.

◆ SetName()

virtual void Raven::Material::SetName ( const std::string & name)
pure virtual

Sets the name of this material.

Parameters
nameThe name to assign.

Implemented in Raven::VulkanMaterial.

◆ SetTexture()

virtual void Raven::Material::SetTexture ( const std::string & name,
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: