载入中...
搜索中...
未找到
Fov.h
浏览该文件的文档.
1#pragma once
2#include "common/Export.h"
3
4
5#include "common/Result.h"
6#include "map/TileLayer.h"
7
8#include <cstdint>
9#include <memory>
10#include <string>
11#include <vector>
12
13namespace eve::graphics {
14class Graphics;
15class Texture;
16} // namespace eve::graphics
17
18namespace eve::map {
19
28public:
30 struct Snapshot {
31 int width = 0;
32 int height = 0;
33 int depth = 1;
34 std::vector<uint8_t> states;
35 };
36 Fov();
37 explicit Fov(TileLayer *layer);
38 explicit Fov(int width, int height);
39 Fov(int width, int height, int depth);
41
42 Fov(Fov &&) noexcept;
43 Fov &operator=(Fov &&) noexcept;
44 Fov(const Fov &) = delete;
45 Fov &operator=(const Fov &) = delete;
46
47 void bindLayer(TileLayer *layer);
48 void setSize(int width, int height);
49 void setVolumeSize(int width, int height, int depth);
50 int getWidth() const;
51 int getHeight() const;
52 int getDepth() const;
53
55 void setMode(const std::string &name);
56 std::string getMode() const;
57
59 void setAlgorithm(const std::string &name);
60 std::string getAlgorithm() const;
61
63 void setRadiusMetric(const std::string &name);
64 std::string getRadiusMetric() const;
65
67 void setTopology(const std::string &name);
68 std::string getTopology() const;
69
70 void setCornerPeek(bool enable);
71 bool getCornerPeek() const;
72
73 void blockOpaqueGid(int gid);
74 void unblockOpaqueGid(int gid);
75 void clearOpaqueGids();
76 void setBlockEmpty(bool enable);
77 bool getBlockEmpty() const;
78 void setOpaque(int x, int y, bool opaque);
79 bool isOpaque(int x, int y) const;
80 void setOpaque3(int x, int y, int z, bool opaque);
81 bool isOpaque3(int x, int y, int z) const;
82 void syncFromLayer();
83
84 void setElevation(int x, int y, float elev);
85 float getElevation(int x, int y) const;
86 void setCliffBlock(float delta);
87 float getCliffBlock() const;
88 void setEyeOffset(float offset);
89 float getEyeOffset() const;
90
91 void setVerticalRange(int range);
92 int getVerticalRange() const;
93
94 int addRevealer(int x, int y, int radius);
95 int addRevealer3(int x, int y, int z, int radius);
96 void removeRevealer(int id);
97 void clearRevealers();
98 void setRevealerPosition(int id, int x, int y);
99 void setRevealerPosition3(int id, int x, int y, int z);
100 void setRevealerRadius(int id, int radius);
101 void setRevealerFacing(int id, float facingDeg, float halfAngleDeg);
102 void clearRevealerFacing(int id);
103 void setRevealerEnabled(int id, bool enabled);
104 int getRevealerCount() const;
105
111 void setRevealerPerception(int id, float perception);
112 float getRevealerPerception(int id) const;
113 void setPerceptionRadiusScale(float scale);
114 float getPerceptionRadiusScale() const;
115 void setDetectionMargin(float margin);
116 float getDetectionMargin() const;
117 int getEffectiveRadius(int id) const;
118 bool canDetect(int revealerId, int x, int y, float targetStealth) const;
119 bool canDetect3(int revealerId, int x, int y, int z, float targetStealth) const;
120
121 void markDirty();
122 bool isDirty() const;
123 void compute();
124 bool isVisible(int x, int y) const;
125 bool isExplored(int x, int y) const;
126 bool isVisible3(int x, int y, int z) const;
127 bool isExplored3(int x, int y, int z) const;
128 std::string getState(int x, int y) const;
129 std::string getState3(int x, int y, int z) const;
130 void clearMemory();
131 void resetVisibleOnly();
133 [[nodiscard]] Snapshot snapshot() const;
135 [[nodiscard]] Result<void> restore(const Snapshot& snapshot);
136
137 float getMaskValue(int x, int y) const;
138 int getMaskByte(int x, int y) const;
139 float getMaskValue3(int x, int y, int z) const;
140 int getMaskByte3(int x, int y, int z) const;
141 bool fillMaskR8(std::vector<uint8_t> &out) const;
142 bool fillMaskR8Slice(std::vector<uint8_t> &out, int sliceZ) const;
143
148 graphics::Texture *buildMaskTexture(graphics::Graphics *gfx) const;
149 graphics::Texture *buildMaskTextureSlice(graphics::Graphics *gfx, int sliceZ) const;
150
151private:
152 struct Impl;
153 std::unique_ptr<Impl> impl_;
154};
155
156} // namespace eve::map
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::uint32_t height
std::uint32_t width
size_t offset
Range range
std::array< float, 3 > scale
std::string name
OnnxCompute * compute
TileLayer * layer
float radius
Move-only, checked operation results for the common layer.
int margin
std::uint32_t depth
Move-only operation result carrying either a value or Status.
Definition Result.h:155
Dynamic field-of-view / fog-of-war facade. Phase A: 2D shadowcast + multi-revealer + explored memory....
Definition Fov.h:27
Fov(Fov &&) noexcept
ECS tile layer entity. Script mutates tile GIDs / tileset / draw; TileRenderSystem batch-draws atlas ...
Definition TileLayer.h:32
卡牌游戏 UI 工具模块:工厂 + 脚本绑定入口。 功能参考 ycarowr/UiCard:扇形手牌布局、抽牌/洗牌、悬浮放大、拖拽到落牌区、 敌方手牌(背面/偷看)、费用不足置灰,以及可实时调节的布局...
Definition Animation.h:25
放置世界:格子占用(多通道)+ 地形语义 + 已放置建筑实例。 行为由 PlacementSystem 提供;本类暴露便于脚本绑定的薄封装方法。 坐标换算统一走 eve::grid(支持 rectang...
bool enabled
Owning visibility-memory snapshot for the current grid/volume dimensions.
Definition Fov.h:30
std::vector< uint8_t > states
Definition Fov.h:34