Răsfoiți Sursa

Updated Loader and SceneLoader to automatically set "material.transparent" flag for materials with opacity < 1.

alteredq 14 ani în urmă
părinte
comite
c50896f249
4 a modificat fișierele cu 41 adăugiri și 35 ștergeri
  1. 3 3
      build/Three.js
  2. 31 31
      build/custom/ThreeExtras.js
  3. 1 1
      src/extras/io/Loader.js
  4. 6 0
      src/extras/io/SceneLoader.js

+ 3 - 3
build/Three.js

@@ -433,8 +433,8 @@ THREE.TorusKnot.prototype=new THREE.Geometry;THREE.TorusKnot.prototype.construct
 THREE.Loader.prototype={addStatusElement:function(){var b=document.createElement("div");b.style.position="absolute";b.style.right="0px";b.style.top="0px";b.style.fontSize="0.8em";b.style.textAlign="left";b.style.background="rgba(0,0,0,0.25)";b.style.color="#fff";b.style.width="120px";b.style.padding="0.5em 0.5em 0.5em 0.5em";b.style.zIndex=1E3;b.innerHTML="Loading ...";return b},updateProgress:function(b){var d="Loaded ";d+=b.total?(100*b.loaded/b.total).toFixed(0)+"%":(b.loaded/1E3).toFixed(2)+" KB";
 this.statusDomElement.innerHTML=d},extractUrlbase:function(b){b=b.split("/");b.pop();return b.join("/")},init_materials:function(b,d,c){b.materials=[];for(var f=0;f<d.length;++f)b.materials[f]=[THREE.Loader.prototype.createMaterial(d[f],c)]},createMaterial:function(b,d){function c(k){k=Math.log(k)/Math.LN2;return Math.floor(k)==k}function f(k,m){var o=new Image;o.onload=function(){if(!c(this.width)||!c(this.height)){var p=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),t=Math.pow(2,Math.round(Math.log(this.height)/
 Math.LN2));k.image.width=p;k.image.height=t;k.image.getContext("2d").drawImage(this,0,0,p,t)}else k.image=this;k.needsUpdate=!0};o.src=m}var g,h,j;g="MeshLambertMaterial";h={color:15658734,opacity:1,map:null,lightMap:null,wireframe:b.wireframe};if(b.shading)if(b.shading=="Phong")g="MeshPhongMaterial";else b.shading=="Basic"&&(g="MeshBasicMaterial");if(b.blending)if(b.blending=="Additive")h.blending=THREE.AdditiveBlending;else if(b.blending=="Subtractive")h.blending=THREE.SubtractiveBlending;else if(b.blending==
-"Multiply")h.blending=THREE.MultiplyBlending;if(b.transparent!==undefined)h.transparent=b.transparent;if(b.depthTest!==undefined)h.depthTest=b.depthTest;if(b.vertexColors!==undefined)if(b.vertexColors=="face")h.vertexColors=THREE.FaceColors;else if(b.vertexColors)h.vertexColors=THREE.VertexColors;if(b.mapDiffuse&&d){j=document.createElement("canvas");h.map=new THREE.Texture(j);h.map.sourceFile=b.mapDiffuse;f(h.map,d+"/"+b.mapDiffuse)}else if(b.colorDiffuse){j=(b.colorDiffuse[0]*255<<16)+(b.colorDiffuse[1]*
-255<<8)+b.colorDiffuse[2]*255;h.color=j;h.opacity=b.transparency}else if(b.DbgColor)h.color=b.DbgColor;if(b.mapLightmap&&d){j=document.createElement("canvas");h.lightMap=new THREE.Texture(j);h.lightMap.sourceFile=b.mapLightmap;f(h.lightMap,d+"/"+b.mapLightmap)}return new THREE[g](h)}};THREE.JSONLoader=function(b){THREE.Loader.call(this,b)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
+"Multiply")h.blending=THREE.MultiplyBlending;if(b.transparent!==undefined||b.opacity<1)h.transparent=b.transparent;if(b.depthTest!==undefined)h.depthTest=b.depthTest;if(b.vertexColors!==undefined)if(b.vertexColors=="face")h.vertexColors=THREE.FaceColors;else if(b.vertexColors)h.vertexColors=THREE.VertexColors;if(b.mapDiffuse&&d){j=document.createElement("canvas");h.map=new THREE.Texture(j);h.map.sourceFile=b.mapDiffuse;f(h.map,d+"/"+b.mapDiffuse)}else if(b.colorDiffuse){j=(b.colorDiffuse[0]*255<<
+16)+(b.colorDiffuse[1]*255<<8)+b.colorDiffuse[2]*255;h.color=j;h.opacity=b.transparency}else if(b.DbgColor)h.color=b.DbgColor;if(b.mapLightmap&&d){j=document.createElement("canvas");h.lightMap=new THREE.Texture(j);h.lightMap.sourceFile=b.mapLightmap;f(h.lightMap,d+"/"+b.mapLightmap)}return new THREE[g](h)}};THREE.JSONLoader=function(b){THREE.Loader.call(this,b)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
 THREE.JSONLoader.prototype.load=function(b){var d=this,c=b.model,f=b.callback,g=b.texture_path?b.texture_path:this.extractUrlbase(c);b=new Worker(c);b.onmessage=function(h){d.createModel(h.data,f,g);d.onLoadComplete()};this.onLoadStart();b.postMessage((new Date).getTime())};
 THREE.JSONLoader.prototype.createModel=function(b,d,c){var f=new THREE.Geometry;this.init_materials(f,b.materials,c);(function(){if(b.version===undefined||b.version!=2)console.error("Deprecated file format.");else{var g,h,j,k,m,o,p,t,z,u,A,E,H,J,W,B=b.faces;u=b.vertices;var U=b.normals,O=b.colors;o=b.scale!==undefined?b.scale:1;var M=0;for(g=0;g<b.uvs.length;g++)b.uvs[g].length&&M++;for(g=0;g<M;g++){f.faceUvs[g]=[];f.faceVertexUvs[g]=[]}k=0;for(m=u.length;k<m;){p=new THREE.Vertex;p.position.x=u[k++]/
 o;p.position.y=u[k++]/o;p.position.z=u[k++]/o;f.vertices.push(p)}k=0;for(m=B.length;k<m;){u=B[k++];o=u&1;j=u&2;g=u&4;h=u&8;t=u&16;p=u&32;A=u&64;u&=128;if(o){E=new THREE.Face4;E.a=B[k++];E.b=B[k++];E.c=B[k++];E.d=B[k++];o=4}else{E=new THREE.Face3;E.a=B[k++];E.b=B[k++];E.c=B[k++];o=3}if(j){j=B[k++];E.materials=f.materials[j]}j=f.faces.length;if(g)for(g=0;g<M;g++){H=b.uvs[g];z=B[k++];W=H[z*2];z=H[z*2+1];f.faceUvs[g][j]=new THREE.UV(W,z)}if(h)for(g=0;g<M;g++){H=b.uvs[g];J=[];for(h=0;h<o;h++){z=B[k++];
@@ -467,7 +467,7 @@ if(H.type=="bin_mesh"||H.type=="ascii_mesh")e+=1}Da=e;for(t in ga.geometries){H=
 H.topRad,H.botRad,H.height,H.topOffset,H.botOffset);ia.geometries[t]=M}else if(H.type=="torus"){M=new THREE.Torus(H.radius,H.tube,H.segmentsR,H.segmentsT);ia.geometries[t]=M}else if(H.type=="icosahedron"){M=new THREE.Icosahedron(H.subdivisions);ia.geometries[t]=M}else if(H.type=="bin_mesh")j.load({model:k(H.url,ga.urlBaseType),callback:o(t)});else H.type=="ascii_mesh"&&ha.load({model:k(H.url,ga.urlBaseType),callback:o(t)})}for(J in ga.textures){t=ga.textures[J];oa+=t.url instanceof Array?t.url.length:
 1}Aa=oa;for(J in ga.textures){t=ga.textures[J];if(t.mapping!=undefined&&THREE[t.mapping]!=undefined)t.mapping=new THREE[t.mapping];if(t.url instanceof Array){H=[];for(var ta=0;ta<t.url.length;ta++)H[ta]=k(t.url[ta],ga.urlBaseType);H=THREE.ImageUtils.loadTextureCube(H,t.mapping,fa)}else{H=THREE.ImageUtils.loadTexture(k(t.url,ga.urlBaseType),t.mapping,fa);if(THREE[t.minFilter]!=undefined)H.minFilter=THREE[t.minFilter];if(THREE[t.magFilter]!=undefined)H.magFilter=THREE[t.magFilter]}ia.textures[J]=H}for(z in ga.materials){J=
 ga.materials[z];for(O in J.parameters)if(O=="envMap"||O=="map"||O=="lightMap")J.parameters[O]=ia.textures[J.parameters[O]];else if(O=="shading")J.parameters[O]=J.parameters[O]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(O=="blending")J.parameters[O]=THREE[J.parameters[O]]?THREE[J.parameters[O]]:THREE.NormalBlending;else if(O=="combine")J.parameters[O]=J.parameters[O]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(O=="vertexColors")if(J.parameters[O]=="face")J.parameters[O]=
-THREE.FaceColors;else if(J.parameters[O])J.parameters[O]=THREE.VertexColors;J=new THREE[J.type](J.parameters);ia.materials[z]=J}m();d(ia)}}};
+THREE.FaceColors;else if(J.parameters[O])J.parameters[O]=THREE.VertexColors;if(J.parameters.opacity!==undefined&&J.parameters.opacity<1)J.parameters.transparent=!0;J=new THREE[J.type](J.parameters);ia.materials[z]=J}m();d(ia)}}};
 THREE.MarchingCubes=function(b,d){THREE.Object3D.call(this);this.materials=d instanceof Array?d:[d];this.init=function(c){this.isolation=80;this.size=c;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=
 0;this.hasPos=!1;this.hasNormal=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(c,f,g){return c+(f-c)*g};this.VIntX=function(c,f,g,h,j,k,m,o,p,t){j=(j-p)/(t-p);p=this.normal_cache;f[h]=k+j*this.delta;f[h+1]=m;f[h+2]=o;g[h]=this.lerp(p[c],p[c+3],j);g[h+1]=this.lerp(p[c+1],p[c+4],j);g[h+2]=this.lerp(p[c+2],p[c+5],j)};this.VIntY=function(c,f,g,h,j,k,m,o,p,t){j=(j-p)/(t-p);p=this.normal_cache;f[h]=k;f[h+1]=m+j*this.delta;f[h+
 2]=o;f=c+this.yd*3;g[h]=this.lerp(p[c],p[f],j);g[h+1]=this.lerp(p[c+1],p[f+1],j);g[h+2]=this.lerp(p[c+2],p[f+2],j)};this.VIntZ=function(c,f,g,h,j,k,m,o,p,t){j=(j-p)/(t-p);p=this.normal_cache;f[h]=k;f[h+1]=m;f[h+2]=o+j*this.delta;f=c+this.zd*3;g[h]=this.lerp(p[c],p[f],j);g[h+1]=this.lerp(p[c+1],p[f+1],j);g[h+2]=this.lerp(p[c+2],p[f+2],j)};this.compNorm=function(c){var f=c*3;if(this.normal_cache[f]==0){this.normal_cache[f]=this.field[c-1]-this.field[c+1];this.normal_cache[f+1]=this.field[c-this.yd]-

+ 31 - 31
build/custom/ThreeExtras.js

@@ -43,7 +43,7 @@ this.activeLook||(e=0);this.lon+=this.mouseX*e;this.lookVertical&&(this.lat-=thi
 (90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi=(this.phi-0)*(this.verticalMax-this.verticalMin)/3.14+this.verticalMin;b=this.target.position;c=this.position;b.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=c.y+100*Math.cos(this.phi);b.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",d(this,
 this.onMouseMove),!1);this.domElement.addEventListener("mousedown",d(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",d(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",d(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",d(this,this.onKeyUp),!1)};THREE.QuakeCamera.prototype=new THREE.Camera;THREE.QuakeCamera.prototype.constructor=THREE.QuakeCamera;THREE.QuakeCamera.prototype.supr=THREE.Camera.prototype;
 THREE.QuakeCamera.prototype.translate=function(a,d){this.matrix.rotateAxis(d);if(this.noFly)d.y=0;this.position.addSelf(d.multiplyScalar(a));this.target.position.addSelf(d.multiplyScalar(a))};
-THREE.PathCamera=function(a){function d(l,k,m,p){var o={name:m,fps:0.6,length:p,hierarchy:[]},x,w=k.getControlPointsArray(),u=k.getLength(),A=w.length,z=0;x=A-1;k={parent:-1,keys:[]};k.keys[0]={time:0,pos:w[0],rot:[0,0,0,1],scl:[1,1,1]};k.keys[x]={time:p,pos:w[x],rot:[0,0,0,1],scl:[1,1,1]};for(x=1;x<A-1;x++){z=p*u.chunks[x]/u.total;k.keys[x]={time:z,pos:w[x]}}o.hierarchy[0]=k;THREE.AnimationHandler.add(o);return new THREE.Animation(l,m,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function b(l,k){var m,
+THREE.PathCamera=function(a){function d(l,k,m,p){var o={name:m,fps:0.6,length:p,hierarchy:[]},x,w=k.getControlPointsArray(),u=k.getLength(),y=w.length,A=0;x=y-1;k={parent:-1,keys:[]};k.keys[0]={time:0,pos:w[0],rot:[0,0,0,1],scl:[1,1,1]};k.keys[x]={time:p,pos:w[x],rot:[0,0,0,1],scl:[1,1,1]};for(x=1;x<y-1;x++){A=p*u.chunks[x]/u.total;k.keys[x]={time:A,pos:w[x]}}o.hierarchy[0]=k;THREE.AnimationHandler.add(o);return new THREE.Animation(l,m,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function b(l,k){var m,
 p,o=new THREE.Geometry;for(m=0;m<l.points.length*k;m++){p=m/(l.points.length*k);p=l.getPoint(p);o.vertices[m]=new THREE.Vertex(new THREE.Vector3(p.x,p.y,p.z))}return o}function e(l,k){var m=b(k,10),p=b(k,10),o=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(m,o);particleObj=new THREE.ParticleSystem(p,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);l.addChild(lineObj);particleObj.scale.set(1,1,1);l.addChild(particleObj);p=new Sphere(1,
 16,8);o=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<k.points.length;i++){m=new THREE.Mesh(p,o);m.position.copy(k.points[i]);m.updateMatrix();l.addChild(m)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.id="PathCamera"+THREE.PathCameraIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;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.useConstantSpeed!==undefined)this.useConstantSpeed=a.useConstantSpeed;if(a.resamplingCoef!==undefined)this.resamplingCoef=a.resamplingCoef;if(a.createDebugPath!==undefined)this.createDebugPath=a.createDebugPath;
@@ -66,10 +66,10 @@ THREE.RollCamera=function(a,d,b,e){THREE.Camera.call(this,a,d,b,e);this.forward=
 c.x;this.matrix.n12=f.x;this.matrix.n13=g.x;this.matrix.n21=c.y;this.matrix.n22=f.y;this.matrix.n23=g.y;this.matrix.n31=c.z;this.matrix.n32=f.z;this.matrix.n33=g.z;h.identity();h.n11=Math.cos(this.roll);h.n12=-Math.sin(this.roll);h.n21=Math.sin(this.roll);h.n22=Math.cos(this.roll);this.matrix.multiplySelf(h);this.matrixWorldNeedsUpdate=!0;this.matrix.n14=this.position.x;this.matrix.n24=this.position.y;this.matrix.n34=this.position.z;this.supr.update.call(this)};this.translateX=function(j){this.position.x+=
 this.matrix.n11*j;this.position.y+=this.matrix.n21*j;this.position.z+=this.matrix.n31*j};this.translateY=function(j){this.position.x+=this.matrix.n12*j;this.position.y+=this.matrix.n22*j;this.position.z+=this.matrix.n32*j};this.translateZ=function(j){this.position.x-=this.matrix.n13*j;this.position.y-=this.matrix.n23*j;this.position.z-=this.matrix.n33*j};this.rotateHorizontally=function(j){c.set(this.matrix.n11,this.matrix.n21,this.matrix.n31);c.multiplyScalar(j);this.forward.subSelf(c);this.forward.normalize()};
 this.rotateVertically=function(j){f.set(this.matrix.n12,this.matrix.n22,this.matrix.n32);f.multiplyScalar(j);this.forward.addSelf(f);this.forward.normalize()}};THREE.RollCamera.prototype=new THREE.Camera;THREE.RollCamera.prototype.constructor=THREE.RollCamera;THREE.RollCamera.prototype.supr=THREE.Camera.prototype;
-THREE.Cube=function(a,d,b,e,c,f,g,h,j){function l(u,A,z,n,y,B,G,K){var J,H,E=e||1,L=c||1,Q=y/2,R=B/2,S=k.vertices.length;if(u=="x"&&A=="y"||u=="y"&&A=="x")J="z";else if(u=="x"&&A=="z"||u=="z"&&A=="x"){J="y";L=f||1}else if(u=="z"&&A=="y"||u=="y"&&A=="z"){J="x";E=f||1}var N=E+1,F=L+1;y/=E;var O=B/L;for(H=0;H<F;H++)for(B=0;B<N;B++){var P=new THREE.Vector3;P[u]=(B*y-Q)*z;P[A]=(H*O-R)*n;P[J]=G;k.vertices.push(new THREE.Vertex(P))}for(H=0;H<L;H++)for(B=0;B<E;B++){k.faces.push(new THREE.Face4(B+N*H+S,B+
+THREE.Cube=function(a,d,b,e,c,f,g,h,j){function l(u,y,A,n,z,B,G,K){var J,H,E=e||1,L=c||1,Q=z/2,R=B/2,S=k.vertices.length;if(u=="x"&&y=="y"||u=="y"&&y=="x")J="z";else if(u=="x"&&y=="z"||u=="z"&&y=="x"){J="y";L=f||1}else if(u=="z"&&y=="y"||u=="y"&&y=="z"){J="x";E=f||1}var N=E+1,F=L+1;z/=E;var O=B/L;for(H=0;H<F;H++)for(B=0;B<N;B++){var P=new THREE.Vector3;P[u]=(B*z-Q)*A;P[y]=(H*O-R)*n;P[J]=G;k.vertices.push(new THREE.Vertex(P))}for(H=0;H<L;H++)for(B=0;B<E;B++){k.faces.push(new THREE.Face4(B+N*H+S,B+
 N*(H+1)+S,B+1+N*(H+1)+S,B+1+N*H+S,null,null,K));k.faceVertexUvs[0].push([new THREE.UV(B/E,H/L),new THREE.UV(B/E,(H+1)/L),new THREE.UV((B+1)/E,(H+1)/L),new THREE.UV((B+1)/E,H/L)])}}THREE.Geometry.call(this);var k=this,m=a/2,p=d/2,o=b/2;h=h?-1:1;if(g!==undefined)if(g instanceof Array)this.materials=g;else{this.materials=[];for(var x=0;x<6;x++)this.materials.push([g])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(j!=undefined)for(var w in j)this.sides[w]!=undefined&&(this.sides[w]=
-j[w]);this.sides.px&&l("z","y",1*h,-1,b,d,-m,this.materials[0]);this.sides.nx&&l("z","y",-1*h,-1,b,d,m,this.materials[1]);this.sides.py&&l("x","z",1*h,1,a,b,p,this.materials[2]);this.sides.ny&&l("x","z",1*h,-1,a,b,-p,this.materials[3]);this.sides.pz&&l("x","y",1*h,-1,a,d,o,this.materials[4]);this.sides.nz&&l("x","y",-1*h,-1,a,d,-o,this.materials[5]);(function(){for(var u=[],A=[],z=0,n=k.vertices.length;z<n;z++){for(var y=k.vertices[z],B=!1,G=0,K=u.length;G<K;G++){var J=u[G];if(y.position.x==J.position.x&&
-y.position.y==J.position.y&&y.position.z==J.position.z){A[z]=G;B=!0;break}}if(!B){A[z]=u.length;u.push(new THREE.Vertex(y.position.clone()))}}z=0;for(n=k.faces.length;z<n;z++){y=k.faces[z];y.a=A[y.a];y.b=A[y.b];y.c=A[y.c];y.d=A[y.d]}k.vertices=u})();this.computeCentroids();this.computeFaceNormals()};THREE.Cube.prototype=new THREE.Geometry;THREE.Cube.prototype.constructor=THREE.Cube;
+j[w]);this.sides.px&&l("z","y",1*h,-1,b,d,-m,this.materials[0]);this.sides.nx&&l("z","y",-1*h,-1,b,d,m,this.materials[1]);this.sides.py&&l("x","z",1*h,1,a,b,p,this.materials[2]);this.sides.ny&&l("x","z",1*h,-1,a,b,-p,this.materials[3]);this.sides.pz&&l("x","y",1*h,-1,a,d,o,this.materials[4]);this.sides.nz&&l("x","y",-1*h,-1,a,d,-o,this.materials[5]);(function(){for(var u=[],y=[],A=0,n=k.vertices.length;A<n;A++){for(var z=k.vertices[A],B=!1,G=0,K=u.length;G<K;G++){var J=u[G];if(z.position.x==J.position.x&&
+z.position.y==J.position.y&&z.position.z==J.position.z){y[A]=G;B=!0;break}}if(!B){y[A]=u.length;u.push(new THREE.Vertex(z.position.clone()))}}A=0;for(n=k.faces.length;A<n;A++){z=k.faces[A];z.a=y[z.a];z.b=y[z.b];z.c=y[z.c];z.d=y[z.d]}k.vertices=u})();this.computeCentroids();this.computeFaceNormals()};THREE.Cube.prototype=new THREE.Geometry;THREE.Cube.prototype.constructor=THREE.Cube;
 THREE.Cylinder=function(a,d,b,e,c,f){function g(p,o,x){h.vertices.push(new THREE.Vertex(new THREE.Vector3(p,o,x)))}THREE.Geometry.call(this);var h=this,j,l=Math.PI*2,k=e/2;for(j=0;j<a;j++)g(Math.sin(l*j/a)*d,Math.cos(l*j/a)*d,-k);for(j=0;j<a;j++)g(Math.sin(l*j/a)*b,Math.cos(l*j/a)*b,k);for(j=0;j<a;j++)h.faces.push(new THREE.Face4(j,j+a,a+(j+1)%a,(j+1)%a));if(b>0){g(0,0,-k-(f||0));for(j=a;j<a+a/2;j++)h.faces.push(new THREE.Face4(2*a,(2*j-2*a)%a,(2*j-2*a+1)%a,(2*j-2*a+2)%a))}if(d>0){g(0,0,k+(c||0));
 for(j=a+a/2;j<2*a;j++)h.faces.push(new THREE.Face4(2*a+1,(2*j-2*a+2)%a+a,(2*j-2*a+1)%a+a,(2*j-2*a)%a+a))}j=0;for(a=this.faces.length;j<a;j++){d=[];b=this.faces[j];c=this.vertices[b.a];f=this.vertices[b.b];k=this.vertices[b.c];var m=this.vertices[b.d];d.push(new THREE.UV(0.5+Math.atan2(c.position.x,c.position.y)/l,0.5+c.position.z/e));d.push(new THREE.UV(0.5+Math.atan2(f.position.x,f.position.y)/l,0.5+f.position.z/e));d.push(new THREE.UV(0.5+Math.atan2(k.position.x,k.position.y)/l,0.5+k.position.z/
 e));b instanceof THREE.Face4&&d.push(new THREE.UV(0.5+Math.atan2(m.position.x,m.position.y)/l,0.5+m.position.z/e));this.faceVertexUvs[0].push(d)}this.computeCentroids();this.computeFaceNormals()};THREE.Cylinder.prototype=new THREE.Geometry;THREE.Cylinder.prototype.constructor=THREE.Cylinder;
@@ -92,51 +92,51 @@ THREE.TorusKnot.prototype=new THREE.Geometry;THREE.TorusKnot.prototype.construct
 THREE.Loader.prototype={addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var d="Loaded ";d+=a.total?(100*a.loaded/a.total).toFixed(0)+"%":(a.loaded/1E3).toFixed(2)+" KB";
 this.statusDomElement.innerHTML=d},extractUrlbase:function(a){a=a.split("/");a.pop();return a.join("/")},init_materials:function(a,d,b){a.materials=[];for(var e=0;e<d.length;++e)a.materials[e]=[THREE.Loader.prototype.createMaterial(d[e],b)]},createMaterial:function(a,d){function b(h){h=Math.log(h)/Math.LN2;return Math.floor(h)==h}function e(h,j){var l=new Image;l.onload=function(){if(!b(this.width)||!b(this.height)){var k=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),m=Math.pow(2,Math.round(Math.log(this.height)/
 Math.LN2));h.image.width=k;h.image.height=m;h.image.getContext("2d").drawImage(this,0,0,k,m)}else h.image=this;h.needsUpdate=!0};l.src=j}var c,f,g;c="MeshLambertMaterial";f={color:15658734,opacity:1,map:null,lightMap:null,wireframe:a.wireframe};if(a.shading)if(a.shading=="Phong")c="MeshPhongMaterial";else a.shading=="Basic"&&(c="MeshBasicMaterial");if(a.blending)if(a.blending=="Additive")f.blending=THREE.AdditiveBlending;else if(a.blending=="Subtractive")f.blending=THREE.SubtractiveBlending;else if(a.blending==
-"Multiply")f.blending=THREE.MultiplyBlending;if(a.transparent!==undefined)f.transparent=a.transparent;if(a.depthTest!==undefined)f.depthTest=a.depthTest;if(a.vertexColors!==undefined)if(a.vertexColors=="face")f.vertexColors=THREE.FaceColors;else if(a.vertexColors)f.vertexColors=THREE.VertexColors;if(a.mapDiffuse&&d){g=document.createElement("canvas");f.map=new THREE.Texture(g);f.map.sourceFile=a.mapDiffuse;e(f.map,d+"/"+a.mapDiffuse)}else if(a.colorDiffuse){g=(a.colorDiffuse[0]*255<<16)+(a.colorDiffuse[1]*
-255<<8)+a.colorDiffuse[2]*255;f.color=g;f.opacity=a.transparency}else if(a.DbgColor)f.color=a.DbgColor;if(a.mapLightmap&&d){g=document.createElement("canvas");f.lightMap=new THREE.Texture(g);f.lightMap.sourceFile=a.mapLightmap;e(f.lightMap,d+"/"+a.mapLightmap)}return new THREE[c](f)}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
+"Multiply")f.blending=THREE.MultiplyBlending;if(a.transparent!==undefined||a.opacity<1)f.transparent=a.transparent;if(a.depthTest!==undefined)f.depthTest=a.depthTest;if(a.vertexColors!==undefined)if(a.vertexColors=="face")f.vertexColors=THREE.FaceColors;else if(a.vertexColors)f.vertexColors=THREE.VertexColors;if(a.mapDiffuse&&d){g=document.createElement("canvas");f.map=new THREE.Texture(g);f.map.sourceFile=a.mapDiffuse;e(f.map,d+"/"+a.mapDiffuse)}else if(a.colorDiffuse){g=(a.colorDiffuse[0]*255<<
+16)+(a.colorDiffuse[1]*255<<8)+a.colorDiffuse[2]*255;f.color=g;f.opacity=a.transparency}else if(a.DbgColor)f.color=a.DbgColor;if(a.mapLightmap&&d){g=document.createElement("canvas");f.lightMap=new THREE.Texture(g);f.lightMap.sourceFile=a.mapLightmap;e(f.lightMap,d+"/"+a.mapLightmap)}return new THREE[c](f)}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
 THREE.JSONLoader.prototype.load=function(a){var d=this,b=a.model,e=a.callback,c=a.texture_path?a.texture_path:this.extractUrlbase(b);a=new Worker(b);a.onmessage=function(f){d.createModel(f.data,e,c);d.onLoadComplete()};this.onLoadStart();a.postMessage((new Date).getTime())};
-THREE.JSONLoader.prototype.createModel=function(a,d,b){var e=new THREE.Geometry;this.init_materials(e,a.materials,b);(function(){if(a.version===undefined||a.version!=2)console.error("Deprecated file format.");else{var c,f,g,h,j,l,k,m,p,o,x,w,u,A,z,n=a.faces;o=a.vertices;var y=a.normals,B=a.colors;l=a.scale!==undefined?a.scale:1;var G=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&G++;for(c=0;c<G;c++){e.faceUvs[c]=[];e.faceVertexUvs[c]=[]}h=0;for(j=o.length;h<j;){k=new THREE.Vertex;k.position.x=o[h++]/
-l;k.position.y=o[h++]/l;k.position.z=o[h++]/l;e.vertices.push(k)}h=0;for(j=n.length;h<j;){o=n[h++];l=o&1;g=o&2;c=o&4;f=o&8;m=o&16;k=o&32;x=o&64;o&=128;if(l){w=new THREE.Face4;w.a=n[h++];w.b=n[h++];w.c=n[h++];w.d=n[h++];l=4}else{w=new THREE.Face3;w.a=n[h++];w.b=n[h++];w.c=n[h++];l=3}if(g){g=n[h++];w.materials=e.materials[g]}g=e.faces.length;if(c)for(c=0;c<G;c++){u=a.uvs[c];p=n[h++];z=u[p*2];p=u[p*2+1];e.faceUvs[c][g]=new THREE.UV(z,p)}if(f)for(c=0;c<G;c++){u=a.uvs[c];A=[];for(f=0;f<l;f++){p=n[h++];
-z=u[p*2];p=u[p*2+1];A[f]=new THREE.UV(z,p)}e.faceVertexUvs[c][g]=A}if(m){m=n[h++]*3;f=new THREE.Vector3;f.x=y[m++];f.y=y[m++];f.z=y[m];w.normal=f}if(k)for(c=0;c<l;c++){m=n[h++]*3;f=new THREE.Vector3;f.x=y[m++];f.y=y[m++];f.z=y[m];w.vertexNormals.push(f)}if(x){k=n[h++];k=new THREE.Color(B[k]);w.color=k}if(o)for(c=0;c<l;c++){k=n[h++];k=new THREE.Color(B[k]);w.vertexColors.push(k)}e.faces.push(w)}}})();(function(){var c,f,g,h;if(a.skinWeights){c=0;for(f=a.skinWeights.length;c<f;c+=2){g=a.skinWeights[c];
+THREE.JSONLoader.prototype.createModel=function(a,d,b){var e=new THREE.Geometry;this.init_materials(e,a.materials,b);(function(){if(a.version===undefined||a.version!=2)console.error("Deprecated file format.");else{var c,f,g,h,j,l,k,m,p,o,x,w,u,y,A,n=a.faces;o=a.vertices;var z=a.normals,B=a.colors;l=a.scale!==undefined?a.scale:1;var G=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&G++;for(c=0;c<G;c++){e.faceUvs[c]=[];e.faceVertexUvs[c]=[]}h=0;for(j=o.length;h<j;){k=new THREE.Vertex;k.position.x=o[h++]/
+l;k.position.y=o[h++]/l;k.position.z=o[h++]/l;e.vertices.push(k)}h=0;for(j=n.length;h<j;){o=n[h++];l=o&1;g=o&2;c=o&4;f=o&8;m=o&16;k=o&32;x=o&64;o&=128;if(l){w=new THREE.Face4;w.a=n[h++];w.b=n[h++];w.c=n[h++];w.d=n[h++];l=4}else{w=new THREE.Face3;w.a=n[h++];w.b=n[h++];w.c=n[h++];l=3}if(g){g=n[h++];w.materials=e.materials[g]}g=e.faces.length;if(c)for(c=0;c<G;c++){u=a.uvs[c];p=n[h++];A=u[p*2];p=u[p*2+1];e.faceUvs[c][g]=new THREE.UV(A,p)}if(f)for(c=0;c<G;c++){u=a.uvs[c];y=[];for(f=0;f<l;f++){p=n[h++];
+A=u[p*2];p=u[p*2+1];y[f]=new THREE.UV(A,p)}e.faceVertexUvs[c][g]=y}if(m){m=n[h++]*3;f=new THREE.Vector3;f.x=z[m++];f.y=z[m++];f.z=z[m];w.normal=f}if(k)for(c=0;c<l;c++){m=n[h++]*3;f=new THREE.Vector3;f.x=z[m++];f.y=z[m++];f.z=z[m];w.vertexNormals.push(f)}if(x){k=n[h++];k=new THREE.Color(B[k]);w.color=k}if(o)for(c=0;c<l;c++){k=n[h++];k=new THREE.Color(B[k]);w.vertexColors.push(k)}e.faces.push(w)}}})();(function(){var c,f,g,h;if(a.skinWeights){c=0;for(f=a.skinWeights.length;c<f;c+=2){g=a.skinWeights[c];
 h=a.skinWeights[c+1];e.skinWeights.push(new THREE.Vector4(g,h,0,0))}}if(a.skinIndices){c=0;for(f=a.skinIndices.length;c<f;c+=2){g=a.skinIndices[c];h=a.skinIndices[c+1];e.skinIndices.push(new THREE.Vector4(g,h,0,0))}}e.bones=a.bones;e.animation=a.animation})();(function(){if(a.morphTargets!==undefined){var c,f,g,h,j,l;c=0;for(f=a.morphTargets.length;c<f;c++){e.morphTargets[c]={};e.morphTargets[c].name=a.morphTargets[c].name;e.morphTargets[c].vertices=[];j=e.morphTargets[c].vertices;l=a.morphTargets[c].vertices;
 g=0;for(h=l.length;g<h;g+=3)j.push(new THREE.Vertex(new THREE.Vector3(l[g],l[g+1],l[g+2])))}}if(a.morphColors!==undefined){var k,m;c=0;for(f=a.morphColors.length;c<f;c++){e.morphColors[c]={};e.morphColors[c].name=a.morphColors[c].name;e.morphColors[c].colors=[];l=e.morphColors[c].colors;k=a.morphColors[c].colors;h=0;for(j=k.length;h<j;h+=3){m=new THREE.Color(16755200);m.setRGB(k[g],k[g+1],k[g+2]);l.push(m)}}}})();(function(){if(a.edges!==undefined){var c,f,g;for(c=0;c<a.edges.length;c+=2){f=a.edges[c];
 g=a.edges[c+1];e.edges.push(new THREE.Edge(e.vertices[f],e.vertices[g],f,g))}}})();e.computeCentroids();e.computeFaceNormals();e.computeEdgeFaces();d(e)};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
 THREE.BinaryLoader.prototype={load:function(a){var d=a.model,b=a.callback,e=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(d),c=a.bin_path?a.bin_path:THREE.Loader.prototype.extractUrlbase(d);a=(new Date).getTime();d=new Worker(d);var f=this.showProgress?THREE.Loader.prototype.updateProgress:null;d.onmessage=function(g){THREE.BinaryLoader.prototype.loadAjaxBuffers(g.data.buffers,g.data.materials,b,c,e,f)};d.onerror=function(g){alert("worker.onerror: "+g.message+"\n"+g.data);g.preventDefault()};
 d.postMessage(a)},loadAjaxBuffers:function(a,d,b,e,c,f){var g=new XMLHttpRequest,h=e+"/"+a,j=0;g.onreadystatechange=function(){if(g.readyState==4)g.status==200||g.status==0?THREE.BinaryLoader.prototype.createBinModel(g.responseText,b,c,d):alert("Couldn't load ["+h+"] ["+g.status+"]");else if(g.readyState==3){if(f){j==0&&(j=g.getResponseHeader("Content-Length"));f({total:j,loaded:g.responseText.length})}}else g.readyState==2&&(j=g.getResponseHeader("Content-Length"))};g.open("GET",h,!0);g.overrideMimeType("text/plain; charset=x-user-defined");
 g.setRequestHeader("Content-Type","text/plain");g.send(null)},createBinModel:function(a,d,b,e){var c=function(f){function g(t,v){var C=k(t,v),D=k(t,v+1),I=k(t,v+2),T=k(t,v+3),V=(T<<1&255|I>>7)-127;C|=(I&127)<<16|D<<8;if(C==0&&V==-127)return 0;return(1-2*(T>>7))*(1+C*Math.pow(2,-23))*Math.pow(2,V)}function h(t,v){var C=k(t,v),D=k(t,v+1),I=k(t,v+2);return(k(t,v+3)<<24)+(I<<16)+(D<<8)+C}function j(t,v){var C=k(t,v);return(k(t,v+1)<<8)+C}function l(t,v){var C=k(t,v);return C>127?C-256:C}function k(t,
-v){return t.charCodeAt(v)&255}function m(t){var v,C,D;v=h(a,t);C=h(a,t+G);D=h(a,t+K);t=j(a,t+J);THREE.BinaryLoader.prototype.f3(A,v,C,D,t)}function p(t){var v,C,D,I,T,V;v=h(a,t);C=h(a,t+G);D=h(a,t+K);I=j(a,t+J);T=h(a,t+H);V=h(a,t+E);t=h(a,t+L);THREE.BinaryLoader.prototype.f3n(A,y,v,C,D,I,T,V,t)}function o(t){var v,C,D,I;v=h(a,t);C=h(a,t+Q);D=h(a,t+R);I=h(a,t+S);t=j(a,t+N);THREE.BinaryLoader.prototype.f4(A,v,C,D,I,t)}function x(t){var v,C,D,I,T,V,ca,da;v=h(a,t);C=h(a,t+Q);D=h(a,t+R);I=h(a,t+S);T=j(a,
-t+N);V=h(a,t+F);ca=h(a,t+O);da=h(a,t+P);t=h(a,t+U);THREE.BinaryLoader.prototype.f4n(A,y,v,C,D,I,T,V,ca,da,t)}function w(t){var v,C;v=h(a,t);C=h(a,t+M);t=h(a,t+X);THREE.BinaryLoader.prototype.uv3(A.faceVertexUvs[0],B[v*2],B[v*2+1],B[C*2],B[C*2+1],B[t*2],B[t*2+1])}function u(t){var v,C,D;v=h(a,t);C=h(a,t+ea);D=h(a,t+fa);t=h(a,t+ga);THREE.BinaryLoader.prototype.uv4(A.faceVertexUvs[0],B[v*2],B[v*2+1],B[C*2],B[C*2+1],B[D*2],B[D*2+1],B[t*2],B[t*2+1])}var A=this,z=0,n,y=[],B=[],G,K,J,H,E,L,Q,R,S,N,F,O,P,
-U,M,X,ea,fa,ga,Y,Z,$,aa,ba,W;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(A,e,f);n={signature:a.substr(z,8),header_bytes:k(a,z+8),vertex_coordinate_bytes:k(a,z+9),normal_coordinate_bytes:k(a,z+10),uv_coordinate_bytes:k(a,z+11),vertex_index_bytes:k(a,z+12),normal_index_bytes:k(a,z+13),uv_index_bytes:k(a,z+14),material_index_bytes:k(a,z+15),nvertices:h(a,z+16),nnormals:h(a,z+16+4),nuvs:h(a,z+16+8),ntri_flat:h(a,z+16+12),ntri_smooth:h(a,z+16+16),ntri_flat_uv:h(a,z+16+20),ntri_smooth_uv:h(a,
-z+16+24),nquad_flat:h(a,z+16+28),nquad_smooth:h(a,z+16+32),nquad_flat_uv:h(a,z+16+36),nquad_smooth_uv:h(a,z+16+40)};z+=n.header_bytes;G=n.vertex_index_bytes;K=n.vertex_index_bytes*2;J=n.vertex_index_bytes*3;H=n.vertex_index_bytes*3+n.material_index_bytes;E=n.vertex_index_bytes*3+n.material_index_bytes+n.normal_index_bytes;L=n.vertex_index_bytes*3+n.material_index_bytes+n.normal_index_bytes*2;Q=n.vertex_index_bytes;R=n.vertex_index_bytes*2;S=n.vertex_index_bytes*3;N=n.vertex_index_bytes*4;F=n.vertex_index_bytes*
+v){return t.charCodeAt(v)&255}function m(t){var v,C,D;v=h(a,t);C=h(a,t+G);D=h(a,t+K);t=j(a,t+J);THREE.BinaryLoader.prototype.f3(y,v,C,D,t)}function p(t){var v,C,D,I,T,V;v=h(a,t);C=h(a,t+G);D=h(a,t+K);I=j(a,t+J);T=h(a,t+H);V=h(a,t+E);t=h(a,t+L);THREE.BinaryLoader.prototype.f3n(y,z,v,C,D,I,T,V,t)}function o(t){var v,C,D,I;v=h(a,t);C=h(a,t+Q);D=h(a,t+R);I=h(a,t+S);t=j(a,t+N);THREE.BinaryLoader.prototype.f4(y,v,C,D,I,t)}function x(t){var v,C,D,I,T,V,ca,da;v=h(a,t);C=h(a,t+Q);D=h(a,t+R);I=h(a,t+S);T=j(a,
+t+N);V=h(a,t+F);ca=h(a,t+O);da=h(a,t+P);t=h(a,t+U);THREE.BinaryLoader.prototype.f4n(y,z,v,C,D,I,T,V,ca,da,t)}function w(t){var v,C;v=h(a,t);C=h(a,t+M);t=h(a,t+X);THREE.BinaryLoader.prototype.uv3(y.faceVertexUvs[0],B[v*2],B[v*2+1],B[C*2],B[C*2+1],B[t*2],B[t*2+1])}function u(t){var v,C,D;v=h(a,t);C=h(a,t+ea);D=h(a,t+fa);t=h(a,t+ga);THREE.BinaryLoader.prototype.uv4(y.faceVertexUvs[0],B[v*2],B[v*2+1],B[C*2],B[C*2+1],B[D*2],B[D*2+1],B[t*2],B[t*2+1])}var y=this,A=0,n,z=[],B=[],G,K,J,H,E,L,Q,R,S,N,F,O,P,
+U,M,X,ea,fa,ga,Y,Z,$,aa,ba,W;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(y,e,f);n={signature:a.substr(A,8),header_bytes:k(a,A+8),vertex_coordinate_bytes:k(a,A+9),normal_coordinate_bytes:k(a,A+10),uv_coordinate_bytes:k(a,A+11),vertex_index_bytes:k(a,A+12),normal_index_bytes:k(a,A+13),uv_index_bytes:k(a,A+14),material_index_bytes:k(a,A+15),nvertices:h(a,A+16),nnormals:h(a,A+16+4),nuvs:h(a,A+16+8),ntri_flat:h(a,A+16+12),ntri_smooth:h(a,A+16+16),ntri_flat_uv:h(a,A+16+20),ntri_smooth_uv:h(a,
+A+16+24),nquad_flat:h(a,A+16+28),nquad_smooth:h(a,A+16+32),nquad_flat_uv:h(a,A+16+36),nquad_smooth_uv:h(a,A+16+40)};A+=n.header_bytes;G=n.vertex_index_bytes;K=n.vertex_index_bytes*2;J=n.vertex_index_bytes*3;H=n.vertex_index_bytes*3+n.material_index_bytes;E=n.vertex_index_bytes*3+n.material_index_bytes+n.normal_index_bytes;L=n.vertex_index_bytes*3+n.material_index_bytes+n.normal_index_bytes*2;Q=n.vertex_index_bytes;R=n.vertex_index_bytes*2;S=n.vertex_index_bytes*3;N=n.vertex_index_bytes*4;F=n.vertex_index_bytes*
 4+n.material_index_bytes;O=n.vertex_index_bytes*4+n.material_index_bytes+n.normal_index_bytes;P=n.vertex_index_bytes*4+n.material_index_bytes+n.normal_index_bytes*2;U=n.vertex_index_bytes*4+n.material_index_bytes+n.normal_index_bytes*3;M=n.uv_index_bytes;X=n.uv_index_bytes*2;ea=n.uv_index_bytes;fa=n.uv_index_bytes*2;ga=n.uv_index_bytes*3;f=n.vertex_index_bytes*3+n.material_index_bytes;W=n.vertex_index_bytes*4+n.material_index_bytes;Y=n.ntri_flat*f;Z=n.ntri_smooth*(f+n.normal_index_bytes*3);$=n.ntri_flat_uv*
-(f+n.uv_index_bytes*3);aa=n.ntri_smooth_uv*(f+n.normal_index_bytes*3+n.uv_index_bytes*3);ba=n.nquad_flat*W;f=n.nquad_smooth*(W+n.normal_index_bytes*4);W=n.nquad_flat_uv*(W+n.uv_index_bytes*4);z+=function(t){for(var v,C,D,I=n.vertex_coordinate_bytes*3,T=t+n.nvertices*I;t<T;t+=I){v=g(a,t);C=g(a,t+n.vertex_coordinate_bytes);D=g(a,t+n.vertex_coordinate_bytes*2);THREE.BinaryLoader.prototype.v(A,v,C,D)}return n.nvertices*I}(z);z+=function(t){for(var v,C,D,I=n.normal_coordinate_bytes*3,T=t+n.nnormals*I;t<
-T;t+=I){v=l(a,t);C=l(a,t+n.normal_coordinate_bytes);D=l(a,t+n.normal_coordinate_bytes*2);y.push(v/127,C/127,D/127)}return n.nnormals*I}(z);z+=function(t){for(var v,C,D=n.uv_coordinate_bytes*2,I=t+n.nuvs*D;t<I;t+=D){v=g(a,t);C=g(a,t+n.uv_coordinate_bytes);B.push(v,C)}return n.nuvs*D}(z);Y=z+Y;Z=Y+Z;$=Z+$;aa=$+aa;ba=aa+ba;f=ba+f;W=f+W;(function(t){var v,C=n.vertex_index_bytes*3+n.material_index_bytes,D=C+n.uv_index_bytes*3,I=t+n.ntri_flat_uv*D;for(v=t;v<I;v+=D){m(v);w(v+C)}return I-t})(Z);(function(t){var v,
+(f+n.uv_index_bytes*3);aa=n.ntri_smooth_uv*(f+n.normal_index_bytes*3+n.uv_index_bytes*3);ba=n.nquad_flat*W;f=n.nquad_smooth*(W+n.normal_index_bytes*4);W=n.nquad_flat_uv*(W+n.uv_index_bytes*4);A+=function(t){for(var v,C,D,I=n.vertex_coordinate_bytes*3,T=t+n.nvertices*I;t<T;t+=I){v=g(a,t);C=g(a,t+n.vertex_coordinate_bytes);D=g(a,t+n.vertex_coordinate_bytes*2);THREE.BinaryLoader.prototype.v(y,v,C,D)}return n.nvertices*I}(A);A+=function(t){for(var v,C,D,I=n.normal_coordinate_bytes*3,T=t+n.nnormals*I;t<
+T;t+=I){v=l(a,t);C=l(a,t+n.normal_coordinate_bytes);D=l(a,t+n.normal_coordinate_bytes*2);z.push(v/127,C/127,D/127)}return n.nnormals*I}(A);A+=function(t){for(var v,C,D=n.uv_coordinate_bytes*2,I=t+n.nuvs*D;t<I;t+=D){v=g(a,t);C=g(a,t+n.uv_coordinate_bytes);B.push(v,C)}return n.nuvs*D}(A);Y=A+Y;Z=Y+Z;$=Z+$;aa=$+aa;ba=aa+ba;f=ba+f;W=f+W;(function(t){var v,C=n.vertex_index_bytes*3+n.material_index_bytes,D=C+n.uv_index_bytes*3,I=t+n.ntri_flat_uv*D;for(v=t;v<I;v+=D){m(v);w(v+C)}return I-t})(Z);(function(t){var v,
 C=n.vertex_index_bytes*3+n.material_index_bytes+n.normal_index_bytes*3,D=C+n.uv_index_bytes*3,I=t+n.ntri_smooth_uv*D;for(v=t;v<I;v+=D){p(v);w(v+C)}return I-t})($);(function(t){var v,C=n.vertex_index_bytes*4+n.material_index_bytes,D=C+n.uv_index_bytes*4,I=t+n.nquad_flat_uv*D;for(v=t;v<I;v+=D){o(v);u(v+C)}return I-t})(f);(function(t){var v,C=n.vertex_index_bytes*4+n.material_index_bytes+n.normal_index_bytes*4,D=C+n.uv_index_bytes*4,I=t+n.nquad_smooth_uv*D;for(v=t;v<I;v+=D){x(v);u(v+C)}return I-t})(W);
-(function(t){var v,C=n.vertex_index_bytes*3+n.material_index_bytes,D=t+n.ntri_flat*C;for(v=t;v<D;v+=C)m(v);return D-t})(z);(function(t){var v,C=n.vertex_index_bytes*3+n.material_index_bytes+n.normal_index_bytes*3,D=t+n.ntri_smooth*C;for(v=t;v<D;v+=C)p(v);return D-t})(Y);(function(t){var v,C=n.vertex_index_bytes*4+n.material_index_bytes,D=t+n.nquad_flat*C;for(v=t;v<D;v+=C)o(v);return D-t})(aa);(function(t){var v,C=n.vertex_index_bytes*4+n.material_index_bytes+n.normal_index_bytes*4,D=t+n.nquad_smooth*
+(function(t){var v,C=n.vertex_index_bytes*3+n.material_index_bytes,D=t+n.ntri_flat*C;for(v=t;v<D;v+=C)m(v);return D-t})(A);(function(t){var v,C=n.vertex_index_bytes*3+n.material_index_bytes+n.normal_index_bytes*3,D=t+n.ntri_smooth*C;for(v=t;v<D;v+=C)p(v);return D-t})(Y);(function(t){var v,C=n.vertex_index_bytes*4+n.material_index_bytes,D=t+n.nquad_flat*C;for(v=t;v<D;v+=C)o(v);return D-t})(aa);(function(t){var v,C=n.vertex_index_bytes*4+n.material_index_bytes+n.normal_index_bytes*4,D=t+n.nquad_smooth*
 C;for(v=t;v<D;v+=C)x(v);return D-t})(ba);this.computeCentroids();this.computeFaceNormals()};c.prototype=new THREE.Geometry;c.prototype.constructor=c;d(new c(b))},v:function(a,d,b,e){a.vertices.push(new THREE.Vertex(new THREE.Vector3(d,b,e)))},f3:function(a,d,b,e,c){a.faces.push(new THREE.Face3(d,b,e,null,null,a.materials[c]))},f4:function(a,d,b,e,c,f){a.faces.push(new THREE.Face4(d,b,e,c,null,null,a.materials[f]))},f3n:function(a,d,b,e,c,f,g,h,j){f=a.materials[f];var l=d[h*3],k=d[h*3+1];h=d[h*3+2];
 var m=d[j*3],p=d[j*3+1];j=d[j*3+2];a.faces.push(new THREE.Face3(b,e,c,[new THREE.Vector3(d[g*3],d[g*3+1],d[g*3+2]),new THREE.Vector3(l,k,h),new THREE.Vector3(m,p,j)],null,f))},f4n:function(a,d,b,e,c,f,g,h,j,l,k){g=a.materials[g];var m=d[j*3],p=d[j*3+1];j=d[j*3+2];var o=d[l*3],x=d[l*3+1];l=d[l*3+2];var w=d[k*3],u=d[k*3+1];k=d[k*3+2];a.faces.push(new THREE.Face4(b,e,c,f,[new THREE.Vector3(d[h*3],d[h*3+1],d[h*3+2]),new THREE.Vector3(m,p,j),new THREE.Vector3(o,x,l),new THREE.Vector3(w,u,k)],null,g))},
 uv3:function(a,d,b,e,c,f,g){var h=[];h.push(new THREE.UV(d,b));h.push(new THREE.UV(e,c));h.push(new THREE.UV(f,g));a.push(h)},uv4:function(a,d,b,e,c,f,g,h,j){var l=[];l.push(new THREE.UV(d,b));l.push(new THREE.UV(e,c));l.push(new THREE.UV(f,g));l.push(new THREE.UV(h,j));a.push(l)}};THREE.SceneLoader=function(){};
-THREE.SceneLoader.prototype={load:function(a,d,b,e){var c=new Worker(a);c.postMessage(0);var f=THREE.Loader.prototype.extractUrlbase(a);c.onmessage=function(g){function h(M,X){return X=="relativeToHTML"?M:f+"/"+M}function j(){for(o in E.objects)if(!F.objects[o]){z=E.objects[o];if(G=F.geometries[z.geometry]){H=[];for(U=0;U<z.materials.length;U++)H[U]=F.materials[z.materials[U]];n=z.position;r=z.rotation;q=z.quaternion;s=z.scale;q=0;H.length==0&&(H[0]=new THREE.MeshFaceMaterial);H.length>1&&(H=[new THREE.MeshFaceMaterial]);
-object=new THREE.Mesh(G,H);object.position.set(n[0],n[1],n[2]);if(q){object.quaternion.set(q[0],q[1],q[2],q[3]);object.useQuaternion=!0}else object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=z.visible;F.scene.addObject(object);F.objects[o]=object;if(z.meshCollider){var M=THREE.CollisionUtils.MeshColliderWBox(object);THREE.Collisions.colliders.push(M)}if(z.castsShadow){M=new THREE.ShadowVolume(G);F.scene.addChild(M);M.position=object.position;M.rotation=object.rotation;
-M.scale=object.scale}}}}function l(M){return function(X){F.geometries[M]=X;j();Q-=1;k()}}function k(){e({total_models:S,total_textures:N,loaded_models:S-Q,loaded_textures:N-R},F);Q==0&&R==0&&b(F)}var m,p,o,x,w,u,A,z,n,y,B,G,K,J,H,E,L,Q,R,S,N,F;E=g.data;g=new THREE.BinaryLoader;L=new THREE.JSONLoader;R=Q=0;F={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{}};if(E.transform){var O=E.transform.position;y=E.transform.rotation;var P=E.transform.scale;
-O&&F.scene.position.set(O[0],O[1],O[2]);y&&F.scene.rotation.set(y[0],y[1],y[2]);P&&F.scene.scale.set(P[0],P[1],P[2]);(O||y||P)&&F.scene.updateMatrix()}O=function(){R-=1;k()};for(w in E.cameras){y=E.cameras[w];if(y.type=="perspective")K=new THREE.Camera(y.fov,y.aspect,y.near,y.far);else if(y.type=="ortho"){K=new THREE.Camera;K.projectionMatrix=THREE.Matrix4.makeOrtho(y.left,y.right,y.top,y.bottom,y.near,y.far)}n=y.position;y=y.target;K.position.set(n[0],n[1],n[2]);K.target.position.set(y[0],y[1],y[2]);
-F.cameras[w]=K}for(x in E.lights){w=E.lights[x];K=w.color!==undefined?w.color:16777215;y=w.intensity!==undefined?w.intensity:1;if(w.type=="directional"){n=w.direction;light=new THREE.DirectionalLight(K,y);light.position.set(n[0],n[1],n[2]);light.position.normalize()}else if(w.type=="point"){n=w.position;light=new THREE.PointLight(K,y);light.position.set(n[0],n[1],n[2])}F.scene.addLight(light);F.lights[x]=light}for(u in E.fogs){x=E.fogs[u];if(x.type=="linear")J=new THREE.Fog(0,x.near,x.far);else x.type==
-"exp2"&&(J=new THREE.FogExp2(0,x.density));y=x.color;J.color.setRGB(y[0],y[1],y[2]);F.fogs[u]=J}if(F.cameras&&E.defaults.camera)F.currentCamera=F.cameras[E.defaults.camera];if(F.fogs&&E.defaults.fog)F.scene.fog=F.fogs[E.defaults.fog];y=E.defaults.bgcolor;F.bgColor=new THREE.Color;F.bgColor.setRGB(y[0],y[1],y[2]);F.bgColorAlpha=E.defaults.bgalpha;for(m in E.geometries){u=E.geometries[m];if(u.type=="bin_mesh"||u.type=="ascii_mesh")Q+=1}S=Q;for(m in E.geometries){u=E.geometries[m];if(u.type=="cube"){G=
+THREE.SceneLoader.prototype={load:function(a,d,b,e){var c=new Worker(a);c.postMessage(0);var f=THREE.Loader.prototype.extractUrlbase(a);c.onmessage=function(g){function h(M,X){return X=="relativeToHTML"?M:f+"/"+M}function j(){for(o in E.objects)if(!F.objects[o]){A=E.objects[o];if(G=F.geometries[A.geometry]){H=[];for(U=0;U<A.materials.length;U++)H[U]=F.materials[A.materials[U]];n=A.position;r=A.rotation;q=A.quaternion;s=A.scale;q=0;H.length==0&&(H[0]=new THREE.MeshFaceMaterial);H.length>1&&(H=[new THREE.MeshFaceMaterial]);
+object=new THREE.Mesh(G,H);object.position.set(n[0],n[1],n[2]);if(q){object.quaternion.set(q[0],q[1],q[2],q[3]);object.useQuaternion=!0}else object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=A.visible;F.scene.addObject(object);F.objects[o]=object;if(A.meshCollider){var M=THREE.CollisionUtils.MeshColliderWBox(object);THREE.Collisions.colliders.push(M)}if(A.castsShadow){M=new THREE.ShadowVolume(G);F.scene.addChild(M);M.position=object.position;M.rotation=object.rotation;
+M.scale=object.scale}}}}function l(M){return function(X){F.geometries[M]=X;j();Q-=1;k()}}function k(){e({total_models:S,total_textures:N,loaded_models:S-Q,loaded_textures:N-R},F);Q==0&&R==0&&b(F)}var m,p,o,x,w,u,y,A,n,z,B,G,K,J,H,E,L,Q,R,S,N,F;E=g.data;g=new THREE.BinaryLoader;L=new THREE.JSONLoader;R=Q=0;F={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{}};if(E.transform){var O=E.transform.position;z=E.transform.rotation;var P=E.transform.scale;
+O&&F.scene.position.set(O[0],O[1],O[2]);z&&F.scene.rotation.set(z[0],z[1],z[2]);P&&F.scene.scale.set(P[0],P[1],P[2]);(O||z||P)&&F.scene.updateMatrix()}O=function(){R-=1;k()};for(w in E.cameras){z=E.cameras[w];if(z.type=="perspective")K=new THREE.Camera(z.fov,z.aspect,z.near,z.far);else if(z.type=="ortho"){K=new THREE.Camera;K.projectionMatrix=THREE.Matrix4.makeOrtho(z.left,z.right,z.top,z.bottom,z.near,z.far)}n=z.position;z=z.target;K.position.set(n[0],n[1],n[2]);K.target.position.set(z[0],z[1],z[2]);
+F.cameras[w]=K}for(x in E.lights){w=E.lights[x];K=w.color!==undefined?w.color:16777215;z=w.intensity!==undefined?w.intensity:1;if(w.type=="directional"){n=w.direction;light=new THREE.DirectionalLight(K,z);light.position.set(n[0],n[1],n[2]);light.position.normalize()}else if(w.type=="point"){n=w.position;light=new THREE.PointLight(K,z);light.position.set(n[0],n[1],n[2])}F.scene.addLight(light);F.lights[x]=light}for(u in E.fogs){x=E.fogs[u];if(x.type=="linear")J=new THREE.Fog(0,x.near,x.far);else x.type==
+"exp2"&&(J=new THREE.FogExp2(0,x.density));z=x.color;J.color.setRGB(z[0],z[1],z[2]);F.fogs[u]=J}if(F.cameras&&E.defaults.camera)F.currentCamera=F.cameras[E.defaults.camera];if(F.fogs&&E.defaults.fog)F.scene.fog=F.fogs[E.defaults.fog];z=E.defaults.bgcolor;F.bgColor=new THREE.Color;F.bgColor.setRGB(z[0],z[1],z[2]);F.bgColorAlpha=E.defaults.bgalpha;for(m in E.geometries){u=E.geometries[m];if(u.type=="bin_mesh"||u.type=="ascii_mesh")Q+=1}S=Q;for(m in E.geometries){u=E.geometries[m];if(u.type=="cube"){G=
 new THREE.Cube(u.width,u.height,u.depth,u.segmentsWidth,u.segmentsHeight,u.segmentsDepth,null,u.flipped,u.sides);F.geometries[m]=G}else if(u.type=="plane"){G=new THREE.Plane(u.width,u.height,u.segmentsWidth,u.segmentsHeight);F.geometries[m]=G}else if(u.type=="sphere"){G=new THREE.Sphere(u.radius,u.segmentsWidth,u.segmentsHeight);F.geometries[m]=G}else if(u.type=="cylinder"){G=new THREE.Cylinder(u.numSegs,u.topRad,u.botRad,u.height,u.topOffset,u.botOffset);F.geometries[m]=G}else if(u.type=="torus"){G=
-new THREE.Torus(u.radius,u.tube,u.segmentsR,u.segmentsT);F.geometries[m]=G}else if(u.type=="icosahedron"){G=new THREE.Icosahedron(u.subdivisions);F.geometries[m]=G}else if(u.type=="bin_mesh")g.load({model:h(u.url,E.urlBaseType),callback:l(m)});else u.type=="ascii_mesh"&&L.load({model:h(u.url,E.urlBaseType),callback:l(m)})}for(A in E.textures){m=E.textures[A];R+=m.url instanceof Array?m.url.length:1}N=R;for(A in E.textures){m=E.textures[A];if(m.mapping!=undefined&&THREE[m.mapping]!=undefined)m.mapping=
-new THREE[m.mapping];if(m.url instanceof Array){u=[];for(var U=0;U<m.url.length;U++)u[U]=h(m.url[U],E.urlBaseType);u=THREE.ImageUtils.loadTextureCube(u,m.mapping,O)}else{u=THREE.ImageUtils.loadTexture(h(m.url,E.urlBaseType),m.mapping,O);if(THREE[m.minFilter]!=undefined)u.minFilter=THREE[m.minFilter];if(THREE[m.magFilter]!=undefined)u.magFilter=THREE[m.magFilter]}F.textures[A]=u}for(p in E.materials){A=E.materials[p];for(B in A.parameters)if(B=="envMap"||B=="map"||B=="lightMap")A.parameters[B]=F.textures[A.parameters[B]];
-else if(B=="shading")A.parameters[B]=A.parameters[B]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(B=="blending")A.parameters[B]=THREE[A.parameters[B]]?THREE[A.parameters[B]]:THREE.NormalBlending;else if(B=="combine")A.parameters[B]=A.parameters[B]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(B=="vertexColors")if(A.parameters[B]=="face")A.parameters[B]=THREE.FaceColors;else if(A.parameters[B])A.parameters[B]=THREE.VertexColors;A=new THREE[A.type](A.parameters);F.materials[p]=
-A}j();d(F)}}};
+new THREE.Torus(u.radius,u.tube,u.segmentsR,u.segmentsT);F.geometries[m]=G}else if(u.type=="icosahedron"){G=new THREE.Icosahedron(u.subdivisions);F.geometries[m]=G}else if(u.type=="bin_mesh")g.load({model:h(u.url,E.urlBaseType),callback:l(m)});else u.type=="ascii_mesh"&&L.load({model:h(u.url,E.urlBaseType),callback:l(m)})}for(y in E.textures){m=E.textures[y];R+=m.url instanceof Array?m.url.length:1}N=R;for(y in E.textures){m=E.textures[y];if(m.mapping!=undefined&&THREE[m.mapping]!=undefined)m.mapping=
+new THREE[m.mapping];if(m.url instanceof Array){u=[];for(var U=0;U<m.url.length;U++)u[U]=h(m.url[U],E.urlBaseType);u=THREE.ImageUtils.loadTextureCube(u,m.mapping,O)}else{u=THREE.ImageUtils.loadTexture(h(m.url,E.urlBaseType),m.mapping,O);if(THREE[m.minFilter]!=undefined)u.minFilter=THREE[m.minFilter];if(THREE[m.magFilter]!=undefined)u.magFilter=THREE[m.magFilter]}F.textures[y]=u}for(p in E.materials){y=E.materials[p];for(B in y.parameters)if(B=="envMap"||B=="map"||B=="lightMap")y.parameters[B]=F.textures[y.parameters[B]];
+else if(B=="shading")y.parameters[B]=y.parameters[B]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(B=="blending")y.parameters[B]=THREE[y.parameters[B]]?THREE[y.parameters[B]]:THREE.NormalBlending;else if(B=="combine")y.parameters[B]=y.parameters[B]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(B=="vertexColors")if(y.parameters[B]=="face")y.parameters[B]=THREE.FaceColors;else if(y.parameters[B])y.parameters[B]=THREE.VertexColors;if(y.parameters.opacity!==undefined&&y.parameters.opacity<
+1)y.parameters.transparent=!0;y=new THREE[y.type](y.parameters);F.materials[p]=y}j();d(F)}}};
 THREE.MarchingCubes=function(a,d){THREE.Object3D.call(this);this.materials=d instanceof Array?d:[d];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=
 0;this.hasPos=!1;this.hasNormal=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(b,e,c){return b+(e-b)*c};this.VIntX=function(b,e,c,f,g,h,j,l,k,m){g=(g-k)/(m-k);k=this.normal_cache;e[f]=h+g*this.delta;e[f+1]=j;e[f+2]=l;c[f]=this.lerp(k[b],k[b+3],g);c[f+1]=this.lerp(k[b+1],k[b+4],g);c[f+2]=this.lerp(k[b+2],k[b+5],g)};this.VIntY=function(b,e,c,f,g,h,j,l,k,m){g=(g-k)/(m-k);k=this.normal_cache;e[f]=h;e[f+1]=j+g*this.delta;e[f+
 2]=l;e=b+this.yd*3;c[f]=this.lerp(k[b],k[e],g);c[f+1]=this.lerp(k[b+1],k[e+1],g);c[f+2]=this.lerp(k[b+2],k[e+2],g)};this.VIntZ=function(b,e,c,f,g,h,j,l,k,m){g=(g-k)/(m-k);k=this.normal_cache;e[f]=h;e[f+1]=j;e[f+2]=l+g*this.delta;e=b+this.zd*3;c[f]=this.lerp(k[b],k[e],g);c[f+1]=this.lerp(k[b+1],k[e+1],g);c[f+2]=this.lerp(k[b+2],k[e+2],g)};this.compNorm=function(b){var e=b*3;if(this.normal_cache[e]==0){this.normal_cache[e]=this.field[b-1]-this.field[b+1];this.normal_cache[e+1]=this.field[b-this.yd]-
-this.field[b+this.yd];this.normal_cache[e+2]=this.field[b-this.zd]-this.field[b+this.zd]}};this.polygonize=function(b,e,c,f,g,h){var j=f+1,l=f+this.yd,k=f+this.zd,m=j+this.yd,p=j+this.zd,o=f+this.yd+this.zd,x=j+this.yd+this.zd,w=0,u=this.field[f],A=this.field[j],z=this.field[l],n=this.field[m],y=this.field[k],B=this.field[p],G=this.field[o],K=this.field[x];u<g&&(w|=1);A<g&&(w|=2);z<g&&(w|=8);n<g&&(w|=4);y<g&&(w|=16);B<g&&(w|=32);G<g&&(w|=128);K<g&&(w|=64);var J=THREE.edgeTable[w];if(J==0)return 0;
-var H=this.delta,E=b+H,L=e+H;H=c+H;if(J&1){this.compNorm(f);this.compNorm(j);this.VIntX(f*3,this.vlist,this.nlist,0,g,b,e,c,u,A)}if(J&2){this.compNorm(j);this.compNorm(m);this.VIntY(j*3,this.vlist,this.nlist,3,g,E,e,c,A,n)}if(J&4){this.compNorm(l);this.compNorm(m);this.VIntX(l*3,this.vlist,this.nlist,6,g,b,L,c,z,n)}if(J&8){this.compNorm(f);this.compNorm(l);this.VIntY(f*3,this.vlist,this.nlist,9,g,b,e,c,u,z)}if(J&16){this.compNorm(k);this.compNorm(p);this.VIntX(k*3,this.vlist,this.nlist,12,g,b,e,H,
-y,B)}if(J&32){this.compNorm(p);this.compNorm(x);this.VIntY(p*3,this.vlist,this.nlist,15,g,E,e,H,B,K)}if(J&64){this.compNorm(o);this.compNorm(x);this.VIntX(o*3,this.vlist,this.nlist,18,g,b,L,H,G,K)}if(J&128){this.compNorm(k);this.compNorm(o);this.VIntY(k*3,this.vlist,this.nlist,21,g,b,e,H,y,G)}if(J&256){this.compNorm(f);this.compNorm(k);this.VIntZ(f*3,this.vlist,this.nlist,24,g,b,e,c,u,y)}if(J&512){this.compNorm(j);this.compNorm(p);this.VIntZ(j*3,this.vlist,this.nlist,27,g,E,e,c,A,B)}if(J&1024){this.compNorm(m);
-this.compNorm(x);this.VIntZ(m*3,this.vlist,this.nlist,30,g,E,L,c,n,K)}if(J&2048){this.compNorm(l);this.compNorm(o);this.VIntZ(l*3,this.vlist,this.nlist,33,g,b,L,c,z,G)}w<<=4;for(g=f=0;THREE.triTable[w+g]!=-1;){b=w+g;e=b+1;c=b+2;this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[e],3*THREE.triTable[c],h);g+=3;f++}return f};this.posnormtriv=function(b,e,c,f,g,h){var j=this.count*3;this.positionArray[j]=b[c];this.positionArray[j+1]=b[c+1];this.positionArray[j+2]=b[c+2];this.positionArray[j+
+this.field[b+this.yd];this.normal_cache[e+2]=this.field[b-this.zd]-this.field[b+this.zd]}};this.polygonize=function(b,e,c,f,g,h){var j=f+1,l=f+this.yd,k=f+this.zd,m=j+this.yd,p=j+this.zd,o=f+this.yd+this.zd,x=j+this.yd+this.zd,w=0,u=this.field[f],y=this.field[j],A=this.field[l],n=this.field[m],z=this.field[k],B=this.field[p],G=this.field[o],K=this.field[x];u<g&&(w|=1);y<g&&(w|=2);A<g&&(w|=8);n<g&&(w|=4);z<g&&(w|=16);B<g&&(w|=32);G<g&&(w|=128);K<g&&(w|=64);var J=THREE.edgeTable[w];if(J==0)return 0;
+var H=this.delta,E=b+H,L=e+H;H=c+H;if(J&1){this.compNorm(f);this.compNorm(j);this.VIntX(f*3,this.vlist,this.nlist,0,g,b,e,c,u,y)}if(J&2){this.compNorm(j);this.compNorm(m);this.VIntY(j*3,this.vlist,this.nlist,3,g,E,e,c,y,n)}if(J&4){this.compNorm(l);this.compNorm(m);this.VIntX(l*3,this.vlist,this.nlist,6,g,b,L,c,A,n)}if(J&8){this.compNorm(f);this.compNorm(l);this.VIntY(f*3,this.vlist,this.nlist,9,g,b,e,c,u,A)}if(J&16){this.compNorm(k);this.compNorm(p);this.VIntX(k*3,this.vlist,this.nlist,12,g,b,e,H,
+z,B)}if(J&32){this.compNorm(p);this.compNorm(x);this.VIntY(p*3,this.vlist,this.nlist,15,g,E,e,H,B,K)}if(J&64){this.compNorm(o);this.compNorm(x);this.VIntX(o*3,this.vlist,this.nlist,18,g,b,L,H,G,K)}if(J&128){this.compNorm(k);this.compNorm(o);this.VIntY(k*3,this.vlist,this.nlist,21,g,b,e,H,z,G)}if(J&256){this.compNorm(f);this.compNorm(k);this.VIntZ(f*3,this.vlist,this.nlist,24,g,b,e,c,u,z)}if(J&512){this.compNorm(j);this.compNorm(p);this.VIntZ(j*3,this.vlist,this.nlist,27,g,E,e,c,y,B)}if(J&1024){this.compNorm(m);
+this.compNorm(x);this.VIntZ(m*3,this.vlist,this.nlist,30,g,E,L,c,n,K)}if(J&2048){this.compNorm(l);this.compNorm(o);this.VIntZ(l*3,this.vlist,this.nlist,33,g,b,L,c,A,G)}w<<=4;for(g=f=0;THREE.triTable[w+g]!=-1;){b=w+g;e=b+1;c=b+2;this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[e],3*THREE.triTable[c],h);g+=3;f++}return f};this.posnormtriv=function(b,e,c,f,g,h){var j=this.count*3;this.positionArray[j]=b[c];this.positionArray[j+1]=b[c+1];this.positionArray[j+2]=b[c+2];this.positionArray[j+
 3]=b[f];this.positionArray[j+4]=b[f+1];this.positionArray[j+5]=b[f+2];this.positionArray[j+6]=b[g];this.positionArray[j+7]=b[g+1];this.positionArray[j+8]=b[g+2];this.normalArray[j]=e[c];this.normalArray[j+1]=e[c+1];this.normalArray[j+2]=e[c+2];this.normalArray[j+3]=e[f];this.normalArray[j+4]=e[f+1];this.normalArray[j+5]=e[f+2];this.normalArray[j+6]=e[g];this.normalArray[j+7]=e[g+1];this.normalArray[j+8]=e[g+2];this.hasPos=!0;this.hasNormal=!0;this.count+=3;this.count>=this.maxCount-3&&h(this)};this.begin=
 function(){this.count=0;this.hasPos=!1;this.hasNormal=!1};this.end=function(b){if(this.count!=0){for(var e=this.count*3;e<this.positionArray.length;e++)this.positionArray[e]=0;b(this)}};this.addBall=function(b,e,c,f,g){var h=this.size*Math.sqrt(f/g),j=c*this.size,l=e*this.size,k=b*this.size,m=Math.floor(j-h);m<1&&(m=1);j=Math.floor(j+h);j>this.size-1&&(j=this.size-1);var p=Math.floor(l-h);p<1&&(p=1);l=Math.floor(l+h);l>this.size-1&&(l=this.size-1);var o=Math.floor(k-h);o<1&&(o=1);h=Math.floor(k+h);
-h>this.size-1&&(h=this.size-1);for(var x,w,u,A,z,n;m<j;m++){k=this.size2*m;w=m/this.size-c;z=w*w;for(w=p;w<l;w++){u=k+this.size*w;x=w/this.size-e;n=x*x;for(x=o;x<h;x++){A=x/this.size-b;A=f/(1.0E-6+A*A+n+z)-g;A>0&&(this.field[u+x]+=A)}}}};this.addPlaneX=function(b,e){var c,f,g,h,j,l=this.size,k=this.yd,m=this.zd,p=this.field,o=l*Math.sqrt(b/e);o>l&&(o=l);for(c=0;c<o;c++){f=c/l;f*=f;h=b/(1.0E-4+f)-e;if(h>0)for(f=0;f<l;f++){j=c+f*k;for(g=0;g<l;g++)p[m*g+j]+=h}}};this.addPlaneY=function(b,e){var c,f,
+h>this.size-1&&(h=this.size-1);for(var x,w,u,y,A,n;m<j;m++){k=this.size2*m;w=m/this.size-c;A=w*w;for(w=p;w<l;w++){u=k+this.size*w;x=w/this.size-e;n=x*x;for(x=o;x<h;x++){y=x/this.size-b;y=f/(1.0E-6+y*y+n+A)-g;y>0&&(this.field[u+x]+=y)}}}};this.addPlaneX=function(b,e){var c,f,g,h,j,l=this.size,k=this.yd,m=this.zd,p=this.field,o=l*Math.sqrt(b/e);o>l&&(o=l);for(c=0;c<o;c++){f=c/l;f*=f;h=b/(1.0E-4+f)-e;if(h>0)for(f=0;f<l;f++){j=c+f*k;for(g=0;g<l;g++)p[m*g+j]+=h}}};this.addPlaneY=function(b,e){var c,f,
 g,h,j,l,k=this.size,m=this.yd,p=this.zd,o=this.field,x=k*Math.sqrt(b/e);x>k&&(x=k);for(f=0;f<x;f++){c=f/k;c*=c;h=b/(1.0E-4+c)-e;if(h>0){j=f*m;for(c=0;c<k;c++){l=j+c;for(g=0;g<k;g++)o[p*g+l]+=h}}}};this.addPlaneZ=function(b,e){var c,f,g,h,j,l;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(b/e);dist>size&&(dist=size);for(g=0;g<dist;g++){c=g/size;c*=c;h=b/(1.0E-4+c)-e;if(h>0){j=zd*g;for(f=0;f<size;f++){l=j+f*yd;for(c=0;c<size;c++)field[l+c]+=h}}}};this.reset=function(){var b;
 for(b=0;b<this.size3;b++){this.normal_cache[b*3]=0;this.field[b]=0}};this.render=function(b){this.begin();var e,c,f,g,h,j,l,k,m,p=this.size-2;for(g=1;g<p;g++){m=this.size2*g;l=(g-this.halfsize)/this.halfsize;for(f=1;f<p;f++){k=m+this.size*f;j=(f-this.halfsize)/this.halfsize;for(c=1;c<p;c++){h=(c-this.halfsize)/this.halfsize;e=k+c;this.polygonize(h,j,l,e,this.isolation,b)}}}this.end(b)};this.generateGeometry=function(){var b=0,e=new THREE.Geometry,c=[];this.render(function(f){var g,h,j,l,k,m,p,o;for(g=
 0;g<f.count;g++){p=g*3;k=p+1;o=p+2;h=f.positionArray[p];j=f.positionArray[k];l=f.positionArray[o];m=new THREE.Vector3(h,j,l);h=f.normalArray[p];j=f.normalArray[k];l=f.normalArray[o];p=new THREE.Vector3(h,j,l);p.normalize();k=new THREE.Vertex(m);e.vertices.push(k);c.push(p)}nfaces=f.count/3;for(g=0;g<nfaces;g++){p=(b+g)*3;k=p+1;o=p+2;m=c[p];h=c[k];j=c[o];p=new THREE.Face3(p,k,o,[m,h,j]);e.faces.push(p)}b+=nfaces;f.count=0});return e};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;

+ 1 - 1
src/extras/io/Loader.js

@@ -147,7 +147,7 @@ THREE.Loader.prototype = {
 
 		}
 
-		if ( m.transparent !== undefined ) {
+		if ( m.transparent !== undefined || m.opacity < 1.0 ) {
 
 			mpars.transparent = m.transparent;
 

+ 6 - 0
src/extras/io/SceneLoader.js

@@ -501,6 +501,12 @@ THREE.SceneLoader.prototype = {
 
 				}
 
+				if ( m.parameters.opacity !== undefined && m.parameters.opacity < 1.0 ) {
+					
+					m.parameters.transparent = true;
+
+				}
+				
 				material = new THREE[ m.type ]( m.parameters );
 				result.materials[ dm ] = material;