|
@@ -1,4 +1,4 @@
|
|
|
-// Three.js r35 - http://github.com/mrdoob/three.js
|
|
|
+// Three.js r36 - http://github.com/mrdoob/three.js
|
|
|
var THREE=THREE||{};THREE.Color=function(a){this.setHex(a)};
|
|
|
THREE.Color.prototype={autoUpdate:!0,setRGB:function(a,c,b){this.r=a;this.g=c;this.b=b;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,c,b){var d,e,g,h,j,k;if(b==0)d=e=g=0;else{h=Math.floor(a*6);j=a*6-h;a=b*(1-c);k=b*(1-c*j);c=b*(1-c*(1-j));switch(h){case 1:d=k;e=b;g=a;break;case 2:d=a;e=b;g=c;break;case 3:d=a;e=k;g=b;break;case 4:d=c;e=a;g=b;break;case 5:d=b;e=a;g=k;break;case 6:case 0:d=b;e=c;g=a}}this.r=d;this.g=e;this.b=g;if(this.autoUpdate){this.updateHex();
|
|
|
this.updateStyleString()}},setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGB();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+","+~~(this.g*255)+","+~~(this.b*255)+")"},clone:function(){return new THREE.Color(this.hex)}};
|
|
@@ -48,7 +48,7 @@ c,b)}}};THREE.Quaternion=function(a,c,b,d){this.set(a||0,c||0,b||0,d!==undefined
|
|
|
THREE.Quaternion.prototype={set:function(a,c,b,d){this.x=a;this.y=c;this.z=b;this.w=d;return this},setFromEuler:function(a){var c=0.5*Math.PI/360,b=a.x*c,d=a.y*c,e=a.z*c;a=Math.cos(d);d=Math.sin(d);c=Math.cos(-e);e=Math.sin(-e);var g=Math.cos(b);b=Math.sin(b);var h=a*c,j=d*e;this.w=h*g-j*b;this.x=h*b+j*g;this.y=d*c*g+a*e*b;this.z=a*e*g-d*c*b;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
|
|
|
-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var c=this.x,b=this.y,d=this.z,e=this.w,g=a.x,h=a.y,j=a.z;a=a.w;this.x=c*a+e*g+b*j-d*h;this.y=b*a+e*h+d*g-c*j;this.z=d*a+e*j+c*h-b*g;this.w=e*a-c*g-b*h-d*j;return this},
|
|
|
multiplyVector3:function(a,c){c||(c=a);var b=a.x,d=a.y,e=a.z,g=this.x,h=this.y,j=this.z,k=this.w,l=k*b+h*e-j*d,o=k*d+j*b-g*e,v=k*e+g*d-h*b;b=-g*b-h*d-j*e;c.x=l*k+b*-g+o*-j-v*-h;c.y=o*k+b*-h+v*-g-l*-j;c.z=v*k+b*-j+l*-h-o*-g;return c}};
|
|
|
-THREE.Quaternion.slerp=function(a,c,b,d){var e=a.w*c.w+a.x*c.x+a.y*c.y+a.z*c.z;if(Math.abs(e)>=1){b.w=a.w;b.x=a.x;b.y=a.y;b.z=a.z;return b}var g=Math.acos(e),h=Math.sqrt(1-e*e);if(Math.abs(h)<0.0010){b.w=0.5*(a.w+c.w);b.x=0.5*(a.x+c.x);b.y=0.5*(a.y+c.y);b.z=0.5*(a.z+c.z);return b}e=Math.sin((1-d)*g)/h;d=Math.sin(d*g)/h;b.w=a.w*e+c.w*d;b.x=a.x*e+c.x*d;b.y=a.y*e+c.y*d;b.z=a.z*e+c.z*d;return b};
|
|
|
+THREE.Quaternion.slerp=function(a,c,b,d){var e=a.w*c.w+a.x*c.x+a.y*c.y+a.z*c.z;if(Math.abs(e)>=1){b.w=a.w;b.x=a.x;b.y=a.y;b.z=a.z;return b}var g=Math.acos(e),h=Math.sqrt(1-e*e);if(Math.abs(h)<0.001){b.w=0.5*(a.w+c.w);b.x=0.5*(a.x+c.x);b.y=0.5*(a.y+c.y);b.z=0.5*(a.z+c.z);return b}e=Math.sin((1-d)*g)/h;d=Math.sin(d*g)/h;b.w=a.w*e+c.w*d;b.x=a.x*e+c.x*d;b.y=a.y*e+c.y*d;b.z=a.z*e+c.z*d;return b};
|
|
|
THREE.Vertex=function(a,c){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=c||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=!0};
|
|
|
THREE.Face3=function(a,c,b,d,e){this.a=a;this.b=c;this.c=b;this.centroid=new THREE.Vector3;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.materials=e instanceof Array?e:[e]};THREE.Face4=function(a,c,b,d,e,g){this.a=a;this.b=c;this.c=b;this.d=d;this.centroid=new THREE.Vector3;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.materials=g instanceof Array?g:[g]};
|
|
|
THREE.UV=function(a,c){this.set(a||0,c||0)};THREE.UV.prototype={set:function(a,c){this.u=a;this.v=c;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.faces=[];this.uvs=[];this.uvs2=[];this.colors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
|
|
@@ -80,10 +80,10 @@ THREE.Animation.prototype.interpolateCatmullRom=function(a,c){var b=[],d=[],e,g,
|
|
|
THREE.Animation.prototype.interpolate=function(a,c,b,d,e,g,h){a=(b-a)*0.5;d=(d-c)*0.5;return(2*(c-b)+a+d)*h+(-3*(c-b)-2*a-d)*g+a*e+c};THREE.Animation.prototype.getNextKeyWith=function(a,c,b){var d=this.data.hierarchy[c].keys;if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)b=b<d.length-1?b:d.length-1;else b%=d.length;for(;b<d.length;b++)if(d[b][a]!==undefined)return d[b];return this.data.hierarchy[c].keys[0]};
|
|
|
THREE.Animation.prototype.getPrevKeyWith=function(a,c,b){var d=this.data.hierarchy[c].keys;for(b=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b>0?b:0:b>=0?b:b+d.length;b>=0;b--)if(d[b][a]!==undefined)return d[b];return this.data.hierarchy[c].keys[d.length-1]};
|
|
|
THREE.Camera=function(a,c,b,d,e){THREE.Object3D.call(this);this.fov=a||50;this.aspect=c||1;this.near=b||0.1;this.far=d||2E3;this.target=e||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
|
|
|
-THREE.Camera.prototype.translate=function(a,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(a));this.target.position.addSelf(c.multiplyScalar(a))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};
|
|
|
+THREE.Camera.prototype.translate=function(a,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(a));this.target.position.addSelf(c.multiplyScalar(a))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};THREE.Camera.prototype.updateMatrix=function(){this.update(undefined,!0)};
|
|
|
THREE.Camera.prototype.update=function(a,c,b){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);this.matrix.setPosition(this.position);a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);c=!0}else{this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=
|
|
|
!1;c=!0;THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,c,b)};
|
|
|
-THREE.QuakeCamera=function(a){function c(b,d){return function(){d.apply(b,arguments)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.dragToLook=!1;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.domElement=document;if(a){if(a.movementSpeed!==undefined)this.movementSpeed=a.movementSpeed;if(a.lookSpeed!==undefined)this.lookSpeed=a.lookSpeed;if(a.noFly!==undefined)this.noFly=
|
|
|
+THREE.QuakeCamera=function(a){function c(b,d){return function(){d.apply(b,arguments)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.movementSpeed=1;this.lookSpeed=0.005;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.dragToLook=!1;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.domElement=document;if(a){if(a.movementSpeed!==undefined)this.movementSpeed=a.movementSpeed;if(a.lookSpeed!==undefined)this.lookSpeed=a.lookSpeed;if(a.noFly!==undefined)this.noFly=
|
|
|
a.noFly;if(a.lookVertical!==undefined)this.lookVertical=a.lookVertical;if(a.autoForward!==undefined)this.autoForward=a.autoForward;if(a.dragToLook!==undefined)this.dragToLook=a.dragToLook;if(a.heightSpeed!==undefined)this.heightSpeed=a.heightSpeed;if(a.heightCoef!==undefined)this.heightCoef=a.heightCoef;if(a.heightMin!==undefined)this.heightMin=a.heightMin;if(a.heightMax!==undefined)this.heightMax=a.heightMax;if(a.domElement!==undefined)this.domElement=a.domElement}this.theta=this.phi=this.lon=this.lat=
|
|
|
this.mouseY=this.mouseX=this.autoSpeedFactor=0;this.moveForward=!1;this.moveBackward=!1;this.moveLeft=!1;this.moveRight=!1;this.mouseDragOn=!1;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;this.onMouseDown=function(b){b.preventDefault();b.stopPropagation();if(!this.dragToLook)switch(b.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(b){b.preventDefault();b.stopPropagation();if(!this.dragToLook)switch(b.button){case 0:this.moveForward=
|
|
|
!1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(b){this.mouseX=b.clientX-this.windowHalfX;this.mouseY=b.clientY-this.windowHalfY};this.onKeyDown=function(b){switch(b.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:case 65:this.moveLeft=!0;break;case 40:case 83:this.moveBackward=!0;break;case 39:case 68:this.moveRight=!0}};this.onKeyUp=function(b){switch(b.keyCode){case 38:case 87:this.moveForward=!1;break;case 37:case 65:this.moveLeft=!1;break;case 40:case 83:this.moveBackward=
|
|
@@ -94,7 +94,7 @@ THREE.QuakeCamera.prototype.translate=function(a,c){this.matrix.rotateAxis(c);if
|
|
|
THREE.PathCamera=function(a){function c(l,o){var v=l[0]-o[0],u=l[1]-o[1],t=l[2]-o[2];return Math.sqrt(v*v+u*u+t*t)}function b(l,o,v,u){var t={name:v,fps:0.6,length:u,hierarchy:[]},y,A;y=o.length;var D,w,F=[];A=new THREE.Spline;var x=0;for(D=0;D<o.length;D++){w=o[D];F[D]={x:w[0],y:w[1],z:w[2]}}var N=[o[0][0],o[0][1],o[0][2]];for(D=1;D<F.length*100;D++){w=D/(F.length*100);position=A.getPoint(F,w);x+=c([position.x,position.y,position.z],N);N=[position.x,position.y,position.z]}D=x;F=0;x=y-1;A={parent:-1,
|
|
|
keys:[]};A.keys[0]={time:0,pos:o[0],rot:[0,0,0,1],scl:[1,1,1]};A.keys[x]={time:u,pos:o[x],rot:[0,0,0,1],scl:[1,1,1]};console.log("path totalLength: ",D);for(y=1;y<x;y++){F+=u*c(o[y],o[y-1])/D;A.keys[y]={time:F,pos:o[y]}}t.hierarchy[0]=A;THREE.AnimationHandler.add(t);return new THREE.Animation(l,v,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function d(l,o){var v,u,t=new THREE.Geometry,y=new THREE.Spline,A=[];for(v=0;v<o.length;v++){u=o[v];A[v]={x:u[0],y:u[1],z:u[2]}}for(v=0;v<A.length*10;v++){u=
|
|
|
v/(A.length*10);u=y.getPoint(A,u);t.vertices[v]=new THREE.Vertex(new THREE.Vector3(u.x,u.y,u.z))}v=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(t,v);lineObj.scale.set(1,1,1);l.addChild(lineObj);v=new Sphere(1,16,8);y=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<o.length;i++){t=new THREE.Mesh(v,y);t.position.set(o[i][0],o[i][1],o[i][2]);t.updateMatrix();l.addChild(t)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.duration=1E4;this.waypoints=
|
|
|
-[];this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookVertical=!0;this.lookHorizontal=!0;this.verticalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.horizontalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.domElement=document;if(a){if(a.duration!==undefined)this.duration=a.duration*1E3;if(a.waypoints!==undefined)this.waypoints=a.waypoints;if(a.createDebugPath!==undefined)this.createDebugPath=a.createDebugPath;
|
|
|
+[];this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.005;this.lookVertical=!0;this.lookHorizontal=!0;this.verticalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.horizontalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.domElement=document;if(a){if(a.duration!==undefined)this.duration=a.duration*1E3;if(a.waypoints!==undefined)this.waypoints=a.waypoints;if(a.createDebugPath!==undefined)this.createDebugPath=a.createDebugPath;
|
|
|
if(a.createDebugDummy!==undefined)this.createDebugDummy=a.createDebugDummy;if(a.lookSpeed!==undefined)this.lookSpeed=a.lookSpeed;if(a.lookVertical!==undefined)this.lookVertical=a.lookVertical;if(a.lookHorizontal!==undefined)this.lookHorizontal=a.lookHorizontal;if(a.verticalAngleMap!==undefined)this.verticalAngleMap=a.verticalAngleMap;if(a.horizontalAngleMap!==undefined)this.horizontalAngleMap=a.horizontalAngleMap;if(a.domElement!==undefined)this.domElement=a.domElement}this.theta=this.phi=this.lon=
|
|
|
this.lat=this.mouseY=this.mouseX=0;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;var e=Math.PI*2,g=Math.PI/180;this.updateManual=function(){var l,o;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*g;this.theta=this.lon*g;l=this.phi%e;this.phi=l>=0?l:l+e;l=this.verticalAngleMap.srcRange;o=this.verticalAngleMap.dstRange;
|
|
|
this.phi=(this.phi-l[0])*(o[1]-o[0])/(l[1]-l[0])+o[0];l=this.horizontalAngleMap.srcRange;o=this.horizontalAngleMap.dstRange;this.theta=(this.theta-l[0])*(o[1]-o[0])/(l[1]-l[0])+o[0];l=this.target.position;o=this.position;l.x=o.x+100*Math.sin(this.phi)*Math.cos(this.theta);l.y=o.y+100*Math.cos(this.phi);l.z=o.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this)};this.onMouseMove=function(l){this.mouseX=l.clientX-this.windowHalfX;this.mouseY=l.clientY-this.windowHalfY};if(this.createDebugDummy){a=
|
|
@@ -259,35 +259,35 @@ maxDirLights:z.directional,maxPointLights:z.point,maxBones:B};q=f.createProgram(
|
|
|
B=[f.getParameter(f.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+B.maxDirLights,"#define MAX_POINT_LIGHTS "+B.maxPointLights,"#define MAX_BONES "+B.maxBones,B.map?"#define USE_MAP":"",B.envMap?"#define USE_ENVMAP":"",B.lightMap?"#define USE_LIGHTMAP":"",B.vertexColors?"#define USE_COLOR":"",B.skinning?"#define USE_SKINNING":"",B.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n");
|
|
|
f.attachShader(q,N("fragment",z+n));f.attachShader(q,N("vertex",B+H));f.linkProgram(q);f.getProgramParameter(q,f.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+f.getProgramParameter(q,f.VALIDATE_STATUS)+", gl error ["+f.getError()+"]");q.uniforms={};q.attributes={};m.program=q;q=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices"];for(p in m.uniforms)q.push(p);p=m.program;n=0;for(H=q.length;n<
|
|
|
H;n++){z=q[n];p.uniforms[z]=f.getUniformLocation(p,z)}p=m.program;q=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];n=0;for(H=q.length;n<H;n++){z=q[n];p.attributes[z]=f.getAttribLocation(p,z)}p=m.program.attributes;f.enableVertexAttribArray(p.position);p.color>=0&&f.enableVertexAttribArray(p.color);p.normal>=0&&f.enableVertexAttribArray(p.normal);p.tangent>=0&&f.enableVertexAttribArray(p.tangent);if(m.skinning&&p.skinVertexA>=0&&p.skinVertexB>=
|
|
|
-0&&p.skinIndex>=0&&p.skinWeight>=0){f.enableVertexAttribArray(p.skinVertexA);f.enableVertexAttribArray(p.skinVertexB);f.enableVertexAttribArray(p.skinIndex);f.enableVertexAttribArray(p.skinWeight)}};this.render=function(m,z,q,n){var p,B,C,G,Q,H,O,la,ka=m.lights,ra=m.fog;z.matrixAutoUpdate&&z.parent===undefined&&z.update(undefined,!0);m.update(undefined,!1,z);z.matrixWorldInverse.flattenToArray(aa);z.projectionMatrix.flattenToArray(ha);ya.multiply(z.projectionMatrix,z.matrixWorldInverse);k(ya);this.initWebGLObjects(m);
|
|
|
-x(q);(this.autoClear||n)&&this.clear();Q=m.__webglObjects.length;for(n=0;n<Q;n++){p=m.__webglObjects[n];O=p.object;if(O.visible)if(!(O instanceof THREE.Mesh)||l(O)){O.matrixWorld.flattenToArray(O._objectMatrixArray);y(O,z);u(p);p.render=!0;if(this.sortObjects){ma.copy(O.position);ya.multiplyVector3(ma);p.z=ma.z}}else p.render=!1;else p.render=!1}this.sortObjects&&m.__webglObjects.sort(t);H=m.__webglObjectsImmediate.length;for(n=0;n<H;n++){p=m.__webglObjectsImmediate[n];O=p.object;if(O.visible){O.matrixAutoUpdate&&
|
|
|
-O.matrixWorld.flattenToArray(O._objectMatrixArray);y(O,z);v(p)}}w(THREE.NormalBlending);for(n=0;n<Q;n++){p=m.__webglObjects[n];if(p.render){O=p.object;la=p.buffer;C=p.opaque;h(O);for(p=0;p<C.count;p++){G=C.list[p];j(G.depthTest);e(z,ka,ra,G,la,O)}}}for(n=0;n<H;n++){p=m.__webglObjectsImmediate[n];O=p.object;if(O.visible){C=p.opaque;h(O);for(p=0;p<C.count;p++){G=C.list[p];j(G.depthTest);B=d(z,ka,ra,G,O);O.render(function(sa){g(sa,B)})}}}for(n=0;n<Q;n++){p=m.__webglObjects[n];if(p.render){O=p.object;
|
|
|
-la=p.buffer;C=p.transparent;h(O);for(p=0;p<C.count;p++){G=C.list[p];w(G.blending);j(G.depthTest);e(z,ka,ra,G,la,O)}}}for(n=0;n<H;n++){p=m.__webglObjectsImmediate[n];O=p.object;if(O.visible){C=p.transparent;h(O);for(p=0;p<C.count;p++){G=C.list[p];w(G.blending);j(G.depthTest);B=d(z,ka,ra,G,O);O.render(function(sa){g(sa,B)})}}}if(q&&q.minFilter!==THREE.NearestFilter&&q.minFilter!==THREE.LinearFilter){f.bindTexture(f.TEXTURE_2D,q.__webGLTexture);f.generateMipmap(f.TEXTURE_2D);f.bindTexture(f.TEXTURE_2D,
|
|
|
-null)}};this.initWebGLObjects=function(m){if(!m.__webglObjects){m.__webglObjects=[];m.__webglObjectsImmediate=[]}for(;m.__objectsAdded.length;){var z=m.__objectsAdded[0],q=m,n=void 0,p=void 0,B=void 0;if(z._modelViewMatrix==undefined){z._modelViewMatrix=new THREE.Matrix4;z._normalMatrixArray=new Float32Array(9);z._modelViewMatrixArray=new Float32Array(16);z._objectMatrixArray=new Float32Array(16);z.matrixWorld.flattenToArray(z._objectMatrixArray)}if(z instanceof THREE.Mesh){p=z.geometry;p.geometryGroups==
|
|
|
-undefined&&A(p);for(n in p.geometryGroups){B=p.geometryGroups[n];if(!B.__webGLVertexBuffer){var C=B;C.__webGLVertexBuffer=f.createBuffer();C.__webGLNormalBuffer=f.createBuffer();C.__webGLTangentBuffer=f.createBuffer();C.__webGLColorBuffer=f.createBuffer();C.__webGLUVBuffer=f.createBuffer();C.__webGLUV2Buffer=f.createBuffer();C.__webGLSkinVertexABuffer=f.createBuffer();C.__webGLSkinVertexBBuffer=f.createBuffer();C.__webGLSkinIndicesBuffer=f.createBuffer();C.__webGLSkinWeightsBuffer=f.createBuffer();
|
|
|
-C.__webGLFaceBuffer=f.createBuffer();C.__webGLLineBuffer=f.createBuffer();C=B;var G=z,Q=void 0,H=void 0,O=0,la=0,ka=0,ra=G.geometry.faces,sa=C.faces;Q=0;for(H=sa.length;Q<H;Q++){fi=sa[Q];face=ra[fi];if(face instanceof THREE.Face3){O+=3;la+=1;ka+=3}else if(face instanceof THREE.Face4){O+=4;la+=2;ka+=4}}C.__vertexArray=new Float32Array(O*3);C.__normalArray=new Float32Array(O*3);C.__tangentArray=new Float32Array(O*4);C.__colorArray=new Float32Array(O*3);C.__uvArray=new Float32Array(O*2);C.__uv2Array=
|
|
|
-new Float32Array(O*2);C.__skinVertexAArray=new Float32Array(O*4);C.__skinVertexBArray=new Float32Array(O*4);C.__skinIndexArray=new Float32Array(O*4);C.__skinWeightArray=new Float32Array(O*4);C.__faceArray=new Uint16Array(la*3);C.__lineArray=new Uint16Array(ka*2);H=Q=C;O=void 0;ra=void 0;var oa=void 0,pa=void 0;oa=void 0;sa=!1;O=0;for(ra=G.materials.length;O<ra;O++){oa=G.materials[O];if(oa instanceof THREE.MeshFaceMaterial){oa=0;for(pa=H.materials.length;oa<pa;oa++)if(H.materials[oa]&&H.materials[oa].shading!=
|
|
|
-undefined&&H.materials[oa].shading==THREE.SmoothShading){sa=!0;break}}else if(oa&&oa.shading!=undefined&&oa.shading==THREE.SmoothShading){sa=!0;break}if(sa)break}Q.__needsSmoothNormals=sa;C.__webGLFaceCount=la*3;C.__webGLLineCount=ka*2;p.__dirtyVertices=!0;p.__dirtyElements=!0;p.__dirtyUvs=!0;p.__dirtyNormals=!0;p.__dirtyTangents=!0;p.__dirtyColors=!0}D(q.__webglObjects,B,z)}}else if(z instanceof THREE.Ribbon){p=z.geometry;if(!p.__webGLVertexBuffer){n=p;n.__webGLVertexBuffer=f.createBuffer();n.__webGLColorBuffer=
|
|
|
-f.createBuffer();n=p;B=n.vertices.length;n.__vertexArray=new Float32Array(B*3);n.__colorArray=new Float32Array(B*3);n.__webGLVertexCount=B;p.__dirtyVertices=!0;p.__dirtyColors=!0}D(q.__webglObjects,p,z)}else if(z instanceof THREE.Line){p=z.geometry;if(!p.__webGLVertexBuffer){n=p;n.__webGLVertexBuffer=f.createBuffer();n.__webGLColorBuffer=f.createBuffer();n=p;B=n.vertices.length;n.__vertexArray=new Float32Array(B*3);n.__colorArray=new Float32Array(B*3);n.__webGLLineCount=B;p.__dirtyVertices=!0;p.__dirtyColors=
|
|
|
-!0}D(q.__webglObjects,p,z)}else if(z instanceof THREE.ParticleSystem){p=z.geometry;if(!p.__webGLVertexBuffer){n=p;n.__webGLVertexBuffer=f.createBuffer();n.__webGLColorBuffer=f.createBuffer();n=p;B=n.vertices.length;n.__vertexArray=new Float32Array(B*3);n.__colorArray=new Float32Array(B*3);n.__sortArray=[];n.__webGLParticleCount=B;p.__dirtyVertices=!0;p.__dirtyColors=!0}D(q.__webglObjects,p,z)}else THREE.MarchingCubes!==undefined&&z instanceof THREE.MarchingCubes&&q.__webglObjectsImmediate.push({object:z,
|
|
|
-opaque:{list:[],count:0},transparent:{list:[],count:0}});m.__objectsAdded.splice(0,1)}for(;m.__objectsRemoved.length;){z=m.__objectsRemoved[0];q=m;p=void 0;n=void 0;for(p=q.__webglObjects.length-1;p>=0;p--){n=q.__webglObjects[p].object;z==n&&q.__webglObjects.splice(p,1)}m.__objectsRemoved.splice(0,1)}z=0;for(q=m.__webglObjects.length;z<q;z++){n=m.__webglObjects[z].object;B=void 0;p=void 0;C=void 0;if(n instanceof THREE.Mesh){p=n.geometry;for(B in p.geometryGroups){C=p.geometryGroups[B];if(p.__dirtyVertices||
|
|
|
-p.__dirtyElements||p.__dirtyUvs||p.__dirtyNormals||p.__dirtyColors||p.__dirtyTangents){la=f.DYNAMIC_DRAW;ka=void 0;Q=void 0;var Ja=void 0,P=void 0,Ga=void 0,Ea=void 0,Fa=void 0;Ja=void 0;var W=void 0,X=void 0,$=void 0,Aa=void 0;W=void 0;X=void 0;$=void 0;P=void 0;W=void 0;X=void 0;$=void 0;Aa=void 0;W=void 0;X=void 0;$=void 0;Aa=void 0;W=void 0;X=void 0;$=void 0;Aa=void 0;W=void 0;X=void 0;$=void 0;Aa=void 0;W=void 0;X=void 0;$=void 0;Aa=void 0;P=void 0;Ea=void 0;Ga=void 0;Fa=void 0;var Ha=pa=oa=
|
|
|
-sa=ra=O=G=H=0,Da=0,E=0,Ca=C.__vertexArray,Ra=C.__uvArray,Ua=C.__uv2Array,Ma=C.__normalArray,Ba=C.__tangentArray,J=C.__colorArray,Y=C.__skinVertexAArray,U=C.__skinVertexBArray,K=C.__skinIndexArray,S=C.__skinWeightArray,ua=C.__faceArray,wa=C.__lineArray,Ia=C.__needsSmoothNormals,za=n.geometry,Pa=za.__dirtyVertices,Ka=za.__dirtyElements,La=za.__dirtyUvs,Ta=za.__dirtyNormals,Na=za.__dirtyTangents,Qa=za.__dirtyColors,Oa=za.vertices,Za=C.faces,$a=za.faces,ab=za.uvs,bb=za.uvs2,Sa=za.colors,Wa=za.skinVerticesA,
|
|
|
-Xa=za.skinVerticesB,Ya=za.skinIndices,Va=za.skinWeights;ka=0;for(Q=Za.length;ka<Q;ka++){Ja=Za[ka];P=$a[Ja];Fa=ab[Ja];Ja=bb[Ja];Ga=P.vertexNormals;Ea=P.normal;if(P instanceof THREE.Face3){if(Pa){W=Oa[P.a].position;X=Oa[P.b].position;$=Oa[P.c].position;Ca[G]=W.x;Ca[G+1]=W.y;Ca[G+2]=W.z;Ca[G+3]=X.x;Ca[G+4]=X.y;Ca[G+5]=X.z;Ca[G+6]=$.x;Ca[G+7]=$.y;Ca[G+8]=$.z;G+=9}if(Va.length){W=Va[P.a];X=Va[P.b];$=Va[P.c];S[E]=W.x;S[E+1]=W.y;S[E+2]=W.z;S[E+3]=W.w;S[E+4]=X.x;S[E+5]=X.y;S[E+6]=X.z;S[E+7]=X.w;S[E+8]=$.x;
|
|
|
-S[E+9]=$.y;S[E+10]=$.z;S[E+11]=$.w;W=Ya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Ea.z;oa+=3}else for(P=0;P<4;P++){Ma[oa]=Ea.x;Ma[oa+1]=Ea.y;Ma[oa+2]=Ea.z;oa+=3}if(La&&Fa)for(P=0;P<4;P++){Ga=Fa[P];Ra[O]=Ga.u;Ra[O+1]=Ga.v;O+=2}if(La&&Ja)for(P=0;P<4;P++){Fa=Ja[P];Ua[ra]=Fa.u;Ua[ra+1]=Fa.v;ra+=2}if(Ka){ua[sa]=H;ua[sa+1]=H+1;ua[sa+2]=H+2;ua[sa+3]=H;ua[sa+4]=H+2;ua[sa+5]=H+3;sa+=6;wa[Ha]=H;wa[Ha+1]=H+1;wa[Ha+2]=H;wa[Ha+3]=H+3;wa[Ha+4]=H+1;wa[Ha+5]=H+2;wa[Ha+6]=H+2;wa[Ha+
|
|
|
-7]=H+3;Ha+=8;H+=4}}}if(Pa){f.bindBuffer(f.ARRAY_BUFFER,C.__webGLVertexBuffer);f.bufferData(f.ARRAY_BUFFER,Ca,la)}if(Qa&&Sa.length){f.bindBuffer(f.ARRAY_BUFFER,C.__webGLColorBuffer);f.bufferData(f.ARRAY_BUFFER,J,la)}if(Ta){f.bindBuffer(f.ARRAY_BUFFER,C.__webGLNormalBuffer);f.bufferData(f.ARRAY_BUFFER,Ma,la)}if(Na&&za.hasTangents){f.bindBuffer(f.ARRAY_BUFFER,C.__webGLTangentBuffer);f.bufferData(f.ARRAY_BUFFER,Ba,la)}if(La&&O>0){f.bindBuffer(f.ARRAY_BUFFER,C.__webGLUVBuffer);f.bufferData(f.ARRAY_BUFFER,
|
|
|
-Ra,la)}if(La&&ra>0){f.bindBuffer(f.ARRAY_BUFFER,C.__webGLUV2Buffer);f.bufferData(f.ARRAY_BUFFER,Ua,la)}if(Ka){f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,C.__webGLFaceBuffer);f.bufferData(f.ELEMENT_ARRAY_BUFFER,ua,la);f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,C.__webGLLineBuffer);f.bufferData(f.ELEMENT_ARRAY_BUFFER,wa,la)}if(E>0){f.bindBuffer(f.ARRAY_BUFFER,C.__webGLSkinVertexABuffer);f.bufferData(f.ARRAY_BUFFER,Y,la);f.bindBuffer(f.ARRAY_BUFFER,C.__webGLSkinVertexBBuffer);f.bufferData(f.ARRAY_BUFFER,U,la);f.bindBuffer(f.ARRAY_BUFFER,
|
|
|
-C.__webGLSkinIndicesBuffer);f.bufferData(f.ARRAY_BUFFER,K,la);f.bindBuffer(f.ARRAY_BUFFER,C.__webGLSkinWeightsBuffer);f.bufferData(f.ARRAY_BUFFER,S,la)}}}p.__dirtyVertices=!1;p.__dirtyElements=!1;p.__dirtyUvs=!1;p.__dirtyNormals=!1;p.__dirtyTangents=!1;p.__dirtyColors=!1}else if(n instanceof THREE.Ribbon){p=n.geometry;if(p.__dirtyVertices||p.__dirtyColors){n=p;B=f.DYNAMIC_DRAW;H=void 0;H=void 0;G=void 0;C=void 0;O=n.vertices;la=n.colors;ra=O.length;ka=la.length;sa=n.__vertexArray;Q=n.__colorArray;
|
|
|
-oa=n.__dirtyColors;if(n.__dirtyVertices){for(H=0;H<ra;H++){G=O[H].position;C=H*3;sa[C]=G.x;sa[C+1]=G.y;sa[C+2]=G.z}f.bindBuffer(f.ARRAY_BUFFER,n.__webGLVertexBuffer);f.bufferData(f.ARRAY_BUFFER,sa,B)}if(oa){for(H=0;H<ka;H++){color=la[H];C=H*3;Q[C]=color.r;Q[C+1]=color.g;Q[C+2]=color.b}f.bindBuffer(f.ARRAY_BUFFER,n.__webGLColorBuffer);f.bufferData(f.ARRAY_BUFFER,Q,B)}}p.__dirtyVertices=!1;p.__dirtyColors=!1}else if(n instanceof THREE.Line){p=n.geometry;if(p.__dirtyVertices||p.__dirtyColors){n=p;B=
|
|
|
-f.DYNAMIC_DRAW;H=void 0;H=void 0;G=void 0;C=void 0;O=n.vertices;la=n.colors;ra=O.length;ka=la.length;sa=n.__vertexArray;Q=n.__colorArray;oa=n.__dirtyColors;if(n.__dirtyVertices){for(H=0;H<ra;H++){G=O[H].position;C=H*3;sa[C]=G.x;sa[C+1]=G.y;sa[C+2]=G.z}f.bindBuffer(f.ARRAY_BUFFER,n.__webGLVertexBuffer);f.bufferData(f.ARRAY_BUFFER,sa,B)}if(oa){for(H=0;H<ka;H++){color=la[H];C=H*3;Q[C]=color.r;Q[C+1]=color.g;Q[C+2]=color.b}f.bindBuffer(f.ARRAY_BUFFER,n.__webGLColorBuffer);f.bufferData(f.ARRAY_BUFFER,
|
|
|
-Q,B)}}p.__dirtyVertices=!1;p.__dirtyColors=!1}else if(n instanceof THREE.ParticleSystem){p=n.geometry;(p.__dirtyVertices||p.__dirtyColors||n.sortParticles)&&c(p,f.DYNAMIC_DRAW,n);p.__dirtyVertices=!1;p.__dirtyColors=!1}}};this.setFaceCulling=function(m,z){if(m){!z||z=="ccw"?f.frontFace(f.CCW):f.frontFace(f.CW);if(m=="back")f.cullFace(f.BACK);else m=="front"?f.cullFace(f.FRONT):f.cullFace(f.FRONT_AND_BACK);f.enable(f.CULL_FACE)}else f.disable(f.CULL_FACE)};this.supportsVertexTextures=function(){return f.getParameter(f.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>
|
|
|
-0}};THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(a,c,b){b&&a.update(undefined,!1,c);b=a.sounds;var d,e=b.length;for(d=0;d<e;d++){a=b[d];this.soundPosition.set(a.matrixWorld.n14,a.matrixWorld.n24,a.matrixWorld.n34);this.soundPosition.subSelf(c.position);if(a.isPlaying&&a.isLoaded){a.isAddedToDOM||a.addToDOM(this.domElement);a.calculateVolumeAndPan(this.soundPosition)}}}};
|
|
|
+0&&p.skinIndex>=0&&p.skinWeight>=0){f.enableVertexAttribArray(p.skinVertexA);f.enableVertexAttribArray(p.skinVertexB);f.enableVertexAttribArray(p.skinIndex);f.enableVertexAttribArray(p.skinWeight)}};this.render=function(m,z,q,n){var p,B,C,G,Q,H,O,la,ka=m.lights,ra=m.fog;z.matrixAutoUpdate&&z.updateMatrix();m.update(undefined,!1,z);z.matrixWorldInverse.flattenToArray(aa);z.projectionMatrix.flattenToArray(ha);ya.multiply(z.projectionMatrix,z.matrixWorldInverse);k(ya);this.initWebGLObjects(m);x(q);(this.autoClear||
|
|
|
+n)&&this.clear();Q=m.__webglObjects.length;for(n=0;n<Q;n++){p=m.__webglObjects[n];O=p.object;if(O.visible)if(!(O instanceof THREE.Mesh)||l(O)){O.matrixWorld.flattenToArray(O._objectMatrixArray);y(O,z);u(p);p.render=!0;if(this.sortObjects){ma.copy(O.position);ya.multiplyVector3(ma);p.z=ma.z}}else p.render=!1;else p.render=!1}this.sortObjects&&m.__webglObjects.sort(t);H=m.__webglObjectsImmediate.length;for(n=0;n<H;n++){p=m.__webglObjectsImmediate[n];O=p.object;if(O.visible){O.matrixAutoUpdate&&O.matrixWorld.flattenToArray(O._objectMatrixArray);
|
|
|
+y(O,z);v(p)}}w(THREE.NormalBlending);for(n=0;n<Q;n++){p=m.__webglObjects[n];if(p.render){O=p.object;la=p.buffer;C=p.opaque;h(O);for(p=0;p<C.count;p++){G=C.list[p];j(G.depthTest);e(z,ka,ra,G,la,O)}}}for(n=0;n<H;n++){p=m.__webglObjectsImmediate[n];O=p.object;if(O.visible){C=p.opaque;h(O);for(p=0;p<C.count;p++){G=C.list[p];j(G.depthTest);B=d(z,ka,ra,G,O);O.render(function(sa){g(sa,B)})}}}for(n=0;n<Q;n++){p=m.__webglObjects[n];if(p.render){O=p.object;la=p.buffer;C=p.transparent;h(O);for(p=0;p<C.count;p++){G=
|
|
|
+C.list[p];w(G.blending);j(G.depthTest);e(z,ka,ra,G,la,O)}}}for(n=0;n<H;n++){p=m.__webglObjectsImmediate[n];O=p.object;if(O.visible){C=p.transparent;h(O);for(p=0;p<C.count;p++){G=C.list[p];w(G.blending);j(G.depthTest);B=d(z,ka,ra,G,O);O.render(function(sa){g(sa,B)})}}}if(q&&q.minFilter!==THREE.NearestFilter&&q.minFilter!==THREE.LinearFilter){f.bindTexture(f.TEXTURE_2D,q.__webGLTexture);f.generateMipmap(f.TEXTURE_2D);f.bindTexture(f.TEXTURE_2D,null)}};this.initWebGLObjects=function(m){if(!m.__webglObjects){m.__webglObjects=
|
|
|
+[];m.__webglObjectsImmediate=[]}for(;m.__objectsAdded.length;){var z=m.__objectsAdded[0],q=m,n=void 0,p=void 0,B=void 0;if(z._modelViewMatrix==undefined){z._modelViewMatrix=new THREE.Matrix4;z._normalMatrixArray=new Float32Array(9);z._modelViewMatrixArray=new Float32Array(16);z._objectMatrixArray=new Float32Array(16);z.matrixWorld.flattenToArray(z._objectMatrixArray)}if(z instanceof THREE.Mesh){p=z.geometry;p.geometryGroups==undefined&&A(p);for(n in p.geometryGroups){B=p.geometryGroups[n];if(!B.__webGLVertexBuffer){var C=
|
|
|
+B;C.__webGLVertexBuffer=f.createBuffer();C.__webGLNormalBuffer=f.createBuffer();C.__webGLTangentBuffer=f.createBuffer();C.__webGLColorBuffer=f.createBuffer();C.__webGLUVBuffer=f.createBuffer();C.__webGLUV2Buffer=f.createBuffer();C.__webGLSkinVertexABuffer=f.createBuffer();C.__webGLSkinVertexBBuffer=f.createBuffer();C.__webGLSkinIndicesBuffer=f.createBuffer();C.__webGLSkinWeightsBuffer=f.createBuffer();C.__webGLFaceBuffer=f.createBuffer();C.__webGLLineBuffer=f.createBuffer();C=B;var G=z,Q=void 0,H=
|
|
|
+void 0,O=0,la=0,ka=0,ra=G.geometry.faces,sa=C.faces;Q=0;for(H=sa.length;Q<H;Q++){fi=sa[Q];face=ra[fi];if(face instanceof THREE.Face3){O+=3;la+=1;ka+=3}else if(face instanceof THREE.Face4){O+=4;la+=2;ka+=4}}C.__vertexArray=new Float32Array(O*3);C.__normalArray=new Float32Array(O*3);C.__tangentArray=new Float32Array(O*4);C.__colorArray=new Float32Array(O*3);C.__uvArray=new Float32Array(O*2);C.__uv2Array=new Float32Array(O*2);C.__skinVertexAArray=new Float32Array(O*4);C.__skinVertexBArray=new Float32Array(O*
|
|
|
+4);C.__skinIndexArray=new Float32Array(O*4);C.__skinWeightArray=new Float32Array(O*4);C.__faceArray=new Uint16Array(la*3);C.__lineArray=new Uint16Array(ka*2);H=Q=C;O=void 0;ra=void 0;var oa=void 0,pa=void 0;oa=void 0;sa=!1;O=0;for(ra=G.materials.length;O<ra;O++){oa=G.materials[O];if(oa instanceof THREE.MeshFaceMaterial){oa=0;for(pa=H.materials.length;oa<pa;oa++)if(H.materials[oa]&&H.materials[oa].shading!=undefined&&H.materials[oa].shading==THREE.SmoothShading){sa=!0;break}}else if(oa&&oa.shading!=
|
|
|
+undefined&&oa.shading==THREE.SmoothShading){sa=!0;break}if(sa)break}Q.__needsSmoothNormals=sa;C.__webGLFaceCount=la*3;C.__webGLLineCount=ka*2;p.__dirtyVertices=!0;p.__dirtyElements=!0;p.__dirtyUvs=!0;p.__dirtyNormals=!0;p.__dirtyTangents=!0;p.__dirtyColors=!0}D(q.__webglObjects,B,z)}}else if(z instanceof THREE.Ribbon){p=z.geometry;if(!p.__webGLVertexBuffer){n=p;n.__webGLVertexBuffer=f.createBuffer();n.__webGLColorBuffer=f.createBuffer();n=p;B=n.vertices.length;n.__vertexArray=new Float32Array(B*3);
|
|
|
+n.__colorArray=new Float32Array(B*3);n.__webGLVertexCount=B;p.__dirtyVertices=!0;p.__dirtyColors=!0}D(q.__webglObjects,p,z)}else if(z instanceof THREE.Line){p=z.geometry;if(!p.__webGLVertexBuffer){n=p;n.__webGLVertexBuffer=f.createBuffer();n.__webGLColorBuffer=f.createBuffer();n=p;B=n.vertices.length;n.__vertexArray=new Float32Array(B*3);n.__colorArray=new Float32Array(B*3);n.__webGLLineCount=B;p.__dirtyVertices=!0;p.__dirtyColors=!0}D(q.__webglObjects,p,z)}else if(z instanceof THREE.ParticleSystem){p=
|
|
|
+z.geometry;if(!p.__webGLVertexBuffer){n=p;n.__webGLVertexBuffer=f.createBuffer();n.__webGLColorBuffer=f.createBuffer();n=p;B=n.vertices.length;n.__vertexArray=new Float32Array(B*3);n.__colorArray=new Float32Array(B*3);n.__sortArray=[];n.__webGLParticleCount=B;p.__dirtyVertices=!0;p.__dirtyColors=!0}D(q.__webglObjects,p,z)}else THREE.MarchingCubes!==undefined&&z instanceof THREE.MarchingCubes&&q.__webglObjectsImmediate.push({object:z,opaque:{list:[],count:0},transparent:{list:[],count:0}});m.__objectsAdded.splice(0,
|
|
|
+1)}for(;m.__objectsRemoved.length;){z=m.__objectsRemoved[0];q=m;p=void 0;n=void 0;for(p=q.__webglObjects.length-1;p>=0;p--){n=q.__webglObjects[p].object;z==n&&q.__webglObjects.splice(p,1)}m.__objectsRemoved.splice(0,1)}z=0;for(q=m.__webglObjects.length;z<q;z++){n=m.__webglObjects[z].object;B=void 0;p=void 0;C=void 0;if(n instanceof THREE.Mesh){p=n.geometry;for(B in p.geometryGroups){C=p.geometryGroups[B];if(p.__dirtyVertices||p.__dirtyElements||p.__dirtyUvs||p.__dirtyNormals||p.__dirtyColors||p.__dirtyTangents){la=
|
|
|
+f.DYNAMIC_DRAW;ka=void 0;Q=void 0;var Ja=void 0,P=void 0,Ga=void 0,Ea=void 0,Fa=void 0;Ja=void 0;var W=void 0,X=void 0,$=void 0,Aa=void 0;W=void 0;X=void 0;$=void 0;P=void 0;W=void 0;X=void 0;$=void 0;Aa=void 0;W=void 0;X=void 0;$=void 0;Aa=void 0;W=void 0;X=void 0;$=void 0;Aa=void 0;W=void 0;X=void 0;$=void 0;Aa=void 0;W=void 0;X=void 0;$=void 0;Aa=void 0;P=void 0;Ea=void 0;Ga=void 0;Fa=void 0;var Ha=pa=oa=sa=ra=O=G=H=0,Da=0,E=0,Ca=C.__vertexArray,Ra=C.__uvArray,Ua=C.__uv2Array,Ma=C.__normalArray,
|
|
|
+Ba=C.__tangentArray,J=C.__colorArray,Y=C.__skinVertexAArray,U=C.__skinVertexBArray,K=C.__skinIndexArray,S=C.__skinWeightArray,ua=C.__faceArray,wa=C.__lineArray,Ia=C.__needsSmoothNormals,za=n.geometry,Pa=za.__dirtyVertices,Ka=za.__dirtyElements,La=za.__dirtyUvs,Ta=za.__dirtyNormals,Na=za.__dirtyTangents,Qa=za.__dirtyColors,Oa=za.vertices,Za=C.faces,$a=za.faces,ab=za.uvs,bb=za.uvs2,Sa=za.colors,Wa=za.skinVerticesA,Xa=za.skinVerticesB,Ya=za.skinIndices,Va=za.skinWeights;ka=0;for(Q=Za.length;ka<Q;ka++){Ja=
|
|
|
+Za[ka];P=$a[Ja];Fa=ab[Ja];Ja=bb[Ja];Ga=P.vertexNormals;Ea=P.normal;if(P instanceof THREE.Face3){if(Pa){W=Oa[P.a].position;X=Oa[P.b].position;$=Oa[P.c].position;Ca[G]=W.x;Ca[G+1]=W.y;Ca[G+2]=W.z;Ca[G+3]=X.x;Ca[G+4]=X.y;Ca[G+5]=X.z;Ca[G+6]=$.x;Ca[G+7]=$.y;Ca[G+8]=$.z;G+=9}if(Va.length){W=Va[P.a];X=Va[P.b];$=Va[P.c];S[E]=W.x;S[E+1]=W.y;S[E+2]=W.z;S[E+3]=W.w;S[E+4]=X.x;S[E+5]=X.y;S[E+6]=X.z;S[E+7]=X.w;S[E+8]=$.x;S[E+9]=$.y;S[E+10]=$.z;S[E+11]=$.w;W=Ya[P.a];X=Ya[P.b];$=Ya[P.c];K[E]=W.x;K[E+1]=W.y;K[E+
|
|
|
+2]=W.z;K[E+3]=W.w;K[E+4]=X.x;K[E+5]=X.y;K[E+6]=X.z;K[E+7]=X.w;K[E+8]=$.x;K[E+9]=$.y;K[E+10]=$.z;K[E+11]=$.w;W=Wa[P.a];X=Wa[P.b];$=Wa[P.c];Y[E]=W.x;Y[E+1]=W.y;Y[E+2]=W.z;Y[E+3]=1;Y[E+4]=X.x;Y[E+5]=X.y;Y[E+6]=X.z;Y[E+7]=1;Y[E+8]=$.x;Y[E+9]=$.y;Y[E+10]=$.z;Y[E+11]=1;W=Xa[P.a];X=Xa[P.b];$=Xa[P.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ha+4]=H+1;wa[Ha+5]=H+2;wa[Ha+6]=H+2;wa[Ha+7]=H+3;Ha+=8;H+=4}}}if(Pa){f.bindBuffer(f.ARRAY_BUFFER,C.__webGLVertexBuffer);f.bufferData(f.ARRAY_BUFFER,
|
|
|
+Ca,la)}if(Qa&&Sa.length){f.bindBuffer(f.ARRAY_BUFFER,C.__webGLColorBuffer);f.bufferData(f.ARRAY_BUFFER,J,la)}if(Ta){f.bindBuffer(f.ARRAY_BUFFER,C.__webGLNormalBuffer);f.bufferData(f.ARRAY_BUFFER,Ma,la)}if(Na&&za.hasTangents){f.bindBuffer(f.ARRAY_BUFFER,C.__webGLTangentBuffer);f.bufferData(f.ARRAY_BUFFER,Ba,la)}if(La&&O>0){f.bindBuffer(f.ARRAY_BUFFER,C.__webGLUVBuffer);f.bufferData(f.ARRAY_BUFFER,Ra,la)}if(La&&ra>0){f.bindBuffer(f.ARRAY_BUFFER,C.__webGLUV2Buffer);f.bufferData(f.ARRAY_BUFFER,Ua,la)}if(Ka){f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,
|
|
|
+C.__webGLFaceBuffer);f.bufferData(f.ELEMENT_ARRAY_BUFFER,ua,la);f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,C.__webGLLineBuffer);f.bufferData(f.ELEMENT_ARRAY_BUFFER,wa,la)}if(E>0){f.bindBuffer(f.ARRAY_BUFFER,C.__webGLSkinVertexABuffer);f.bufferData(f.ARRAY_BUFFER,Y,la);f.bindBuffer(f.ARRAY_BUFFER,C.__webGLSkinVertexBBuffer);f.bufferData(f.ARRAY_BUFFER,U,la);f.bindBuffer(f.ARRAY_BUFFER,C.__webGLSkinIndicesBuffer);f.bufferData(f.ARRAY_BUFFER,K,la);f.bindBuffer(f.ARRAY_BUFFER,C.__webGLSkinWeightsBuffer);f.bufferData(f.ARRAY_BUFFER,
|
|
|
+S,la)}}}p.__dirtyVertices=!1;p.__dirtyElements=!1;p.__dirtyUvs=!1;p.__dirtyNormals=!1;p.__dirtyTangents=!1;p.__dirtyColors=!1}else if(n instanceof THREE.Ribbon){p=n.geometry;if(p.__dirtyVertices||p.__dirtyColors){n=p;B=f.DYNAMIC_DRAW;H=void 0;H=void 0;G=void 0;C=void 0;O=n.vertices;la=n.colors;ra=O.length;ka=la.length;sa=n.__vertexArray;Q=n.__colorArray;oa=n.__dirtyColors;if(n.__dirtyVertices){for(H=0;H<ra;H++){G=O[H].position;C=H*3;sa[C]=G.x;sa[C+1]=G.y;sa[C+2]=G.z}f.bindBuffer(f.ARRAY_BUFFER,n.__webGLVertexBuffer);
|
|
|
+f.bufferData(f.ARRAY_BUFFER,sa,B)}if(oa){for(H=0;H<ka;H++){color=la[H];C=H*3;Q[C]=color.r;Q[C+1]=color.g;Q[C+2]=color.b}f.bindBuffer(f.ARRAY_BUFFER,n.__webGLColorBuffer);f.bufferData(f.ARRAY_BUFFER,Q,B)}}p.__dirtyVertices=!1;p.__dirtyColors=!1}else if(n instanceof THREE.Line){p=n.geometry;if(p.__dirtyVertices||p.__dirtyColors){n=p;B=f.DYNAMIC_DRAW;H=void 0;H=void 0;G=void 0;C=void 0;O=n.vertices;la=n.colors;ra=O.length;ka=la.length;sa=n.__vertexArray;Q=n.__colorArray;oa=n.__dirtyColors;if(n.__dirtyVertices){for(H=
|
|
|
+0;H<ra;H++){G=O[H].position;C=H*3;sa[C]=G.x;sa[C+1]=G.y;sa[C+2]=G.z}f.bindBuffer(f.ARRAY_BUFFER,n.__webGLVertexBuffer);f.bufferData(f.ARRAY_BUFFER,sa,B)}if(oa){for(H=0;H<ka;H++){color=la[H];C=H*3;Q[C]=color.r;Q[C+1]=color.g;Q[C+2]=color.b}f.bindBuffer(f.ARRAY_BUFFER,n.__webGLColorBuffer);f.bufferData(f.ARRAY_BUFFER,Q,B)}}p.__dirtyVertices=!1;p.__dirtyColors=!1}else if(n instanceof THREE.ParticleSystem){p=n.geometry;(p.__dirtyVertices||p.__dirtyColors||n.sortParticles)&&c(p,f.DYNAMIC_DRAW,n);p.__dirtyVertices=
|
|
|
+!1;p.__dirtyColors=!1}}};this.setFaceCulling=function(m,z){if(m){!z||z=="ccw"?f.frontFace(f.CCW):f.frontFace(f.CW);if(m=="back")f.cullFace(f.BACK);else m=="front"?f.cullFace(f.FRONT):f.cullFace(f.FRONT_AND_BACK);f.enable(f.CULL_FACE)}else f.disable(f.CULL_FACE)};this.supportsVertexTextures=function(){return f.getParameter(f.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};
|
|
|
+THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(a,c,b){b&&a.update(undefined,!1,c);b=a.sounds;var d,e=b.length;for(d=0;d<e;d++){a=b[d];this.soundPosition.set(a.matrixWorld.n14,a.matrixWorld.n24,a.matrixWorld.n34);this.soundPosition.subSelf(c.position);if(a.isPlaying&&a.isLoaded){a.isAddedToDOM||a.addToDOM(this.domElement);a.calculateVolumeAndPan(this.soundPosition)}}}};
|
|
|
THREE.RenderableObject=function(){this.z=this.object=null};THREE.RenderableFace3=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.v3=new THREE.Vertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[null,null,null]};
|
|
|
THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.materials=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.materials=null};
|
|
|
var GeometryUtils={merge:function(a,c){var b=c instanceof THREE.Mesh,d=a.vertices.length,e=b?c.geometry:c,g=a.vertices,h=e.vertices,j=a.faces,k=e.faces,l=a.uvs;e=e.uvs;b&&c.matrixAutoUpdate&&c.updateMatrix();for(var o=0,v=h.length;o<v;o++){var u=new THREE.Vertex(h[o].position.clone());b&&c.matrix.multiplyVector3(u.position);g.push(u)}o=0;for(v=k.length;o<v;o++){h=k[o];var t,y=h.vertexNormals;if(h instanceof THREE.Face3)t=new THREE.Face3(h.a+d,h.b+d,h.c+d);else h instanceof THREE.Face4&&(t=new THREE.Face4(h.a+
|
|
@@ -329,7 +329,7 @@ var Torus=function(a,c,b,d){this.radius=a||100;this.tube=c||40;this.segmentsR=b|
|
|
|
var Icosahedron=function(a){function c(v,u,t){var y=Math.sqrt(v*v+u*u+t*t);return e.vertices.push(new THREE.Vertex(new THREE.Vector3(v/y,u/y,t/y)))-1}function b(v,u,t,y){y.faces.push(new THREE.Face3(v,u,t))}function d(v,u){var t=e.vertices[v].position,y=e.vertices[u].position;return c((t.x+y.x)/2,(t.y+y.y)/2,(t.z+y.z)/2)}var e=this,g=new THREE.Geometry,h;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;c(-1,a,0);c(1,a,0);c(-1,-a,0);c(1,-a,0);c(0,-1,a);c(0,1,a);c(0,-1,-a);c(0,
|
|
|
1,-a);c(a,0,-1);c(a,0,1);c(-a,0,-1);c(-a,0,1);b(0,11,5,g);b(0,5,1,g);b(0,1,7,g);b(0,7,10,g);b(0,10,11,g);b(1,5,9,g);b(5,11,4,g);b(11,10,2,g);b(10,7,6,g);b(7,1,8,g);b(3,9,4,g);b(3,4,2,g);b(3,2,6,g);b(3,6,8,g);b(3,8,9,g);b(4,9,5,g);b(2,4,11,g);b(6,2,10,g);b(8,6,7,g);b(9,8,1,g);for(a=0;a<this.subdivisions;a++){h=new THREE.Geometry;for(var j in g.faces){var k=d(g.faces[j].a,g.faces[j].b),l=d(g.faces[j].b,g.faces[j].c),o=d(g.faces[j].c,g.faces[j].a);b(g.faces[j].a,k,o,h);b(g.faces[j].b,l,k,h);b(g.faces[j].c,
|
|
|
o,l,h);b(k,l,o,h)}g.faces=h.faces}e.faces=g.faces;delete g;delete h;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Icosahedron.prototype=new THREE.Geometry;Icosahedron.prototype.constructor=Icosahedron;
|
|
|
-function LathedObject(a,c,b){THREE.Geometry.call(this);this.nsteps=c||12;this.latheAngle=b||2*Math.PI;c=this.latheAngle/this.nsteps;for(var d=[],e=[],g=[],h=[],j=0;j<a.length;j++){this.vertices.push(new THREE.Vertex(a[j]));e[j]=this.vertices.length-1;d[j]=new THREE.Vector3(a[j].x,a[j].y,a[j].z)}for(var k=THREE.Matrix4.rotationZMatrix(this.stepSize),l=0;l<=this.latheAngle+0.0010;l+=this.stepSize){for(j=0;j<d.length;j++)if(l<b){d[j]=k.multiplyVector3(d[j].clone());this.vertices.push(new THREE.Vertex(d[j]));
|
|
|
+function LathedObject(a,c,b){THREE.Geometry.call(this);this.nsteps=c||12;this.latheAngle=b||2*Math.PI;c=this.latheAngle/this.nsteps;for(var d=[],e=[],g=[],h=[],j=0;j<a.length;j++){this.vertices.push(new THREE.Vertex(a[j]));e[j]=this.vertices.length-1;d[j]=new THREE.Vector3(a[j].x,a[j].y,a[j].z)}for(var k=THREE.Matrix4.rotationZMatrix(this.stepSize),l=0;l<=this.latheAngle+0.001;l+=this.stepSize){for(j=0;j<d.length;j++)if(l<b){d[j]=k.multiplyVector3(d[j].clone());this.vertices.push(new THREE.Vertex(d[j]));
|
|
|
g[j]=this.vertices.length-1}else g=h;l==0&&(h=e);for(j=0;j<e.length-1;j++){this.faces.push(new THREE.Face4(g[j],g[j+1],e[j+1],e[j]));this.uvs.push([new THREE.UV(l/b,j/a.length),new THREE.UV(l/b,(j+1)/a.length),new THREE.UV((l-c)/b,(j+1)/a.length),new THREE.UV((l-c)/b,j/a.length)])}e=g;g=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()}LathedObject.prototype=new THREE.Geometry;LathedObject.prototype.constructor=LathedObject;
|
|
|
if(!window.Int32Array){window.Int32Array=Array;window.Float32Array=Array}
|
|
|
THREE.MarchingCubes=function(a,c){THREE.Object3D.call(this);this.materials=c instanceof Array?c:[c];this.init=function(b){this.isolation=80;this.size=b;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=
|