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

@ -5,7 +5,6 @@ struct Particle {
vec4 vel;
vec4 uv;
vec4 normal;
float pinned;
};
layout(std430, binding = 0) buffer ParticleIn {
@ -53,13 +52,6 @@ void main()
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 = vec4(0.0);
return;
}
// Initial force from gravity
vec3 force = params.gravity.xyz * params.particleMass;

View file

@ -17,11 +17,6 @@ layout (binding = 0) uniform UBO
vec4 lightPos;
} ubo;
out gl_PerVertex
{
vec4 gl_Position;
};
void main ()
{
outUV = inUV;

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;