载入中...
搜索中...
未找到
EffectProfile.h
浏览该文件的文档.
1#pragma once
2#include "common/Export.h"
3
5
6#include <glm/glm.hpp>
7
8namespace eve::gpuagents {
9
12 EffectKind kind = EffectKind::Fish;
13 int maxAgents = 256;
14 float fixedDt = 1.f / 60.f;
15 float agentRadius = 0.25f;
16 float obstaclePredictTime = 0.35f;
17 std::uint32_t seed = 1u;
18};
19
23
24 float separationRadius = 1.5f;
25 float cohesionRadius = 4.0f;
26 float alignmentRadius = 3.0f;
27 float perceptionFovDegrees = 270.f;
28 int maxNeighborSamples = 24;
29
30 float separationWeight = 1.4f;
31 float cohesionWeight = 0.8f;
32 float alignmentWeight = 1.0f;
33 float goalWeight = 0.6f;
34 float dangerWeight = 1.8f;
35 float currentWeight = 1.0f;
36 float depthWeight = 0.5f;
37
38 float maxSpeed = 4.0f;
39 float maxAcceleration = 12.0f;
40 float maxHorizontalTurn = 4.0f;
41 float maxVerticalTurn = 2.5f;
42 float preferredDepth = 0.0f;
43 float depthTolerance = 2.0f;
44};
45
49
50 int fieldResolution = 64;
51 float worldSize = 32.f;
52 glm::vec3 origin{-16.f, 0.f, -16.f};
53
54 float sensorDistance = 1.5f;
55 float sensorAngle = 0.6f;
56 float trailFollow = 1.2f;
57 float nutrient = 0.4f;
58 float repulsion = 0.8f;
59 float danger = 1.5f;
60
61 float depositStrength = 0.35f;
62 float trailDecayRate = 0.15f;
63 float freshnessHalfLife = 4.0f;
64 float diffusionRate = 0.08f;
65 float moveSpeed = 1.8f;
66 float minSurfaceNormalZ = 0.35f;
67};
68
72
73 float separationRadius = 2.0f;
74 float cohesionRadius = 6.0f;
75 float alignmentRadius = 5.0f;
76 float perceptionFovDegrees = 300.f;
77 int maxNeighborSamples = 20;
78
79 float separationWeight = 1.2f;
80 float cohesionWeight = 0.7f;
81 float alignmentWeight = 1.1f;
82 float goalWeight = 0.5f;
83
84 float stallSpeed = 2.5f;
85 float cruiseSpeed = 6.0f;
86 float maxSpeed = 10.0f;
87 float liftCoefficient = 1.4f;
88 float gravityScale = 1.0f;
89 float airDrag = 0.35f;
90
91 float maxClimbSpeed = 3.0f;
92 float maxDescentSpeed = 5.0f;
93 float maxTurnRate = 2.8f;
94 float maxBankAngle = 0.85f;
95
96 float timeToCollision = 0.8f;
97 float groundClearance = 1.5f;
98 float ceilingClearance = 2.0f;
99 float windResponseTime = 0.4f;
100 float gustAcceleration = 2.0f;
101 glm::vec3 uniformWindLocal{0.f, 0.f, 0.f};
102};
103
107
108 float length = 0.12f;
109 float width = 0.06f;
110 float thickness = 0.004f;
111 float mass = 0.002f;
112 float sizeVariation = 0.25f;
113
114 float frontalDrag = 1.8f;
115 float edgeDrag = 0.35f;
116 float liftCoeff = 0.55f;
117 float angularDrag = 0.9f;
118 float pressureCenterOffset = 0.15f;
119
120 float lifetime = 12.f;
121 float settleSpeed = 0.15f;
122 float softBoundPadding = 1.0f;
123 float groundY = 0.0f;
124 float gravity = 9.8f;
125 glm::vec3 worldMin{-20.f, -1.f, -20.f};
126 glm::vec3 worldMax{20.f, 30.f, 20.f};
127};
128
131 EffectKind kind = EffectKind::Fish;
136
138 const EffectProfileBase& base() const {
139 switch (kind) {
140 case EffectKind::LifeNetwork: return life.base;
141 case EffectKind::Bird: return bird.base;
142 case EffectKind::Petal: return petal.base;
143 case EffectKind::Fish:
144 default: return fish.base;
145 }
146 }
147
150 switch (kind) {
151 case EffectKind::LifeNetwork: return life.base;
152 case EffectKind::Bird: return bird.base;
153 case EffectKind::Petal: return petal.base;
154 case EffectKind::Fish:
155 default: return fish.base;
156 }
157 }
158
160 static EffectProfile makeFish(int maxAgents = 256) {
162 p.kind = EffectKind::Fish;
163 p.fish.base.kind = EffectKind::Fish;
164 p.fish.base.maxAgents = maxAgents;
165 return p;
166 }
167
169 static EffectProfile makeLife(int maxAgents = 128, int resolution = 64) {
171 p.kind = EffectKind::LifeNetwork;
172 p.life.base.kind = EffectKind::LifeNetwork;
173 p.life.base.maxAgents = maxAgents;
174 p.life.fieldResolution = resolution;
175 return p;
176 }
177
179 static EffectProfile makeBird(int maxAgents = 256) {
181 p.kind = EffectKind::Bird;
182 p.bird.base.kind = EffectKind::Bird;
183 p.bird.base.maxAgents = maxAgents;
184 return p;
185 }
186
188 static EffectProfile makePetal(int maxAgents = 512) {
190 p.kind = EffectKind::Petal;
191 p.petal.base.kind = EffectKind::Petal;
192 p.petal.base.maxAgents = maxAgents;
193 return p;
194 }
195};
196
197} // namespace eve::gpuagents
float length
Definition CaveMesh.cpp:94
float thickness
Definition CaveMesh.cpp:83
glm::vec4 p[6]
#define EVENGINE_API_DOMAINS
Definition Export.h:110
std::uint32_t width
TokenKind kind
std::weak_ptr< const void > lifetime
std::uint32_t seed
Definition PointSet.cpp:807
V3 origin
Definition RoadBake.cpp:138
double gravity
EffectKind
Effect kind selecting the solver kernel.
Definition AgentState.h:22
Bird flock flight-dynamics parameters.
Shared capacity / timing / collision envelope for every effect.
Type-erased profile bundle owned by an EffectBackend.
EffectProfileBase & base()
Mutable shared base slice for the active kind.
static EffectProfile makePetal(int maxAgents=512)
Factory for a default petal profile.
const EffectProfileBase & base() const
Returns the shared base slice for the active kind.
static EffectProfile makeBird(int maxAgents=256)
Factory for a default bird profile.
static EffectProfile makeFish(int maxAgents=256)
Factory for a default fish profile.
static EffectProfile makeLife(int maxAgents=128, int resolution=64)
Factory for a default life-network profile.
3D Boids fish school parameters.
Life Network 2D surface-trail parameters.
Passive petal rigid-body aerodynamic parameters.