This commit is contained in:
Teemu Järvisalo
2024-07-29 22:57:15 +03:00

View File

@ -4,7 +4,7 @@
* Contact: tdmaav@gmail.com
*/
// precision mediump float;
//precision mediump float;
uniform vec2 u_resolution;
uniform float u_time;
const float PI = 22./7.;
@ -75,20 +75,17 @@ float sdTriPrism( vec3 p, vec2 h, float rot )
//////////////////
// POSITIONS
/*
const vec3 glyph1Pos = vec3(1.7,-1.1,0.0);
const vec3 glyph2Pos = vec3(2.0,0.0,0.0);
//const vec3 glyph1Pos = vec3(1.7,-1.1,0.0);
//const vec3 glyph2Pos = vec3(2.0,0.0,0.0);
const vec3 glyph3Pos = vec3(1.5,1.4,0.0);
const vec3 glyph4Pos = vec3(0.0,2.0,0.0);
const vec3 glyph5Pos = vec3(1.5,1.4,0.0);
const vec3 glyph6Pos = vec3(1.5 * -1.,1.4,0.0);
const vec3 glyph7Pos = vec3(1.7 * -1.,-1.1,0.0);
*/
const vec3 glyph5Pos = vec3(-1.5,1.4,0.0);
//const vec3 glyph6Pos = vec3(1.5 * -1.,1.4,0.0);
//const vec3 glyph7Pos = vec3(1.7 * -1.,-1.1,0.0);
// DELAYS
float STARTDELAY = 9.;
// COLORS
vec3 fogColor1 = vec3(0.49, 0.18, 0.49), // fog color1
fogColor2 = vec3(0.93, 0.37, 0.16), // fog color2
@ -319,16 +316,35 @@ vec3 postProcess(vec3 col) {
return col;
}
vec3 getCpos(float time) {
return vec3((cos(time)-0.9)*2., -sin(time)*0.8, 5.);;
}
vec3 cameraPos()
{
// first zoom in to the gate
vec3 cPos = vec3(0., clamp(6.-u_time,2.,6.), clamp((75.-u_time*8.),6.,75.));
if (u_time > 7.5) cPos += vec3(0., clamp(7.5-u_time,-1.,0.), 0.);
// close up shot for 1st glyph lock
if (u_time > 10.5) cPos = vec3(2.,-1.,1.);
// zoom away for 2nd glyph animation
if (u_time > 12.) cPos = vec3(-1., -.7, 4.);
if (u_time > 22.) cPos = vec3(0., -1., 5.);
if (u_time > 12.) cPos = vec3(-1., -.7, 4.);
if (u_time > 13.5) {
cPos = vec3(0., 0., 4.);
cPos.yz *= rot2D(-0.6-(cos(u_time-15.))*0.2);
cPos.xz *= rot2D(sin((u_time-16.5)*0.5)*.6);
}
if (u_time > 19.5)
{
cPos = vec3(3., -.7, 4.);
}
if (u_time > 22.) {
cPos.yz *= rot2D(((1.-cos(u_time-22.))*0.25)*-0.1);
cPos.xz *= rot2D(sin((u_time-22.)*0.2)*.6);
}
return cPos;
}
@ -337,7 +353,15 @@ vec3 cameraPointAt() {
// look at 1st glyph
if (u_time > 10.5) p = vec3(1.7,-1.1,0.);
// look gate at distance
if(u_time > 12.) p = vec3(0.);
if(u_time > 12.) p = vec3(0.);
if(u_time > 13.5) {
p = mix(glyph3Pos,glyph4Pos, (u_time-13.5)*0.3);
}
if(u_time > 16.8)
{
p = mix(glyph4Pos,glyph5Pos, clamp((u_time-16.8)*0.3,0.,1.));
}
if(u_time > 19.5) p = vec3(0.);
return p;
}
@ -400,10 +424,10 @@ vec3 sceneGate(vec2 uv)
if(mat == 6.) {
col *= vec3(0.01, 0.04, 0.06) + addSpecular(n,rd,.1, 2.5);
}
}
col = applyFog(col, d, rd, vec3(0., -.1, -1.), .01);
col = colorFlashesAnim(col); // animated color flash
col = colorFlashesAnim(col); // animated color flash
return postProcess(col);
}