Animaatiot toimii

This commit is contained in:
2024-07-24 16:48:38 +03:00
parent 0ea616d2ec
commit 4389be6ef8
2 changed files with 62 additions and 35 deletions

View File

@ -6,7 +6,7 @@ PROJECT_INFO_FILE=prod.nfo
PROJECT_SCREENSHOT= PROJECT_SCREENSHOT=
# Currently active config file name # Currently active config file name
ACTIVE_CONFIG=minified.config ACTIVE_CONFIG=base.config
# ------- GUI options/preferences -------- # ------- GUI options/preferences --------
# Automatically rebuild DLLs when things have changed? # Automatically rebuild DLLs when things have changed?

View File

@ -81,10 +81,10 @@ const float STARTDELAY = 2.0;
float factor = 9.0+9.0*clamp(sin(ringRotateFunc(2.0, 0.0, 1.0) * 0.05), -0.9, 0.9); float factor = 9.0+9.0*clamp(sin(ringRotateFunc(2.0, 0.0, 1.0) * 0.05), -0.9, 0.9);
// delay start // delay start
if( u_time >= STARTDELAY ) { if( u_time >= STARTDELAY ) {
factor = 9.0+9.0*clamp(sin(ringRotateFunc(2.0, 0.0, 1.0) * 0.05), -0.9, 0.9); factor = 9.0+9.0*clamp(sin(ringRotateFunc(2.0, 0.0, 1.0) * 0.05), -0.9, 0.9);
p.xy = rot2D(factor) * p.xy; p.xy = rot2D(factor) * p.xy;
} }
if(u_time >= 14.0) { if(u_time >= 14.0) {
@ -275,42 +275,69 @@ void main( )
vec3 rd = GetRayDir(uv, ro, vec3(0, 0., 0.), 1.); // ray direction vec3 rd = GetRayDir(uv, ro, vec3(0, 0., 0.), 1.); // ray direction
vec3 col = vec3(0); // color vec3 col = vec3(0); // color
float d = rayMarch(ro, rd); if(u_time > 0.0)
if (d < 1000.)
{ {
// Lighting float d = rayMarch(ro, rd);
vec3 p = ro + rd * d;
float mat = map(p).y; if (d < 1000.)
// Light 1 {
// Light 1 Position // Lighting
vec3 lightPos1 = vec3( 3, 5, 4); vec3 p = ro + rd * d;
// Light 1 Arguments
// 1: Ray starting point
// 2: Light position
// 3: Light intensity
// 4: Shadow intensity
float dif = getLight(p, lightPos1, 0.75, 0.2);
// Color for light 1
col = vec3(dif * vec3(1));
// Light 2 float mat = map(p).y;
vec3 lightPos2 = vec3( -3, 5, -4); // Light 1
dif = getLight(p, lightPos2, 0.75, 0.1); // Light 1 Position
// Color for light 2 vec3 lightPos1 = vec3( 3, 5, 4);
col += vec3(dif * vec3(0.5,0.2,0.1)); // Light 1 Arguments
// 1: Ray starting point
// 2: Light position
// 3: Light intensity
// 4: Shadow intensity
float dif = getLight(p, lightPos1, 0.75, 0.2);
// Color for light 1
col = vec3(dif * vec3(1));
if(mat==0.){ // Light 2
col *= vec3(0,0,1); vec3 lightPos2 = vec3( -3, 5, -4);
} dif = getLight(p, lightPos2, 0.75, 0.1);
else if(mat==1.){ // Color for light 2
col *= vec3(0,1,0); col += vec3(dif * vec3(0.5,0.2,0.1));
}
else if(mat==2.){ if(mat==0.){
col *= vec3(1,0,0); col *= vec3(0,0,1);
}
else if(mat==1.){
col *= vec3(0,1,0);
}
else if(mat==2.){
col *= vec3(1,0,0);
}
} }
gl_FragColor = vec4(col, 1);
} }
gl_FragColor = vec4(col, 1); else {
// ************* post-process pass ******************
// Uncomment this to try a post-processing "effect"
vec4 c = texture2D(texture_sampler, (gl_FragCoord.xy / u_resolution )),
c1 = texture2D(texture_sampler, ((gl_FragCoord.xy + vec2(1.0, 0.0)) / u_resolution) ),
c2 = texture2D(texture_sampler, ((gl_FragCoord.xy + vec2(0.0, 1.0)) / u_resolution) ),
c3 = texture2D(texture_sampler, ((gl_FragCoord.xy + vec2(1.0, 1.0)) / u_resolution) ),
c4 = texture2D(texture_sampler, ((gl_FragCoord.xy + vec2(-1.0, 1.0)) / u_resolution) ),
c5 = texture2D(texture_sampler, ((gl_FragCoord.xy + vec2(-1.0, 0.0)) / u_resolution) ),
c6 = texture2D(texture_sampler, ((gl_FragCoord.xy + vec2(-1.0, -1.0)) / u_resolution) ),
c7 = texture2D(texture_sampler, ((gl_FragCoord.xy + vec2(0.0, -1.0)) / u_resolution) ),
c8 = texture2D(texture_sampler, ((gl_FragCoord.xy + vec2(1.0, -1.0)) / u_resolution) )
;
// weird emboss effect
// gl_FragColor = (c - c1 - c2 - c3 - c4 + c5 + c6 + c7 + c8) / 2.0;
// some sort of gamma correction with smoothing
gl_FragColor = sqrt(c * 2.0 + c1 + c2 + c3 + c4 + c5 + c6 + c7 + c8) / 3.0;
}
} }