matrix values cpu side

This commit is contained in:
2025-11-09 12:13:08 +01:00
parent 6a874a01bb
commit 1be8e337a3
2 changed files with 31 additions and 14 deletions

View File

@@ -4,6 +4,10 @@ layout(std430, binding = 3) buffer layoutName {
float o_Points[];
};
const uint transformationCount = 3;
layout(location = 1) uniform mat4 transformations[transformationCount];
layout(local_size_x = 64) in;
highp float rand(vec2 co)
@@ -27,24 +31,12 @@ void store(vec3 vect, uint index) {
}
void main() {
const uint total = gl_NumWorkGroups.x * gl_WorkGroupSize.x;
uint currentIndex = gl_GlobalInvocationID.x;
vec3 currentPoint = unpack(currentIndex);
uint index = uint(rand(currentPoint.xy + currentPoint.z + currentIndex) * 69);
mat4 transformation;
switch (index % 3) {
case 0:
transformation = mat4(0.5, 0, 0, 0, 0, 0.5, 0, 0, 0, 0, 0, 0, 0, 0.36, 0, 1);
break;
mat4 transformation = transformations[index % transformationCount];
case 1:
transformation = mat4(0.5, 0, 0, 0, 0, 0.5, 0, 0, 0, 0, 0, 0, -0.5, -0.5, 0, 1);
break;
case 2:
transformation = mat4(0.5, 0, 0, 0, 0, 0.5, 0, 0, 0, 0, 0, 0, 0.5, -0.5, 0, 1);
break;
}
vec3 result = (transformation * vec4(currentPoint, 1.0)).xyz;
store(result, currentIndex);
}