载入中...
搜索中...
未找到
FlowField.h
浏览该文件的文档.
1#pragma once
2#include "common/Export.h"
3
4
5#include <limits>
6#include <vector>
7
8namespace eve::map {
9
16public:
17 static constexpr float kUnreachable = std::numeric_limits<float>::infinity();
18
20 void clear();
22 void resize(int width, int height);
24 int getWidth() const { return width_; }
26 int getHeight() const { return height_; }
27
29 int getGoalX() const { return goalX_; }
31 int getGoalY() const { return goalY_; }
33 void setGoal(int x, int y);
34
36 float costAt(int x, int y) const;
38 void setCost(int x, int y, float cost);
39
41 int nextX(int x, int y) const;
43 int nextY(int x, int y) const;
45 void setNext(int x, int y, int nx, int ny);
46
48 bool isReachable(int x, int y) const;
49
50private:
51 bool inBounds(int x, int y) const;
52 int index(int x, int y) const { return y * width_ + x; }
53
54 int width_ = 0;
55 int height_ = 0;
56 int goalX_ = 0;
57 int goalY_ = 0;
58 std::vector<float> cost_;
59 std::vector<int> nextX_;
60 std::vector<int> nextY_;
61};
62
63} // namespace eve::map
float y
Definition AnimClip.cpp:738
float x
Definition AnimClip.cpp:738
float nx
float ny
eve::resource::CostSpec cost
#define EVENGINE_API_WORLD
Definition Export.h:109
std::uint32_t height
std::uint32_t width
uint32_t index
Integration + direction field for group pathfinding to a single goal. nextX/nextY point to the neighb...
Definition FlowField.h:15
int getGoalX() const
Returns the goal x.
Definition FlowField.h:29
int getWidth() const
Returns the width.
Definition FlowField.h:24
int getGoalY() const
Returns the goal y.
Definition FlowField.h:31
int getHeight() const
Returns the height.
Definition FlowField.h:26
放置世界:格子占用(多通道)+ 地形语义 + 已放置建筑实例。 行为由 PlacementSystem 提供;本类暴露便于脚本绑定的薄封装方法。 坐标换算统一走 eve::grid(支持 rectang...