载入中...
搜索中...
未找到
FogTypes.h
浏览该文件的文档.
1#pragma once
2#include "common/Export.h"
3
4#include <cstdint>
5#include <string_view>
6
7#include <glm/vec3.hpp>
8#include <glm/vec4.hpp>
9
10namespace eve::graphics::fog {
11
13enum class FogQuality : uint8_t {
14 Fast = 0,
15 Enhanced = 1,
17};
18
20[[nodiscard]] inline constexpr std::string_view fogQualityName(FogQuality quality) noexcept {
21 switch (quality) {
22 case FogQuality::Fast: return "fast";
23 case FogQuality::Enhanced: return "enhanced";
24 case FogQuality::PhysicalReference: return "physical_reference";
25 }
26 return "unknown";
27}
28
30[[nodiscard]] inline FogQuality fogQualityFromName(std::string_view name) noexcept {
31 if (name == "fast" || name == "low") return FogQuality::Fast;
32 if (name == "physical_reference" || name == "physical" || name == "high")
35}
36
39 int raySamples = 24;
41 int froxelWidth = 80;
42 int froxelHeight = 45;
43 int froxelDepth = 48;
44 bool beerLightCache = true;
45 bool occupancySkip = true;
46 bool temporalHistory = true;
47 bool spatialReconstruct = false;
48 float historyWeight = 0.75f;
49};
50
52[[nodiscard]] inline FogQualityBudget budgetFor(FogQuality quality) noexcept {
53 FogQualityBudget budget;
54 switch (quality) {
56 budget.raySamples = 12;
57 budget.volLightSegments = 2;
58 budget.froxelWidth = 48;
59 budget.froxelHeight = 27;
60 budget.froxelDepth = 32;
61 budget.beerLightCache = true;
62 budget.occupancySkip = true;
63 budget.temporalHistory = true;
64 budget.spatialReconstruct = false;
65 budget.historyWeight = 0.85f;
66 break;
68 budget.raySamples = 24;
69 budget.volLightSegments = 4;
70 budget.froxelWidth = 80;
71 budget.froxelHeight = 45;
72 budget.froxelDepth = 48;
73 budget.beerLightCache = true;
74 budget.occupancySkip = true;
75 budget.temporalHistory = true;
76 budget.spatialReconstruct = true;
77 budget.historyWeight = 0.75f;
78 break;
80 budget.raySamples = 64;
81 budget.volLightSegments = 8;
82 budget.froxelWidth = 128;
83 budget.froxelHeight = 72;
84 budget.froxelDepth = 64;
85 budget.beerLightCache = false;
86 budget.occupancySkip = false;
87 budget.temporalHistory = false;
88 budget.spatialReconstruct = false;
89 budget.historyWeight = 0.f;
90 break;
91 }
92 return budget;
93}
94
97 glm::vec3 minimum{-8.f, 0.f, -8.f};
98 glm::vec3 maximum{8.f, 6.f, 8.f};
99
101 [[nodiscard]] glm::vec3 size() const noexcept { return maximum - minimum; }
103 [[nodiscard]] glm::vec3 center() const noexcept { return 0.5f * (minimum + maximum); }
105 [[nodiscard]] bool contains(const glm::vec3& p) const noexcept {
106 return p.x >= minimum.x && p.y >= minimum.y && p.z >= minimum.z && p.x <= maximum.x &&
107 p.y <= maximum.y && p.z <= maximum.z;
108 }
109};
110
113 float tEnter = 0.f;
114 float tExit = 0.f;
116 [[nodiscard]] bool valid() const noexcept { return tExit > tEnter; }
118 [[nodiscard]] float length() const noexcept { return tExit - tEnter; }
119};
120
123 glm::vec3 inScatter{0.f};
124 float transmittance = 1.f;
125 float opticalDepth = 0.f;
126 int samplesUsed = 0;
127};
128
131 float maxSpeed = 0.f;
132 float cellSize = 0.f;
133 float dt = 0.f;
134 float cfl = 0.f;
135 bool stable = true;
136};
137
139enum class FogProxyShape : uint8_t { Sphere = 0, Capsule = 1, Obb = 2 };
140
144 glm::vec3 position{0.f};
145 glm::vec3 velocity{0.f};
147 glm::vec3 extents{0.5f};
149 glm::vec3 axis{0.f, 0.5f, 0.f};
151 glm::vec3 axisX{1.f, 0.f, 0.f};
152 glm::vec3 axisY{0.f, 1.f, 0.f};
153 glm::vec3 axisZ{0.f, 0.f, 1.f};
154 float drag = 0.35f;
155 float wakeStrength = 1.f;
156 bool enabled = true;
157};
158
161 glm::vec3 colorTint{1.f};
162 float edgeBoost = 0.f;
163 float silhouetteSoftness = 0.25f;
164 float internalGlow = 0.f;
165 float silverDust = 0.f;
166};
167
170 glm::vec3 color{0.f};
171 float opacity = 0.f;
172 float edgeMask = 0.f;
173 float dustHighlight = 0.f;
174};
175
176} // namespace eve::graphics::fog
glm::vec4 p[6]
std::string name
FogQualityBudget budgetFor(FogQuality quality) noexcept
Resolve the budget for a quality preset.
Definition FogTypes.h:52
FogQuality
Tracking / cache / skip budget for the realtime fog pipeline.
Definition FogTypes.h:13
@ Enhanced
Temporal + spatial reconstruction, Beer cache.
@ PhysicalReference
Dense tracking, no skip shortcuts.
@ Fast
Low sample count, Beer cache, occupancy skip.
FogProxyShape
Solid proxy kinds accepted by the realtime fog interactor.
Definition FogTypes.h:139
FogQuality fogQualityFromName(std::string_view name) noexcept
Parse a quality spelling; unknown values yield Enhanced.
Definition FogTypes.h:30
constexpr std::string_view fogQualityName(FogQuality quality) noexcept
Stable spelling of a quality preset.
Definition FogTypes.h:20
Stylized fog presentation derived from a physical FogRayResult.
Definition FogTypes.h:169
Continuous-art stylization that never mutates density or optics.
Definition FogTypes.h:160
CFL stability snapshot for the MAC fluid solver.
Definition FogTypes.h:130
Resource / sample budget derived from a quality preset.
Definition FogTypes.h:38
Interval along a ray where media is present (t in world units).
Definition FogTypes.h:112
float length() const noexcept
Length.
Definition FogTypes.h:118
bool valid() const noexcept
Valid.
Definition FogTypes.h:116
Optical result of integrating one view ray through fog.
Definition FogTypes.h:122
One analytic solid that carves / wakes the fog domain.
Definition FogTypes.h:142
glm::vec3 extents
Sphere/capsule radius, or half-extents for OBB.
Definition FogTypes.h:147
glm::vec3 axis
Capsule axis endpoint offset from position (half-length along axis).
Definition FogTypes.h:149
glm::vec3 axisX
OBB local axes (columns); identity when unused.
Definition FogTypes.h:151
Axis-aligned world bounds for a fog simulation domain.
Definition FogTypes.h:96
glm::vec3 center() const noexcept
Center.
Definition FogTypes.h:103
bool contains(const glm::vec3 &p) const noexcept
True if active.
Definition FogTypes.h:105
glm::vec3 size() const noexcept
Returns the size of .
Definition FogTypes.h:101