You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
948 B

4 months ago
#version 450
layout (local_size_x = 16) in;
4 months ago
struct Vertex {
vec3 position;
vec3 color;
4 months ago
vec3 normal;
4 months ago
};
4 months ago
layout (std430, set = 0, binding = 0) buffer VertexBuffer {
4 months ago
Vertex vertices[];
};
layout (std140, set = 0, binding = 5) uniform Sizes {
uint vertexCount;
uint faceCount;
};
4 months ago
layout (std140, set = 1, binding = 0) uniform UBO {
float dt;
vec3 gravity;
};
layout (push_constant) uniform PushConstants {
uint state;
int vertexOffset;
4 months ago
};
void preSolve(uint vID){
vertices[vID].position += vec3(0.0001, 0, 0);
}
4 months ago
void postSolve(uint vID){
vertices[vID].position += vec3(0, 0.0001, 0);
}
void main() {
uint id = gl_GlobalInvocationID.x;
switch (state){
case 0:
if (id < vertexCount){
preSolve(id);
}
break;
case 2:
if (id < vertexCount){
postSolve(id);
}
break;
}
4 months ago
}