提交 315bc5ad 编写于 作者: M Mr.doob

Updated build.

上级 ef2243bd
此差异已折叠。
此差异已折叠。
......@@ -43,12 +43,13 @@ THREE.Vertex=function(a,b){this.position=a||new THREE.Vector3;this.positionWorld
THREE.Face3=function(a,b,d,e,f){this.a=a;this.b=b;this.c=d;this.centroid=new THREE.Vector3;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.material=f instanceof Array?f:[f]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}};
THREE.Face4=function(a,b,d,e,f,j){this.a=a;this.b=b;this.c=d;this.d=e;this.centroid=new THREE.Vector3;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.material=j instanceof Array?j:[j]};THREE.Face4.prototype={toString:function(){return"THREE.Face4 ( "+this.a+", "+this.b+", "+this.c+" "+this.d+" )"}};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};
THREE.UV.prototype={copy:function(a){this.u=a.u;this.v=a.v},toString:function(){return"THREE.UV ("+this.u+", "+this.v+")"}};THREE.Geometry=function(){this.vertices=[];this.faces=[];this.uvs=[];this.geometryChunks={}};
THREE.Geometry.prototype={computeCentroids:function(){var a,b,d;a=0;for(b=this.faces.length;a<b;a++){d=this.faces[a];d.centroid.set(0,0,0);d.centroid.addSelf(this.vertices[d.a].position);d.centroid.addSelf(this.vertices[d.b].position);d.centroid.addSelf(this.vertices[d.c].position);if(d instanceof THREE.Face3)d.centroid.divideScalar(3);else if(d instanceof THREE.Face4){d.centroid.addSelf(this.vertices[d.d].position);d.centroid.divideScalar(4)}}},computeNormals:function(a){var b,d,e,f,j,k,g=new THREE.Vector3,
p=new THREE.Vector3;e=0;for(f=this.vertices.length;e<f;e++){j=this.vertices[e];j.normal.set(0,0,0)}e=0;for(f=this.faces.length;e<f;e++){j=this.faces[e];if(a&&j.vertexNormals.length){g.set(0,0,0);b=0;for(d=j.normal.length;b<d;b++)g.addSelf(j.vertexNormals[b]);g.divideScalar(3)}else{b=this.vertices[j.a];d=this.vertices[j.b];k=this.vertices[j.c];g.sub(k.position,d.position);p.sub(b.position,d.position);g.crossSelf(p)}g.isZero()||g.normalize();j.normal.copy(g)}},computeVertexNormals:function(){var a,
b;a=0;for(b=this.faces.length;a<b;a++);},computeBoundingBox:function(){if(this.vertices.length>0){this.bbox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var a=1,b=this.vertices.length;a<b;a++){vertex=this.vertices[a];if(vertex.position.x<this.bbox.x[0])this.bbox.x[0]=vertex.position.x;else if(vertex.position.x>this.bbox.x[1])this.bbox.x[1]=vertex.position.x;
if(vertex.position.y<this.bbox.y[0])this.bbox.y[0]=vertex.position.y;else if(vertex.position.y>this.bbox.y[1])this.bbox.y[1]=vertex.position.y;if(vertex.position.z<this.bbox.z[0])this.bbox.z[0]=vertex.position.z;else if(vertex.position.z>this.bbox.z[1])this.bbox.z[1]=vertex.position.z}}},sortFacesByMaterial:function(){function a(t){var F=[];b=0;for(d=t.length;b<d;b++)t[b]==undefined?F.push("undefined"):F.push(t[b].toString());return F.join("_")}var b,d,e,f,j,k,g,p,c={};e=0;for(f=this.faces.length;e<
f;e++){j=this.faces[e];k=j.material;g=a(k);if(c[g]==undefined)c[g]={hash:g,counter:0};p=c[g].hash+"_"+c[g].counter;if(this.geometryChunks[p]==undefined)this.geometryChunks[p]={faces:[],material:k,vertices:0};j=j instanceof THREE.Face3?3:4;if(this.geometryChunks[p].vertices+j>65535){c[g].counter+=1;p=c[g].hash+"_"+c[g].counter;if(this.geometryChunks[p]==undefined)this.geometryChunks[p]={faces:[],material:k,vertices:0}}this.geometryChunks[p].faces.push(e);this.geometryChunks[p].vertices+=j}},toString:function(){return"THREE.Geometry ( vertices: "+
this.vertices+", faces: "+this.faces+", uvs: "+this.uvs+" )"}};
THREE.Geometry.prototype={computeCentroids:function(){var a,b,d;a=0;for(b=this.faces.length;a<b;a++){d=this.faces[a];d.centroid.set(0,0,0);if(d instanceof THREE.Face3){d.centroid.addSelf(this.vertices[d.a].position);d.centroid.addSelf(this.vertices[d.b].position);d.centroid.addSelf(this.vertices[d.c].position);d.centroid.divideScalar(3)}else if(d instanceof THREE.Face4){d.centroid.addSelf(this.vertices[d.a].position);d.centroid.addSelf(this.vertices[d.b].position);d.centroid.addSelf(this.vertices[d.c].position);
d.centroid.addSelf(this.vertices[d.d].position);d.centroid.divideScalar(4)}}},computeNormals:function(a){var b,d,e,f,j,k,g=new THREE.Vector3,p=new THREE.Vector3;e=0;for(f=this.vertices.length;e<f;e++){j=this.vertices[e];j.normal.set(0,0,0)}e=0;for(f=this.faces.length;e<f;e++){j=this.faces[e];if(a&&j.vertexNormals.length){g.set(0,0,0);b=0;for(d=j.normal.length;b<d;b++)g.addSelf(j.vertexNormals[b]);g.divideScalar(3)}else{b=this.vertices[j.a];d=this.vertices[j.b];k=this.vertices[j.c];g.sub(k.position,
d.position);p.sub(b.position,d.position);g.crossSelf(p)}g.isZero()||g.normalize();j.normal.copy(g)}},computeVertexNormals:function(){var a,b=[],d,e;a=0;for(vl=this.vertices.length;a<vl;a++)b[a]=new THREE.Vector3;a=0;for(d=this.faces.length;a<d;a++){e=this.faces[a];if(e instanceof THREE.Face3){b[e.a].addSelf(e.normal);b[e.b].addSelf(e.normal);b[e.c].addSelf(e.normal)}else if(e instanceof THREE.Face4){b[e.a].addSelf(e.normal);b[e.b].addSelf(e.normal);b[e.c].addSelf(e.normal);b[e.d].addSelf(e.normal)}}a=
0;for(vl=this.vertices.length;a<vl;a++)b[a].normalize();a=0;for(d=this.faces.length;a<d;a++){e=this.faces[a];if(e instanceof THREE.Face3){e.vertexNormals[0]=b[e.a].clone();e.vertexNormals[1]=b[e.b].clone();e.vertexNormals[2]=b[e.c].clone()}else if(e instanceof THREE.Face4){e.vertexNormals[0]=b[e.a].clone();e.vertexNormals[1]=b[e.b].clone();e.vertexNormals[2]=b[e.c].clone();e.vertexNormals[3]=b[e.d].clone()}}},computeBoundingBox:function(){if(this.vertices.length>0){this.bbox={x:[this.vertices[0].position.x,
this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var a=1,b=this.vertices.length;a<b;a++){vertex=this.vertices[a];if(vertex.position.x<this.bbox.x[0])this.bbox.x[0]=vertex.position.x;else if(vertex.position.x>this.bbox.x[1])this.bbox.x[1]=vertex.position.x;if(vertex.position.y<this.bbox.y[0])this.bbox.y[0]=vertex.position.y;else if(vertex.position.y>this.bbox.y[1])this.bbox.y[1]=vertex.position.y;
if(vertex.position.z<this.bbox.z[0])this.bbox.z[0]=vertex.position.z;else if(vertex.position.z>this.bbox.z[1])this.bbox.z[1]=vertex.position.z}}},sortFacesByMaterial:function(){function a(t){var F=[];b=0;for(d=t.length;b<d;b++)t[b]==undefined?F.push("undefined"):F.push(t[b].toString());return F.join("_")}var b,d,e,f,j,k,g,p,c={};e=0;for(f=this.faces.length;e<f;e++){j=this.faces[e];k=j.material;g=a(k);if(c[g]==undefined)c[g]={hash:g,counter:0};p=c[g].hash+"_"+c[g].counter;if(this.geometryChunks[p]==
undefined)this.geometryChunks[p]={faces:[],material:k,vertices:0};j=j instanceof THREE.Face3?3:4;if(this.geometryChunks[p].vertices+j>65535){c[g].counter+=1;p=c[g].hash+"_"+c[g].counter;if(this.geometryChunks[p]==undefined)this.geometryChunks[p]={faces:[],material:k,vertices:0}}this.geometryChunks[p].faces.push(e);this.geometryChunks[p].vertices+=j}},toString:function(){return"THREE.Geometry ( vertices: "+this.vertices+", faces: "+this.faces+", uvs: "+this.uvs+" )"}};
THREE.Camera=function(a,b,d,e){this.position=new THREE.Vector3(0,0,0);this.target={position:new THREE.Vector3(0,0,0)};this.up=new THREE.Vector3(0,1,0);this.matrix=new THREE.Matrix4;this.projectionMatrix=THREE.Matrix4.makePerspective(a,b,d,e);this.autoUpdateMatrix=true;this.updateMatrix=function(){this.matrix.lookAt(this.position,this.target.position,this.up)};this.toString=function(){return"THREE.Camera ( "+this.position+", "+this.target.position+" )"}};THREE.Light=function(a){this.color=new THREE.Color(a)};
THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=b||1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;
THREE.PointLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=b||1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.PointLight;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册