Line
Link Here
|
0 |
-- a/source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Environment/Environment.cpp |
0 |
++ b/source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Environment/Environment.cpp |
Lines 1-4
Link Here
|
1 |
/* Copyright (C) 2021 Wildfire Games. |
1 |
/* Copyright (C) 2022 Wildfire Games. |
2 |
* This file is part of 0 A.D. |
2 |
* This file is part of 0 A.D. |
3 |
* |
3 |
* |
4 |
* 0 A.D. is free software: you can redistribute it and/or modify |
4 |
* 0 A.D. is free software: you can redistribute it and/or modify |
Lines 29-36
using AtlasMessage::Shareable;
Link Here
|
29 |
|
29 |
|
30 |
static Observable<AtlasMessage::sEnvironmentSettings> g_EnvironmentSettings; |
30 |
static Observable<AtlasMessage::sEnvironmentSettings> g_EnvironmentSettings; |
31 |
|
31 |
|
32 |
const float M_PIf = 3.14159265f; |
|
|
33 |
|
34 |
////////////////////////////////////////////////////////////////////////// |
32 |
////////////////////////////////////////////////////////////////////////// |
35 |
|
33 |
|
36 |
class VariableSliderBox : public wxPanel |
34 |
class VariableSliderBox : public wxPanel |
Lines 85-96
public:
Link Here
|
85 |
: wxPanel(parent), |
83 |
: wxPanel(parent), |
86 |
m_Var(var) |
84 |
m_Var(var) |
87 |
{ |
85 |
{ |
88 |
m_Conn = g_EnvironmentSettings.RegisterObserver(0, &VariableListBox::OnSettingsChange, this); |
86 |
m_Conn = g_EnvironmentSettings.RegisterObserver( |
|
|
87 |
0, &VariableListBox::OnSettingsChange, this); |
89 |
|
88 |
|
90 |
m_Sizer = new wxStaticBoxSizer(wxVERTICAL, this, label); |
89 |
m_Sizer = new wxStaticBoxSizer(wxVERTICAL, this, label); |
91 |
SetSizer(m_Sizer); |
90 |
SetSizer(m_Sizer); |
92 |
|
91 |
|
93 |
m_Combo = new wxComboBox(this, -1, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxArrayString(), wxCB_READONLY), |
92 |
m_Combo = new wxComboBox( |
|
|
93 |
this, -1, wxEmptyString, wxDefaultPosition, wxDefaultSize, |
94 |
wxArrayString(), wxCB_READONLY), |
94 |
m_Sizer->Add(m_Combo, wxSizerFlags().Expand()); |
95 |
m_Sizer->Add(m_Combo, wxSizerFlags().Expand()); |
95 |
} |
96 |
} |
96 |
|
97 |
|
Lines 206-213
static void SendToGame(const AtlasMessage::sEnvironmentSettings& settings)
Link Here
|
206 |
POST_COMMAND(SetEnvironmentSettings, (settings)); |
207 |
POST_COMMAND(SetEnvironmentSettings, (settings)); |
207 |
} |
208 |
} |
208 |
|
209 |
|
209 |
EnvironmentSidebar::EnvironmentSidebar(ScenarioEditor& scenarioEditor, wxWindow* sidebarContainer, wxWindow* bottomBarContainer) |
210 |
EnvironmentSidebar::EnvironmentSidebar( |
210 |
: Sidebar(scenarioEditor, sidebarContainer, bottomBarContainer) |
211 |
ScenarioEditor& scenarioEditor, wxWindow* sidebarContainer, wxWindow* bottomBarContainer) |
|
|
212 |
: Sidebar(scenarioEditor, sidebarContainer, bottomBarContainer) |
211 |
{ |
213 |
{ |
212 |
wxSizer* scrollSizer = new wxBoxSizer(wxVERTICAL); |
214 |
wxSizer* scrollSizer = new wxBoxSizer(wxVERTICAL); |
213 |
wxScrolledWindow* scrolledWindow = new wxScrolledWindow(this); |
215 |
wxScrolledWindow* scrolledWindow = new wxScrolledWindow(this); |
Lines 217-231
EnvironmentSidebar::EnvironmentSidebar(ScenarioEditor& scenarioEditor, wxWindow*
Link Here
|
217 |
|
219 |
|
218 |
wxSizer* waterSizer = new wxStaticBoxSizer(wxVERTICAL, scrolledWindow, _T("Water settings")); |
220 |
wxSizer* waterSizer = new wxStaticBoxSizer(wxVERTICAL, scrolledWindow, _T("Water settings")); |
219 |
scrollSizer->Add(waterSizer, wxSizerFlags().Expand()); |
221 |
scrollSizer->Add(waterSizer, wxSizerFlags().Expand()); |
220 |
waterSizer->Add(new wxButton(scrolledWindow, ID_RecomputeWaterData, _("Reset Water Data")), wxSizerFlags().Expand()); |
222 |
waterSizer->Add(new wxButton( |
221 |
waterSizer->Add(m_WaterTypeList = new VariableListBox(scrolledWindow, _("Water Type"), g_EnvironmentSettings.watertype), wxSizerFlags().Expand()); |
223 |
scrolledWindow, ID_RecomputeWaterData, _("Reset Water Data")), wxSizerFlags().Expand()); |
222 |
waterSizer->Add(new VariableSliderBox(scrolledWindow, _("Water height"), g_EnvironmentSettings.waterheight, 0.f, 1.2f), wxSizerFlags().Expand()); |
224 |
waterSizer->Add(m_WaterTypeList = new VariableListBox( |
223 |
waterSizer->Add(new wxButton(scrolledWindow, ID_PickWaterHeight, _("Pick Water Height")), wxSizerFlags().Expand()); |
225 |
scrolledWindow, _("Water Type"), g_EnvironmentSettings.watertype), wxSizerFlags().Expand()); |
224 |
waterSizer->Add(new VariableSliderBox(scrolledWindow, _("Water waviness"), g_EnvironmentSettings.waterwaviness, 0.f, 10.f), wxSizerFlags().Expand()); |
226 |
waterSizer->Add(new VariableSliderBox( |
225 |
waterSizer->Add(new VariableSliderBox(scrolledWindow, _("Water murkiness"), g_EnvironmentSettings.watermurkiness, 0.f, 1.f), wxSizerFlags().Expand()); |
227 |
scrolledWindow, _("Water height"), g_EnvironmentSettings.waterheight, 0.f, 1.2f), wxSizerFlags().Expand()); |
226 |
waterSizer->Add(new VariableSliderBox(scrolledWindow, _("Wind angle"), g_EnvironmentSettings.windangle, -M_PIf, M_PIf), wxSizerFlags().Expand()); |
228 |
waterSizer->Add(new wxButton( |
227 |
waterSizer->Add(new VariableColorBox(scrolledWindow, _("Water color"), g_EnvironmentSettings.watercolor), wxSizerFlags().Expand()); |
229 |
scrolledWindow, ID_PickWaterHeight, _("Pick Water Height")), wxSizerFlags().Expand()); |
228 |
waterSizer->Add(new VariableColorBox(scrolledWindow, _("Water tint"), g_EnvironmentSettings.watertint), wxSizerFlags().Expand()); |
230 |
waterSizer->Add(new VariableSliderBox( |
|
|
231 |
scrolledWindow, _("Water waviness"), g_EnvironmentSettings.waterwaviness, 0.f, 10.f), wxSizerFlags().Expand()); |
232 |
waterSizer->Add(new VariableSliderBox( |
233 |
scrolledWindow, _("Water murkiness"), g_EnvironmentSettings.watermurkiness, 0.f, 1.f), wxSizerFlags().Expand()); |
234 |
waterSizer->Add(new VariableSliderBox( |
235 |
scrolledWindow, _("Wind angle"), g_EnvironmentSettings.windangle, -static_cast<float>(M_PI), static_cast<float>(M_PI)), wxSizerFlags().Expand()); |
236 |
waterSizer->Add(new VariableColorBox( |
237 |
scrolledWindow, _("Water color"), g_EnvironmentSettings.watercolor), wxSizerFlags().Expand()); |
238 |
waterSizer->Add(new VariableColorBox( |
239 |
scrolledWindow, _("Water tint"), g_EnvironmentSettings.watertint), wxSizerFlags().Expand()); |
229 |
|
240 |
|
230 |
std::vector<std::wstring> list; |
241 |
std::vector<std::wstring> list; |
231 |
list.push_back(L"ocean"); list.push_back(L"lake"); list.push_back(L"clap"); |
242 |
list.push_back(L"ocean"); list.push_back(L"lake"); list.push_back(L"clap"); |
Lines 235-259
EnvironmentSidebar::EnvironmentSidebar(ScenarioEditor& scenarioEditor, wxWindow*
Link Here
|
235 |
wxSizer* sunSizer = new wxStaticBoxSizer(wxVERTICAL, scrolledWindow, _T("Sun / lighting settings")); |
246 |
wxSizer* sunSizer = new wxStaticBoxSizer(wxVERTICAL, scrolledWindow, _T("Sun / lighting settings")); |
236 |
scrollSizer->Add(sunSizer, wxSizerFlags().Expand().Border(wxTOP, 8)); |
247 |
scrollSizer->Add(sunSizer, wxSizerFlags().Expand().Border(wxTOP, 8)); |
237 |
|
248 |
|
238 |
sunSizer->Add(new VariableSliderBox(scrolledWindow, _("Sun rotation"), g_EnvironmentSettings.sunrotation, -M_PIf, M_PIf), wxSizerFlags().Expand()); |
249 |
sunSizer->Add(new VariableSliderBox( |
239 |
sunSizer->Add(new VariableSliderBox(scrolledWindow, _("Sun elevation"), g_EnvironmentSettings.sunelevation, -M_PIf/2, M_PIf/2), wxSizerFlags().Expand()); |
250 |
scrolledWindow, _("Sun rotation"), g_EnvironmentSettings.sunrotation, -static_cast<float>(M_PI), static_cast<float>(M_PI)), wxSizerFlags().Expand()); |
240 |
sunSizer->Add(new VariableSliderBox(scrolledWindow, _("Sun overbrightness"), g_EnvironmentSettings.sunoverbrightness, 1.0f, 3.0f), wxSizerFlags().Expand()); |
251 |
sunSizer->Add(new VariableSliderBox( |
241 |
sunSizer->Add(new LightControl(scrolledWindow, wxSize(150, 150), g_EnvironmentSettings)); |
252 |
scrolledWindow, _("Sun elevation"), g_EnvironmentSettings.sunelevation, -static_cast<float>(M_PI) / 2.0f, static_cast<float>(M_PI) / 2.0f), wxSizerFlags().Expand()); |
242 |
sunSizer->Add(new VariableColorBox(scrolledWindow, _("Sun color"), g_EnvironmentSettings.suncolor), wxSizerFlags().Expand()); |
253 |
sunSizer->Add(new VariableSliderBox( |
243 |
sunSizer->Add(m_SkyList = new VariableListBox(scrolledWindow, _("Sky set"), g_EnvironmentSettings.skyset), wxSizerFlags().Expand()); |
254 |
scrolledWindow, _("Sun overbrightness"), g_EnvironmentSettings.sunoverbrightness, 1.0f, 3.0f), wxSizerFlags().Expand()); |
244 |
sunSizer->Add(new VariableSliderBox(scrolledWindow, _("Fog Factor"), g_EnvironmentSettings.fogfactor, 0.0f, 0.01f), wxSizerFlags().Expand()); |
255 |
sunSizer->Add(new LightControl( |
245 |
sunSizer->Add(new VariableSliderBox(scrolledWindow, _("Fog Thickness"), g_EnvironmentSettings.fogmax, 0.5f, 0.0f), wxSizerFlags().Expand()); |
256 |
scrolledWindow, wxSize(150, 150), g_EnvironmentSettings)); |
246 |
sunSizer->Add(new VariableColorBox(scrolledWindow, _("Fog color"), g_EnvironmentSettings.fogcolor), wxSizerFlags().Expand()); |
257 |
sunSizer->Add(new VariableColorBox( |
247 |
sunSizer->Add(new VariableColorBox(scrolledWindow, _("Ambient color"), g_EnvironmentSettings.ambientcolor), wxSizerFlags().Expand()); |
258 |
scrolledWindow, _("Sun color"), g_EnvironmentSettings.suncolor), wxSizerFlags().Expand()); |
|
|
259 |
sunSizer->Add(m_SkyList = new VariableListBox( |
260 |
scrolledWindow, _("Sky set"), g_EnvironmentSettings.skyset), wxSizerFlags().Expand()); |
261 |
sunSizer->Add(new VariableSliderBox( |
262 |
scrolledWindow, _("Fog Factor"), g_EnvironmentSettings.fogfactor, 0.0f, 0.01f), wxSizerFlags().Expand()); |
263 |
sunSizer->Add(new VariableSliderBox( |
264 |
scrolledWindow, _("Fog Thickness"), g_EnvironmentSettings.fogmax, 0.5f, 0.0f), wxSizerFlags().Expand()); |
265 |
sunSizer->Add(new VariableColorBox( |
266 |
scrolledWindow, _("Fog color"), g_EnvironmentSettings.fogcolor), wxSizerFlags().Expand()); |
267 |
sunSizer->Add(new VariableColorBox( |
268 |
scrolledWindow, _("Ambient color"), g_EnvironmentSettings.ambientcolor), wxSizerFlags().Expand()); |
248 |
|
269 |
|
249 |
wxSizer* postProcSizer = new wxStaticBoxSizer(wxVERTICAL, scrolledWindow, _T("Post-processing settings")); |
270 |
wxSizer* postProcSizer = new wxStaticBoxSizer(wxVERTICAL, scrolledWindow, _T("Post-processing settings")); |
250 |
scrollSizer->Add(postProcSizer, wxSizerFlags().Expand().Border(wxTOP, 8)); |
271 |
scrollSizer->Add(postProcSizer, wxSizerFlags().Expand().Border(wxTOP, 8)); |
251 |
|
272 |
|
252 |
postProcSizer->Add(m_PostEffectList = new VariableListBox(scrolledWindow, _("Post Effect"), g_EnvironmentSettings.posteffect), wxSizerFlags().Expand()); |
273 |
postProcSizer->Add(m_PostEffectList = new VariableListBox( |
253 |
postProcSizer->Add(new VariableSliderBox(scrolledWindow, _("Brightness"), g_EnvironmentSettings.brightness, -0.5f, 0.5f), wxSizerFlags().Expand()); |
274 |
scrolledWindow, _("Post Effect"), g_EnvironmentSettings.posteffect), wxSizerFlags().Expand()); |
254 |
postProcSizer->Add(new VariableSliderBox(scrolledWindow, _("Contrast (HDR)"), g_EnvironmentSettings.contrast, 0.5f, 1.5f), wxSizerFlags().Expand()); |
275 |
postProcSizer->Add(new VariableSliderBox( |
255 |
postProcSizer->Add(new VariableSliderBox(scrolledWindow, _("Saturation"), g_EnvironmentSettings.saturation, 0.0f, 2.0f), wxSizerFlags().Expand()); |
276 |
scrolledWindow, _("Brightness"), g_EnvironmentSettings.brightness, -0.5f, 0.5f), wxSizerFlags().Expand()); |
256 |
postProcSizer->Add(new VariableSliderBox(scrolledWindow, _("Bloom"), g_EnvironmentSettings.bloom, 0.2f, 0.0f), wxSizerFlags().Expand()); |
277 |
postProcSizer->Add(new VariableSliderBox( |
|
|
278 |
scrolledWindow, _("Contrast (HDR)"), g_EnvironmentSettings.contrast, 0.5f, 1.5f), wxSizerFlags().Expand()); |
279 |
postProcSizer->Add(new VariableSliderBox( |
280 |
scrolledWindow, _("Saturation"), g_EnvironmentSettings.saturation, 0.0f, 2.0f), wxSizerFlags().Expand()); |
281 |
postProcSizer->Add(new VariableSliderBox( |
282 |
scrolledWindow, _("Bloom"), g_EnvironmentSettings.bloom, 0.2f, 0.0f), wxSizerFlags().Expand()); |
257 |
|
283 |
|
258 |
m_Conn = g_EnvironmentSettings.RegisterObserver(0, &SendToGame); |
284 |
m_Conn = g_EnvironmentSettings.RegisterObserver(0, &SendToGame); |
259 |
} |
285 |
} |