Added color to lights, added a gui slider to control the single light color

This commit is contained in:
MitchellHansen
2017-03-18 20:08:38 -07:00
parent 4549428954
commit 6a3eaa04f7
6 changed files with 77 additions and 47 deletions

View File

@@ -143,7 +143,7 @@ int main() {
LightPrototype prototype(
sf::Vector3f(100.0f, 100.0f, 30.0f),
sf::Vector3f(-1.0f, -1.0f, -1.5f),
sf::Vector4f(1.0f, 1.0f, 1.0f, 1.0f)
sf::Vector4f(0.2f, 0.9f, 0.0f, 1.0f)
);
std::shared_ptr<LightHandle> handle(light_controller.create_light(prototype));
@@ -178,6 +178,8 @@ int main() {
sf::Clock sf_delta_clock;
fps_counter fps;
float light_color[4] = { 0, 0, 0, 0 };
while (window.isOpen()) {
input_handler.consume_sf_events(&window);
@@ -254,6 +256,17 @@ int main() {
ImGui::End();
ImGui::Begin("Lights");
if (ImGui::SliderFloat4("Color", light_color, 0, 1)) {
sf::Vector4f light(light_color[0], light_color[1], light_color[2], light_color[3]);
handle->set_rgbi(light);
}
ImGui::End();
ImGui::Render();