sample testailuja

This commit is contained in:
2024-06-04 17:07:01 +03:00
parent 1c6b4cdc7e
commit 878e57b057
16 changed files with 1346 additions and 599 deletions

View File

@ -9,6 +9,12 @@ struct Ray {
vec3 dir;
};
vec2 getUV(vec2 offset) {
vec2 uv = 2.0 *((gl_FragCoord.xy + offset*0.5)/u_resolution.xy - 0.5);
uv.x *= u_resolution.x/u_resolution.y; // Correct for aspect ratio
return uv;
}
mat2 scale(vec2 scale){
return mat2(1. / scale.x, 0.0, 0.0, 1./scale.y);
}
@ -617,8 +623,20 @@ float sdCog2d(vec2 pos) {
float sdCog(vec3 pos, float angle) {
pos.xy *= Rot(angle);
float d1 = opExtrusion(pos, sdCog2d(pos.xy), 0.05);
float d2 = fCapsule(pos, vec3(0., 0.0, 0.), vec3(0., 0., 1.), 0.2);
return 0.8 * fOpDifferenceRound(d1,d2,0.05)-0.003;}
float d2 = fCapsule(pos, vec3(0., 0.0, 0.), vec3(0., 0., 1.), 0.2);
return 0.8 * fOpDifferenceRound(d1,d2,0.05)-0.003;
}
float sdText(vec3 pos, float angle) {
//pos.xy *= Rot(angle);
vec3 color = texture2D(texts, getUV(vec2( 0.,0.))).rgb;
//gl_FragColor = vec4(vec3(color), 1.);
//float d1 = opExtrusion(pos, , 0.1);
return 0.;
// return d1;
}
float sdHex(vec3 pos, float i, float angle) {
@ -655,10 +673,11 @@ vec2 mapScene(in vec3 p) {
if (d == a) mat = 1. + mod(i,3.);
}
/*float c2 = sdCog(p, u_time);
d = min(d, c2);
if ( d == c2) mat = 4.;
*/
//float c2 = sdText(p, u_time);
//d = min(d, c2);
//if ( d == c2) mat = 4.;
// float c3 = fBox(p+vec3(0.5, .87, 0.), vec3(1., 1.,1.));
// d = min(d, c3);
@ -963,11 +982,7 @@ vec3 render(vec2 uv) {
return col;
}
vec2 getUV(vec2 offset) {
vec2 uv = 2.0 *((gl_FragCoord.xy + offset*0.5)/u_resolution.xy - 0.5);
uv.x *= u_resolution.x/u_resolution.y; // Correct for aspect ratio
return uv;
}
void main()
{