46 {
47 if (m_shader)
48 {
50
51 for (const auto& uniform : m_shader->GetLayout())
52 {
53
55
59 {
60 continue;
61 }
62
63 void* data = m_buffer.data() + uniform.Offset;
64
65 if (m_definedUniforms[uniform.Index])
66 {
67 m_shader->SetUniform(uniform.Name, uniform.Type, data);
68 }
69 }
70
71
72 m_shader->SetUniform1i("has_diffuseTex", 0);
73 m_shader->SetUniform1i("has_specularTex", 0);
74 m_shader->SetUniform1i("has_ambientTex", 0);
75
76 uint32_t slot = 0;
77 for (auto& tex : m_textures)
78 {
79 if (tex.second && tex.second->IsTextureLoaded())
80 {
82 m_shader->SetUniform1i(tex.first, slot);
83 m_shader->SetUniform1i("has_" + tex.first, 1);
84 slot++;
85 }
86 }
87 }
88 else
89 {
90 EE_CORE_ERROR("Material::Apply() : Cannot apply uniforms to a shader that is nullptr.");
91 }
92 }
#define EE_SHADER_VIEWPROJ
static void BindTexture(const std::shared_ptr< Texture > &texture, uint8_t slot=0)
static bool BindShader(const std::shared_ptr< Shader > &shader)