tän pitäisi tehdä shapeja

This commit is contained in:
Teemu Järvisalo
2025-07-22 22:22:35 +03:00
parent be7398cc91
commit 3110e64236
3 changed files with 189 additions and 97 deletions

View File

@ -6,6 +6,8 @@ const float TAU = (2. * PI);
const float PHI = sqrt(5.) * 0.5 + 0.5;
layout(location = 0) uniform float syncs[7];
layout(location = 8) uniform float fft_output[512]; // FFT_SIZE / 4
layout(location = 600) uniform vec3 shapes[15]; // shapes - x = horizontal position, y = vertical position, z = length
layout(location = 700) uniform vec3 test; // shapes test
float u_time = syncs[0];
vec2 getUV() {
@ -41,6 +43,10 @@ float getScaledFFT(int index, float scale, float offset) {
return log(1.0 + raw * scale) + offset;
}
float sdSphere(vec3 p, float r){
return length(p) -r;
}
// Modify your mapScene function
vec2 mapScene(in vec3 p) {
float mat = 0.;
@ -54,7 +60,7 @@ vec2 mapScene(in vec3 p) {
// Hexagonal grid
float hexGap = 0.2;
/*
for(float j = 0.; j < 16.; j++) {
vec3 po = p;
po += vec3((1.6 + hexGap) * 8, -5., -(1.88 + hexGap) * 10);
@ -85,6 +91,14 @@ vec2 mapScene(in vec3 p) {
}
}
}
*/
// main note effect shapes
a = sdSphere(vec3(p.x + test.y, p.y + test.x, p.z), test.z + 2.);
d = min(d, a);
if (d == a) {
mat = 1.;
}
return vec2(d, mat);
}