Merge branch 'teemun_uusi_efekti' into teemun_shaderi

This commit is contained in:
Teemu Järvisalo
2025-07-23 22:31:01 +03:00
3 changed files with 191 additions and 105 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() {
@ -65,6 +67,10 @@ vec2 opU( vec2 d1, vec2 d2 )
return (d1.x<d2.x) ? d1 : d2;
}
float sdSphere(vec3 p, float r){
return length(p) -r;
}
float opU( float d1, float d2 ) { return -max( -d1, -d2 ); }
vec2 mapScene(in vec3 p) {
@ -82,7 +88,7 @@ vec2 mapScene(in vec3 p) {
// Hexagonal grid
float hexGap = 0.2;
/*
for(float j = 0.; j < 16.; j++) {
vec3 po = p-vec3(-2.0,-5., 0.0);
po += vec3((1.6 + hexGap) * 8, -5., -(1.88 + hexGap) * 10);
@ -117,6 +123,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 res;
}