Code cleanup, rework, additional code comments

This commit is contained in:
Sascha Willems 2024-01-07 20:04:18 +01:00
parent fe46cef0a7
commit dec7d2e9f8
5 changed files with 206 additions and 290 deletions

View file

@ -1,11 +1,11 @@
// Copyright 2020 Google LLC
// Copyright 2023 Sascha Willems
struct Particle {
float4 pos;
float4 vel;
float4 uv;
float4 normal;
float pinned;
};
[[vk::binding(0)]]
@ -54,13 +54,6 @@ void main(uint3 id : SV_DispatchThreadID)
if (index > params.particleCount.x * params.particleCount.y)
return;
// Pinned?
if (particleIn[index].pinned == 1.0) {
particleOut[index].pos = particleOut[index].pos;
particleOut[index].vel = float4(0, 0, 0, 0);
return;
}
// Initial force from gravity
float3 force = params.gravity.xyz * params.particleMass;