Vulkan-resident multi-sheet 3D XPBD cloth with explicit backend errors. @ownership Owns buffers, compute shader and sequence. Graphics owns the draw mesh. @lifetime Borrowed Gpgpu and Graphics/device must outlive this object, including destruction. Destroy only after the last draw frame is presented, never inside an open pass. @thread Render/submission thread only. Call update before render-pass recording. @reentrancy No callbacks; update/draw/diagnostics must not overlap. Grid topology only; tolerance-bounded swept point-face/edge-edge contacts, no rigid-body coupling. GPU floating-point/contact-list ordering is tolerance-bounded, not bit-exact. 更多...
#include <LayeredClothGPU.h>
类 | |
| struct | Impl |
Public 成员函数 | |
| LayeredClothGPU (gpgpu::Gpgpu &compute, graphics::Graphics &graphics, int layers, int cols, int rows, float spacing, float gap, float x, float y, float z) | |
| Allocate grids, bake adjacency and compile compute; throws on invalid input or unavailable backend. | |
| ~LayeredClothGPU () | |
| Wait for resident draw retirement and release compute resources; never throws. | |
| LayeredClothGPU (const LayeredClothGPU &)=delete | |
| LayeredClothGPU & | operator= (const LayeredClothGPU &)=delete |
| Result< void > | update (float dt) |
| Execute finite dt in [1e-6,0.05] on GPU; zero is a no-op. Input failure leaves state unchanged. | |
| Result< void > | draw () |
| Record direct resident-buffer drawing inside an open 3D pass; no host vertex transfer. | |
| void | reset () |
| Restore initial pinned pose and material/particle overrides; synchronously uploads once. @cost Linear topology/state upload; intended for user reset, not per-frame use. | |
| void | setSolver (int substeps, int iterations) |
| Set substeps [1,16], iterations [1,64]; throws before mutation on invalid budget. | |
| void | setGravity (float x, float y, float z) |
| Set finite world gravity; throws on invalid input. | |
| void | setWind (float x, float y, float z) |
| Set finite uniform wind acceleration; not triangle aerodynamics. | |
| void | setInterCollision (bool enabled) |
| Enable inter-layer point-face and edge-edge contact, independently of self contact. | |
| void | setSelfCollision (bool enabled) |
| Enable nonlocal point-face and edge-edge contact within each sheet. | |
| void | setContact (float thickness, float friction) |
| Set separation >0, friction [0,1]; throws on nonfinite/out-of-range input. | |
| void | setFloor (float y) |
| Set finite floor height, default -3 metres. | |
| void | setParticleInverseMass (int index, float inverseMass) |
| Change one particle's inverse mass, effective on the next update; zero pins. @cost One tiny upload plus synchronization; use for authoring/interaction, not a particle loop per frame. | |
| int | getParticleCount () const |
| Return total simulation particles (render stream duplicates each for two sides). | |
| std::vector< float > | readPositions () |
| Explicit diagnostic readback, XYZW per particle; W is inverse mass. @cost Full state download plus GPU wait. Never called by update or draw. | |
| std::array< unsigned, 4 > | readDiagnostics () |
| Explicit readback: hash references attempted, last overflow flag, contact projections, overflow events. @cost One tiny download plus GPU wait; inspect only on demand. | |
详细描述
Vulkan-resident multi-sheet 3D XPBD cloth with explicit backend errors. @ownership Owns buffers, compute shader and sequence. Graphics owns the draw mesh. @lifetime Borrowed Gpgpu and Graphics/device must outlive this object, including destruction. Destroy only after the last draw frame is presented, never inside an open pass. @thread Render/submission thread only. Call update before render-pass recording. @reentrancy No callbacks; update/draw/diagnostics must not overlap. Grid topology only; tolerance-bounded swept point-face/edge-edge contacts, no rigid-body coupling. GPU floating-point/contact-list ordering is tolerance-bounded, not bit-exact.
在文件 LayeredClothGPU.h 第 23 行定义.
构造及析构函数说明
◆ LayeredClothGPU() [1/2]
| eve::physics::LayeredClothGPU::LayeredClothGPU | ( | gpgpu::Gpgpu & | compute, |
| graphics::Graphics & | graphics, | ||
| int | layers, | ||
| int | cols, | ||
| int | rows, | ||
| float | spacing, | ||
| float | gap, | ||
| float | x, | ||
| float | y, | ||
| float | z | ||
| ) |
Allocate grids, bake adjacency and compile compute; throws on invalid input or unavailable backend.
- 参数
-
compute Borrowed active Vulkan compute provider, call-only reference becomes lifetime dependency. graphics Borrowed same-device rendering owner, must remain alive until this object is destroyed. @cost One-time shader compilation, topology upload and GPU allocation, amortized across all steps.
在文件 LayeredClothGPU.cpp 第 71 行定义.
引用了 bytes, c, cols, compute, edge, gap, graphics, indices, p, positions, r, reset(), rows, size, spacing, v, eve::Vulkan, x, y , 以及 z.
◆ ~LayeredClothGPU()
|
default |
Wait for resident draw retirement and release compute resources; never throws.
◆ LayeredClothGPU() [2/2]
|
delete |
成员函数说明
◆ draw()
| Result< void > eve::physics::LayeredClothGPU::draw | ( | ) |
Record direct resident-buffer drawing inside an open 3D pass; no host vertex transfer.
在文件 LayeredClothGPU.cpp 第 207 行定义.
引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), p, eve::PreconditionViolation , 以及 view.
◆ getParticleCount()
| int eve::physics::LayeredClothGPU::getParticleCount | ( | ) | const |
Return total simulation particles (render stream duplicates each for two sides).
在文件 LayeredClothGPU.cpp 第 257 行定义.
◆ operator=()
|
delete |
◆ readDiagnostics()
| std::array< unsigned, 4 > eve::physics::LayeredClothGPU::readDiagnostics | ( | ) |
Explicit readback: hash references attempted, last overflow flag, contact projections, overflow events. @cost One tiny download plus GPU wait; inspect only on demand.
在文件 LayeredClothGPU.cpp 第 270 行定义.
◆ readPositions()
| std::vector< float > eve::physics::LayeredClothGPU::readPositions | ( | ) |
Explicit diagnostic readback, XYZW per particle; W is inverse mass. @cost Full state download plus GPU wait. Never called by update or draw.
在文件 LayeredClothGPU.cpp 第 258 行定义.
◆ reset()
| void eve::physics::LayeredClothGPU::reset | ( | ) |
Restore initial pinned pose and material/particle overrides; synchronously uploads once. @cost Linear topology/state upload; intended for user reset, not per-frame use.
在文件 LayeredClothGPU.cpp 第 153 行定义.
被这些函数引用 LayeredClothGPU().
◆ setContact()
| void eve::physics::LayeredClothGPU::setContact | ( | float | thickness, |
| float | friction | ||
| ) |
Set separation >0, friction [0,1]; throws on nonfinite/out-of-range input.
在文件 LayeredClothGPU.cpp 第 237 行定义.
◆ setFloor()
| void eve::physics::LayeredClothGPU::setFloor | ( | float | y | ) |
◆ setGravity()
| void eve::physics::LayeredClothGPU::setGravity | ( | float | x, |
| float | y, | ||
| float | z | ||
| ) |
Set finite world gravity; throws on invalid input.
在文件 LayeredClothGPU.cpp 第 223 行定义.
◆ setInterCollision()
| void eve::physics::LayeredClothGPU::setInterCollision | ( | bool | enabled | ) |
Enable inter-layer point-face and edge-edge contact, independently of self contact.
在文件 LayeredClothGPU.cpp 第 235 行定义.
◆ setParticleInverseMass()
| void eve::physics::LayeredClothGPU::setParticleInverseMass | ( | int | index, |
| float | inverseMass | ||
| ) |
Change one particle's inverse mass, effective on the next update; zero pins. @cost One tiny upload plus synchronization; use for authoring/interaction, not a particle loop per frame.
在文件 LayeredClothGPU.cpp 第 247 行定义.
◆ setSelfCollision()
| void eve::physics::LayeredClothGPU::setSelfCollision | ( | bool | enabled | ) |
Enable nonlocal point-face and edge-edge contact within each sheet.
在文件 LayeredClothGPU.cpp 第 236 行定义.
◆ setSolver()
| void eve::physics::LayeredClothGPU::setSolver | ( | int | substeps, |
| int | iterations | ||
| ) |
Set substeps [1,16], iterations [1,64]; throws before mutation on invalid budget.
在文件 LayeredClothGPU.cpp 第 217 行定义.
引用了 iterations.
◆ setWind()
| void eve::physics::LayeredClothGPU::setWind | ( | float | x, |
| float | y, | ||
| float | z | ||
| ) |
Set finite uniform wind acceleration; not triangle aerodynamics.
在文件 LayeredClothGPU.cpp 第 229 行定义.
◆ update()
| Result< void > eve::physics::LayeredClothGPU::update | ( | float | dt | ) |
Execute finite dt in [1e-6,0.05] on GPU; zero is a no-op. Input failure leaves state unchanged.
- 返回
- Explicit failure; a device failure requires reset/recreation before continuing. @cost One synchronous submission per call, with substeps times iterations dispatches and no readback.
在文件 LayeredClothGPU.cpp 第 166 行定义.
引用了 dt, eve::Diagnostic::error(), eve::Failed, eve::Result< T >::failure(), eve::InvalidArgument, p, eve::PreconditionViolation, s , 以及 eve::Result< T >::success().
该类的文档由以下文件生成:
- src/modules/physics/cloth/LayeredClothGPU.h
- src/modules/physics/cloth/LayeredClothGPU.cpp