15#define TEXTURE_SLOT_DIFFUSE 0
16#define TEXTURE_SLOT_NORMAL 1
17#define TEXTURE_SLOT_SPECULAR 2
18#define TEXTURE_SLOT_ROUGHNESS 3
19#define TEXTURE_SLOT_METALLIC 4
20#define TEXTURE_SLOT_AO 5
21#define TEXTURE_SLOT_EMISSIVE 6
25 namespace RenderEngine {
28 struct MaterialGPUData;
97 void SetShader(
const std::string& shaderPath);
138 void SetDiffuseColor(uint8_t r, uint8_t g, uint8_t b, uint8_t a = 255);
161 void SetAO(
float ao);
222 Math::Color m_emissiveColor {0, 0, 0, 255};
225 float m_shininess = 32.0f;
226 float m_metallic = 0.0f;
227 float m_roughness = 0.5f;
229 float m_normalIntensity = 1.0f;
230 float m_emissiveIntensity = 1.0f;
231 float m_opacity = 1.0f;
232 float m_alphaCutoff = 0.5f;
235 float m_tilingX = 1.0f;
236 float m_tilingY = 1.0f;
237 float m_offsetX = 0.0f;
238 float m_offsetY = 0.0f;
242 bool m_twoSided =
false;
float GetAlphaCutoff() const
Math::Color GetEmissiveColor() const
Texture * GetRoughnessTexture() const
void SetShader(RenderEngine::Shader *shader)
Texture * GetMetallicTexture() const
bool HasNormalTexture() const
Math::Color GetSpecularColor() const
RenderEngine::Shader * GetShader() const
void SetMetallicTexture(Texture *texture)
Texture * GetNormalTexture() const
void SetNormalTexture(Texture *texture)
void SetOpacity(float opacity)
Texture * GetDiffuseTexture() const
void SetMetallic(float metallic)
void SetShininess(float shininess)
bool HasEmissiveTexture() const
void SetOffset(float x, float y)
bool HasAOTexture() const
void SetAOTexture(Texture *texture)
void SetDiffuseTexture(Texture *texture)
void SetSpecularColor(Math::Color color)
float GetShininess() const
Texture * GetEmissiveTexture() const
void SetRenderMode(MaterialRenderMode mode)
void SetAlphaCutoff(float cutoff)
void Initialize()
Lazily allocates the material's constant buffer on first use.
void SetSpecularTexture(Texture *texture)
bool HasRoughnessTexture() const
void BindTexturesAndCB()
Binds textures and uploads the material CB for the deferred geometry pass, skipping the shader bind.
bool HasSpecularTexture() const
Texture * GetSpecularTexture() const
void SetRoughnessTexture(Texture *texture)
Math::Vector2D GetTiling() const
Math::Color GetDiffuseColor() const
void SetTwoSided(bool twoSided)
MaterialRenderMode GetRenderMode() const
bool HasDiffuseTexture() const
void SetNormalIntensity(float intensity)
void SetEmissiveTexture(Texture *texture)
Math::Vector2D GetOffset() const
void SetEmissiveColor(Math::Color color)
void SetDiffuseColor(Math::Color color)
void SetRoughness(float roughness)
bool IsForwardRendered() const
True when this material must skip the GBuffer and render in the forward transparent pass.
Texture * GetAOTexture() const
float GetNormalIntensity() const
float GetRoughness() const
void SetTiling(float x, float y)
float GetMetallic() const
void SetEmissiveIntensity(float intensity)
void Bind()
Binds shader, all set textures, and uploads the packed material CB for a forward draw.
float GetEmissiveIntensity() const
bool HasMetallicTexture() const
Object(const std::string &name="Object")
Backend-agnostic compiled shader program.
Root namespace for everything the engine exposes.
Packed PBR material parameters uploaded to the material constant buffer.