Added color to lights, added a gui slider to control the single light color
This commit is contained in:
15
src/main.cpp
15
src/main.cpp
@@ -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();
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user