diff --git a/README.md b/README.md
index 4dcb9091..cea025f5 100644
--- a/README.md
+++ b/README.md
@@ -37,62 +37,83 @@ This code creates a camera, then creates a scene object, adds a bunch of random
init();
setInterval(loop, 1000 / 60);
- function init()
- {
- camera = new Camera(0, 0, 1000);
+ function init() {
+
+ camera = new THREE.Camera(0, 0, 1000);
- scene = new Scene();
+ scene = new THREE.Scene();
- renderer = new CanvasRenderer();
+ renderer = new THREE.CanvasRenderer();
renderer.setSize(window.innerWidth, window.innerHeight);
- for (var i = 0; i < 1000; i++)
- {
- var particle = new Particle( new ColorMaterial(Math.random() * 0x808008 + 0x808080, 1) );
+ for (var i = 0; i < 1000; i++) {
+
+ var particle = new THREE.Particle( new THREE.ColorMaterial(Math.random() * 0x808008 + 0x808080, 1) );
particle.size = Math.random() * 10 + 5;
particle.position.x = Math.random() * 2000 - 1000;
particle.position.y = Math.random() * 2000 - 1000;
particle.position.z = Math.random() * 2000 - 1000;
particle.updateMatrix();
scene.add( particle );
+
}
document.body.appendChild(renderer.viewport);
+
}
- function loop()
- {
+ function loop() {
+
renderer.render(scene, camera);
+
}
If you are interested on messing with the actual library, instead of importing the three.js compressed file, you can include the original files in this order:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
### Change Log ###
+2010 05 16 - **r5** (17.979 kb)
+
+* Removed Class.js dependency
+* Added THREE namespace
+* Camera.x -> Camera.position.x
+* Camera.target.x -> Camera.target.position.x
+* ColorMaterial -> ColorFillMaterial
+* FaceColorMaterial -> FaceColorFillMaterial
+* Materials are now multipass (use array)
+* Added ColorStrokeMaterial and FaceColorStrokeMaterial
+* geometry.faces.a are now indexes instead of links
+
+
2010 04 26 - **r4** (16.274 kb)
* SVGRenderer Particle rendering
diff --git a/build/three.js b/build/three.js
index d8504182..373fe523 100644
--- a/build/three.js
+++ b/build/three.js
@@ -1,2 +1,2 @@
-// three.js r4 - http://github.com/mrdoob/three.js
-(function(){var a=false,b=/xyz/.test(function(){xyz})?/\b_super\b/:/.*/;this.Class=function(){};Class.extend=function(g){var f=this.prototype;a=true;var e=new this();a=false;for(var d in g){e[d]=typeof g[d]=="function"&&typeof f[d]=="function"&&b.test(g[d])?(function(h,i){return function(){var l=this._super;this._super=f[h];var k=i.apply(this,arguments);this._super=l;return k}})(d,g[d]):g[d]}function c(){if(!a&&this.init){this.init.apply(this,arguments)}}c.prototype=e;c.constructor=c;c.extend=arguments.callee;return c}})();var Color=Class.extend({r:null,g:null,b:null,a:null,hex:null,styleString:null,init:function(a){this.setHex(a?a:4278190080)},setHex:function(a){this.hex=a;this.updateRGBA();this.updateStyleString()},setRGBA:function(f,e,c,d){this.r=f;this.g=e;this.b=c;this.a=d;this.updateHex();this.updateStyleString()},updateHex:function(){this.hex=this.a<<24|this.r<<16|this.g<<8|this.b},updateRGBA:function(){this.r=this.hex>>16&255;this.g=this.hex>>8&255;this.b=this.hex&255;this.a=this.hex>>24&255},updateStyleString:function(){this.styleString="rgba("+this.r+","+this.g+","+this.b+","+(this.a/255)+")"},toString:function(){return"Color ( r: "+this.r+", g: "+this.g+", b: "+this.b+", a: "+this.a+", hex: "+this.hex+", style: "+this.styleString+" )"}});var Vector3=Class.extend({x:null,y:null,z:null,dx:null,dy:null,dz:null,tx:null,ty:null,tz:null,init:function(a,c,b){this.x=a?a:0;this.y=c?c:0;this.z=b?b:0},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z},add:function(b,a){this.x=b.x+a.x;this.y=b.y+a.y;this.z=b.z+a.z},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z},sub:function(b,a){this.x=b.x-a.x;this.y=b.y-a.y;this.z=b.z-a.z},cross:function(a){this.tx=this.x;this.ty=this.y;this.tz=this.z;this.x=this.ty*a.z-this.tz*a.y;this.y=this.tz*a.x-this.tx*a.z;this.z=this.tx*a.y-this.ty*a.x},multiply:function(a){this.x*=a;this.y*=a;this.z*=a},distanceTo:function(a){this.dx=this.x-a.x;this.dy=this.y-a.y;this.dz=this.z-a.z;return Math.sqrt(this.dx*this.dx+this.dy*this.dy+this.dz*this.dz)},distanceToSquared:function(a){this.dx=this.x-a.x;this.dy=this.y-a.y;this.dz=this.z-a.z;return this.dx*this.dx+this.dy*this.dy+this.dz*this.dz},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},negate:function(){this.x=-this.x;this.y=-this.y;this.z=-this.z},normalize:function(){if(this.length()>0){this.ool=1/this.length()}else{this.ool=0}this.x*=this.ool;this.y*=this.ool;this.z*=this.ool;return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},clone:function(){return new Vector3(this.x,this.y,this.z)},toString:function(){return"Vector3 ("+this.x+", "+this.y+", "+this.z+")"}});Vector3.add=function(d,c){return new Vector3(d.x+c.x,d.y+c.y,d.z+c.z)};Vector3.sub=function(d,c){return new Vector3(d.x-c.x,d.y-c.y,d.z-c.z)};Vector3.multiply=function(b,c){return new Vector3(b.x*c,b.y*c,b.z*c)};Vector3.cross=function(d,c){return new Vector3(d.y*c.z-d.z*c.y,d.z*c.x-d.x*c.z,d.x*c.y-d.y*c.x)};Vector3.dot=function(d,c){return d.x*c.x+d.y*c.y+d.z*c.z};var Matrix4=Class.extend({n11:null,n12:null,n13:null,n14:null,n21:null,n22:null,n23:null,n24:null,n31:null,n32:null,n33:null,n34:null,x:null,y:null,z:null,init:function(){this.identity()},identity:function(){this.n11=1;this.n12=0;this.n13=0;this.n14=0;this.n21=0;this.n22=1;this.n23=0;this.n24=0;this.n31=0;this.n32=0;this.n33=1;this.n34=0;this.x=new Vector3(0,0,0);this.y=new Vector3(0,0,0);this.z=new Vector3(0,0,0)},lookAt:function(c,b,a){this.z.sub(b,c);this.z.normalize();this.x.copy(this.z);this.x.cross(a);this.x.normalize();this.y.copy(this.x);this.y.cross(this.z);this.y.normalize();this.y.negate();this.n11=this.x.x;this.n12=this.x.y;this.n13=this.x.z;this.n14=-this.x.dot(c);this.n21=this.y.x;this.n22=this.y.y;this.n23=this.y.z;this.n24=-this.y.dot(c);this.n31=this.z.x;this.n32=this.z.y;this.n33=this.z.z;this.n34=-this.z.dot(c)},transform:function(a){var d=a.x,c=a.y,b=a.z;a.x=this.n11*d+this.n12*c+this.n13*b+this.n14;a.y=this.n21*d+this.n22*c+this.n23*b+this.n24;a.z=this.n31*d+this.n32*c+this.n33*b+this.n34},multiply:function(d,c){this.n11=d.n11*c.n11+d.n12*c.n21+d.n13*c.n31;this.n12=d.n11*c.n12+d.n12*c.n22+d.n13*c.n32;this.n13=d.n11*c.n13+d.n12*c.n23+d.n13*c.n33;this.n14=d.n11*c.n14+d.n12*c.n24+d.n13*c.n34+d.n14;this.n21=d.n21*c.n11+d.n22*c.n21+d.n23*c.n31;this.n22=d.n21*c.n12+d.n22*c.n22+d.n23*c.n32;this.n23=d.n21*c.n13+d.n22*c.n23+d.n23*c.n33;this.n24=d.n21*c.n14+d.n22*c.n24+d.n23*c.n34+d.n24;this.n31=d.n31*c.n11+d.n32*c.n21+d.n33*c.n31;this.n32=d.n31*c.n12+d.n32*c.n22+d.n33*c.n32;this.n33=d.n31*c.n13+d.n32*c.n23+d.n33*c.n33;this.n34=d.n31*c.n14+d.n32*c.n24+d.n33*c.n34+d.n34},multiplySelf:function(c){var k=this.n11,i=this.n12,h=this.n13,g=this.n14;var f=this.n21,e=this.n22,d=this.n23,b=this.n24;var a=this.n31,o=this.n32,n=this.n33,l=this.n34;this.n11=k*c.n11+i*c.n21+h*c.n31;this.n12=k*c.n12+i*c.n22+h*c.n32;this.n13=k*c.n13+i*c.n23+h*c.n33;this.n14=k*c.n14+i*c.n24+h*c.n34+g;this.n21=f*c.n11+e*c.n21+d*c.n31;this.n22=f*c.n12+e*c.n22+d*c.n32;this.n23=f*c.n13+e*c.n23+d*c.n33;this.n24=f*c.n14+e*c.n24+d*c.n34+b;this.n31=a*c.n11+o*c.n21+n*c.n31;this.n32=a*c.n12+o*c.n22+n*c.n32;this.n33=a*c.n13+o*c.n23+n*c.n33;this.n34=a*c.n14+o*c.n24+n*c.n34+l},clone:function(){var a=new Matrix4();a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;return a},toString:function(){return"| "+this.n11+" "+this.n12+" "+this.n13+" "+this.n14+" |\n| "+this.n21+" "+this.n22+" "+this.n23+" "+this.n24+" |\n| "+this.n31+" "+this.n32+" "+this.n33+" "+this.n34+" |"}});Matrix4.translationMatrix=function(b,d,c){var a=new Matrix4();a.n14=b;a.n24=d;a.n34=c;return a};Matrix4.scaleMatrix=function(b,d,c){var a=new Matrix4();a.n11=b;a.n22=d;a.n33=c;return a};Matrix4.rotationXMatrix=function(b){var a=new Matrix4();a.n22=a.n33=Math.cos(b);a.n32=Math.sin(b);a.n23=-a.n32;return a};Matrix4.rotationYMatrix=function(b){var a=new Matrix4();a.n11=a.n33=Math.cos(b);a.n13=Math.sin(b);a.n31=-a.n13;return a};Matrix4.rotationZMatrix=function(b){var a=new Matrix4();a.n11=a.n22=Math.cos(b);a.n21=Math.sin(b);a.n12=-a.n21;return a};var Vertex=Vector3.extend({u:null,v:null,screen:null,normal:null,visible:null,init:function(a,c,b){this._super(a,c,b);this.screen=new Vector3()},toString:function(){return"Vertex ( "+this.x+", "+this.y+", "+this.z+" )"}});var Face3=Vector3.extend({a:null,b:null,c:null,screen:null,uv:null,normal:null,color:null,init:function(e,d,i,g,h,f){this._super((e.x+d.x+i.x)/3,(e.y+d.y+i.y)/3,(e.z+d.z+i.z)/3);this.a=e;this.b=d;this.c=i;this.screen=new Vector3();this.uv=g?g:[[0,0],[0,0],[0,0]];this.normal=h?h:new Vector3();this.color=f?f:new Color()},toString:function(){return"Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}});var Face4=Vector3.extend({a:null,b:null,c:null,d:null,normal:null,screen:null,color:null,init:function(f,e,l,k,h,i,g){this._super((f.x+e.x+l.x+k.x)/4,(f.y+e.y+l.y+k.y)/4,(f.z+e.z+l.z+k.z)/4);this.a=f;this.b=e;this.c=l;this.d=k;this.screen=new Vector3();this.color=g?g:new Color()},toString:function(){return"Face4 ( "+this.a+", "+this.b+", "+this.c+", "+this.d+" )"}});var Geometry=Class.extend({vertices:null,faces:null,init:function(){this.vertices=new Array();this.faces=new Array()}});var Camera=Vector3.extend({up:null,target:null,zoom:null,focus:null,roll:null,matrix:null,init:function(a,c,b){this._super(a,c,b);this.up=new Vector3(0,1,0);this.target=new Vector3(0,0,0);this.zoom=3;this.focus=500;this.roll=0;this.matrix=new Matrix4();this.updateMatrix()},updateMatrix:function(){this.matrix.lookAt(this,this.target,this.up)},toString:function(){return"Camera ( "+this.x+", "+this.y+", "+this.z+" )"}});var Object3D=Class.extend({position:null,rotation:null,scale:null,matrix:null,screen:null,init:function(){this.position=new Vector3(0,0,0);this.rotation=new Vector3(0,0,0);this.scale=new Vector3(1,1,1);this.matrix=new Matrix4();this.screen=new Vector3(0,0,0)},updateMatrix:function(){this.matrix.identity();this.matrix.multiplySelf(Matrix4.translationMatrix(this.position.x,this.position.y,this.position.z));this.matrix.multiplySelf(Matrix4.rotationXMatrix(this.rotation.x));this.matrix.multiplySelf(Matrix4.rotationYMatrix(this.rotation.y));this.matrix.multiplySelf(Matrix4.rotationZMatrix(this.rotation.z));this.matrix.multiplySelf(Matrix4.scaleMatrix(this.scale.x,this.scale.y,this.scale.z))}});var Mesh=Object3D.extend({geometry:null,material:null,doubleSide:null,init:function(b,a){this._super();this.geometry=b;this.material=a}});var Particle=Object3D.extend({size:1,material:null,init:function(a){this._super();this.material=a}});var Plane=Geometry.extend({init:function(b,a){this._super();var d=b/2;var c=a/2;this.v(-d,c,0);this.v(d,c,0);this.v(d,-c,0);this.v(-d,-c,0);this.f4(0,1,2,3)},v:function(a,c,b){this.vertices.push(new Vertex(a,c,b))},f4:function(f,e,h,g){this.faces.push(new Face4(this.vertices[f],this.vertices[e],this.vertices[h],this.vertices[g]))}});var Cube=Geometry.extend({init:function(c,a,e){this._super();var f=c/2;var d=a/2;var b=e/2;this.v(f,d,-b);this.v(f,-d,-b);this.v(-f,-d,-b);this.v(-f,d,-b);this.v(f,d,b);this.v(f,-d,b);this.v(-f,-d,b);this.v(-f,d,b);this.f4(0,1,2,3);this.f4(4,7,6,5);this.f4(0,4,5,1);this.f4(1,5,6,2);this.f4(2,6,7,3);this.f4(4,0,3,7)},v:function(a,c,b){this.vertices.push(new Vertex(a,c,b))},f4:function(f,e,h,g){this.faces.push(new Face4(this.vertices[f],this.vertices[e],this.vertices[h],this.vertices[g]))}});var ColorMaterial=Class.extend({color:null,init:function(b,a){this.color=new Color((a?(a*255)<<24:4278190080)|b)}});var FaceColorMaterial=Class.extend({});var Scene=Class.extend({objects:null,init:function(){this.objects=new Array()},add:function(a){this.objects.push(a)},remove:function(a){for(var b=0;b0;f.screen.x*=f.screen.z;f.screen.y*=f.screen.z}for(c=0;c0)){h.screen.z=(h.a.screen.z+h.b.screen.z+h.c.screen.z)*0.3;if(this.face3Pool[l]==null){this.face3Pool[l]=new Face3(new Vertex(),new Vertex(),new Vertex())}this.face3Pool[l].a.screen.copy(h.a.screen);this.face3Pool[l].b.screen.copy(h.b.screen);this.face3Pool[l].c.screen.copy(h.c.screen);this.face3Pool[l].screen.z=h.screen.z;this.face3Pool[l].color=h.color;this.face3Pool[l].material=b.material;this.renderList.push(this.face3Pool[l]);l++}}else{if(h instanceof Face4){if(h.a.visible&&h.b.visible&&h.c.visible&&(b.doubleSided||((h.d.screen.x-h.a.screen.x)*(h.b.screen.y-h.a.screen.y)-(h.d.screen.y-h.a.screen.y)*(h.b.screen.x-h.a.screen.x)>0||(h.b.screen.x-h.c.screen.x)*(h.d.screen.y-h.c.screen.y)-(h.b.screen.y-h.c.screen.y)*(h.d.screen.x-h.c.screen.x)>0))){h.screen.z=(h.a.screen.z+h.b.screen.z+h.c.screen.z+h.d.screen.z)*0.25;if(this.face4Pool[a]==null){this.face4Pool[a]=new Face4(new Vertex(),new Vertex(),new Vertex(),new Vertex())}this.face4Pool[a].a.screen.copy(h.a.screen);this.face4Pool[a].b.screen.copy(h.b.screen);this.face4Pool[a].c.screen.copy(h.c.screen);this.face4Pool[a].d.screen.copy(h.d.screen);this.face4Pool[a].screen.z=h.screen.z;this.face4Pool[a].color=h.color;this.face4Pool[a].material=b.material;this.renderList.push(this.face4Pool[a]);a++}}}}}else{if(b instanceof Particle){b.screen.copy(b.position);g.matrix.transform(b.screen);b.screen.z=k/(g.focus+b.screen.z);if(b.screen.z<0){continue}b.screen.x*=b.screen.z;b.screen.y*=b.screen.z;this.renderList.push(b)}}}this.renderList.sort(this.sort)}});var CanvasRenderer=Renderer.extend({context:null,init:function(){this._super();this.viewport=document.createElement("canvas");this.viewport.style.position="absolute";this.context=this.viewport.getContext("2d")},setSize:function(b,a){this._super(b,a);this.viewport.width=this.width;this.viewport.height=this.height;this.context.setTransform(1,0,0,1,this.widthHalf,this.heightHalf)},render:function(d,b){this._super(d,b);var a,c=Math.PI*2;this.context.clearRect(-this.widthHalf,-this.heightHalf,this.width,this.height);for(j=0;j0){this.viewport.removeChild(this.viewport.childNodes[0])}var b=0,a=0,d;for(j=0;j>16&255;e=d>>8&255;a=d&255;b=d>>24&255};this.updateStyleString=function(){this.styleString="rgba("+f+","+e+","+a+","+(b/255)+")"};this.toString=function(){return"THREE.Color ( r: "+f+", g: "+e+", b: "+a+", a: "+b+", hex: "+d+", style: "+this.styleString+" )"};this.setHex(c)};THREE.Vector2=function(a,b){this.x=a||0;this.y=b||0;this.copy=function(c){this.x=c.x;this.y=c.y};this.addSelf=function(c){this.x+=c.x;this.y+=c.y};this.add=function(d,c){this.x=d.x+c.x;this.y=d.y+c.y};this.subSelf=function(c){this.x-=c.x;this.y-=c.y};this.sub=function(d,c){this.x=d.x-c.x;this.y=d.y-c.y};this.multiply=function(c){this.x*=c;this.y*=c};this.unit=function(){this.multiply(1/this.length())};this.expand=function(d,c){this.unit(this.sub(c,d));c.addSelf(this)};this.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y)};this.lengthSq=function(){return this.x*this.x+this.y*this.y};this.negate=function(){this.x=-this.x;this.y=-this.y};this.clone=function(){return new THREE.Vector2(this.x,this.y)};this.toString=function(){return"THREE.Vector2 ("+this.x+", "+this.y+")"}};THREE.Vector3=function(a,c,b){this.x=a||0;this.y=c||0;this.z=b||0;this.copy=function(d){this.x=d.x;this.y=d.y;this.z=d.z};this.add=function(e,d){this.x=e.x+d.x;this.y=e.y+d.y;this.z=e.z+d.z};this.addSelf=function(d){this.x+=d.x;this.y+=d.y;this.z+=d.z};this.sub=function(e,d){this.x=e.x-d.x;this.y=e.y-d.y;this.z=e.z-d.z};this.subSelf=function(d){this.x-=d.x;this.y-=d.y;this.z-=d.z};this.cross=function(f){var e=this.x,d=this.y,g=this.z;this.x=d*f.z-g*f.y;this.y=g*f.x-e*f.z;this.z=e*f.y-d*f.x};this.multiply=function(d){this.x*=d;this.y*=d;this.z*=d};this.distanceTo=function(g){var f=this.x-g.x,e=this.y-g.y,d=this.z-g.z;return Math.sqrt(f*f+e*e+d*d)};this.distanceToSquared=function(g){var f=this.x-g.x,e=this.y-g.y,d=this.z-g.z;return f*f+e*e+d*d};this.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)};this.lengthSq=function(){return this.x*this.x+this.y*this.y+this.z*this.z};this.negate=function(){this.x=-this.x;this.y=-this.y;this.z=-this.z};this.normalize=function(){if(this.length()>0){this.multiply(1/this.length())}else{this.multiply(0)}};this.dot=function(d){return this.x*d.x+this.y*d.y+this.z*d.z};this.clone=function(){return new Vector3(this.x,this.y,this.z)};this.toString=function(){return"THREE.Vector3 ("+this.x+", "+this.y+", "+this.z+")"}};THREE.Vector4=function(a,d,c,b){this.x=a||0;this.y=d||0;this.z=c||0;this.w=b||1;this.copy=function(e){this.x=e.x;this.y=e.y;this.z=e.z;this.w=e.w};this.add=function(f,e){this.x=f.x+e.x;this.y=f.y+e.y;this.z=f.z+e.z;this.w=f.w+e.w};this.addSelf=function(e){this.x+=e.x;this.y+=e.y;this.z+=e.z;this.w+=e.w};this.sub=function(f,e){this.x=f.x-e.x;this.y=f.y-e.y;this.z=f.z-e.z;this.w=f.w-e.w};this.subSelf=function(e){this.x-=e.x;this.y-=e.y;this.z-=e.z;this.w-=e.w};this.clone=function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)};this.toVector3=function(){return new THREE.Vector3(this.x/this.w,this.y/this.w,this.z/this.w)};this.toString=function(){return"THREE.Vector4 ("+this.x+", "+this.y+", "+this.z+", "+this.w+")"}};THREE.Matrix4=function(){var a,c,b;a=new THREE.Vector3();c=new THREE.Vector3();b=new THREE.Vector3();this.n11=1;this.n12=0;this.n13=0;this.n14=0;this.n21=0;this.n22=1;this.n23=0;this.n24=0;this.n31=0;this.n32=0;this.n33=1;this.n34=0;this.n41=0;this.n42=0;this.n43=0;this.n44=1;this.identity=function(){this.n11=1;this.n12=0;this.n13=0;this.n14=0;this.n21=0;this.n22=1;this.n23=0;this.n24=0;this.n31=0;this.n32=0;this.n33=1;this.n34=0;this.n41=0;this.n42=0;this.n43=0;this.n44=1};this.lookAt=function(f,e,d){b.sub(e,f);b.normalize();a.copy(b);a.cross(d);a.normalize();c.copy(a);c.cross(b);c.normalize();c.negate();this.n11=a.x;this.n12=a.y;this.n13=a.z;this.n14=-a.dot(f);this.n21=c.x;this.n22=c.y;this.n23=c.z;this.n24=-c.dot(f);this.n31=b.x;this.n32=b.y;this.n33=b.z;this.n34=-b.dot(f)};this.transform=function(d){var g=d.x,f=d.y,e=d.z,h=(d.w?d.w:1);d.x=this.n11*g+this.n12*f+this.n13*e+this.n14*h;d.y=this.n21*g+this.n22*f+this.n23*e+this.n24*h;d.z=this.n31*g+this.n32*f+this.n33*e+this.n34*h;h=this.n41*g+this.n42*f+this.n43*e+this.n44*h;if(d.w){d.w=h}else{d.x=d.x/h;d.y=d.y/h;d.z=d.z/h}};this.crossVector=function(d){var e=new THREE.Vector4();e.x=this.n11*d.x+this.n12*d.y+this.n13*d.z+this.n14*d.w;e.y=this.n21*d.x+this.n22*d.y+this.n23*d.z+this.n24*d.w;e.z=this.n31*d.x+this.n32*d.y+this.n33*d.z+this.n34*d.w;e.w=(d.w)?this.n41*d.x+this.n42*d.y+this.n43*d.z+this.n44*d.w:1;return e};this.multiply=function(e,d){this.n11=e.n11*d.n11+e.n12*d.n21+e.n13*d.n31+e.n14*d.n41;this.n12=e.n11*d.n12+e.n12*d.n22+e.n13*d.n32+e.n14*d.n42;this.n13=e.n11*d.n13+e.n12*d.n23+e.n13*d.n33+e.n14*d.n43;this.n14=e.n11*d.n14+e.n12*d.n24+e.n13*d.n34+e.n14*d.n44;this.n21=e.n21*d.n11+e.n22*d.n21+e.n23*d.n31+e.n24*d.n41;this.n22=e.n21*d.n12+e.n22*d.n22+e.n23*d.n32+e.n24*d.n42;this.n23=e.n21*d.n13+e.n22*d.n23+e.n23*d.n33+e.n24*d.n34;this.n24=e.n21*d.n14+e.n22*d.n24+e.n23*d.n34+e.n24*d.n44;this.n31=e.n31*d.n11+e.n32*d.n21+e.n33*d.n31+e.n34*d.n41;this.n32=e.n31*d.n12+e.n32*d.n22+e.n33*d.n32+e.n34*d.n42;this.n33=e.n31*d.n13+e.n32*d.n23+e.n33*d.n33+e.n34*d.n43;this.n34=e.n31*d.n14+e.n32*d.n24+e.n33*d.n34+e.n34*d.n44;this.n41=e.n41*d.n11+e.n42*d.n21+e.n43*d.n31+e.n44*d.n41;this.n42=e.n41*d.n12+e.n42*d.n22+e.n43*d.n32+e.n44*d.n42;this.n43=e.n41*d.n13+e.n42*d.n23+e.n43*d.n33+e.n44*d.n43;this.n44=e.n41*d.n14+e.n42*d.n24+e.n43*d.n34+e.n44*d.n44};this.multiplySelf=function(f){var r=this.n11,q=this.n12,o=this.n13,l=this.n14,i=this.n21,h=this.n22,g=this.n23,e=this.n24,d=this.n31,u=this.n32,t=this.n33,s=this.n34,p=this.n41,n=this.n42,k=this.n43,j=this.n44;this.n11=r*f.n11+q*f.n21+o*f.n31+l*f.n41;this.n12=r*f.n12+q*f.n22+o*f.n32+l*f.n42;this.n13=r*f.n13+q*f.n23+o*f.n33+l*f.n43;this.n14=r*f.n14+q*f.n24+o*f.n34+l*f.n44;this.n21=i*f.n11+h*f.n21+g*f.n31+e*f.n41;this.n22=i*f.n12+h*f.n22+g*f.n32+e*f.n42;this.n23=i*f.n13+h*f.n23+g*f.n33+e*f.n43;this.n24=i*f.n14+h*f.n24+g*f.n34+e*f.n44;this.n31=d*f.n11+u*f.n21+t*f.n31+s*f.n41;this.n32=d*f.n12+u*f.n22+t*f.n32+s*f.n42;this.n33=d*f.n13+u*f.n23+t*f.n33+s*f.n43;this.n34=d*f.n14+u*f.n24+t*f.n34+s*f.n44;this.n41=p*f.n11+n*f.n21+k*f.n31+j*f.n41;this.n42=p*f.n12+n*f.n22+k*f.n32+j*f.n42;this.n43=p*f.n13+n*f.n23+k*f.n33+j*f.n43;this.n44=p*f.n14+n*f.n24+k*f.n34+j*f.n44};this.clone=function(){var d=new THREE.Matrix4();d.n11=this.n11;d.n12=this.n12;d.n13=this.n13;d.n14=this.n14;d.n21=this.n21;d.n22=this.n22;d.n23=this.n23;d.n24=this.n24;d.n31=this.n31;d.n32=this.n32;d.n33=this.n33;d.n34=this.n34;d.n41=this.n41;d.n42=this.n42;d.n43=this.n43;d.n44=this.n44;return d};this.toString=function(){return"| "+this.n11+" "+this.n12+" "+this.n13+" "+this.n14+" |\n| "+this.n21+" "+this.n22+" "+this.n23+" "+this.n24+" |\n| "+this.n31+" "+this.n32+" "+this.n33+" "+this.n34+" |\n| "+this.n41+" "+this.n42+" "+this.n43+" "+this.n44+" |"}};THREE.Matrix4.translationMatrix=function(b,d,c){var a=new THREE.Matrix4();a.n14=b;a.n24=d;a.n34=c;return a};THREE.Matrix4.scaleMatrix=function(b,d,c){var a=new THREE.Matrix4();a.n11=b;a.n22=d;a.n33=c;return a};THREE.Matrix4.rotationXMatrix=function(b){var a=new THREE.Matrix4();a.n22=a.n33=Math.cos(b);a.n32=Math.sin(b);a.n23=-a.n32;return a};THREE.Matrix4.rotationYMatrix=function(b){var a=new THREE.Matrix4();a.n11=a.n33=Math.cos(b);a.n13=Math.sin(b);a.n31=-a.n13;return a};THREE.Matrix4.rotationZMatrix=function(b){var a=new THREE.Matrix4();a.n11=a.n22=Math.cos(b);a.n21=Math.sin(b);a.n12=-a.n21;return a};THREE.Matrix4.makeFrustum=function(f,r,e,o,i,h){var g=new THREE.Matrix4(),q=2*i/(r-f),n=2*i/(o-e),p=(r+f)/(r-f),l=(o+e)/(o-e),k=-(h+i)/(h-i),j=-2*h*i/(h-i);g.n11=q;g.n13=p;g.n22=n;g.n23=l;g.n33=k;g.n34=j;g.n43=-1;g.n44=0;return g};THREE.Matrix4.makePerspective=function(d,c,g,b){var a=g*Math.tan(d*0.00872664625972),f=-a,h=f*c,e=a*c;return THREE.Matrix4.makeFrustum(h,e,f,a,g,b)};THREE.Vertex=function(a,b){this.position=a||new THREE.Vector3();this.normal=b||new THREE.Vector3();this.screen=new THREE.Vector3();this.visible=true;this.toString=function(){return"THREE.Vertex ( "+this.position+", "+this.normal+" )"}};THREE.Face3=function(e,d,i,g,h,f){this.a=e;this.b=d;this.c=i;this.normal=h||new THREE.Vector3();this.screen=new THREE.Vector3();this.uv=g||[[0,0],[0,0],[0,0]];this.color=f||new THREE.Color();this.toString=function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}};THREE.Face4=function(f,e,k,j,h,i,g){this.a=f;this.b=e;this.c=k;this.d=j;this.normal=i||new THREE.Vector3();this.screen=new THREE.Vector3();this.uv=h||[[0,0],[0,0],[0,0],[0,0]];this.color=g||new THREE.Color();this.toString=function(){return"THREE.Face4 ( "+this.a+", "+this.b+", "+this.c+" "+this.d+" )"}};THREE.Geometry=function(){this.vertices=[];this.faces=[]};THREE.Camera=function(a,c,b){this.position=new THREE.Vector3(a,c,b);this.target={position:new THREE.Vector3(0,0,0)};this.matrix=new THREE.Matrix4();this.projectionMatrix=THREE.Matrix4.makePerspective(45,1,0.001,1000);this.up=new THREE.Vector3(0,1,0);this.roll=0;this.zoom=3;this.focus=500;this.updateMatrix=function(){this.matrix.lookAt(this.position,this.target.position,this.up)};this.toString=function(){return"THREE.Camera ( "+this.position+", "+this.target.position+" )"};this.updateMatrix()};THREE.Object3D=function(a){this.position=new THREE.Vector3(0,0,0);this.rotation=new THREE.Vector3(0,0,0);this.scale=new THREE.Vector3(1,1,1);this.matrix=new THREE.Matrix4();this.screen=new THREE.Vector3(0,0,0);this.material=a instanceof Array?a:[a];this.updateMatrix=function(){this.matrix.identity();this.matrix.multiplySelf(THREE.Matrix4.translationMatrix(this.position.x,this.position.y,this.position.z));this.matrix.multiplySelf(THREE.Matrix4.rotationXMatrix(this.rotation.x));this.matrix.multiplySelf(THREE.Matrix4.rotationYMatrix(this.rotation.y));this.matrix.multiplySelf(THREE.Matrix4.rotationZMatrix(this.rotation.z));this.matrix.multiplySelf(THREE.Matrix4.scaleMatrix(this.scale.x,this.scale.y,this.scale.z))}};THREE.Line=function(b,a){THREE.Object3D.call(this,a);this.geometry=b};THREE.Line.prototype=new THREE.Object3D();THREE.Line.prototype.constructor=THREE.Line;THREE.Mesh=function(b,a){THREE.Object3D.call(this,a);this.geometry=b;this.doubleSided=false};THREE.Mesh.prototype=new THREE.Object3D();THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Particle=function(a){THREE.Object3D.call(this,a);this.size=1};THREE.Particle.prototype=new THREE.Object3D();THREE.Particle.prototype.constructor=THREE.Particle;THREE.ColorFillMaterial=function(b,a){this.color=new THREE.Color((a?(a*255)<<24:4278190080)|b);this.toString=function(){return"THREE.ColorFillMaterial ( color: "+this.color+" )"}};THREE.ColorStrokeMaterial=function(c,b,a){this.lineWidth=a||1;this.color=new THREE.Color((b?(b*255)<<24:4278190080)|c);this.toString=function(){return"THREE.ColorStrokeMaterial ( lineWidth: "+this.lineWidth+", color: "+this.color+" )"}};THREE.FaceColorFillMaterial=function(){this.toString=function(){return"THREE.FaceColorFillMaterial ( )"}};THREE.FaceColorStrokeMaterial=function(a){this.lineWidth=a||1;this.toString=function(){return"THREE.FaceColorStrokeMaterial ( lineWidth: "+this.lineWidth+" )"}};THREE.Scene=function(){this.objects=[];this.add=function(a){this.objects.push(a)};this.toString=function(){return"THREE.Scene ( "+this.objects+" )"}};THREE.Renderer=function(){var e=[],c=[],a=[],b=new THREE.Matrix4();this.renderList;function d(g,f){return g.screenZ-f.screenZ}this.project=function(x,v){var s,q,w,n,y,l,k,h,g,p=0,u=0,r=0,t=v.focus,o=v.focus*v.zoom,m=0,f=0;this.renderList=[];for(s=0;s0;w.screen.x*=w.screen.z;w.screen.y*=w.screen.z}f=y.geometry.faces.length;for(q=0;q0)){n.screen.z=(l.screen.z+k.screen.z+h.screen.z)*0.3;if(e[p]==null){e[p]=new THREE.RenderableFace3()}e[p].v1.x=l.screen.x;e[p].v1.y=l.screen.y;e[p].v2.x=k.screen.x;e[p].v2.y=k.screen.y;e[p].v3.x=h.screen.x;e[p].v3.y=h.screen.y;e[p].screenZ=n.screen.z;e[p].color=n.color;e[p].material=y.material;this.renderList.push(e[p]);p++}}else{if(n instanceof THREE.Face4){l=y.geometry.vertices[n.a];k=y.geometry.vertices[n.b];h=y.geometry.vertices[n.c];g=y.geometry.vertices[n.d];if(l.visible&&k.visible&&h.visible&&g.visible&&(y.doubleSided||((g.screen.x-l.screen.x)*(k.screen.y-l.screen.y)-(g.screen.y-l.screen.y)*(k.screen.x-l.screen.x)>0||(k.screen.x-h.screen.x)*(g.screen.y-h.screen.y)-(k.screen.y-h.screen.y)*(g.screen.x-h.screen.x)>0))){n.screen.z=(l.screen.z+k.screen.z+h.screen.z+g.screen.z)*0.25;if(c[u]==null){c[u]=new THREE.RenderableFace4()}c[u].v1.x=l.screen.x;c[u].v1.y=l.screen.y;c[u].v2.x=k.screen.x;c[u].v2.y=k.screen.y;c[u].v3.x=h.screen.x;c[u].v3.y=h.screen.y;c[u].v4.x=g.screen.x;c[u].v4.y=g.screen.y;c[u].screenZ=n.screen.z;c[u].color=n.color;c[u].material=y.material;this.renderList.push(c[u]);u++}}}}}else{if(y instanceof THREE.Particle){y.screen.copy(y.position);v.matrix.transform(y.screen);y.screen.z=o/(t+y.screen.z);if(y.screen.z<0){continue}y.screen.x*=y.screen.z;y.screen.y*=y.screen.z;if(a[r]==null){a[r]=new THREE.RenderableParticle()}a[r].x=y.screen.x;a[r].y=y.screen.y;a[r].screenZ=y.screen.z;a[r].size=y.size;a[r].material=y.material;a[r].color=y.color;this.renderList.push(a[r]);r++}}}this.renderList.sort(d)}};THREE.CanvasRenderer=function(){THREE.Renderer.call(this);var a=document.createElement("canvas"),b=a.getContext("2d");this.setSize=function(d,c){a.width=d;a.height=c;b.setTransform(1,0,0,1,d/2,c/2)};this.domElement=a;this.render=function(f,h){var d,c,e,m=Math.PI*2,g,k,l;b.clearRect(-a.width/2,-a.height/2,a.width,a.height);this.project(f,h);g=this.renderList.length;for(d=0;d0){a.removeChild(a.childNodes[0])}o=this.renderList.length;for(k=0;k
+
+
+
+
+
+
+