-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlight_editor.h
52 lines (41 loc) · 1.46 KB
/
light_editor.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#pragma once
#include <imgui/imgui.h>
#include <imgui/imgui_impl_glfw.h>
#include <imgui/imgui_impl_opengl3.h>
#include "light_manager.h"
class LightEditor
{
public:
LightEditor(LightManager& lightManager) : lm(lightManager) {}
void BuildGUI() const
{
ImGui::Begin("Light Editor");
// Adjust point light position
if (ImGui::CollapsingHeader("Point Light")) {
// Add UI elements within the collapsible section
ImGui::Text("Light Position");
ImGui::SliderFloat3("Position", &lm.pl.position[0], -15.0f, 15.0f);
// Adjust light colors
ImGui::Text("Light Colors");
ImGui::ColorEdit3("PL Ambient", &lm.pl.ambient[0]);
ImGui::ColorEdit3("PL Diffuse", &lm.pl.diffuse[0]);
ImGui::ColorEdit3("PL Specular", &lm.pl.specular[0]);
ImGui::SliderFloat("PL Constant", &lm.pl.constant, 0.0f, 1.0f);
ImGui::SliderFloat("PL Linear", &lm.pl.linear, 0.0f, 1.0f);
ImGui::SliderFloat("PL Quadratic", &lm.pl.quadratic, 0.0f, 1.0f);
}
if (ImGui::CollapsingHeader("Directional Light")) {
// Add UI elements within the collapsible section
ImGui::Text("Light Direction");
ImGui::SliderFloat3("DL Direction", &lm.dl.direction[0], -15.0f, 15.0f);
// Adjust light colors
ImGui::Text("Light Colors");
ImGui::ColorEdit3("DL Ambient", &lm.dl.ambient[0]);
ImGui::ColorEdit3("DL Diffuse", &lm.dl.diffuse[0]);
ImGui::ColorEdit3("DL Specular", &lm.dl.specular[0]);
}
ImGui::End();
}
private:
LightManager& lm; // Reference to allow modifications
};