载入中...
搜索中...
未找到
GpuAgentWorld.h
浏览该文件的文档.
1#pragma once
2#include "common/Export.h"
3
4#include "common/Result.h"
9
10#include <string>
11#include <unordered_map>
12#include <vector>
13
14namespace eve::gpuagents {
15
28public:
30 GpuAgentWorld() = default;
31
33 ObstacleField& obstacles() { return obstacles_; }
35 const ObstacleField& obstacles() const { return obstacles_; }
36
38 SurfaceField& surface() { return surface_; }
40 const SurfaceField& surface() const { return surface_; }
41
43 void setWaterCurrent(float x, float y, float z) { waterCurrent_ = {x, y, z}; }
45 void setWind(float x, float y, float z) { wind_ = {x, y, z}; }
47 void setVerticalBounds(float groundY, float ceilingY) {
48 groundY_ = groundY;
49 ceilingY_ = ceilingY;
50 }
51
53 void setGoals(std::vector<EnvironmentMarker> goals) { goals_ = std::move(goals); }
55 void setDangers(std::vector<EnvironmentMarker> dangers) { dangers_ = std::move(dangers); }
57 void setNutrients(std::vector<EnvironmentMarker> nutrients) { nutrients_ = std::move(nutrients); }
58
66 [[nodiscard("check backend register")]] Result<void> registerBackend(std::string name, EffectBackend* backend);
67
72 [[nodiscard("check backend unregister")]] Result<void> unregisterBackend(const std::string& name);
73
80 [[nodiscard("check find result before use")]] EffectBackend* find(const std::string& name) const;
81
83 int backendCount() const { return static_cast<int>(backends_.size()); }
84
91 EnvironmentSnapshot makeSnapshot(bool includeSurface) const;
92
97 [[nodiscard("check world step")]] Result<void> stepAll(float dt);
98
99private:
100 ObstacleField obstacles_;
101 SurfaceField surface_;
102 glm::vec3 waterCurrent_{0.f};
103 glm::vec3 wind_{0.f};
104 float groundY_ = 0.f;
105 float ceilingY_ = 40.f;
106 std::vector<EnvironmentMarker> goals_;
107 std::vector<EnvironmentMarker> dangers_;
108 std::vector<EnvironmentMarker> nutrients_;
109 std::unordered_map<std::string, EffectBackend*> backends_;
110};
111
112} // namespace eve::gpuagents
float y
Definition AnimClip.cpp:738
float x
Definition AnimClip.cpp:738
float z
Definition AnimClip.cpp:738
#define EVENGINE_API_DOMAINS
Definition Export.h:110
std::string name
Move-only, checked operation results for the common layer.
Move-only operation result carrying either a value or Status.
Definition Result.h:155
Binds an EffectProfile to a GpuAgentSimulation and optional renderer.
World-level registry for GPU agent simulations and environment semantics.
GpuAgentWorld()=default
Gpu agent world.
const ObstacleField & obstacles() const
Const obstacle field.
void setDangers(std::vector< EnvironmentMarker > dangers)
Replace danger markers.
void setGoals(std::vector< EnvironmentMarker > goals)
Replace goal markers.
const SurfaceField & surface() const
Const surface field.
int backendCount() const
Number of registered backends.
SurfaceField & surface()
Shared surface field for Life Network effects.
void setWaterCurrent(float x, float y, float z)
Set uniform water current.
void setWind(float x, float y, float z)
Set uniform wind.
void setNutrients(std::vector< EnvironmentMarker > nutrients)
Replace nutrient markers.
void setVerticalBounds(float groundY, float ceilingY)
Set ground / ceiling heights for bird clearance.
ObstacleField & obstacles()
Access the shared obstacle field (mutable for baking).
Unified static + dynamic obstacle distance field.
2.5D surface + life-field textures for Life Network.
Read-only environment semantics prepared by GpuAgentWorld each tick.