8 :
Component(object), m_material(material) {}
28 GameObject*
object,
const std::string& diffuseTexture)
37 m_material->Initialize();
44 if (!m_enabled || !m_material)
56 m_material = material;
58 m_material->Initialize();
69 m_material->Initialize();
78 return m_material.IsValid() ? m_material.get() :
nullptr;
87 const std::string& path) {
89 m_material->SetDiffuseTexture(path);
93 const std::string& path) {
95 m_material->SetNormalTexture(path);
100 m_material->SetShininess(shininess);
105 m_material->SetMetallic(metallic);
110 m_material->SetRoughness(roughness);
Component(GameObject *object)
void SetShininess(float shininess)
bool Initialize() override
Initializes the owned material's GPU resources.
void SetDiffuseTexture(const std::string &path)
Material * GetMaterialRaw() const
void SetDiffuseColor(Math::Color color)
void OnDisable() override
void SetMetallic(float metallic)
void SetRoughness(float roughness)
void Update(float DeltaTime) override
Submits the material to the render command queue for this frame.
MaterialComponent(GameObject *object, const RefPtr< Material > &material)
const RefPtr< Material > & GetMaterial() const
void SetNormalTexture(const std::string &path)
void SetMaterial(const RefPtr< Material > &material)
Replaces the material, re-initializing it if the component is already initialized.
void SetDiffuseTexture(Texture *texture)
void SetDiffuseColor(Math::Color color)
static RenderCommandQueue * GetInstance()
Lazily creates and returns the process-wide singleton instance.
void SubmitBindMaterial(::Sleak::Material *material)
Queues a material bind, switching shader/texture state for subsequent draws.
Root namespace for everything the engine exposes.