Animaatiot toimii
This commit is contained in:
@ -6,7 +6,7 @@ PROJECT_INFO_FILE=prod.nfo
|
||||
PROJECT_SCREENSHOT=
|
||||
|
||||
# Currently active config file name
|
||||
ACTIVE_CONFIG=minified.config
|
||||
ACTIVE_CONFIG=base.config
|
||||
|
||||
# ------- GUI options/preferences --------
|
||||
# Automatically rebuild DLLs when things have changed?
|
||||
|
||||
95
shader.glsl
95
shader.glsl
@ -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);
|
||||
|
||||
// delay start
|
||||
// delay start
|
||||
if( u_time >= STARTDELAY ) {
|
||||
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;
|
||||
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;
|
||||
}
|
||||
|
||||
if(u_time >= 14.0) {
|
||||
@ -275,42 +275,69 @@ void main( )
|
||||
vec3 rd = GetRayDir(uv, ro, vec3(0, 0., 0.), 1.); // ray direction
|
||||
vec3 col = vec3(0); // color
|
||||
|
||||
float d = rayMarch(ro, rd);
|
||||
|
||||
if (d < 1000.)
|
||||
if(u_time > 0.0)
|
||||
{
|
||||
// Lighting
|
||||
vec3 p = ro + rd * d;
|
||||
float d = rayMarch(ro, rd);
|
||||
|
||||
float mat = map(p).y;
|
||||
// Light 1
|
||||
// Light 1 Position
|
||||
vec3 lightPos1 = vec3( 3, 5, 4);
|
||||
// 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 (d < 1000.)
|
||||
{
|
||||
// Lighting
|
||||
vec3 p = ro + rd * d;
|
||||
|
||||
// Light 2
|
||||
vec3 lightPos2 = vec3( -3, 5, -4);
|
||||
dif = getLight(p, lightPos2, 0.75, 0.1);
|
||||
// Color for light 2
|
||||
col += vec3(dif * vec3(0.5,0.2,0.1));
|
||||
float mat = map(p).y;
|
||||
// Light 1
|
||||
// Light 1 Position
|
||||
vec3 lightPos1 = vec3( 3, 5, 4);
|
||||
// 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.){
|
||||
col *= vec3(0,0,1);
|
||||
}
|
||||
else if(mat==1.){
|
||||
col *= vec3(0,1,0);
|
||||
}
|
||||
else if(mat==2.){
|
||||
col *= vec3(1,0,0);
|
||||
// Light 2
|
||||
vec3 lightPos2 = vec3( -3, 5, -4);
|
||||
dif = getLight(p, lightPos2, 0.75, 0.1);
|
||||
// Color for light 2
|
||||
col += vec3(dif * vec3(0.5,0.2,0.1));
|
||||
|
||||
if(mat==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;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user