Browse Source

- CanvasRenderer expands screen space points (workaround for antialias gaps).
- CanvasRenderer supports TextureUVMappingMaterial.
- Moved UVs to Geometry.
- Minor clean up

Mr.doob 15 years ago
parent
commit
90f54e2507

+ 11 - 3
README.md

@@ -96,6 +96,7 @@ If you are interested on messing with the actual library, instead of importing t
 	<script type="text/javascript" src="js/three/materials/ColorStrokeMaterial.js"></script>
 	<script type="text/javascript" src="js/three/materials/ColorStrokeMaterial.js"></script>
 	<script type="text/javascript" src="js/three/materials/FaceColorFillMaterial.js"></script>
 	<script type="text/javascript" src="js/three/materials/FaceColorFillMaterial.js"></script>
 	<script type="text/javascript" src="js/three/materials/FaceColorStrokeMaterial.js"></script>
 	<script type="text/javascript" src="js/three/materials/FaceColorStrokeMaterial.js"></script>
+	<script type="text/javascript" src="js/three/materials/TextureUVMappingMaterial.js"></script>
 	<script type="text/javascript" src="js/three/scenes/Scene.js"></script>
 	<script type="text/javascript" src="js/three/scenes/Scene.js"></script>
 	<script type="text/javascript" src="js/three/renderers/Renderer.js"></script>
 	<script type="text/javascript" src="js/three/renderers/Renderer.js"></script>
 	<script type="text/javascript" src="js/three/renderers/CanvasRenderer.js"></script>
 	<script type="text/javascript" src="js/three/renderers/CanvasRenderer.js"></script>
@@ -108,11 +109,18 @@ If you are interested on messing with the actual library, instead of importing t
 
 
 ### Change Log ###
 ### Change Log ###
 
 
+2010 06 06 - **r8** (23.129 kb)
+
+* Moved UVs to Geometry.
+* CanvasRenderer expands screen space points (workaround for antialias gaps).
+* CanvasRenderer supports TextureUVMappingMaterial.
+
+
 2010 06 05 - **r7** (22.387 kb)
 2010 06 05 - **r7** (22.387 kb)
 
 
-* Added Line Object
-* Workaround for WebKit not supporting rgba() in SVG yet
-* No need to call updateMatrix(). Use .autoUpdateMatrix = false if needed. (thx [Gregory Athons](http://github.com/gregmax17))
+* Added Line Object.
+* Workaround for WebKit not supporting rgba() in SVG yet.
+* No need to call updateMatrix(). Use .autoUpdateMatrix = false if needed. (thx [Gregory Athons](http://github.com/gregmax17)).
 
 
 
 
 2010 05 17 - **r6** (21.003 kb)
 2010 05 17 - **r6** (21.003 kb)

File diff suppressed because it is too large
+ 0 - 1
build/three.js


+ 2 - 4
examples/geometry/cube.html

@@ -84,7 +84,7 @@
 				// Plane
 				// Plane
 
 
 				plane = new THREE.Mesh(new Plane(200, 200), new THREE.ColorFillMaterial(0xe0e0e0));
 				plane = new THREE.Mesh(new Plane(200, 200), new THREE.ColorFillMaterial(0xe0e0e0));
-				plane.rotation.x = 90 * (Math.PI / 180);
+				plane.rotation.x = -90 * (Math.PI / 180);
 				scene.add(plane);
 				scene.add(plane);
 
 
 				renderer = new THREE.CanvasRenderer();
 				renderer = new THREE.CanvasRenderer();
@@ -163,9 +163,7 @@
 
 
 			function loop() {
 			function loop() {
 
 
-				cube.rotation.y += (targetRotation - cube.rotation.y) * 0.05;
-
-				plane.rotation.z = -cube.rotation.y;
+				plane.rotation.z = cube.rotation.y += (targetRotation - cube.rotation.y) * 0.05;
 
 
 				renderer.render(scene, camera);
 				renderer.render(scene, camera);
 				stats.update();
 				stats.update();

+ 53 - 18
examples/geometry/primitives/Plane.js

@@ -1,31 +1,66 @@
 /**
 /**
  * @author mr.doob / http://mrdoob.com/
  * @author mr.doob / http://mrdoob.com/
+ * based on Papervision3D's Plane.as
  */
  */
 
 
-var Plane = function (width, height) {
+var Plane = function ( width, height, segments_width, segments_height ) {
 
 
-	THREE.Geometry.call(this);
+	THREE.Geometry.call( this );
 
 
 	var scope = this,
 	var scope = this,
 	width_half = width / 2,
 	width_half = width / 2,
-	height_half = height / 2;
-		
-	v( -width_half,  height_half, 0 );
-	v(  width_half,  height_half, 0 );
-	v(  width_half, -height_half, 0 );
-	v( -width_half, -height_half, 0 );
-		
-	f4( 0, 1, 2, 3 );
-	
-	function v(x, y, z) {
-	
-		scope.vertices.push( new THREE.Vertex( new THREE.Vector3( x, y, z ) ) );
+	height_half = height / 2,
+	gridX = segments_width || 1,
+	gridY = segments_height || 1,
+	gridX1 = gridX + 1,
+	gridY1 = gridY + 1,
+	segment_width = width / gridX,
+	segment_height = height / gridY;
+
+
+	for(var iy = 0; iy < gridY1; iy++) {
+
+		for( var ix = 0; ix < gridX1; ix++ ) {
+
+			var x = ix * segment_width - width_half;
+			var y = iy * segment_height - height_half;
+
+			this.vertices.push( new THREE.Vertex( new THREE.Vector3( x, -y, 0 ) ) );
+
+		}
+
+	}
+
+	for(  iy = 0; iy < gridY; iy++ ) {
+
+		for( ix = 0; ix < gridX; ix++ ) {
+
+			var a = ix + gridX1 * iy;
+			var b = ix + gridX1 * ( iy + 1 );
+			var c = ( ix + 1 ) + gridX1 * iy;
+
+			this.faces.push( new THREE.Face3( a, b, c ) );
+			this.uvs.push( [
+						new THREE.Vector2( ix / gridX, iy / gridY ),
+						new THREE.Vector2( ix / gridX, ( iy + 1 ) / gridY ),
+						new THREE.Vector2( ( ix + 1 ) / gridX, iy / gridY )
+					] );
+
+			a = ( ix + 1 ) + gridX1 * ( iy + 1 );
+			b = ( ix + 1 ) + gridX1 * iy;
+			c = ix + gridX1 * ( iy + 1 );
+
+			this.faces.push( new THREE.Face3( a, b, c ) );
+			this.uvs.push( [
+						new THREE.Vector2( ( ix + 1 ) / gridX, ( iy + 1 ) / gridY ),
+						new THREE.Vector2( ( ix + 1 ) / gridX, iy / gridY ),
+						new THREE.Vector2( ix / gridX, ( iy + 1 ) / gridY )
+					] );
+
+		}
+
 	}
 	}
 
 
-	function f4(a, b, c, d) {
-	
-		scope.faces.push( new THREE.Face4(a, b, c, d) );
-	}	
 }
 }
 
 
 Plane.prototype = new THREE.Geometry();
 Plane.prototype = new THREE.Geometry();

+ 6 - 6
src/core/Color.js

@@ -2,14 +2,14 @@
  * @author mr.doob / http://mrdoob.com/
  * @author mr.doob / http://mrdoob.com/
  */
  */
 
 
-THREE.Color = function (hex) {
+THREE.Color = function ( hex ) {
 
 
 	var _r, _g, _b, _a, _hex;
 	var _r, _g, _b, _a, _hex;
 
 
 	this.__styleString;
 	this.__styleString;
 	this.__svgStyleString; // Workaround for WebKit :(
 	this.__svgStyleString; // Workaround for WebKit :(
 
 
-	this.setHex = function (hex) {
+	this.setHex = function ( hex ) {
 
 
 		_hex = hex;
 		_hex = hex;
 		this.updateRGBA();
 		this.updateRGBA();
@@ -17,7 +17,7 @@ THREE.Color = function (hex) {
 
 
 	}
 	}
 
 
-	this.setRGBA = function (r, g, b, a) {
+	this.setRGBA = function ( r, g, b, a ) {
 
 
 		_r = r;
 		_r = r;
 		_g = g;
 		_g = g;
@@ -46,8 +46,8 @@ THREE.Color = function (hex) {
 
 
 	this.updateStyleString = function () {
 	this.updateStyleString = function () {
 
 
-		this.__styleString = 'rgba(' + _r + ',' + _g + ',' + _b + ',' + (_a / 255) + ')';
-		this.__svgStyleString = 'rgb(' + _r + ',' + _g + ',' + _b + '); opacity: '+(_a / 255);
+		this.__styleString = 'rgba(' + _r + ',' + _g + ',' + _b + ',' + ( _a / 255 ) + ')';
+		this.__svgStyleString = 'rgb(' + _r + ',' + _g + ',' + _b + '); opacity: ' + ( _a / 255 );
 
 
 	}
 	}
 
 
@@ -57,6 +57,6 @@ THREE.Color = function (hex) {
 
 
 	}
 	}
 
 
-	this.setHex(hex);
+	this.setHex( hex );
 
 
 }
 }

+ 6 - 5
src/core/Face3.js

@@ -2,20 +2,21 @@
  * @author mr.doob / http://mrdoob.com/
  * @author mr.doob / http://mrdoob.com/
  */
  */
 
 
-THREE.Face3 = function (a, b, c, uv, normal, color) {
+THREE.Face3 = function ( a, b, c, normal, color ) {
 
 
 	this.a = a;
 	this.a = a;
 	this.b = b;
 	this.b = b;
 	this.c = c;
 	this.c = c;
-	
+
 	this.normal = normal || new THREE.Vector3();
 	this.normal = normal || new THREE.Vector3();
 	this.screen = new THREE.Vector3();
 	this.screen = new THREE.Vector3();
-	
-	this.uv = uv || [ [0,0], [0,0], [0,0] ];
+
 	this.color = color || new THREE.Color();
 	this.color = color || new THREE.Color();
 
 
 	this.toString = function () {
 	this.toString = function () {
-	
+
 		return 'THREE.Face3 ( ' + this.a + ', ' + this.b + ', ' + this.c + ' )';
 		return 'THREE.Face3 ( ' + this.a + ', ' + this.b + ', ' + this.c + ' )';
+
 	}
 	}
+
 }
 }

+ 6 - 5
src/core/Face4.js

@@ -2,21 +2,22 @@
  * @author mr.doob / http://mrdoob.com/
  * @author mr.doob / http://mrdoob.com/
  */
  */
 
 
-THREE.Face4 = function (a, b, c, d, uv, normal, color) {
+THREE.Face4 = function ( a, b, c, d, normal, color ) {
 
 
 	this.a = a;
 	this.a = a;
 	this.b = b;
 	this.b = b;
 	this.c = c;
 	this.c = c;
 	this.d = d;
 	this.d = d;
-	
+
 	this.normal = normal || new THREE.Vector3();
 	this.normal = normal || new THREE.Vector3();
 	this.screen = new THREE.Vector3();
 	this.screen = new THREE.Vector3();
-	
-	this.uv = uv || [ [0,0], [0,0], [0,0], [0, 0] ];
+
 	this.color = color || new THREE.Color();
 	this.color = color || new THREE.Color();
 
 
 	this.toString = function () {
 	this.toString = function () {
-	
+
 		return 'THREE.Face4 ( ' + this.a + ', ' + this.b + ', ' + this.c + ' ' + this.d + ' )';
 		return 'THREE.Face4 ( ' + this.a + ', ' + this.b + ', ' + this.c + ' ' + this.d + ' )';
+
 	}
 	}
+
 }
 }

+ 32 - 27
src/core/Geometry.js

@@ -7,47 +7,52 @@ THREE.Geometry = function () {
 
 
 	this.vertices = [];
 	this.vertices = [];
 	this.faces = [];
 	this.faces = [];
+	this.uvs = [];
 
 
 	this.computeNormals = function () {
 	this.computeNormals = function () {
-	
+
 		var v, f, vA, vB, vC, cb, ab, normal;
 		var v, f, vA, vB, vC, cb, ab, normal;
-	
-		for(v = 0; v < this.vertices.length; v++) {
-		
+
+		for( v = 0; v < this.vertices.length; v++ ) {
+
 			this.vertices[v].normal.set(0,0,0);
 			this.vertices[v].normal.set(0,0,0);
+
 		}
 		}
-	
-		for(f = 0; f < this.faces.length; f++) {
-		
-			vA = this.vertices[this.faces[f].a],
-			vB = this.vertices[this.faces[f].b],
-			vC = this.vertices[this.faces[f].c],
-			
+
+		for( f = 0; f < this.faces.length; f++ ) {
+
+			vA = this.vertices[ this.faces[f].a ],
+			vB = this.vertices[ this.faces[f].b ],
+			vC = this.vertices[ this.faces[f].c ],
+
 			cb = new THREE.Vector3(),
 			cb = new THREE.Vector3(),
 			ab = new THREE.Vector3(),
 			ab = new THREE.Vector3(),
 			normal = new THREE.Vector3();
 			normal = new THREE.Vector3();
-			
+
 			cb.sub(vC.position,vB.position);
 			cb.sub(vC.position,vB.position);
 			ab.sub(vA.position,vB.position);
 			ab.sub(vA.position,vB.position);
 			cb.cross(ab);
 			cb.cross(ab);
-			
-			if (!cb.isZero()) {
-			
+
+			if ( !cb.isZero() ) {
+
 				cb.normalize();
 				cb.normalize();
-				
+
 			}
 			}
-				
-			this.faces[f].normal=cb;
-
-			vA.normal.addSelf(normal);
-			vB.normal.addSelf(normal);
-			vC.normal.addSelf(normal);
-			
-			if (this.faces[f] instanceof THREE.Face4) {
-			
-				this.vertices[this.faces[f].d].normal.addSelf(normal);
-				
+
+			this.faces[f].normal = cb;
+
+			vA.normal.addSelf( normal );
+			vB.normal.addSelf( normal );
+			vC.normal.addSelf( normal );
+
+			if ( this.faces[f] instanceof THREE.Face4 ) {
+
+				this.vertices[ this.faces[f].d ].normal.addSelf( normal );
+
 			}
 			}
+
 		}
 		}
+
 	}
 	}
+
 }
 }

+ 23 - 16
src/core/Matrix3.js

@@ -8,23 +8,25 @@ THREE.Matrix3 = function () {
 	this.n11 = 1; this.n12 = 0; this.n13 = 0;
 	this.n11 = 1; this.n12 = 0; this.n13 = 0;
 	this.n21 = 0; this.n22 = 1; this.n23 = 0;
 	this.n21 = 0; this.n22 = 1; this.n23 = 0;
 	this.n31 = 0; this.n32 = 0; this.n33 = 1;
 	this.n31 = 0; this.n32 = 0; this.n33 = 1;
-	
+
 	this.identity = function () {
 	this.identity = function () {
-	
+
 		this.n11 = 1; this.n12 = 0; this.n13 = 0;
 		this.n11 = 1; this.n12 = 0; this.n13 = 0;
 		this.n21 = 0; this.n22 = 1; this.n23 = 0;
 		this.n21 = 0; this.n22 = 1; this.n23 = 0;
 		this.n31 = 0; this.n32 = 0; this.n33 = 1;
 		this.n31 = 0; this.n32 = 0; this.n33 = 1;
+
 	}
 	}
 
 
-	this.assign = function (m) {
-	
+	this.assign = function ( m ) {
+
 		this.n11 = m.n11; this.n12 = m.n12; this.n13 = m.n13;
 		this.n11 = m.n11; this.n12 = m.n12; this.n13 = m.n13;
 		this.n21 = m.n21; this.n22 = m.n22; this.n23 = m.n23;
 		this.n21 = m.n21; this.n22 = m.n22; this.n23 = m.n23;
 		this.n31 = m.n31; this.n32 = m.n32; this.n33 = m.n33;
 		this.n31 = m.n31; this.n32 = m.n32; this.n33 = m.n33;
+
 	}
 	}
 
 
-	this.multiplySelf = function (m) {
-	
+	this.multiplySelf = function ( m ) {
+
 		var n11 = this.n11, n12 = this.n12, n13 = this.n13, n14 = this.n14;
 		var n11 = this.n11, n12 = this.n12, n13 = this.n13, n14 = this.n14;
 		var n21 = this.n21, n22 = this.n22, n23 = this.n23, n24 = this.n24;
 		var n21 = this.n21, n22 = this.n22, n23 = this.n23, n24 = this.n24;
 		var n31 = this.n31, n32 = this.n32, n33 = this.n33, n34 = this.n34;
 		var n31 = this.n31, n32 = this.n32, n33 = this.n33, n34 = this.n34;
@@ -40,10 +42,11 @@ THREE.Matrix3 = function () {
 		this.n31 = n31 * m.n11 + n32 * m.n21 + n33 * m.n31;
 		this.n31 = n31 * m.n11 + n32 * m.n21 + n33 * m.n31;
 		this.n32 = n31 * m.n12 + n32 * m.n22 + n33 * m.n32;
 		this.n32 = n31 * m.n12 + n32 * m.n22 + n33 * m.n32;
 		this.n33 = n31 * m.n13 + n32 * m.n23 + n33 * m.n33;
 		this.n33 = n31 * m.n13 + n32 * m.n23 + n33 * m.n33;
+
 	}
 	}
 
 
 	this.inverse = function () {
 	this.inverse = function () {
-	
+
 		var n11 = this.n11, n12 = this.n12, n13 = this.n13, n14 = this.n14;
 		var n11 = this.n11, n12 = this.n12, n13 = this.n13, n14 = this.n14;
 		var n21 = this.n21, n22 = this.n22, n23 = this.n23, n24 = this.n24;
 		var n21 = this.n21, n22 = this.n22, n23 = this.n23, n24 = this.n24;
 		var n31 = this.n31, n32 = this.n32, n33 = this.n33, n34 = this.n34;
 		var n31 = this.n31, n32 = this.n32, n33 = this.n33, n34 = this.n34;
@@ -51,23 +54,27 @@ THREE.Matrix3 = function () {
 		this.n11 = n11; this.n12 = n21; this.n13 = n31;
 		this.n11 = n11; this.n12 = n21; this.n13 = n31;
 		this.n21 = n12; this.n22 = n22; this.n23 = n32;
 		this.n21 = n12; this.n22 = n22; this.n23 = n32;
 		this.n31 = n13; this.n32 = n23; this.n33 = n33;
 		this.n31 = n13; this.n32 = n23; this.n33 = n33;
+
 	}
 	}
 
 
 	this.clone = function () {
 	this.clone = function () {
-	
+
 		var m = new THREE.Matrix3();
 		var m = new THREE.Matrix3();
-		
+
 		m.n11 = this.n11; m.n12 = this.n12; m.n13 = this.n13;
 		m.n11 = this.n11; m.n12 = this.n12; m.n13 = this.n13;
 		m.n21 = this.n21; m.n22 = this.n22; m.n23 = this.n23;
 		m.n21 = this.n21; m.n22 = this.n22; m.n23 = this.n23;
 		m.n31 = this.n31; m.n32 = this.n32; m.n33 = this.n33;
 		m.n31 = this.n31; m.n32 = this.n32; m.n33 = this.n33;
-		
+
 		return m;
 		return m;
+
 	}
 	}
-    
+
 	this.toString = function () {
 	this.toString = function () {
-	
-        	return "| " + this.n11 + " " + this.n12 + " " + this.n13 + " |\n" +
-                        "| " + this.n21 + " " + this.n22 + " " + this.n23 + " |\n" +
-                        "| " + this.n31 + " " + this.n32 + " " + this.n33 + " |";
- 	}
+
+		return "| " + this.n11 + " " + this.n12 + " " + this.n13 + " |\n" +
+			"| " + this.n21 + " " + this.n22 + " " + this.n23 + " |\n" +
+			"| " + this.n31 + " " + this.n32 + " " + this.n33 + " |";
+
+	}
+
 }
 }

+ 80 - 66
src/core/Matrix4.js

@@ -15,80 +15,82 @@ THREE.Matrix4 = function () {
 	this.n21 = 0; this.n22 = 1; this.n23 = 0; this.n24 = 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.n31 = 0; this.n32 = 0; this.n33 = 1; this.n34 = 0;
 	this.n41 = 0; this.n42 = 0; this.n43 = 0; this.n44 = 1;
 	this.n41 = 0; this.n42 = 0; this.n43 = 0; this.n44 = 1;
-	
+
 	this.identity = function () {
 	this.identity = function () {
-	
+
 		this.n11 = 1; this.n12 = 0; this.n13 = 0; this.n14 = 0;
 		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.n21 = 0; this.n22 = 1; this.n23 = 0; this.n24 = 0;
 		this.n31 = 0; this.n32 = 0; this.n33 = 1; this.n34 = 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.n41 = 0; this.n42 = 0; this.n43 = 0; this.n44 = 1;
 	}
 	}
-    
-	this.lookAt = function (eye, center, up) {
-	
-		z.sub(center, eye);
+
+	this.lookAt = function ( eye, center, up ) {
+
+		z.sub( center, eye );
 		z.normalize();
 		z.normalize();
 
 
-		x.copy(z);
-		x.crossSelf(up);
+		x.copy( z );
+		x.crossSelf( up );
 		x.normalize();
 		x.normalize();
 
 
-		y.copy(x);
-		y.crossSelf(z);
+		y.copy( x );
+		y.crossSelf( z );
 		y.normalize();
 		y.normalize();
 		y.negate(); //
 		y.negate(); //
 
 
 		this.n11 = x.x;
 		this.n11 = x.x;
 		this.n12 = x.y;
 		this.n12 = x.y;
 		this.n13 = x.z;
 		this.n13 = x.z;
-		this.n14 = -x.dot(eye);
+		this.n14 = - x.dot( eye );
 		this.n21 = y.x;
 		this.n21 = y.x;
 		this.n22 = y.y;
 		this.n22 = y.y;
 		this.n23 = y.z;
 		this.n23 = y.z;
-		this.n24 = -y.dot(eye);
+		this.n24 = - y.dot( eye );
 		this.n31 = z.x;
 		this.n31 = z.x;
 		this.n32 = z.y;
 		this.n32 = z.y;
 		this.n33 = z.z;
 		this.n33 = z.z;
-		this.n34 = -z.dot(eye);
+		this.n34 = - z.dot( eye );
 	}
 	}
 
 
-	this.transform = function (v) {
-	
-        	var vx = v.x, vy = v.y, vz = v.z, vw = (v.w ? v.w : 1.0);
-        
+	this.transform = function ( v ) {
+
+        	var vx = v.x, vy = v.y, vz = v.z, vw = ( v.w ? v.w : 1.0 );
+
 		v.x = this.n11 * vx + this.n12 * vy + this.n13 * vz + this.n14 * vw;
 		v.x = this.n11 * vx + this.n12 * vy + this.n13 * vz + this.n14 * vw;
 		v.y = this.n21 * vx + this.n22 * vy + this.n23 * vz + this.n24 * vw;
 		v.y = this.n21 * vx + this.n22 * vy + this.n23 * vz + this.n24 * vw;
 		v.z = this.n31 * vx + this.n32 * vy + this.n33 * vz + this.n34 * vw;
 		v.z = this.n31 * vx + this.n32 * vy + this.n33 * vz + this.n34 * vw;
 
 
 		vw = this.n41 * vx + this.n42 * vy + this.n43 * vz + this.n44 * vw;
 		vw = this.n41 * vx + this.n42 * vy + this.n43 * vz + this.n44 * vw;
 
 
-		if(v.w) {
-		
+		if( v.w ) {
+
 			v.w = vw;
 			v.w = vw;
-			
+
 		} else {
 		} else {
-		
+
 			v.x = v.x / vw;
 			v.x = v.x / vw;
 			v.y = v.y / vw;
 			v.y = v.y / vw;
 			v.z = v.z / vw;
 			v.z = v.z / vw;
+
 		}
 		}
 	}
 	}
-	
-	this.crossVector = function (a) {
-	
+
+	this.crossVector = function ( a ) {
+
 		var v = new THREE.Vector4();
 		var v = new THREE.Vector4();
-		
+
 		v.x = this.n11 * a.x + this.n12 * a.y + this.n13 * a.z + this.n14 * a.w;
 		v.x = this.n11 * a.x + this.n12 * a.y + this.n13 * a.z + this.n14 * a.w;
 		v.y = this.n21 * a.x + this.n22 * a.y + this.n23 * a.z + this.n24 * a.w;
 		v.y = this.n21 * a.x + this.n22 * a.y + this.n23 * a.z + this.n24 * a.w;
 		v.z = this.n31 * a.x + this.n32 * a.y + this.n33 * a.z + this.n34 * a.w;
 		v.z = this.n31 * a.x + this.n32 * a.y + this.n33 * a.z + this.n34 * a.w;
-		
-		v.w = (a.w) ? this.n41 * a.x + this.n42 * a.y + this.n43 * a.z + this.n44 * a.w : 1;
-		
+
+		v.w = ( a.w ) ? this.n41 * a.x + this.n42 * a.y + this.n43 * a.z + this.n44 * a.w : 1;
+
 		return v;
 		return v;
+
 	}
 	}
 
 
-	this.multiply = function (a, b) {
-	
+	this.multiply = function ( a, b ) {
+
 		this.n11 = a.n11 * b.n11 + a.n12 * b.n21 + a.n13 * b.n31 + a.n14 * b.n41;
 		this.n11 = a.n11 * b.n11 + a.n12 * b.n21 + a.n13 * b.n31 + a.n14 * b.n41;
 		this.n12 = a.n11 * b.n12 + a.n12 * b.n22 + a.n13 * b.n32 + a.n14 * b.n42;
 		this.n12 = a.n11 * b.n12 + a.n12 * b.n22 + a.n13 * b.n32 + a.n14 * b.n42;
 		this.n13 = a.n11 * b.n13 + a.n12 * b.n23 + a.n13 * b.n33 + a.n14 * b.n43;
 		this.n13 = a.n11 * b.n13 + a.n12 * b.n23 + a.n13 * b.n33 + a.n14 * b.n43;
@@ -108,10 +110,11 @@ THREE.Matrix4 = function () {
 		this.n42 = a.n41 * b.n12 + a.n42 * b.n22 + a.n43 * b.n32 + a.n44 * b.n42;
 		this.n42 = a.n41 * b.n12 + a.n42 * b.n22 + a.n43 * b.n32 + a.n44 * b.n42;
 		this.n43 = a.n41 * b.n13 + a.n42 * b.n23 + a.n43 * b.n33 + a.n44 * b.n43;
 		this.n43 = a.n41 * b.n13 + a.n42 * b.n23 + a.n43 * b.n33 + a.n44 * b.n43;
 		this.n44 = a.n41 * b.n14 + a.n42 * b.n24 + a.n43 * b.n34 + a.n44 * b.n44;
 		this.n44 = a.n41 * b.n14 + a.n42 * b.n24 + a.n43 * b.n34 + a.n44 * b.n44;
+
 	}
 	}
 
 
-	this.multiplySelf = function (m) {
-	
+	this.multiplySelf = function ( m ) {
+
 		var n11 = this.n11, n12 = this.n12, n13 = this.n13, n14 = this.n14,
 		var n11 = this.n11, n12 = this.n12, n13 = this.n13, n14 = this.n14,
 		n21 = this.n21, n22 = this.n22, n23 = this.n23, n24 = this.n24,
 		n21 = this.n21, n22 = this.n22, n23 = this.n23, n24 = this.n24,
 		n31 = this.n31, n32 = this.n32, n33 = this.n33, n34 = this.n34,
 		n31 = this.n31, n32 = this.n32, n33 = this.n33, n34 = this.n34,
@@ -136,28 +139,32 @@ THREE.Matrix4 = function () {
 		this.n42 = n41 * m.n12 + n42 * m.n22 + n43 * m.n32 + n44 * m.n42;
 		this.n42 = n41 * m.n12 + n42 * m.n22 + n43 * m.n32 + n44 * m.n42;
 		this.n43 = n41 * m.n13 + n42 * m.n23 + n43 * m.n33 + n44 * m.n43;
 		this.n43 = n41 * m.n13 + n42 * m.n23 + n43 * m.n33 + n44 * m.n43;
 		this.n44 = n41 * m.n14 + n42 * m.n24 + n43 * m.n34 + n44 * m.n44;
 		this.n44 = n41 * m.n14 + n42 * m.n24 + n43 * m.n34 + n44 * m.n44;
+
 	}
 	}
 
 
 	this.clone = function () {
 	this.clone = function () {
-	
+
 		var m = new THREE.Matrix4();
 		var m = new THREE.Matrix4();
 		m.n11 = this.n11; m.n12 = this.n12; m.n13 = this.n13; m.n14 = this.n14;
 		m.n11 = this.n11; m.n12 = this.n12; m.n13 = this.n13; m.n14 = this.n14;
 		m.n21 = this.n21; m.n22 = this.n22; m.n23 = this.n23; m.n24 = this.n24;
 		m.n21 = this.n21; m.n22 = this.n22; m.n23 = this.n23; m.n24 = this.n24;
 		m.n31 = this.n31; m.n32 = this.n32; m.n33 = this.n33; m.n34 = this.n34;
 		m.n31 = this.n31; m.n32 = this.n32; m.n33 = this.n33; m.n34 = this.n34;
 		m.n41 = this.n41; m.n42 = this.n42; m.n43 = this.n43; m.n44 = this.n44;
 		m.n41 = this.n41; m.n42 = this.n42; m.n43 = this.n43; m.n44 = this.n44;
 		return m;
 		return m;
+
 	}
 	}
-    
+
 	this.toString = function() {
 	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 + " |";
+
+		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 (x, y, z) {
+THREE.Matrix4.translationMatrix = function ( x, y, z ) {
 
 
 	var m = new THREE.Matrix4();
 	var m = new THREE.Matrix4();
 
 
@@ -166,9 +173,10 @@ THREE.Matrix4.translationMatrix = function (x, y, z) {
 	m.n34 = z;
 	m.n34 = z;
 
 
 	return m;
 	return m;
+
 }
 }
 
 
-THREE.Matrix4.scaleMatrix = function (x, y, z) {
+THREE.Matrix4.scaleMatrix = function ( x, y, z ) {
 
 
 	var m = new THREE.Matrix4();
 	var m = new THREE.Matrix4();
 
 
@@ -177,66 +185,72 @@ THREE.Matrix4.scaleMatrix = function (x, y, z) {
 	m.n33 = z;
 	m.n33 = z;
 
 
 	return m;
 	return m;
+
 }
 }
 
 
-THREE.Matrix4.rotationXMatrix = function (theta) {
+THREE.Matrix4.rotationXMatrix = function ( theta ) {
 
 
 	var rot = new THREE.Matrix4();
 	var rot = new THREE.Matrix4();
 
 
-	rot.n22 = rot.n33 = Math.cos(theta);
-	rot.n32 = Math.sin(theta);
-	rot.n23 = -rot.n32;
+	rot.n22 = rot.n33 = Math.cos( theta );
+	rot.n32 = Math.sin( theta );
+	rot.n23 = - rot.n32;
 
 
 	return rot;
 	return rot;
+
 }
 }
 
 
-THREE.Matrix4.rotationYMatrix = function (theta) {
+THREE.Matrix4.rotationYMatrix = function ( theta ) {
 
 
 	var rot = new THREE.Matrix4();
 	var rot = new THREE.Matrix4();
 
 
-	rot.n11 = rot.n33 = Math.cos(theta);
-	rot.n13 = Math.sin(theta);
-	rot.n31 = -rot.n13;
+	rot.n11 = rot.n33 = Math.cos( theta );
+	rot.n13 = Math.sin( theta );
+	rot.n31 = - rot.n13;
 
 
 	return rot;
 	return rot;
+
 }
 }
 
 
-THREE.Matrix4.rotationZMatrix = function(theta) {
+THREE.Matrix4.rotationZMatrix = function( theta ) {
 
 
 	var rot = new THREE.Matrix4();
 	var rot = new THREE.Matrix4();
 
 
-	rot.n11 = rot.n22 = Math.cos(theta);
-	rot.n21 = Math.sin(theta);
-	rot.n12 = -rot.n21;
+	rot.n11 = rot.n22 = Math.cos( theta );
+	rot.n21 = Math.sin( theta );
+	rot.n12 = - rot.n21;
 
 
 	return rot;
 	return rot;
+
 }
 }
 
 
-THREE.Matrix4.makeFrustum = function(left,right,bottom,top,near,far) {
+THREE.Matrix4.makeFrustum = function( left, right, bottom, top, near, far ) {
 
 
 	var m = new THREE.Matrix4(),
 	var m = new THREE.Matrix4(),
 
 
-	x = 2 * near / (right - left),
-	y = 2 * near / (top - bottom),
-	a = (right + left) / (right - left),
-	b = (top + bottom) / (top - bottom),
-	c = -(far + near) / (far - near),
-	d = -2 * far * near / (far - near);
+	x = 2 * near / ( right - left ),
+	y = 2 * near / ( top - bottom ),
+	a = ( right + left ) / ( right - left ),
+	b = ( top + bottom ) / ( top - bottom ),
+	c = - ( far + near ) / ( far - near ),
+	d = - 2 * far * near / ( far - near );
 
 
 	m.n11 = x; m.n13 = a;
 	m.n11 = x; m.n13 = a;
 	m.n22 = y; m.n23 = b;
 	m.n22 = y; m.n23 = b;
 	m.n33 = c; m.n34 = d;
 	m.n33 = c; m.n34 = d;
-	m.n43 = -1; m.n44 = 0;
+	m.n43 = - 1; m.n44 = 0;
 
 
 	return m;
 	return m;
+
 }
 }
 
 
-THREE.Matrix4.makePerspective = function(fovy, aspect, near, far) {
+THREE.Matrix4.makePerspective = function( fovy, aspect, near, far ) {
 
 
-	var ymax = near * Math.tan(fovy * 0.00872664625972),
-	ymin = -ymax,
+	var ymax = near * Math.tan( fovy * 0.00872664625972 ),
+	ymin = - ymax,
 	xmin = ymin * aspect,
 	xmin = ymin * aspect,
 	xmax = ymax * aspect;
 	xmax = ymax * aspect;
-	
-	return THREE.Matrix4.makeFrustum(xmin, xmax, ymin, ymax, near, far);
+
+	return THREE.Matrix4.makeFrustum( xmin, xmax, ymin, ymax, near, far );
+
 }
 }

+ 81 - 54
src/core/Rectangle.js

@@ -2,7 +2,7 @@
  * @author mr.doob / http://mrdoob.com/
  * @author mr.doob / http://mrdoob.com/
  */
  */
 
 
-THREE.Rectangle = function (x1, y1, x2, y2) {
+THREE.Rectangle = function ( x1, y1, x2, y2 ) {
 
 
 	var _x1 = x1, _y1 = y1,
 	var _x1 = x1, _y1 = y1,
 	_x2 = x2, _y2 = y2,
 	_x2 = x2, _y2 = y2,
@@ -10,135 +10,162 @@ THREE.Rectangle = function (x1, y1, x2, y2) {
 	_isEmpty = false;
 	_isEmpty = false;
 
 
 	function resize() {
 	function resize() {
-	
+
 		_width = _x2 - _x1;
 		_width = _x2 - _x1;
 		_height = _y2 - _y1;
 		_height = _y2 - _y1;
+
 	}
 	}
 
 
 	this.getX = function () {
 	this.getX = function () {
-	
+
 		return _x1;
 		return _x1;
+
 	}
 	}
 
 
 	this.getY = function () {
 	this.getY = function () {
-	
+
 		return _y1;
 		return _y1;
+
 	}
 	}
 
 
 	this.getWidth = function () {
 	this.getWidth = function () {
-	
+
 		return _width;
 		return _width;
+
 	}
 	}
-	
+
 	this.getHeight = function () {
 	this.getHeight = function () {
-	
+
 		return _height;
 		return _height;
+
 	}
 	}
-	
+
 	this.getX1 = function() {
 	this.getX1 = function() {
-	
+
 		return _x1;
 		return _x1;
+
 	}
 	}
 
 
 	this.getY1 = function() {
 	this.getY1 = function() {
-	
+
 		return _y1;
 		return _y1;
+
 	}
 	}
 
 
 	this.getX2 = function() {
 	this.getX2 = function() {
-	
+
 		return _x2;
 		return _x2;
+
 	}
 	}
 
 
 	this.getY2 = function() {
 	this.getY2 = function() {
-	
+
 		return _y2;
 		return _y2;
+
 	}
 	}
 
 
-	this.set = function (x1, y1, x2, y2) {
-	
+	this.set = function ( x1, y1, x2, y2 ) {
+
 		_isEmpty = false;
 		_isEmpty = false;
-		
+
 		_x1 = x1; _y1 = y1;
 		_x1 = x1; _y1 = y1;
 		_x2 = x2; _y2 = y2;
 		_x2 = x2; _y2 = y2;
 
 
 		resize();
 		resize();
+
 	}
 	}
-	
-	this.addPoint = function (x, y) {
-	
-		if (_isEmpty) {
+
+	this.addPoint = function ( x, y ) {
+
+		if ( _isEmpty ) {
+
 			_isEmpty = false;
 			_isEmpty = false;
 			_x1 = x; _y1 = y;
 			_x1 = x; _y1 = y;
 			_x2 = x; _y2 = y;
 			_x2 = x; _y2 = y;
+
 		} else {
 		} else {
-			_x1 = Math.min(_x1, x);
-			_y1 = Math.min(_y1, y);
-			_x2 = Math.max(_x2, x);
-			_y2 = Math.max(_y2, y);
+
+			_x1 = Math.min( _x1, x );
+			_y1 = Math.min( _y1, y );
+			_x2 = Math.max( _x2, x );
+			_y2 = Math.max( _y2, y );
+
 		}
 		}
-		
+
 		resize();
 		resize();
+
 	}
 	}
-	
-	this.addRectangle = function (r) {
 
 
-		if (_isEmpty) {
+	this.addRectangle = function ( r ) {
+
+		if ( _isEmpty ) {
+
 			_isEmpty = false;
 			_isEmpty = false;
 			_x1 = r.getX1(); _y1 = r.getY1();
 			_x1 = r.getX1(); _y1 = r.getY1();
 			_x2 = r.getX2(); _y2 = r.getY2();
 			_x2 = r.getX2(); _y2 = r.getY2();
-		} else {	
+
+		} else {
+
 			_x1 = Math.min(_x1, r.getX1());
 			_x1 = Math.min(_x1, r.getX1());
 			_y1 = Math.min(_y1, r.getY1());
 			_y1 = Math.min(_y1, r.getY1());
 			_x2 = Math.max(_x2, r.getX2());
 			_x2 = Math.max(_x2, r.getX2());
 			_y2 = Math.max(_y2, r.getY2());
 			_y2 = Math.max(_y2, r.getY2());
+
 		}
 		}
-		
+
 		resize();
 		resize();
+
 	}
 	}
-	
-	this.inflate = function (v) {
-	
+
+	this.inflate = function ( v ) {
+
 		_x1 -= v; _y1 -= v;
 		_x1 -= v; _y1 -= v;
 		_x2 += v; _y2 += v;
 		_x2 += v; _y2 += v;
-		
+
 		resize();
 		resize();
+
+	}
+
+	this.minSelf = function( r ) {
+
+		_x1 = Math.max( _x1, r.getX1() );
+		_y1 = Math.max( _y1, r.getY1() );
+		_x2 = Math.min( _x2, r.getX2() );
+		_y2 = Math.min( _y2, r.getY2() );
+
+		resize();
+
 	}
 	}
 
 
-	this.minSelf = function(r) {
-	
-		_x1 = Math.max(_x1, r.getX1());
-		_y1 = Math.max(_y1, r.getY1());
-		_x2 = Math.min(_x2, r.getX2());
-		_y2 = Math.min(_y2, r.getY2());
-		
-		resize();		
-	}	
-	
 	/*
 	/*
 	this.containsPoint = function (x, y) {
 	this.containsPoint = function (x, y) {
-	
+
 		return x > _x1 && x < _x2 && y > _y1 && y < _y2;
 		return x > _x1 && x < _x2 && y > _y1 && y < _y2;
+
 	}
 	}
 	*/
 	*/
-	
-	this.instersects = function (r) {
-	
-		return Math.min(_x2, r.getX2()) - Math.max(_x1, r.getX1()) > 0 && Math.min(_y2, r.getY2()) - Math.max(_y1, r.getY1()) > 0;
+
+	this.instersects = function ( r ) {
+
+		return Math.min( _x2, r.getX2() ) - Math.max( _x1, r.getX1() ) > 0 && Math.min( _y2, r.getY2() ) - Math.max( _y1, r.getY1() ) > 0;
+
 	}
 	}
-	
+
 	this.empty = function () {
 	this.empty = function () {
-	
-		_isEmpty = true;	
-	
+
+		_isEmpty = true;
+
 		_x1 = 0; _y1 = 0;
 		_x1 = 0; _y1 = 0;
 		_x2 = 0, _y2 = 0;
 		_x2 = 0, _y2 = 0;
 
 
 		resize();
 		resize();
+
 	}
 	}
-	
+
 	this.toString = function () {
 	this.toString = function () {
-	
+
 		return "THREE.Rectangle (x1: " + _x1 + ", y1: " + _y2 + ", x2: " + _x2 + ", y1: " + _y1 + ", width: " + _width + ", height: " + _height + ")";
 		return "THREE.Rectangle (x1: " + _x1 + ", y1: " + _y2 + ", x2: " + _x2 + ", y1: " + _y1 + ", width: " + _width + ", height: " + _height + ")";
+
 	}
 	}
+
 }
 }

+ 51 - 45
src/core/Vector2.js

@@ -2,88 +2,94 @@
  * @author mr.doob / http://mrdoob.com/
  * @author mr.doob / http://mrdoob.com/
  */
  */
 
 
-THREE.Vector2 = function (x, y) {
-	
+THREE.Vector2 = function ( x, y ) {
+
 	this.x = x || 0;
 	this.x = x || 0;
 	this.y = y || 0;
 	this.y = y || 0;
-	
-	this.set = function (x, y) {
-	
+
+	this.set = function ( x, y ) {
+
 		this.x = x;
 		this.x = x;
 		this.y = y;
 		this.y = y;
-	}	
-	
-	this.copy = function (v) {
-	
+
+	}
+
+	this.copy = function ( v ) {
+
 		this.x = v.x;
 		this.x = v.x;
 		this.y = v.y;
 		this.y = v.y;
+
 	}
 	}
-	
-	this.addSelf = function (v) {
-	
+
+	this.addSelf = function ( v ) {
+
 		this.x += v.x;
 		this.x += v.x;
 		this.y += v.y;
 		this.y += v.y;
+
 	}
 	}
 
 
-	this.add = function (v1, v2) {
-	
+	this.add = function ( v1, v2 ) {
+
 		this.x = v1.x + v2.x;
 		this.x = v1.x + v2.x;
 		this.y = v1.y + v2.y;
 		this.y = v1.y + v2.y;
+
 	}
 	}
-	
-	this.subSelf = function (v) {
-	
+
+	this.subSelf = function ( v ) {
+
 		this.x -= v.x;
 		this.x -= v.x;
 		this.y -= v.y;
 		this.y -= v.y;
+
 	}
 	}
 
 
-	this.sub = function (v1, v2) {
-	
+	this.sub = function ( v1, v2 ) {
+
 		this.x = v1.x - v2.x;
 		this.x = v1.x - v2.x;
 		this.y = v1.y - v2.y;
 		this.y = v1.y - v2.y;
+
 	}
 	}
-	
-	this.multiplyScalar = function (s) {
-	
+
+	this.multiplyScalar = function ( s ) {
+
 		this.x *= s;
 		this.x *= s;
 		this.y *= s;
 		this.y *= s;
+
 	}
 	}
-	
+
 	this.unit = function () {
 	this.unit = function () {
-	
-		this.multiply(1 / this.length());
-	}
-	
-	this.expand = function(v1, v2) {
-	
-		this.unit( this.sub(v2, v1) );
-		v2.addSelf(this);
-		// v1.subSelf(this);
+
+		this.multiplyScalar( 1 / this.length() );
+
 	}
 	}
 
 
 	this.length = function () {
 	this.length = function () {
-	
-		return Math.sqrt(this.x * this.x + this.y * this.y);
+
+		return Math.sqrt( this.x * this.x + this.y * this.y );
+
 	}
 	}
-	
+
 	this.lengthSq = function () {
 	this.lengthSq = function () {
-	
+
 		return this.x * this.x + this.y * this.y;
 		return this.x * this.x + this.y * this.y;
+
 	}
 	}
-	
+
 	this.negate = function() {
 	this.negate = function() {
-	
-		this.x = -this.x;
-		this.y = -this.y;
+
+		this.x = - this.x;
+		this.y = - this.y;
+
 	}
 	}
-	
+
 	this.clone = function () {
 	this.clone = function () {
-	
-		return new THREE.Vector2(this.x, this.y);
+
+		return new THREE.Vector2( this.x, this.y );
+
 	}
 	}
-	
+
 	this.toString = function () {
 	this.toString = function () {
-	
+
 		return 'THREE.Vector2 (' + this.x + ', ' + this.y + ')';
 		return 'THREE.Vector2 (' + this.x + ', ' + this.y + ')';
+
 	}
 	}
 }
 }

+ 78 - 67
src/core/Vector3.js

@@ -3,143 +3,154 @@
  * @author mr.doob / http://mrdoob.com/
  * @author mr.doob / http://mrdoob.com/
  */
  */
 
 
-THREE.Vector3 = function (x, y, z) {
+THREE.Vector3 = function ( x, y, z ) {
 
 
 	this.x = x || 0;
 	this.x = x || 0;
 	this.y = y || 0;
 	this.y = y || 0;
 	this.z = z || 0;
 	this.z = z || 0;
 
 
-	this.set = function (x, y, z) {
-	
+	this.set = function ( x, y, z ) {
+
 		this.x = x;
 		this.x = x;
 		this.y = y;
 		this.y = y;
 		this.z = z;
 		this.z = z;
+
 	}
 	}
 
 
-	this.copy = function (v) {
-	
+	this.copy = function ( v ) {
+
 		this.x = v.x;
 		this.x = v.x;
 		this.y = v.y;
 		this.y = v.y;
 		this.z = v.z;
 		this.z = v.z;
+
 	}
 	}
 
 
-	this.add = function(v1, v2) {
-	
+	this.add = function( v1, v2 ) {
+
 		this.x = v1.x + v2.x;
 		this.x = v1.x + v2.x;
 		this.y = v1.y + v2.y;
 		this.y = v1.y + v2.y;
-		this.z = v1.z + v2.z;	
+		this.z = v1.z + v2.z;
+
 	}
 	}
 
 
-	this.addSelf = function (v) {
-	
+	this.addSelf = function ( v ) {
+
 		this.x += v.x;
 		this.x += v.x;
 		this.y += v.y;
 		this.y += v.y;
 		this.z += v.z;
 		this.z += v.z;
+
 	}
 	}
-	
-	this.addScalar = function (s) {
-	
+
+	this.addScalar = function ( s ) {
+
 		this.x += s;
 		this.x += s;
 		this.y += s;
 		this.y += s;
 		this.z += s;
 		this.z += s;
-	}	
 
 
-	this.sub = function(v1, v2) {
-	
+	}
+
+	this.sub = function( v1, v2 ) {
+
 		this.x = v1.x - v2.x;
 		this.x = v1.x - v2.x;
 		this.y = v1.y - v2.y;
 		this.y = v1.y - v2.y;
-		this.z = v1.z - v2.z;	
+		this.z = v1.z - v2.z;
+
 	}
 	}
-	
-	this.subSelf = function (v) {
-	
+
+	this.subSelf = function ( v ) {
+
 		this.x -= v.x;
 		this.x -= v.x;
 		this.y -= v.y;
 		this.y -= v.y;
 		this.z -= v.z;
 		this.z -= v.z;
+
 	}
 	}
-	
-	this.crossSelf = function (v) {
-	
+
+	this.crossSelf = function ( v ) {
+
 		var tx = this.x, ty = this.y, tz = this.z;
 		var tx = this.x, ty = this.y, tz = this.z;
-		
+
 		this.x = ty * v.z - tz * v.y;
 		this.x = ty * v.z - tz * v.y;
 		this.y = tz * v.x - tx * v.z;
 		this.y = tz * v.x - tx * v.z;
 		this.z = tx * v.y - ty * v.x;
 		this.z = tx * v.y - ty * v.x;
+
 	}
 	}
-	
-	this.multiplySelf = function (v) {
-	
+
+	this.multiplySelf = function ( v ) {
+
 		this.x *= v.x;
 		this.x *= v.x;
 		this.y *= v.y;
 		this.y *= v.y;
 		this.z *= v.z;
 		this.z *= v.z;
-	}	
-	
-	this.multiplyScalar = function (s) {
-	
+	}
+
+	this.multiplyScalar = function ( s ) {
+
 		this.x *= s;
 		this.x *= s;
 		this.y *= s;
 		this.y *= s;
 		this.z *= s;
 		this.z *= s;
+
 	}
 	}
-	
-	this.dot = function (v) {
-	
+
+	this.dot = function ( v ) {
+
 		return this.x * v.x + this.y * v.y + this.z * v.z;
 		return this.x * v.x + this.y * v.y + this.z * v.z;
+
 	}
 	}
-	
-	this.distanceTo = function (v) {
-	
-		var dx = this.x - v.x, dy = this.y - v.y, dz = this.z - v.z;
-		return Math.sqrt(dx * dx + dy * dy + dz * dz);
+
+	this.distanceTo = function ( v ) {
+
+		return Math.sqrt( this.distanceToSquared( v ) );
+
 	}
 	}
-	
-	this.distanceToSquared = function (v) {
-	
+
+	this.distanceToSquared = function ( v ) {
+
 		var dx = this.x - v.x, dy = this.y - v.y, dz = this.z - v.z;
 		var dx = this.x - v.x, dy = this.y - v.y, dz = this.z - v.z;
 		return dx * dx + dy * dy + dz * dz;
 		return dx * dx + dy * dy + dz * dz;
+
 	}
 	}
-	
+
 	this.length = function () {
 	this.length = function () {
-	
-		return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z);
+
+		return Math.sqrt( this.x * this.x + this.y * this.y + this.z * this.z );
+
 	}
 	}
-	
+
 	this.lengthSq = function () {
 	this.lengthSq = function () {
-	
+
 		return this.x * this.x + this.y * this.y + this.z * this.z;
 		return this.x * this.x + this.y * this.y + this.z * this.z;
+
 	}
 	}
-	
+
 	this.negate = function () {
 	this.negate = function () {
-	
-		this.x = -this.x;
-		this.y = -this.y;
-		this.z = -this.z;
+
+		this.x = - this.x;
+		this.y = - this.y;
+		this.z = - this.z;
 	}
 	}
-	
+
 	this.normalize = function () {
 	this.normalize = function () {
-	
+
 		if (this.length() > 0) {
 		if (this.length() > 0) {
-		
+
 			this.multiplyScalar(1 / this.length());
 			this.multiplyScalar(1 / this.length());
-			
+
 		} else {
 		} else {
-		
+
 			this.multiplyScalar(0);
 			this.multiplyScalar(0);
+
 		}
 		}
 	}
 	}
-	
-	this.isZero = function () {
-	
-		var almostZero = 0.0001;
-		return (Math.abs(this.x) < almostZero) && (Math.abs(this.y) < almostZero) && (Math.abs(this.z) < almostZero);
-	}	
-	
+
 	this.clone = function () {
 	this.clone = function () {
-	
+
 		return new THREE.Vector3(this.x, this.y, this.z);
 		return new THREE.Vector3(this.x, this.y, this.z);
+
 	}
 	}
-	
+
 	this.toString = function () {
 	this.toString = function () {
-	
+
 		return 'THREE.Vector3 (' + this.x + ', ' + this.y + ', ' + this.z + ')';
 		return 'THREE.Vector3 (' + this.x + ', ' + this.y + ', ' + this.z + ')';
+
 	}
 	}
+
 }
 }

+ 31 - 21
src/core/Vector4.js

@@ -2,73 +2,83 @@
  * @author supereggbert / http://www.paulbrunt.co.uk/
  * @author supereggbert / http://www.paulbrunt.co.uk/
  */
  */
 
 
-THREE.Vector4 = function (x, y, z, w) {
+THREE.Vector4 = function ( x, y, z, w ) {
 
 
 	this.x = x || 0;
 	this.x = x || 0;
 	this.y = y || 0;
 	this.y = y || 0;
 	this.z = z || 0;
 	this.z = z || 0;
 	this.w = w || 1;
 	this.w = w || 1;
 
 
-	this.set = function (x, y, z, w) {
-	
+	this.set = function ( x, y, z, w ) {
+
 		this.x = x;
 		this.x = x;
 		this.y = y;
 		this.y = y;
 		this.z = z;
 		this.z = z;
 		this.w = w;
 		this.w = w;
+
 	}
 	}
 
 
-	this.copy = function (v) {
-	
+	this.copy = function ( v ) {
+
 		this.x = v.x;
 		this.x = v.x;
 		this.y = v.y;
 		this.y = v.y;
 		this.z = v.z;
 		this.z = v.z;
 		this.w = v.w;
 		this.w = v.w;
+
 	}
 	}
 
 
-	this.add = function (v1, v2) {
-	
+	this.add = function ( v1, v2 ) {
+
 		this.x = v1.x + v2.x;
 		this.x = v1.x + v2.x;
 		this.y = v1.y + v2.y;
 		this.y = v1.y + v2.y;
-		this.z = v1.z + v2.z;	
+		this.z = v1.z + v2.z;
 		this.w = v1.w + v2.w;
 		this.w = v1.w + v2.w;
+
 	}
 	}
 
 
-	this.addSelf = function (v) {
-	
+	this.addSelf = function ( v ) {
+
 		this.x += v.x;
 		this.x += v.x;
 		this.y += v.y;
 		this.y += v.y;
 		this.z += v.z;
 		this.z += v.z;
 		this.w += v.w;
 		this.w += v.w;
+
 	}
 	}
 
 
-	this.sub = function (v1, v2) {
-	
+	this.sub = function ( v1, v2 ) {
+
 		this.x = v1.x - v2.x;
 		this.x = v1.x - v2.x;
 		this.y = v1.y - v2.y;
 		this.y = v1.y - v2.y;
-		this.z = v1.z - v2.z;	
+		this.z = v1.z - v2.z;
 		this.w = v1.w - v2.w;
 		this.w = v1.w - v2.w;
+
 	}
 	}
-	
-	this.subSelf = function (v) {
-	
+
+	this.subSelf = function ( v ) {
+
 		this.x -= v.x;
 		this.x -= v.x;
 		this.y -= v.y;
 		this.y -= v.y;
 		this.z -= v.z;
 		this.z -= v.z;
 		this.w -= v.w;
 		this.w -= v.w;
+
 	}
 	}
 
 
 	this.clone = function () {
 	this.clone = function () {
-	
-		return new THREE.Vector4(this.x, this.y, this.z, this.w);
+
+		return new THREE.Vector4( this.x, this.y, this.z, this.w );
+
 	}
 	}
-	
+
 	this.toVector3 = function () {
 	this.toVector3 = function () {
 
 
-		return new THREE.Vector3(this.x / this.w, this.y / this.w, this.z / this.w);
+		return new THREE.Vector3( this.x / this.w, this.y / this.w, this.z / this.w );
+
 	}
 	}
 
 
 	this.toString = function () {
 	this.toString = function () {
-	
+
 		return 'THREE.Vector4 (' + this.x + ', ' + this.y + ', ' + this.z + ', ' + this.w + ')';
 		return 'THREE.Vector4 (' + this.x + ', ' + this.y + ', ' + this.z + ', ' + this.w + ')';
+
 	}
 	}
+
 }
 }

+ 4 - 4
src/core/Vertex.js

@@ -2,16 +2,16 @@
  * @author mr.doob / http://mrdoob.com/
  * @author mr.doob / http://mrdoob.com/
  */
  */
 
 
-THREE.Vertex = function (position, normal) {
+THREE.Vertex = function ( position, normal ) {
 
 
 	this.position = position || new THREE.Vector3();
 	this.position = position || new THREE.Vector3();
 	this.normal = normal || new THREE.Vector3();
 	this.normal = normal || new THREE.Vector3();
 	this.screen = new THREE.Vector3();
 	this.screen = new THREE.Vector3();
-	
-	this.visible = true; // internal
+
+	this.__visible = true;
 
 
 	this.toString = function () {
 	this.toString = function () {
-	
+
 		return 'THREE.Vertex ( position: ' + this.position + ', normal: ' + this.normal + ' )';
 		return 'THREE.Vertex ( position: ' + this.position + ', normal: ' + this.normal + ' )';
 	}
 	}
 }
 }

+ 6 - 4
src/materials/ColorFillMaterial.js

@@ -2,12 +2,14 @@
  * @author mr.doob / http://mrdoob.com/
  * @author mr.doob / http://mrdoob.com/
  */
  */
 
 
-THREE.ColorFillMaterial = function (hex, opacity) {
+THREE.ColorFillMaterial = function ( hex, opacity ) {
+
+	this.color = new THREE.Color( ( opacity ? ( opacity * 0xff ) << 24 : 0xff000000 ) | hex );
 
 
-	this.color = new THREE.Color( (opacity ? (opacity * 0xff) << 24 : 0xff000000) | hex );
-	
 	this.toString = function () {
 	this.toString = function () {
-	
+
 		return 'THREE.ColorFillMaterial ( color: ' + this.color + ' )';
 		return 'THREE.ColorFillMaterial ( color: ' + this.color + ' )';
+
 	}
 	}
+
 }
 }

+ 7 - 5
src/materials/ColorStrokeMaterial.js

@@ -2,13 +2,15 @@
  * @author mr.doob / http://mrdoob.com/
  * @author mr.doob / http://mrdoob.com/
  */
  */
 
 
-THREE.ColorStrokeMaterial = function (hex, opacity, lineWidth) {
+THREE.ColorStrokeMaterial = function ( lineWidth, hex, opacity ) {
 
 
 	this.lineWidth = lineWidth || 1;
 	this.lineWidth = lineWidth || 1;
-	this.color = new THREE.Color( (opacity ? (opacity * 0xff) << 24 : 0xff000000) | hex );
-	
+	this.color = new THREE.Color( ( opacity ? ( opacity * 0xff ) << 24 : 0xff000000 ) | hex );
+
 	this.toString = function () {
 	this.toString = function () {
-	
+
 		return 'THREE.ColorStrokeMaterial ( lineWidth: ' + this.lineWidth + ', color: ' + this.color + ' )';
 		return 'THREE.ColorStrokeMaterial ( lineWidth: ' + this.lineWidth + ', color: ' + this.color + ' )';
-	}	
+
+	}
+
 }
 }

+ 2 - 1
src/materials/FaceColorFillMaterial.js

@@ -7,6 +7,7 @@ THREE.FaceColorFillMaterial = function () {
 	this.toString = function () {
 	this.toString = function () {
 
 
 		return 'THREE.FaceColorFillMaterial ( )';
 		return 'THREE.FaceColorFillMaterial ( )';
-		
+
 	}
 	}
+
 }
 }

+ 5 - 4
src/materials/FaceColorStrokeMaterial.js

@@ -2,13 +2,14 @@
  * @author mr.doob / http://mrdoob.com/
  * @author mr.doob / http://mrdoob.com/
  */
  */
 
 
-THREE.FaceColorStrokeMaterial = function (lineWidth) {
+THREE.FaceColorStrokeMaterial = function ( lineWidth ) {
 
 
 	this.lineWidth = lineWidth || 1;
 	this.lineWidth = lineWidth || 1;
-	
+
 	this.toString = function () {
 	this.toString = function () {
 
 
 		return 'THREE.FaceColorStrokeMaterial ( lineWidth: ' + this.lineWidth + ' )';
 		return 'THREE.FaceColorStrokeMaterial ( lineWidth: ' + this.lineWidth + ' )';
-		
-	}	
+
+	}
+
 }
 }

+ 15 - 0
src/materials/TextureUVMappingMaterial.js

@@ -0,0 +1,15 @@
+/**
+ * @author mr.doob / http://mrdoob.com/
+ */
+
+THREE.TextureUVMappingMaterial = function ( bitmap ) {
+
+	this.bitmap = bitmap;
+
+	this.toString = function () {
+
+		return 'THREE.TextureUVMappingMaterial ( bitmap: ' + this.bitmap + ' )';
+
+	}
+
+}

+ 3 - 3
src/objects/Line.js

@@ -2,10 +2,10 @@
  * @author mr.doob / http://mrdoob.com/
  * @author mr.doob / http://mrdoob.com/
  */
  */
 
 
-THREE.Line = function (geometry, material) {
+THREE.Line = function ( geometry, material ) {
+
+	THREE.Object3D.call( this, material );
 
 
-	THREE.Object3D.call(this, material);
-	
 	this.geometry = geometry;
 	this.geometry = geometry;
 
 
 }
 }

+ 4 - 4
src/objects/Mesh.js

@@ -2,12 +2,12 @@
  * @author mr.doob / http://mrdoob.com/
  * @author mr.doob / http://mrdoob.com/
  */
  */
 
 
-THREE.Mesh = function (geometry, material) {
+THREE.Mesh = function ( geometry, material ) {
+
+	THREE.Object3D.call( this, material );
 
 
-	THREE.Object3D.call(this, material);
-	
 	this.geometry = geometry;
 	this.geometry = geometry;
-	
+
 	this.doubleSided = false;
 	this.doubleSided = false;
 
 
 }
 }

+ 7 - 6
src/objects/Object3D.js

@@ -2,16 +2,16 @@
  * @author mr.doob / http://mrdoob.com/
  * @author mr.doob / http://mrdoob.com/
  */
  */
 
 
-THREE.Object3D = function (material) {
+THREE.Object3D = function ( material ) {
 
 
-	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.position = new THREE.Vector3();
+	this.rotation = new THREE.Vector3();
+	this.scale = new THREE.Vector3( 1, 1, 1 );
 
 
 	this.matrix = new THREE.Matrix4();
 	this.matrix = new THREE.Matrix4();
-	this.screen = new THREE.Vector3(0, 0, 0);
+	this.screen = new THREE.Vector3();
 
 
-	this.material = material instanceof Array ? material : [material];
+	this.material = material instanceof Array ? material : [ material ];
 
 
 	this.autoUpdateMatrix = true;
 	this.autoUpdateMatrix = true;
 
 
@@ -26,4 +26,5 @@ THREE.Object3D = function (material) {
 		this.matrix.multiplySelf(THREE.Matrix4.scaleMatrix(this.scale.x, this.scale.y, this.scale.z));
 		this.matrix.multiplySelf(THREE.Matrix4.scaleMatrix(this.scale.x, this.scale.y, this.scale.z));
 
 
 	}
 	}
+
 }
 }

+ 3 - 2
src/objects/Particle.js

@@ -2,12 +2,13 @@
  * @author mr.doob / http://mrdoob.com/
  * @author mr.doob / http://mrdoob.com/
  */
  */
 
 
-THREE.Particle = function (material) {
+THREE.Particle = function ( material ) {
 
 
-	THREE.Object3D.call(this, material);
+	THREE.Object3D.call( this, material );
 
 
 	this.size = 1;
 	this.size = 1;
 	this.autoUpdateMatrix = false;
 	this.autoUpdateMatrix = false;
+
 }
 }
 
 
 THREE.Particle.prototype = new THREE.Object3D();
 THREE.Particle.prototype = new THREE.Object3D();

+ 146 - 88
src/renderers/CanvasRenderer.js

@@ -4,37 +4,41 @@
 
 
 THREE.CanvasRenderer = function () {
 THREE.CanvasRenderer = function () {
 
 
-	THREE.Renderer.call(this);
+	THREE.Renderer.call( this );
 
 
-	var _viewport = document.createElement("canvas"),
-	_context = _viewport.getContext("2d"),
+	var _viewport = document.createElement( "canvas" ),
+	_context = _viewport.getContext( "2d" ),
 	_clipRect = new THREE.Rectangle(),
 	_clipRect = new THREE.Rectangle(),
-	_clearRect = new THREE.Rectangle(0, 0, 0, 0),
-	_bboxRect = new THREE.Rectangle();
+	_clearRect = new THREE.Rectangle( 0, 0, 0, 0 ),
+	_bboxRect = new THREE.Rectangle(),
 
 
-	this.setSize = function (width, height) {
+	_uvs, _bitmap, _bitmap_width, _bitmap_height,
+	_denom, _m11, _m12, _m21, _m22, _dx, _dy,
+	_vector2 = new THREE.Vector2();
+
+	this.setSize = function ( width, height ) {
 
 
 		_viewport.width = width;
 		_viewport.width = width;
 		_viewport.height = height;
 		_viewport.height = height;
 
 
-		_context.setTransform(1, 0, 0, 1, width / 2, height / 2);
+		_context.setTransform( 1, 0, 0, 1, width / 2, height / 2 );
 
 
-		_clipRect.set(-width / 2, -height / 2, width / 2, height / 2);
+		_clipRect.set( -width / 2, -height / 2, width / 2, height / 2 );
 
 
 	}
 	}
 
 
 	this.domElement = _viewport;
 	this.domElement = _viewport;
 
 
-	this.render = function (scene, camera) {
+	this.render = function ( scene, camera ) {
 
 
 		var i, j, element, pi2 = Math.PI * 2,
 		var i, j, element, pi2 = Math.PI * 2,
 		elementsLength, material, materialLength,
 		elementsLength, material, materialLength,
 		v1x, v1y, v2x, v2y, v3x, v3y, v4x, v4y,
 		v1x, v1y, v2x, v2y, v3x, v3y, v4x, v4y,
 		size;
 		size;
 
 
-		_clearRect.inflate(1);
-		_clearRect.minSelf(_clipRect);
-		_context.clearRect(_clearRect.getX(), _clearRect.getY(), _clearRect.getWidth(), _clearRect.getHeight());
+		_clearRect.inflate( 1 );
+		_clearRect.minSelf( _clipRect );
+		_context.clearRect( _clearRect.getX(), _clearRect.getY(), _clearRect.getWidth(), _clearRect.getHeight() );
 		_clearRect.empty();
 		_clearRect.empty();
 
 
 		/*
 		/*
@@ -42,118 +46,126 @@ THREE.CanvasRenderer = function () {
 		_context.fillRect(_clipRect.getX(), _clipRect.getY(), _clipRect.getWidth(), _clipRect.getHeight());
 		_context.fillRect(_clipRect.getX(), _clipRect.getY(), _clipRect.getWidth(), _clipRect.getHeight());
 		*/
 		*/
 
 
-		this.project(scene, camera);
+		this.project( scene, camera );
 
 
 		elementsLength = this.renderList.length;
 		elementsLength = this.renderList.length;
 
 
-		for (i = 0; i < elementsLength; i++) {
+		for ( i = 0; i < elementsLength; i++ ) {
 
 
-			element = this.renderList[i];
-			materialLength = element.material.length;
+			element = this.renderList[ i ];
 
 
-			for (j = 0; j < materialLength; j++) {
+			_bboxRect.empty();
 
 
-				material = element.material[j];
+			_context.beginPath();
 
 
-				_context.beginPath();
+			if ( element instanceof THREE.RenderableParticle ) {
 
 
-				_bboxRect.empty();
+				size = element.size * element.screenZ;
 
 
-				if (element instanceof THREE.RenderableFace3) {
+				_bboxRect.set( element.x - size, element.y - size, element.x + size, element.y + size );
 
 
-					v1x = element.v1.x; v1y = element.v1.y;
-					v2x = element.v2.x; v2y = element.v2.y;
-					v3x = element.v3.x; v3y = element.v3.y;
+				if ( !_clipRect.instersects( _bboxRect ) ) {
 
 
-					_bboxRect.addPoint(v1x, v1y);
-					_bboxRect.addPoint(v2x, v2y);
-					_bboxRect.addPoint(v3x, v3y);
+					continue;
 
 
-					if (!_clipRect.instersects(_bboxRect)) {
+				}
 
 
-						continue;
+				_context.arc( element.x, element.y, size, 0, pi2, true );
 
 
-					}
+			} else if ( element instanceof THREE.RenderableLine ) {
 
 
-					_clearRect.addRectangle(_bboxRect);
+				v1x = element.v1.x; v1y = element.v1.y;
+				v2x = element.v2.x; v2y = element.v2.y;
 
 
-					_context.moveTo(v1x, v1y);
-					_context.lineTo(v2x, v2y);
-					_context.lineTo(v3x, v3y);
-					_context.lineTo(v1x, v1y);
+				_bboxRect.addPoint( v1x, v1y );
+				_bboxRect.addPoint( v2x, v2y );
 
 
-				} else if (element instanceof THREE.RenderableFace4) {
+				if ( !_clipRect.instersects( _bboxRect ) ) {
 
 
-					v1x = element.v1.x; v1y = element.v1.y;
-					v2x = element.v2.x; v2y = element.v2.y;
-					v3x = element.v3.x; v3y = element.v3.y;
-					v4x = element.v4.x; v4y = element.v4.y;
+					continue;
 
 
-					_bboxRect.addPoint(v1x, v1y);
-					_bboxRect.addPoint(v2x, v2y);
-					_bboxRect.addPoint(v3x, v3y);
-					_bboxRect.addPoint(v4x, v4y);
+				}
 
 
-					if (!_clipRect.instersects(_bboxRect)) {
+				_context.moveTo( v1x, v1y );
+				_context.lineTo( v2x, v2y );
 
 
-						continue;
+			} else if ( element instanceof THREE.RenderableFace3 ) {
 
 
-					}
+				expand( element.v1, element.v2 );
+				expand( element.v2, element.v3 );
+				expand( element.v3, element.v1 );
 
 
-					_context.moveTo(v1x, v1y);
-					_context.lineTo(v2x, v2y);
-					_context.lineTo(v3x, v3y);
-					_context.lineTo(v4x, v4y);
-					_context.lineTo(v1x, v1y);
-				
-				} else if (element instanceof THREE.RenderableLine) {
-				
-					v1x = element.v1.x; v1y = element.v1.y;
-					v2x = element.v2.x; v2y = element.v2.y;
+				v1x = element.v1.x; v1y = element.v1.y;
+				v2x = element.v2.x; v2y = element.v2.y;
+				v3x = element.v3.x; v3y = element.v3.y;
 
 
-					_bboxRect.addPoint(v1x, v1y);
-					_bboxRect.addPoint(v2x, v2y);
+				_bboxRect.addPoint( v1x, v1y );
+				_bboxRect.addPoint( v2x, v2y );
+				_bboxRect.addPoint( v3x, v3y );
 
 
-					if (!_clipRect.instersects(_bboxRect)) {
+				if ( !_clipRect.instersects( _bboxRect ) ) {
 
 
-						continue;
+					continue;
 
 
-					}
+				}
 
 
-					_context.moveTo(v1x, v1y);
-					_context.lineTo(v2x, v2y);
+				_clearRect.addRectangle( _bboxRect );
 
 
-				} else if (element instanceof THREE.RenderableParticle) {
+				_context.moveTo( v1x, v1y );
+				_context.lineTo( v2x, v2y );
+				_context.lineTo( v3x, v3y );
+				_context.lineTo( v1x, v1y );
 
 
-					size = element.size * element.screenZ;
+			} else if ( element instanceof THREE.RenderableFace4 ) {
 
 
-					_bboxRect.set(element.x - size, element.y - size, element.x + size, element.y + size);
+				expand( element.v1, element.v2 );
+				expand( element.v2, element.v3 );
+				expand( element.v3, element.v4 );
+				expand( element.v4, element.v1 );
 
 
-					if (!_clipRect.instersects(_bboxRect)) {
+				v1x = element.v1.x; v1y = element.v1.y;
+				v2x = element.v2.x; v2y = element.v2.y;
+				v3x = element.v3.x; v3y = element.v3.y;
+				v4x = element.v4.x; v4y = element.v4.y;
 
 
-						continue;
+				_bboxRect.addPoint( v1x, v1y );
+				_bboxRect.addPoint( v2x, v2y );
+				_bboxRect.addPoint( v3x, v3y );
+				_bboxRect.addPoint( v4x, v4y );
 
 
-					}
+				if ( !_clipRect.instersects( _bboxRect ) ) {
 
 
-					_context.arc(element.x, element.y, size, 0, pi2, true);
+					continue;
 
 
 				}
 				}
 
 
-				if (material instanceof THREE.ColorFillMaterial) {
+				_context.moveTo( v1x, v1y );
+				_context.lineTo( v2x, v2y );
+				_context.lineTo( v3x, v3y );
+				_context.lineTo( v4x, v4y );
+				_context.lineTo( v1x, v1y );
+
+			}
+
+			_context.closePath();
+
+			materialLength = element.material.length;
+
+			for ( j = 0; j < materialLength; j++ ) {
+
+				material = element.material[ j ];
+
+				if ( material instanceof THREE.ColorFillMaterial ) {
 
 
 					_context.fillStyle = material.color.__styleString;
 					_context.fillStyle = material.color.__styleString;
 					_context.fill();
 					_context.fill();
 
 
-					_clearRect.addRectangle(_bboxRect);
-
-				} else if (material instanceof THREE.FaceColorFillMaterial) {
+				} else if ( material instanceof THREE.FaceColorFillMaterial ) {
 
 
 					_context.fillStyle = element.color.__styleString;
 					_context.fillStyle = element.color.__styleString;
 					_context.fill();
 					_context.fill();
 
 
-					_clearRect.addRectangle(_bboxRect);
-
-				} else if (material instanceof THREE.ColorStrokeMaterial) {
+				} else if ( material instanceof THREE.ColorStrokeMaterial ) {
 
 
 					_context.lineWidth = material.lineWidth;
 					_context.lineWidth = material.lineWidth;
 					_context.lineJoin = "round";
 					_context.lineJoin = "round";
@@ -162,10 +174,9 @@ THREE.CanvasRenderer = function () {
 					_context.strokeStyle = material.color.__styleString;
 					_context.strokeStyle = material.color.__styleString;
 					_context.stroke();
 					_context.stroke();
 
 
-					_bboxRect.inflate(material.lineWidth);
-					_clearRect.addRectangle(_bboxRect);
+					_bboxRect.inflate( _context.lineWidth );
 
 
-				} else if (material instanceof THREE.FaceColorStrokeMaterial) {
+				} else if ( material instanceof THREE.FaceColorStrokeMaterial ) {
 
 
 					_context.lineWidth = material.lineWidth;
 					_context.lineWidth = material.lineWidth;
 					_context.lineJoin = "round";
 					_context.lineJoin = "round";
@@ -174,22 +185,69 @@ THREE.CanvasRenderer = function () {
 					_context.strokeStyle = element.color.__styleString;
 					_context.strokeStyle = element.color.__styleString;
 					_context.stroke();
 					_context.stroke();
 
 
-					_bboxRect.inflate(material.lineWidth);
-					_clearRect.addRectangle(_bboxRect);
+					_bboxRect.inflate( _context.lineWidth );
 
 
-				}
+				} else if ( material instanceof THREE.TextureUVMappingMaterial ) {
+
+					_uvs = element.uvs;
+					_bitmap = material.bitmap,
+					_bitmap_width = _bitmap.width,
+					_bitmap_height = _bitmap.height;
 
 
-				_context.closePath();
+					drawTexturedTriangle( _bitmap, _bboxRect, v1x, v1y, v2x, v2y, v3x, v3y,
+						_uvs[ 0 ].x * _bitmap_width, _uvs[ 0 ].y * _bitmap_height,
+						_uvs[ 1 ].x * _bitmap_width, _uvs[ 1 ].y * _bitmap_height,
+						_uvs[ 2 ].x * _bitmap_width, _uvs[ 2 ].y * _bitmap_height );
+
+				}
 
 
 			}
 			}
+
+			_clearRect.addRectangle( _bboxRect );
+
 		}
 		}
-		
+
 		/*
 		/*
 		_context.lineWidth = 1;
 		_context.lineWidth = 1;
-		_context.strokeStyle = 'rgba(0, 0, 255, 0.5)';
-		_context.strokeRect(_clearRect.getX(), _clearRect.getY(), _clearRect.getWidth(), _clearRect.getHeight());	
+		_context.strokeStyle = 'rgba( 0, 0, 255, 0.5 )';
+		_context.strokeRect( _clearRect.getX(), _clearRect.getY(), _clearRect.getWidth(), _clearRect.getHeight() );
 		*/
 		*/
+
+	}
+
+	// Textured triangle drawing by Thatcher Ulrich.
+	// http://tulrich.com/geekstuff/canvas/jsgl.js
+
+	function drawTexturedTriangle( texture, bbox, x0, y0, x1, y1, x2, y2, sx0, sy0, sx1, sy1, sx2, sy2 ) {
+
+		_context.save();
+		_context.clip();
+
+		_denom = sx0 * ( sy2 - sy1 ) - sx1 * sy2 + sx2 * sy1 + ( sx1 - sx2 ) * sy0;
+		_m11 = - ( sy0 * (x2 - x1 ) - sy1 * x2 + sy2 * x1 + ( sy1 - sy2 ) * x0 ) / _denom;
+		_m12 = ( sy1 * y2 + sy0 * ( y1 - y2 ) - sy2 * y1 + ( sy2 - sy1) * y0 ) / _denom;
+		_m21 = ( sx0 * ( x2 - x1 ) - sx1 * x2 + sx2 * x1 + ( sx1 - sx2 ) * x0 ) / _denom;
+		_m22 = - ( sx1 * y2 + sx0 * ( y1 - y2 ) - sx2 * y1 + ( sx2 - sx1 ) * y0 ) / _denom;
+		_dx = ( sx0 * ( sy2 * x1 - sy1 * x2 ) + sy0 * ( sx1 * x2 - sx2 * x1 ) + ( sx2 * sy1 - sx1 * sy2 ) * x0 ) / _denom;
+		_dy = ( sx0 * ( sy2 * y1 - sy1 * y2 ) + sy0 * ( sx1 * y2 - sx2 * y1 ) + ( sx2 * sy1 - sx1 * sy2 ) * y0 ) / _denom;
+
+		_context.transform( _m11, _m12, _m21, _m22, _dx, _dy );
+
+		_context.drawImage( texture, 0, 0 );
+		_context.restore();
+
 	}
 	}
+
+	function expand( a, b ) {
+
+		_vector2.sub( b, a );
+		_vector2.unit();
+
+		b.addSelf( _vector2 );
+		a.subSelf( _vector2 );
+
+	}
+
 }
 }
 
 
 THREE.CanvasRenderer.prototype = new THREE.Renderer();
 THREE.CanvasRenderer.prototype = new THREE.Renderer();

+ 7 - 5
src/renderers/Renderer.js

@@ -62,7 +62,7 @@ THREE.Renderer = function() {
 
 
 					vertex.screen.z = focuszoom / (camerafocus + vertex.screen.z);
 					vertex.screen.z = focuszoom / (camerafocus + vertex.screen.z);
 
 
-					vertex.visible = vertex.screen.z > 0;
+					vertex.__visible = vertex.screen.z > 0;
 
 
 					vertex.screen.x *= vertex.screen.z;
 					vertex.screen.x *= vertex.screen.z;
 					vertex.screen.y *= vertex.screen.z; 
 					vertex.screen.y *= vertex.screen.z; 
@@ -85,7 +85,7 @@ THREE.Renderer = function() {
 						v2 = object.geometry.vertices[face.b];
 						v2 = object.geometry.vertices[face.b];
 						v3 = object.geometry.vertices[face.c];
 						v3 = object.geometry.vertices[face.c];
 
 
-						if (v1.visible && v2.visible && v3.visible && (object.doubleSided ||
+						if (v1.__visible && v2.__visible && v3.__visible && (object.doubleSided ||
 						   (v3.screen.x - v1.screen.x) * (v2.screen.y - v1.screen.y) -
 						   (v3.screen.x - v1.screen.x) * (v2.screen.y - v1.screen.y) -
 						   (v3.screen.y - v1.screen.y) * (v2.screen.x - v1.screen.x) > 0) ) {
 						   (v3.screen.y - v1.screen.y) * (v2.screen.x - v1.screen.x) > 0) ) {
 
 
@@ -105,8 +105,9 @@ THREE.Renderer = function() {
 							face3Pool[face3count].v3.y = v3.screen.y;
 							face3Pool[face3count].v3.y = v3.screen.y;
 							face3Pool[face3count].screenZ = face.screen.z;
 							face3Pool[face3count].screenZ = face.screen.z;
 
 
-							face3Pool[face3count].color = face.color;
 							face3Pool[face3count].material = object.material;
 							face3Pool[face3count].material = object.material;
+							face3Pool[face3count].uvs = object.geometry.uvs[j];
+							face3Pool[face3count].color = face.color;
 
 
 							this.renderList.push(face3Pool[face3count]);
 							this.renderList.push(face3Pool[face3count]);
 
 
@@ -120,7 +121,7 @@ THREE.Renderer = function() {
 						v3 = object.geometry.vertices[face.c];
 						v3 = object.geometry.vertices[face.c];
 						v4 = object.geometry.vertices[face.d];
 						v4 = object.geometry.vertices[face.d];
 
 
-						if (v1.visible && v2.visible && v3.visible && v4.visible && (object.doubleSided ||
+						if (v1.__visible && v2.__visible && v3.__visible && v4.__visible && (object.doubleSided ||
 						   ((v4.screen.x - v1.screen.x) * (v2.screen.y - v1.screen.y) -
 						   ((v4.screen.x - v1.screen.x) * (v2.screen.y - v1.screen.y) -
 						   (v4.screen.y - v1.screen.y) * (v2.screen.x - v1.screen.x) > 0 ||
 						   (v4.screen.y - v1.screen.y) * (v2.screen.x - v1.screen.x) > 0 ||
 						   (v2.screen.x - v3.screen.x) * (v4.screen.y - v3.screen.y) -
 						   (v2.screen.x - v3.screen.x) * (v4.screen.y - v3.screen.y) -
@@ -144,8 +145,9 @@ THREE.Renderer = function() {
 							face4Pool[face4count].v4.y = v4.screen.y;
 							face4Pool[face4count].v4.y = v4.screen.y;
 							face4Pool[face4count].screenZ = face.screen.z;
 							face4Pool[face4count].screenZ = face.screen.z;
 
 
-							face4Pool[face4count].color = face.color;
 							face4Pool[face4count].material = object.material;
 							face4Pool[face4count].material = object.material;
+							face4Pool[face4count].uvs = object.geometry.uvs[j];
+							face4Pool[face4count].color = face.color;
 
 
 							this.renderList.push(face4Pool[face4count]);
 							this.renderList.push(face4Pool[face4count]);
 
 

+ 143 - 107
src/renderers/SVGRenderer.js

@@ -4,153 +4,189 @@
 
 
 THREE.SVGRenderer = function () {
 THREE.SVGRenderer = function () {
 
 
-	THREE.Renderer.call(this);
-	
+	THREE.Renderer.call( this );
+
 	var _viewport = document.createElementNS('http://www.w3.org/2000/svg', 'svg'),
 	var _viewport = document.createElementNS('http://www.w3.org/2000/svg', 'svg'),
 	_clipRect = new THREE.Rectangle(),
 	_clipRect = new THREE.Rectangle(),
 	_bboxRect = new THREE.Rectangle(),
 	_bboxRect = new THREE.Rectangle(),
-	_svgPathPool = [], _svgCirclePool = [];
-
-	this.setSize = function (width, height) {
-	
-		_viewport.setAttribute('viewBox', (-width / 2) + ' ' + (-height / 2) + ' ' + width + ' ' + height );
-		_viewport.setAttribute('width', width);
-		_viewport.setAttribute('height', height);
-		
-		_clipRect.set(-width / 2, -height / 2, width / 2, height / 2);
+	_svgPathPool = [], _svgCirclePool = [],
+	_quality = 1;
+
+	this.setQuality = function( quality ) {
+
+		switch(quality) {
+
+			case "high": _quality = 1; break;
+			case "low": _quality = 0; break;
+
+		}
+	}
+
+	this.setSize = function ( width, height ) {
+
+		_viewport.setAttribute( 'viewBox', ( - width / 2 ) + ' ' + ( - height / 2 ) + ' ' + width + ' ' + height );
+		_viewport.setAttribute( 'width', width );
+		_viewport.setAttribute( 'height', height );
+
+		_clipRect.set( - width / 2, - height / 2, width / 2, height / 2 );
 	}
 	}
-	
+
 	this.domElement = _viewport;
 	this.domElement = _viewport;
 
 
-	this.render = function (scene, camera) {
-	
+	this.render = function ( scene, camera ) {
+
 		var i, j, element, elementsLength, material, materialLength,
 		var i, j, element, elementsLength, material, materialLength,
 		pathCount = 0, circleCount = 0, svgNode,
 		pathCount = 0, circleCount = 0, svgNode,
 		v1x, v1y, v2x, v2y, v3x, v3y, v4x, v4y,
 		v1x, v1y, v2x, v2y, v3x, v3y, v4x, v4y,
 		size;
 		size;
-	
-		this.project(scene, camera);
-	
-		while (_viewport.childNodes.length > 0) {
-		
-			_viewport.removeChild(_viewport.childNodes[0]);
+
+		this.project( scene, camera );
+
+		while ( _viewport.childNodes.length > 0 ) {
+
+			_viewport.removeChild( _viewport.childNodes[ 0 ] );
+
 		}
 		}
-		
+
 		elementsLength = this.renderList.length;
 		elementsLength = this.renderList.length;
-		
-		for (i = 0; i < elementsLength; i++) {
-			
-			element = this.renderList[i];
+
+		for ( i = 0; i < elementsLength; i++ ) {
+
+			element = this.renderList[ i ];
 			materialLength = element.material.length;
 			materialLength = element.material.length;
-			
-			for (j = 0; j < materialLength; j++) {
-			
-				material = element.material[j];
-				
+
+			for ( j = 0; j < materialLength; j++ ) {
+
+				material = element.material[ j ];
+
 				_bboxRect.empty();
 				_bboxRect.empty();
 
 
-				if (element instanceof THREE.RenderableFace3) {
-				
+				if ( element instanceof THREE.RenderableFace3 ) {
+
 					v1x = element.v1.x; v1y = element.v1.y;
 					v1x = element.v1.x; v1y = element.v1.y;
 					v2x = element.v2.x; v2y = element.v2.y;
 					v2x = element.v2.x; v2y = element.v2.y;
 					v3x = element.v3.x; v3y = element.v3.y;
 					v3x = element.v3.x; v3y = element.v3.y;
-					
-					_bboxRect.addPoint(v1x, v1y);
-					_bboxRect.addPoint(v2x, v2y);
-					_bboxRect.addPoint(v3x, v3y);
-					
-					if (!_clipRect.instersects(_bboxRect)) {
-					
+
+					_bboxRect.addPoint( v1x, v1y );
+					_bboxRect.addPoint( v2x, v2y );
+					_bboxRect.addPoint( v3x, v3y );
+
+					if ( !_clipRect.instersects( _bboxRect ) ) {
+
 						continue;
 						continue;
+
 					}
 					}
-					
-					svgNode = getPathNode(pathCount++);
-					svgNode.setAttribute('d', 'M ' + v1x + ' ' + v1y + ' L ' + v2x + ' ' + v2y + ' L ' + v3x + ',' + v3y + 'z');
-					
-				} else if (element instanceof THREE.RenderableFace4) {
-					
+
+					svgNode = getPathNode( pathCount++ );
+					svgNode.setAttribute( 'd', 'M ' + v1x + ' ' + v1y + ' L ' + v2x + ' ' + v2y + ' L ' + v3x + ',' + v3y + 'z' );
+
+				} else if ( element instanceof THREE.RenderableFace4 ) {
+
 					v1x = element.v1.x; v1y = element.v1.y;
 					v1x = element.v1.x; v1y = element.v1.y;
 					v2x = element.v2.x; v2y = element.v2.y;
 					v2x = element.v2.x; v2y = element.v2.y;
 					v3x = element.v3.x; v3y = element.v3.y;
 					v3x = element.v3.x; v3y = element.v3.y;
 					v4x = element.v4.x; v4y = element.v4.y;
 					v4x = element.v4.x; v4y = element.v4.y;
-					
-					_bboxRect.addPoint(v1x, v1y);
-					_bboxRect.addPoint(v2x, v2y);
-					_bboxRect.addPoint(v3x, v3y);
-					_bboxRect.addPoint(v4x, v4y);
-
-					if (!_clipRect.instersects(_bboxRect)) {
-					
+
+					_bboxRect.addPoint( v1x, v1y );
+					_bboxRect.addPoint( v2x, v2y );
+					_bboxRect.addPoint( v3x, v3y );
+					_bboxRect.addPoint( v4x, v4y );
+
+					if ( !_clipRect.instersects( _bboxRect) ) {
+
 						continue;
 						continue;
+
 					}
 					}
-									
-					svgNode = getPathNode(pathCount++);
-					svgNode.setAttribute('d', 'M ' + v1x + ' ' + v1y + ' L ' + v2x + ' ' + v2y + ' L ' + v3x + ',' + v3y + ' L ' + v4x + ',' + v4y + 'z');
-					
-				} else if (element instanceof THREE.RenderableParticle) {
-				
+
+					svgNode = getPathNode( pathCount++ );
+					svgNode.setAttribute( 'd', 'M ' + v1x + ' ' + v1y + ' L ' + v2x + ' ' + v2y + ' L ' + v3x + ',' + v3y + ' L ' + v4x + ',' + v4y + 'z' );
+
+				} else if ( element instanceof THREE.RenderableParticle ) {
+
 					size = element.size * element.screenZ;
 					size = element.size * element.screenZ;
-					
-					_bboxRect.set(element.x - size, element.y - size, element.x + size, element.y + size);
 
 
-					if (!_clipRect.instersects(_bboxRect)) {
-					
+					_bboxRect.set( element.x - size, element.y - size, element.x + size, element.y + size );
+
+					if ( !_clipRect.instersects( _bboxRect ) ) {
+
 						continue;
 						continue;
+
 					}
 					}
-				
+
 					svgNode = getCircleNode(circleCount++);
 					svgNode = getCircleNode(circleCount++);
-					svgNode.setAttribute('cx', element.x);
-					svgNode.setAttribute('cy', element.y);
-					svgNode.setAttribute('r', size);
+					svgNode.setAttribute( 'cx', element.x );
+					svgNode.setAttribute( 'cy', element.y );
+					svgNode.setAttribute( 'r', size );
 				}
 				}
 
 
-				if (material instanceof THREE.ColorFillMaterial) {
-				
-					svgNode.setAttribute('style', 'fill: ' + material.color.__svgStyleString + '; stroke-width:10');
-					
-				} else if (material instanceof THREE.FaceColorFillMaterial) {
-				
-					svgNode.setAttribute('style', 'fill: ' + element.color.__svgStyleString + '; stroke-width:10');
-					
-				} else if (material instanceof THREE.ColorStrokeMaterial) {
-				
-					svgNode.setAttribute('style', 'fill: none; stroke: ' + material.color.__svgStyleString + '; stroke-width: ' + material.lineWidth + '; stroke-linecap: round; stroke-linejoin: round');
-				
-				} else if (material instanceof THREE.FaceColorStrokeMaterial) {
-				
-					svgNode.setAttribute('style', 'fill: none; stroke: ' + element.color.__svgStyleString + '; stroke-width: ' + material.lineWidth + '; stroke-linecap: round; stroke-linejoin: round');
+				// TODO: Move out of materials loop
+
+				if ( material instanceof THREE.ColorFillMaterial ) {
+
+					svgNode.setAttribute( 'style', 'fill: ' + material.color.__svgStyleString );
+
+				} else if ( material instanceof THREE.FaceColorFillMaterial ) {
+
+					svgNode.setAttribute( 'style', 'fill: ' + element.color.__svgStyleString );
+
+				} else if ( material instanceof THREE.ColorStrokeMaterial ) {
+
+					svgNode.setAttribute( 'style', 'fill: none; stroke: ' + material.color.__svgStyleString + '; stroke-width: ' + material.lineWidth + '; stroke-linecap: round; stroke-linejoin: round' );
+
+				} else if ( material instanceof THREE.FaceColorStrokeMaterial ) {
+
+					svgNode.setAttribute( 'style', 'fill: none; stroke: ' + element.color.__svgStyleString + '; stroke-width: ' + material.lineWidth + '; stroke-linecap: round; stroke-linejoin: round' );
+
 				}
 				}
-				
 
 
-				_viewport.appendChild(svgNode);
+				_viewport.appendChild( svgNode );
+
 			}
 			}
-		}	
+
+		}
+
 	}
 	}
-	
-	function getPathNode(id) {
-	
-		if (_svgPathPool[id] == null) {
-		
-			_svgPathPool[id] = document.createElementNS('http://www.w3.org/2000/svg', 'path');
-			// _svgPathPool[id].setAttribute('shape-rendering', 'crispEdges'); //optimizeSpeed
-			return _svgPathPool[id];
+
+	function getPathNode( id ) {
+
+		if ( _svgPathPool[ id ] == null ) {
+
+			_svgPathPool[ id ] = document.createElementNS( 'http://www.w3.org/2000/svg', 'path' );
+
+			if ( _quality == 0 ) {
+
+				_svgPathPool[ id ].setAttribute( 'shape-rendering', 'crispEdges' ); //optimizeSpeed
+
+			}
+
+			return _svgPathPool[ id ];
+
 		}
 		}
-		
-		return _svgPathPool[id];
+
+		return _svgPathPool[ id ];
+
 	}
 	}
-	
-	function getCircleNode(id) {
-	
-		if (_svgCirclePool[id] == null) {
-		
-			_svgCirclePool[id] = document.createElementNS('http://www.w3.org/2000/svg', 'circle');
-			// _svgCirclePool[id].setAttribute('shape-rendering', 'crispEdges'); //optimizeSpeed
-			// _svgCirclePool[id].setAttribute('fill', 'red');
-			return _svgCirclePool[id];
+
+	function getCircleNode( id ) {
+
+		if ( _svgCirclePool[id] == null ) {
+
+			_svgCirclePool[ id ] = document.createElementNS( 'http://www.w3.org/2000/svg', 'circle' );
+
+			if ( _quality == 0 ) {
+
+				_svgCirclePool[id].setAttribute( 'shape-rendering', 'crispEdges' ); //optimizeSpeed
+
+			}
+
+			return _svgCirclePool[ id ];
+
 		}
 		}
-		
-		return _svgCirclePool[id];
-	}	
+
+		return _svgCirclePool[ id ];
+
+	}
+
 }
 }
 
 
 THREE.SVGRenderer.prototype = new THREE.Renderer();
 THREE.SVGRenderer.prototype = new THREE.Renderer();

+ 3 - 2
src/renderers/renderables/RenderableFace3.js

@@ -7,9 +7,10 @@ THREE.RenderableFace3 = function () {
 	this.v1 = new THREE.Vector2();
 	this.v1 = new THREE.Vector2();
 	this.v2 = new THREE.Vector2();
 	this.v2 = new THREE.Vector2();
 	this.v3 = new THREE.Vector2();
 	this.v3 = new THREE.Vector2();
-	
+
 	this.screenZ;
 	this.screenZ;
-	
+
 	this.color;
 	this.color;
 	this.material;
 	this.material;
+
 }
 }

+ 4 - 3
src/renderers/renderables/RenderableFace4.js

@@ -7,10 +7,11 @@ THREE.RenderableFace4 = function () {
 	this.v1 = new THREE.Vector2();
 	this.v1 = new THREE.Vector2();
 	this.v2 = new THREE.Vector2();
 	this.v2 = new THREE.Vector2();
 	this.v3 = new THREE.Vector2();
 	this.v3 = new THREE.Vector2();
-	this.v4 = new THREE.Vector2();	
-	
+	this.v4 = new THREE.Vector2();
+
 	this.screenZ;
 	this.screenZ;
-	
+
 	this.color;
 	this.color;
 	this.material;
 	this.material;
+
 }
 }

+ 3 - 2
src/renderers/renderables/RenderableLine.js

@@ -6,9 +6,10 @@ THREE.RenderableLine = function () {
 
 
 	this.v1 = new THREE.Vector2();
 	this.v1 = new THREE.Vector2();
 	this.v2 = new THREE.Vector2();
 	this.v2 = new THREE.Vector2();
-	
+
 	this.screenZ;
 	this.screenZ;
-	
+
 	this.color;
 	this.color;
 	this.material;
 	this.material;
+
 }
 }

+ 2 - 1
src/renderers/renderables/RenderableParticle.js

@@ -7,7 +7,8 @@ THREE.RenderableParticle = function () {
 	this.x;
 	this.x;
 	this.y;
 	this.y;
 	this.screenZ;
 	this.screenZ;
-	
+
 	this.color;
 	this.color;
 	this.material;
 	this.material;
+
 }
 }

+ 2 - 1
utils/deployer.py

@@ -3,7 +3,7 @@ import os
 
 
 # MERGER
 # MERGER
 
 
-rev = 7;
+rev = 8;
 
 
 files = [];
 files = [];
 files.append('Three.js');
 files.append('Three.js');
@@ -26,6 +26,7 @@ files.append('materials/ColorFillMaterial.js');
 files.append('materials/ColorStrokeMaterial.js');
 files.append('materials/ColorStrokeMaterial.js');
 files.append('materials/FaceColorFillMaterial.js');
 files.append('materials/FaceColorFillMaterial.js');
 files.append('materials/FaceColorStrokeMaterial.js');
 files.append('materials/FaceColorStrokeMaterial.js');
+files.append('materials/TextureUVMappingMaterial.js');
 files.append('scenes/Scene.js');
 files.append('scenes/Scene.js');
 files.append('renderers/Renderer.js');
 files.append('renderers/Renderer.js');
 files.append('renderers/CanvasRenderer.js');
 files.append('renderers/CanvasRenderer.js');

Some files were not shown because too many files changed in this diff