载入中...
搜索中...
未找到
DayNight.h
浏览该文件的文档.
1#pragma once
2#include "common/Export.h"
3
4
5#include "common/Module.h"
6#include "common/Result.h"
7
8#include <string>
9#include <vector>
10
11namespace eve::graphics {
12class Graphics;
13class Light3D;
14class ReflectionProbeCapture;
15class Volumetric;
16} // namespace eve::graphics
17
18namespace eve::daynight {
19
22 bool enabled = false;
23 float pitchDegrees = 75.f;
24 float rotationDegrees = 0.f;
25 float intensity = 1.f;
26 float red = 1.f;
27 float green = 1.f;
28 float blue = 1.f;
29 float kelvin = 6500.f;
30};
31
34 bool enabled = false;
35 float rotationDegrees = 0.f;
36 float exposure = 1.f;
37 float tintRed = 0.f;
38 float tintGreen = 0.f;
39 float tintBlue = 0.f;
40};
41
46 bool overrideFog = false;
47 int mode = 1;
48 float red = 0.f, green = 0.f, blue = 0.f;
49 float density = 0.01f;
50 float startDistance = 100.f;
51 float endDistance = 1000.f;
55 float densityVolumeDistance = 250.f;
58};
59
62 bool active = false;
63 float intensity = 1.f;
64 float skyRed = 0.7027151f, skyGreen = 0.881016f, skyBlue = 1.001631f;
65 float equatorRed = 0.6302439f, equatorGreen = 0.7919513f, equatorBlue = 0.85f;
66 float groundRed = 0.5f, groundGreen = 0.4142857f, groundBlue = 0.3321428f;
68};
69
95public:
97
99 DayNight();
101 ~DayNight() override;
102
104 void init(graphics::Graphics *gfx);
106 void update(float dt, graphics::Graphics *gfx);
107
108 // ---- clock ----
110 void setTimeOfDay(float hours); // 0..24
112 float getTimeOfDay() const;
114 void setSpeed(float hoursPerRealHour); // default 1.0
116 float getSpeed() const;
118 void setPaused(bool paused);
120 bool isPaused() const;
122 bool isNight() const;
123
124 // ---- sun ----
126 float getSunElevation() const;
128 float getSunAzimuth() const;
130 float getSunDirX() const;
132 float getSunDirY() const;
134 float getSunDirZ() const;
136 float getSunIntensity() const;
138 float getSunR() const;
140 float getSunG() const;
142 float getSunB() const;
150 [[nodiscard]] Result<void> setPcgManualSun(const PcgManualSunState &state);
152 PcgManualSunState getPcgManualSun() const noexcept;
159 [[nodiscard]] Result<void> setPcgSkybox(const PcgSkyboxState &state);
161 PcgSkyboxState getPcgSkybox() const noexcept;
168 [[nodiscard]] Result<void> setPcgFog(const PcgFogState &state);
170 PcgFogState getPcgFog() const noexcept;
177 [[nodiscard]] Result<void> setPcgAmbientLight(const PcgAmbientLightState &state);
179 PcgAmbientLightState getPcgAmbientLight() const noexcept;
180
181 // ---- atmosphere ----
183 void setTurbidity(float turbidity);
185 float getTurbidity() const;
187 void setSkyExposure(float exposure);
189 float getSkyExposure() const;
191 void setMieStrength(float strength);
193 float getMieStrength() const;
194
195 // ---- sky / ambient (sampled by the scene) ----
197 float getSkyR() const;
199 float getSkyG() const;
201 float getSkyB() const;
203 float getAmbientR() const;
205 float getAmbientG() const;
207 float getAmbientB() const;
209 float getAmbientBrightness() const;
210
220 void applyAtmosphere(graphics::Volumetric *fog) const;
225 void applyReflectionProbeSky(graphics::ReflectionProbeCapture *probe) const;
226
227 // ---- weather coupling ----
233 void setWeatherInfluence(float cloudiness, float lightningFlash);
235 float getWeatherCloudiness() const;
237 float getWeatherFlash() const;
238
239 // ---- skybox ----
241 void setSkyboxEnabled(bool enabled);
243 bool isSkyboxEnabled() const;
244
245 // ---- night lighting ----
247 void setNightLight(const std::string &name, bool enabled);
249 bool isNightLight(const std::string &name) const;
250 static const char *const kNamedLights[];
251 static const int kNamedLightCount;
252
254 void setFirePosition(float x, float y, float z);
256 void addFirefly(float x, float y, float z);
258 void clearFireflies();
260 int getFireflyCount() const;
261
262private:
263 struct Impl;
264 Impl *impl_ = nullptr;
265};
266
267} // namespace eve::daynight
float y
Definition AnimClip.cpp:738
float x
Definition AnimClip.cpp:738
float z
Definition AnimClip.cpp:738
#define EVENGINE_API_WORLD
Definition Export.h:109
std::string name
Move-only, checked operation results for the common layer.
EVENGINE_API_FOUNDATION public API.
Definition Module.h:46
Move-only operation result carrying either a value or Status.
Definition Result.h:155
DayNight module — a time-of-day cycle that drives the sun, sky and light.
Definition DayNight.h:94
卡牌游戏 UI 工具模块:工厂 + 脚本绑定入口。 功能参考 ycarowr/UiCard:扇形手牌布局、抽牌/洗牌、悬浮放大、拖拽到落牌区、 敌方手牌(背面/偷看)、费用不足置灰,以及可实时调节的布局...
Definition Animation.h:25
bool enabled
Pcg ambient-gradient colors and global direct-light multiplier.
Definition DayNight.h:61
Joint Pcg Photo Mode fog and density-volume state.
Definition DayNight.h:43
Persistent manual sun settings projected from Pcg Photo Mode.
Definition DayNight.h:21
Persistent Pcg skybox override settings.
Definition DayNight.h:33