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;
100 void SetShader(
const std::string& shaderPath);
148 void SetDiffuseColor(uint8_t r, uint8_t g, uint8_t b, uint8_t a = 255);
171 void SetAO(
float ao);
232 Math::Color m_emissiveColor {0, 0, 0, 255};
235 float m_shininess = 32.0f;
236 float m_metallic = 0.0f;
237 float m_roughness = 0.5f;
239 float m_normalIntensity = 1.0f;
240 float m_emissiveIntensity = 1.0f;
241 float m_opacity = 1.0f;
242 float m_alphaCutoff = 0.5f;
245 float m_tilingX = 1.0f;
246 float m_tilingY = 1.0f;
247 float m_offsetX = 0.0f;
248 float m_offsetY = 0.0f;
252 bool m_twoSided =
false;
void SetRoughnessTexture(const RefPtr< Texture > &texture)
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
Texture * GetNormalTexture() const
void SetAOTexture(const RefPtr< Texture > &texture)
void SetOpacity(float opacity)
Texture * GetDiffuseTexture() const
void SetMetallic(float metallic)
void SetShininess(float shininess)
void SetEmissiveTexture(const RefPtr< Texture > &texture)
bool HasEmissiveTexture() const
void SetOffset(float x, float y)
bool HasAOTexture() const
void SetDiffuseTexture(const RefPtr< Texture > &texture)
void SetNormalTexture(const RefPtr< 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.
bool HasRoughnessTexture() const
void BindTexturesAndCB()
Binds textures and uploads the material CB for the deferred geometry pass, skipping the shader bind.
bool HasSpecularTexture() const
void SetSpecularTexture(const RefPtr< Texture > &texture)
Texture * GetSpecularTexture() const
Math::Vector2D GetTiling() const
Math::Color GetDiffuseColor() const
void SetMetallicTexture(const RefPtr< Texture > &texture)
void SetTwoSided(bool twoSided)
MaterialRenderMode GetRenderMode() const
bool HasDiffuseTexture() const
void SetNormalIntensity(float intensity)
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.