载入中...
搜索中...
未找到
BeerLightCache.h
浏览该文件的文档.
1#pragma once
2#include "common/Export.h"
3
4#include "common/Result.h"
7
8#include <cstdint>
9#include <vector>
10
11#include <glm/vec3.hpp>
12
13namespace eve::graphics::fog {
14
21public:
23 struct LightKey {
24 glm::vec3 direction{0.f, 1.f, 0.f};
25 glm::vec3 color{1.f};
26 float intensity = 1.f;
27 std::uint64_t densityRevision = 0;
28 std::uint64_t version = 0;
29 };
30
31 [[nodiscard]] std::uint64_t version() const noexcept { return key_.version; }
32 [[nodiscard]] bool valid() const noexcept { return valid_; }
33 [[nodiscard]] const LightKey& key() const noexcept { return key_; }
34
39 [[nodiscard]] Result<void> rebuild(const FogDensityField& field, const FogProfile& profile,
40 const glm::vec3& lightDir, const glm::vec3& lightColor,
41 float intensity, int samplesPerCell = 6);
42
44 void invalidate();
45
47 [[nodiscard]] float sampleTransmittance(const FogDensityField& field,
48 const glm::vec3& world) const noexcept;
49
53 [[nodiscard]] bool matches(std::uint64_t densityRevision, const glm::vec3& lightDir,
54 float intensity) const noexcept;
55
56private:
57 LightKey key_{};
58 bool valid_ = false;
59 int width_ = 0;
60 int height_ = 0;
61 int depth_ = 0;
62 std::vector<float> transmittance_;
63};
64
65} // namespace eve::graphics::fog
#define EVENGINE_API_WORLD
Definition Export.h:109
World3D * world
Move-only, checked operation results for the common layer.
RoadLaneDirection direction
Move-only operation result carrying either a value or Status.
Definition Result.h:155
Cached light-path transmittance used by Fast / Enhanced quality tiers.
std::uint64_t version() const noexcept
const LightKey & key() const noexcept
World-space density bands, curl assist velocity, and lighting helpers.
Unit-density optical profile for participating media.
Definition FogProfile.h:16
glm::vec4 lightColor
glm::vec4 lightDir
glm::vec4 color