CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
CeresEngine::RendererMaterialPBR Class Referencefinal

A renderer material that represents a PBR model material. More...

#include <CeresEngine/Renderer/RendererMaterial.hpp>

Inheritance diagram for CeresEngine::RendererMaterialPBR:
CeresEngine::RendererMaterial

Classes

class  Property
 

Public Member Functions

 RendererMaterialPBR (RendererMaterialManager &manager, const SPtr< PBRMaterial > &material)
 Creates a new renderer material from the given model on the given render API device.
 
void prepare (RendererContext &context) override
 Prepares the material for the rendering of the current frame.
 
void fillResourceSetDescriptor (GPUShaderResourceSetBindings &bindings) const final
 Fills a ReflectedResourceSetDescriptor with the material parameters.
 
const GPUShaderProgramPtrgetShaderProgram () const final
 Gets the shader program used by the material.
 
const GPUUniformBuffergetUniformBuffer () const final
 Returns the uniform buffer that holds material parameters.
 
const GPUResourceSetPtrgetResourceSet () const final
 Returns the ResourceSet that holds material parameters.
 
GPUResourceSetDescriptor getResourceSetDescriptor () const final
 Returns the ResourceSet bindings that holds material parameters.
 
const PBRMaterialModelgetModel () const noexcept
 A copy of the PBR material model structure.
 
void bind (GPUCommandBuffer &commandBuffer) final
 Binds the material to the given command buffer.
 
- Public Member Functions inherited from CeresEngine::RendererMaterial
 RendererMaterial (RendererMaterialManager &manager)
 Creates a new renderer material.
 
virtual ~RendererMaterial ()=default
 Virtual defaulted destructor.
 
UInt32 getID () const noexcept
 A unique ID that can be used to uniquely identify the material in the bindless material resource set.
 
bool isDirty () const noexcept
 
void markAsDirty () noexcept
 

Public Attributes

const Property< ColorbaseColor
 A material channel that represents the base color (or albedo) of the material.
 
const Property< doubleroughness
 A material channel that represents the roughness map of the material.
 
const Property< doublemetallic
 A material channel that represents the metallic map of the material.
 
const Property< Vector3normal
 A material channel that represents the normal map of the material.
 
const Property< Coloremission
 The material emission property.
 
const Property< Vector3displacement
 The material displacement property.
 
const Property< doubleambientOcclusion
 The material ambient occlusion property.
 

Private Member Functions

void onImageChanged ()
 
void didChangeMaterialModel (const PBRMaterialModel &newModel)
 An event called whenever the associated PBRMaterialModel has a property changed.
 

Private Attributes

SPtr< PBRMaterialmMaterial
 The material resource referneced by this renderer material.
 
PBRMaterialModel mModel
 A copy of the PBR material model structure.
 
GPUShaderProgramPtr mShaderProgram
 The deferred PBR shader program.
 
GPUPipelineLayoutPtr mPipelineLayout
 The deferred PBR shader pipeline layout.
 
GPUDynamicUniformBuffer< PBRMaterialParamsmUniformBuffer
 The uniform buffer that holds GPU parameters for the material.
 
GPUResourceSetDescriptor mResourceSetDescriptor
 
GPUResourceSetPtr mResourceSet
 The ResourceSet with renderer material parameters.
 
UInt64 mHash = ~0u
 

Friends

class RendererMaterialManager
 

Additional Inherited Members

- Protected Attributes inherited from CeresEngine::RendererMaterial
RendererMaterialManagermManager
 The material manager that owns and manages this material instance.
 
RenderermRenderer
 The renderer that owns the material.
 
UInt32 mID = ~0u
 A unique ID that can be used to uniquely identify the material in the bindless material resource set.
 
bool mDirty = true
 

Detailed Description

A renderer material that represents a PBR model material.

Constructor & Destructor Documentation

◆ RendererMaterialPBR()

CeresEngine::RendererMaterialPBR::RendererMaterialPBR ( RendererMaterialManager manager,
const SPtr< PBRMaterial > &  material 
)
explicit

Creates a new renderer material from the given model on the given render API device.

Member Function Documentation

◆ bind()

void CeresEngine::RendererMaterialPBR::bind ( GPUCommandBuffer commandBuffer)
finalvirtual

Binds the material to the given command buffer.

Implements CeresEngine::RendererMaterial.

◆ didChangeMaterialModel()

void CeresEngine::RendererMaterialPBR::didChangeMaterialModel ( const PBRMaterialModel newModel)
private

An event called whenever the associated PBRMaterialModel has a property changed.

◆ fillResourceSetDescriptor()

void CeresEngine::RendererMaterialPBR::fillResourceSetDescriptor ( GPUShaderResourceSetBindings bindings) const
finalvirtual

Fills a ReflectedResourceSetDescriptor with the material parameters.

The parameters are filled by name.

Parameters
bindingsThe bindings to be filled with material parameters.

Implements CeresEngine::RendererMaterial.

◆ getModel()

const PBRMaterialModel & CeresEngine::RendererMaterialPBR::getModel ( ) const
inlinenoexcept

A copy of the PBR material model structure.

◆ getResourceSet()

const GPUResourceSetPtr & CeresEngine::RendererMaterialPBR::getResourceSet ( ) const
inlinefinalvirtual

Returns the ResourceSet that holds material parameters.

Implements CeresEngine::RendererMaterial.

◆ getResourceSetDescriptor()

GPUResourceSetDescriptor CeresEngine::RendererMaterialPBR::getResourceSetDescriptor ( ) const
inlinefinalvirtual

Returns the ResourceSet bindings that holds material parameters.

Implements CeresEngine::RendererMaterial.

◆ getShaderProgram()

const GPUShaderProgramPtr & CeresEngine::RendererMaterialPBR::getShaderProgram ( ) const
inlinefinalvirtual

Gets the shader program used by the material.

Implements CeresEngine::RendererMaterial.

◆ getUniformBuffer()

const GPUUniformBuffer & CeresEngine::RendererMaterialPBR::getUniformBuffer ( ) const
inlinefinalvirtual

Returns the uniform buffer that holds material parameters.

Implements CeresEngine::RendererMaterial.

◆ onImageChanged()

void CeresEngine::RendererMaterialPBR::onImageChanged ( )
private

◆ prepare()

void CeresEngine::RendererMaterialPBR::prepare ( RendererContext context)
overridevirtual

Prepares the material for the rendering of the current frame.

This will update uniform buffers and perform any other necessary operations necessary for rendering. All prepared data must be view independent.

Parameters
contextA context struct that contains parameters given by the renderer.

Implements CeresEngine::RendererMaterial.

Friends And Related Symbol Documentation

◆ RendererMaterialManager

Member Data Documentation

◆ ambientOcclusion

const Property<double> CeresEngine::RendererMaterialPBR::ambientOcclusion

The material ambient occlusion property.

◆ baseColor

const Property<Color> CeresEngine::RendererMaterialPBR::baseColor

A material channel that represents the base color (or albedo) of the material.

◆ displacement

const Property<Vector3> CeresEngine::RendererMaterialPBR::displacement

The material displacement property.

◆ emission

const Property<Color> CeresEngine::RendererMaterialPBR::emission

The material emission property.

◆ metallic

const Property<double> CeresEngine::RendererMaterialPBR::metallic

A material channel that represents the metallic map of the material.

◆ mHash

UInt64 CeresEngine::RendererMaterialPBR::mHash = ~0u
private

◆ mMaterial

SPtr<PBRMaterial> CeresEngine::RendererMaterialPBR::mMaterial
private

The material resource referneced by this renderer material.

◆ mModel

PBRMaterialModel CeresEngine::RendererMaterialPBR::mModel
private

A copy of the PBR material model structure.

◆ mPipelineLayout

GPUPipelineLayoutPtr CeresEngine::RendererMaterialPBR::mPipelineLayout
private

The deferred PBR shader pipeline layout.

This is used to create new ResourceSets and is inferred from the shader program.

◆ mResourceSet

GPUResourceSetPtr CeresEngine::RendererMaterialPBR::mResourceSet
private

The ResourceSet with renderer material parameters.

◆ mResourceSetDescriptor

GPUResourceSetDescriptor CeresEngine::RendererMaterialPBR::mResourceSetDescriptor
private

◆ mShaderProgram

GPUShaderProgramPtr CeresEngine::RendererMaterialPBR::mShaderProgram
private

The deferred PBR shader program.

◆ mUniformBuffer

GPUDynamicUniformBuffer<PBRMaterialParams> CeresEngine::RendererMaterialPBR::mUniformBuffer
private

The uniform buffer that holds GPU parameters for the material.

◆ normal

const Property<Vector3> CeresEngine::RendererMaterialPBR::normal

A material channel that represents the normal map of the material.

◆ roughness

const Property<double> CeresEngine::RendererMaterialPBR::roughness

A material channel that represents the roughness map of the material.


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