8#include <unordered_map>
9#include <unordered_set>
46 void update(
float dt);
49 [[nodiscard(
"check the cloth step outcome")]]
57 return SimulationDeterminism::ToleranceBounded;
60 [[nodiscard(
"check cloth observation restore")]]
64 void setGravity(
float gx,
float gy);
71 void setStiffness(
float stiffness);
81 void setDamping(
float damping);
90 void setParticleSize(
float size);
98 void setParticleMass(
float mass);
106 void setSelfCollision(
bool on);
111 void setFoldStiffness(
float k);
120 void setMaxFoldAngle(
float degrees);
125 void setBounds(
float x,
float y,
float w,
float h);
132 void unpin(
int index);
136 bool isPinned(
int index)
const;
142 int grabAt(
float x,
float y,
float radius = 24.f);
144 void moveGrab(
float x,
float y);
154 void applyForce(
float fx,
float fy);
190 void setColor(
float r,
float g,
float b,
float a = 1.f);
210 float getParticleX(
int index)
const;
212 float getParticleY(
int index)
const;
214 void setParticlePosition(
int index,
float x,
float y);
228 float x = 0.f,
y = 0.f;
229 float px = 0.f,
py = 0.f;
238 void updateSubsteps(
float dt,
int substeps);
239 void integrate(
float dt);
240 void solveConstraints();
241 void solveFoldConstraint();
242 void solveSelfCollision();
243 void collideWorld(
float dt);
244 void collideBounds();
246 void buildLinkKeys();
247 bool areLinked(
int a,
int b)
const;
248 bool validIndex(
int index)
const;
249 int64_t cellKey(
int cx,
int cy)
const;
253 float spacing_ = 10.f;
254 float originX_ = 0.f;
255 float originY_ = 0.f;
257 float gravityX_ = 0.f;
258 float gravityY_ = 980.f;
259 float stiffness_ = 0.85f;
260 float damping_ = 0.01f;
262 float particleSize_ = 3.f;
263 float particleMass_ = 0.1f;
264 bool selfCollision_ =
true;
265 float foldStiffness_ = 0.5f;
266 float maxFoldAngle_ = 90.f * 3.14159265f / 180.f;
268 bool hasBounds_ =
false;
269 float boundX_ = 0.f, boundY_ = 0.f, boundW_ = 0.f, boundH_ = 0.f;
272 float grabX_ = 0.f, grabY_ = 0.f;
273 float forceX_ = 0.f, forceY_ = 0.f;
274 float interactX_ = 0.f, interactY_ = 0.f;
275 float interactRadius_ = 0.f;
276 float interactStrength_ = 0.f;
278 World *world_ =
nullptr;
280 float colorR_ = 0.75f, colorG_ = 0.82f, colorB_ = 0.95f, colorA_ = 1.f;
282 bool destroyed_ =
false;
283 SimulationObservation observation_;
285 std::vector<Particle> particles_;
286 std::vector<Link> links_;
287 std::unordered_set<int64_t> linkKeys_;
288 std::unordered_map<int64_t, std::vector<int>> hash_;
#define EVENGINE_API_DOMAINS
Backend-neutral, observable fixed-step contract for physics domains.
TerrainThermalSettings settings
Move-only operation result carrying either a value or Status.
Interactive 2D cloth — Verlet particles + distance constraints. Pixel space (same convention as Box2D...
int getGrabIndex() const
Returns the grab index.
int getCols() const
Returns the cols.
float getOriginX() const
Returns the origin x.
float getColorA() const
Returns the color a.
float getDamping() const
Returns the damping.
SimulationDeterminism determinism() const noexcept override
CPU cloth uses bounded floating-point determinism.
float getOriginY() const
Returns the origin y.
float getParticleSize() const
Returns the particle size.
int getRows() const
Returns the rows.
SimulationBackendKind kind() const noexcept override
Identifies this production CPU cloth backend.
float getColorG() const
Returns the color g.
int getParticleCount() const
Returns the particle count.
float getGravityX() const
Returns the gravity x.
Cloth(const Cloth &)=delete
float getStiffness() const
Returns the stiffness.
bool isGrabbing() const
True when grabbing.
float getFoldStiffness() const
Returns the fold stiffness.
float getMaxFoldAngle() const
Returns the max fold angle.
float getGravityY() const
Returns the gravity y.
SimulationObservation observation() const noexcept override
Returns completed tick/time observables.
int getIterations() const
Returns the iterations.
float getColorB() const
Returns the color b.
float getParticleMass() const
Returns the particle mass.
float getColorR() const
Returns the color r.
Cloth & operator=(const Cloth &)=delete
bool getSelfCollision() const
Returns the self collision.
World * getCollideWorld() const
Returns the attached collision world, or null when detached.
float getSpacing() const
Returns the spacing.
Minimal observable contract for physics simulation providers.
Box2D world wrapper (2D physics) with pixel-space coordinates. Handles stepping, gravity,...
卡牌游戏 UI 工具模块:工厂 + 脚本绑定入口。 功能参考 ycarowr/UiCard:扇形手牌布局、抽牌/洗牌、悬浮放大、拖拽到落牌区、 敌方手牌(背面/偷看)、费用不足置灰,以及可实时调节的布局...
Optional physics backend for vehicle mobility and body attach.
SimulationBackendKind
Kind of implementation that owns a simulation step.
SimulationDeterminism
Determinism guarantee made by a simulation backend.
One deterministic fixed-step emitted by SimulationClock.
Observable backend progress shared by CPU and accelerator providers.
Validated solver policy for one simulation step.