1FSS={FRONT:0,BACK:1,DOUBLE:2,SVGNS:"http://www.w3.org/2000/svg"},FSS.Array="function"==typeof Float32Array?Float32Array:Array,FSS.Utils={isNumber:function(t){return!isNaN(parseFloat(t))&&isFinite(t)}},function(){for(var n=0,t=["ms","moz","webkit","o"],e=0;e<t.length&&!window.requestAnimationFrame;++e)window.requestAnimationFrame=window[t[e]+"RequestAnimationFrame"],window.cancelAnimationFrame=window[t[e]+"CancelAnimationFrame"]||window[t[e]+"CancelRequestAnimationFrame"];window.requestAnimationFrame||(window.requestAnimationFrame=function(t){var e=(new Date).getTime(),i=Math.max(0,16-(e-n)),r=window.setTimeout(function(){t(e+i)},i);return n=e+i,r}),window.cancelAnimationFrame||(window.cancelAnimationFrame=function(t){clearTimeout(t)})}(),Math.PIM2=2*Math.PI,Math.PID2=Math.PI/2,Math.randomInRange=function(t,e){return t+(e-t)*Math.random()},Math.clamp=function(t,e,i){return t=Math.max(t,e),Math.min(t,i)},FSS.Vector3={create:function(t,e,i){var r=new FSS.Array(3);return this.set(r,t,e,i),r},clone:function(t){var e=this.create();return this.copy(e,t),e},set:function(t,e,i,r){return t[0]=e||0,t[1]=i||0,t[2]=r||0,this},setX:function(t,e){return t[0]=e||0,this},setY:function(t,e){return t[1]=e||0,this},setZ:function(t,e){return t[2]=e||0,this},copy:function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],this},add:function(t,e){return t[0]+=e[0],t[1]+=e[1],t[2]+=e[2],this},addVectors:function(t,e,i){return t[0]=e[0]+i[0],t[1]=e[1]+i[1],t[2]=e[2]+i[2],this},addScalar:function(t,e){return t[0]+=e,t[1]+=e,t[2]+=e,this},subtract:function(t,e){return t[0]-=e[0],t[1]-=e[1],t[2]-=e[2],this},subtractVectors:function(t,e,i){return t[0]=e[0]-i[0],t[1]=e[1]-i[1],t[2]=e[2]-i[2],this},subtractScalar:function(t,e){return t[0]-=e,t[1]-=e,t[2]-=e,this},multiply:function(t,e){return t[0]*=e[0],t[1]*=e[1],t[2]*=e[2],this},multiplyVectors:function(t,e,i){return t[0]=e[0]*i[0],t[1]=e[1]*i[1],t[2]=e[2]*i[2],this},multiplyScalar:function(t,e){return t[0]*=e,t[1]*=e,t[2]*=e,this},divide:function(t,e){return t[0]/=e[0],t[1]/=e[1],t[2]/=e[2],this},divideVectors:function(t,e,i){return t[0]=e[0]/i[0],t[1]=e[1]/i[1],t[2]=e[2]/i[2],this},divideScalar:function(t,e){return 0!==e?(t[0]/=e,t[1]/=e,t[2]/=e):(t[0]=0,t[1]=0,t[2]=0),this},cross:function(t,e){var i=t[0],r=t[1],n=t[2];return t[0]=r*e[2]-n*e[1],t[1]=n*e[0]-i*e[2],t[2]=i*e[1]-r*e[0],this},crossVectors:function(t,e,i){return t[0]=e[1]*i[2]-e[2]*i[1],t[1]=e[2]*i[0]-e[0]*i[2],t[2]=e[0]*i[1]-e[1]*i[0],this},min:function(t,e){return e>t[0]&&(t[0]=e),e>t[1]&&(t[1]=e),e>t[2]&&(t[2]=e),this},max:function(t,e){return t[0]>e&&(t[0]=e),t[1]>e&&(t[1]=e),t[2]>e&&(t[2]=e),this},clamp:function(t,e,i){return this.min(t,e),this.max(t,i),this},limit:function(t,e,i){var r=this.length(t);return null!==e&&r<e?this.setLength(t,e):null!==i&&i<r&&this.setLength(t,i),this},dot:function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]},normalise:function(t){return this.divideScalar(t,this.length(t))},negate:function(t){return this.multiplyScalar(t,-1)},distanceSquared:function(t,e){var i=t[0]-e[0],r=t[1]-e[1],n=t[2]-e[2];return i*i+r*r+n*n},distance:function(t,e){return Math.sqrt(this.distanceSquared(t,e))},lengthSquared:function(t){return t[0]*t[0]+t[1]*t[1]+t[2]*t[2]},length:function(t){return Math.sqrt(this.lengthSquared(t))},setLength:function(t,e){var i=this.length(t);return 0!==i&&e!==i&&this.multiplyScalar(t,e/i),this}},FSS.Vector4={create:function(t,e,i){var r=new FSS.Array(4);return this.set(r,t,e,i),r},set:function(t,e,i,r,n){return t[0]=e||0,t[1]=i||0,t[2]=r||0,t[3]=n||0,this},setX:function(t,e){return t[0]=e||0,this},setY:function(t,e){return t[1]=e||0,this},setZ:function(t,e){return t[2]=e||0,this},setW:function(t,e){return t[3]=e||0,this},add:function(t,e){return t[0]+=e[0],t[1]+=e[1],t[2]+=e[2],t[3]+=e[3],this},multiplyVectors:function(t,e,i){return t[0]=e[0]*i[0],t[1]=e[1]*i[1],t[2]=e[2]*i[2],t[3]=e[3]*i[3],this},multiplyScalar:function(t,e){return t[0]*=e,t[1]*=e,t[2]*=e,t[3]*=e,this},min:function(t,e){return e>t[0]&&(t[0]=e),e>t[1]&&(t[1]=e),e>t[2]&&(t[2]=e),e>t[3]&&(t[3]=e),this},max:function(t,e){return t[0]>e&&(t[0]=e),t[1]>e&&(t[1]=e),t[2]>e&&(t[2]=e),t[3]>e&&(t[3]=e),this}
1,clamp:function(t,e,i){return this.min(t,e),this.max(t,i),this}},FSS.Color=function(t,e){this.rgba=FSS.Vector4.create(),this.hex=t||"#000000",this.opacity=FSS.Utils.isNumber(e)?e:1,this.set(this.hex,this.opacity)},FSS.Color.prototype={set:function(t,e){var i=(t=t.replace("#","")).length/3;return this.rgba[0]=parseInt(t.substring(0*i,1*i),16)/255,this.rgba[1]=parseInt(t.substring(1*i,2*i),16)/255,this.rgba[2]=parseInt(t.substring(2*i,3*i),16)/255,this.rgba[3]=FSS.Utils.isNumber(e)?e:this.rgba[3],this},hexify:function(t){var e=Math.ceil(255*t).toString(16);return 1===e.length&&(e="0"+e),e},format:function(){var t=this.hexify(this.rgba[0]),e=this.hexify(this.rgba[1]),i=this.hexify(this.rgba[2]);return this.hex="#"+t+e+i,this.hex}},FSS.Object=function(){this.position=FSS.Vector3.create()},FSS.Object.prototype={setPosition:function(t,e,i){return FSS.Vector3.set(this.position,t,e,i),this}},FSS.Light=function(t,e){FSS.Object.call(this),this.ambient=new FSS.Color(t||"#FFFFFF"),this.diffuse=new FSS.Color(e||"#FFFFFF"),this.ray=FSS.Vector3.create()},FSS.Light.prototype=Object.create(FSS.Object.prototype),FSS.Vertex=function(t,e,i){this.position=FSS.Vector3.create(t,e,i)},FSS.Vertex.prototype={setPosition:function(t,e,i){return FSS.Vector3.set(this.position,t,e,i),this}},FSS.Triangle=function(t,e,i){this.a=t||new FSS.Vertex,this.b=e||new FSS.Vertex,this.c=i||new FSS.Vertex,this.vertices=[this.a,this.b,this.c],this.u=FSS.Vector3.create(),this.v=FSS.Vector3.create(),this.centroid=FSS.Vector3.create(),this.normal=FSS.Vector3.create(),this.color=new FSS.Color,this.polygon=document.createElementNS(FSS.SVGNS,"polygon"),this.polygon.setAttributeNS(null,"stroke-linejoin","round"),this.polygon.setAttributeNS(null,"stroke-miterlimit","1"),this.polygon.setAttributeNS(null,"stroke-width","1"),this.computeCentroid(),this.computeNormal()},FSS.Triangle.prototype={computeCentroid:function(){return this.centroid[0]=this.a.position[0]+this.b.position[0]+this.c.position[0],this.centroid[1]=this.a.position[1]+this.b.position[1]+this.c.position[1],this.centroid[2]=this.a.position[2]+this.b.position[2]+this.c.position[2],FSS.Vector3.divideScalar(this.centroid,3),this},computeNormal:function(){return FSS.Vector3.subtractVectors(this.u,this.b.position,this.a.position),FSS.Vector3.subtractVectors(this.v,this.c.position,this.a.position),FSS.Vector3.crossVectors(this.normal,this.u,this.v),FSS.Vector3.normalise(this.normal),this}},FSS.Geometry=function(){this.vertices=[],this.triangles=[],this.dirty=!1},FSS.Geometry.prototype={update:function(){if(this.dirty){var t,e;for(t=this.triangles.length-1;0<=t;t--)(e=this.triangles[t]).computeCentroid(),e.computeNormal();this.dirty=!1}return this}},FSS.Plane=function(t,e,i,r){FSS.Geometry.call(this),this.width=t||100,this.height=e||100,this.segments=i||4,this.slices=r||4,this.segmentWidth=this.width/this.segments,this.sliceHeight=this.height/this.slices;var n,s,o,a,h,l,c,u=[],S=-.5*this.width,f=.5*this.height;for(n=0;this.segments>=n;n++)for(u.push([]),s=0;this.slices>=s;s++)c=new FSS.Vertex(S+n*this.segmentWidth,f-s*this.sliceHeight),u[n].push(c),this.vertices.push(c);for(n=0;this.segments>n;n++)for(s=0;this.slices>s;s++)o=u[n+0][s+0],a=u[n+0][s+1],h=u[n+1][s+0],l=u[n+1][s+1],t0=new FSS.Triangle(o,a,h),t1=new FSS.Triangle(h,a,l),this.triangles.push(t0,t1)},FSS.Plane.prototype=Object.create(FSS.Geometry.prototype),FSS.Material=function(t,e){this.ambient=new FSS.Color(t||"#444444"),this.diffuse=new FSS.Color(e||"#FFFFFF"),this.slave=new FSS.Color},FSS.Mesh=function(t,e){FSS.Object.call(this),this.geometry=t||new FSS.Geometry,this.material=e||new FSS.Material,this.side=FSS.FRONT,this.visible=!0},FSS.Mesh.prototype=Object.create(FSS.Object.prototype),FSS.Mesh.prototype.update=function(t,e){var i,r,n,s,o;if(this.geometry.update(),e)for(i=this.geometry.triangles.length-1;0<=i;i--){for(r=this.geometry.triangles[i],FSS.Vector4.set(r.color.rgba),n=t.length-1;0<=n;n--)s=t[n],FSS.Vector3.subtractVectors(s.ray,s.position,r.centroid),FSS.Vector3.normalise(s.ray),o=FSS.Vector3.dot(r.normal,s.ray),this.side===FSS.FRONT?o=Math.max(o,0):this.side===FSS.BACK?o=Math.abs(Math.min(o,0)):this.side===FSS.DOUBLE&&(o=Math.max(Math.abs(o),0)),FSS.Vector4.multiplyVectors(this.material.slave.rgba,this.material.ambient.rgba,s.ambient.rgba),FSS.Vector4.add(r.color.rgba,this.material.slave.rgba),FSS.Vector4.multiplyVectors(this.material.slave.rgba,this.material.diffuse.rgba,s.diffuse.rgba),FSS.Vector4.multiplyScalar(this.material.slave.rgba,o),FSS.Vector4.add(r.color.rgba,this.material.slave.rgba);FSS.Vector4.clamp(r.color.rgba,0,1)}return this},FSS.Scene=function(){this.meshes=[],this.lights=[]},FSS.Scene.prototype={add:function(t){return t instanceof FSS.Mesh&&!~this.meshes.indexOf(t)?this.meshes.push(t):t instanceof FSS.Light&&!~this.lights.indexOf(t)&&this.lights.push(t),this},remove:function(t){return t instanceof FSS.Mesh&&~this.meshes.indexOf(t)?this.meshes.splice(this.meshes.indexOf(t),1):t instanceof FSS.Light&&~this.lights.indexOf(t)&&this.lights.splice(this.lights.indexOf(t),1),this}},FSS.Renderer=function(){this.width=0,this.height=0,this.halfWidth=0,this.halfHeight=0},FSS.Renderer.prototype={setSize:function(t,e){return this.width!==t||this.height!==e?(this.width=t,this.height=e,this.halfWidth=.5*this.width,this.halfHeight=.5*this.height,this):void 0},clear:function(){return this},render:function(){return this}},FSS.CanvasRenderer=function(){FSS.Renderer.call(this),this.element=document.createElement("canvas"),this.element.style.display="block",this.context=this.element.getContext("2d"),this.setSize(this.element.width,this.element.height)},FSS.CanvasRenderer.prototype=Object.create(FSS.Renderer.prototype),FSS.CanvasRenderer.prototype.setSize=function(t,e){return FSS.Renderer.prototype.setSize.call(this,t,e),this.element.width=t,this.element.height=e,this.context.setTransform(1,0,0,-1,this.halfWidth,this.halfHeight),this},FSS.CanvasRenderer.prototype.clear=function(){return FSS.Renderer.prototype.clear.call(this),this.context.clearRect(-this.halfWidth,-this.halfHeight,this.width,this.height),this},FSS.CanvasRenderer.prototype.render=function(t){var e,i,r,n,s;for(FSS.Renderer.prototype.render.call(this,t),this.clear(),this.context.lineJoin="round",this.context.lineWidth=1,e=t.meshes.length-1;0<=e;e--)if((i=t.meshes[e]).visible)for(i.update(t.lights,!0),r=i.geometry.triangles.length-1;0<=r;r--)s=(n=i.geometry.triangles[r]).color.format(),this.context.beginPath(),this.context.moveTo(n.a.position[0],n.a.position[1]),this.context.lineTo(n.b.position[0],n.b.position[1]),this.context.lineTo(n.c.position[0],n.c.position[1]),this.context.closePath(),this.context.strokeStyle=s,this.context.fillStyle=s,this.context.stroke(),this.context.fill();return this},FSS.WebGLRenderer=function(){FSS.Renderer.call(this),this.element=document.createElement("canvas"),this.element.style.display="block",this.vertices=null;this.lights=null;return this.gl=this.getContext(this.element,{preserveDrawingBuffer:!1,premultipliedAlpha:!0,antialias:!0,stencil:!0,alpha:!0}),this.unsupported=!this.gl,this.unsupported?"WebGL is not supported by your browser.":(this.gl.clearColor(0,0,0,0),this.gl.enable(this.gl.DEPTH_TEST),void this.setSize(this.element.width,this.element.height))},FSS.WebGLRenderer.prototype=Object.create(FSS.Renderer.prototype),FSS.WebGLRenderer.prototype.getContext=function(t,e){var i=!1;try{if(!(i=t.getContext("experimental-webgl",e)))throw"Error creating WebGL context."}catch(t){console.error(t)}return i},FSS.WebGLRenderer.prototype.setSize=function(t,e){return FSS.Renderer.prototype.setSize.call(this,t,e),this.unsupported?void 0:(this.element.width=t,this.element.height=e,this.gl.viewport(0,0,t,e),this)},FSS.WebGLRenderer.prototype.clear=function(){return FSS.Renderer.prototype.clear.call(this),this.unsupported?void 0:(this.gl.clear(this.gl.COLOR_BUFFER_BIT|this.gl.DEPTH_BUFFER_BIT),this)},FSS.WebGLRenderer.prototype.render=function(t){if(FSS.Renderer.prototype.render.call(this,t),!this.unsupported){var e,i,r,n,s,o,a,h,l,c,u,S,f,d,m,g=!1,p=t.lights.length,F=0;if(this.clear(),this.lights!==p){if(this.lights=p,!(0<this.lights))return;this.buildProgram(p)}if(this.program){for(e=t.meshes.length-1;0<=e;e--)(i=t.meshes[e]).geometry.dirty&&(g=!0),i.update(t.lights,!1),F+=3*i.geometry.triangles.length;if(g||this.vertices!==F)for(h in this.vertices=F,this.program.attributes){for((c=this.program.attributes[h]).data=new FSS.Array(F*c.size),f=0,e=t.meshes.length-1;0<=e;e--)for(r=0,n=(i=t.meshes[e]).geometry.triangles.length;r<n;r++)for(d=0,m=(s=i.geometry.triangles[r]).vertices.length;d<m;d++){switch(vertex=s.vertices[d],h){case"side":this.setBufferData(f,c,i.side);break;case"position":this.setBufferData(f,c,vertex.position);break;case"centroid":this.setBufferData(f,c,s.centroid);break;case"normal":this.setBufferData(f,c,s.normal);break;case"ambient":this.setBufferData(f,c,i.material.ambient.rgba);break;case"diffuse":this.setBufferData(f,c,i.material.diffuse.rgba)}f++}this.gl.bindBuffer(this.gl.ARRAY_BUFFER,c.buffer),this.gl.bufferData(this.gl.ARRAY_BUFFER,c.data,this.gl.DYNAMIC_DRAW),this.gl.enableVertexAttribArray(c.location),this.gl.vertexAttribPointer(c.location,c.size,this.gl.FLOAT,!1,0,0)}for(this.setBufferData(0,this.program.uniforms.resolution,[this.width,this.height,this.width]),o=p-1;0<=o;o--)a=t.lights[o],this.setBufferData(o,this.program.uniforms.lightPosition,a.position),this.setBufferData(o,this.program.uniforms.lightAmbient,a.ambient.rgba),this.setBufferData(o,this.program.uniforms.lightDiffuse,a.diffuse.rgba);for(l in this.program.uniforms)switch(c=this.program.uniforms[l],S=c.location,u=c.data,c.structure){case"3f":this.gl.uniform3f(S,u[0],u[1],u[2]);break;case"3fv":this.gl.uniform3fv(S,u);break;case"4fv":this.gl.uniform4fv(S,u)}}return this.gl.drawArrays(this.gl.TRIANGLES,0,this.vertices),this}}
1,FSS.WebGLRenderer.prototype.setBufferData=function(t,e,i){if(FSS.Utils.isNumber(i))e.data[t*e.size]=i;else for(var r=i.length-1;0<=r;r--)e.data[t*e.size+r]=i[r]},FSS.WebGLRenderer.prototype.buildProgram=function(t){if(!this.unsupported){var e=FSS.WebGLRenderer.VS(t),i=FSS.WebGLRenderer.FS(t),r=e+i;if(!this.program||this.program.code!==r){var n=this.gl.createProgram(),s=this.buildShader(this.gl.VERTEX_SHADER,e),o=this.buildShader(this.gl.FRAGMENT_SHADER,i);if(this.gl.attachShader(n,s),this.gl.attachShader(n,o),this.gl.linkProgram(n),this.gl.getProgramParameter(n,this.gl.LINK_STATUS))return this.gl.deleteShader(o),this.gl.deleteShader(s),n.code=r,n.attributes={side:this.buildBuffer(n,"attribute","aSide",1,"f"),position:this.buildBuffer(n,"attribute","aPosition",3,"v3"),centroid:this.buildBuffer(n,"attribute","aCentroid",3,"v3"),normal:this.buildBuffer(n,"attribute","aNormal",3,"v3"),ambient:this.buildBuffer(n,"attribute","aAmbient",4,"v4"),diffuse:this.buildBuffer(n,"attribute","aDiffuse",4,"v4")},n.uniforms={resolution:this.buildBuffer(n,"uniform","uResolution",3,"3f",1),lightPosition:this.buildBuffer(n,"uniform","uLightPosition",3,"3fv",t),lightAmbient:this.buildBuffer(n,"uniform","uLightAmbient",4,"4fv",t),lightDiffuse:this.buildBuffer(n,"uniform","uLightDiffuse",4,"4fv",t)},this.program=n,this.gl.useProgram(this.program),n;var a=this.gl.getError(),h=this.gl.getProgramParameter(n,this.gl.VALIDATE_STATUS);return console.error("Could not initialise shader.\nVALIDATE_STATUS: "+h+"\nERROR: "+a),null}}},FSS.WebGLRenderer.prototype.buildShader=function(t,e){if(!this.unsupported){var i=this.gl.createShader(t);return this.gl.shaderSource(i,e),this.gl.compileShader(i),this.gl.getShaderParameter(i,this.gl.COMPILE_STATUS)?i:(console.error(this.gl.getShaderInfoLog(i)),null)}},FSS.WebGLRenderer.prototype.buildBuffer=function(t,e,i,r,n,s){var o={buffer:this.gl.createBuffer(),size:r,structure:n,data:null};switch(e){case"attribute":o.location=this.gl.getAttribLocation(t,i);break;case"uniform":o.location=this.gl.getUniformLocation(t,i)}return s&&(o.data=new FSS.Array(s*r)),o},FSS.WebGLRenderer.VS=function(t){return["precision mediump float;","#define LIGHTS "+t,"attribute float aSide;","attribute vec3 aPosition;","attribute vec3 aCentroid;","attribute vec3 aNormal;","attribute vec4 aAmbient;","attribute vec4 aDiffuse;","uniform vec3 uResolution;","uniform vec3 uLightPosition[LIGHTS];","uniform vec4 uLightAmbient[LIGHTS];","uniform vec4 uLightDiffuse[LIGHTS];","varying vec4 vColor;","void main() {","vColor = vec4(0.0);","vec3 position = aPosition / uResolution * 2.0;","for (int i = 0; i < LIGHTS; i++) {","vec3 lightPosition = uLightPosition[i];","vec4 lightAmbient = uLightAmbient[i];","vec4 lightDiffuse = uLightDiffuse[i];","vec3 ray = normalize(lightPosition - aCentroid);","float illuminance = dot(aNormal, ray);","if (aSide == 0.0) {","illuminance = max(illuminance, 0.0);","} else if (aSide == 1.0) {","illuminance = abs(min(illuminance, 0.0));","} else if (aSide == 2.0) {","illuminance = max(abs(illuminance), 0.0);","}","vColor += aAmbient * lightAmbient;","vColor += aDiffuse * lightDiffuse * illuminance;","}","vColor = clamp(vColor, 0.0, 1.0);","gl_Position = vec4(position, 1.0);","}"].join("\n")},FSS.WebGLRenderer.FS=function(){return["precision mediump float;","varying vec4 vColor;","void main() {","gl_FragColor = vColor;","}"].join("\n")},FSS.SVGRenderer=function(){FSS.Renderer.call(this),this.element=document.createElementNS(FSS.SVGNS,"svg"),this.element.setAttribute("xmlns",FSS.SVGNS),this.element.setAttribute("version","1.1"),this.element.style.display="block",this.setSize(300,150)},FSS.SVGRenderer.prototype=Object.create(FSS.Renderer.prototype),FSS.SVGRenderer.prototype.setSize=function(t,e){return FSS.Renderer.prototype.setSize.call(this,t,e),this.element.setAttribute("width",t),this.element.setAttribute("height",e),this},FSS.SVGRenderer.prototype.clear=function(){FSS.Renderer.prototype.clear.call(this);for(var t=this.element.childNodes.length-1;0<=t;t--)this.element.removeChild(this.element.childNodes[t]);return this},FSS.SVGRenderer.prototype.render=function(t){var e,i,r,n,s,o;for(FSS.Renderer.prototype.render.call(this,t),e=t.meshes.length-1;0<=e;e--)if((i=t.meshes[e]).visible)for(i.update(t.lights,!0),r=i.geometry.triangles.length-1;0<=r;r--)(n=i.geometry.triangles[r]).polygon.parentNode!==this.element&&this.element.appendChild(n.polygon),s=this.formatPoint(n.a)+" ",s+=this.formatPoint(n.b)+" ",s+=this.formatPoint(n.c),o=this.formatStyle(n.color.format()),n.polygon.setAttributeNS(null,"points",s),n.polygon.setAttributeNS(null,"
1style",o);return this},FSS.SVGRenderer.prototype.formatPoint=function(t){return this.halfWidth+t.position[0]+","+(this.halfHeight-t.position[1])},FSS.SVGRenderer.prototype.formatStyle=function(t){return"fill:"+t+";"+"stroke:"+t+";"},jQuery("#fss").length&&function(){var c,n,u,i,S,r,e,s,o,f={width:1.2,height:1.2,depth:2,segments:8,slices:5,xRange:.3,yRange:.2,zRange:1,ambient:"#000000",diffuse:"#FFFFFF",speed:.002},d={count:4,xyScalar:1,zOffset:30,ambient:"#000000",diffuse:"#FFFFFF",speed:.0015,gravity:1200,dampening:.95,minLimit:10,maxLimit:null,minDistance:20,maxDistance:400,autopilot:!1,draw:!1,bounds:FSS.Vector3.create(),step:FSS.Vector3.create(Math.randomInRange(.2,1),Math.randomInRange(.2,1),Math.randomInRange(.2,1))},a="webgl",h="canvas",l="svg",m={renderer:h},t=Date.now(),g=FSS.Vector3.create(),p=FSS.Vector3.create(),F=document.getElementById("fss"),b=document.getElementById("fss");function y(){var t,e;for(u.remove(i),n.clear(),S=new FSS.Plane(f.width*n.width,f.height*n.height,f.segments,f.slices),r=new FSS.Material(f.ambient,f.diffuse),i=new FSS.Mesh(S,r),u.add(i),t=S.vertices.length-1;0<=t;t--)(e=S.vertices[t]).anchor=FSS.Vector3.clone(e.position),e.step=FSS.Vector3.create(Math.randomInRange(.2,1),Math.randomInRange(.2,1),Math.randomInRange(.2,1)),e.time=Math.randomInRange(0,Math.PIM2)}function v(){var t,e;for(t=u.lights.length-1;0<=t;t--)e=u.lights[t],u.remove(e);for(n.clear(),t=0;t<d.count;t++)(e=new FSS.Light(d.ambient,d.diffuse)).ambientHex=e.ambient.format(),e.diffuseHex=e.diffuse.format(),u.add(e),e.mass=Math.randomInRange(.5,1),e.velocity=FSS.Vector3.create(),e.acceleration=FSS.Vector3.create(),e.force=FSS.Vector3.create()}function V(t,e){n.setSize(t,e),FSS.Vector3.set(g,n.halfWidth,n.halfHeight),y()}function w(){c=Date.now()-t,function(){var t,e,i,r,n,s,o,a=f.depth/2;for(FSS.Vector3.copy(d.bounds,g),FSS.Vector3.multiplyScalar(d.bounds,d.xyScalar),FSS.Vector3.setZ(p,d.zOffset),d.autopilot&&(t=Math.sin(d.step[0]*c*d.speed),e=Math.cos(d.step[1]*c*d.speed),FSS.Vector3.set(p,d.bounds[0]*t,d.bounds[1]*e,d.zOffset)),r=u.lights.length-1;0<=r;r--){n=u.lights[r],FSS.Vector3.setZ(n.position,d.zOffset);var h=Math.clamp(FSS.Vector3.distanceSquared(n.position,p),d.minDistance,d.maxDistance),l=d.gravity*n.mass/h;FSS.Vector3.subtractVectors(n.force,p,n.position),FSS.Vector3.normalise(n.force),FSS.Vector3.multiplyScalar(n.force,l),FSS.Vector3.set(n.acceleration),FSS.Vector3.add(n.acceleration,n.force),FSS.Vector3.add(n.velocity,n.acceleration),FSS.Vector3.multiplyScalar(n.velocity,d.dampening),FSS.Vector3.limit(n.velocity,d.minLimit,d.maxLimit),FSS.Vector3.add(n.position,n.velocity)}for(s=S.vertices.length-1;0<=s;s--)o=S.vertices[s],t=Math.sin(o.time+o.step[0]*c*f.speed),e=Math.cos(o.time+o.step[1]*c*f.speed),i=Math.sin(o.time+o.step[2]*c*f.speed),FSS.Vector3.set(o.position,f.xRange*S.segmentWidth*t,f.yRange*S.sliceHeight*e,f.zRange*a*i-a),FSS.Vector3.add(o.position,o.anchor);S.dirty=!0}(),R(),requestAnimationFrame(w)}function R(){var t,e,i,r;if(n.render(u),d.draw)for(t=u.lights.length-1;0<=t;t--)switch(e=(r=u.lights[t]).position[0],i=r.position[1],m.renderer){case h:n.context.lineWidth=.5,n.context.beginPath(),n.context.arc(e,i,10,0,Math.PIM2),n.context.strokeStyle=r.ambientHex,n.context.stroke(),n.context.beginPath(),n.context.arc(e,i,4,0,Math.PIM2),n.context.fillStyle=r.diffuseHex,n.context.fill();break;case l:e+=n.halfWidth,i=n.halfHeight-i,r.core.setAttributeNS(null,"fill",r.diffuseHex),r.core.setAttributeNS(null,"cx",e),r.core.setAttributeNS(null,"cy",i),n.element.appendChild(r.core),r.ring.setAttributeNS(null,"stroke",r.ambientHex),r.ring.setAttributeNS(null,"cx",e),r.ring.setAttributeNS(null,"cy",i),n.element.appendChild(r.ring)}}function x(t){FSS.Vector3.set(p,t.x,n.height-t.y),FSS.Vector3.subtract(p,g),d.autopilot=!d.autopilot}function A(t){FSS.Vector3.set(p,t.x,n.height-t.y),FSS.Vector3.subtract(p,g)}function L(t){V(F.offsetWidth,F.offsetHeight),R()}e=new FSS.WebGLRenderer,s=new FSS.CanvasRenderer,o=new FSS.SVGRenderer,function(t){switch(n&&b.removeChild(n.element),t){case a:n=e;break;case h:n=s;break;case l:n=o}n.setSize(F.offsetWidth,F.offsetHeight),b.appendChild(n.element)}(m.renderer),u=new FSS.Scene,y(),v(),window.addEventListener("resize",L),F.addEventListener("click",x),F.addEventListener("mousemove",A),V(F.offsetWidth,F.offsetHeight),w()}();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.