Interactive 3D cloth — Verlet particles + distance constraints. Meter space, +Y up, grid laid out in the XZ plane with the top row pinned. 更多...
#include <Cloth3D.h>
Public 成员函数 | |
| Cloth3D (int cols, int rows, float spacing, float originX, float originY, float originZ) | |
| Cloth 3 d. | |
| Cloth3D (const ClothModel &model) | |
| Create runtime cloth state by copying a reusable ClothModel. | |
| ~Cloth3D () | |
| Cloth 3 d. | |
| Cloth3D (const Cloth3D &)=delete | |
| Cloth3D & | operator= (const Cloth3D &)=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. | |
| std::string | getBackendName () const |
| Return stable backend name for scripts and diagnostics. | |
| bool | supportsFeature (const std::string &feature) const |
| Query a stable cloth feature name without assuming CPU/GPU parity. | |
| eve::Result< void > | restoreObservation (const SimulationObservation &observation) override |
| Restores tick/progress metadata after an owner-level restore. | |
| void | setGravity (float gx, float gy, float gz) |
| Sets the gravity. | |
| float | getGravityX () const |
| Returns the gravity x. | |
| float | getGravityY () const |
| Returns the gravity y. | |
| float | getGravityZ () const |
| Returns the gravity z. | |
| void | setStiffness (float stiffness) |
| Constraint relaxation strength in [0,1] (default 0.85). | |
| float | getStiffness () const |
| Returns the stiffness. | |
| void | setStretchCompliance (float compliance) |
| Set XPBD stretch compliance in m/N; zero preserves legacy PBD. | |
| float | getStretchCompliance () const |
| Return XPBD stretch compliance in m/N. | |
| void | setShearCompliance (float compliance) |
| Set XPBD shear compliance in m/N; zero preserves legacy PBD. | |
| float | getShearCompliance () const |
| Return XPBD shear compliance in m/N. | |
| void | setBendCompliance (float compliance) |
| Set XPBD distance-bend compliance in m/N; zero preserves legacy PBD. | |
| float | getBendCompliance () const |
| Return XPBD distance-bend compliance in m/N. | |
| void | setTetherScale (float scale) |
| Set tether maximum-length scale; zero disables tethers, one uses baked lengths. | |
| float | getTetherScale () const |
| Return the current tether length scale. | |
| void | setTetherCompliance (float compliance) |
| Set XPBD tether compliance in m/N. | |
| float | getTetherCompliance () const |
| Return XPBD tether compliance in m/N. | |
| void | setPressure (float pressure) |
| Set closed-mesh target volume ratio; zero disables volume solving. | |
| float | getPressure () const |
| Return the closed-mesh target volume ratio. | |
| void | setVolumeCompliance (float compliance) |
| Set XPBD closed-volume compliance in m^3/N. | |
| float | getVolumeCompliance () const |
| Return XPBD closed-volume compliance. | |
| float | getCurrentVolume () const |
| Return current signed mesh volume, or zero for an open model. | |
| 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 in meters (default 0.1): self-collision separation, draw scale and rigid-body collision thickness. | |
| float | getParticleSize () const |
| Returns the particle size. | |
| void | setSelfCollision (bool on) |
| Enable proximity-based self-collision between non-adjacent particles and triangles (default true). Triangle-level pass keeps non-adjacent faces at least 2*particleSize apart, so the sheet cannot slip through itself between particles. | |
| bool | getSelfCollision () const |
| Returns the self collision. | |
| 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 | setFoldStiffness (float k) |
| Strength of the dihedral fold clamp [0,1] (default 0.5). | |
| float | getFoldStiffness () const |
| Returns the fold stiffness. | |
| void | setMaxFoldAngle (float degrees) |
| Maximum fold angle between adjacent triangles in degrees Range is 0..180 degrees; default is 120. Zero is fully flat and 180 is folded onto itself; larger values allow stronger draping without creasing. | |
| float | getMaxFoldAngle () const |
| Returns the max fold angle. | |
| void | setBounds (float x, float y, float z, float w, float h, float d) |
| Axis-aligned box (origin + extents, meters); particles bounce inside. | |
| void | clearBounds () |
| Clears bounds. | |
| void | setCollisionMaterial (float friction, float restitution) |
| Configure cloth contact friction and restitution in [0,1]. | |
| float | getCollisionFriction () const |
| Return cloth-side Coulomb friction. | |
| float | getCollisionRestitution () const |
| Return cloth-side restitution. | |
| void | setCollisionFilter (uint64_t categoryBits, uint64_t maskBits) |
| Configure symmetric category/mask filtering for World3D contacts. | |
| uint64_t | getCollisionCategoryBits () const |
| Return cloth collision category bits. | |
| uint64_t | getCollisionMaskBits () const |
| Return cloth collision mask bits. | |
| void | setTearThreshold (float strain) |
| Set automatic structural-edge tear strain; zero disables, values must exceed one. | |
| float | getTearThreshold () const |
| Return the automatic tear strain threshold, or zero when disabled. | |
| void | setMaxTearsPerStep (int count) |
| Limit automatic structural tears per simulation substep. | |
| int | getMaxTearsPerStep () const |
| Return the automatic tear budget per substep. | |
| void | tearConstraint (int particleA, int particleB) |
| Tear an existing structural edge. | |
| int | getTornConstraintCount () const |
| Return the cumulative number of torn structural constraints. | |
| void | pin (int index) |
| void | unpin (int index) |
| Unpin. | |
| void | pinTopRow () |
| Pin top row. | |
| bool | isPinned (int index) const |
| True when pinned. | |
| void | setParticleInverseMass (int index, float inverseMass) |
| Set per-particle inverse mass; zero makes the particle kinematic/pinned. | |
| float | getParticleInverseMass (int index) const |
| Return per-particle inverse mass, or zero for an invalid index. | |
| void | setSkinConstraint (int index, float x, float y, float z, float nx, float ny, float nz, float radius, float backstopDistance=-1.f, float backstopRadius=0.f, float compliance=0.f) |
| Constrain a particle around an animated skin reference and optional backstop sphere. | |
| void | updateSkinReference (int index, float x, float y, float z, float nx, float ny, float nz) |
| Update the animated reference pose of an existing skin constraint. | |
| void | clearSkinConstraint (int index) |
| Remove a particle's skin/backstop constraint. | |
| bool | hasSkinConstraint (int index) const |
| Return whether a particle has a skin/backstop constraint. | |
| void | attachParticle (int index, float x, float y, float z, float compliance=0.f) |
| Attach a particle to a world-space target using an XPBD point constraint. | |
| void | updateAttachment (int index, float x, float y, float z) |
| Move an existing attachment target without recreating it. | |
| void | detachParticle (int index) |
| Detach a particle; its simulated velocity remains continuous. | |
| bool | isAttached (int index) const |
| Return whether a particle currently has an attachment. | |
| int | grabAt (float x, float y, float z, float radius=0.3f) |
| Grab nearest free particle within radius (meters). Returns particle index, or -1 if none. | |
| void | moveGrab (float x, float y, float z) |
| 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, float fz) |
| Applies force. | |
| void | setWindVelocity (float vx, float vy, float vz) |
| Set world-space air velocity used by the aerodynamic model (m/s). | |
| float | getWindVelocityX () const |
| Return configured air velocity along X in m/s. | |
| float | getWindVelocityY () const |
| Return configured air velocity along Y in m/s. | |
| float | getWindVelocityZ () const |
| Return configured air velocity along Z in m/s. | |
| void | setAerodynamics (float airDensity, float dragCoefficient, float liftCoefficient) |
| Configure two-sided triangle aerodynamics. | |
| float | getAirDensity () const |
| Return aerodynamic fluid density in kg/m³. | |
| float | getDragCoefficient () const |
| Return the aerodynamic drag coefficient. | |
| float | getLiftCoefficient () const |
| Return the aerodynamic lift coefficient. | |
| void | interactAt (float x, float y, float z, float radius, float strength) |
| Pointer-field interaction like Fluid2D::interactAt (3D): positive strength attracts, negative repels within radius (meters). | |
| void | setCollideWorld (World3D *world) |
| Attach a World3D so free particles collide with its non-sensor shapes in meter space. Passing null detaches it. Dynamic bodies receive a small push. | |
| World3D * | 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) |
| Draw the cloth as a triangle mesh (requires an open 3D frame). | |
| int | getCols () const |
| Returns the cols. | |
| int | getRows () const |
| Returns the rows. | |
| int | getParticleCount () const |
| Returns the particle count. | |
| int | getTriangleCount () const |
| Return the current render/collision triangle count, reduced by tearing. | |
| int | getDistanceConstraintCount () const |
| Return the current distance-constraint count. | |
| int | getTetherConstraintCount () const |
| Return baked geodesic tether count. | |
| int | getSkinConstraintCount () const |
| Return active skin-constraint count. | |
| int | getAttachmentCount () const |
| Return active attachment count. | |
| float | getParticleX (int index) const |
| float | getParticleY (int index) const |
| Returns the particle y. | |
| float | getParticleZ (int index) const |
| Returns the particle z. | |
| void | setParticlePosition (int index, float x, float y, float z) |
| Sets the particle position. | |
| float | getSpacing () const |
| Returns the spacing. | |
| float | getOriginX () const |
| Returns the origin x. | |
| float | getOriginY () const |
| Returns the origin y. | |
| float | getOriginZ () const |
| Returns the origin z. | |
| void | destroy () |
| Destroys . | |
Public 成员函数 继承自 eve::physics::ISimulationBackend | |
| virtual | ~ISimulationBackend ()=default |
| Releases the backend; borrowed domain state is not destroyed. | |
详细描述
Interactive 3D cloth — Verlet particles + distance constraints. Meter space, +Y up, grid laid out in the XZ plane with the top row pinned.
Supports self-collision (spatial-hash proximity), a dihedral fold-angle limit between adjacent triangles (avoids excessive creasing), and particle-vs-rigid-body collision when attached to a World3D. Script-owned, independent of the Box3D world.
构造及析构函数说明
◆ Cloth3D() [1/3]
| eve::physics::Cloth3D::Cloth3D | ( | int | cols, |
| int | rows, | ||
| float | spacing, | ||
| float | originX, | ||
| float | originY, | ||
| float | originZ | ||
| ) |
Cloth 3 d.
- 参数
-
cols grid columns (>= 2), along +X rows grid rows (>= 2), along +Z spacing particle spacing in meters originX top-left particle X (meters) originY top-left particle Y (meters) originZ top-left particle Z (meters)
在文件 Cloth3D.cpp 第 216 行定义.
引用了 cols, eve::physics::ClothModel::grid(), model, rows , 以及 spacing.
◆ Cloth3D() [2/3]
|
explicit |
Create runtime cloth state by copying a reusable ClothModel.
- 参数
-
model Validated model; the runtime does not retain a reference to it. @ownership Cloth3D owns its copied particle and constraint state. @lifetime The source model only needs to remain alive for this constructor call. @thread Construct and use on the owning physics thread. @reentrancy Invokes no callbacks.
在文件 Cloth3D.cpp 第 224 行定义.
引用了 model.
◆ ~Cloth3D()
| eve::physics::Cloth3D::~Cloth3D | ( | ) |
◆ Cloth3D() [3/3]
|
delete |
成员函数说明
◆ applyForce()
| void eve::physics::Cloth3D::applyForce | ( | float | fx, |
| float | fy, | ||
| float | fz | ||
| ) |
◆ attachParticle()
| void eve::physics::Cloth3D::attachParticle | ( | int | index, |
| float | x, | ||
| float | y, | ||
| float | z, | ||
| float | compliance = 0.f |
||
| ) |
◆ clearBounds()
| void eve::physics::Cloth3D::clearBounds | ( | ) |
◆ clearSkinConstraint()
| void eve::physics::Cloth3D::clearSkinConstraint | ( | int | index | ) |
◆ destroy()
| void eve::physics::Cloth3D::destroy | ( | ) |
◆ detachParticle()
| void eve::physics::Cloth3D::detachParticle | ( | int | index | ) |
Detach a particle; its simulated velocity remains continuous.
在文件 Cloth3DConstraints.cpp 第 121 行定义.
引用了 index.
◆ determinism()
|
inlineoverridevirtualnoexcept |
CPU cloth uses bounded floating-point determinism.
◆ draw()
| void eve::physics::Cloth3D::draw | ( | graphics::Graphics * | gfx | ) |
Draw the cloth as a triangle mesh (requires an open 3D frame).
在文件 Cloth3D.cpp 第 1267 行定义.
引用了 a, b, c, d, eve::graphics::Graphics::drawMesh(), getParticleCount(), indexCount, indices, eve::graphics::Graphics::newMeshFromArrays(), nx, ny, nz, p, pos, r, side, u, eve::graphics::Graphics::updateMeshVertices(), uv, v , 以及 vertexCount.
◆ getAirDensity()
| float eve::physics::Cloth3D::getAirDensity | ( | ) | const |
Return aerodynamic fluid density in kg/m³.
在文件 Cloth3D.cpp 第 439 行定义.
◆ getAttachmentCount()
|
inline |
◆ getBackendName()
|
inline |
◆ getBendCompliance()
| float eve::physics::Cloth3D::getBendCompliance | ( | ) | const |
Return XPBD distance-bend compliance in m/N.
在文件 Cloth3DConstraints.cpp 第 13 行定义.
◆ getCollideWorld()
|
inline |
Returns the attached collision world, or null when detached.
- 返回
- Borrowed nullable World3D pointer owned by the physics registry. @ownership Cloth3D does not own the world and callers must not delete it. @lifetime Valid until the world is destroyed or detached. @thread Call on the owning physics thread. @reentrancy The accessor invokes no callbacks and is invalid across world mutation.
◆ getCollisionCategoryBits()
| uint64_t eve::physics::Cloth3D::getCollisionCategoryBits | ( | ) | const |
Return cloth collision category bits.
在文件 Cloth3DConstraints.cpp 第 20 行定义.
◆ getCollisionFriction()
| float eve::physics::Cloth3D::getCollisionFriction | ( | ) | const |
Return cloth-side Coulomb friction.
在文件 Cloth3DConstraints.cpp 第 18 行定义.
◆ getCollisionMaskBits()
| uint64_t eve::physics::Cloth3D::getCollisionMaskBits | ( | ) | const |
Return cloth collision mask bits.
在文件 Cloth3DConstraints.cpp 第 21 行定义.
◆ getCollisionRestitution()
| float eve::physics::Cloth3D::getCollisionRestitution | ( | ) | const |
Return cloth-side restitution.
在文件 Cloth3DConstraints.cpp 第 19 行定义.
◆ getColorA()
|
inline |
◆ getColorB()
|
inline |
◆ getColorG()
|
inline |
◆ getColorR()
|
inline |
◆ getCols()
◆ getCurrentVolume()
| float eve::physics::Cloth3D::getCurrentVolume | ( | ) | const |
◆ getDamping()
|
inline |
◆ getDistanceConstraintCount()
| int eve::physics::Cloth3D::getDistanceConstraintCount | ( | ) | const |
Return the current distance-constraint count.
在文件 Cloth3DConstraints.cpp 第 23 行定义.
◆ getDragCoefficient()
| float eve::physics::Cloth3D::getDragCoefficient | ( | ) | const |
Return the aerodynamic drag coefficient.
在文件 Cloth3D.cpp 第 441 行定义.
◆ getFoldStiffness()
|
inline |
◆ getGrabIndex()
|
inline |
◆ getGravityX()
|
inline |
◆ getGravityY()
|
inline |
◆ getGravityZ()
|
inline |
◆ getIterations()
|
inline |
◆ getLiftCoefficient()
| float eve::physics::Cloth3D::getLiftCoefficient | ( | ) | const |
Return the aerodynamic lift coefficient.
在文件 Cloth3D.cpp 第 443 行定义.
◆ getMaxFoldAngle()
|
inline |
◆ getMaxTearsPerStep()
| int eve::physics::Cloth3D::getMaxTearsPerStep | ( | ) | const |
Return the automatic tear budget per substep.
在文件 Cloth3DTearing.cpp 第 14 行定义.
◆ getOriginX()
|
inline |
◆ getOriginY()
|
inline |
◆ getOriginZ()
|
inline |
◆ getParticleCount()
|
inline |
◆ getParticleInverseMass()
| float eve::physics::Cloth3D::getParticleInverseMass | ( | int | index | ) | const |
Return per-particle inverse mass, or zero for an invalid index.
在文件 Cloth3D.cpp 第 507 行定义.
引用了 index.
◆ getParticleMass()
|
inline |
◆ getParticleSize()
|
inline |
◆ getParticleX()
| float eve::physics::Cloth3D::getParticleX | ( | int | index | ) | const |
在文件 Cloth3D.cpp 第 569 行定义.
◆ getParticleY()
| float eve::physics::Cloth3D::getParticleY | ( | int | index | ) | const |
◆ getParticleZ()
| float eve::physics::Cloth3D::getParticleZ | ( | int | index | ) | const |
◆ getPressure()
| float eve::physics::Cloth3D::getPressure | ( | ) | const |
Return the closed-mesh target volume ratio.
在文件 Cloth3DConstraints.cpp 第 16 行定义.
◆ getRows()
◆ getSelfCollision()
|
inline |
◆ getShearCompliance()
| float eve::physics::Cloth3D::getShearCompliance | ( | ) | const |
Return XPBD shear compliance in m/N.
在文件 Cloth3DConstraints.cpp 第 12 行定义.
◆ getSkinConstraintCount()
| int eve::physics::Cloth3D::getSkinConstraintCount | ( | ) | const |
Return active skin-constraint count.
在文件 Cloth3DConstraints.cpp 第 25 行定义.
◆ getSpacing()
|
inline |
◆ getStiffness()
|
inline |
◆ getStretchCompliance()
| float eve::physics::Cloth3D::getStretchCompliance | ( | ) | const |
Return XPBD stretch compliance in m/N.
在文件 Cloth3DConstraints.cpp 第 11 行定义.
◆ getTearThreshold()
| float eve::physics::Cloth3D::getTearThreshold | ( | ) | const |
Return the automatic tear strain threshold, or zero when disabled.
在文件 Cloth3DTearing.cpp 第 13 行定义.
◆ getTetherCompliance()
| float eve::physics::Cloth3D::getTetherCompliance | ( | ) | const |
Return XPBD tether compliance in m/N.
在文件 Cloth3DConstraints.cpp 第 15 行定义.
◆ getTetherConstraintCount()
| int eve::physics::Cloth3D::getTetherConstraintCount | ( | ) | const |
Return baked geodesic tether count.
在文件 Cloth3DConstraints.cpp 第 24 行定义.
◆ getTetherScale()
| float eve::physics::Cloth3D::getTetherScale | ( | ) | const |
Return the current tether length scale.
在文件 Cloth3DConstraints.cpp 第 14 行定义.
◆ getTornConstraintCount()
| int eve::physics::Cloth3D::getTornConstraintCount | ( | ) | const |
Return the cumulative number of torn structural constraints.
在文件 Cloth3DTearing.cpp 第 15 行定义.
◆ getTriangleCount()
| int eve::physics::Cloth3D::getTriangleCount | ( | ) | const |
Return the current render/collision triangle count, reduced by tearing.
在文件 Cloth3DConstraints.cpp 第 22 行定义.
◆ getVolumeCompliance()
| float eve::physics::Cloth3D::getVolumeCompliance | ( | ) | const |
Return XPBD closed-volume compliance.
在文件 Cloth3DConstraints.cpp 第 17 行定义.
◆ getWindVelocityX()
| float eve::physics::Cloth3D::getWindVelocityX | ( | ) | const |
Return configured air velocity along X in m/s.
在文件 Cloth3D.cpp 第 427 行定义.
◆ getWindVelocityY()
| float eve::physics::Cloth3D::getWindVelocityY | ( | ) | const |
Return configured air velocity along Y in m/s.
在文件 Cloth3D.cpp 第 429 行定义.
◆ getWindVelocityZ()
| float eve::physics::Cloth3D::getWindVelocityZ | ( | ) | const |
Return configured air velocity along Z in m/s.
在文件 Cloth3D.cpp 第 431 行定义.
◆ grabAt()
| int eve::physics::Cloth3D::grabAt | ( | float | x, |
| float | y, | ||
| float | z, | ||
| float | radius = 0.3f |
||
| ) |
Grab nearest free particle within radius (meters). Returns particle index, or -1 if none.
在文件 Cloth3D.cpp 第 511 行定义.
引用了 best, dx, dy, dz, getParticleCount(), moveGrab(), p, radius, x, y , 以及 z.
◆ hasSkinConstraint()
| bool eve::physics::Cloth3D::hasSkinConstraint | ( | int | index | ) | const |
Return whether a particle has a skin/backstop constraint.
在文件 Cloth3DConstraints.cpp 第 96 行定义.
引用了 index.
◆ interactAt()
| void eve::physics::Cloth3D::interactAt | ( | float | x, |
| float | y, | ||
| float | z, | ||
| float | radius, | ||
| float | strength | ||
| ) |
Pointer-field interaction like Fluid2D::interactAt (3D): positive strength attracts, negative repels within radius (meters).
在文件 Cloth3D.cpp 第 552 行定义.
◆ isAttached()
| bool eve::physics::Cloth3D::isAttached | ( | int | index | ) | const |
Return whether a particle currently has an attachment.
在文件 Cloth3DConstraints.cpp 第 125 行定义.
引用了 index.
◆ isGrabbing()
|
inline |
◆ isPinned()
| bool eve::physics::Cloth3D::isPinned | ( | int | index | ) | const |
◆ kind()
|
inlineoverridevirtualnoexcept |
Identifies this production CPU cloth backend.
◆ moveGrab()
| void eve::physics::Cloth3D::moveGrab | ( | float | x, |
| float | y, | ||
| float | z | ||
| ) |
◆ observation()
|
inlineoverridevirtualnoexcept |
Returns completed tick/time observables.
实现了 eve::physics::ISimulationBackend.
被这些函数引用 restoreObservation().
◆ operator=()
◆ pin()
| void eve::physics::Cloth3D::pin | ( | int | index | ) |
◆ pinTopRow()
| void eve::physics::Cloth3D::pinTopRow | ( | ) |
◆ releaseGrab()
| void eve::physics::Cloth3D::releaseGrab | ( | ) |
Release grab.
在文件 Cloth3D.cpp 第 544 行定义.
◆ reset()
| void eve::physics::Cloth3D::reset | ( | ) |
Restore the flat grid pose (top row pinned) and clear transient state.
在文件 Cloth3D.cpp 第 230 行定义.
◆ restoreObservation()
|
overridevirtual |
Restores tick/progress metadata after an owner-level restore.
重载 eve::physics::ISimulationBackend .
在文件 Cloth3D.cpp 第 1256 行定义.
引用了 eve::Applied, eve::Diagnostic::error(), eve::Result< T >::failure(), observation(), eve::PreconditionViolation, eve::Status::success(), eve::Result< T >::success() , 以及 valid.
◆ setAerodynamics()
| void eve::physics::Cloth3D::setAerodynamics | ( | float | airDensity, |
| float | dragCoefficient, | ||
| float | liftCoefficient | ||
| ) |
Configure two-sided triangle aerodynamics.
Forces use each deformed triangle's current area and normal, relative air velocity, and the configured particle mass. Setting both coefficients to zero disables aerodynamics without changing the wind velocity.
- 参数
-
airDensity Non-negative fluid density in kg/m³ (air is about 1.225). dragCoefficient Non-negative pressure-drag coefficient. liftCoefficient Non-negative lift coefficient. @thread Call on the owning physics thread between simulation steps. @reentrancy Invokes no callbacks.
在文件 Cloth3D.cpp 第 433 行定义.
◆ setBendCompliance()
| void eve::physics::Cloth3D::setBendCompliance | ( | float | compliance | ) |
Set XPBD distance-bend compliance in m/N; zero preserves legacy PBD.
在文件 Cloth3D.cpp 第 365 行定义.
◆ setBounds()
| void eve::physics::Cloth3D::setBounds | ( | float | x, |
| float | y, | ||
| float | z, | ||
| float | w, | ||
| float | h, | ||
| float | d | ||
| ) |
Axis-aligned box (origin + extents, meters); particles bounce inside.
在文件 Cloth3D.cpp 第 451 行定义.
◆ setCollideWorld()
| void eve::physics::Cloth3D::setCollideWorld | ( | World3D * | world | ) |
Attach a World3D so free particles collide with its non-sensor shapes in meter space. Passing null detaches it. Dynamic bodies receive a small push.
Attach a borrowed 3D world for collision queries; null detaches it. @ownership Cloth3D never owns the World3D pointer; the physics registry owns it. @lifetime The association is valid only while the world remains alive; clear it before world destruction. @thread Call on the owning physics thread. @reentrancy Does not invoke callbacks; do not destroy the world re-entrantly.
在文件 Cloth3D.cpp 第 560 行定义.
引用了 world.
◆ setCollisionFilter()
| void eve::physics::Cloth3D::setCollisionFilter | ( | uint64_t | categoryBits, |
| uint64_t | maskBits | ||
| ) |
Configure symmetric category/mask filtering for World3D contacts.
在文件 Cloth3D.cpp 第 472 行定义.
◆ setCollisionMaterial()
| void eve::physics::Cloth3D::setCollisionMaterial | ( | float | friction, |
| float | restitution | ||
| ) |
Configure cloth contact friction and restitution in [0,1].
在文件 Cloth3D.cpp 第 467 行定义.
引用了 restitution.
◆ setColor()
| void eve::physics::Cloth3D::setColor | ( | float | r, |
| float | g, | ||
| float | b, | ||
| float | a = 1.f |
||
| ) |
◆ setDamping()
| void eve::physics::Cloth3D::setDamping | ( | float | damping | ) |
Damping applied to Verlet velocity [0,1] (default 0.01).
在文件 Cloth3D.cpp 第 371 行定义.
◆ setFoldStiffness()
| void eve::physics::Cloth3D::setFoldStiffness | ( | float | k | ) |
Strength of the dihedral fold clamp [0,1] (default 0.5).
在文件 Cloth3D.cpp 第 447 行定义.
◆ setGravity()
| void eve::physics::Cloth3D::setGravity | ( | float | gx, |
| float | gy, | ||
| float | gz | ||
| ) |
Sets the gravity.
在文件 Cloth3D.cpp 第 349 行定义.
◆ setIterations()
| void eve::physics::Cloth3D::setIterations | ( | int | iterations | ) |
◆ setMaxFoldAngle()
| void eve::physics::Cloth3D::setMaxFoldAngle | ( | float | degrees | ) |
Maximum fold angle between adjacent triangles in degrees Range is 0..180 degrees; default is 120. Zero is fully flat and 180 is folded onto itself; larger values allow stronger draping without creasing.
在文件 Cloth3D.cpp 第 449 行定义.
引用了 degrees.
◆ setMaxTearsPerStep()
| void eve::physics::Cloth3D::setMaxTearsPerStep | ( | int | count | ) |
Limit automatic structural tears per simulation substep.
在文件 Cloth3DTearing.cpp 第 21 行定义.
引用了 count.
◆ setParticleInverseMass()
| void eve::physics::Cloth3D::setParticleInverseMass | ( | int | index, |
| float | inverseMass | ||
| ) |
Set per-particle inverse mass; zero makes the particle kinematic/pinned.
在文件 Cloth3D.cpp 第 500 行定义.
引用了 index.
◆ setParticleMass()
| void eve::physics::Cloth3D::setParticleMass | ( | float | mass | ) |
Implicit particle mass in kg (default 0.1). Used for mass-proportional momentum exchange when colliding with dynamic rigid bodies.
在文件 Cloth3D.cpp 第 375 行定义.
◆ setParticlePosition()
| void eve::physics::Cloth3D::setParticlePosition | ( | int | index, |
| float | x, | ||
| float | y, | ||
| float | z | ||
| ) |
◆ setParticleSize()
| void eve::physics::Cloth3D::setParticleSize | ( | float | size | ) |
Particle radius in meters (default 0.1): self-collision separation, draw scale and rigid-body collision thickness.
在文件 Cloth3D.cpp 第 373 行定义.
引用了 size.
◆ setPressure()
| void eve::physics::Cloth3D::setPressure | ( | float | pressure | ) |
Set closed-mesh target volume ratio; zero disables volume solving.
在文件 Cloth3DConstraints.cpp 第 136 行定义.
◆ setSelfCollision()
| void eve::physics::Cloth3D::setSelfCollision | ( | bool | on | ) |
Enable proximity-based self-collision between non-adjacent particles and triangles (default true). Triangle-level pass keeps non-adjacent faces at least 2*particleSize apart, so the sheet cannot slip through itself between particles.
在文件 Cloth3D.cpp 第 445 行定义.
◆ setShearCompliance()
| void eve::physics::Cloth3D::setShearCompliance | ( | float | compliance | ) |
Set XPBD shear compliance in m/N; zero preserves legacy PBD.
在文件 Cloth3D.cpp 第 361 行定义.
◆ setSkinConstraint()
◆ setStiffness()
| void eve::physics::Cloth3D::setStiffness | ( | float | stiffness | ) |
Constraint relaxation strength in [0,1] (default 0.85).
在文件 Cloth3D.cpp 第 355 行定义.
◆ setStretchCompliance()
| void eve::physics::Cloth3D::setStretchCompliance | ( | float | compliance | ) |
Set XPBD stretch compliance in m/N; zero preserves legacy PBD.
在文件 Cloth3D.cpp 第 357 行定义.
◆ setTearThreshold()
| void eve::physics::Cloth3D::setTearThreshold | ( | float | strain | ) |
Set automatic structural-edge tear strain; zero disables, values must exceed one.
在文件 Cloth3DTearing.cpp 第 17 行定义.
◆ setTetherCompliance()
| void eve::physics::Cloth3D::setTetherCompliance | ( | float | compliance | ) |
Set XPBD tether compliance in m/N.
在文件 Cloth3DConstraints.cpp 第 132 行定义.
◆ setTetherScale()
| void eve::physics::Cloth3D::setTetherScale | ( | float | scale | ) |
Set tether maximum-length scale; zero disables tethers, one uses baked lengths.
在文件 Cloth3DConstraints.cpp 第 130 行定义.
引用了 scale.
◆ setVolumeCompliance()
| void eve::physics::Cloth3D::setVolumeCompliance | ( | float | compliance | ) |
Set XPBD closed-volume compliance in m^3/N.
在文件 Cloth3DConstraints.cpp 第 138 行定义.
◆ setWindVelocity()
| void eve::physics::Cloth3D::setWindVelocity | ( | float | vx, |
| float | vy, | ||
| float | vz | ||
| ) |
Set world-space air velocity used by the aerodynamic model (m/s).
- 参数
-
vx Air velocity along X. vy Air velocity along Y. vz Air velocity along Z. @thread Call on the owning physics thread between simulation steps. @reentrancy Invokes no callbacks.
在文件 Cloth3D.cpp 第 421 行定义.
◆ step()
|
overridevirtual |
Advances cloth with the shared ticked backend contract.
实现了 eve::physics::ISimulationBackend.
在文件 Cloth3D.cpp 第 1235 行定义.
引用了 eve::Applied, eve::SimulationStep::delta, error, eve::Diagnostic::error(), eve::Failed, eve::Result< T >::failure(), eve::PreconditionViolation, eve::Duration::seconds(), settings, eve::Status::success(), eve::Result< T >::success() , 以及 valid.
◆ supportsFeature()
| bool eve::physics::Cloth3D::supportsFeature | ( | const std::string & | feature | ) | const |
Query a stable cloth feature name without assuming CPU/GPU parity.
在文件 Cloth3DConstraints.cpp 第 44 行定义.
◆ tearConstraint()
| void eve::physics::Cloth3D::tearConstraint | ( | int | particleA, |
| int | particleB | ||
| ) |
Tear an existing structural edge.
- 异常
-
eve::Exception if the edge cannot tear.
在文件 Cloth3DTearing.cpp 第 23 行定义.
引用了 found.
◆ unpin()
| void eve::physics::Cloth3D::unpin | ( | int | index | ) |
◆ update()
| void eve::physics::Cloth3D::update | ( | float | dt | ) |
Updates .
在文件 Cloth3D.cpp 第 1201 行定义.
◆ updateAttachment()
| void eve::physics::Cloth3D::updateAttachment | ( | int | index, |
| float | x, | ||
| float | y, | ||
| float | z | ||
| ) |
◆ updateSkinReference()
| void eve::physics::Cloth3D::updateSkinReference | ( | int | index, |
| float | x, | ||
| float | y, | ||
| float | z, | ||
| float | nx, | ||
| float | ny, | ||
| float | nz | ||
| ) |
该类的文档由以下文件生成:
- src/modules/physics/cloth/Cloth3D.h
- src/modules/physics/cloth/Cloth3D.cpp
- src/modules/physics/cloth/Cloth3DConstraints.cpp
- src/modules/physics/cloth/Cloth3DTearing.cpp
Public 成员函数 继承自