Interactive 2D cloth — Verlet particles + distance constraints. Pixel space (same convention as Box2D World). Script-owned.
更多...
|
| | Cloth (int cols, int rows, float spacing, float originX, float originY) |
| | Cloth.
|
| |
| | ~Cloth () |
| | Cloth.
|
| |
| | Cloth (const Cloth &)=delete |
| |
| Cloth & | operator= (const Cloth &)=delete |
| |
| void | update (float dt) |
| | Updates .
|
| |
| eve::Result< void > | step (const eve::SimulationStep &step, const SimulationSettings &settings) override |
| | Advances cloth with the shared ticked backend contract.
|
| |
| SimulationObservation | observation () const noexcept override |
| | Returns completed tick/time observables.
|
| |
| SimulationBackendKind | kind () const noexcept override |
| | Identifies this production CPU cloth backend.
|
| |
| SimulationDeterminism | determinism () const noexcept override |
| | CPU cloth uses bounded floating-point determinism.
|
| |
| eve::Result< void > | restoreObservation (const SimulationObservation &observation) override |
| | Restores tick/progress metadata after an owner-level restore.
|
| |
| void | setGravity (float gx, float gy) |
| | Sets the gravity.
|
| |
| float | getGravityX () const |
| | Returns the gravity x.
|
| |
| float | getGravityY () const |
| | Returns the gravity y.
|
| |
| void | setStiffness (float stiffness) |
| | Constraint relaxation strength in [0,1] (default 0.85).
|
| |
| float | getStiffness () const |
| | Returns the stiffness.
|
| |
| void | setIterations (int iterations) |
| | Constraint solver iterations per substep (default 4).
|
| |
| int | getIterations () const |
| | Returns the iterations.
|
| |
| void | setDamping (float damping) |
| | Damping applied to Verlet velocity [0,1] (default 0.01).
|
| |
| float | getDamping () const |
| | Returns the damping.
|
| |
| void | setParticleSize (float size) |
| | Particle radius used for self-collision, draw size and body collision Default is 3. Two particles keep at least twice this size apart when self-collision is on.
|
| |
| float | getParticleSize () const |
| | Returns the particle size.
|
| |
| void | setParticleMass (float mass) |
| | Implicit particle mass in kg (default 0.1). Used for mass-proportional momentum exchange when colliding with dynamic rigid bodies.
|
| |
| float | getParticleMass () const |
| | Returns the particle mass.
|
| |
| void | setSelfCollision (bool on) |
| | Enable proximity-based self-collision between non-adjacent particles Default is true.
|
| |
| bool | getSelfCollision () const |
| | Returns the self collision.
|
| |
| void | setFoldStiffness (float k) |
| | Strength of the fold-angle clamp [0,1] (default 0.5).
|
| |
| float | getFoldStiffness () const |
| | Returns the fold stiffness.
|
| |
| void | setMaxFoldAngle (float degrees) |
| | Maximum bend deviation from a straight row/column segment in degrees Range is 0..180 degrees; default is 90. Prevents sharp creases and excessive folding.
|
| |
| float | getMaxFoldAngle () const |
| | Returns the max fold angle.
|
| |
| void | setBounds (float x, float y, float w, float h) |
| | Axis-aligned walls; particles bounce inside. Disabled if w/h <= 0.
|
| |
| void | clearBounds () |
| | Clears bounds.
|
| |
| void | pin (int index) |
| | Pin.
|
| |
| void | unpin (int index) |
| | Unpin.
|
| |
| void | pinTopRow () |
| | Pin top row.
|
| |
| bool | isPinned (int index) const |
| | True when pinned.
|
| |
| int | grabAt (float x, float y, float radius=24.f) |
| | Grab nearest free particle within radius (pixels). Returns particle index, or -1 if none.
|
| |
| void | moveGrab (float x, float y) |
| | Moves grab.
|
| |
| void | releaseGrab () |
| | Release grab.
|
| |
| bool | isGrabbing () const |
| | True when grabbing.
|
| |
| int | getGrabIndex () const |
| | Returns the grab index.
|
| |
| void | applyForce (float fx, float fy) |
| | Applies force.
|
| |
| void | interactAt (float x, float y, float radius, float strength) |
| | Pointer-field interaction like Fluid2D::interactAt: positive strength attracts, negative repels. Applied as acceleration within radius (pixels) during the next update.
|
| |
| void | setCollideWorld (World *world) |
| | Attach a 2D World so free particles collide with its non-sensor fixtures in pixel space. Passing null detaches it. Dynamic bodies receive a small push.
|
| |
| World * | getCollideWorld () const |
| | Returns the attached collision world, or null when detached.
|
| |
| void | reset () |
| | Restore the flat grid pose (top row pinned) and clear transient state.
|
| |
| void | setColor (float r, float g, float b, float a=1.f) |
| | Sets the color.
|
| |
| float | getColorR () const |
| | Returns the color r.
|
| |
| float | getColorG () const |
| | Returns the color g.
|
| |
| float | getColorB () const |
| | Returns the color b.
|
| |
| float | getColorA () const |
| | Returns the color a.
|
| |
| void | draw (graphics::Graphics *gfx) |
| | Draws .
|
| |
| int | getCols () const |
| | Returns the cols.
|
| |
| int | getRows () const |
| | Returns the rows.
|
| |
| int | getParticleCount () const |
| | Returns the particle count.
|
| |
| float | getParticleX (int index) const |
| | Returns the particle x.
|
| |
| float | getParticleY (int index) const |
| | Returns the particle y.
|
| |
| void | setParticlePosition (int index, float x, float y) |
| | Sets the particle position.
|
| |
| float | getSpacing () const |
| | Returns the spacing.
|
| |
| float | getOriginX () const |
| | Returns the origin x.
|
| |
| float | getOriginY () const |
| | Returns the origin y.
|
| |
| void | destroy () |
| | Destroys .
|
| |
| virtual | ~ISimulationBackend ()=default |
| | Releases the backend; borrowed domain state is not destroyed.
|
| |
Interactive 2D cloth — Verlet particles + distance constraints. Pixel space (same convention as Box2D World). Script-owned.
Supports optional self-collision (spatial-hash proximity), a fold-angle limit that prevents sharp creases, and particle-vs-rigid-body collision when attached to a 2D World via setCollideWorld.
在文件 Cloth.h 第 28 行定义.