MCPcopy Create free account
hub / github.com/JeanPhilippeKernel/RendererEngine / Apply

Method Apply

ZEngine/src/StandardMaterial.cpp:82–105  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

80 }
81
82 void StandardMaterial::Apply(Shaders::Shader* const shader) {
83 ShaderMaterial::Apply(shader);
84
85 shader->SetUniform("material.tiling_factor", m_tile_factor);
86 shader->SetUniform("material.tint_color", m_tint_color);
87
88 shader->SetUniform("material.diffuse", 0);
89 shader->SetUniform("material.specular", 1);
90 shader->SetUniform("material.shininess", m_shininess);
91
92 shader->SetUniform("view_position", m_view_position);
93
94 if (!m_light.expired()) {
95 const auto light = m_light.lock();
96
97 shader->SetUniform("light.position", light->GetPosition());
98 shader->SetUniform("light.ambient", light->GetAmbientColor());
99 shader->SetUniform("light.diffuse", light->GetDiffuseColor());
100 shader->SetUniform("light.specular", light->GetSpecularColor());
101 }
102
103 m_texture->Bind();
104 m_specular_map->Bind(1);
105 }
106} // namespace ZEngine::Rendering::Materials

Callers

nothing calls this directly

Calls 6

SetUniformMethod · 0.80
GetAmbientColorMethod · 0.80
GetDiffuseColorMethod · 0.80
GetSpecularColorMethod · 0.80
GetPositionMethod · 0.45
BindMethod · 0.45

Tested by

no test coverage detected