generated from Persson-dev/OpenGLComputeShader
matrix multiplcation
This commit is contained in:
@@ -20,11 +20,19 @@ void main() {
|
||||
const uint total = gl_NumWorkGroups.x * gl_WorkGroupSize.x;
|
||||
uint currentPoint = gl_GlobalInvocationID.x;
|
||||
uint index = uint(rand(o_Points[currentPoint] + currentPoint) * 69);
|
||||
if (index % 3 == 0) {
|
||||
o_Points[currentPoint] = o_Points[currentPoint] / 2 + vec2(0, 0.36);
|
||||
} else if (index % 3 == 1) {
|
||||
o_Points[currentPoint] = o_Points[currentPoint] / 2 + vec2(-0.5, -0.5);
|
||||
} else {
|
||||
o_Points[currentPoint] = o_Points[currentPoint] / 2 + vec2(0.5, -0.5);
|
||||
mat3 transformation;
|
||||
switch (index % 3) {
|
||||
case 0:
|
||||
transformation = mat3(0.5, 0, 0, 0, 0.5, 0, 0, 0.36, 1);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
transformation = mat3(0.5, 0, 0, 0, 0.5, 0, -0.5, -0.5, 1);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
transformation = mat3(0.5, 0, 0, 0, 0.5, 0, 0.5, -0.5, 1);
|
||||
break;
|
||||
}
|
||||
o_Points[currentPoint] = (transformation * vec3(o_Points[currentPoint], 1.0)).xy;
|
||||
}
|
||||
Reference in New Issue
Block a user