kamera-ajo

This commit is contained in:
2024-07-29 22:18:06 +03:00
parent 719e6d367d
commit 9646be5552

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.;
@ -324,16 +324,28 @@ 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 > 22.) {
cPos = getCpos(u_time);
}
if (u_time > 26.5) {
cPos = mix(getCpos(26.5), vec3(0., 0., 5.), clamp((u_time-26.5) * 1.5, 0., 1.1));
}
return cPos;
}
@ -342,7 +354,7 @@ 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.,0.,0.);
return p;
}
@ -402,11 +414,11 @@ vec3 sceneGate(vec2 uv)
col *= vec3(.1)+ addSpecular(n,rd,0.5);
if(mat ==5.)
col *= chevronColor; // activated glyph color
}
col = applyFog(col, d, rd, vec3(0., -.1, -1.), .01);
col = colorFlashesAnim(col); // animated color flash
return postProcess(col);
col = applyFog(col, d, rd, vec3(0., -.1, -1.), .01);
col = colorFlashesAnim(col); // animated color flash
return postProcess(col);
}
void main() {