_='!E{ aE{ ){X,Y,Z} cE{return Mh.&Z/9+T)/2J.5}(HcleKCoQr(1cleK(16384=[],C=W(k+9*T)%30J5,X@],Y@+1],Z-=.1,(lW-k X=J,Z++#Z-- (S=8,extW-k*S+30*T%S,X=J#HbDa?new FQ32:(35044u>1f(TU,Tdw:s(1,C/3requtAnimFme(aT+=1} a,b){S=^asSource(S,"precis Qwp ;u>`T;"+bcompile^Stach^P,S)}vK c="tribute $3 V; {`N=0; O=1;$4 v=$4(V,1v.z+=(&T*3+v.x)+cos(T*2+v.y*1.5)=m4(7,7,-O,-O,||/2N,O)*v;Z=O-.z/50;}",d="{ gl_FgCoQr=$4(Z,Z,Z,1}";(TU=T=n=5e3,next=2nl=9s=[],s.push(2*Mh.EJP=I3,cI2,dlkPusePRjV"TUjU>T"bdB?BEv~PotG(R,3,5126,0enableV~:(RaE}(),vKyg`Z;void ma(void)functvGticHndomk=0;k<nat ,Y=c(Progm(ionforfQ;k++)hadGHcree[C++]=b(in0,Attribra,N,N.0stKsuffGgl_PositLoc(P,");# X=1,$vec&s(:Ary>nim?(34962,@=2*s[kE()GerHg.I3563J-1KarQloRVPAWZ=^S(` j=Hget|4*&T~Gtexes';for(Y in $='~|j`^WRQKJIHGE@?>:&$# ')with(_.split($[Y]))_=join(pop());eval(_)
(function() {
var vertex_shader_code="attribute vec3 V;varying float Z;void main(void) { float N=0.0;float O=1.0;vec4 v=vec4(V,1);v.z+=(sin(T*3.0+v.x)+cos(T*2.0+v.y*1.5));gl_Position=mat4(7,N,N,N,N,7,N,N,N,N,-O,-O,4.0*sin(T),4.0*sin(T/2.0),N,O)*v;Z=O-gl_Position.z/50.0;}";
var fragment_shader_code="varying float Z;void main(void){ gl_FragColor=vec4(Z,Z,Z,1);}";
// DEMO: Spacetrain
// document.write('see console');
// if (typeof(a) !== 'undefined') console.log('demo canvas', a);
// if (typeof(b) !== 'undefined') console.log('demo body', b);
// if (typeof(c) !== 'undefined') console.log('demo 2d context', c);
// if (typeof(g) !== 'undefined') console.log('demo gl', g);
// console.log('RAF', requestAnimationFrame);
//
//
// GLOBALS
//
//
// prog;
TU = 0;
T = 0;
//
//
// FRAME LOOP
//
//
// function p(n) { vertices.push(n) }
nstars = 5000;
nextra = 20;
nlines = 90;
randoms = [];
// R = Math.random;
for(k=0; k<nstars; k++) randoms.push(Math.random() * 2 - 1);
// console.log(vertices);
function F() {
g.clearColor(0, 0, 0, 1);
// g.enable(g.DEPTH_TEST);
// g.depthFunc(g.LEQUAL);
g.clear( 16384/*g.COLOR_BUFFER_BIT*/ );
// g.useProgram(prog);
vertices = [];
C = 0;
// X=0;
// Y=0;
// Z=0;
function p() {
vertices[C++] = X;
vertices[C++] = Y;
vertices[C++] = Z;
// vertices=vertices.concat([x,y,z]);
// C += 1;
}
for( k=0; k<nstars; k++) {
Z = (k+T*9)%30-15;
X=randoms[k]*2;
Y=randoms[k+1]*2;
// Z=z;
p(); // randoms[k]*2, randoms[k+1]*2, z);
Z-=.1;
p(); // randoms[k]*2, randoms[k+1]*2, z+.1);
}
// W = 1;
// D = 2;
function M() {
return Math.sin(Z / 9 + T) / 2 - 1.5;
}
// add rails
for( k=0; k<nlines; k++) {
Z=-k;
// ZZ = -k;
// h = ;
// H = ;
Y=M();
X=-1;
// Z=ZZ;
p(); // p(-W, h, ZZ);
Z++;//=1;
Y=M();
// Z=ZZ;
p(); // p(-W, H, ZZ+1);
X=1;
// Y=;
// Z--;//=1;//ZZ;
p(); // p(W, h, ZZ);
Z--; //=1;
Y=M();
p(); // p(W, H, ZZ+1);
}
// add segments
S = 8;
for(k=0; k<nextra; k++) {
Z = -k*S+(T*30)%S;
// H = ;
X=-1;
Y=M();
// Z=ZO;
p(); // (-W, H, ZO);
X=1;
p(); // (W, H, ZO);
}
g.bufferData(34962/*g.ARRAY_BUFFER*/, new Float32Array(vertices), 35044/*g.STATIC_DRAW*/);
// console.log(g.FLOAT);
// console.log(g.LINES);
g.uniform1f(TU, T);
g.drawArrays(1/*g.LINES*/, 0, C/3);// nstars*12 + nextra*3);
requestAnimationFrame(F);
T += .01;
}
//
//
// SET UP
//
//
function getShader(type, theSource) {
S = g.createShader(type);
g.shaderSource(S, "precision lowp float;uniform float T;" + theSource);
g.compileShader(S);
// if (!g.getShaderParameter(shader, g.COMPILE_STATUS)) {
// alert("An error occurred compiling the shaders: " + g.getShaderInfoLog(shader));
// return null;
// }
g.attachShader(P,S);
}
// Create the shader program
P = g.createProgram();
getShader(35633/*g.VERTEX_SHADER*/, vertex_shader_code);
getShader(35632/*g.FRAGMENT_SHADER*/, fragment_shader_code);
g.linkProgram(P);
// if (!g.getProgramParameter(prog, g.LINK_STATUS)) {
// alert("Unable to initialize the shader program.");
// }
g.useProgram(P);
VPA = g.getAttribLocation(P, "V");
TU = g.getUniformLocation(P, "T");
g.bindBuffer(34962/*g.ARRAY_BUFFER*/, g.createBuffer());
g.vertexAttribPointer(VPA, 3, 5126/*g.FLOAT*/, 0, 0, 0);
g.enableVertexAttribArray(VPA);
//
//
// START EVERYTHING
//
//
F();
})();