My Project
Loading...
Searching...
No Matches
Material Class Reference

Simple material class. Contains a diffuse color and an optional texture. Handles binding to the GPU pipeline. More...

#include <Material.hpp>

Public Member Functions

 Material ()=default
 Default constructor.
 ~Material ()=default
 Destructor.
bool IsReady () const
 Checks if the material is ready to be used (texture loaded).
void Bind (ID3D11DeviceContext *context) const
 Binds the material to the GPU pipeline. If a texture is set and ready, it will be bound. Otherwise, a null shader resource view is bound.

Public Attributes

std::shared_ptr< TextureAssettexture = nullptr
 Texture associated with this material.
DirectX::XMFLOAT3 color = DirectX::XMFLOAT3(1.0f, 1.0f, 1.0f)
 Diffuse color of the material (RGB, 0..1).

Detailed Description

Simple material class. Contains a diffuse color and an optional texture. Handles binding to the GPU pipeline.

Constructor & Destructor Documentation

◆ Material()

Material::Material ( )
default

Default constructor.

◆ ~Material()

Material::~Material ( )
default

Destructor.

Member Function Documentation

◆ Bind()

void Material::Bind ( ID3D11DeviceContext * context) const
inline

Binds the material to the GPU pipeline. If a texture is set and ready, it will be bound. Otherwise, a null shader resource view is bound.

Parameters
contextDevice context used for binding

◆ IsReady()

bool Material::IsReady ( ) const
inline

Checks if the material is ready to be used (texture loaded).

Returns
True if texture exists and is ready, false otherwise

Member Data Documentation

◆ color

DirectX::XMFLOAT3 Material::color = DirectX::XMFLOAT3(1.0f, 1.0f, 1.0f)

Diffuse color of the material (RGB, 0..1).

◆ texture

std::shared_ptr<TextureAsset> Material::texture = nullptr

Texture associated with this material.


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