Find file
Fetching contributors…
Cannot retrieve contributors at this time
2667 lines (2127 sloc) 89.1 KB
<!--
should not be so white when entering guitar riff (became like so with tl wipe out
eye should be moving on beggining of speech, not during the guitar riff syncs (became always still with tl wipe out
still crashes at 287000 for unknown reasons
-->
<!DOCTYPE html>
<html>
<head>
<title></title>
<script type="text/javascript">
var audio;
var audio_position = 0;
var audio_inited = 0;
var finetime = 0;
var finetime_start = 0;
function finePos() {
return finetime;
}
function audioUpdatePos() {
audio_position = audio.currentTime*1000;
}
function audioReady() {
if (audio_inited == 0) {
initSubtitles();
initOverlays();
audio_inited = 1;
}
}
function audioSeek(msec) {
audio.currentTime = msec/1000;
}
function audioSeeked() {
audio_position = audio.currentTime*1000;
}
function audioStop() {
audio.stop();
}
function audioPlay() {
}
function initAudio() {
audio = document.createElement('audio');
//audio.setAttribute('src', '02_profan_-_sacrificing_to_the_serpent_god.ogg');
//audio.setAttribute('src', '4_40_edit.ogg');
audio.setAttribute('src', '5_45_edit.ogg');
audio.setAttribute('preload', false);
audio.setAttribute('autoplay', false);
audio.addEventListener('canplaythrough', audioReady, false);
audio.addEventListener('seeked', audioSeeked, false);
audio.controls = false;
audio.load();
}
function audioPos() {
if (audio_inited > 0) {
audio_position = audio.currentTime*1000;
return audio_position;
} else return 0;
}
</script>
<script type="text/javascript" src="timeline_noflash.js"></script>
<!-- fragment shader effects for fullscreen quad scenes !-->
<script id="shaderfs_skybox" type="x-shader/x-fragment">
#ifdef GL_ES
precision highp float;
precision highp vec3;
precision highp mat3;
precision highp vec2;
precision highp mat2;
#endif
uniform float time;
uniform float width;
uniform float height;
uniform float beat;
uniform float alpha;
uniform samplerCube scube;
uniform sampler2D s2d;
void main(void) {
vec2 resolution;
resolution.x = width;
resolution.y = height;
vec2 pixpos = (gl_FragCoord.xy / resolution.xy);
float myTime = time*0.0002;
vec3 pos = vec3(0.0, 0.0, -20.0);
vec3 dir = normalize(vec3(pixpos, 1.0));
float a2 = 2.9+cos(myTime*0.7)*0.5;
mat3 r2 = mat3(1);
r2[1][1] = cos(a2);
r2[2][1] = sin(a2);
r2[1][2] = -sin(a2);
r2[2][2] = cos(a2);
pos = r2 * pos;
dir = r2 * dir;
float a = myTime;
mat3 r = mat3(1);
r[0][0] = cos(a);
r[2][0] = sin(a);
r[0][2] = -sin(a);
r[2][2] = cos(a);
pos = r * pos;
dir = r * dir;
vec4 d = texture2D(s2d, pixpos)*(abs(0.4*cos(myTime*0.25)));
gl_FragColor = vec4(0.0,0.0,0.0, 0.0);
vec4 cube = textureCube(scube,dir);
cube-=vec4(alpha, alpha, alpha, 0.0);
vec4 endc = vec4(cube.r+d.r*beat, cube.g-beat, d.a+cube.b*beat, beat*0.25+d.a-cube.r);
gl_FragColor = endc;
}
</script>
<script id="shaderfs_mankeliscene" type="x-shader/x-fragment">
#ifdef GL_ES
precision highp float;
precision highp vec3;
precision highp mat3;
precision highp vec2;
precision highp mat2;
#endif
uniform float time;
uniform float width;
uniform float height;
uniform sampler2D s2d;
uniform float beat;
uniform float beat_runner;
varying vec2 pixpos;
int objid;
vec3 ball1,ball2,ball3;
float fuckfunk(vec3 pos)
{
float myTime = time * 0.0007;
float distball = sqrt(dot(pos, pos)) - 1.4;
float dbo = distball;
float tt = abs(atan(myTime*0.2)*0.4);
float loaddone = 0.66-cos(beat_runner+tt*1.0)*0.2;
distball -= sin(pos.y * 4.0 + tt * 4.0) * cos(myTime*1.0*pos.x)*2.2 * clamp((tt-0.4)*1.6,0.0,1.0);
distball += texture2D(s2d, pos.xy * vec2(0.5, 1.0) + vec2(0.2, 0.4) * pos.z).r * 0.1;
//distball += textureCube(s2d, pos.xyz).r * 0.1;
float bs = 2.0;
float bsy = 0.4;
float bof = 2.6 - pow(2.7, -loaddone * 3.0) * 1.6;
float mixrat = sin( clamp(loaddone - 0.7,0.0,0.3) *(3.14159/0.3));
float a = pos.y * mixrat;
mat2 r = mat2(1);
r[0][0] = cos(a);
r[1][0] = sin(a);
r[0][1] = -sin(a);
r[1][1] = cos(a);
vec3 pos2 = pos;
pos2.xz = r * pos.xz;
pos2.y -= bof;
float distbox1 = max(max(abs(pos2.x) - bs, abs(pos2.y) - bsy), abs(pos2.z) - bs);
distbox1 += texture2D(s2d, pos2.xy).r * 0.1;
pos2.y += 2.0*bof;
float distbox2 = max(max(abs(pos2.x) - bs, abs(pos2.y) - bsy), abs(pos2.z) - bs);
//distbox2 += textureCube(s2d, pos2.xyz).r * 0.1;
float distbox = min(distbox1, distbox2);
pos2 = pos - vec3(0.0, bof - bsy, 0.0);
float distball1 = sqrt(dot(pos2, pos2)) - 1.4;
pos2 = pos + vec3(0.0, bof - bsy, 0.0);
float distball2 = sqrt(dot(pos2, pos2)) - 1.4;
float distballcut = -min(distball1, distball2);
objid = 0;
//float rdist = max(distbox, distballcut);
//float mixrat = clamp((loaddone - 0.7)*3.333, 0.0, 1.0);
//distballcut = mix(distballcut, -10.0, mixrat);
float rdist = distbox;
// rdist -= mix(0.0, sin(pos.y * 5.0 + myTime * 10.0), mixrat);
if (distballcut > rdist)
{
objid = 2;
rdist = distballcut;
}
// rdist = mix(rdist, distbox3, mixrat);
if (distball < rdist)
{
objid = 1;
rdist = distball;
}
return rdist;
}
void main(void) {
float myTime = time * 0.0001;
vec3 pos = vec3(0.0, 0.0, -10.0);
vec3 dir = normalize(vec3(pixpos, 2.0));
/*
float a2 = myTime * 0.43;
mat3 r2 = mat3(1);
r2[1][1] = cos(a2);
r2[2][1] = sin(a2);
r2[1][2] = -sin(a2);
r2[2][2] = cos(a2);
pos = r2 * pos;
dir = r2 * dir;
*/
float a = myTime;
mat3 r = mat3(1);
r[0][0] = cos(a);
r[2][0] = sin(a);
r[0][2] = -sin(a);
r[2][2] = cos(a);
pos = r * pos;
dir = r * dir;
gl_FragColor = vec4(0.0,0.0,0.0, 0.0);
//gl_FragColor = vec4(0.0,0.0,0.0, 0.0);
float totaldist = 0.0;
bool hit = false;
int lastid;
int lastiter;
for (int i = 40; i < 100; i+=10)
{
float rdist = fuckfunk(pos);
if (rdist < 0.001)
{
lastid = objid;
hit = true;
lastiter = i;
break;
}
rdist = max(rdist, totaldist * 0.001);
pos += dir * rdist;
totaldist += rdist;
if (totaldist > 90.0)
break;
}
if (hit)
{
vec2 texcoords;
/* float veclen = length(pos);
texcoords = pos.xy / veclen;
gl_FragColor = texture2D(s2d, texcoords);
*/// gl_FragColor.xyz *= pos.xyz * 0.5 + vec3(0.5,0.5,0.5);
vec3 dx = vec3(0.01, 0.0, 0.0);
vec3 dy = vec3(0.0, 0.01, 0.0);
vec3 dz = vec3(0.0, 0.0, 0.01);
vec3 px1 = pos - dx;
vec3 px2 = pos + dx;
vec3 py1 = pos - dy;
vec3 py2 = pos + dy;
vec3 pz1 = pos - dz;
vec3 pz2 = pos + dz;
vec3 normal = vec3(
fuckfunk(px2)-fuckfunk(px1),
fuckfunk(py2)-fuckfunk(py1),
fuckfunk(pz2)-fuckfunk(pz1));
normal = normalize(normal);
// texcoords = normal.xy;
// gl_FragColor = texture2D(s2d, texcoords);
vec3 lightdir = normalize(vec3(3.8,5.8,-1.0));
//lightdir = r * lightdir;
float light = clamp(dot(normal, lightdir)*1.5, 0.4, 1.0);
float speclight = 1.0;
totaldist = 0.0;
/* pos += lightdir * 0.1;
for (int i = 0; i < 80; i+=1)
{
float rdist = fuckfunk(pos);
if (rdist < 0.001)
{
light *= 0.5;
speclight = 0.0;
break;
}
rdist = max(rdist, length(pos) * 0.001);
pos += lightdir * rdist;
totaldist += rdist;
if (totaldist > 90.0)
break;
}
*/
if (lastid == 1)
{
gl_FragColor = vec4(dir.y*1.8, dir.x*1.5, dir.x*1.8, 0.8-beat*0.1);
gl_FragColor.xyz *= light;
float specular = pow(clamp(dot(reflect(dir, normal),lightdir),1.0,1.0),1.0);
gl_FragColor.xyz += vec3(sin(dir.x), cos(dir.x), sin(dir.y)) * specular * 0.3 * speclight;
}
}
}
</script>
<script id="shaderfs_convo" type="x-shader/x-fragment">
#ifdef GL_ES
precision highp float;
precision highp vec3;
precision highp mat3;
precision highp vec2;
precision highp mat2;
#endif
#define KERNEL_SIZE 9
uniform sampler2D s2d;
uniform float width;
uniform float height;
uniform float kernel1;
uniform float kernel2;
uniform float kernel3;
uniform float kernel4;
uniform float kernel5;
uniform float kernel6;
uniform float kernel7;
uniform float kernel8;
uniform float kernel9;
uniform float effect;
uniform float alpha;
float step_w = effect/width;
float step_h = effect/height;
vec2 offset1 = vec2(-step_w, -step_h);
vec2 offset2 = vec2(0.0, -step_h);
vec2 offset3 = vec2(step_w, -step_h);
vec2 offset4 = vec2(-step_w, 0.0);
vec2 offset5 = vec2(0.0, 0.0);
vec2 offset6 = vec2(step_w, 0.0);
vec2 offset7 = vec2(-step_w, step_h);
vec2 offset8 = vec2(0.0, step_h);
vec2 offset9 = vec2(step_w, step_h);
void main(void) {
int i = 0;
vec4 sum = vec4(0.0);
vec2 resolution;
resolution.x = width;
resolution.y = height;
vec2 c = (gl_FragCoord.xy / resolution.xy);
vec4 tmp = vec4(0.0);
float val = 0.3;
tmp = texture2D(s2d, c + offset1);
sum += tmp * kernel1*val;
tmp = texture2D(s2d, c + offset2);
sum += tmp * kernel2*val;
tmp = texture2D(s2d, c + offset3);
sum += tmp * kernel3*val;
tmp = texture2D(s2d, c + offset4);
sum += tmp * kernel4*val;
tmp = texture2D(s2d, c + offset5);
sum += tmp * kernel5*val;
tmp = texture2D(s2d, c + offset6);
sum += tmp * kernel6*val;
tmp = texture2D(s2d, c + offset7);
sum += tmp * kernel7*val;
tmp = texture2D(s2d, c + offset8);
sum += tmp * kernel8*val;
tmp = texture2D(s2d, c + offset9);
sum += tmp * kernel9*val;
sum.a = alpha;
gl_FragColor = sum ;
}
</script>
<script id="shaderfs_fsscene" type="x-shader/x-fragment">
precision highp float;
precision highp vec3;
precision highp mat3;
precision highp vec2;
precision highp mat2;
uniform float time;
uniform float beat;
uniform float width;
uniform float height;
uniform sampler2D s2d;
uniform float alpha;
uniform float layer_alpha;
uniform float z;
void main(void)
{
vec2 resolution;
resolution.x = width;
resolution.y = height;
vec2 c, c2;
c = (gl_FragCoord.xy / resolution.xy);
vec4 d = texture2D(s2d, c*z)*1.1;
if (layer_alpha > 0.0)
gl_FragColor = vec4(d.r, d.g, d.b, layer_alpha);
else
gl_FragColor = vec4(d.r, d.g, d.b, alpha);
}
</script>
<script id="shaderfs_blurdeformscene" type="x-shader/x-fragment">
precision highp float;
precision highp vec3;
precision highp mat3;
precision highp vec2;
precision highp mat2;
float myTime;
uniform float time;
uniform float width;
uniform float height;
uniform sampler2D s2d;
uniform float alpha;
uniform float layer_alpha;
vec3 deform( in vec2 p, float scale )
{
vec2 uv;
float mtime = scale+myTime;
float a = atan(p.y+tan(mtime)*mtime*0.1,p.x+cos(mtime)*mtime*0.1);
float r = sqrt(dot(p,p));
float s = r * (1.0+0.45*cos(mtime*1.7));
uv.x = .13*mtime +.04*p.y+.05*cos(-mtime+a*3.0)/s;
uv.y = .16*mtime +.04*p.x+.05*sin(-mtime+a*3.0)/s;
float w = 0.8-0.2*cos(mtime+3.0*a);
vec3 res = vec3(cos(myTime)*0.03,sin(myTime*0.8)*0.02,0.0)+texture2D(s2d,uv).xyz*w;
return res*res;
}
void main(void)
{
vec2 resolution;
resolution.x = width;
resolution.y = height;
myTime = time * 0.0001;
vec2 p = -1.0 + 2.0 * gl_FragCoord.xy / (resolution.xy);
vec3 total = vec3(0.0);
float w = 0.0;
for( int i=0; i<20; i+=5 )
{
vec3 res = deform(p,w);
total += res;
w += 0.03;
}
total /= 20.0;
gl_FragColor = vec4( 9.0*total,0.01);
}
</script>
<script id="shaderfs_fractalscene" type="x-shader/x-fragment">
precision highp float;
precision highp vec3;
precision highp mat3;
precision highp vec2;
precision highp mat2;
uniform float time;
uniform float beat;
uniform float beat_runner;
uniform float width;
uniform float height;
uniform float x;
uniform float y;
uniform float z;
uniform sampler2D s2d;
void main(void) {
vec2 resolution;
resolution.x = width;
resolution.y = height;
vec2 p, p2;
vec2 p3, p4;
vec2 c;
float tt = time*0.0004;
float myTime = time*0.00009;
c = (gl_FragCoord.xy / resolution.xy) - 0.5;
c.y *= (height / width);
float a = myTime*0.1;
mat2 r = mat2(1);
r[0][0] = cos(a);
r[1][0] = sin(a);
r[0][1] = -sin(a);
r[1][1] = cos(a);
c = r * c;
float oy;
oy = c.y;
float zoomy = z;
c *= 10.0 / zoomy;
c.x += x;
c.y += y;
for (int n = 300; n > 100; n-=10)
{
p2 = p;
p2.x+=cos(p.y*0.001+myTime*0.04+float(n)+cos(zoomy*0.004+float(n)*0.03)*20.0+tt*10.0)*0.03;
p = vec2(p.x * p.x - p.y * p.y, cos(myTime*0.2)*0.02+2.0 * p2.x * p2.y) + c;
p3 = vec2(p.x - p.x * p.y - p.y, cos(myTime*0.25)*0.03+2.0 * p2.x * p2.y) + c;
p4 = vec2(p.x * p.x - p.y * p.y+tt, cos(myTime*0.2)*0.02+2.0 * p2.x * p2.y) + c;
if (length(p) > (0.1+abs(cos(myTime*0.0003))*0.5+1.3+cos((float(n/2)+p.y*(cos(tt*0.5)*8.0+c.y+p.x)*p.x)+cos(tt*0.3+myTime*0.4))*0.30))
{
vec4 cc = vec4(0.0,0.0,0.0,0.0);
cc += vec4(1.0-tan(float(n*20)*0.1)*0.2*sin(sin(myTime*0.4)+p.x*0.15+float(n)), cos(float(n*3)*0.2)*sin(myTime*0.3+p.y*0.4+float(n)+myTime*0.6)*0.3, cos(float(n*2)*cos(sin(myTime*0.7)+p4.x*0.03+p.y*0.2)*0.1), 0.0) - (sin(float(n*2)*2.1+cos(myTime*0.3)*p4.x*0.002) + 0.2+float(n/3)*0.05);
cc -= vec4(1.0-cos(float(n*18)*0.1)*0.2*cos(p3.x*0.02+float(n)), cos(float(n*10)*0.2)*sin(p3.y*0.002+float(n))*0.2, cos(float(n*1)*cos(p3.x+beat)*0.1), 0.0) - (sin(float(n*2)*2.1+myTime*1.3*p3.x) + 0.2+float(n/3)*0.05);
gl_FragColor=(vec4(cc.g*beat,cc.r*beat,cc.r*beat,cc.g)*vec4(cc.r,cc.g,cc.b,cc.a)-vec4(cc.b,cc.b,cc.b,cc.a));
break;
}
}
}
</script>
<script id="shaderfs_psykescene" type="x-shader/x-fragment">
#ifdef GL_ES
precision highp float;
#endif
uniform float time;
uniform float width;
uniform float height;
uniform sampler2D s2d;
uniform float beat;
uniform float beat_runner;
uniform float x;
uniform float y;
uniform float z;
void main(void) {
vec2 resolution;
resolution.x = width;
resolution.y = height;
float myTime = time * 0.0002;
vec2 p = -resolution.xy + abs(cos((atan(gl_FragCoord.x*0.1)*cos(gl_FragCoord.y*0.01+myTime)*0.2*myTime)*1.3+sin(gl_FragCoord.x*0.01+z*0.3)+tan(gl_FragCoord.x*0.0002))*5.01) * gl_FragCoord.xy / resolution.xy * resolution.xy;
p.x = p.x + x;
p.y = p.y + y;
float c1 = atan(p.x*0.1+p.y*0.2+myTime*0.7)*cos(p.y*myTime*0.85)*0.6-0.4;
float c2 = sin(c1+p.y*0.002+p.x*0.003+myTime*0.7)*sin(p.x*0.01-myTime*0.8)*0.6;
float c3 = cos(c2+p.x*0.002+p.y*0.001+myTime*0.5)*atan(p.y*0.001-myTime*0.9)*0.4;
vec4 collyvec = vec4(c1*c3,c3*c2,c3*c2,0.3)-vec4(c1-c3,c3*c1,c2*c1,0.2)*vec4(c3-beat*0.4,c1,c3,0.1);
float c = cos((p.x*0.001)+myTime*10.0)*0.3;
vec4 vignette = vec4(c,c,c,abs(cos(myTime*0.3)*0.1));
gl_FragColor = ((collyvec) * vignette);
}
</script>
<script id="shaderfs_avaruusscene" type="x-shader/x-fragment">
#ifdef GL_ES
precision highp float;
#endif
uniform float time;
uniform float width;
uniform float height;
uniform sampler2D s2d;
uniform float beat;
uniform float alpha;
uniform float x;
uniform float y;
uniform float z;
void main(void) {
vec2 resolution;
resolution.x = width;
resolution.y = height;
float myTime = time * 0.0004;
vec2 p = (gl_FragCoord.xy / resolution.xy) * resolution.xy*3.0;
// avaruuseffu
p.x = p.x + x;
p.y = p.y + y;
float zoom = cos(myTime*0.1+(cos(p.y*0.3*cos(myTime*0.001)*((cos(myTime*0.008+p.y*0.0001)*0.0006)*p.x))*0.01)*(0.5*p.y*cos(myTime*0.01+p.x*0.001)*0.01)+sin(p.y*0.0001+myTime*0.01)*0.001)*0.0002;
zoom = zoom + 0.0007;
float z2 = zoom*z;
if (z2 > 0.6) z2 = 0.6;
float tx = p.y*zoom*0.9;
float ty = p.x*zoom*0.8;
float r = cos(myTime*0.1+z+p.y*0.0001)*0.7;
float r2 = sin(myTime*0.1+z+p.x*0.0001)*0.6;
vec4 ccc = texture2D(s2d, vec2(tx+r, ty+r2));
vec4 ccc2 = texture2D(s2d, vec2(ty+r, tx+r2));
float cal = myTime*0.1+p.x*0.0005+p.y*0.0015;
float ata = atan(myTime);
float vr = cos(cal)*0.5+ata*0.35-z2;
float vg = sin(cal)*0.5+ata*0.15-z2;
float vb = cos(cal)*0.4+ata*0.2-z2;
gl_FragColor = vec4(ccc.r-ccc2.g+vr, ccc.g-ccc2.b+vb, ccc.b-ccc2.r+vg, 0.2);
}
</script>
<script id="shaderfs_curvescene" type="x-shader/x-fragment">
precision highp float;
precision highp vec3;
precision highp mat3;
precision highp vec2;
precision highp mat2;
uniform float time;
uniform float width;
uniform float height;
void main(void) {
vec2 resolution;
resolution.x = width;
resolution.y = height;
float myTime = cos(time*0.0007)*1.0;
vec2 p = (2.0*gl_FragCoord.xy-resolution)/resolution.y;
p.y = p.y + atan(myTime*p.x*13.7*cos(myTime*0.8*p.y))*cos(p.y+myTime)*cos(p.x-myTime);
p.x = p.x + cos(myTime+p.y*26.3*sin(myTime*0.87*p.y))*sin(p.x+myTime)*sin(p.y-myTime);
float col2 = cos(gl_FragCoord.x*(5.5-cos(atan(p.x+gl_FragCoord.y)*0.05+sin(p.y-p.x-myTime)*p.y*0.1+myTime*0.05)*5.55)-myTime*26.0+atan(p.y*10.0+myTime*10.0*(p.x)*p.y))*atan(gl_FragCoord.y*4.5+myTime*0.5);
float col3 = col2+p.x*0.01;
float col4 = col2+p.y*0.01;
if (col2 > abs(cos(myTime*10.0+cos(gl_FragCoord.y+myTime-p.x*0.03)))) col2 = 1.0;
else col2 = 0.0;
if (col3 > abs(sin(myTime*10.0+sin(gl_FragCoord.x+myTime-p.x*0.01)))) col3 = 1.0;
else col3 = 0.0;
if (col4 > abs(tan(myTime*10.0+tan(gl_FragCoord.y+myTime-p.y*0.02)))) col4 = 1.0;
else col4 = 0.0;
float r = cos(p.x+myTime)*col2*col2;
float g = sin(p.y+myTime)*col2*col3;
float b = atan(p.x+myTime)*col2*col4;
if (g < 0.0) g = 0.0;
if (b < 0.0) b = 0.0;
gl_FragColor = vec4((atan(myTime+p.x)*r-b*col2*p.x)*0.3,(g-r*col3*p.y)*0.2,(b-g*col4*p.x*atan(myTime))*0.5,1.0);
}
</script>
<script id="shaderfs_blurspacescene" type="x-shader/x-fragment">
#ifdef GL_ES
precision highp float;
#endif
uniform float time;
uniform float width;
uniform float height;
uniform sampler2D s2d;
uniform float alpha;
void main(void) {
vec2 resolution;
resolution.x = width;
resolution.y = height;
vec2 p;
float myTime = time * 0.0002;
p = -resolution.xy + 3.0 * gl_FragCoord.xy / resolution.xy * resolution.xy;
p.x = p.x + myTime*cos(myTime*0.2)*200.0;
p.y = p.y + myTime*sin(myTime*0.3)*300.0;
float z = cos(myTime*0.6+(cos(p.y*cos(myTime*0.001)*(0.006*p.x))*0.01)*(0.5*p.y*cos(myTime*0.01+p.x*0.001)*0.01)+sin(p.y*0.0001)*0.001)*0.0002;
z = z + 0.0005;
float tx = p.x*z+myTime*0.01;
float ty = p.y*z+myTime*0.01;
float r = cos(myTime*0.06)*1.0;
float r2 = sin(myTime*0.06)*1.0;
vec4 ccc = texture2D(s2d, vec2(tx+r, ty+r2));
vec4 ccc2 = texture2D(s2d, vec2(ty+r, tx+r2));
float vr = cos(myTime*0.001+p.x*0.0012+p.y*0.0015)*0.1;
float vg = sin(myTime*0.001+p.y*0.0014+p.x*0.0013)*0.15;
float vb = atan(myTime*0.001+p.x*0.0013+p.y*0.0014)*0.13;
gl_FragColor = vec4(ccc.r-ccc2.g+vr, ccc.g-ccc2.b+vb, ccc.b-ccc2.r+vg,alpha);
}
</script>
<script id="shaderfs_analogscene" type="x-shader/x-fragment">
#ifdef GL_ES
precision highp float;
#endif
uniform float time;
uniform float beat;
uniform float width;
uniform float height;
float an (float x) { return cos(x)*sin(x*2.0)-atan(x*2.5);}
void main(void) {
vec2 resolution;
resolution.x = width;
resolution.y = height;
float myTime = time * 0.0001;
float myBeat = beat*0.02;
vec2 p = (1.0*gl_FragCoord.xy-resolution)/resolution.y;
p.x = p.x+cos(myTime*0.6)*resolution.x/200.0;
p.y = p.y+sin(myTime*0.4)*resolution.y/200.0;
float r = cos(1.0-myBeat*0.8)*atan((p.y+1.0*myBeat)*(2500.0+myTime+(cos(myBeat*p.x*2.6)*(myBeat*0.1)))*10.0);
float g = sin(1.0-myBeat*0.9)*atan((p.x+2.0*myBeat)*(2500.0+myTime+(sin(myBeat*p.x*3.5)*(myBeat*0.2)))*9.0);
float b = sin(1.0-myBeat*1.0)*atan((p.y+3.0*myBeat)*(2500.0+myTime+(cos(myBeat*p.y*4.4)*(myBeat*0.3)))*8.0);
float of = an(tan(p.y*myTime+myBeat)+cos(p.x*myTime-myBeat*r)*cos(myBeat*tan(g*p.x*cos(myBeat*1.0+myTime*10.0)*b*p.y)) * cos(r+myBeat*atan(p.y*myTime*3.0)+p.x*myTime*4.0));
float of2 = an((p.x*cos(p.x+p.y*myTime*0.8)*tan(p.x*myTime)*p.y) * (sin(p.x*myTime*0.8*cos(p.y*myTime*p.x)*myBeat)*sin(p.y*cos(p.x*myTime*myBeat)*p.y*myBeat))*(2.0*myBeat)*p.y);
gl_FragColor = vec4(
(r*of*of2)*of2,
(g*of*of2)+of2,
(b*of*of2)-of2,
1.0);
}
</script>
<script id="shaderfs_letterscene" type="x-shader/x-fragment">
#ifdef GL_ES
precision highp float;
#endif
uniform float time;
uniform float width;
uniform float height;
uniform sampler2D s2d;
uniform float alpha;
uniform float beat;
void main(void) {
vec2 resolution;
resolution.x = width;
resolution.y = height;
vec2 p;
float myTime = time * 0.0002;
p = (gl_FragCoord.xy / resolution.xy) * resolution.xy*10.0;
float x = cos(p.y*0.04+p.x)*0.01+myTime*0.09+(p.x*0.0006);
float y = myTime*0.09+(0.1-gl_FragCoord.y*0.0006*2.03)*cos(myTime+p.y*(cos(myTime*0.4)*0.0025))*1.0;
vec4 c = vec4(0.0);
float b = 0.0005-cos(myTime)*(sin(myTime*0.5)*0.002)-beat*0.0008;
c = c + texture2D(s2d, vec2(x,y));
c = c + texture2D(s2d, vec2(x+2.0*b,y+2.0*b));
c = c + texture2D(s2d, vec2(x+4.0*b,y+4.0*b));
c = c + texture2D(s2d, vec2(x+6.0*b,y+6.0*b));
c = c + texture2D(s2d, vec2(x+8.0*b,y+8.0*b));
c = c + texture2D(s2d, vec2(x-2.0*b,y-2.0*b));
c = c + texture2D(s2d, vec2(x-4.0*b,y-4.0*b));
c = c + texture2D(s2d, vec2(x-6.0*b,y-6.0*b));
c = c + texture2D(s2d, vec2(x+8.0*b,y-8.0*b));
float e = cos(p.x*0.0001+myTime)*sin(p.y*0.0001+myTime);
float f = cos(p.x*0.001+myTime*7.95)*sin(p.y*0.0015+myTime*3.95);
gl_FragColor = vec4(c.r+cos(p.y*0.004)*1.0,c.b*e,c.g*f,(abs(cos(p.y*0.0004+p.x*0.0005+myTime*1.5)*0.01))*c.a);
}
</script>
<script id="shaderfs_tunnelscene" type="x-shader/x-fragment">
#ifdef GL_ES
precision highp float;
#endif
uniform float time;
uniform float width;
uniform float height;
uniform float beat;
uniform float x;
uniform float y;
uniform float z;
uniform float alpha;
void main(void) {
vec2 resolution;
resolution.x = width;
resolution.y = height;
vec2 position = -resolution.xy + 2.0 * gl_FragCoord.xy / resolution.xy * resolution.xy;
float myTime = time*0.0003;
position.x += x*resolution.x;
position.y += y*resolution.y;
float angle = 0.0;
float radius = length(position);
if (position.x != 0.0 && position.y != 0.0) {
angle = degrees(atan(position.y,position.x));
}
float ss = z;
float amod = mod((angle*cos(sin(position.y*0.03+cos(myTime))*sin(position.x*0.008)*position.y*0.00033))+ss*(myTime*3.0)-ss*4.0*log(radius*abs(cos(myTime*0.1))), ss*1.5);
float c = (radius*0.0005)+(radius*0.0002);
if (amod<ss/2.0) {
gl_FragColor = vec4( beat*1.2-c, c*0.75, beat*1.3-c, alpha );
} else {
gl_FragColor = vec4( 0, 0, 0, alpha );
}
}
</script>
<script id="shaderfs_kukkascene" type="x-shader/x-fragment">
#ifdef GL_ES
precision highp float;
#endif
uniform float time;
uniform float width;
uniform float height;
uniform float beat;
uniform float x;
uniform float y;
uniform float z;
uniform float alpha;
float u( float x ) { return (x>0.0)?1.0:0.0; }
void main(void) {
vec2 resolution;
resolution.x = width;
resolution.y = height;
float myTime = time * 0.0007;
vec2 p = (2.0*gl_FragCoord.xy-resolution)/resolution.y;
float a = atan(p.x+cos(myTime*0.75)*0.68,p.y+sin(myTime*0.75)*0.68);
float r = length(p)*.75+sin(myTime)*0.1;
float w = cos(3.1415927*myTime-r*2.0);
float h = 0.5+0.5*cos(12.0*a-w*7.0+r*8.0);
float d = 0.25+0.75*pow(h,1.0*r)*(0.7+0.3*w);
float col = u( d-r ) * sqrt(1.0-r/d)*r*2.5;
col *= 1.25+0.25*cos((12.0*a-w*7.0+tan(myTime)+r*8.0)/3.0);
col *= 1.0 - 0.35*(0.5+0.5*sin(r*30.0))*(0.5+0.5*cos(12.0*a-w*7.0+r*8.0));
gl_FragColor = vec4(
col,
col-h*0.5+r*.2 + 0.35*h*(1.0-r+cos(myTime)),
col-h*r + 0.1*h*(1.0-r+sin(myTime*0.8)),
alpha);
}
</script>
<!-- vertex shaders below -->
<script id="shadervs_fsquad" type="x-shader/x-vertex">
attribute vec3 vertexPosition;
uniform mat4 modelViewMatrix;
uniform mat4 perspectiveMatrix;
varying vec2 pixpos;
void main(void) {
gl_Position = perspectiveMatrix * modelViewMatrix * vec4(vertexPosition, 1.0);
pixpos = (vertexPosition.xy + vec2(0.0, 0.0)) / vec2(2.0, 2.0);
}
</script>
<script id="shadervs_skybox" type="x-shader/x-vertex">
attribute vec3 vertexPosition;
uniform mat4 modelViewMatrix;
uniform mat4 perspectiveMatrix;
varying vec2 pixpos;
void main(void) {
gl_Position = perspectiveMatrix * modelViewMatrix * vec4(vertexPosition, 1.0);
pixpos = (vertexPosition.xy + vec2(1.0, 0.0)) / vec2(2.0, 2.0);
}
</script>
<script type="text/javascript">
var gl;
var vertexBuffer;
var rttFramebuffer;
var rttTexture;
function initGL(canvas) {
try {
gl = canvas.getContext("experimental-webgl");
gl.viewportWidth = canvas.width;
gl.viewportHeight = canvas.height;
var vertices = new Float32Array([ -1., -1., 1., -1., -1., 1., 1., -1., 1., 1., -1., 1.]);
vertexBuffer = gl.createBuffer();
gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer);
} catch(e) { }
if (!gl) {
alert("Bilotrip DarumaGL systems failure. Init failed.");
}
}
function initFramebuffer() {
rttFramebuffer = gl.createFramebuffer();
gl.bindFramebuffer(gl.FRAMEBUFFER, rttFramebuffer);
rttFramebuffer.width = 512;
rttFramebuffer.height = 512;
rttTexture = gl.createTexture();
gl.bindTexture(gl.TEXTURE_2D, rttTexture);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
gl.generateMipmap(gl.TEXTURE_2D);
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, rttFramebuffer.width, rttFramebuffer.height, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
var renderbuffer = gl.createRenderbuffer();
gl.bindRenderbuffer(gl.RENDERBUFFER, renderbuffer);
gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_COMPONENT16, rttFramebuffer.width, rttFramebuffer.height);
gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, rttTexture, 0);
gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.RENDERBUFFER, renderbuffer);
gl.bindTexture(gl.TEXTURE_2D, null);
gl.bindRenderbuffer(gl.RENDERBUFFER, null);
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
if (!gl.isFramebuffer(rttFramebuffer)) {
alert("Invalid framebuffer");
}
gl.bindFramebuffer(gl.FRAMEBUFFER, rttFramebuffer);
var status = gl.checkFramebufferStatus(gl.FRAMEBUFFER);
switch (status) {
case gl.FRAMEBUFFER_COMPLETE:
break;
case gl.FRAMEBUFFER_INCOMPLETE_ATTACHMENT:
alert("Incomplete framebuffer: FRAMEBUFFER_INCOMPLETE_ATTACHMENT");
break;
case gl.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:
alert("Incomplete framebuffer: FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT");
break;
case gl.FRAMEBUFFER_INCOMPLETE_DIMENSIONS:
alert("Incomplete framebuffer: FRAMEBUFFER_INCOMPLETE_DIMENSIONS");
break;
case gl.FRAMEBUFFER_UNSUPPORTED:
alert("Incomplete framebuffer: FRAMEBUFFER_UNSUPPORTED");
break;
default:
alert("Incomplete framebuffer: " + status);
}
}
function getShader(gl, id) {
var shaderScript = document.getElementById(id);
if (!shaderScript) {
return null;
}
var str = "";
var k = shaderScript.firstChild;
while (k) {
if (k.nodeType == 3) {
str += k.textContent;
}
k = k.nextSibling;
}
var shader;
if (shaderScript.type == "x-shader/x-fragment") {
shader = gl.createShader(gl.FRAGMENT_SHADER);
} else if (shaderScript.type == "x-shader/x-vertex") {
shader = gl.createShader(gl.VERTEX_SHADER);
} else {
return null;
}
gl.shaderSource(shader, str);
gl.compileShader(shader);
if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {
alert(gl.getShaderInfoLog(shader));
return null;
}
return shader;
}
function getObjectName(obj) {
var tmp = obj.toString();
return tmp.substring(tmp.indexOf(' ')+1,tmp.indexOf('('));
}
var shaderProgram_fsscene;
var shaderProgram_blurdeformscene;
var shaderProgram_convo;
var shaderProgram_avaruusscene;
var shaderProgram_blurspacescene;
var shaderProgram_analogscene;
var shaderProgram_psykescene;
var shaderProgram_letterscene;
var shaderProgram_fractalscene;
var shaderProgram_mankeliscene;
var shaderProgram_curvescene;
var shaderProgram_skyboxscene;
var shaderProgram_tunnelscene;
var shaderProgram_kukkascene;
function getVertices(z) {
return new Float32Array([
0.0, 2.15-z, 4.0,
-3.0, 2.15-z, 4.0,
-3.0, -3.0+z, 4.0,
-3.0, -3.0+z, 4.0,
3.0, -3.0+z, 4.0,
0.0, 2.15-z, 4.0,
0.0, 2.15-z, 4.0,
3.0, 2.15-z, 4.0,
3.0, -3.0+z, 4.0
]);
}
function linkshader(shaderProgram, fragmentShader, vertexShader, type) {
gl.attachShader(shaderProgram, fragmentShader);
gl.attachShader(shaderProgram, vertexShader);
gl.linkProgram(shaderProgram);
if (!gl.getProgramParameter(shaderProgram, gl.LINK_STATUS)) {
alert("Bilotrip DarumaGL fail: Could not initialise shader program");
alert(gl.getProgramInfoLog(shaderProgram));
} else {
gl.useProgram(shaderProgram);
var vertexPosition = gl.getAttribLocation(shaderProgram, "vertexPosition");
gl.enableVertexAttribArray(vertexPosition);
gl.bufferData(gl.ARRAY_BUFFER, getVertices(0.0), gl.STATIC_DRAW);
if (type == 0) { scw = rttFramebuffer.width; sch = rttFramebuffer.height; }
else { scw = gl.viewportWidth; gl.viewportHeight; }
var fieldOfView = 20.0;
var aspectRatio = scw / sch;
var nearPlane = 1.0;
var farPlane = 10000.0;
var top = nearPlane * Math.tan(fieldOfView * Math.PI / 360.0);
var bottom = -top;
var right = top * aspectRatio;
var left = -right;
var a = (right + left) / (right - left);
var b = (top + bottom) / (top - bottom);
var c = (farPlane + nearPlane) / (farPlane - nearPlane);
var d = (2 * farPlane * nearPlane) / (farPlane - nearPlane);
var x = (2 * nearPlane) / (right - left);
var y = (2 * nearPlane) / (top - bottom);
var perspectiveMatrix = [
x, 0, a, 0,
0, y, b, 0,
0, 0, c, d,
0, 0, -1, 0
];
var modelViewMatrix = [
1, 0, 0, 0,
0, 1, 0, 0,
0, 0, 1, 0,
0, 0, 0, 1
];
var vertexPosAttribLocation = gl.getAttribLocation(shaderProgram, "vertexPosition");
gl.vertexAttribPointer(vertexPosAttribLocation, 3.0, gl.FLOAT, false, 0, 0);
var uModelViewMatrix = gl.getUniformLocation(shaderProgram, "modelViewMatrix");
var uPerspectiveMatrix = gl.getUniformLocation(shaderProgram, "perspectiveMatrix");
gl.uniformMatrix4fv(uModelViewMatrix, false, new Float32Array(perspectiveMatrix));
gl.uniformMatrix4fv(uPerspectiveMatrix, false, new Float32Array(modelViewMatrix));
shaderProgram.widthUniform = gl.getUniformLocation(shaderProgram, "width");
shaderProgram.heightUniform = gl.getUniformLocation(shaderProgram, "height");
shaderProgram.timeUniform = gl.getUniformLocation(shaderProgram, "time");
shaderProgram.beatUniform = gl.getUniformLocation(shaderProgram, "beat");
shaderProgram.beatrunnerUniform = gl.getUniformLocation(shaderProgram, "beat_runner");
shaderProgram.alphaUniform = gl.getUniformLocation(shaderProgram, "alpha");
shaderProgram.xUniform = gl.getUniformLocation(shaderProgram, "x");
shaderProgram.yUniform = gl.getUniformLocation(shaderProgram, "y");
shaderProgram.zUniform = gl.getUniformLocation(shaderProgram, "z");
shaderProgram.layer_alphaUniform = gl.getUniformLocation(shaderProgram, "layer_alpha");
}
}
function initShaders() {
var fragmentShader_fsscene = getShader(gl, "shaderfs_fsscene");
var fragmentShader_blurdeformscene = getShader(gl, "shaderfs_blurdeformscene");
var fragmentShader_convo = getShader(gl, "shaderfs_convo");
var fragmentShader_avaruusscene = getShader(gl, "shaderfs_avaruusscene");
var fragmentShader_blurspacescene = getShader(gl, "shaderfs_blurspacescene");
var fragmentShader_analogscene = getShader(gl, "shaderfs_analogscene");
var fragmentShader_psykescene = getShader(gl, "shaderfs_psykescene");
var fragmentShader_letterscene = getShader(gl, "shaderfs_letterscene");
var fragmentShader_fractalscene = getShader(gl, "shaderfs_fractalscene");
var fragmentShader_mankeliscene = getShader(gl, "shaderfs_mankeliscene");
var fragmentShader_curvescene = getShader(gl, "shaderfs_curvescene");
var fragmentShader_skybox = getShader(gl, "shaderfs_skybox");
var fragmentShader_tunnelscene = getShader(gl, "shaderfs_tunnelscene");
var fragmentShader_kukkascene = getShader(gl, "shaderfs_kukkascene");
var vertexShader_fsquad = getShader(gl, "shadervs_fsquad");
var vertexShader_skybox = getShader(gl, "shadervs_skybox");
shaderProgram_fsscene = gl.createProgram();
shaderProgram_blurdeformscene = gl.createProgram();
shaderProgram_convo = gl.createProgram();
shaderProgram_avaruusscene = gl.createProgram();
shaderProgram_blurspacescene = gl.createProgram();
shaderProgram_analogscene = gl.createProgram();
shaderProgram_psykescene = gl.createProgram();
shaderProgram_letterscene = gl.createProgram();
shaderProgram_fractalscene = gl.createProgram();
shaderProgram_mankeliscene = gl.createProgram();
shaderProgram_curvescene = gl.createProgram();
shaderProgram_skyboxscene = gl.createProgram();
shaderProgram_tunnelscene = gl.createProgram();
shaderProgram_kukkascene = gl.createProgram();
linkshader(shaderProgram_curvescene, fragmentShader_curvescene, vertexShader_fsquad, 0);
linkshader(shaderProgram_fsscene, fragmentShader_fsscene, vertexShader_fsquad, 0);
linkshader(shaderProgram_blurdeformscene, fragmentShader_blurdeformscene, vertexShader_fsquad, 0);
linkshader(shaderProgram_convo, fragmentShader_convo, vertexShader_fsquad, 0);
linkshader(shaderProgram_avaruusscene, fragmentShader_avaruusscene, vertexShader_fsquad, 0);
linkshader(shaderProgram_blurspacescene, fragmentShader_blurspacescene, vertexShader_fsquad, 0);
linkshader(shaderProgram_analogscene, fragmentShader_analogscene, vertexShader_fsquad, 0);
linkshader(shaderProgram_psykescene, fragmentShader_psykescene, vertexShader_fsquad, 0);
linkshader(shaderProgram_letterscene, fragmentShader_letterscene, vertexShader_fsquad, 0);
linkshader(shaderProgram_fractalscene, fragmentShader_fractalscene, vertexShader_fsquad, 0);
linkshader(shaderProgram_mankeliscene, fragmentShader_mankeliscene, vertexShader_fsquad, 0);
linkshader(shaderProgram_skyboxscene, fragmentShader_skybox, vertexShader_skybox, 0);
linkshader(shaderProgram_tunnelscene, fragmentShader_tunnelscene, vertexShader_fsquad, 0);
linkshader(shaderProgram_kukkascene, fragmentShader_kukkascene, vertexShader_fsquad, 0);
}
var spaceTexture;
var letterTexture;
var bilogoTexture;
var eyeTexture;
var catTexture;
var skyboxTexture1;
var skyboxTexture2;
var skyboxTexture3;
var skyboxTexture4;
var skyboxTexture5;
var skyboxTexture6;
var skyboxCube;
var skyboxCount = 0;
var textureCount = 0;
var numTextures = 11;
function initTextures() {
spaceTexture = gl.createTexture();
spaceTexture.image = new Image();
spaceTexture.image.onload = function() {
handleLoadedTexture_space(spaceTexture)
}
spaceTexture.image.src = "bilotrip_gfx/spacetexture.png";
letterTexture = gl.createTexture();
letterTexture.image = new Image();
letterTexture.image.onload = function() {
handleLoadedTexture_letter(letterTexture)
}
letterTexture.image.src = "bilotrip_gfx/letters.png";
bilogoTexture = gl.createTexture();
bilogoTexture.image = new Image();
bilogoTexture.image.onload = function() {
handleLoadedTexture_bilogo(bilogoTexture)
}
bilogoTexture.image.src = "bilotrip_gfx/bilogo.png";
eyeTexture = gl.createTexture();
eyeTexture.image = new Image();
eyeTexture.image.onload = function() {
handleLoadedTexture_eye(eyeTexture)
}
eyeTexture.image.src = "bilotrip_gfx/eye.png"
catTexture = gl.createTexture();
catTexture.image = new Image();
catTexture.image.onload = function() {
handleLoadedTexture_cat(catTexture)
}
catTexture.image.src = "bilotrip_gfx/cat.png"
var i = 0;
skyboxTexture1 = gl.createTexture();
skyboxTexture2 = gl.createTexture();
skyboxTexture3 = gl.createTexture();
skyboxTexture4 = gl.createTexture();
skyboxTexture5 = gl.createTexture();
skyboxTexture6 = gl.createTexture();
skyboxCube = gl.createTexture();
skyboxCube.image = new Image();
skyboxTexture1.image = new Image();
skyboxTexture2.image = new Image();
skyboxTexture3.image = new Image();
skyboxTexture4.image = new Image();
skyboxTexture5.image = new Image();
skyboxTexture6.image = new Image();
skyboxTexture1.image.onload = function() {
handleLoadedTexture_skybox(skyboxTexture1)
}
skyboxTexture2.image.onload = function() {
handleLoadedTexture_skybox(skyboxTexture2)
}
skyboxTexture3.image.onload = function() {
handleLoadedTexture_skybox(skyboxTexture3)
}
skyboxTexture4.image.onload = function() {
handleLoadedTexture_skybox(skyboxTexture4)
}
skyboxTexture5.image.onload = function() {
handleLoadedTexture_skybox(skyboxTexture5)
}
skyboxTexture6.image.onload = function() {
handleLoadedTexture_skybox(skyboxTexture6)
}
skyboxTexture1.image.src = "bilotrip_gfx/newsky1.png";
skyboxTexture2.image.src = "bilotrip_gfx/newsky2.png";
skyboxTexture3.image.src = "bilotrip_gfx/newsky3.png";
skyboxTexture4.image.src = "bilotrip_gfx/newsky4.png";
skyboxTexture5.image.src = "bilotrip_gfx/newsky5.png";
skyboxTexture6.image.src = "bilotrip_gfx/newsky6.png";
}
function handleLoadedTexture_space(texture) {
gl.bindTexture(gl.TEXTURE_2D, texture);
gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true);
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, texture.image);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR_MIPMAP_NEAREST);
gl.generateMipmap(gl.TEXTURE_2D);
gl.bindTexture(gl.TEXTURE_2D, null);
textureCount++;
}
function handleLoadedTexture_letter(texture) {
gl.bindTexture(gl.TEXTURE_2D, texture);
gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true);
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, texture.image);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR_MIPMAP_NEAREST);
gl.generateMipmap(gl.TEXTURE_2D);
gl.bindTexture(gl.TEXTURE_2D, null);
textureCount++;
}
function handleLoadedTexture_bilogo(texture) {
gl.bindTexture(gl.TEXTURE_2D, texture);
gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true);
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, texture.image);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
gl.bindTexture(gl.TEXTURE_2D, null);
textureCount++;
}
function handleLoadedTexture_eye(texture) {
gl.bindTexture(gl.TEXTURE_2D, texture);
gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true);
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, texture.image);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR_MIPMAP_NEAREST);
gl.generateMipmap(gl.TEXTURE_2D);
gl.bindTexture(gl.TEXTURE_2D, null);
textureCount++;
}
function handleLoadedTexture_cat(texture) {
gl.bindTexture(gl.TEXTURE_2D, texture);
gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true);
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, texture.image);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
gl.bindTexture(gl.TEXTURE_2D, null);
textureCount++;
}
function handleLoadedTexture_skybox(texture) {
textureCount++;
skyboxCount++;
if (skyboxCount >= 6) {
gl.bindTexture(gl.TEXTURE_CUBE_MAP, skyboxCube);
gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, skyboxTexture5.image);
gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_X, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, skyboxTexture4.image);
gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Y, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, skyboxTexture2.image);
gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, skyboxTexture6.image);
gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Z, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, skyboxTexture3.image);
gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, skyboxTexture1.image);
gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MIN_FILTER, gl.LINEAR_MIPMAP_NEAREST);
gl.generateMipmap(gl.TEXTURE_CUBE_MAP);
gl.bindTexture(gl.TEXTURE_CUBE_MAP, null);
}
}
var templeVertexPositionBuffer;
var templeVertexNormalBuffer;
var templeVertexTextureCoordBuffer;
var templeVertexIndexBuffer;
function handleLoadedTemple(templeData) {
templeVertexNormalBuffer = gl.createBuffer();
gl.bindBuffer(gl.ARRAY_BUFFER, templeVertexNormalBuffer);
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(templeData.vertexNormals), gl.STATIC_DRAW);
templeVertexNormalBuffer.itemSize = 3;
templeVertexNormalBuffer.numItems = templeData.vertexNormals.length / 3;
templeVertexTextureCoordBuffer = gl.createBuffer();
gl.bindBuffer(gl.ARRAY_BUFFER, templeVertexTextureCoordBuffer);
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(templeData.vertexTextureCoords), gl.STATIC_DRAW);
templeVertexTextureCoordBuffer.itemSize = 2;
templeVertexTextureCoordBuffer.numItems = templeData.vertexTextureCoords.length / 2;
templeVertexPositionBuffer = gl.createBuffer();
gl.bindBuffer(gl.ARRAY_BUFFER, templeVertexPositionBuffer);
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(templeData.vertexPositions), gl.STATIC_DRAW);
templeVertexPositionBuffer.itemSize = 3;
templeVertexPositionBuffer.numItems = templeData.vertexPositions.length / 3;
templeVertexIndexBuffer = gl.createBuffer();
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, templeVertexIndexBuffer);
gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(templeData.indices), gl.STATIC_DRAW);
templeVertexIndexBuffer.itemSize = 1;
templeVertexIndexBuffer.numItems = templeData.indices.length;
}
var date;
var demo_start_time = 0;
var part_start_time = 0;
var timefromlast = 0;
var time = 0;
var low = 0;
var beat = 0;
var demo_beattime = 2958.6/2; //618.55670*4; // 97bpm 2474?!? then 116 must be 2958.6 O_o
var next_beattime = demo_beattime/2;
var beatstart = 0;
var beatend = 0;
var beatflip = 1;
var beat_runner = 0;
var fadecounter = 0;
var feedbackval = 0.0;
var feedbackalpha = 1.0;
var part_counter = 0;
var tl = [];
var feedback = [];
var convolution = [];
var skybox = [];
requestAnimFrame = (function() {
return window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.oRequestAnimationFrame ||
window.msRequestAnimationFrame ||
function(/* function FrameRequestCallback */ callback, /* DOMElement Element */ element) {
window.setTimeout(callback, 1000/60);
};
})();
function lerp(mini, maxi, starti, endi, timei) {
if (timei <= starti) return mini;
if (timei >= endi) return maxi;
var value1 = (timei-starti) / (endi-starti);
var value2 = mini+((maxi-mini)*value1);
return value2;
}
function render_scene(layer, shaderProgram, currentTexture, z, alpha, timeoverride, w,h,xoff) {
if (!alpha) alpha = 1.0;
if (!xoff) xoff = 0.0;
if (w) { scw = w; sch = h; }
else { scw = rttFramebuffer.width; sch = rttFramebuffer.height; }
gl.useProgram(shaderProgram);
gl.activeTexture(gl.TEXTURE0);
gl.bindTexture(gl.TEXTURE_2D, currentTexture);
gl.uniform1i(gl.getUniformLocation(shaderProgram, "s2d"), 0);
gl.uniform1f(shaderProgram.widthUniform, scw);
gl.uniform1f(shaderProgram.heightUniform, sch);
gl.uniform1f(shaderProgram.beatUniform, beat);
gl.uniform1f(shaderProgram.beatrunnerUniform, beat_runner);
gl.uniform1f(shaderProgram.timeUniform, finetime);
// timeline values
if (tl[part_counter][layer]) {
if (tl[part_counter][layer].x) gl.uniform1f(shaderProgram.xUniform,tl[part_counter][layer].x);
if (tl[part_counter][layer].y) gl.uniform1f(shaderProgram.yUniform,tl[part_counter][layer].y);
if (tl[part_counter][layer].z) gl.uniform1f(shaderProgram.zUniform,tl[part_counter][layer].z);
if (tl[part_counter][layer].layer_alpha) gl.uniform1f(shaderProgram.layer_alphaUniform,tl[part_counter][layer].layer_alpha);
}
///////////////////////
gl.uniform1f(shaderProgram.alphaUniform, alpha);
gl.drawArrays(gl.TRIANGLES, 0, 9);
}
function skybox_scene(layer, shaderProgram, currentTexture, z, alpha, timeoverride, w,h,xoff) {
if (!alpha) alpha = 1.0;
if (!xoff) xoff = 0.0;
scw = gl.viewportWidth;
sch = gl.viewportHeight;
gl.useProgram(shaderProgram);
gl.activeTexture(gl.TEXTURE0);
gl.bindTexture(gl.TEXTURE_CUBE_MAP, currentTexture);
gl.uniform1i(gl.getUniformLocation(shaderProgram, "scube"), 0);
gl.activeTexture(gl.TEXTURE1);
gl.bindTexture(gl.TEXTURE_2D, rttTexture);
gl.uniform1i(gl.getUniformLocation(shaderProgram, "s2d"), 1);
gl.uniform1f(shaderProgram.widthUniform, scw);
gl.uniform1f(shaderProgram.heightUniform, sch);
gl.uniform1f(shaderProgram.timeUniform, finetime);
gl.uniform1f(shaderProgram.alphaUniform, skybox.alpha);
gl.uniform1f(shaderProgram.beatUniform, beat);
gl.uniform1f(shaderProgram.beatrunnerUniform, beat_runner);
// timeline values
if (tl[part_counter][layer]) {
if (tl[part_counter][layer].x) gl.uniform1f(shaderProgram.xUniform,tl[part_counter][layer].x);
if (tl[part_counter][layer].y) gl.uniform1f(shaderProgram.yUniform,tl[part_counter][layer].y);
if (tl[part_counter][layer].z) gl.uniform1f(shaderProgram.zUniform,tl[part_counter][layer].z);
}
///////////////////////
gl.drawArrays(gl.TRIANGLES, 0, 9);
}
function fs_scene(layer, shaderProgram, currentTexture, z, alpha, timeoverride, w,h,xoff, kernel) {
if (!alpha) alpha = 1.0;
if (!xoff) xoff = 0.0;
if (w) { scw = w; sch = h; }
else { scw = rttFramebuffer.width; sch = rttFramebuffer.height; }
gl.useProgram(shaderProgram);
gl.activeTexture(gl.TEXTURE0);
gl.bindTexture(gl.TEXTURE_2D, currentTexture);
gl.uniform1i(gl.getUniformLocation(shaderProgram, "s2d"), 0);
gl.uniform1f(shaderProgram.widthUniform, scw);
gl.uniform1f(shaderProgram.heightUniform, sch);
gl.uniform1f(shaderProgram.timeUniform, finetime);
gl.uniform1f(shaderProgram.beatUniform, beat);
gl.uniform1f(shaderProgram.beatrunnerUniform, beat_runner);
gl.uniform1f(shaderProgram.alphaUniform, alpha);
if (kernel) {
var j;
var loc = Array(9);
for (j=0;j<9;j++) {
loc[j] = gl.getUniformLocation(shaderProgram, "kernel"+(j+1));
gl.uniform1f(loc[j], kernel[j]);
}
shaderProgram.convoUniform = gl.getUniformLocation(shaderProgram, "effect");
gl.uniform1f(shaderProgram.convoUniform,convolution.effect);
}
// timeline values
if (tl[part_counter][layer]) {
if (tl[part_counter][layer].x) gl.uniform1f(shaderProgram.xUniform,tl[part_counter][layer].x);
if (tl[part_counter][layer].y) gl.uniform1f(shaderProgram.yUniform,tl[part_counter][layer].y);
if (tl[part_counter][layer].z) gl.uniform1f(shaderProgram.zUniform,tl[part_counter][layer].z);
if (tl[part_counter][layer].layer_alpha) gl.uniform1f(shaderProgram.layer_alphaUniform,tl[part_counter][layer].layer_alpha);
}
gl.drawArrays(gl.TRIANGLES, 0, 9);
}
function endDemo() {
gl.bindFramebuffer(gl.FRAMEBUFFER, rttFramebuffer);
gl.viewport(0, 0, gl.viewportWidth, gl.viewportHeight);
gl.clearColor(0.0, 0.0, 0.0, 1.0);
gl.clear(gl.COLOR_BUFFER_BIT + gl.DEPTH_BUFFER_BIT);
}
var effects = [];
var sharpkernel;
function initEffects() {
tl = new Array(25); // 25 scenes
for(var i=0;i<tl.length;i++) tl[i] = new Array(3);
feedback.push({amount:0, alpha:0});
convolution.push({effect:0});
skybox.push({alpha:0});
anim("feedback",feedback).to({"amount":0.8},0).to({"amount":0.8},0, Timeline.Easing.Quadratic.EaseIn).to({"amount":0.8},0, Timeline.Easing.Quadratic.EaseIn).to({"amount":1},12.504600044438327, Timeline.Easing.Quadratic.EaseIn).to({"amount":1},0, Timeline.Easing.Cubic.EaseInOut).to({"amount":1},0, Timeline.Easing.Cubic.EaseInOut).to({"amount":1},9.635399955561677, Timeline.Easing.Cubic.EaseInOut).to({"amount":1},0, Timeline.Easing.Cubic.EaseInOut).to({"amount":1},0, Timeline.Easing.Cubic.EaseInOut).to({"amount":0.86133620680685},7.374600044438324, Timeline.Easing.Cubic.EaseInOut).to({"amount":0.86133620680685},0).to({"amount":0.86133620680685},0).to({"amount":0.5},9.81539995556167).to({"amount":0.5},0).to({"amount":0.5},0).to({"amount":0.9},0.720000000000006).to({"amount":0.9},0).to({"amount":0.9},0).to({"amount":1},25.449999999999996).to({"amount":0.9797005351473923},34.94, Timeline.Easing.Quadratic.EaseIn).to({"amount":0},18.360000000000014, Timeline.Easing.Quadratic.EaseIn).to({"amount":2},21.682463614823575, Timeline.Easing.Cubic.EaseOut).to({"amount":3},0.49736842105264145, Timeline.Easing.Cubic.EaseIn).to({"amount":4},0.6252631578947501, Timeline.Easing.Cubic.EaseIn).to({"amount":5},0.6110526315789286, Timeline.Easing.Cubic.EaseIn).to({"amount":6},0.4916749165053318, Timeline.Easing.Cubic.EaseIn).to({"amount":6},2.6999999999999886, Timeline.Easing.Cubic.EaseIn).to({"amount":2},4.860000000000014, Timeline.Easing.Cubic.EaseIn).to({"amount":1},10.664999999999992, Timeline.Easing.Cubic.EaseIn).to({"amount":0.98},17.887500000000017);
anim("feedback",feedback).to({"alpha":0},0).to({"alpha":0},0).to({"alpha":0},0).to({"alpha":0.9},12.5).to({"alpha":0.9},0, Timeline.Easing.Cubic.EaseInOut).to({"alpha":0.9},0, Timeline.Easing.Cubic.EaseInOut).to({"alpha":0.9267500531829455},10.13460004443833, Timeline.Easing.Cubic.EaseInOut).to({"alpha":0.9267500531829455},0, Timeline.Easing.Cubic.EaseInOut).to({"alpha":0.9267500531829455},0, Timeline.Easing.Cubic.EaseInOut).to({"alpha":1},7.3877715540263935, Timeline.Easing.Cubic.EaseInOut).to({"alpha":1},0, Timeline.Easing.Cubic.EaseInOut).to({"alpha":1},0, Timeline.Easing.Cubic.EaseInOut).to({"alpha":1},10.259999999999998, Timeline.Easing.Cubic.EaseInOut).to({"alpha":1},0).to({"alpha":1},0).to({"alpha":0},79.71762840153528).to({"alpha":0.660790273556231},22.74000000000001).to({"alpha":0.2},9.539999999999992).to({"alpha":0.3},10.800000000000011);
anim("convolution",convolution).to({"effect":1},0).to({"effect":1},12.690000000000001).to({"effect":1},3.780000000000001).to({"effect":1},28.350000000000005).to({"effect":0},75.17999999999999).to({"effect":10},49);
anim("skybox",skybox).to({"alpha":0},0).to({"alpha":0},0).to({"alpha":0},196.2).to({"alpha":1},30.404732142857142).to({"alpha":0},57.25526785714288);
var scenecounter = 0;
// scene 1
var scene1_psyke = new Object;
var scene1_letter = new Object;
scene1_psyke = tl[scenecounter][1];
scene1_letter = tl[scenecounter][2];
scenecounter++;
// cut and paste export to here
anim("scene1_psyke",scene1_psyke).to({"x":10},0).to({"x":10000},59);
anim("scene1_psyke",scene1_psyke).to({"y":0},0).to({"y":1000},73, Timeline.Easing.Cubic.EaseOut);
anim("scene1_psyke",scene1_psyke).to({"z":10},0).to({"z":0},41.5);
anim("scene1_letter",scene1_letter).to({"x":100},0).to({"x":1000},11);
anim("scene1_letter",scene1_letter).to({"y":10},0).to({"y":1000},43.5);
anim("scene1_letter",scene1_letter).to({"z":1},0).to({"z":1},40.5, Timeline.Easing.Cubic.EaseOut);
effects.push(" \
gl.enable(gl.BLEND); \
gl.blendFunc(gl.SRC_ALPHA, gl.DST_COLOR); \
render_scene(1,shaderProgram_psykescene, spaceTexture,0.01, 1.00, timefromstart); \
gl.blendFunc(gl.SRC_ALPHA, gl.DST_COLOR); \
render_scene(2,shaderProgram_letterscene, letterTexture,0.01); \
");
effects.push(0);
effects.push(76500);
// scene 2
var scene2_blurspace = new Object;
var scene2_letter = new Object;
var scene2_psyke = new Object;
scene2_blurspace = tl[scenecounter][0];
scene2_letter = tl[scenecounter][2];
scene2_psyke = tl[scenecounter][2];
scenecounter++;
// cut and paste export to here
anim("scene2_blurspace",scene2_blurspace).to({"x":100},0).to({"x":1000},11);
anim("scene2_blurspace",scene2_blurspace).to({"y":10},0).to({"y":1000},43.5);
anim("scene2_blurspace",scene2_blurspace).to({"z":1},0).to({"z":1},40.5, Timeline.Easing.Cubic.EaseOut);
anim("scene2_letter",scene2_letter).to({"x":100},0).to({"x":1000},11);
anim("scene2_letter",scene2_letter).to({"y":10},0).to({"y":1000},43.5);
anim("scene2_letter",scene2_letter).to({"z":1},0).to({"z":1},40.5, Timeline.Easing.Cubic.EaseOut);
anim("scene2_psyke",scene2_psyke).to({"x":10},0).to({"x":10000},59);
anim("scene2_psyke",scene2_psyke).to({"y":0},0).to({"y":1000},73, Timeline.Easing.Cubic.EaseOut);
anim("scene2_psyke",scene2_psyke).to({"z":10},0).to({"z":0},41.5);
effects.push(" \
gl.enable(gl.BLEND); \
gl.blendFunc(gl.SRC_COLOR, gl.DST_ALPHA); \
render_scene(0,shaderProgram_blurspacescene, spaceTexture,0.01); \
gl.blendFunc(gl.SRC_ALPHA, gl.DST_COLOR); \
render_scene(2,shaderProgram_letterscene, letterTexture,0.01); \
gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_DST_COLOR); \
render_scene(2,shaderProgram_psykescene, spaceTexture,0.01, 1.00, timefromstart); \
gl.blendFunc(gl.ONE_MINUS_SRC_COLOR, gl.ONE_MINUS_DST_ALPHA); \
render_scene(2,shaderProgram_psykescene, spaceTexture,0.01, 1.00, timefromstart); \
");
effects.push(76500);
effects.push(87000);
// scene 3
var scene3_blurspace = new Object;
var scene3_mankeli = new Object;
var scene3_letter = new Object;
var scene3_psyke = new Object;
scene3_blurspace = tl[scenecounter][0];
scene3_mankeli = tl[scenecounter][1];
scene3_letter = tl[scenecounter][2];
scene3_psyke = tl[scenecounter][2];
scenecounter++;
// cut and paste export to here
anim("scene3_blurspace",scene3_blurspace).to({"x":100},0).to({"x":1000},11);
anim("scene3_blurspace",scene3_blurspace).to({"y":10},0).to({"y":1000},43.5);
anim("scene3_blurspace",scene3_blurspace).to({"z":1},0).to({"z":1},40.5, Timeline.Easing.Cubic.EaseOut);
anim("scene3_marcher",scene3_mankeli).to(121.5,{"x":0},0).to({"x":0},0).to({"x":0},0).to({"x":0},62.5);
anim("scene3_marcher",scene3_mankeli).to(121.5,{"y":0},0).to({"y":0},0).to({"y":0},0).to({"y":0},61.5);
anim("scene3_marcher",scene3_mankeli).to(-1.5,{"z":1},0).to({"z":1},122.5).to({"z":1},38);
anim("scene3_letter",scene3_letter).to({"x":100},0).to({"x":1000},11);
anim("scene3_letter",scene3_letter).to({"y":10},0).to({"y":1000},43.5);
anim("scene3_letter",scene3_letter).to({"z":1},0).to({"z":1},40.5, Timeline.Easing.Cubic.EaseOut);
anim("scene3_psyke",scene3_psyke).to({"x":10},0).to({"x":10000},59);
anim("scene3_psyke",scene3_psyke).to({"y":0},0).to({"y":1000},73, Timeline.Easing.Cubic.EaseOut);
anim("scene3_psyke",scene3_psyke).to({"z":10},0).to({"z":0},41.5);
// scene 3
effects.push(" \
gl.enable(gl.BLEND); \
gl.blendFunc(gl.SRC_COLOR, gl.DST_ALPHA); \
render_scene(0,shaderProgram_blurspacescene, spaceTexture,0.01); \
gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_DST_COLOR); \
render_scene(1,shaderProgram_mankeliscene, rttTexture, 0.01); \
gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_DST_COLOR); \
render_scene(2,shaderProgram_letterscene, letterTexture,0.01); \
gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_DST_COLOR); \
render_scene(2,shaderProgram_psykescene, spaceTexture,0.01, 1.00, timefromstart); \
gl.blendFunc(gl.ONE_MINUS_SRC_COLOR, gl.ONE_MINUS_DST_ALPHA); \
render_scene(2,shaderProgram_psykescene, spaceTexture,0.01, 1.00, timefromstart); \
gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_DST_COLOR); \
render_scene(1,shaderProgram_mankeliscene, rttTexture, 0.01); \
");
effects.push(87000);
//effects.push(164500);
effects.push(295000);
/*
// cut and paste export to here
anim("scene1_space",scene1_space).to({"x":100},0).to({"x":1000},11);
anim("scene1_space",scene1_space).to({"y":10},0).to({"y":1000},43.5);
anim("scene1_space",scene1_space).to({"z":1},0).to({"z":1},40.5, Timeline.Easing.Cubic.EaseOut);
anim("scene1_psyke",scene1_psyke).to({"x":10},0).to({"x":10000},59);
anim("scene1_psyke",scene1_psyke).to({"y":0},0).to({"y":1000},73, Timeline.Easing.Cubic.EaseOut);
anim("scene1_psyke",scene1_psyke).to({"z":10},0).to({"z":0},41.5);
//anim("scene1_bilogo",scene1_bilogo).to({"layer_alpha":0},0).to({"layer_alpha":0.7},11).to({"layer_alpha":0.7},26.5).to({"layer_alpha":0.98},2.5);
anim("scene2_fractal",scene2_fractal).to({"x":0},0).to({"x":0},34).to({"x":-1},25, Timeline.Easing.Cubic.EaseOut).to({"x":0.3091604828735536},2.524563170694975).to({"x":-0.1},2.533846153846156, Timeline.Easing.Cubic.EaseOut).to({"x":-0.8},14.538461538461533).to({"x":0.1},1.8276923076923168, Timeline.Easing.Quadratic.EaseIn).to({"x":0.5},7.6033211654046085).to({"x":0.4},4.859999999999985).to({"x":0.4},8.099999999999994).to({"x":2.5},17.82000000000002, Timeline.Easing.Quadratic.EaseIn);
anim("scene2_fractal",scene2_fractal).to({"y":10},0).to({"y":10},36.5).to({"y":10},23.979999999999997).to({"y":1},4.159947786079606, Timeline.Easing.Cubic.EaseOut).to({"y":0.4},8.598461538461521).to({"y":0},3.73846153846155).to({"y":0},11.043129136997337, Timeline.Easing.Elastic.EaseInOut).to({"y":0},7.243884336099569, Timeline.Easing.Elastic.EaseInOut).to({"y":0},3.240000000000009, Timeline.Easing.Elastic.EaseInOut);
anim("scene2_fractal",scene2_fractal).to({"z":10},0).to({"z":10},38).to({"z":10},5).to({"z":9},16.5).to({"z":9},0.697276371715617).to({"z":15},18.648825260517825).to({"z":0.007420094043132498},2.6169230769230722, Timeline.Easing.Cubic.EaseOut).to({"z":0.9062022177296598},0.19285962694306136, Timeline.Easing.Back.EaseIn).to({"z":50},16.956000000000017, Timeline.Easing.Back.EaseOut).to({"z":10},15.012).to({"z":10},88.8761156639004);
anim("scene3_marcher",scene3_marcher).to(121.5,{"x":0},0).to({"x":0},0).to({"x":0},0).to({"x":0},62.5);
anim("scene3_marcher",scene3_marcher).to(121.5,{"y":0},0).to({"y":0},0).to({"y":0},0).to({"y":0},61.5);
anim("scene3_marcher",scene3_marcher).to(-1.5,{"z":1},0).to({"z":1},122.5).to({"z":1},38);
anim("scene4_eye",scene4_eye).to(158.40163263881547,{"z":0},0).to({"z":0},0).to({"z":2},0).to({"z":-0.997},22.119427612819692).to({"z":-0.997},9.978939748364837, Timeline.Easing.Quadratic.EaseIn).to({"z":-3},10.514999999999986).to({"z":0},1.0934046559812316, Timeline.Easing.Cubic.EaseOut).to({"z":-3},71.9415953440188);
anim("scene5_cat",scene5_cat).to(196.3304046559812,{"z":0},0).to({"z":0},0).to({"z":0},0).to({"z":0},0).to({"z":0},5.669595344018802).to({"z":0.3},5.684351647934392).to({"z":1},4.315648352065608).to({"z":1.01},11.632265909781324).to({"z":1.02},11.367734090218676).to({"z":1},53);
anim("scene5_skybox",scene5_skybox).to({"x":100},0).to({"x":1000},11);
anim("scene5_skybox",scene5_skybox).to({"y":100},0).to({"y":1000},11);
anim("scene5_skybox",scene5_skybox).to({"z":100},0).to({"z":1000},11);
anim("scene6_skybox",scene6_skybox).to({"x":100},0).to({"x":1000},11);
anim("scene6_skybox",scene6_skybox).to({"y":100},0).to({"y":1000},11);
anim("scene6_skybox",scene6_skybox).to({"z":100},0).to({"z":1000},11);
// anim("feedback",feedback).to({"amount":0.8},0).to({"amount":0.8},0, Timeline.Easing.Quadratic.EaseIn).to({"amount":0.8},0, Timeline.Easing.Quadratic.EaseIn).to({"amount":1},12.504600044438327, Timeline.Easing.Quadratic.EaseIn).to({"amount":1},0, Timeline.Easing.Cubic.EaseInOut).to({"amount":1},0, Timeline.Easing.Cubic.EaseInOut).to({"amount":1},9.635399955561677, Timeline.Easing.Cubic.EaseInOut).to({"amount":1},0, Timeline.Easing.Cubic.EaseInOut).to({"amount":1},0, Timeline.Easing.Cubic.EaseInOut).to({"amount":0.86133620680685},7.374600044438324, Timeline.Easing.Cubic.EaseInOut).to({"amount":0.86133620680685},0).to({"amount":0.86133620680685},0).to({"amount":0.5},9.81539995556167).to({"amount":0.5},0).to({"amount":0.5},0).to({"amount":0.9},0.720000000000006).to({"amount":0.9},0).to({"amount":0.9},0).to({"amount":1},25.449999999999996).to({"amount":0.9797005351473923},34.94, Timeline.Easing.Quadratic.EaseIn).to({"amount":0},18.360000000000014, Timeline.Easing.Quadratic.EaseIn).to({"amount":2},21.682463614823575, Timeline.Easing.Cubic.EaseOut).to({"amount":3},0.49736842105264145, Timeline.Easing.Cubic.EaseIn).to({"amount":4},0.6252631578947501, Timeline.Easing.Cubic.EaseIn).to({"amount":5},0.6110526315789286, Timeline.Easing.Cubic.EaseIn).to({"amount":6},0.4916749165053318, Timeline.Easing.Cubic.EaseIn).to({"amount":6},2.6999999999999886, Timeline.Easing.Cubic.EaseIn).to({"amount":2},4.860000000000014, Timeline.Easing.Cubic.EaseIn).to({"amount":1},10.664999999999992, Timeline.Easing.Cubic.EaseIn).to({"amount":0.98},17.887500000000017);
// anim("feedback",feedback).to({"alpha":0},0).to({"alpha":0},0).to({"alpha":0},0).to({"alpha":0.9},12.5).to({"alpha":0.9},0, Timeline.Easing.Cubic.EaseInOut).to({"alpha":0.9},0, Timeline.Easing.Cubic.EaseInOut).to({"alpha":0.9267500531829455},10.13460004443833, Timeline.Easing.Cubic.EaseInOut).to({"alpha":0.9267500531829455},0, Timeline.Easing.Cubic.EaseInOut).to({"alpha":0.9267500531829455},0, Timeline.Easing.Cubic.EaseInOut).to({"alpha":1},7.3877715540263935, Timeline.Easing.Cubic.EaseInOut).to({"alpha":1},0, Timeline.Easing.Cubic.EaseInOut).to({"alpha":1},0, Timeline.Easing.Cubic.EaseInOut).to({"alpha":1},10.259999999999998, Timeline.Easing.Cubic.EaseInOut).to({"alpha":1},0).to({"alpha":1},0).to({"alpha":0},79.71762840153528).to({"alpha":0.660790273556231},22.74000000000001).to({"alpha":0.2},9.539999999999992).to({"alpha":0.3},10.800000000000011);
// anim("convolution",convolution).to({"effect":1},0).to({"effect":1},12.690000000000001).to({"effect":1},3.780000000000001).to({"effect":1},28.350000000000005).to({"effect":0},75.17999999999999).to({"effect":10},49);
// anim("skybox",skybox).to({"alpha":0},0).to({"alpha":0},0).to({"alpha":0},196.2).to({"alpha":1},30.404732142857142).to({"alpha":0},57.25526785714288);
anim("scene21_space",scene21_space).to({"x":100},0).to({"x":1000},11);
anim("scene21_space",scene21_space).to({"y":10},0).to({"y":1000},43.5);
anim("scene21_space",scene21_space).to({"z":1},0).to({"z":1},40.5, Timeline.Easing.Cubic.EaseOut);
anim("scene21_psyke",scene21_psyke).to({"x":10},0).to({"x":10000},59);
anim("scene21_psyke",scene21_psyke).to({"y":0},0).to({"y":1000},73, Timeline.Easing.Cubic.EaseOut);
anim("scene21_psyke",scene21_psyke).to({"z":10},0).to({"z":0},41.5);
anim("scene22_space",scene22_space).to({"x":100},0).to({"x":1000},11);
anim("scene22_space",scene22_space).to({"y":10},0).to({"y":1000},43.5);
anim("scene22_space",scene22_space).to({"z":1},0).to({"z":1},40.5, Timeline.Easing.Cubic.EaseOut);
anim("scene22_psyke",scene22_psyke).to({"x":10},0).to({"x":10000},59);
anim("scene22_psyke",scene22_psyke).to({"y":0},0).to({"y":1000},73, Timeline.Easing.Cubic.EaseOut);
anim("scene22_psyke",scene22_psyke).to({"z":10},0).to({"z":0},41.5);
var dummy = [];
anim("dummy",dummy).to({"dummy":0},0).to({"dummy":0},0);
// export end
// SCENES
// scene 4
effects.push(" \
gl.enable(gl.BLEND); \
gl.blendFunc(gl.SRC_ALPHA, gl.DST_ALPHA); \
render_scene(1,shaderProgram_fsscene, eyeTexture, 0.01, 0.3); \
gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_DST_COLOR); \
render_scene(2,shaderProgram_psykescene, spaceTexture,0.01, 1.00, timefromstart); \
gl.blendFunc(gl.ONE_MINUS_SRC_COLOR, gl.ONE_MINUS_DST_ALPHA); \
render_scene(2,shaderProgram_psykescene, spaceTexture,0.01, 1.00, timefromstart); \
");
effects.push(164500);
effects.push(202800);
// scene 5
effects.push(" \
gl.enable(gl.BLEND); \
gl.blendFunc(gl.SRC_ALPHA, gl.DST_ALPHA); \
render_scene(1,shaderProgram_fsscene, eyeTexture, 0.01, 0.3); \
gl.blendFunc(gl.SRC_COLOR, gl.ONE_MINUS_DST_COLOR); \
render_scene(0,shaderProgram_avaruusscene, spaceTexture, 0.01); \
");
effects.push(202800);
effects.push(215000);
// scene 6
effects.push(" \
gl.enable(gl.BLEND); \
gl.blendFunc(gl.SRC_ALPHA, gl.DST_ALPHA); \
render_scene(1,shaderProgram_fsscene, eyeTexture, 0.01, 0.3); \
gl.blendFunc(gl.SRC_COLOR, gl.ONE_MINUS_DST_COLOR); \
render_scene(0,shaderProgram_avaruusscene, spaceTexture,0.01); \
gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_DST_COLOR); \
render_scene(2,shaderProgram_psykescene, spaceTexture,0.01, 1.00, timefromstart); \
gl.blendFunc(gl.ONE_MINUS_SRC_COLOR, gl.ONE_MINUS_DST_ALPHA); \
render_scene(2,shaderProgram_psykescene, spaceTexture,0.01, 1.00, timefromstart); \
");
effects.push(215000);
effects.push(218000);
// scene 7
effects.push(" \
gl.enable(gl.BLEND); \
gl.blendFunc(gl.SRC_ALPHA, gl.DST_ALPHA); \
render_scene(1,shaderProgram_fsscene, eyeTexture, 0.01, 0.3); \
gl.blendFunc(gl.SRC_COLOR, gl.ONE_MINUS_DST_COLOR); \
render_scene(0,shaderProgram_avaruusscene, spaceTexture,0.01); \
gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_DST_ALPHA); \
render_scene(1,shaderProgram_analogscene, rttTexture, 0.01); \
");
effects.push(218000);
effects.push(221000);
// scene 8
effects.push(" \
gl.enable(gl.BLEND); \
gl.blendFunc(gl.SRC_ALPHA, gl.DST_ALPHA); \
render_scene(1,shaderProgram_fsscene, eyeTexture, 0.01, 0.3); \
gl.blendFunc(gl.SRC_COLOR, gl.ONE_MINUS_DST_COLOR); \
render_scene(0,shaderProgram_avaruusscene, spaceTexture,0.01); \
gl.blendFunc(gl.ONE_MINUS_SRC_COLOR, gl.ONE_MINUS_DST_ALPHA); \
render_scene(0,shaderProgram_curvescene, spaceTexture,0.01, 1.00, timefromstart); \
gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_DST_ALPHA); \
render_scene(1,shaderProgram_analogscene, rttTexture, 0.01); \
");
effects.push(221000);
effects.push(224000);
// scene 9
effects.push(" \
gl.enable(gl.BLEND); \
gl.blendFunc(gl.SRC_ALPHA, gl.DST_ALPHA); \
render_scene(1,shaderProgram_fsscene, eyeTexture, 0.01, 0.3); \
gl.blendFunc(gl.SRC_COLOR, gl.ONE_MINUS_DST_COLOR); \
render_scene(0,shaderProgram_avaruusscene, spaceTexture,0.01); \
gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_DST_COLOR); \
render_scene(2,shaderProgram_psykescene, spaceTexture,0.01, 1.00, timefromstart); \
gl.blendFunc(gl.ONE_MINUS_SRC_COLOR, gl.ONE_MINUS_DST_ALPHA); \
render_scene(2,shaderProgram_psykescene, spaceTexture,0.01, 1.00, timefromstart); \
gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_DST_COLOR); \
render_scene(0,shaderProgram_analogscene, rttTexture, 0.01); \
");
effects.push(224000);
effects.push(227000);
// scene 10
effects.push(" \
gl.enable(gl.BLEND); \
gl.blendFunc(gl.SRC_ALPHA, gl.DST_ALPHA); \
render_scene(1,shaderProgram_fsscene, eyeTexture, 0.01, 0.3); \
gl.blendFunc(gl.SRC_COLOR, gl.ONE_MINUS_DST_COLOR); \
render_scene(0,shaderProgram_avaruusscene, spaceTexture,0.01); \
");
effects.push(227000);
effects.push(233500);
// scene 11
effects.push(" \
gl.enable(gl.BLEND); \
gl.blendFunc(gl.SRC_ALPHA, gl.DST_ALPHA); \
render_scene(1,shaderProgram_fsscene, eyeTexture, 0.01, 0.3); \
gl.blendFunc(gl.SRC_COLOR, gl.ONE_MINUS_DST_COLOR); \
render_scene(0,shaderProgram_avaruusscene, spaceTexture,0.01); \
gl.blendFunc(gl.ONE_MINUS_SRC_COLOR, gl.ONE_MINUS_DST_ALPHA); \
render_scene(2,shaderProgram_curvescene, spaceTexture,0.01, 1.00, timefromstart); \
gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_DST_ALPHA); \
render_scene(1,shaderProgram_analogscene, rttTexture, 0.01); \
");
effects.push(233500);
effects.push(240000);
// scene 12
effects.push(" \
gl.enable(gl.BLEND); \
gl.blendFunc(gl.SRC_ALPHA, gl.DST_ALPHA); \
render_scene(1,shaderProgram_fsscene, eyeTexture, 0.01, 0.3); \
gl.blendFunc(gl.SRC_COLOR, gl.ONE_MINUS_DST_COLOR); \
render_scene(0,shaderProgram_avaruusscene, spaceTexture,0.01); \
gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_DST_COLOR); \
render_scene(2,shaderProgram_psykescene, spaceTexture,0.01, 1.00, timefromstart); \
gl.blendFunc(gl.ONE_MINUS_SRC_COLOR, gl.ONE_MINUS_DST_ALPHA); \
render_scene(2,shaderProgram_psykescene, spaceTexture,0.01, 1.00, timefromstart); \
gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_DST_COLOR); \
render_scene(0,shaderProgram_analogscene, rttTexture, 0.01); \
");
effects.push(240000);
effects.push(246000);
// scene 13
effects.push(" \
gl.enable(gl.BLEND); \
gl.blendFunc(gl.SRC_ALPHA, gl.DST_ALPHA); \
render_scene(1,shaderProgram_fsscene, eyeTexture, 0.01, 0.3); \
gl.blendFunc(gl.SRC_COLOR, gl.ONE_MINUS_DST_COLOR); \
render_scene(0,shaderProgram_avaruusscene, spaceTexture,0.01); \
gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_DST_COLOR); \
render_scene(2,shaderProgram_psykescene, spaceTexture,0.01, 1.00, timefromstart); \
gl.blendFunc(gl.ONE_MINUS_SRC_COLOR, gl.ONE_MINUS_DST_ALPHA); \
render_scene(2,shaderProgram_psykescene, spaceTexture,0.01, 1.00, timefromstart); \
");
effects.push(246000);
effects.push(253000);
// scene 14
effects.push(" \
gl.enable(gl.BLEND); \
gl.blendFunc(gl.SRC_COLOR, gl.DST_COLOR); \
render_scene(1,shaderProgram_kukkascene, catTexture, 0.01, 0.3); \
");
effects.push(253000);
effects.push(256000);
// scene 15
effects.push(" \
gl.enable(gl.BLEND); \
gl.blendFunc(gl.SRC_ALPHA, gl.DST_ALPHA); \
render_scene(1,shaderProgram_fsscene, eyeTexture, 0.01, 0.3); \
gl.blendFunc(gl.SRC_COLOR, gl.ONE_MINUS_DST_COLOR); \
render_scene(0,shaderProgram_avaruusscene, spaceTexture,0.01); \
gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_DST_ALPHA); \
render_scene(1,shaderProgram_analogscene, rttTexture, 0.01); \
");
effects.push(256000);
effects.push(259000);
// scene 16
effects.push(" \
gl.enable(gl.BLEND); \
gl.blendFunc(gl.SRC_COLOR, gl.DST_COLOR); \
render_scene(1,shaderProgram_kukkascene, catTexture, 0.01, 0.3); \
");
effects.push(259000);
effects.push(262000);
// scene 17
effects.push(" \
gl.enable(gl.BLEND); \
gl.blendFunc(gl.SRC_ALPHA, gl.DST_ALPHA); \
render_scene(1,shaderProgram_fsscene, eyeTexture, 0.01, 0.3); \
gl.blendFunc(gl.SRC_COLOR, gl.ONE_MINUS_DST_COLOR); \
render_scene(0,shaderProgram_avaruusscene, spaceTexture,0.01); \
gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_DST_COLOR); \
render_scene(2,shaderProgram_psykescene, spaceTexture,0.01, 1.00, timefromstart); \
gl.blendFunc(gl.ONE_MINUS_SRC_COLOR, gl.ONE_MINUS_DST_ALPHA); \
render_scene(2,shaderProgram_psykescene, spaceTexture,0.01, 1.00, timefromstart); \
gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_DST_COLOR); \
render_scene(0,shaderProgram_analogscene, rttTexture, 0.01); \
");
effects.push(262000);
effects.push(265000);
// scene 18
effects.push(" \
gl.enable(gl.BLEND); \
gl.blendFunc(gl.SRC_COLOR, gl.DST_COLOR); \
render_scene(1,shaderProgram_kukkascene, catTexture, 0.01, 0.3); \
");
effects.push(265000);
effects.push(268000);
// scene 19
effects.push(" \
gl.enable(gl.BLEND); \
gl.blendFunc(gl.SRC_ALPHA, gl.DST_ALPHA); \
render_scene(1,shaderProgram_fsscene, catTexture, 0.01, 0.3); \
gl.blendFunc(gl.SRC_COLOR, gl.ONE_MINUS_DST_COLOR); \
render_scene(0,shaderProgram_avaruusscene, spaceTexture,0.01); \
");
effects.push(268000);
effects.push(271000);
// scene 20
effects.push(" \
gl.enable(gl.BLEND); \
gl.blendFunc(gl.SRC_COLOR, gl.DST_COLOR); \
render_scene(1,shaderProgram_kukkascene, catTexture, 0.01, 0.3); \
");
effects.push(271000);
effects.push(278000);
// scene 21
effects.push(" \
gl.enable(gl.BLEND); \
gl.blendFunc(gl.SRC_COLOR, gl.DST_ALPHA); \
render_scene(0,shaderProgram_blurspacescene, spaceTexture,0.01); \
gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_DST_COLOR); \
render_scene(1,shaderProgram_mankeliscene, spaceTexture, 0.01); \
gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_DST_COLOR); \
render_scene(2,shaderProgram_letterscene, spaceTexture,0.01); \
gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_DST_COLOR); \
render_scene(2,shaderProgram_psykescene, spaceTexture,0.01, 1.00, timefromstart); \
gl.blendFunc(gl.ONE_MINUS_SRC_COLOR, gl.ONE_MINUS_DST_ALPHA); \
render_scene(2,shaderProgram_psykescene, catTexture,0.01, 1.00, timefromstart); \
");
effects.push(278000);
effects.push(281000);
// scene 22
effects.push(" \
gl.enable(gl.BLEND); \
gl.blendFunc(gl.SRC_COLOR, gl.DST_ALPHA); \
render_scene(0,shaderProgram_blurspacescene, spaceTexture,0.01); \
gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_DST_COLOR); \
render_scene(2,shaderProgram_letterscene, spaceTexture,0.01); \
gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_DST_COLOR); \
render_scene(2,shaderProgram_psykescene, spaceTexture,0.01, 1.00, timefromstart); \
gl.blendFunc(gl.ONE_MINUS_SRC_COLOR, gl.ONE_MINUS_DST_ALPHA); \
render_scene(2,shaderProgram_psykescene, catTexture,0.01, 1.00, timefromstart); \
");
effects.push(281000);
effects.push(295000);*/
effects.push("endDemo();");
effects.push(295000);
effects.push(1000000);
sharpkernel = new Array(-1, -1, 1, -1, 6, 1, -1, -1, 1);
}
var effect_pointer = 0;
var hitting = 0;
var timedelta = 0;
var seektime = -1;
function demo_seekto(msec) {
var i = 0;
var thispart = 0;
while (i<effects.length) {
if (msec >= effects[i+1] && msec < effects[i+2]) {
audioSeek(msec);
part_counter = thispart;
effect_pointer = part_counter*3;
part_start_time = effects[i+1];
seektime = msec;
ptimer = msec;
beat_runner = 0;
break;
}
i+=3;
thispart++;
}
}
var firstframe = 0;
function drawScene() {
if (audio_inited == 1 && textureCount >= numTextures) {
if (firstframe == 0) {
Timeline.getGlobalInstance().loop(-1);
firstframe = 1;
audio.play();
finetime_start = new Date().getTime();
//$('#loader').hide();
$('#overlay').html('');
}
var ptimer = 0;
ptimer = finePos();
var frame_start_msec = 0;
frame_start_msec = ptimer;
time = (frame_start_msec - demo_start_time - part_start_time);
if (seektime > 0) { time = seektime; seektime = -1; }
audiotime = audioPos();
if (beatflip == 1)
beat = lerp(1,0,beatstart,beatend,audiotime);
else
beat = lerp(0,1,beatstart,beatend,audiotime);
if (audiotime >= next_beattime) {
beatstart = audiotime;
if (beatflip == 1)
next_beattime+=demo_beattime/2;
else next_beattime+=demo_beattime/2;
beatend = next_beattime;
beatflip = -beatflip;
}
gl.bindFramebuffer(gl.FRAMEBUFFER, rttFramebuffer);
gl.viewport(0, 0, rttFramebuffer.width, rttFramebuffer.height);
finetime = (new Date().getTime()-finetime_start);
var timefromstart = finetime;
if (ptimer >= effects[effect_pointer+1] && ptimer < effects[effect_pointer+2]) {
eval(effects[effect_pointer]);
} else {
effect_pointer+=3;
part_counter++;
part_start_time = ptimer;
timefromlast = (new Date().getTime() - part_start_time);
beat_runner = 0;
}
if (audio.currentTime*1000 > 300) {
gl.enable(gl.BLEND);
gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_DST_ALPHA);
var mw = rttFramebuffer.width/(feedback.amount);
var mh = rttFramebuffer.height/(feedback.amount);
if (ptimer < 160000) {
gl.viewport(0, 0,rttFramebuffer.width, rttFramebuffer.height);
fs_scene(0,shaderProgram_fsscene, rttTexture,-0.1, feedback.alpha, timefromstart, mw+Math.abs(Math.cos(time*0.0001)*0.1), mh,0.0);
}
gl.bindTexture(gl.TEXTURE_2D, null);
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
gl.viewport(0, 0, gl.viewportWidth, gl.viewportHeight);
gl.clearColor(0.0, 0.0, 0.0, 1.0);
gl.clear(gl.COLOR_BUFFER_BIT + gl.DEPTH_BUFFER_BIT);
gl.enable(gl.BLEND);
gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_COLOR);
fs_scene(0,shaderProgram_convo, rttTexture,0.01, 0.8, timefromstart, gl.viewportWidth, gl.viewportHeight, 0, sharpkernel);
//gl.blendFunc(gl.SRC_COLOR, gl.ONE_MINUS_SRC_ALPHA);
//if (!(ptimer >= 120500 && ptimer < 160800))
//fs_scene(0,shaderProgram_blurdeformscene, rttTexture,0.01, 0.99, timefromstart, gl.viewportWidth, gl.viewportHeight, 0);
if ((ptimer > 253000) && (ptimer < 278000))
{
gl.blendFunc(gl.SRC_COLOR, gl.SRC_ALPHA);
skybox_scene(0,shaderProgram_skyboxscene, skyboxCube, 0.01, 1.00, timefromstart, gl.viewportWidth, gl.viewportHeight, 0);
}
}
gl.finish();
ptimer = finePos();
document.getElementById('timer').innerHTML = ptimer;
timedelta = (ptimer - frame_start_msec);
timefromlast = (ptimer - part_start_time);
runSubtitles();
runOverlays();
//if (ptimer > 281000) audioStop();
if (ptimer > 295000) audioStop();
requestAnimFrame(drawScene);
} else {
// loaderi tähän
gl.bindFramebuffer(gl.FRAMEBUFFER, rttFramebuffer);
gl.viewport(0, 0, rttFramebuffer.width, rttFramebuffer.height);
var loadercolor = 0.0;
gl.clearColor(loadercolor, loadercolor, loadercolor, 0.0);
gl.clear(gl.COLOR_BUFFER_BIT + gl.DEPTH_BUFFER_BIT);
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
gl.viewport(0, 0, gl.viewportWidth, gl.viewportHeight);
gl.clearColor(loadercolor, loadercolor, loadercolor, 0.0);
gl.clear(gl.COLOR_BUFFER_BIT + gl.DEPTH_BUFFER_BIT);
gl.finish();
requestAnimFrame(drawScene);
}
// document.getElementById('timer').innerHTML = audio.currentTime*1000;
}
function BrowserSize() {
if( typeof( window.innerWidth ) == 'number' ) {
//Non-IE
this.width = window.innerWidth;
this.height = window.innerHeight;
} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
//IE 6+ in 'standards compliant mode'
this.width = document.documentElement.clientWidth;
this.height = document.documentElement.clientHeight;
} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
//IE 4 compatible
this.width = document.body.clientWidth;
this.height = document.body.clientHeight;
}
this.noOverflowWidth = this.width - 4;
this.noOverflowHeight = this.height - 4;
}
BrowserSize.prototype.width;
BrowserSize.prototype.noOverflowWidth;
BrowserSize.prototype.height;
BrowserSize.prototype.noOverflowHeight;
var browserSize = new BrowserSize();
function webGLStart() {
var container = document.getElementById("container");
var canvas = document.getElementById("bilocanvas");
container.style.width = browserSize.width + "px";
container.style.height = browserSize.height + "px";
canvas.width = container.offsetWidth;
canvas.height = container.offsetHeight;
initGL(canvas);
initFramebuffer();
initShaders();
initEffects();
initTextures();
demo_start_time = 0;
requestAnimFrame(drawScene);
}
</script>
<script type="text/javascript">
function init() {
setTimeout(function() {
initAudio();
webGLStart();
$('#text').css('fontSize', browserSize.height*0.110 +'px');
}, 1000);
}
</script>
<script type="text/javascript">
document.onkeyup = KeyCheck;
function KeyCheck(e)
{
var KeyID = (window.event) ? event.keyCode : e.keyCode;
console.log('pressed key with keycode '+ KeyID);
if(KeyID==83) {
console.log(audioPos());
}
}
</script>
<script type="text/javascript" src="jquery.js"></script>
<style type="text/css">
@font-face {
font-family: myfont;
src: url('font.ttf');
}
body {
background-color: black;
margin: 0px;
padding: 0px;
font-family: myfont;
}
#container {
overflow: hidden;
position: fixed;
top: 0px;
left: 0px;
bottom: 0px;
right: 0px;
}
#loader {
position: fixed;
top: 0px;
bottom: 0px;
left: 0px;
right: 0px;
}
#loader table {
width: 100%;
height: 100%;
}
#loader td {
vertical-align: middle;
text-align: center;
}
#loader img {
height: 100%;
}
#timer {
position: absolute;
top: 0px;
right: 0px;
color: white;
display: block;
}
/*#overlay {
text-align: center;
position: absolute;
top: 0;
left: 2%;
right: 2%;
display: none;
}*/
#overlay-img {
display: none;
}
#subtitle {
text-align: center;
position: fixed;
bottom: 2%;
left: 2%;
right: 2%;
display: none;
}
#subtitle>span {
color: white;
background-color: black;
padding: 6px;
font-size: 2.5em;
}
#bilocanvas {
position: absolute;
}
em {
font-style: italic;
}
#text {
text-align: center;
vertical-align: 50%;
position: absolute;
width: 100%;
height: 100%;
color: white;
opacity: 0.05;
}
#text>span {
display: block;
position: relative;
top: 35%;
visibility: hidden;
-webkit-transform: scaleX(2.2) scaleY(5.5);
-moz-transform: scaleX(2.2) scaleY(5.5);
}
#text,#text .credits {
visibility: visible;
}
#subtitle-text {
display: none;
}
</style>
<script type="text/javascript">
window.onload = init;
</script>
<script type="text/javascript">
function toggleGUI() {
/*var visible = Timeline.getGlobalInstance().container.style.visibility;
if(visible == "hidden") {
Timeline.getGlobalInstance().container.style.visibility = "visible";
} else {
Timeline.getGlobalInstance().container.style.visibility = "hidden";
} */
}
function isSpace(e)
{
var keynum;
var keychar;
var check;
if(window.event) // IE
{
keynum = e.keyCode;
}
else if(e.which) // Netscape/Firefox/Opera
{
keynum = e.which;
}
keychar = String.fromCharCode(keynum);
check = " ";
return (check == keychar);
}
</script>
<script type="text/javascript">
// part system global
var flag = new Array();
var fi = 0;
flag.push(true);
// init
var subtitles;
function initSubtitles() {
subtitles = function(e) {
r = $('span',e);
return r;
}($('#subtitle-text'));
}
var timing = {"bindings": [
{"begin": 6950, "duration": 4700},
{"begin": 13250, "duration": 4700},
{"begin": 25760, "duration": 4700},
{"begin": 32000, "duration": 4700},
{"begin": 38300, "duration": 4700},
{"begin": 44600, "duration": 4700},
{"begin": 50830, "duration": 4700},
{"begin": 57060, "duration": 4700},
{"begin": 63360, "duration": 4700},
{"begin": 69590, "duration": 4700},
// {"begin": 75860, "duration": 4700},
{"begin": 82100, "duration": 4700},
{"begin": 88400, "duration": 4700},
{"begin": null, "duration": null}
]};;
var si = 0;
var sii = 0;
var prev_text = -1;
function runSubtitles() {
var st = audioPos();
var t_begin, t_end;
if (timing.bindings[si].begin == null) return;
t_begin = timing.bindings[si].begin;
if (timing.bindings[si].duration == null)
t_end = timing.bindings[si+1].begin;
else
t_end = timing.bindings[si].begin + timing.bindings[si].duration;
if (st >= t_begin && st < t_end && prev_text < sii) {
prev_text = sii;
if (sii != 5) {
$('#subtitle').html(subtitles[sii]);
$('#subtitle').show();
}
}
if (st >= t_end) {
si++;
sii++;
$('#subtitle').html('');
$('#subtitle').hide();
}
}
// part system global
var flag2 = new Array();
var fi2 = 0;
flag2.push(true);
// init
var overlay;
function initOverlays() {
overlay = function(e) {
r = $('span',e);
return r;
}($('#overlay-img'));
}
var timing2 = {"bindings": [
{"begin": 75860, "duration": 4700},
{"begin": 102500, "duration": 5000},
{"begin": 110000, "duration": 5000},
{"begin": 117500, "duration": 5000},
{"begin": 125000, "duration": 5000},
{"begin": 132500, "duration": 5000},
{"begin": 140000, "duration": 5000},
{"begin": 147500, "duration": 5000},
{"begin": 155000, "duration": 5000},
{"begin": 162500, "duration": 5000},
{"begin": 170000, "duration": 5000},
{"begin": 177500, "duration": 5000},
{"begin": 185000, "duration": 5000},
// {"begin": 192500, "duration": 5000},
{"begin": 230000, "duration": 5000},
{"begin": 237000, "duration": 5000},
{"begin": 243000, "duration": 5000},
{"begin": 281000, "duration": 5000},
{"begin": null, "duration": null}
]};;
var si2 = 0;
var sii2 = 0;
var prev_img = -1;
var clear_fadeout = true;
function runOverlays() {
var st = audioPos();
var t_begin, t_end;
if (timing2.bindings[si2].begin == null) return;
t_begin = timing2.bindings[si2].begin;
if (timing2.bindings[si2].duration == null)
t_end = timing2.bindings[si2+1].begin;
else
t_end = timing2.bindings[si2].begin + timing2.bindings[si2].duration;
if (clear_fadeout) {
if (st >= t_begin && st < t_end && prev_img < sii2) {
prev_img = sii2;
if (sii2 != 5) {
$('#overlay').html(overlay[sii2]);
//$('#overlay').show();
$('#overlay').fadeIn(1500, function() {});
clear_fadeout = false;
}
}
}
if (st >= t_end) {
si2++;
sii2++;
//$('#overlay').html('');
//$('#overlay').hide();
$('#overlay').fadeOut(1500, function() {
$('#overlay').html('');
clear_fadeout = true;
});
}
}
</script>
</head>
<body onresize="window.location.reload(true);" onkeypress="if(isSpace(event)) toggleGUI();">
<div id="container">
<canvas id="bilocanvas" width="512" height="512"></canvas>
<div id="loader">
<table><tbody><tr><td id="overlay">
<span><img src="andre_coelho_gfx/astral_king1.jpg" /></span>
</td></tr></tbody></table>
</div>
<div id="timer">test</div>
<!-- <p id="overlay"><span><img src="andre_coelho_gfx/1.jpg"></span></p> -->
<div id="overlay-img"><p><span><img src="andre_coelho_gfx/mao_cosmica_blog.jpg"></span> <span><img src="andre_coelho_gfx/1.jpg"></span> <span><img src="andre_coelho_gfx/2.jpg"></span> <span><img src="andre_coelho_gfx/3.jpg"></span> <span><img src="andre_coelho_gfx/4.jpg"></span> <span><img src="andre_coelho_gfx/5.jpg"></span> <span><img src="andre_coelho_gfx/6.jpg"></span> <span><img src="andre_coelho_gfx/7.jpg"></span> <span><img src="andre_coelho_gfx/8.jpg"></span> <span><img src="andre_coelho_gfx/9.jpg"></span> <span><img src="andre_coelho_gfx/10.jpg"></span> <span><img src="andre_coelho_gfx/11.jpg"></span> <span><img src="andre_coelho_gfx/12.jpg"></span> <span><img src="andre_coelho_gfx/deathmetal.jpg"></span> <span><img src="andre_coelho_gfx/3_m.jpg"></span> <span><img src="andre_coelho_gfx/flower.jpg"></span> <span><img src="andre_coelho_gfx/5_m.jpg"></span> </p><br data-goto="#subtitle-text>p:first-child" /></div>
<p id="subtitle"><span>The legend is always the same.</span></p>
<div id="subtitle-text"><p><span>The legend is always the same.</span> <span>The legend is always different.</span> <span></span> <span>Nine immortal kings live on top of the mountain;</span> <span>from the highest peak they direct our world.</span> <span>They hold the secret to the conquest of death.</span> <span>They are more than forty thousand years old.</span> <span>But they were once like ourselves -</span> <span>if others have succeeded conquering death,</span> <span>why must we accept it?</span> <span>I know where the immortals live,</span> <span>and how to obtain their secret.</span></p><br data-goto="#subtitle-text>p:first-child" /></div>
</div>
</body>
</html>