Skip to content
Snippets Groups Projects
Commit 4601a497 authored by JonShard's avatar JonShard
Browse files

Added sun changes color depening on time of day.

parent cc0ed79e
No related branches found
No related tags found
No related merge requests found
......@@ -156,13 +156,14 @@ int main(int argc, char** args)
}
ImGui::Text("Time of day: %d:%d", int(Input::m_timeOfDay), int(Input::m_timeOfDay * 60) % 60);
Entity* sun = Scene::getEntityByTag("distantSunLight"); // Rotate sun.
EntityDirectionalLight* sun = (EntityDirectionalLight*) Scene::getEntityByTag("distantSunLight"); // Rotate sun.
if (sun == nullptr)
{
LOG_ERROR("No Sun in scene by tag distantSunLight"); // Terminates app.
}
sun-> setRotation(glm::vec3(0, (Input::m_timeOfDay / Input::m_maxDay) * 360,0));
sun-> m_intensities.b = glm::clamp(glm::abs(glm::sin(glm::radians(sun-> getRotation().y))), 0.3f, 1.0f);
sun-> m_intensities.g = glm::clamp(glm::abs(glm::sin(glm::radians(sun-> getRotation().y))), 0.8f, 1.0f);
// Plane controls:
Entity* plane = Scene::getEntityByTag("planeCore");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment