载入中...
搜索中...
未找到
LayeredClothGPU.cpp
浏览该文件的文档.
71LayeredClothGPU::LayeredClothGPU(gpgpu::Gpgpu& compute, graphics::Graphics& graphics, int layers, int cols, int rows,
74 if (layers < 1 || layers > 8 || cols < 2 || rows < 2 || cols > 128 || rows > 128 || !std::isfinite(spacing) ||
85 p->count * 16, p->count * 16, p->count * 16, p->count * 12 * 16, p->buckets * 4, p->capacity * 32, 32,
91 p->buffers[size_t(i)].reset(compute.newBuffer(bytes[size_t(i)], i == 7 ? "storage_vertex" : "storage"));
170 DiagnosticCode::InvalidArgument, "dt must be zero or finite in [1e-6,0.05]", "physics.layeredGpu.update"));
204 return Result<void>::failure(Diagnostic::error(DiagnosticCode::Failed, e.what(), "physics.layeredGpu.update"));
static Diagnostic error(DiagnosticCode code, std::string message, std::string path={})
Construct an error diagnostic with the standard error severity.
Definition Diagnostic.cpp:21
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:196
GPGPU module — compute shaders + storage buffers via the active Graphics backend. Uses the graphics q...
Definition Gpgpu.h:23
Definition Graphics.h:134
virtual bool releaseMesh(Mesh *mesh)
Eagerly releases a mesh created by this Graphics.
Definition Graphics.h:935
void setGravity(float x, float y, float z)
Set finite world gravity; throws on invalid input.
Definition LayeredClothGPU.cpp:223
std::array< unsigned, 4 > readDiagnostics()
Explicit readback: hash references attempted, last overflow flag, contact projections,...
Definition LayeredClothGPU.cpp:270
void setWind(float x, float y, float z)
Set finite uniform wind acceleration; not triangle aerodynamics.
Definition LayeredClothGPU.cpp:229
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.
Definition LayeredClothGPU.cpp:71
void setSolver(int substeps, int iterations)
Set substeps [1,16], iterations [1,64]; throws before mutation on invalid budget.
Definition LayeredClothGPU.cpp:217
Result< void > draw()
Record direct resident-buffer drawing inside an open 3D pass; no host vertex transfer.
Definition LayeredClothGPU.cpp:207
void setParticleInverseMass(int index, float inverseMass)
Change one particle's inverse mass, effective on the next update; zero pins. @cost One tiny upload pl...
Definition LayeredClothGPU.cpp:247
void setContact(float thickness, float friction)
Set separation >0, friction [0,1]; throws on nonfinite/out-of-range input.
Definition LayeredClothGPU.cpp:237
void reset()
Restore initial pinned pose and material/particle overrides; synchronously uploads once....
Definition LayeredClothGPU.cpp:153
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.
Definition LayeredClothGPU.cpp:166
int getParticleCount() const
Return total simulation particles (render stream duplicates each for two sides).
Definition LayeredClothGPU.cpp:257
~LayeredClothGPU()
Wait for resident draw retirement and release compute resources; never throws.
void setSelfCollision(bool enabled)
Enable nonlocal point-face and edge-edge contact within each sheet.
Definition LayeredClothGPU.cpp:236
std::vector< float > readPositions()
Explicit diagnostic readback, XYZW per particle; W is inverse mass. @cost Full state download plus GP...
Definition LayeredClothGPU.cpp:258
void setInterCollision(bool enabled)
Enable inter-layer point-face and edge-edge contact, independently of self contact.
Definition LayeredClothGPU.cpp:235
@ Exception
@ InvalidArgument
@ PreconditionViolation
@ Failed
@ Vulkan
std::vector< float > adjacency
Definition LayeredClothGPU.cpp:28
std::array< std::unique_ptr< gpgpu::GpuBuffer >, 8 > buffers
Definition LayeredClothGPU.cpp:24
graphics::Graphics & graphics
Definition LayeredClothGPU.cpp:23
void dispatch(int mode, int work, bool swap=false)
Definition LayeredClothGPU.cpp:37
std::array< float, 32 > params
Definition LayeredClothGPU.cpp:29
std::unique_ptr< gpgpu::ComputeShader > kernel
Definition LayeredClothGPU.cpp:25
std::vector< float > initial
Definition LayeredClothGPU.cpp:28
Impl(gpgpu::Gpgpu &c, graphics::Graphics &g)
Definition LayeredClothGPU.cpp:32
std::unique_ptr< gpgpu::Sequence > sequence
Definition LayeredClothGPU.cpp:26