载入中...
搜索中...
未找到
VegetationField.h
浏览该文件的文档.
1#pragma once
2#include "common/Export.h"
3
4#include <array>
5#include <cstdint>
6#include <glm/vec3.hpp>
7#include <glm/vec4.hpp>
8#include <span>
9#include <vector>
10#include "common/Result.h"
11#include "common/Value.h"
12
13namespace eve::graphics {
14
16enum class VegetationChannel : uint8_t { Color, Extras, Motion, Vertex };
18enum class VegetationBlend : uint8_t { Replace, Add, Multiply, Minimum, Maximum };
20enum class VegetationShape : uint8_t { Ellipsoid, Box };
21
24 uint32_t width = 0, height = 0;
25 std::vector<glm::vec4> pixels;
26};
27
37 glm::vec3 center{0.f}, extents{1.f};
38 float yaw = 0.f, opacity = 1.f, edgeFade = 0.25f;
39 uint16_t layers = 1;
40 int priority = 0;
41 glm::vec4 value{1.f};
42 bool seasonal = false;
43 std::array<glm::vec4, 4> seasons{glm::vec4(1.f), glm::vec4(1.f), glm::vec4(1.f), glm::vec4(1.f)};
45};
46
53 glm::vec4 color{1.f, 1.f, 1.f, 0.f};
54 glm::vec4 extras{1.f, 0.f, 0.f, 1.f};
55 glm::vec4 motion{1.f, 0.f, 0.5f, 0.f};
56 glm::vec4 vertex{0.f, 0.f, 0.f, 1.f};
57 float season = 2.f;
58};
59
62 glm::vec4 color, extras, motion, vertex;
63};
64
67 uint32_t width = 0, height = 0;
68 glm::vec3 center{0.f}, extent{1.f};
69 std::array<std::vector<glm::vec4>, 4> channels;
70};
71
76 uint32_t width = 0, height = 0;
77 glm::vec3 center{0.f}, extent{1.f};
78 std::vector<glm::vec4> pixels;
79};
80
87public:
89 VegetationGlobals globalValues() const { return globals_; }
91 uint64_t revision() const { return revision_; }
95 [[nodiscard]] Result<std::vector<VegetationElement>> snapshotElements() const;
99 [[nodiscard]] Result<void> restore(const Value& document);
101 [[nodiscard]] Result<Value> snapshot() const;
107 [[nodiscard]] Result<void> replace(const VegetationGlobals& globals, std::span<const VegetationElement> elements);
111 [[nodiscard]] Result<VegetationSample> sample(glm::vec3 position, std::array<uint8_t, 4> layers = {}) const;
116 [[nodiscard]] Result<VegetationAtlas> bake(glm::vec3 center, glm::vec3 extent, uint32_t width, uint32_t height,
117 std::array<uint8_t, 4> layers = {}, bool snapToTexel = true) const;
118
119private:
120 VegetationSample evaluate(glm::vec3 position, std::array<uint8_t, 4> layers) const;
121 VegetationGlobals globals_;
122 std::vector<VegetationElement> elements_;
123 uint64_t revision_ = 0;
124};
125} // namespace eve::graphics
#define EVENGINE_API_BACKENDS
Definition Export.h:108
std::uint32_t height
std::uint32_t width
std::array< float, 3 > position
Move-only, checked operation results for the common layer.
std::size_t elements
Owning, renderer-independent dynamic values.
Move-only operation result carrying either a value or Status.
Definition Result.h:155
The canonical owning dynamic value used by data-facing protocols.
Definition Value.h:31
Backend-independent, owning vegetation influence field. Single writer; concurrent const evaluation is...
VegetationGlobals globalValues() const
Return detached global defaults; concurrent reads require no writer. No callbacks.
uint64_t revision() const
Monotonic successful-publication revision for derived render snapshots.
卡牌游戏 UI 工具模块:工厂 + 脚本绑定入口。 功能参考 ycarowr/UiCard:扇形手牌布局、抽牌/洗牌、悬浮放大、拖拽到落牌区、 敌方手牌(背面/偷看)、费用不足置灰,以及可实时调节的布局...
Definition Animation.h:25
VegetationBlend
Ordered field composition operation.
eve::Color Color
RGBA color used by every graphics draw call. Lives inside eve::graphics so including a graphics heade...
Definition Color.h:13
VegetationChannel
Independent vegetation field channels; values use linear color and world units.
VegetationShape
Analytic influence shape in an element's local coordinates.
Four owning arrays in row-major X/Z order at texel centers.
std::array< std::vector< glm::vec4 >, 4 > channels
One owning vegetation channel in row-major X/Z order at texel centers. Channel atlases may use indepe...
Owning element definition; no scene, texture or entity pointers survive admission....
std::array< glm::vec4, 4 > seasons
Owning global defaults. Extras = emission, wetness, overlay, alpha. Motion = signed world X/Z directi...
Owning linear RGBA mask, sampled bilinearly with clamped addressing.
std::vector< glm::vec4 > pixels
Owning sampled field channels; no lifetime dependency on the field.