Browse Source

* Refactored `CanvasRenderer` (more duplicated code, but easier to handle)
* `Face4` now supports `MeshBitmapUVMappingMaterial`
* Changed order of `*StrokeMaterial` parameters. Now it's `color`, `opacity`, `lineWidth`.
* `BitmapUVMappingMaterial` > `MeshBitmapUVMappingMaterial`
* `ColorFillMaterial` > `MeshColorFillMaterial`
* `ColorStrokeMaterial` > `MeshColorStrokeMaterial`
* `FaceColorFillMaterial` > `MeshFaceColorFillMaterial`
* `FaceColorStrokeMaterial` > `MeshFaceColorStrokeMaterial`
* `ColorStrokeMaterial` > `LineColorMaterial`
* `Rectangle.instersects` returned false with rectangles with 0px witdh or height

Mr.doob 15 years ago
parent
commit
8f543db16d
39 changed files with 3296 additions and 874 deletions
  1. 23 6
      README.md
  2. 0 1
      build/three.js
  3. 0 1
      build/three_debug.js
  4. 275 0
      examples/camera_free.html
  5. 131 0
      examples/cameras/FreeCamera.js
  6. 6 6
      examples/geometry_cube.html
  7. 2 1
      examples/geometry_terrain.html
  8. 4 3
      examples/geometry_vr.html
  9. 2 2
      examples/lines_sphere.html
  10. 143 0
      examples/lines_test.html
  11. 2 2
      examples/materials_video.html
  12. 1457 0
      examples/objects/Qrcode.js
  13. 158 0
      examples/particles.html
  14. 10 7
      examples/primitives/Cube.js
  15. 21 19
      examples/primitives/Cylinder.js
  16. 6 13
      examples/primitives/Plane.js
  17. 231 0
      examples/test.html
  18. 46 0
      src/core/Geometry.js
  19. 174 148
      src/core/Matrix4.js
  20. 0 247
      src/core/Matrix4.old.js
  21. 1 1
      src/core/Rectangle.js
  22. 51 51
      src/core/Vector2.js
  23. 103 95
      src/core/Vector3.js
  24. 46 46
      src/core/Vector4.js
  25. 0 15
      src/materials/BitmapUVMappingMaterial.js
  26. 0 13
      src/materials/FaceColorFillMaterial.js
  27. 0 15
      src/materials/FaceColorStrokeMaterial.js
  28. 2 2
      src/materials/LineColorMaterial.js
  29. 15 0
      src/materials/MeshBitmapUVMappingMaterial.js
  30. 2 2
      src/materials/MeshColorFillMaterial.js
  31. 17 0
      src/materials/MeshColorStrokeMaterial.js
  32. 13 0
      src/materials/MeshFaceColorFillMaterial.js
  33. 15 0
      src/materials/MeshFaceColorStrokeMaterial.js
  34. 304 131
      src/renderers/CanvasRenderer.js
  35. 14 27
      src/renderers/Renderer.js
  36. 4 4
      src/renderers/SVGRenderer.js
  37. 2 2
      src/renderers/WebGLRenderer.js
  38. 8 7
      utils/deployer.py
  39. 8 7
      utils/deployer_debug.py

+ 23 - 6
README.md

@@ -23,6 +23,8 @@ Other similar projects: [pre3d](http://deanm.github.com/pre3d/), [pvjs](http://c
 [![particles_wave](http://github.com/mrdoob/three.js/raw/master/assets/examples/01_waves.png)](http://mrdoob.com/projects/three.js/examples/particles_waves.html)
 [![particles_floor](http://github.com/mrdoob/three.js/raw/master/assets/examples/00_floor.png)](http://mrdoob.com/projects/three.js/examples/particles_floor.html)
 
+### Featured projects ###
+
 [![Rat](http://github.com/mrdoob/three.js/raw/master/assets/projects/06_rat.png)](http://tech.lab212.org/2010/07/export-textured-models-from-blender2-5-to-three-js/)
 [![Failure](http://github.com/mrdoob/three.js/raw/master/assets/projects/05_failure.png)](http://www.is-real.net/experiments/three/failure/)
 [![Space Cannon 3D](http://github.com/mrdoob/three.js/raw/master/assets/projects/02_spacecannon.png)](http://labs.brian-stoner.com/spacecannon/)
@@ -94,14 +96,15 @@ For creating a customised version of the library, including the source files in
 	<script type="text/javascript" src="js/three/core/Geometry.js"></script>
 	<script type="text/javascript" src="js/three/cameras/Camera.js"></script>
 	<script type="text/javascript" src="js/three/objects/Object3D.js"></script>
+	<script type="text/javascript" src="js/three/objects/Line.js"></script>
 	<script type="text/javascript" src="js/three/objects/Mesh.js"></script>
 	<script type="text/javascript" src="js/three/objects/Particle.js"></script>
-	<script type="text/javascript" src="js/three/objects/Line.js"></script>
-	<script type="text/javascript" src="js/three/materials/BitmapUVMappingMaterial.js"></script>
-	<script type="text/javascript" src="js/three/materials/ColorFillMaterial.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/FaceColorStrokeMaterial.js"></script>
+	<script type="text/javascript" src="js/three/materials/LineColorMaterial.js"></script>
+	<script type="text/javascript" src="js/three/materials/MeshBitmapUVMappingMaterial.js"></script>
+	<script type="text/javascript" src="js/three/materials/MeshColorFillMaterial.js"></script>
+	<script type="text/javascript" src="js/three/materials/MeshColorStrokeMaterial.js"></script>
+	<script type="text/javascript" src="js/three/materials/MeshFaceColorFillMaterial.js"></script>
+	<script type="text/javascript" src="js/three/materials/MeshFaceColorStrokeMaterial.js"></script>
 	<script type="text/javascript" src="js/three/materials/ParticleBitmapMaterial.js"></script>
 	<script type="text/javascript" src="js/three/materials/ParticleCircleMaterial.js"></script>
 	<script type="text/javascript" src="js/three/scenes/Scene.js"></script>
@@ -124,6 +127,20 @@ Thanks to the power of the internets (and github <3) these people have kindly he
 
 ### Change Log ###
 
+2010 07 17 - **r14** (32.162 kb)
+
+* Refactored `CanvasRenderer` (more duplicated code, but easier to handle)
+* `Face4` now supports `MeshBitmapUVMappingMaterial`
+* Changed order of `*StrokeMaterial` parameters. Now it's `color`, `opacity`, `lineWidth`.
+* `BitmapUVMappingMaterial` > `MeshBitmapUVMappingMaterial`
+* `ColorFillMaterial` > `MeshColorFillMaterial`
+* `ColorStrokeMaterial` > `MeshColorStrokeMaterial`
+* `FaceColorFillMaterial` > `MeshFaceColorFillMaterial`
+* `FaceColorStrokeMaterial` > `MeshFaceColorStrokeMaterial`
+* `ColorStrokeMaterial` > `LineColorMaterial`
+* `Rectangle.instersects` returned false with rectangles with 0px witdh or height
+
+
 2010 07 12 - **r13** (29.492 kb)
 
 * Added `ParticleCircleMaterial` and `ParticleBitmapMaterial`

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


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


+ 275 - 0
examples/camera_free.html

@@ -0,0 +1,275 @@
+<!DOCTYPE HTML>
+<html lang="en">
+	<head>
+		<title>three.js - geometry - cube</title>
+		<meta charset="utf-8">
+		<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;"/>
+		<style type="text/css">
+			body {
+				font-family: Monospace;
+				background-color: #f0f0f0;
+				margin: 0px;
+				overflow: hidden;
+			}
+		</style>
+	</head>
+	<body>
+
+		<!-- <script type="text/javascript" src="../build/three.js"></script> -->
+
+		<script type="text/javascript" src="../src/Three.js"></script>
+		<script type="text/javascript" src="../src/core/Color.js"></script>
+		<script type="text/javascript" src="../src/core/Vector2.js"></script>
+		<script type="text/javascript" src="../src/core/Vector3.js"></script>
+		<script type="text/javascript" src="../src/core/Vector4.js"></script>
+		<script type="text/javascript" src="../src/core/Rectangle.js"></script>
+		<script type="text/javascript" src="../src/core/Matrix4.js"></script>
+		<script type="text/javascript" src="../src/core/Vertex.js"></script>
+		<script type="text/javascript" src="../src/core/Face3.js"></script>
+		<script type="text/javascript" src="../src/core/Face4.js"></script>
+		<script type="text/javascript" src="../src/core/Geometry.js"></script>
+		<script type="text/javascript" src="../src/cameras/Camera.js"></script>
+		<script type="text/javascript" src="../src/objects/Object3D.js"></script>
+		<script type="text/javascript" src="../src/objects/Mesh.js"></script>
+		<script type="text/javascript" src="../src/objects/Particle.js"></script>
+		<script type="text/javascript" src="../src/objects/Line.js"></script>
+		<script type="text/javascript" src="../src/materials/LineColorMaterial.js"></script>
+		<script type="text/javascript" src="../src/materials/MeshBitmapUVMappingMaterial.js"></script>
+		<script type="text/javascript" src="../src/materials/MeshColorFillMaterial.js"></script>
+		<script type="text/javascript" src="../src/materials/MeshColorStrokeMaterial.js"></script>
+		<script type="text/javascript" src="../src/materials/MeshFaceColorFillMaterial.js"></script>
+		<script type="text/javascript" src="../src/materials/MeshFaceColorStrokeMaterial.js"></script>
+		<script type="text/javascript" src="../src/materials/ParticleCircleMaterial.js"></script>
+		<script type="text/javascript" src="../src/materials/ParticleBitmapMaterial.js"></script>
+		<script type="text/javascript" src="../src/scenes/Scene.js"></script>
+		<script type="text/javascript" src="../src/renderers/Renderer.js"></script>
+		<script type="text/javascript" src="../src/renderers/CanvasRenderer.js"></script>
+		<script type="text/javascript" src="../src/renderers/SVGRenderer.js"></script>
+		<script type="text/javascript" src="../src/renderers/WebGLRenderer.js"></script>
+		<script type="text/javascript" src="../src/renderers/renderables/RenderableFace3.js"></script>
+		<script type="text/javascript" src="../src/renderers/renderables/RenderableFace4.js"></script>
+		<script type="text/javascript" src="../src/renderers/renderables/RenderableParticle.js"></script>
+		<script type="text/javascript" src="../src/renderers/renderables/RenderableLine.js"></script>
+
+		<script type="text/javascript" src="cameras/FreeCamera.js"></script>
+
+		<script type="text/javascript" src="primitives/Cube.js"></script>
+		<script type="text/javascript" src="primitives/Plane.js"></script>
+
+		<script type="text/javascript" src="http://github.com/mrdoob/stats.js/raw/master/build/stats.js"></script>
+
+		<script type="text/javascript">
+
+			var SCREEN_WIDTH = window.innerWidth;
+			var SCREEN_HEIGHT = window.innerHeight;
+
+			var container;
+			var stats;
+
+			var camera;
+			var scene;
+			var renderer;
+
+			var cube, plane;
+
+			var targetRotation = 0;
+			var targetRotationOnMouseDown = 0;
+
+			var mouseX = 0;
+			var mouseXOnMouseDown = 0;
+
+			var windowHalfX = window.innerWidth / 2;
+			var windowHalfY = window.innerHeight / 2;
+
+			var moveForward = false,
+			moveBackwards = false,
+			moveUp = false,
+			moveDown = false,
+			moveLeft = false,
+			moveRight = false,
+
+			yawLeft = false,
+			yawRight = false,
+			pitchUp = false,
+			pitchDown = false,
+			rollLeft = false,
+			rollRight = false;
+
+			var debugContext;
+
+			init();
+			setInterval(loop, 1000/60);
+
+			function init() {
+
+				container = document.createElement('div');
+				document.body.appendChild(container);
+
+				camera = new THREE.Camera( 45, SCREEN_WIDTH / SCREEN_HEIGHT, 1, 10000 );
+				camera.position.y = 150;
+				camera.position.z = 400;
+				camera.target.position.y = 150;
+
+				scene = new THREE.Scene();
+
+				// Cube
+
+				geometry = new Cube(200, 200, 200);
+
+				for (var i = 0; i < geometry.faces.length; i++) {
+
+					geometry.faces[i].color.setRGBA( Math.random() * 0.5, Math.random() * 0.5 + 0.5, Math.random() * 0.5 + 0.5, 1 );
+				}
+
+				for (var i = 0; i < 10; i ++ ) {
+
+					cube = new THREE.Mesh(geometry, new THREE.MeshFaceColorFillMaterial() );
+
+					cube.position.x = Math.random() * 1000 - 500;
+					cube.position.y = Math.random() * 1000 - 500;
+					cube.position.z = Math.random() * 1000 - 500;
+
+					cube.rotation.x = Math.random() * 200 - 100;
+					cube.rotation.y = Math.random() * 200 - 100;
+					cube.rotation.z = Math.random() * 200 - 100;
+
+					cube.scale.x = cube.scale.y = cube.scale.z = Math.random() + 0.5;
+
+					scene.add(cube);
+
+				}
+
+				// Plane
+
+				plane = new THREE.Mesh( new Plane( 1000, 1000, 10, 10 ), new THREE.MeshColorStrokeMaterial( 0x000000, 0.5, 1 ) );
+				plane.rotation.x = -90 * (Math.PI / 180);
+				scene.add(plane);
+
+				renderer = new THREE.CanvasRenderer();
+				renderer.setSize(SCREEN_WIDTH, SCREEN_HEIGHT);
+				renderer.autoClear = false;
+
+				container.appendChild(renderer.domElement);
+
+				var debugCanvas = document.createElement( 'canvas' );
+				debugCanvas.width = 512;
+				debugCanvas.height = 512;
+				debugCanvas.style.position = 'absolute';
+				debugCanvas.style.top = '0px';
+				debugCanvas.style.left = '0px';
+
+				container.appendChild( debugCanvas );
+
+				debugContext = debugCanvas.getContext( '2d' );
+				debugContext.setTransform( 1, 0, 0, 1, 256, 256 );
+				debugContext.strokeStyle = '#000000';
+
+				stats = new Stats();
+				stats.domElement.style.position = 'absolute';
+				stats.domElement.style.top = '0px';
+				container.appendChild(stats.domElement);
+
+				document.addEventListener('keydown', onDocumentKeyDown, false);
+				document.addEventListener('keyup', onDocumentKeyUp, false);
+			}
+
+			function onDocumentKeyDown( event ) {
+
+				switch( event.keyCode ) {
+
+					case 38: moveForward = true; break; // up
+					case 40: moveBackwards = true; break; // down
+					case 37: moveLeft = true; break; // left
+					case 39: moveRight = true; break; // right
+					case 65: yawLeft = true; break; // a
+					case 68: yawRight = true; break; // d
+					case 87: moveUp/*pitchUp*/ = true; break; // w
+					case 83: moveDown/*pitchDown*/ = true; break; // s
+					case 90: rollLeft = true; break; // z
+					case 67: rollRight = true; break; // c
+
+				}
+
+			}
+
+			function onDocumentKeyUp( event ) {
+
+				switch( event.keyCode ) {
+
+					case 38: moveForward = false; break; // up
+					case 40: moveBackwards = false; break; // down
+					case 37: moveLeft = false; break; // left
+					case 39: moveRight = false; break; // right
+					case 65: yawLeft = false; break; // a
+					case 68: yawRight = false; break; // d
+					case 87: moveUp/*pitchUp*/ = false; break; // w
+					case 83: moveDown/*pitchDown*/ = false; break; // s
+					case 90: rollLeft = false; break; // z
+					case 67: rollRight = false; break; // c
+
+				}
+
+			}
+
+			//
+
+			function loop() {
+
+				if ( moveForward ) camera.position.z -= 5; // camera.moveZ( 5 );
+				if ( moveBackwards ) camera.position.z += 5; // camera.moveZ( - 5 );
+
+				if ( moveUp ) camera.position.y += 5; // camera.moveZ( 5 );
+				if ( moveDown ) camera.position.y -= 5; // camera.moveZ( - 5 );
+
+				if ( moveLeft ) camera.position.x -= 5; // camera.moveX( - 5 );
+				if ( moveRight ) camera.position.x += 5; // camera.moveX( 5 );
+
+				if ( pitchUp ) camera.rotation.x += 0.01; // camera.rotateX( 1 );
+				if ( pitchDown ) camera.rotation.x -= 0.01; // camera.rotateX( - 1 );
+
+				if ( yawLeft ) camera.target.position.x -= 5; // camera.rotation.y += 0.01; // camera.rotateY( 1 );
+				if ( yawRight ) camera.target.position.x += 5; // camera.rotation.y -= 0.01; // camera.rotateY( - 1 );
+
+				if ( rollLeft ) camera.rotation.z += 0.01; // camera.rotateZ( 1 );
+				if ( rollRight ) camera.rotation.z -= 0.01; // camera.rotateZ( - 1 );
+
+				debugContext.clearRect( -256, -256, 512, 512 );
+
+				debugContext.beginPath();
+
+				// center
+				debugContext.moveTo( -10, 0 );
+				debugContext.lineTo( 10, 0 );
+				debugContext.moveTo( 0, -10 );
+				debugContext.lineTo( 0, 10 );
+
+				// camera
+
+				debugContext.moveTo( camera.position.x * 0.1, camera.position.z * 0.1 );
+				debugContext.lineTo( camera.target.position.x * 0.1, camera.target.position.z * 0.1 );
+				debugContext.rect( camera.position.x * 0.1 - 5, camera.position.z * 0.1 - 5, 10, 10 );
+				debugContext.rect( camera.target.position.x * 0.1 - 5, camera.target.position.z * 0.1 - 5, 10, 10 );
+				debugContext.rect( - 50, - 50, 100, 100 );
+
+				for ( var i = 0; i < scene.objects.length; i++ ) {
+
+					var object = scene.objects[i];
+
+					debugContext.rect( object.position.x * 0.1 - 5, object.position.z * 0.1 - 5, 10, 10 );
+
+				}
+
+
+				debugContext.closePath();
+				debugContext.stroke();
+
+				renderer.clear();
+				renderer.render(scene, camera);
+
+				stats.update();
+			}
+
+		</script>
+
+	</body>
+</html>

+ 131 - 0
examples/cameras/FreeCamera.js

@@ -0,0 +1,131 @@
+/**
+ * @author mr.doob / http://mrdoob.com/
+ */
+
+THREE.FreeCamera = function ( x, y, z ) {
+
+	THREE.Camera.call( this, x, y, z );
+
+	this.rotation = new THREE.Vector3( 0, 0, 0 );
+
+	this.moveZ = function ( amount ) {
+
+		direction.set( this.matrix.n11, this.target.position, this.position );
+		depth = direction.length();
+
+		direction.normalize();
+
+		vector.copy( direction );
+		vector.multiplyScalar( amount );
+
+		direction.multiplyScalar( depth );
+
+		this.position.addSelf( vector );
+		this.target.position.add( this.position, direction );
+
+	};
+
+	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 ) );
+	};
+
+	/*
+	var depth = 0;
+	var vector = new THREE.Vector3();
+	var direction = new THREE.Vector3();
+
+	this.moveX = function ( amount ) {
+
+		direction.sub( this.target.position, this.position );
+		depth = direction.length();
+
+		direction.normalize();
+
+		vector.copy( this.up );
+		vector.crossSelf( direction );
+		vector.multiplyScalar( amount );
+
+		direction.multiplyScalar( depth );
+
+		this.position.subSelf( vector );
+		this.target.position.add( this.position, direction );
+
+	};
+
+	this.moveZ = function ( amount ) {
+
+		direction.sub( this.target.position, this.position );
+		depth = direction.length();
+
+		direction.normalize();
+
+		vector.copy( direction );
+		vector.multiplyScalar( amount );
+
+		direction.multiplyScalar( depth );
+
+		this.position.addSelf( vector );
+		this.target.position.add( this.position, direction );
+
+	};
+
+	this.rotateX = function( amount ) { // pitch
+
+		amount *= Math.PI / 180;
+
+		vector.x = direction.x;
+		vector.y = ( direction.y * Math.cos( amount ) ) - ( direction.z * Math.sin( amount ) );
+		vector.z = ( direction.y * Math.sin( amount ) ) + ( direction.z * Math.cos( amount ) );
+
+		direction.copy( vector );
+
+		vector.set( direction.x, direction.y, direction.z );
+		vector.multiplyScalar( 400 );
+
+		this.target.position.copy( this.position );
+		this.target.position.addSelf( vector );
+
+	};
+
+	this.rotateY = function( amount ) { // yaw
+
+		amount *= Math.PI / 180;
+
+		direction.sub( this.position, this.target.position );
+		depth = direction.length();
+
+		direction.normalize();
+
+		vector.x = ( direction.z * Math.sin( amount ) ) + ( direction.x * Math.cos( amount ) );
+		vector.y = direction.y;
+		vector.z = ( direction.z * Math.cos( amount ) ) - ( direction.x * Math.sin( amount ) );
+
+		direction.copy( vector );
+		direction.multiplyScalar( depth );
+
+		this.target.position.sub( this.position, direction );
+
+	};
+
+	this.rotateZ = function( amount ) { // roll
+
+		amount *= Math.PI / 180;
+
+		vector.x = ( this.up.x * Math.cos( amount ) ) - ( this.up.y * Math.sin( amount ) );
+		vector.y = ( this.up.x * Math.sin( amount ) ) + ( this.up.y * Math.cos( amount ) );
+		vector.z = this.up.z;
+
+		this.up.copy( vector );
+
+	};
+	*/
+};
+
+THREE.FreeCamera.prototype = new THREE.Camera();
+THREE.FreeCamera.prototype.constructor = THREE.FreeCamera;

+ 6 - 6
examples/geometry_cube.html

@@ -70,22 +70,22 @@
 
 				// Cube
 
-				geometry = new Cube(200, 200, 200);
+				geometry = new Cube( 200, 200, 200 );
 
 				for (var i = 0; i < geometry.faces.length; i++) {
 
 					geometry.faces[i].color.setRGBA( Math.random() * 0.5, Math.random() * 0.5 + 0.5, Math.random() * 0.5 + 0.5, 1 );
 				}
 
-				cube = new THREE.Mesh(geometry, new THREE.FaceColorFillMaterial());
+				cube = new THREE.Mesh(geometry, new THREE.MeshFaceColorFillMaterial() );
 				cube.position.y = 150;
-				scene.add(cube);
+				scene.addObject(cube);
 
 				// Plane
 
-				plane = new THREE.Mesh(new Plane(200, 200), new THREE.ColorFillMaterial(0xe0e0e0));
-				plane.rotation.x = -90 * (Math.PI / 180);
-				scene.add(plane);
+				plane = new THREE.Mesh( new Plane( 200, 200, 4, 4 ), new THREE.MeshColorFillMaterial( 0xe0e0e0 ) );
+				plane.rotation.x = -90 * ( Math.PI / 180 );
+				scene.addObject(plane);
 
 				renderer = new THREE.CanvasRenderer();
 				renderer.setSize(SCREEN_WIDTH, SCREEN_HEIGHT);

+ 2 - 1
examples/geometry_terrain.html

@@ -34,6 +34,7 @@
 		<div id="info"><a href="http://github.com/mrdoob/three.js" target="_blank">three.js</a> - terrain demo. <a href="geometry_terrain.html">generate another</a></div> 
 
 		<script type="text/javascript" src="http://github.com/mrdoob/stats.js/raw/master/build/stats.js"></script>
+
 		<script type="text/javascript" src="../build/three.js"></script>
 
 		<script type="text/javascript" src="primitives/Plane.js"></script>
@@ -144,7 +145,7 @@
 
 				var heightMap = height( 1024, 1024 );
 				var textureMap = shadow( heightMap );
-				var material = new THREE.BitmapUVMappingMaterial( textureMap );
+				var material = new THREE.MeshBitmapUVMappingMaterial( textureMap );
 
 				var quality = 20;
 				var quality1 = quality + 1;

+ 4 - 3
examples/geometry_vr.html

@@ -31,6 +31,7 @@
 		<div id="info"><a href="http://github.com/mrdoob/three.js" target="_blank">three.js</a> - vr demo. skybox by <a href="http://www.zfight.com/" target="_blank">Jochum Skoglund</a></div>
 
 		<script type="text/javascript" src="../build/three.js"></script>
+
 		<script type="text/javascript" src="primitives/Plane.js"></script>
 
 		<script type="text/javascript">
@@ -62,7 +63,7 @@
 				texture_placeholder.width = 128;
 				texture_placeholder.height = 128;
 
-				wireframe = new THREE.ColorStrokeMaterial( 1, 0xffffff, 0 );
+				wireframe = new THREE.MeshColorStrokeMaterial( 0xffffff, 0 );
 
 				var context = texture_placeholder.getContext( '2d' );
 				context.fillStyle = 'rgba( 200, 200, 200, 1 )';
@@ -120,7 +121,7 @@
 
 			function loadTexture( path ) {
 
-				var material = new THREE.BitmapUVMappingMaterial( texture_placeholder );
+				var material = new THREE.MeshBitmapUVMappingMaterial( texture_placeholder );
 
 				var texture = new Image();
 
@@ -168,7 +169,7 @@
 
 				isUserInteracting = false;
 
-				wireframe.color.setRGBA(255, 255, 255, 0);
+				wireframe.color.setRGBA( 1, 1, 1, 0);
 
 				render();
 			}

+ 2 - 2
examples/lines_sphere.html

@@ -80,7 +80,7 @@
 
 					var geometry = new THREE.Geometry();
 
-					var vector = new THREE.Vector3(Math.random() * 2 - 1, Math.random() * 2 - 1, Math.random() * 2 - 1);
+					var vector = new THREE.Vector3( Math.random() * 2 - 1, Math.random() * 2 - 1, Math.random() * 2 - 1 );
 					vector.normalize();
 					vector.multiplyScalar(450);
 
@@ -91,7 +91,7 @@
 
 					geometry.vertices.push(new THREE.Vertex(vector2));
 
-					var line = new THREE.Line(geometry, new THREE.ColorStrokeMaterial(1, 0xffffff, Math.random()));
+					var line = new THREE.Line( geometry, new THREE.LineColorMaterial( 0xffffff, Math.random() ) );
 					scene.add(line);
 				}
 

+ 143 - 0
examples/lines_test.html

@@ -0,0 +1,143 @@
+<!DOCTYPE HTML>
+<html lang="en">
+	<head>
+		<title>three.js - particles - floor</title>
+		<meta charset="utf-8">
+		<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;"/>
+		<style type="text/css">
+			body {
+				background-color: #000000;
+				margin: 0px;
+				overflow: hidden;
+			}
+
+			a {
+				color:#0078ff;
+			}
+		</style>
+	</head>
+	<body>
+
+		<script type="text/javascript" src="../build/three.js"></script> 
+
+		<script type="text/javascript">
+
+			var SCREEN_WIDTH = window.innerWidth,
+			SCREEN_HEIGHT = window.innerHeight,
+
+			mouseX = 0, mouseY = 0,
+
+			windowHalfX = window.innerWidth / 2,
+			windowHalfY = window.innerHeight / 2,
+
+			SEPARATION = 200,
+			AMOUNTX = 10,
+			AMOUNTY = 10,
+
+			camera, scene, renderer,
+
+			stats;
+
+			init();
+			setInterval(loop, 1000 / 60);
+
+			function init() {
+
+				var container, separation = 100, amountX = 50, amountY = 50,
+				particles, particle, material;
+
+				container = document.createElement('div');
+				document.body.appendChild(container);
+
+				camera = new THREE.Camera( 75, SCREEN_WIDTH / SCREEN_HEIGHT, 1, 10000 );
+				camera.position.z = 1000;
+
+				scene = new THREE.Scene();
+
+				renderer = new THREE.CanvasRenderer();
+				renderer.setSize(SCREEN_WIDTH, SCREEN_HEIGHT);
+				container.appendChild(renderer.domElement);
+
+				// particles
+
+				material = new THREE.ParticleCircleMaterial( 0xffffff, 1 );
+				var geometry = new THREE.Geometry();
+
+				for (var i = 0; i < 100; i++) {
+
+					particle = new THREE.Particle( material );
+					particle.position.x = Math.random() * 2 - 1;
+					particle.position.y = Math.random() * 2 - 1;
+					particle.position.z = Math.random() * 2 - 1;
+					particle.position.normalize();
+					particle.position.multiplyScalar(Math.random() * 10 + 450);
+					particle.scale.x = particle.scale.y = 5;
+					scene.add( particle );
+
+					geometry.vertices.push( new THREE.Vertex( particle.position ) );
+
+				}
+
+				// lines
+
+				var line = new THREE.Line( geometry, new THREE.LineColorMaterial( 0xffffff, Math.random(), 1 ) );
+				scene.add(line);
+
+				/*
+				stats = new Stats();
+				stats.domElement.style.position = 'absolute';
+				stats.domElement.style.top = '0px';
+				container.appendChild(stats.domElement);
+				*/
+
+				document.addEventListener('mousemove', onDocumentMouseMove, false);
+				document.addEventListener('touchstart', onDocumentTouchStart, false);
+				document.addEventListener('touchmove', onDocumentTouchMove, false);
+			}
+
+			//
+
+			function onDocumentMouseMove(event) {
+
+				mouseX = event.clientX - windowHalfX;
+				mouseY = event.clientY - windowHalfY;
+			}
+
+			function onDocumentTouchStart( event ) {
+
+				if(event.touches.length > 1) {
+
+					event.preventDefault();
+
+					mouseX = event.touches[0].pageX - windowHalfX;
+					mouseY = event.touches[0].pageY - windowHalfY;
+				}
+			}
+
+			function onDocumentTouchMove( event ) {
+
+				if(event.touches.length == 1) {
+
+					event.preventDefault();
+
+					mouseX = event.touches[0].pageX - windowHalfX;
+					mouseY = event.touches[0].pageY - windowHalfY;
+				}
+			}
+
+			//
+
+			function loop() {
+
+				camera.position.x += (mouseX - camera.position.x) * .05;
+				camera.position.y += (-mouseY + 200 - camera.position.y) * .05;
+				camera.updateMatrix();
+
+				renderer.render(scene, camera);
+
+				// stats.update();
+			}
+
+		</script>
+	</body>
+</html>

+ 2 - 2
examples/materials_video.html

@@ -83,7 +83,7 @@
 				textureContext.fillStyle = '#000000';
 				textureContext.fillRect( 0, 0, 480, 204 );
 
-				var material = new THREE.BitmapUVMappingMaterial( texture );
+				var material = new THREE.MeshBitmapUVMappingMaterial( texture );
 
 				textureReflection = document.createElement( 'canvas' );
 				textureReflection.width = 480;
@@ -97,7 +97,7 @@
 				textureReflectionGradient.addColorStop( 0.2, 'rgba(240, 240, 240, 1)' );
 				textureReflectionGradient.addColorStop( 1, 'rgba(240, 240, 240, 0.8)' );
 
-				var materialReflection = new THREE.BitmapUVMappingMaterial( textureReflection );
+				var materialReflection = new THREE.MeshBitmapUVMappingMaterial( textureReflection );
 
 				//
 

+ 1457 - 0
examples/objects/Qrcode.js

@@ -0,0 +1,1457 @@
+var Qrcode = function () {
+
+	THREE.Geometry.call(this);
+
+	var scope = this;
+
+	v(-54,134,58);
+	v(-54,146,58);
+	v(-42,146,58);
+	v(-42,134,58);
+	v(-42,158,58);
+	v(-18,158,58);
+	v(-18,146,58);
+	v(-66,-57,58);
+	v(-66,-141,58);
+	v(-150,-141,58);
+	v(-150,-57,58);
+	v(-138,-129,58);
+	v(-78,-129,58);
+	v(-78,-69,58);
+	v(-138,-69,58);
+	v(-90,-81,58);
+	v(-90,-117,58);
+	v(-126,-117,58);
+	v(-126,-81,58);
+	v(-6,146,58);
+	v(-6,122,58);
+	v(-18,122,58);
+	v(6,146,58);
+	v(6,158,58);
+	v(-6,158,58);
+	v(6,122,58);
+	v(6,74,58);
+	v(-6,74,58);
+	v(-6,86,58);
+	v(-18,86,58);
+	v(-18,74,58);
+	v(-30,74,58);
+	v(-30,86,58);
+	v(-42,86,58);
+	v(-42,98,58);
+	v(-30,98,58);
+	v(-30,122,58);
+	v(-18,98,58);
+	v(-6,98,58);
+	v(18,74,58);
+	v(18,2,58);
+	v(30,2,58);
+	v(30,50,58);
+	v(42,50,58);
+	v(42,38,58);
+	v(54,38,58);
+	v(54,26,58);
+	v(66,26,58);
+	v(66,38,58);
+	v(78,38,58);
+	v(78,2,58);
+	v(66,2,58);
+	v(66,14,58);
+	v(54,14,58);
+	v(54,-9,58);
+	v(66,-9,58);
+	v(66,-33,58);
+	v(78,-33,58);
+	v(78,-21,58);
+	v(90,-21,58);
+	v(90,-33,58);
+	v(102,-33,58);
+	v(102,-57,58);
+	v(114,-57,58);
+	v(114,-69,58);
+	v(102,-69,58);
+	v(102,-81,58);
+	v(114,-81,58);
+	v(114,-105,58);
+	v(102,-105,58);
+	v(102,-93,58);
+	v(78,-93,58);
+	v(78,-105,58);
+	v(66,-105,58);
+	v(66,-117,58);
+	v(54,-117,58);
+	v(54,-93,58);
+	v(30,-93,58);
+	v(30,-105,58);
+	v(18,-105,58);
+	v(18,-69,58);
+	v(30,-69,58);
+	v(30,-81,58);
+	v(42,-81,58);
+	v(42,-33,58);
+	v(54,-33,58);
+	v(54,-21,58);
+	v(42,-21,58);
+	v(30,-33,58);
+	v(30,-9,58);
+	v(-18,-9,58);
+	v(-18,-21,58);
+	v(-30,-21,58);
+	v(-30,-33,58);
+	v(-42,-33,58);
+	v(-42,-21,58);
+	v(-54,-21,58);
+	v(-54,2,58);
+	v(-42,2,58);
+	v(-42,-9,58);
+	v(-30,-9,58);
+	v(-30,2,58);
+	v(-6,2,58);
+	v(-6,14,58);
+	v(6,14,58);
+	v(18,86,58);
+	v(30,86,58);
+	v(30,74,58);
+	v(42,74,58);
+	v(42,86,58);
+	v(54,86,58);
+	v(54,62,58);
+	v(78,62,58);
+	v(78,50,58);
+	v(42,62,58);
+	v(30,62,58);
+	v(90,50,58);
+	v(90,62,58);
+	v(114,62,58);
+	v(114,50,58);
+	v(126,50,58);
+	v(126,62,58);
+	v(138,62,58);
+	v(138,38,58);
+	v(114,38,58);
+	v(114,26,58);
+	v(138,26,58);
+	v(150,38,58);
+	v(150,2,58);
+	v(138,2,58);
+	v(138,14,58);
+	v(102,14,58);
+	v(102,38,58);
+	v(138,-9,58);
+	v(150,-9,58);
+	v(150,-33,58);
+	v(138,-33,58);
+	v(138,-21,58);
+	v(126,-21,58);
+	v(126,-33,58);
+	v(138,-57,58);
+	v(126,-57,58);
+	v(126,-45,58);
+	v(114,-45,58);
+	v(114,-21,58);
+	v(102,-21,58);
+	v(102,-9,58);
+	v(126,-9,58);
+	v(126,2,58);
+	v(150,-57,58);
+	v(150,-141,58);
+	v(138,-141,58);
+	v(138,-129,58);
+	v(114,-129,58);
+	v(126,-105,58);
+	v(126,-93,58);
+	v(138,-93,58);
+	v(138,-81,58);
+	v(126,-81,58);
+	v(126,-69,58);
+	v(138,-69,58);
+	v(114,-141,58);
+	v(102,-141,58);
+	v(102,-129,58);
+	v(78,-129,58);
+	v(90,-9,58);
+	v(90,2,58);
+	v(102,2,58);
+	v(30,-117,58);
+	v(42,-117,58);
+	v(42,-105,58);
+	v(30,-141,58);
+	v(6,-141,58);
+	v(6,-129,58);
+	v(18,-129,58);
+	v(18,-117,58);
+	v(6,-69,58);
+	v(6,-81,58);
+	v(-18,-81,58);
+	v(-18,-69,58);
+	v(-6,-69,58);
+	v(-6,-57,58);
+	v(18,-57,58);
+	v(-18,-93,58);
+	v(-30,-93,58);
+	v(-30,-117,58);
+	v(-42,-117,58);
+	v(-42,-105,58);
+	v(-54,-105,58);
+	v(-54,-69,58);
+	v(-42,-69,58);
+	v(-42,-57,58);
+	v(-54,-57,58);
+	v(-54,-45,58);
+	v(-30,-45,58);
+	v(-30,-81,58);
+	v(-18,-117,58);
+	v(-6,-117,58);
+	v(-6,-129,58);
+	v(-18,-129,58);
+	v(-6,-105,58);
+	v(6,-105,58);
+	v(6,-117,58);
+	v(-78,-45,58);
+	v(-78,-33,58);
+	v(-66,-33,58);
+	v(-66,-21,58);
+	v(-78,-21,58);
+	v(-78,-9,58);
+	v(-66,-9,58);
+	v(-90,-9,58);
+	v(-90,-21,58);
+	v(-114,-21,58);
+	v(-114,-9,58);
+	v(-102,-9,58);
+	v(-102,14,58);
+	v(-114,14,58);
+	v(-114,2,58);
+	v(-126,2,58);
+	v(-126,26,58);
+	v(-138,26,58);
+	v(-138,38,58);
+	v(-90,38,58);
+	v(-90,26,58);
+	v(-78,26,58);
+	v(-78,14,58);
+	v(-90,14,58);
+	v(-90,2,58);
+	v(-78,2,58);
+	v(-126,-9,58);
+	v(-138,-9,58);
+	v(-138,2,58);
+	v(-150,2,58);
+	v(-150,14,58);
+	v(-138,14,58);
+	v(-90,50,58);
+	v(-114,50,58);
+	v(-114,62,58);
+	v(-66,62,58);
+	v(-66,50,58);
+	v(-78,50,58);
+	v(-78,38,58);
+	v(-54,50,58);
+	v(-54,86,58);
+	v(-42,74,58);
+	v(-30,50,58);
+	v(-42,50,58);
+	v(-42,38,58);
+	v(-54,38,58);
+	v(-54,26,58);
+	v(-66,26,58);
+	v(-66,38,58);
+	v(-18,26,58);
+	v(-18,14,58);
+	v(-30,14,58);
+	v(-42,14,58);
+	v(-54,14,58);
+	v(-18,-57,58);
+	v(-18,-33,58);
+	v(-6,-33,58);
+	v(-6,-21,58);
+	v(18,-21,58);
+	v(18,-33,58);
+	v(30,-57,58);
+	v(18,-45,58);
+	v(6,-45,58);
+	v(6,-33,58);
+	v(-18,62,58);
+	v(-6,62,58);
+	v(-30,134,58);
+	v(-42,122,58);
+	v(54,158,58);
+	v(54,134,58);
+	v(42,134,58);
+	v(42,146,58);
+	v(18,146,58);
+	v(18,158,58);
+	v(42,122,58);
+	v(54,122,58);
+	v(54,98,58);
+	v(42,98,58);
+	v(42,110,58);
+	v(30,110,58);
+	v(30,134,58);
+	v(30,98,58);
+	v(18,98,58);
+	v(18,110,58);
+	v(150,158,58);
+	v(150,74,58);
+	v(66,74,58);
+	v(66,158,58);
+	v(78,86,58);
+	v(138,86,58);
+	v(138,146,58);
+	v(78,146,58);
+	v(126,134,58);
+	v(126,98,58);
+	v(90,98,58);
+	v(90,134,58);
+	v(54,-81,58);
+	v(90,-81,58);
+	v(90,-45,58);
+	v(54,-45,58);
+	v(78,-57,58);
+	v(78,-69,58);
+	v(66,-69,58);
+	v(66,-57,58);
+	v(54,-129,58);
+	v(54,-141,58);
+	v(42,-141,58);
+	v(42,-129,58);
+	v(-66,158,58);
+	v(-66,74,58);
+	v(-150,74,58);
+	v(-150,158,58);
+	v(-138,86,58);
+	v(-78,86,58);
+	v(-78,146,58);
+	v(-138,146,58);
+	v(-126,134,58);
+	v(-90,134,58);
+	v(-90,98,58);
+	v(-126,98,58);
+	v(-126,-21,58);
+	v(-126,-45,58);
+	v(-138,-45,58);
+	v(-138,-21,58);
+	v(-126,62,58);
+	v(-126,50,58);
+	v(-138,50,58);
+	v(-138,62,58);
+	v(-90,-33,58);
+	v(-90,-45,58);
+	v(-114,-45,58);
+	v(-114,-33,58);
+	v(-42,-129,58);
+	v(-54,-129,58);
+	v(-54,-117,58);
+	v(-18,-141,58);
+	v(-42,-141,58);
+	v(-54,98,58);
+	v(-54,122,58);
+	v(-54,134,-41);
+	v(-54,146,-41);
+	v(-42,146,-41);
+	v(-42,134,-41);
+	v(-42,158,-41);
+	v(-18,158,-41);
+	v(-18,146,-41);
+	v(-66,-57,-41);
+	v(-66,-141,-41);
+	v(-150,-141,-41);
+	v(-150,-57,-41);
+	v(-138,-129,-41);
+	v(-78,-129,-41);
+	v(-78,-69,-41);
+	v(-138,-69,-41);
+	v(-90,-81,-41);
+	v(-90,-117,-41);
+	v(-126,-117,-41);
+	v(-126,-81,-41);
+	v(-6,146,-41);
+	v(-6,122,-41);
+	v(-18,122,-41);
+	v(6,146,-41);
+	v(6,158,-41);
+	v(-6,158,-41);
+	v(6,122,-41);
+	v(6,74,-41);
+	v(-6,74,-41);
+	v(-6,86,-41);
+	v(-18,86,-41);
+	v(-18,74,-41);
+	v(-30,74,-41);
+	v(-30,86,-41);
+	v(-42,86,-41);
+	v(-42,98,-41);
+	v(-30,98,-41);
+	v(-30,122,-41);
+	v(-18,98,-41);
+	v(-6,98,-41);
+	v(18,74,-41);
+	v(18,2,-41);
+	v(30,2,-41);
+	v(30,50,-41);
+	v(42,50,-41);
+	v(42,38,-41);
+	v(54,38,-41);
+	v(54,26,-41);
+	v(66,26,-41);
+	v(66,38,-41);
+	v(78,38,-41);
+	v(78,2,-41);
+	v(66,2,-41);
+	v(66,14,-41);
+	v(54,14,-41);
+	v(54,-9,-41);
+	v(66,-9,-41);
+	v(66,-33,-41);
+	v(78,-33,-41);
+	v(78,-21,-41);
+	v(90,-21,-41);
+	v(90,-33,-41);
+	v(102,-33,-41);
+	v(102,-57,-41);
+	v(114,-57,-41);
+	v(114,-69,-41);
+	v(102,-69,-41);
+	v(102,-81,-41);
+	v(114,-81,-41);
+	v(114,-105,-41);
+	v(102,-105,-41);
+	v(102,-93,-41);
+	v(78,-93,-41);
+	v(78,-105,-41);
+	v(66,-105,-41);
+	v(66,-117,-41);
+	v(54,-117,-41);
+	v(54,-93,-41);
+	v(30,-93,-41);
+	v(30,-105,-41);
+	v(18,-105,-41);
+	v(18,-69,-41);
+	v(30,-69,-41);
+	v(30,-81,-41);
+	v(42,-81,-41);
+	v(42,-33,-41);
+	v(54,-33,-41);
+	v(54,-21,-41);
+	v(42,-21,-41);
+	v(30,-33,-41);
+	v(30,-9,-41);
+	v(-18,-9,-41);
+	v(-18,-21,-41);
+	v(-30,-21,-41);
+	v(-30,-33,-41);
+	v(-42,-33,-41);
+	v(-42,-21,-41);
+	v(-54,-21,-41);
+	v(-54,2,-41);
+	v(-42,2,-41);
+	v(-42,-9,-41);
+	v(-30,-9,-41);
+	v(-30,2,-41);
+	v(-6,2,-41);
+	v(-6,14,-41);
+	v(6,14,-41);
+	v(18,86,-41);
+	v(30,86,-41);
+	v(30,74,-41);
+	v(42,74,-41);
+	v(42,86,-41);
+	v(54,86,-41);
+	v(54,62,-41);
+	v(78,62,-41);
+	v(78,50,-41);
+	v(42,62,-41);
+	v(30,62,-41);
+	v(90,50,-41);
+	v(90,62,-41);
+	v(114,62,-41);
+	v(114,50,-41);
+	v(126,50,-41);
+	v(126,62,-41);
+	v(138,62,-41);
+	v(138,38,-41);
+	v(114,38,-41);
+	v(114,26,-41);
+	v(138,26,-41);
+	v(150,38,-41);
+	v(150,2,-41);
+	v(138,2,-41);
+	v(138,14,-41);
+	v(102,14,-41);
+	v(102,38,-41);
+	v(138,-9,-41);
+	v(150,-9,-41);
+	v(150,-33,-41);
+	v(138,-33,-41);
+	v(138,-21,-41);
+	v(126,-21,-41);
+	v(126,-33,-41);
+	v(138,-57,-41);
+	v(126,-57,-41);
+	v(126,-45,-41);
+	v(114,-45,-41);
+	v(114,-21,-41);
+	v(102,-21,-41);
+	v(102,-9,-41);
+	v(126,-9,-41);
+	v(126,2,-41);
+	v(150,-57,-41);
+	v(150,-141,-41);
+	v(138,-141,-41);
+	v(138,-129,-41);
+	v(114,-129,-41);
+	v(126,-105,-41);
+	v(126,-93,-41);
+	v(138,-93,-41);
+	v(138,-81,-41);
+	v(126,-81,-41);
+	v(126,-69,-41);
+	v(138,-69,-41);
+	v(114,-141,-41);
+	v(102,-141,-41);
+	v(102,-129,-41);
+	v(78,-129,-41);
+	v(90,-9,-41);
+	v(90,2,-41);
+	v(102,2,-41);
+	v(30,-117,-41);
+	v(42,-117,-41);
+	v(42,-105,-41);
+	v(30,-141,-41);
+	v(6,-141,-41);
+	v(6,-129,-41);
+	v(18,-129,-41);
+	v(18,-117,-41);
+	v(6,-69,-41);
+	v(6,-81,-41);
+	v(-18,-81,-41);
+	v(-18,-69,-41);
+	v(-6,-69,-41);
+	v(-6,-57,-41);
+	v(18,-57,-41);
+	v(-18,-93,-41);
+	v(-30,-93,-41);
+	v(-30,-117,-41);
+	v(-42,-117,-41);
+	v(-42,-105,-41);
+	v(-54,-105,-41);
+	v(-54,-69,-41);
+	v(-42,-69,-41);
+	v(-42,-57,-41);
+	v(-54,-57,-41);
+	v(-54,-45,-41);
+	v(-30,-45,-41);
+	v(-30,-81,-41);
+	v(-18,-117,-41);
+	v(-6,-117,-41);
+	v(-6,-129,-41);
+	v(-18,-129,-41);
+	v(-6,-105,-41);
+	v(6,-105,-41);
+	v(6,-117,-41);
+	v(-78,-45,-41);
+	v(-78,-33,-41);
+	v(-66,-33,-41);
+	v(-66,-21,-41);
+	v(-78,-21,-41);
+	v(-78,-9,-41);
+	v(-66,-9,-41);
+	v(-90,-9,-41);
+	v(-90,-21,-41);
+	v(-114,-21,-41);
+	v(-114,-9,-41);
+	v(-102,-9,-41);
+	v(-102,14,-41);
+	v(-114,14,-41);
+	v(-114,2,-41);
+	v(-126,2,-41);
+	v(-126,26,-41);
+	v(-138,26,-41);
+	v(-138,38,-41);
+	v(-90,38,-41);
+	v(-90,26,-41);
+	v(-78,26,-41);
+	v(-78,14,-41);
+	v(-90,14,-41);
+	v(-90,2,-41);
+	v(-78,2,-41);
+	v(-126,-9,-41);
+	v(-138,-9,-41);
+	v(-138,2,-41);
+	v(-150,2,-41);
+	v(-150,14,-41);
+	v(-138,14,-41);
+	v(-90,50,-41);
+	v(-114,50,-41);
+	v(-114,62,-41);
+	v(-66,62,-41);
+	v(-66,50,-41);
+	v(-78,50,-41);
+	v(-78,38,-41);
+	v(-54,50,-41);
+	v(-54,86,-41);
+	v(-42,74,-41);
+	v(-30,50,-41);
+	v(-42,50,-41);
+	v(-42,38,-41);
+	v(-54,38,-41);
+	v(-54,26,-41);
+	v(-66,26,-41);
+	v(-66,38,-41);
+	v(-18,26,-41);
+	v(-18,14,-41);
+	v(-30,14,-41);
+	v(-42,14,-41);
+	v(-54,14,-41);
+	v(-18,-57,-41);
+	v(-18,-33,-41);
+	v(-6,-33,-41);
+	v(-6,-21,-41);
+	v(18,-21,-41);
+	v(18,-33,-41);
+	v(30,-57,-41);
+	v(18,-45,-41);
+	v(6,-45,-41);
+	v(6,-33,-41);
+	v(-18,62,-41);
+	v(-6,62,-41);
+	v(-30,134,-41);
+	v(-42,122,-41);
+	v(54,158,-41);
+	v(54,134,-41);
+	v(42,134,-41);
+	v(42,146,-41);
+	v(18,146,-41);
+	v(18,158,-41);
+	v(42,122,-41);
+	v(54,122,-41);
+	v(54,98,-41);
+	v(42,98,-41);
+	v(42,110,-41);
+	v(30,110,-41);
+	v(30,134,-41);
+	v(30,98,-41);
+	v(18,98,-41);
+	v(18,110,-41);
+	v(150,158,-41);
+	v(150,74,-41);
+	v(66,74,-41);
+	v(66,158,-41);
+	v(78,86,-41);
+	v(138,86,-41);
+	v(138,146,-41);
+	v(78,146,-41);
+	v(126,134,-41);
+	v(126,98,-41);
+	v(90,98,-41);
+	v(90,134,-41);
+	v(54,-81,-41);
+	v(90,-81,-41);
+	v(90,-45,-41);
+	v(54,-45,-41);
+	v(78,-57,-41);
+	v(78,-69,-41);
+	v(66,-69,-41);
+	v(66,-57,-41);
+	v(54,-129,-41);
+	v(54,-141,-41);
+	v(42,-141,-41);
+	v(42,-129,-41);
+	v(-66,158,-41);
+	v(-66,74,-41);
+	v(-150,74,-41);
+	v(-150,158,-41);
+	v(-138,86,-41);
+	v(-78,86,-41);
+	v(-78,146,-41);
+	v(-138,146,-41);
+	v(-126,134,-41);
+	v(-90,134,-41);
+	v(-90,98,-41);
+	v(-126,98,-41);
+	v(-126,-21,-41);
+	v(-126,-45,-41);
+	v(-138,-45,-41);
+	v(-138,-21,-41);
+	v(-126,62,-41);
+	v(-126,50,-41);
+	v(-138,50,-41);
+	v(-138,62,-41);
+	v(-90,-33,-41);
+	v(-90,-45,-41);
+	v(-114,-45,-41);
+	v(-114,-33,-41);
+	v(-42,-129,-41);
+	v(-54,-129,-41);
+	v(-54,-117,-41);
+	v(-18,-141,-41);
+	v(-42,-141,-41);
+	v(-54,98,-41);
+	v(-54,122,-41);
+
+	f3(151,150,152,0xff000000);
+	f3(644,398,399,0xff000000);
+	f3(493,494,492,0xff000000);
+	f3(301,65,62,0xff000000);
+	f3(585,375,586,0xff000000);
+	f3(243,244,33,0xff000000);
+	f3(156,149,157,0xff000000);
+	f3(498,499,491,0xff000000);
+	f3(532,537,526,0xff000000);
+	f3(102,90,40,0xff000000);
+	f3(302,57,56,0xff000000);
+	f3(526,529,530,0xff000000);
+	f3(215,219,216,0xff000000);
+	f3(642,413,641,0xff000000);
+	f3(382,432,444,0xff000000);
+	f3(71,300,299,0xff000000);
+	f3(489,480,486,0xff000000);
+	f3(144,138,147,0xff000000);
+	f3(80,182,176,0xff000000);
+	f3(262,261,266,0xff000000);
+	f3(422,518,524,0xff000000);
+	f3(604,608,603,0xff000000);
+	f3(387,388,386,0xff000000);
+	f3(45,44,46,0xff000000);
+	f3(605,524,606,0xff000000);
+	f3(569,552,556,0xff000000);
+	f3(555,556,554,0xff000000);
+	f3(521,522,520,0xff000000);
+	f3(482,483,484,0xff000000);
+	f3(481,484,485,0xff000000);
+	f3(479,475,476,0xff000000);
+	f3(385,456,453,0xff000000);
+	f3(451,452,450,0xff000000);
+	f3(441,437,438,0xff000000);
+	f3(424,425,419,0xff000000);
+	f3(413,414,415,0xff000000);
+	f3(412,408,409,0xff000000);
+	f3(643,404,407,0xff000000);
+	f3(428,396,397,0xff000000);
+	f3(264,182,263,0xff000000);
+	f3(226,223,215,0xff000000);
+	f3(214,210,227,0xff000000);
+	f3(213,212,214,0xff000000);
+	f3(179,178,180,0xff000000);
+	f3(142,141,140,0xff000000);
+	f3(143,142,139,0xff000000);
+	f3(134,133,137,0xff000000);
+	f3(43,111,114,0xff000000);
+	f3(109,108,110,0xff000000);
+	f3(96,95,99,0xff000000);
+	f3(82,77,83,0xff000000);
+	f3(73,72,71,0xff000000);
+	f3(67,66,70,0xff000000);
+	f3(55,54,86,0xff000000);
+	f4(85,56,55,86,0xff000000);
+	f4(69,68,67,70,0xff000000);
+	f4(299,76,73,71,0xff000000);
+	f4(84,302,56,85,0xff000000);
+	f4(114,111,110,108,0xff000000);
+	f4(136,135,134,137,0xff000000);
+	f4(280,279,278,281,0xff000000);
+	f4(427,428,397,398,0xff000000);
+	f4(408,642,643,407,0xff000000);
+	f4(411,412,409,410,0xff000000);
+	f4(641,413,415,418,0xff000000);
+	f4(426,427,398,644,0xff000000);
+	f4(456,450,452,453,0xff000000);
+	f4(478,479,476,477,0xff000000);
+	f4(622,623,620,621,0xff000000);
+	f4(604,430,605,606,0xff000000);
+	f4(481,478,482,484,0xff000000);
+	f4(262,264,263,88,0xff000000);
+	f4(139,142,140,136,0xff000000);
+	f4(43,42,41,44,0xff000000);
+	f4(98,97,96,99,0xff000000);
+	f4(138,144,143,139,0xff000000);
+	f4(178,177,176,180,0xff000000);
+	f4(210,214,212,211,0xff000000);
+	f4(226,215,214,227,0xff000000);
+	f4(278,277,282,281,0xff000000);
+	f4(385,386,383,384,0xff000000);
+	f4(440,441,438,439,0xff000000);
+	f4(480,481,485,486,0xff000000);
+	f4(520,522,518,519,0xff000000);
+	f4(552,553,554,556,0xff000000);
+	f4(568,569,556,557,0xff000000);
+	f4(620,623,624,619,0xff000000);
+	f4(615,619,624,625,0xff000000);
+	f4(273,283,282,277,0xff000000);
+	f4(46,44,41,53,0xff000000);
+	f4(182,181,180,176,0xff000000);
+	f4(524,518,522,523,0xff000000);
+	f4(558,565,568,557,0xff000000);
+	f4(601,602,603,608,0xff000000);
+	f4(259,266,261,260,0xff000000);
+	f4(145,144,147,146,0xff000000);
+	f4(383,431,432,382,0xff000000);
+	f4(487,488,489,486,0xff000000);
+	f4(299,83,77,76,0xff000000);
+	f4(641,418,419,425,0xff000000);
+	f4(388,395,383,386,0xff000000);
+	f4(223,222,219,215,0xff000000);
+	f4(19,22,23,24,0xff000000);
+	f4(39,107,106,105,0xff000000);
+	f4(147,133,129,148,0xff000000);
+	f4(162,161,153,163,0xff000000);
+	f4(164,163,69,72,0xff000000);
+	f4(197,202,201,200,0xff000000);
+	f4(230,229,218,231,0xff000000);
+	f4(222,241,240,235,0xff000000);
+	f4(98,101,254,255,0xff000000);
+	f4(267,268,27,30,0xff000000);
+	f4(285,284,282,286,0xff000000);
+	f4(336,335,186,337,0xff000000);
+	f4(365,364,361,366,0xff000000);
+	f4(448,449,381,447,0xff000000);
+	f4(471,475,489,490,0xff000000);
+	f4(495,503,504,505,0xff000000);
+	f4(411,505,506,414,0xff000000);
+	f4(543,544,539,542,0xff000000);
+	f4(560,571,572,573,0xff000000);
+	f4(582,583,564,577,0xff000000);
+	f4(596,443,440,597,0xff000000);
+	f4(369,610,609,372,0xff000000);
+	f4(624,626,627,628,0xff000000);
+	f4(528,677,678,679,0xff000000);
+	f4(669,670,671,672,0xff000000);
+	f4(661,662,663,664,0xff000000);
+	f4(649,650,651,652,0xff000000);
+	f4(645,646,647,648,0xff000000);
+	f4(640,637,638,639,0xff000000);
+	f4(576,573,574,575,0xff000000);
+	f4(551,548,549,550,0xff000000);
+	f4(539,540,541,538,0xff000000);
+	f4(512,511,510,420,0xff000000);
+	f4(509,488,507,508,0xff000000);
+	f4(502,499,500,501,0xff000000);
+	f4(434,435,436,437,0xff000000);
+	f4(405,406,407,404,0xff000000);
+	f4(401,402,399,400,0xff000000);
+	f4(371,372,373,374,0xff000000);
+	f4(360,357,358,359,0xff000000);
+	f4(329,328,327,330,0xff000000);
+	f4(319,322,321,320,0xff000000);
+	f4(309,308,307,310,0xff000000);
+	f4(305,304,303,306,0xff000000);
+	f4(298,297,296,295,0xff000000);
+	f4(232,231,234,233,0xff000000);
+	f4(207,206,209,208,0xff000000);
+	f4(199,198,197,196,0xff000000);
+	f4(168,169,170,78,0xff000000);
+	f4(165,146,167,166,0xff000000);
+	f4(158,157,160,159,0xff000000);
+	f4(94,93,92,95,0xff000000);
+	f4(65,64,63,62,0xff000000);
+	f4(57,60,59,58,0xff000000);
+	f4(31,30,29,32,0xff000000);
+	f4(18,17,16,15,0xff000000);
+	f4(183,178,195,184,0xff000000);
+	f4(525,526,537,520,0xff000000);
+	f4(608,604,606,607,0xff000000);
+	f4(449,450,456,457,0xff000000);
+	f4(394,395,388,389,0xff000000);
+	f4(266,265,264,262,0xff000000);
+	f4(107,115,114,108,0xff000000);
+	f4(52,47,46,53,0xff000000);
+	f4(250,249,248,251,0xff000000);
+	f4(590,591,592,593,0xff000000);
+	f4(584,588,589,590,0xff000000);
+	f4(569,570,550,552,0xff000000);
+	f4(379,371,374,377,0xff000000);
+	f4(247,246,242,248,0xff000000);
+	f4(208,228,227,210,0xff000000);
+	f4(32,29,37,35,0xff000000);
+	f4(251,241,224,250,0xff000000);
+	f4(566,583,593,592,0xff000000);
+	f4(593,581,584,590,0xff000000);
+	f4(375,376,377,374,0xff000000);
+	f4(380,370,371,379,0xff000000);
+	f4(242,239,251,248,0xff000000);
+	f4(35,34,33,32,0xff000000);
+	f4(29,28,38,37,0xff000000);
+	f4(489,475,479,480,0xff000000);
+	f4(441,442,434,437,0xff000000);
+	f4(147,138,137,133,0xff000000);
+	f4(99,95,92,100,0xff000000);
+	f4(568,565,566,567,0xff000000);
+	f4(434,442,432,433,0xff000000);
+	f4(226,225,224,223,0xff000000);
+	f4(92,91,90,100,0xff000000);
+	f4(195,190,187,184,0xff000000);
+	f4(565,558,561,564,0xff000000);
+	f4(532,526,530,531,0xff000000);
+	f4(413,642,408,412,0xff000000);
+	f4(66,300,71,70,0xff000000);
+	f4(595,596,591,594,0xff000000);
+	f4(581,582,577,580,0xff000000);
+	f4(249,254,253,252,0xff000000);
+	f4(239,238,235,240,0xff000000);
+	f4(444,432,442,443,0xff000000);
+	f4(187,190,189,188,0xff000000);
+	f4(100,90,102,101,0xff000000);
+	f4(90,89,41,40,0xff000000);
+	f4(116,132,124,119,0xff000000);
+	f4(458,461,466,474,0xff000000);
+	f4(598,591,596,597,0xff000000);
+	f4(578,579,580,577,0xff000000);
+	f4(562,563,564,561,0xff000000);
+	f4(465,466,461,462,0xff000000);
+	f4(402,643,644,399,0xff000000);
+	f4(256,255,254,249,0xff000000);
+	f4(236,235,238,237,0xff000000);
+	f4(220,219,222,221,0xff000000);
+	f4(123,120,119,124,0xff000000);
+	f4(60,57,302,301,0xff000000);
+	f4(43,113,112,111,0xff000000);
+	f4(454,455,385,453,0xff000000);
+	f4(613,616,617,618,0xff000000);
+	f4(588,586,373,587,0xff000000);
+	f4(536,533,534,535,0xff000000);
+	f4(532,533,536,537,0xff000000);
+	f4(468,472,473,467,0xff000000);
+	f4(466,467,473,474,0xff000000);
+	f4(423,424,421,422,0xff000000);
+	f4(275,274,271,276,0xff000000);
+	f4(31,244,246,245,0xff000000);
+	f4(192,191,194,193,0xff000000);
+	f4(131,130,126,125,0xff000000);
+	f4(131,125,124,132,0xff000000);
+	f4(79,82,81,80,0xff000000);
+	f4(2,6,5,4,0xff000000);
+	f4(35,37,21,36,0xff000000);
+	f4(113,49,132,116,0xff000000);
+	f4(175,174,171,168,0xff000000);
+	f4(206,205,193,96,0xff000000);
+	f4(228,97,256,225,0xff000000);
+	f4(339,338,199,335,0xff000000);
+	f4(270,341,340,34,0xff000000);
+	f4(347,348,344,346,0xff000000);
+	f4(363,379,377,378,0xff000000);
+	f4(455,458,474,391,0xff000000);
+	f4(517,510,513,516,0xff000000);
+	f4(548,438,535,547,0xff000000);
+	f4(598,439,570,567,0xff000000);
+	f4(541,680,681,677,0xff000000);
+	f4(612,376,682,683,0xff000000);
+	f4(673,674,675,676,0xff000000);
+	f4(665,666,667,668,0xff000000);
+	f4(660,657,655,656,0xff000000);
+	f4(658,654,655,657,0xff000000);
+	f4(654,658,659,653,0xff000000);
+	f4(653,659,660,656,0xff000000);
+	f4(636,633,631,632,0xff000000);
+	f4(634,630,631,633,0xff000000);
+	f4(630,634,635,629,0xff000000);
+	f4(629,635,636,632,0xff000000);
+	f4(613,614,615,616,0xff000000);
+	f4(345,611,378,612,0xff000000);
+	f4(601,523,599,600,0xff000000);
+	f4(585,586,588,584,0xff000000);
+	f4(561,558,559,560,0xff000000);
+	f4(546,547,535,545,0xff000000);
+	f4(526,527,528,529,0xff000000);
+	f4(515,516,513,514,0xff000000);
+	f4(497,498,494,496,0xff000000);
+	f4(410,496,494,495,0xff000000);
+	f4(494,498,491,492,0xff000000);
+	f4(482,491,499,502,0xff000000);
+	f4(471,472,469,470,0xff000000);
+	f4(465,469,472,468,0xff000000);
+	f4(463,464,465,462,0xff000000);
+	f4(460,461,458,459,0xff000000);
+	f4(445,446,382,444,0xff000000);
+	f4(431,429,426,430,0xff000000);
+	f4(641,425,426,644,0xff000000);
+	f4(420,421,424,419,0xff000000);
+	f4(418,415,416,417,0xff000000);
+	f4(404,643,402,403,0xff000000);
+	f4(431,396,428,429,0xff000000);
+	f4(393,394,391,392,0xff000000);
+	f4(390,391,394,389,0xff000000);
+	f4(395,396,431,383,0xff000000);
+	f4(368,381,382,446,0xff000000);
+	f4(380,368,369,370,0xff000000);
+	f4(362,367,368,380,0xff000000);
+	f4(348,361,362,363,0xff000000);
+	f4(356,353,351,352,0xff000000);
+	f4(354,350,351,353,0xff000000);
+	f4(350,354,355,349,0xff000000);
+	f4(349,355,356,352,0xff000000);
+	f4(344,345,342,343,0xff000000);
+	f4(333,332,331,334,0xff000000);
+	f4(325,324,323,326,0xff000000);
+	f4(313,315,318,314,0xff000000);
+	f4(313,312,316,315,0xff000000);
+	f4(317,316,312,311,0xff000000);
+	f4(318,317,311,314,0xff000000);
+	f4(289,291,294,290,0xff000000);
+	f4(289,288,292,291,0xff000000);
+	f4(293,292,288,287,0xff000000);
+	f4(294,293,287,290,0xff000000);
+	f4(271,274,273,272,0xff000000);
+	f4(3,270,36,269,0xff000000);
+	f4(257,181,259,258,0xff000000);
+	f4(243,242,246,244,0xff000000);
+	f4(219,218,217,216,0xff000000);
+	f4(204,203,193,205,0xff000000);
+	f4(191,190,195,194,0xff000000);
+	f4(184,187,186,185,0xff000000);
+	f4(173,172,171,174,0xff000000);
+	f4(155,154,152,156,0xff000000);
+	f4(68,153,152,154,0xff000000);
+	f4(152,150,149,156,0xff000000);
+	f4(140,160,157,149,0xff000000);
+	f4(126,130,129,128,0xff000000);
+	f4(123,126,128,127,0xff000000);
+	f4(121,120,123,122,0xff000000);
+	f4(116,119,118,117,0xff000000);
+	f4(103,102,40,104,0xff000000);
+	f4(89,88,84,87,0xff000000);
+	f4(299,302,84,83,0xff000000);
+	f4(82,79,78,77,0xff000000);
+	f4(76,75,74,73,0xff000000);
+	f4(66,65,301,300,0xff000000);
+	f4(62,61,60,301,0xff000000);
+	f4(89,87,86,54,0xff000000);
+	f4(47,52,51,50,0xff000000);
+	f4(48,47,50,49,0xff000000);
+	f4(53,41,89,54,0xff000000);
+	f4(26,104,40,39,0xff000000);
+	f4(38,28,27,26,0xff000000);
+	f4(20,38,26,25,0xff000000);
+	f4(6,21,20,19,0xff000000);
+	f4(9,11,14,10,0xff000000);
+	f4(9,8,12,11,0xff000000);
+	f4(13,12,8,7,0xff000000);
+	f4(14,13,7,10,0xff000000);
+	f4(0,3,2,1,0xff000000);
+	f4(2,4,346,344,0xffc0c0c0);
+	f4(6,2,344,348,0xffc0c0c0);
+	f4(5,6,348,347,0xffc0c0c0);
+	f4(4,5,347,346,0xffc0c0c0);
+	f4(319,661,664,322,0xffc0c0c0);
+	f4(322,664,663,321,0xffc0c0c0);
+	f4(321,663,662,320,0xffc0c0c0);
+	f4(320,662,661,319,0xffc0c0c0);
+	f4(318,315,657,660,0xffc0c0c0);
+	f4(317,318,660,659,0xffc0c0c0);
+	f4(316,317,659,658,0xffc0c0c0);
+	f4(315,316,658,657,0xffc0c0c0);
+	f4(311,653,656,314,0xffc0c0c0);
+	f4(314,656,655,313,0xffc0c0c0);
+	f4(313,655,654,312,0xffc0c0c0);
+	f4(312,654,653,311,0xffc0c0c0);
+	f4(310,307,649,652,0xffc0c0c0);
+	f4(309,310,652,651,0xffc0c0c0);
+	f4(308,309,651,650,0xffc0c0c0);
+	f4(307,308,650,649,0xffc0c0c0);
+	f4(15,357,360,18,0xffc0c0c0);
+	f4(18,360,359,17,0xffc0c0c0);
+	f4(17,359,358,16,0xffc0c0c0);
+	f4(16,358,357,15,0xffc0c0c0);
+	f4(14,11,353,356,0xffc0c0c0);
+	f4(13,14,356,355,0xffc0c0c0);
+	f4(12,13,355,354,0xffc0c0c0);
+	f4(11,12,354,353,0xffc0c0c0);
+	f4(306,303,645,648,0xffc0c0c0);
+	f4(305,306,648,647,0xffc0c0c0);
+	f4(304,305,647,646,0xffc0c0c0);
+	f4(303,304,646,645,0xffc0c0c0);
+	f4(7,349,352,10,0xffc0c0c0);
+	f4(10,352,351,9,0xffc0c0c0);
+	f4(9,351,350,8,0xffc0c0c0);
+	f4(8,350,349,7,0xffc0c0c0);
+	f4(299,641,644,302,0xffc0c0c0);
+	f4(302,644,643,301,0xffc0c0c0);
+	f4(301,643,642,300,0xffc0c0c0);
+	f4(300,642,641,299,0xffc0c0c0);
+	f4(334,331,673,676,0xffc0c0c0);
+	f4(333,334,676,675,0xffc0c0c0);
+	f4(332,333,675,674,0xffc0c0c0);
+	f4(331,332,674,673,0xffc0c0c0);
+	f4(326,323,665,668,0xffc0c0c0);
+	f4(325,326,668,667,0xffc0c0c0);
+	f4(324,325,667,666,0xffc0c0c0);
+	f4(323,324,666,665,0xffc0c0c0);
+	f4(330,327,669,672,0xffc0c0c0);
+	f4(329,330,672,671,0xffc0c0c0);
+	f4(328,329,671,670,0xffc0c0c0);
+	f4(327,328,670,669,0xffc0c0c0);
+	f4(295,637,640,298,0xffc0c0c0);
+	f4(298,640,639,297,0xffc0c0c0);
+	f4(297,639,638,296,0xffc0c0c0);
+	f4(296,638,637,295,0xffc0c0c0);
+	f4(294,291,633,636,0xffc0c0c0);
+	f4(293,294,636,635,0xffc0c0c0);
+	f4(292,293,635,634,0xffc0c0c0);
+	f4(291,292,634,633,0xffc0c0c0);
+	f4(287,629,632,290,0xffc0c0c0);
+	f4(290,632,631,289,0xffc0c0c0);
+	f4(289,631,630,288,0xffc0c0c0);
+	f4(288,630,629,287,0xffc0c0c0);
+	f4(282,284,626,624,0xffc0c0c0);
+	f4(286,282,624,628,0xffc0c0c0);
+	f4(285,286,628,627,0xffc0c0c0);
+	f4(284,285,627,626,0xffc0c0c0);
+	f4(273,277,619,615,0xffc0c0c0);
+	f4(283,273,615,625,0xffc0c0c0);
+	f4(282,283,625,624,0xffc0c0c0);
+	f4(281,282,624,623,0xffc0c0c0);
+	f4(280,281,623,622,0xffc0c0c0);
+	f4(279,280,622,621,0xffc0c0c0);
+	f4(278,279,621,620,0xffc0c0c0);
+	f4(277,278,620,619,0xffc0c0c0);
+	f4(271,613,618,276,0xffc0c0c0);
+	f4(275,276,618,617,0xffc0c0c0);
+	f4(274,275,617,616,0xffc0c0c0);
+	f4(273,274,616,615,0xffc0c0c0);
+	f4(272,273,615,614,0xffc0c0c0);
+	f4(271,272,614,613,0xffc0c0c0);
+	f4(3,0,342,345,0xffc0c0c0);
+	f4(2,3,345,344,0xffc0c0c0);
+	f4(1,2,344,343,0xffc0c0c0);
+	f4(0,1,343,342,0xffc0c0c0);
+	f4(270,3,345,612,0xffc0c0c0);
+	f4(36,270,612,378,0xffc0c0c0);
+	f4(269,36,378,611,0xffc0c0c0);
+	f4(3,269,611,345,0xffc0c0c0);
+	f4(34,340,682,376,0xffc0c0c0);
+	f4(270,34,376,612,0xffc0c0c0);
+	f4(341,270,612,683,0xffc0c0c0);
+	f4(340,341,683,682,0xffc0c0c0);
+	f4(268,610,369,27,0xffc0c0c0);
+	f4(267,609,610,268,0xffc0c0c0);
+	f4(30,372,609,267,0xffc0c0c0);
+	f4(27,369,372,30,0xffc0c0c0);
+	f4(259,260,602,601,0xffc0c0c0);
+	f4(266,259,601,608,0xffc0c0c0);
+	f4(265,266,608,607,0xffc0c0c0);
+	f4(264,265,607,606,0xffc0c0c0);
+	f4(182,264,606,524,0xffc0c0c0);
+	f4(263,182,524,605,0xffc0c0c0);
+	f4(88,263,605,430,0xffc0c0c0);
+	f4(262,88,430,604,0xffc0c0c0);
+	f4(261,262,604,603,0xffc0c0c0);
+	f4(260,261,603,602,0xffc0c0c0);
+	f4(181,257,599,523,0xffc0c0c0);
+	f4(259,181,523,601,0xffc0c0c0);
+	f4(258,259,601,600,0xffc0c0c0);
+	f4(257,258,600,599,0xffc0c0c0);
+	f4(256,97,439,598,0xffc0c0c0);
+	f4(225,256,598,567,0xffc0c0c0);
+	f4(228,225,567,570,0xffc0c0c0);
+	f4(97,228,570,439,0xffc0c0c0);
+	f4(252,594,591,249,0xffc0c0c0);
+	f4(256,249,591,598,0xffc0c0c0);
+	f4(255,256,598,597,0xffc0c0c0);
+	f4(98,255,597,440,0xffc0c0c0);
+	f4(101,98,440,443,0xffc0c0c0);
+	f4(254,101,443,596,0xffc0c0c0);
+	f4(253,254,596,595,0xffc0c0c0);
+	f4(252,253,595,594,0xffc0c0c0);
+	f4(239,242,584,581,0xffc0c0c0);
+	f4(251,239,581,593,0xffc0c0c0);
+	f4(241,251,593,583,0xffc0c0c0);
+	f4(224,241,583,566,0xffc0c0c0);
+	f4(250,224,566,592,0xffc0c0c0);
+	f4(249,250,592,591,0xffc0c0c0);
+	f4(248,249,591,590,0xffc0c0c0);
+	f4(247,248,590,589,0xffc0c0c0);
+	f4(246,247,589,588,0xffc0c0c0);
+	f4(245,246,588,587,0xffc0c0c0);
+	f4(31,245,587,373,0xffc0c0c0);
+	f4(244,31,373,586,0xffc0c0c0);
+	f4(33,244,586,375,0xffc0c0c0);
+	f4(243,33,375,585,0xffc0c0c0);
+	f4(243,585,584,242,0xffc0c0c0);
+	f4(222,235,577,564,0xffc0c0c0);
+	f4(241,222,564,583,0xffc0c0c0);
+	f4(240,241,583,582,0xffc0c0c0);
+	f4(239,240,582,581,0xffc0c0c0);
+	f4(238,239,581,580,0xffc0c0c0);
+	f4(238,580,579,237,0xffc0c0c0);
+	f4(236,237,579,578,0xffc0c0c0);
+	f4(235,236,578,577,0xffc0c0c0);
+	f4(231,232,574,573,0xffc0c0c0);
+	f4(234,231,573,576,0xffc0c0c0);
+	f4(233,234,576,575,0xffc0c0c0);
+	f4(232,233,575,574,0xffc0c0c0);
+	f4(218,229,571,560,0xffc0c0c0);
+	f4(231,218,560,573,0xffc0c0c0);
+	f4(230,231,573,572,0xffc0c0c0);
+	f4(229,230,572,571,0xffc0c0c0);
+	f4(208,210,552,550,0xffc0c0c0);
+	f4(228,208,550,570,0xffc0c0c0);
+	f4(227,228,570,569,0xffc0c0c0);
+	f4(226,227,569,568,0xffc0c0c0);
+	f4(225,226,568,567,0xffc0c0c0);
+	f4(224,225,567,566,0xffc0c0c0);
+	f4(223,224,566,565,0xffc0c0c0);
+	f4(222,223,565,564,0xffc0c0c0);
+	f4(222,564,563,221,0xffc0c0c0);
+	f4(220,221,563,562,0xffc0c0c0);
+	f4(219,220,562,561,0xffc0c0c0);
+	f4(218,219,561,560,0xffc0c0c0);
+	f4(217,218,560,559,0xffc0c0c0);
+	f4(216,217,559,558,0xffc0c0c0);
+	f4(215,216,558,557,0xffc0c0c0);
+	f4(214,215,557,556,0xffc0c0c0);
+	f4(213,214,556,555,0xffc0c0c0);
+	f4(212,213,555,554,0xffc0c0c0);
+	f4(211,212,554,553,0xffc0c0c0);
+	f4(210,211,553,552,0xffc0c0c0);
+	f4(206,207,549,548,0xffc0c0c0);
+	f4(209,206,548,551,0xffc0c0c0);
+	f4(208,209,551,550,0xffc0c0c0);
+	f4(207,208,550,549,0xffc0c0c0);
+	f4(193,203,545,535,0xffc0c0c0);
+	f4(96,193,535,438,0xffc0c0c0);
+	f4(206,96,438,548,0xffc0c0c0);
+	f4(205,206,548,547,0xffc0c0c0);
+	f4(204,205,547,546,0xffc0c0c0);
+	f4(203,204,546,545,0xffc0c0c0);
+	f4(197,200,542,539,0xffc0c0c0);
+	f4(202,197,539,544,0xffc0c0c0);
+	f4(201,202,544,543,0xffc0c0c0);
+	f4(200,201,543,542,0xffc0c0c0);
+	f4(199,196,538,541,0xffc0c0c0);
+	f4(198,199,541,540,0xffc0c0c0);
+	f4(197,198,540,539,0xffc0c0c0);
+	f4(196,197,539,538,0xffc0c0c0);
+	f4(335,199,541,677,0xffc0c0c0);
+	f4(339,335,677,681,0xffc0c0c0);
+	f4(338,339,681,680,0xffc0c0c0);
+	f4(199,338,680,541,0xffc0c0c0);
+	f4(186,335,677,528,0xffc0c0c0);
+	f4(337,186,528,679,0xffc0c0c0);
+	f4(336,337,679,678,0xffc0c0c0);
+	f4(335,336,678,677,0xffc0c0c0);
+	f4(178,183,525,520,0xffc0c0c0);
+	f4(195,178,520,537,0xffc0c0c0);
+	f4(195,537,536,194,0xffc0c0c0);
+	f4(193,194,536,535,0xffc0c0c0);
+	f4(192,193,535,534,0xffc0c0c0);
+	f4(191,192,534,533,0xffc0c0c0);
+	f4(190,191,533,532,0xffc0c0c0);
+	f4(189,190,532,531,0xffc0c0c0);
+	f4(189,531,530,188,0xffc0c0c0);
+	f4(187,188,530,529,0xffc0c0c0);
+	f4(186,187,529,528,0xffc0c0c0);
+	f4(185,186,528,527,0xffc0c0c0);
+	f4(184,185,527,526,0xffc0c0c0);
+	f4(183,184,526,525,0xffc0c0c0);
+	f4(80,176,518,422,0xffc0c0c0);
+	f4(182,80,422,524,0xffc0c0c0);
+	f4(181,182,524,523,0xffc0c0c0);
+	f4(180,181,523,522,0xffc0c0c0);
+	f4(179,180,522,521,0xffc0c0c0);
+	f4(178,179,521,520,0xffc0c0c0);
+	f4(177,178,520,519,0xffc0c0c0);
+	f4(176,177,519,518,0xffc0c0c0);
+	f4(168,171,513,510,0xffc0c0c0);
+	f4(175,168,510,517,0xffc0c0c0);
+	f4(174,175,517,516,0xffc0c0c0);
+	f4(173,174,516,515,0xffc0c0c0);
+	f4(172,173,515,514,0xffc0c0c0);
+	f4(171,172,514,513,0xffc0c0c0);
+	f4(170,512,420,78,0xffc0c0c0);
+	f4(169,511,512,170,0xffc0c0c0);
+	f4(168,510,511,169,0xffc0c0c0);
+	f4(78,420,510,168,0xffc0c0c0);
+	f4(146,165,507,488,0xffc0c0c0);
+	f4(167,146,488,509,0xffc0c0c0);
+	f4(166,167,509,508,0xffc0c0c0);
+	f4(165,166,508,507,0xffc0c0c0);
+	f4(163,164,506,505,0xffc0c0c0);
+	f4(69,163,505,411,0xffc0c0c0);
+	f4(72,69,411,414,0xffc0c0c0);
+	f4(164,72,414,506,0xffc0c0c0);
+	f4(153,161,503,495,0xffc0c0c0);
+	f4(163,153,495,505,0xffc0c0c0);
+	f4(162,163,505,504,0xffc0c0c0);
+	f4(161,162,504,503,0xffc0c0c0);
+	f4(140,149,491,482,0xffc0c0c0);
+	f4(160,140,482,502,0xffc0c0c0);
+	f4(159,160,502,501,0xffc0c0c0);
+	f4(158,159,501,500,0xffc0c0c0);
+	f4(157,158,500,499,0xffc0c0c0);
+	f4(156,157,499,498,0xffc0c0c0);
+	f4(155,156,498,497,0xffc0c0c0);
+	f4(154,155,497,496,0xffc0c0c0);
+	f4(68,154,496,410,0xffc0c0c0);
+	f4(153,68,410,495,0xffc0c0c0);
+	f4(152,153,495,494,0xffc0c0c0);
+	f4(151,152,494,493,0xffc0c0c0);
+	f4(150,151,493,492,0xffc0c0c0);
+	f4(150,492,491,149,0xffc0c0c0);
+	f4(129,133,475,471,0xffc0c0c0);
+	f4(148,129,471,490,0xffc0c0c0);
+	f4(147,148,490,489,0xffc0c0c0);
+	f4(146,147,489,488,0xffc0c0c0);
+	f4(145,146,488,487,0xffc0c0c0);
+	f4(144,145,487,486,0xffc0c0c0);
+	f4(143,144,486,485,0xffc0c0c0);
+	f4(142,143,485,484,0xffc0c0c0);
+	f4(141,142,484,483,0xffc0c0c0);
+	f4(140,141,483,482,0xffc0c0c0);
+	f4(136,140,482,478,0xffc0c0c0);
+	f4(139,136,478,481,0xffc0c0c0);
+	f4(138,139,481,480,0xffc0c0c0);
+	f4(137,138,480,479,0xffc0c0c0);
+	f4(136,137,479,478,0xffc0c0c0);
+	f4(135,136,478,477,0xffc0c0c0);
+	f4(134,135,477,476,0xffc0c0c0);
+	f4(133,134,476,475,0xffc0c0c0);
+	f4(113,116,458,455,0xffc0c0c0);
+	f4(49,113,455,391,0xffc0c0c0);
+	f4(132,49,391,474,0xffc0c0c0);
+	f4(131,132,474,473,0xffc0c0c0);
+	f4(131,473,472,130,0xffc0c0c0);
+	f4(129,130,472,471,0xffc0c0c0);
+	f4(128,129,471,470,0xffc0c0c0);
+	f4(128,470,469,127,0xffc0c0c0);
+	f4(123,127,469,465,0xffc0c0c0);
+	f4(126,123,465,468,0xffc0c0c0);
+	f4(125,126,468,467,0xffc0c0c0);
+	f4(124,125,467,466,0xffc0c0c0);
+	f4(123,124,466,465,0xffc0c0c0);
+	f4(122,123,465,464,0xffc0c0c0);
+	f4(121,122,464,463,0xffc0c0c0);
+	f4(120,121,463,462,0xffc0c0c0);
+	f4(119,120,462,461,0xffc0c0c0);
+	f4(118,119,461,460,0xffc0c0c0);
+	f4(117,118,460,459,0xffc0c0c0);
+	f4(116,117,459,458,0xffc0c0c0);
+	f4(107,108,450,449,0xffc0c0c0);
+	f4(115,107,449,457,0xffc0c0c0);
+	f4(114,115,457,456,0xffc0c0c0);
+	f4(43,114,456,385,0xffc0c0c0);
+	f4(43,385,455,113,0xffc0c0c0);
+	f4(112,113,455,454,0xffc0c0c0);
+	f4(111,112,454,453,0xffc0c0c0);
+	f4(110,111,453,452,0xffc0c0c0);
+	f4(109,110,452,451,0xffc0c0c0);
+	f4(108,109,451,450,0xffc0c0c0);
+	f4(39,105,447,381,0xffc0c0c0);
+	f4(107,39,381,449,0xffc0c0c0);
+	f4(106,107,449,448,0xffc0c0c0);
+	f4(105,106,448,447,0xffc0c0c0);
+	f4(26,39,381,368,0xffc0c0c0);
+	f4(104,26,368,446,0xffc0c0c0);
+	f4(103,104,446,445,0xffc0c0c0);
+	f4(102,103,445,444,0xffc0c0c0);
+	f4(101,102,444,443,0xffc0c0c0);
+	f4(100,101,443,442,0xffc0c0c0);
+	f4(99,100,442,441,0xffc0c0c0);
+	f4(98,99,441,440,0xffc0c0c0);
+	f4(97,98,440,439,0xffc0c0c0);
+	f4(96,97,439,438,0xffc0c0c0);
+	f4(95,96,438,437,0xffc0c0c0);
+	f4(94,95,437,436,0xffc0c0c0);
+	f4(93,94,436,435,0xffc0c0c0);
+	f4(92,93,435,434,0xffc0c0c0);
+	f4(91,92,434,433,0xffc0c0c0);
+	f4(90,91,433,432,0xffc0c0c0);
+	f4(90,432,431,89,0xffc0c0c0);
+	f4(88,89,431,430,0xffc0c0c0);
+	f4(84,88,430,426,0xffc0c0c0);
+	f4(87,84,426,429,0xffc0c0c0);
+	f4(86,87,429,428,0xffc0c0c0);
+	f4(85,86,428,427,0xffc0c0c0);
+	f4(84,85,427,426,0xffc0c0c0);
+	f4(84,426,425,83,0xffc0c0c0);
+	f4(82,83,425,424,0xffc0c0c0);
+	f4(81,82,424,423,0xffc0c0c0);
+	f4(80,81,423,422,0xffc0c0c0);
+	f4(80,422,421,79,0xffc0c0c0);
+	f4(78,79,421,420,0xffc0c0c0);
+	f4(77,78,420,419,0xffc0c0c0);
+	f4(76,77,419,418,0xffc0c0c0);
+	f4(75,76,418,417,0xffc0c0c0);
+	f4(74,75,417,416,0xffc0c0c0);
+	f4(73,74,416,415,0xffc0c0c0);
+	f4(72,73,415,414,0xffc0c0c0);
+	f4(71,72,414,413,0xffc0c0c0);
+	f4(70,71,413,412,0xffc0c0c0);
+	f4(69,70,412,411,0xffc0c0c0);
+	f4(68,69,411,410,0xffc0c0c0);
+	f4(67,68,410,409,0xffc0c0c0);
+	f4(66,67,409,408,0xffc0c0c0);
+	f4(65,66,408,407,0xffc0c0c0);
+	f4(64,65,407,406,0xffc0c0c0);
+	f4(63,64,406,405,0xffc0c0c0);
+	f4(62,63,405,404,0xffc0c0c0);
+	f4(61,62,404,403,0xffc0c0c0);
+	f4(60,61,403,402,0xffc0c0c0);
+	f4(59,60,402,401,0xffc0c0c0);
+	f4(58,59,401,400,0xffc0c0c0);
+	f4(57,58,400,399,0xffc0c0c0);
+	f4(56,57,399,398,0xffc0c0c0);
+	f4(55,56,398,397,0xffc0c0c0);
+	f4(54,55,397,396,0xffc0c0c0);
+	f4(53,54,396,395,0xffc0c0c0);
+	f4(52,53,395,394,0xffc0c0c0);
+	f4(51,52,394,393,0xffc0c0c0);
+	f4(50,51,393,392,0xffc0c0c0);
+	f4(50,392,391,49,0xffc0c0c0);
+	f4(48,49,391,390,0xffc0c0c0);
+	f4(47,48,390,389,0xffc0c0c0);
+	f4(46,47,389,388,0xffc0c0c0);
+	f4(45,46,388,387,0xffc0c0c0);
+	f4(44,45,387,386,0xffc0c0c0);
+	f4(43,44,386,385,0xffc0c0c0);
+	f4(42,43,385,384,0xffc0c0c0);
+	f4(42,384,383,41,0xffc0c0c0);
+	f4(40,41,383,382,0xffc0c0c0);
+	f4(40,382,381,39,0xffc0c0c0);
+	f4(20,25,367,362,0xffc0c0c0);
+	f4(38,20,362,380,0xffc0c0c0);
+	f4(37,38,380,379,0xffc0c0c0);
+	f4(21,37,379,363,0xffc0c0c0);
+	f4(36,21,363,378,0xffc0c0c0);
+	f4(35,36,378,377,0xffc0c0c0);
+	f4(34,35,377,376,0xffc0c0c0);
+	f4(33,34,376,375,0xffc0c0c0);
+	f4(32,33,375,374,0xffc0c0c0);
+	f4(31,32,374,373,0xffc0c0c0);
+	f4(30,31,373,372,0xffc0c0c0);
+	f4(29,30,372,371,0xffc0c0c0);
+	f4(28,29,371,370,0xffc0c0c0);
+	f4(27,28,370,369,0xffc0c0c0);
+	f4(26,27,369,368,0xffc0c0c0);
+	f4(26,368,367,25,0xffc0c0c0);
+	f4(24,366,361,19,0xffc0c0c0);
+	f4(23,365,366,24,0xffc0c0c0);
+	f4(22,364,365,23,0xffc0c0c0);
+	f4(19,361,364,22,0xffc0c0c0);
+	f4(6,19,361,348,0xffc0c0c0);
+	f4(21,6,348,363,0xffc0c0c0);
+	f4(20,21,363,362,0xffc0c0c0);
+	f4(19,20,362,361,0xffc0c0c0);
+
+	this.computeNormals();
+
+	function v( x, y, z ) {
+
+		scope.vertices.push( new THREE.Vertex( new THREE.Vector3( x, y, z ) ) );
+
+	}
+
+	function f3( a, b, c, color ) {
+
+		scope.faces.push( new THREE.Face3( a, b, c, null, new THREE.Color(color) ) );
+
+	}
+
+	function f4( a, b, c, d, color ) {
+
+		scope.faces.push( new THREE.Face4( a, b, c, d, null, new THREE.Color(color) ) );
+
+	}
+
+}
+
+Qrcode.prototype = new THREE.Geometry();
+Qrcode.prototype.constructor = Qrcode;

+ 158 - 0
examples/particles.html

@@ -0,0 +1,158 @@
+<!DOCTYPE HTML>
+<html lang="en">
+	<head>
+		<title>three.js - particles - random</title>
+		<meta charset="utf-8">
+		<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;"/>
+		<style type="text/css">
+			body {
+				background-color: #000000;
+				margin: 0px;
+				overflow: hidden;
+			}
+
+			a {
+				color:#0078ff;
+			}
+		</style>
+	</head>
+	<body>
+
+		<script type="text/javascript" src="http://github.com/mrdoob/stats.js/raw/master/build/stats.js"></script>
+
+		<script type="text/javascript" src="../build/three.js"></script>
+
+		<script type="text/javascript">
+
+			var SCREEN_WIDTH = window.innerWidth;
+			var SCREEN_HEIGHT = window.innerHeight;
+
+			var stats;
+			var container;
+
+			var particle;
+
+			var camera;
+			var scene;
+			var renderer;
+
+			var mouseX = 0;
+			var mouseY = 0;
+
+			var windowHalfX = window.innerWidth / 2;
+			var windowHalfY = window.innerHeight / 2;
+
+
+			init();
+			setInterval(loop, 1000 / 60);
+
+			function init() {
+
+				container = document.createElement('div');
+				document.body.appendChild(container);
+
+				camera = new THREE.Camera( 75, SCREEN_WIDTH / SCREEN_HEIGHT, 1, 10000 );
+				camera.position.z = 1000;
+
+				scene = new THREE.Scene();
+
+				renderer = new THREE.CanvasRenderer();
+				renderer.setSize(SCREEN_WIDTH, SCREEN_HEIGHT);
+
+				for (var i = 0; i < 500; i++) {
+
+					particle = new THREE.Particle( new THREE.ParticleCircleMaterial( Math.random() * 0xff0000, 1 ) );
+					particle.position.x = Math.random() * 2000 - 1000;
+					particle.position.y = Math.random() * 2000 - 1000;
+					particle.position.z = Math.random() * 2000 - 1000;
+					particle.scale.x = particle.scale.y = Math.random() * 10 + 5;
+					scene.add(particle);
+				}
+
+				var material = loadTexture( 'textures/Tree_01.png' );
+
+				for (var i = 0; i < 10; i++) {
+
+					particle = new THREE.Particle( material );
+					particle.position.x = Math.random() * 2000 - 1000;
+					// particle.position.y = Math.random() * 2000 - 1000;
+					particle.position.z = Math.random() * 2000 - 1000;
+					// particle.rotation.z = 90 * Math.PI / 180;
+					// particle.scale.x = particle.scale.y = Math.random();
+					scene.add(particle);
+				}
+
+				container.appendChild(renderer.domElement);
+
+				stats = new Stats();
+				stats.domElement.style.position = 'absolute';
+				stats.domElement.style.top = '0px';
+				container.appendChild(stats.domElement);
+
+				document.addEventListener('mousemove', onDocumentMouseMove, false);
+				document.addEventListener('touchstart', onDocumentTouchStart, false);
+				document.addEventListener('touchmove', onDocumentTouchMove, false);
+			}
+
+			function loadTexture( path ) {
+
+				var material = new THREE.ParticleBitmapMaterial();
+
+				var texture = new Image();
+
+				texture.onload = function () {
+
+					material.bitmap = this;
+
+				};
+
+				texture.src = path;
+
+				return material;
+			}
+
+			//
+
+			function onDocumentMouseMove(event) {
+
+				mouseX = event.clientX - windowHalfX;
+				mouseY = event.clientY - windowHalfY;
+			}
+
+			function onDocumentTouchStart(event) {
+
+				if(event.touches.length == 1) {
+
+					event.preventDefault();
+
+					mouseX = event.touches[0].pageX - windowHalfX;
+					mouseY = event.touches[0].pageY - windowHalfY;
+				}
+			}
+
+			function onDocumentTouchMove(event) {
+
+				if(event.touches.length == 1) {
+
+					event.preventDefault();
+
+					mouseX = event.touches[0].pageX - windowHalfX;
+					mouseY = event.touches[0].pageY - windowHalfY;
+				}
+			}
+
+			//
+
+			function loop() {
+
+				camera.position.x += (mouseX - camera.position.x) * .05;
+				camera.position.y += (-mouseY - camera.position.y) * .05;
+
+				renderer.render(scene, camera);
+
+				stats.update();
+			}
+
+		</script>
+	</body>
+</html>

+ 10 - 7
examples/primitives/Cube.js

@@ -5,12 +5,12 @@
 var Cube = function (width, height, depth) {
 
 	THREE.Geometry.call(this);
-	
+
 	var scope = this,
 	width_half = width / 2,
 	height_half = height / 2,
 	depth_half = depth / 2;
-	
+
 	v(  width_half,  height_half, -depth_half );
 	v(  width_half, -height_half, -depth_half );
 	v( -width_half, -height_half, -depth_half );
@@ -19,23 +19,26 @@ var Cube = function (width, height, depth) {
 	v(  width_half, -height_half,  depth_half );
 	v( -width_half, -height_half,  depth_half );
 	v( -width_half,  height_half,  depth_half );
-	
+
 	f4( 0, 1, 2, 3 );
 	f4( 4, 7, 6, 5 );
 	f4( 0, 4, 5, 1 );
 	f4( 1, 5, 6, 2 );
 	f4( 2, 6, 7, 3 );
 	f4( 4, 0, 3, 7 );
-	
+
 	function v(x, y, z) {
-	
+
 		scope.vertices.push( new THREE.Vertex( new THREE.Vector3( x, y, z ) ) );
 	}
 
 	function f4(a, b, c, d) {
-	
+
 		scope.faces.push( new THREE.Face4( a, b, c, d ) );
-	}	
+	}
+
+	this.computeNormals();
+
 }
 
 Cube.prototype = new THREE.Geometry();

+ 21 - 19
examples/primitives/Cylinder.js

@@ -5,14 +5,14 @@
 var Cylinder = function (numSegs, topRad, botRad, height, topOffset, botOffset) {
 
 	THREE.Geometry.call(this);
-	
+
 	var scope = this, i;
 
 	// VERTICES
 
 	// Top circle vertices
 	for (i = 0; i < numSegs; i++) {
-	
+
 		v( 
 			Math.sin(2 * 3.1415 * i / numSegs)*topRad,
 			Math.cos(2 * 3.1415 * i / numSegs)*topRad,
@@ -21,29 +21,29 @@ var Cylinder = function (numSegs, topRad, botRad, height, topOffset, botOffset)
 
 	// Bottom circle vertices
 	for (i = 0; i < numSegs; i++) {
-	
+
 		v(  
 			Math.sin(2 * 3.1415 * i / numSegs)*botRad,
 			Math.cos(2 * 3.1415 * i / numSegs)*botRad,
 			height);
 	}
-			
-			
+
+
 	// FACES
-	
+
 	// Body	
 	for (i = 0; i < numSegs; i++) {
-	
+
 		f4(i, i + numSegs, numSegs + (i + 1) % numSegs, (i + 1) % numSegs, '#ff0000');
 	}
-	
+
 	// Bottom circle
 	if (botRad != 0) {
-	
+
 		v(0, 0, -topOffset);
-		
+
 		for (i = numSegs; i < numSegs + (numSegs / 2); i++) {
-		
+
 			f4(2 * numSegs,
 			(2 * i - 2 * numSegs) % numSegs,
 			(2 * i - 2 * numSegs + 1) % numSegs,
@@ -53,27 +53,29 @@ var Cylinder = function (numSegs, topRad, botRad, height, topOffset, botOffset)
 
 	// Top circle
 	if (topRad != 0) {
-	
+
 		v(0, 0, height + topOffset);
-		
+
 		for (i = numSegs + (numSegs / 2); i < 2 * numSegs; i++) {
-		
+
 			f4(	(2 * i - 2 * numSegs + 2) % numSegs + numSegs,
 				(2 * i - 2 * numSegs + 1) % numSegs + numSegs,
 				(2 * i - 2 * numSegs) % numSegs+numSegs, 
 				2 * numSegs + 1);
 		}
 	}
-	
+
+	this.computeNormals();
+
 	function v(x, y, z) {
-	
+
 		scope.vertices.push( new THREE.Vertex( new THREE.Vector3( x, y, z ) ) );
 	}
 
 	function f4(a, b, c, d) {
-	
-		scope.faces.push( new THREE.Face4(a, b, c, d) );
-	}	
+
+		scope.faces.push( new THREE.Face4( a, b, c, d ) );
+	}
 }
 
 Cylinder.prototype = new THREE.Geometry();

+ 6 - 13
examples/primitives/Plane.js

@@ -37,30 +37,23 @@ var Plane = function ( width, height, segments_width, segments_height ) {
 
 			var a = ix + gridX1 * iy;
 			var b = ix + gridX1 * ( iy + 1 );
-			var c = ( ix + 1 ) + gridX1 * iy;
+			var c = ( ix + 1 ) + gridX1 * ( iy + 1 );
+			var d = ( ix + 1 ) + gridX1 * iy;
 
-			this.faces.push( new THREE.Face3( a, b, c ) );
+			this.faces.push( new THREE.Face4( a, b, c, d ) );
 			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 )
+						new THREE.Vector2( ( ix + 1 ) / gridX, iy / gridY )
 					] );
 
 		}
 
 	}
 
+	this.computeNormals();
+
 }
 
 Plane.prototype = new THREE.Geometry();

+ 231 - 0
examples/test.html

@@ -0,0 +1,231 @@
+<!DOCTYPE HTML>
+<html lang="en">
+	<head>
+		<title>three.js - geometry - canvas polyfield</title>
+		<meta charset="utf-8">
+		<style type="text/css">
+			body {
+				background-color: #ffffff;
+				margin: 0px;
+				overflow: hidden;
+			}
+		</style>
+	</head>
+	<body>
+
+		<!-- <script type="text/javascript" src="../build/three.js"></script> -->
+
+		<script type="text/javascript" src="../src/Three.js"></script>
+		<script type="text/javascript" src="../src/core/Color.js"></script>
+		<script type="text/javascript" src="../src/core/Vector2.js"></script>
+		<script type="text/javascript" src="../src/core/Vector3.js"></script>
+		<script type="text/javascript" src="../src/core/Vector4.js"></script>
+		<script type="text/javascript" src="../src/core/Rectangle.js"></script>
+		<script type="text/javascript" src="../src/core/Matrix4.js"></script>
+		<script type="text/javascript" src="../src/core/Vertex.js"></script>
+		<script type="text/javascript" src="../src/core/Face3.js"></script>
+		<script type="text/javascript" src="../src/core/Face4.js"></script>
+		<script type="text/javascript" src="../src/core/Geometry.js"></script>
+		<script type="text/javascript" src="../src/cameras/Camera.js"></script>
+		<script type="text/javascript" src="../src/objects/Object3D.js"></script>
+		<script type="text/javascript" src="../src/objects/Mesh.js"></script>
+		<script type="text/javascript" src="../src/objects/Particle.js"></script>
+		<script type="text/javascript" src="../src/objects/Line.js"></script>
+		<script type="text/javascript" src="../src/materials/LineColorMaterial.js"></script>
+		<script type="text/javascript" src="../src/materials/MeshBitmapUVMappingMaterial.js"></script>
+		<script type="text/javascript" src="../src/materials/MeshColorFillMaterial.js"></script>
+		<script type="text/javascript" src="../src/materials/MeshColorStrokeMaterial.js"></script>
+		<script type="text/javascript" src="../src/materials/MeshFaceColorFillMaterial.js"></script>
+		<script type="text/javascript" src="../src/materials/MeshFaceColorStrokeMaterial.js"></script>
+		<script type="text/javascript" src="../src/materials/ParticleCircleMaterial.js"></script>
+		<script type="text/javascript" src="../src/materials/ParticleBitmapMaterial.js"></script>
+		<script type="text/javascript" src="../src/scenes/Scene.js"></script>
+		<script type="text/javascript" src="../src/renderers/Renderer.js"></script>
+		<script type="text/javascript" src="../src/renderers/CanvasRenderer.js"></script>
+		<script type="text/javascript" src="../src/renderers/SVGRenderer.js"></script>
+		<script type="text/javascript" src="../src/renderers/WebGLRenderer.js"></script>
+		<script type="text/javascript" src="../src/renderers/renderables/RenderableFace3.js"></script>
+		<script type="text/javascript" src="../src/renderers/renderables/RenderableFace4.js"></script>
+		<script type="text/javascript" src="../src/renderers/renderables/RenderableParticle.js"></script>
+		<script type="text/javascript" src="../src/renderers/renderables/RenderableLine.js"></script>
+
+		<script type="text/javascript" src="objects/Qrcode.js"></script>
+		<script type="text/javascript" src="primitives/Cube.js"></script>
+		<script type="text/javascript" src="primitives/Plane.js"></script>
+		<script type="text/javascript" src="primitives/Cylinder.js"></script>
+
+		<script type="text/javascript" src="http://github.com/mrdoob/stats.js/raw/master/build/stats.js"></script>
+
+		<script type="text/javascript">
+
+			var SCREEN_WIDTH = window.innerWidth / 3;
+			var SCREEN_HEIGHT = window.innerHeight;
+			var AMOUNT = 100;
+
+			var container;
+			var stats;
+
+			var camera;
+			var scene;
+			var canvasRenderer, svgRenderer, webglRenderer;
+
+			var mesh;
+
+			var mouseX = 0;
+			var mouseY = 0;
+
+			var windowHalfX = window.innerWidth >> 1;
+			var windowHalfY = window.innerHeight >> 1;
+
+
+			document.addEventListener('mousemove', onDocumentMouseMove, false);
+
+			init();
+			// loop();
+			setInterval(loop, 1000/60);
+
+
+			function init() {
+
+				container = document.createElement('div');
+				document.body.appendChild(container);
+
+				camera = new THREE.Camera( 75, SCREEN_WIDTH / SCREEN_HEIGHT, 1, 100000 );
+				// camera.position.x = - 5000;
+				// camera.position.y = 50000;
+				camera.position.z = 500
+
+				scene = new THREE.Scene();
+
+				// QRCODE
+
+				mesh = new THREE.Mesh(new Qrcode(), new THREE.MeshFaceColorFillMaterial());
+				mesh.scale.x = mesh.scale.y = mesh.scale.z = 2;
+				mesh.updateMatrix();
+				scene.add(mesh);
+
+				// CUBES
+
+				var cube = new Cube(100, 100, 100);
+
+				mesh = new THREE.Mesh( cube, new THREE.MeshColorFillMaterial( 0x0000ff, 0.5 ) );
+				mesh.position.x = 500;
+				mesh.rotation.x = Math.random();
+				mesh.rotation.y = Math.random();
+				mesh.scale.x = mesh.scale.y = mesh.scale.z = 2;
+				mesh.updateMatrix();
+				scene.add(mesh);
+
+				mesh = new THREE.Mesh( cube, new THREE.MeshColorFillMaterial( Math.random() * 0xffffff ) );
+				mesh.position.x = 500;
+				mesh.position.y = 500;
+				mesh.rotation.x = Math.random();
+				mesh.rotation.y = Math.random();
+				mesh.scale.x = mesh.scale.y = mesh.scale.z = 2;
+				mesh.updateMatrix();
+				scene.add(mesh);
+
+				// PLANE
+
+				mesh = new THREE.Mesh( new Plane( 100, 100 ), new THREE.MeshColorFillMaterial( Math.random() * 0xffffff ) );
+				mesh.position.y = -500;
+				mesh.scale.x = mesh.scale.y = mesh.scale.z = 2;
+				mesh.doubleSided = true;
+				mesh.updateMatrix();
+				scene.add(mesh);
+
+				// CYLINDER
+
+				mesh = new THREE.Mesh( new Cylinder( 10, 20, 100, 200, - 50, - 20 ), new THREE.MeshColorFillMaterial( Math.random() * 0xffffff ) );
+				mesh.position.x = -500;
+				mesh.scale.x = mesh.scale.y = mesh.scale.z = 2;
+				mesh.updateMatrix();
+				scene.add(mesh);
+
+				// POLYFIELD
+
+				var geometry = new THREE.Geometry();
+
+				for (var i = 0; i < 100; i ++) {
+
+					var v = new THREE.Vector3( Math.random() * 1000 - 500, Math.random() * 1000 - 500, Math.random() * 1000 - 500 );
+
+					var v0 = new THREE.Vertex( new THREE.Vector3(Math.random() * 100 - 50, Math.random() * 100 - 50, Math.random() * 100 - 50 ) );
+					var v1 = new THREE.Vertex( new THREE.Vector3(Math.random() * 100 - 50, Math.random() * 100 - 50, Math.random() * 100 - 50 ) );
+					var v2 = new THREE.Vertex( new THREE.Vector3(Math.random() * 100 - 50, Math.random() * 100 - 50, Math.random() * 100 - 50 ) );
+
+					v0.position.addSelf( v );
+					v1.position.addSelf( v );
+					v2.position.addSelf( v );
+
+					var face = new THREE.Face3( geometry.vertices.push( v0 ) - 1, geometry.vertices.push( v1 ) - 1, geometry.vertices.push( v2 ) - 1 );
+					face.color.setRGBA( Math.random(), Math.random(), Math.random(), 1 );
+					geometry.faces.push( face );
+				}
+
+				mesh = new THREE.Mesh( geometry, new THREE.MeshFaceColorFillMaterial() );
+				mesh.doubleSided = true;
+				mesh.scale.x = mesh.scale.y = mesh.scale.z = 2;
+				scene.add(mesh);
+
+				// PARTICLES
+
+				for (var i = 0; i < 100; i ++) {
+
+					particle = new THREE.Particle( new THREE.ParticleCircleMaterial( Math.random() * 0xffffff ) );
+					particle.position.x = Math.random() * 1000 - 500;
+					particle.position.y = Math.random() * 1000 - 500;
+					particle.position.z = Math.random() * 1000 - 500;
+					particle.scale.x = particle.scale.y = 10;
+					scene.add(particle);
+
+				}
+
+				canvasRenderer = new THREE.CanvasRenderer();
+				canvasRenderer.setSize( SCREEN_WIDTH, SCREEN_HEIGHT );
+				container.appendChild( canvasRenderer.domElement );
+
+				svgRenderer = new THREE.SVGRenderer();
+				svgRenderer.setSize( SCREEN_WIDTH, SCREEN_HEIGHT );
+				svgRenderer.setQuality( 'low' );
+				container.appendChild( svgRenderer.domElement );
+
+				webglRenderer = new THREE.WebGLRenderer();
+				webglRenderer.setSize( SCREEN_WIDTH, SCREEN_HEIGHT );
+				container.appendChild( webglRenderer.domElement );
+
+				stats = new Stats();
+				stats.domElement.style.position = 'absolute';
+				stats.domElement.style.top = '0px';
+				container.appendChild( stats.domElement );
+
+			}
+
+			function onDocumentMouseMove(event) {
+
+				mouseX = ( event.clientX - windowHalfX );
+				mouseY = ( event.clientY - windowHalfY );
+
+			}
+
+			function loop() {
+
+				camera.position.x += ( mouseX - camera.position.x ) * .05;
+				camera.position.y += ( - mouseY - camera.position.y ) * .05;
+				camera.updateMatrix();
+
+				mesh.rotation.y += 0.01;
+				mesh.updateMatrix();
+
+				canvasRenderer.render( scene, camera );
+				svgRenderer.render( scene, camera );
+				webglRenderer.render( scene, camera );
+
+				stats.update();
+
+			}
+
+		</script>
+
+	</body>
+</html>

+ 46 - 0
src/core/Geometry.js

@@ -9,4 +9,50 @@ THREE.Geometry = function () {
 	this.faces = [];
 	this.uvs = [];
 
+	this.computeNormals = function () {
+
+		var v, f, vA, vB, vC, cb, ab, normal;
+
+		for ( v = 0; v < this.vertices.length; v++ ) {
+
+			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 ];
+
+			cb = new THREE.Vector3();
+			ab = new THREE.Vector3();
+			normal = new THREE.Vector3();
+
+			cb.sub( vC.position, vB.position );
+			ab.sub( vA.position, vB.position );
+			cb.crossSelf( ab );
+
+			if ( !cb.isZero() ) {
+
+				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 );
+
+			}
+
+		}
+
+	};
+
 };

+ 174 - 148
src/core/Matrix4.js

@@ -2,250 +2,276 @@
  * @author mr.doob / http://mrdoob.com/
  * @author supereggbert / http://www.paulbrunt.co.uk/
  * @author philogb / http://blog.thejit.org/
+ * @author jordi_ros / http://plattsoft.com
  */
 
 THREE.Matrix4 = function () {
 
-  this._x = new THREE.Vector3();
-  this._y = new THREE.Vector3();
-  this._z = new THREE.Vector3();
+	this._x = new THREE.Vector3();
+	this._y = new THREE.Vector3();
+	this._z = new THREE.Vector3();
 
 };
 
 THREE.Matrix4.prototype = {
-  n11: 1, n12: 0, n13: 0, n14: 0,
-  n21: 0, n22: 1, n23: 0, n24: 0,
-  n31: 0, n32: 0, n33: 1, n34: 0,
-  n41: 0, n42: 0, n43: 0, n44: 1,
-    
-  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;
-  },
+	n11: 1, n12: 0, n13: 0, n14: 0,
+	n21: 0, n22: 1, n23: 0, n24: 0,
+	n31: 0, n32: 0, n33: 1, n34: 0,
+	n41: 0, n42: 0, n43: 0, n44: 1,
 
-  lookAt: function ( eye, center, up ) {
+	identity: function () {
 
-    var x = this._x, y = this._y, z = this._z;
-    
-    z.sub( eye, center );
-    z.normalize();
+		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;
 
-    x.cross( up, z );
-    x.normalize();
+	},
 
-    y.cross( z, x );
-    y.normalize();
+	lookAt: function ( eye, center, up ) {
 
-    this.n11 = x.x; this.n12 = x.y; this.n13 = x.z; this.n14 = - x.dot( eye );
-    this.n21 = y.x; this.n22 = y.y; this.n23 = y.z; this.n24 = - y.dot( eye );
-    this.n31 = z.x; this.n32 = z.y; this.n33 = z.z; this.n34 = - z.dot( eye );
-  },
+		var x = this._x, y = this._y, z = this._z;
 
-  transform: function ( v ) {
+		z.sub( eye, center );
+		z.normalize();
 
-    var vx = v.x, vy = v.y, vz = v.z, vw = v.w ? v.w : 1.0;
+		x.cross( up, z );
+		x.normalize();
 
-    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.z = this.n31 * vx + this.n32 * vy + this.n33 * vz + this.n34 * vw;
+		y.cross( z, x );
+		y.normalize();
 
-    vw = this.n41 * vx + this.n42 * vy + this.n43 * vz + this.n44 * vw;
+		this.n11 = x.x; this.n12 = x.y; this.n13 = x.z; this.n14 = - x.dot( eye );
+		this.n21 = y.x; this.n22 = y.y; this.n23 = y.z; this.n24 = - y.dot( eye );
+		this.n31 = z.x; this.n32 = z.y; this.n33 = z.z; this.n34 = - z.dot( eye );
 
-    if( v.w ) {
+	},
 
-      v.w = vw;
+	transform: function ( v ) {
 
-    } else {
+		var vx = v.x, vy = v.y, vz = v.z, vw = v.w ? v.w : 1.0;
 
-      v.x = v.x / vw;
-      v.y = v.y / vw;
-      v.z = v.z / 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.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;
 
-  crossVector: function ( a ) {
+		if( v.w ) {
 
-    var v = new THREE.Vector4();
+			v.w = vw;
 
-    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.z = this.n31 * a.x + this.n32 * a.y + this.n33 * a.z + this.n34 * a.w;
+		} else {
 
-    v.w = ( a.w ) ? this.n41 * a.x + this.n42 * a.y + this.n43 * a.z + this.n44 * a.w : 1;
+			v.x = v.x / vw;
+			v.y = v.y / vw;
+			v.z = v.z / vw;
 
-    return v;
+		}
 
-  },
+	},
 
-  multiply: function ( a, b ) {
+	crossVector: function ( a ) {
 
-    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.n13 = a.n11 * b.n13 + a.n12 * b.n23 + a.n13 * b.n33 + a.n14 * b.n43;
-    this.n14 = a.n11 * b.n14 + a.n12 * b.n24 + a.n13 * b.n34 + a.n14 * b.n44;
+		var v = new THREE.Vector4();
 
-    this.n21 = a.n21 * b.n11 + a.n22 * b.n21 + a.n23 * b.n31 + a.n24 * b.n41;
-    this.n22 = a.n21 * b.n12 + a.n22 * b.n22 + a.n23 * b.n32 + a.n24 * b.n42;
-    this.n23 = a.n21 * b.n13 + a.n22 * b.n23 + a.n23 * b.n33 + a.n24 * b.n43;
-    this.n24 = a.n21 * b.n14 + a.n22 * b.n24 + a.n23 * b.n34 + a.n24 * b.n44;
+		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.z = this.n31 * a.x + this.n32 * a.y + this.n33 * a.z + this.n34 * a.w;
 
-    this.n31 = a.n31 * b.n11 + a.n32 * b.n21 + a.n33 * b.n31 + a.n34 * b.n41;
-    this.n32 = a.n31 * b.n12 + a.n32 * b.n22 + a.n33 * b.n32 + a.n34 * b.n42;
-    this.n33 = a.n31 * b.n13 + a.n32 * b.n23 + a.n33 * b.n33 + a.n34 * b.n43;
-    this.n34 = a.n31 * b.n14 + a.n32 * b.n24 + a.n33 * b.n34 + a.n34 * b.n44;
+		v.w = ( a.w ) ? this.n41 * a.x + this.n42 * a.y + this.n43 * a.z + this.n44 * a.w : 1;
 
-    this.n41 = a.n41 * b.n11 + a.n42 * b.n21 + a.n43 * b.n31 + a.n44 * b.n41;
-    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.n44 = a.n41 * b.n14 + a.n42 * b.n24 + a.n43 * b.n34 + a.n44 * b.n44;
+		return v;
 
-  },
+	},
 
-  multiplySelf: function ( m ) {
+	multiply: function ( a, b ) {
 
-    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,
-    n31 = this.n31, n32 = this.n32, n33 = this.n33, n34 = this.n34,
-    n41 = this.n41, n42 = this.n42, n43 = this.n43, n44 = this.n44;
+		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.n13 = a.n11 * b.n13 + a.n12 * b.n23 + a.n13 * b.n33 + a.n14 * b.n43;
+		this.n14 = a.n11 * b.n14 + a.n12 * b.n24 + a.n13 * b.n34 + a.n14 * b.n44;
 
-    this.n11 = n11 * m.n11 + n12 * m.n21 + n13 * m.n31 + n14 * m.n41;
-    this.n12 = n11 * m.n12 + n12 * m.n22 + n13 * m.n32 + n14 * m.n42;
-    this.n13 = n11 * m.n13 + n12 * m.n23 + n13 * m.n33 + n14 * m.n43;
-    this.n14 = n11 * m.n14 + n12 * m.n24 + n13 * m.n34 + n14 * m.n44;
+		this.n21 = a.n21 * b.n11 + a.n22 * b.n21 + a.n23 * b.n31 + a.n24 * b.n41;
+		this.n22 = a.n21 * b.n12 + a.n22 * b.n22 + a.n23 * b.n32 + a.n24 * b.n42;
+		this.n23 = a.n21 * b.n13 + a.n22 * b.n23 + a.n23 * b.n33 + a.n24 * b.n43;
+		this.n24 = a.n21 * b.n14 + a.n22 * b.n24 + a.n23 * b.n34 + a.n24 * b.n44;
 
-    this.n21 = n21 * m.n11 + n22 * m.n21 + n23 * m.n31 + n24 * m.n41;
-    this.n22 = n21 * m.n12 + n22 * m.n22 + n23 * m.n32 + n24 * m.n42;
-    this.n23 = n21 * m.n13 + n22 * m.n23 + n23 * m.n33 + n24 * m.n43;
-    this.n24 = n21 * m.n14 + n22 * m.n24 + n23 * m.n34 + n24 * m.n44;
+		this.n31 = a.n31 * b.n11 + a.n32 * b.n21 + a.n33 * b.n31 + a.n34 * b.n41;
+		this.n32 = a.n31 * b.n12 + a.n32 * b.n22 + a.n33 * b.n32 + a.n34 * b.n42;
+		this.n33 = a.n31 * b.n13 + a.n32 * b.n23 + a.n33 * b.n33 + a.n34 * b.n43;
+		this.n34 = a.n31 * b.n14 + a.n32 * b.n24 + a.n33 * b.n34 + a.n34 * b.n44;
 
-    this.n31 = n31 * m.n11 + n32 * m.n21 + n33 * m.n31 + n34 * m.n41;
-    this.n32 = n31 * m.n12 + n32 * m.n22 + n33 * m.n32 + n34 * m.n42;
-    this.n33 = n31 * m.n13 + n32 * m.n23 + n33 * m.n33 + n34 * m.n43;
-    this.n34 = n31 * m.n14 + n32 * m.n24 + n33 * m.n34 + n34 * m.n44;
+		this.n41 = a.n41 * b.n11 + a.n42 * b.n21 + a.n43 * b.n31 + a.n44 * b.n41;
+		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.n44 = a.n41 * b.n14 + a.n42 * b.n24 + a.n43 * b.n34 + a.n44 * b.n44;
 
-    this.n41 = n41 * m.n11 + n42 * m.n21 + n43 * m.n31 + n44 * m.n41;
-    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.n44 = n41 * m.n14 + n42 * m.n24 + n43 * m.n34 + n44 * m.n44;
+	},
 
-  },
+	multiplySelf: function ( m ) {
 
-  clone: function () {
+		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,
+		n31 = this.n31, n32 = this.n32, n33 = this.n33, n34 = this.n34,
+		n41 = this.n41, n42 = this.n42, n43 = this.n43, n44 = this.n44;
 
-    var m = new THREE.Matrix4();
-    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.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;
-    return m;
+		this.n11 = n11 * m.n11 + n12 * m.n21 + n13 * m.n31 + n14 * m.n41;
+		this.n12 = n11 * m.n12 + n12 * m.n22 + n13 * m.n32 + n14 * m.n42;
+		this.n13 = n11 * m.n13 + n12 * m.n23 + n13 * m.n33 + n14 * m.n43;
+		this.n14 = n11 * m.n14 + n12 * m.n24 + n13 * m.n34 + n14 * m.n44;
 
-  },
+		this.n21 = n21 * m.n11 + n22 * m.n21 + n23 * m.n31 + n24 * m.n41;
+		this.n22 = n21 * m.n12 + n22 * m.n22 + n23 * m.n32 + n24 * m.n42;
+		this.n23 = n21 * m.n13 + n22 * m.n23 + n23 * m.n33 + n24 * m.n43;
+		this.n24 = n21 * m.n14 + n22 * m.n24 + n23 * m.n34 + n24 * m.n44;
 
-  toString: function() {
+		this.n31 = n31 * m.n11 + n32 * m.n21 + n33 * m.n31 + n34 * m.n41;
+		this.n32 = n31 * m.n12 + n32 * m.n22 + n33 * m.n32 + n34 * m.n42;
+		this.n33 = n31 * m.n13 + n32 * m.n23 + n33 * m.n33 + n34 * m.n43;
+		this.n34 = n31 * m.n14 + n32 * m.n24 + n33 * m.n34 + n34 * m.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 + " |";
+		this.n41 = n41 * m.n11 + n42 * m.n21 + n43 * m.n31 + n44 * m.n41;
+		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.n44 = n41 * m.n14 + n42 * m.n24 + n43 * m.n34 + n44 * m.n44;
+
+	},
+
+	clone: function () {
+
+		var m = new THREE.Matrix4();
+		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.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;
+		return m;
+
+	},
+
+	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 ( x, y, z ) {
 
-  var m = new THREE.Matrix4();
+	var m = new THREE.Matrix4();
 
-  m.n14 = x;
-  m.n24 = y;
-  m.n34 = z;
+	m.n14 = x;
+	m.n24 = y;
+	m.n34 = z;
 
-  return m;
+	return m;
 
 };
 
 THREE.Matrix4.scaleMatrix = function ( x, y, z ) {
 
-  var m = new THREE.Matrix4();
+	var m = new THREE.Matrix4();
 
-  m.n11 = x;
-  m.n22 = y;
-  m.n33 = z;
+	m.n11 = x;
+	m.n22 = y;
+	m.n33 = z;
 
-  return m;
+	return m;
 
 };
 
 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 ) {
 
-  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 ) {
 
-  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 ) {
 
-  var m, x, y, a, b, c, d;
+	var m, x, y, a, b, c, d;
 
-  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 );
+	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 );
 
-  m.n11 = x; m.n12 = 0; m.n13 = a; m.n14 = 0;
-  m.n21 = 0; m.n22 = y; m.n23 = b; m.n24 = 0;
-  m.n31 = 0; m.n32 = 0; m.n33 = c; m.n34 = d;
-  m.n41 = 0; m.n42 = 0; m.n43 = - 1; m.n44 = 0;
+	m.n11 = x;  m.n12 = 0;  m.n13 = a;   m.n14 = 0;
+	m.n21 = 0;  m.n22 = y;  m.n23 = b;   m.n24 = 0;
+	m.n31 = 0;  m.n32 = 0;  m.n33 = c;   m.n34 = d;
+	m.n41 = 0;  m.n42 = 0;  m.n43 = - 1; m.n44 = 0;
 
-  return m;
+	return m;
 
 };
 
 THREE.Matrix4.makePerspective = function( fov, aspect, near, far ) {
 
-  var ymax, ymin, xmin, xmax;
+	var ymax, ymin, xmin, xmax;
+
+	ymax = near * Math.tan( fov * Math.PI / 360 );
+	ymin = - ymax;
+	xmin = ymin * aspect;
+	xmax = ymax * aspect;
+
+	return THREE.Matrix4.makeFrustum( xmin, xmax, ymin, ymax, near, far );
+
+};
+
+THREE.Matrix4.makeOrtho = function( left, right, top, bottom, near, far ) {
+
+	var m, x, y, z, w, h, p;
+
+	m = new THREE.Matrix4();
+	w = right - left;
+	h = bottom - top;
+	p = far - near;
+	x = ( right + left ) / w;
+	y = ( bottom + top ) / h;
+	z = ( far + near ) / p;
 
-  ymax = near * Math.tan( fov * Math.PI / 360 );
-  ymin = - ymax;
-  xmin = ymin * aspect;
-  xmax = ymax * aspect;
+	m.n11 = 2 / w; m.n12 = 0;     m.n13 = 0;      m.n14 = -x;
+	m.n21 = 0;     m.n22 = 2 / h; m.n23 = 0;      m.n24 = -y;
+	m.n31 = 0;     m.n32 = 0;     m.n33 = -2 / p; m.n34 = -z;
+	m.n41 = 0;     m.n42 = 0;     m.n43 = 0;      m.n44 = 1;
 
-  return THREE.Matrix4.makeFrustum( xmin, xmax, ymin, ymax, near, far );
+	return m;
 
 };

+ 0 - 247
src/core/Matrix4.old.js

@@ -1,247 +0,0 @@
-/**
- * @author supereggbert / http://www.paulbrunt.co.uk/
- * @author mr.doob / http://mrdoob.com/
- */
-
-THREE.Matrix4Orig = function () {
-
-  var x, y, z;
-
-  x = new THREE.Vector3Orig();
-  y = new THREE.Vector3Orig();
-  z = new THREE.Vector3Orig();
-
-  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 ( eye, center, up ) {
-
-    z.sub( eye, center );
-    z.normalize();
-
-    x.cross( up, z );
-    x.normalize();
-
-    y.cross( z, x );
-    y.normalize();
-
-    this.n11 = x.x; this.n12 = x.y; this.n13 = x.z; this.n14 = - x.dot( eye );
-    this.n21 = y.x; this.n22 = y.y; this.n23 = y.z; this.n24 = - y.dot( eye );
-    this.n31 = z.x; this.n32 = z.y; this.n33 = z.z; 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;
-
-    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.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;
-
-    if( v.w ) {
-
-      v.w = vw;
-
-    } else {
-
-      v.x = v.x / vw;
-      v.y = v.y / vw;
-      v.z = v.z / vw;
-
-    }
-  };
-
-  this.crossVector = function ( a ) {
-
-    var v = new THREE.Vector4Orig();
-
-    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.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;
-
-    return v;
-
-  };
-
-  this.multiply = function ( a, b ) {
-
-    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.n13 = a.n11 * b.n13 + a.n12 * b.n23 + a.n13 * b.n33 + a.n14 * b.n43;
-    this.n14 = a.n11 * b.n14 + a.n12 * b.n24 + a.n13 * b.n34 + a.n14 * b.n44;
-
-    this.n21 = a.n21 * b.n11 + a.n22 * b.n21 + a.n23 * b.n31 + a.n24 * b.n41;
-    this.n22 = a.n21 * b.n12 + a.n22 * b.n22 + a.n23 * b.n32 + a.n24 * b.n42;
-    this.n23 = a.n21 * b.n13 + a.n22 * b.n23 + a.n23 * b.n33 + a.n24 * b.n43;
-    this.n24 = a.n21 * b.n14 + a.n22 * b.n24 + a.n23 * b.n34 + a.n24 * b.n44;
-
-    this.n31 = a.n31 * b.n11 + a.n32 * b.n21 + a.n33 * b.n31 + a.n34 * b.n41;
-    this.n32 = a.n31 * b.n12 + a.n32 * b.n22 + a.n33 * b.n32 + a.n34 * b.n42;
-    this.n33 = a.n31 * b.n13 + a.n32 * b.n23 + a.n33 * b.n33 + a.n34 * b.n43;
-    this.n34 = a.n31 * b.n14 + a.n32 * b.n24 + a.n33 * b.n34 + a.n34 * b.n44;
-
-    this.n41 = a.n41 * b.n11 + a.n42 * b.n21 + a.n43 * b.n31 + a.n44 * b.n41;
-    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.n44 = a.n41 * b.n14 + a.n42 * b.n24 + a.n43 * b.n34 + a.n44 * b.n44;
-
-  };
-
-  this.multiplySelf = function ( m ) {
-
-    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,
-    n31 = this.n31, n32 = this.n32, n33 = this.n33, n34 = this.n34,
-    n41 = this.n41, n42 = this.n42, n43 = this.n43, n44 = this.n44;
-
-    this.n11 = n11 * m.n11 + n12 * m.n21 + n13 * m.n31 + n14 * m.n41;
-    this.n12 = n11 * m.n12 + n12 * m.n22 + n13 * m.n32 + n14 * m.n42;
-    this.n13 = n11 * m.n13 + n12 * m.n23 + n13 * m.n33 + n14 * m.n43;
-    this.n14 = n11 * m.n14 + n12 * m.n24 + n13 * m.n34 + n14 * m.n44;
-
-    this.n21 = n21 * m.n11 + n22 * m.n21 + n23 * m.n31 + n24 * m.n41;
-    this.n22 = n21 * m.n12 + n22 * m.n22 + n23 * m.n32 + n24 * m.n42;
-    this.n23 = n21 * m.n13 + n22 * m.n23 + n23 * m.n33 + n24 * m.n43;
-    this.n24 = n21 * m.n14 + n22 * m.n24 + n23 * m.n34 + n24 * m.n44;
-
-    this.n31 = n31 * m.n11 + n32 * m.n21 + n33 * m.n31 + n34 * m.n41;
-    this.n32 = n31 * m.n12 + n32 * m.n22 + n33 * m.n32 + n34 * m.n42;
-    this.n33 = n31 * m.n13 + n32 * m.n23 + n33 * m.n33 + n34 * m.n43;
-    this.n34 = n31 * m.n14 + n32 * m.n24 + n33 * m.n34 + n34 * m.n44;
-
-    this.n41 = n41 * m.n11 + n42 * m.n21 + n43 * m.n31 + n44 * m.n41;
-    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.n44 = n41 * m.n14 + n42 * m.n24 + n43 * m.n34 + n44 * m.n44;
-
-  };
-
-  this.clone = function () {
-
-    var m = new THREE.Matrix4Orig();
-    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.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;
-    return m;
-
-  };
-
-  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.Matrix4Orig.translationMatrix = function ( x, y, z ) {
-
-  var m = new THREE.Matrix4Orig();
-
-  m.n14 = x;
-  m.n24 = y;
-  m.n34 = z;
-
-  return m;
-
-};
-
-THREE.Matrix4Orig.scaleMatrix = function ( x, y, z ) {
-
-  var m = new THREE.Matrix4Orig();
-
-  m.n11 = x;
-  m.n22 = y;
-  m.n33 = z;
-
-  return m;
-
-};
-
-THREE.Matrix4Orig.rotationXMatrix = function ( theta ) {
-
-  var rot = new THREE.Matrix4Orig();
-
-  rot.n22 = rot.n33 = Math.cos( theta );
-  rot.n32 = Math.sin( theta );
-  rot.n23 = - rot.n32;
-
-  return rot;
-
-};
-
-THREE.Matrix4Orig.rotationYMatrix = function ( theta ) {
-
-  var rot = new THREE.Matrix4Orig();
-
-  rot.n11 = rot.n33 = Math.cos( theta );
-  rot.n13 = Math.sin( theta );
-  rot.n31 = - rot.n13;
-
-  return rot;
-
-};
-
-THREE.Matrix4Orig.rotationZMatrix = function( theta ) {
-
-  var rot = new THREE.Matrix4Orig();
-
-  rot.n11 = rot.n22 = Math.cos( theta );
-  rot.n21 = Math.sin( theta );
-  rot.n12 = - rot.n21;
-
-  return rot;
-
-};
-
-THREE.Matrix4Orig.makeFrustum = function( left, right, bottom, top, near, far ) {
-
-  var m, x, y, a, b, c, d;
-
-  m = new THREE.Matrix4Orig();
-  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.n12 = 0; m.n13 = a; m.n14 = 0;
-  m.n21 = 0; m.n22 = y; m.n23 = b; m.n24 = 0;
-  m.n31 = 0; m.n32 = 0; m.n33 = c; m.n34 = d;
-  m.n41 = 0; m.n42 = 0; m.n43 = - 1; m.n44 = 0;
-
-  return m;
-
-};
-
-THREE.Matrix4Orig.makePerspective = function( fov, aspect, near, far ) {
-
-  var ymax, ymin, xmin, xmax;
-
-  ymax = near * Math.tan( fov * Math.PI / 360 );
-  ymin = - ymax;
-  xmin = ymin * aspect;
-  xmax = ymax * aspect;
-
-  return THREE.Matrix4Orig.makeFrustum( xmin, xmax, ymin, ymax, near, far );
-
-};

+ 1 - 1
src/core/Rectangle.js

@@ -147,7 +147,7 @@ THREE.Rectangle = function ( x1, y1, x2, 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;
+		return Math.min( _x2, r.getX2() ) - Math.max( _x1, r.getX1() ) >= 0 && Math.min( _y2, r.getY2() ) - Math.max( _y1, r.getY1() ) >= 0;
 
 	};
 

+ 51 - 51
src/core/Vector2.js

@@ -5,97 +5,97 @@
 
 THREE.Vector2 = function ( x, y ) {
 
-  this.x = x || 0;
-  this.y = y || 0;
+	this.x = x || 0;
+	this.y = y || 0;
 
 };
 
 THREE.Vector2.prototype = {
-  
-  set: function ( x, y ) {
 
-    this.x = x;
-    this.y = y;
+	set: function ( x, y ) {
 
-  },
+		this.x = x;
+		this.y = y;
 
-  copy: function ( v ) {
+	},
 
-    this.x = v.x;
-    this.y = v.y;
+	copy: function ( v ) {
 
-  },
+		this.x = v.x;
+		this.y = v.y;
 
-  addSelf: function ( v ) {
+	},
 
-    this.x += v.x;
-    this.y += v.y;
+	addSelf: function ( v ) {
 
-  },
+		this.x += v.x;
+		this.y += v.y;
 
-  add: function ( v1, v2 ) {
+	},
 
-    this.x = v1.x + v2.x;
-    this.y = v1.y + v2.y;
+	add: function ( v1, v2 ) {
 
-  },
+		this.x = v1.x + v2.x;
+		this.y = v1.y + v2.y;
 
-  subSelf: function ( v ) {
+	},
 
-    this.x -= v.x;
-    this.y -= v.y;
+	subSelf: function ( v ) {
 
-  },
+		this.x -= v.x;
+		this.y -= v.y;
 
-  sub: function ( v1, v2 ) {
+	},
 
-    this.x = v1.x - v2.x;
-    this.y = v1.y - v2.y;
+	sub: function ( v1, v2 ) {
 
-  },
+		this.x = v1.x - v2.x;
+		this.y = v1.y - v2.y;
 
-  multiplyScalar: function ( s ) {
+	},
 
-    this.x *= s;
-    this.y *= s;
+	multiplyScalar: function ( s ) {
 
-  },
+		this.x *= s;
+		this.y *= s;
 
-  unit: function () {
+	},
 
-    this.multiplyScalar( 1 / this.length() );
+	unit: function () {
 
-  },
+		this.multiplyScalar( 1 / this.length() );
 
-  length: function () {
+	},
 
-    return Math.sqrt( this.x * this.x + this.y * this.y );
+	length: function () {
 
-  },
+		return Math.sqrt( this.x * this.x + this.y * this.y );
 
-  lengthSq: function () {
+	},
 
-    return this.x * this.x + this.y * this.y;
+	lengthSq: function () {
 
-  },
+		return this.x * this.x + this.y * this.y;
 
-  negate: function() {
+	},
 
-    this.x = - this.x;
-    this.y = - this.y;
+	negate: function() {
 
-  },
+		this.x = - this.x;
+		this.y = - this.y;
 
-  clone: function () {
+	},
 
-    return new THREE.Vector2( this.x, this.y );
+	clone: function () {
 
-  },
+		return new THREE.Vector2( this.x, this.y );
 
-  toString: function () {
+	},
 
-    return 'THREE.Vector2 (' + this.x + ', ' + this.y + ')';
+	toString: function () {
+
+		return 'THREE.Vector2 (' + this.x + ', ' + this.y + ')';
+
+	}
 
-  }
-        
 };

+ 103 - 95
src/core/Vector3.js

@@ -6,166 +6,174 @@
 
 THREE.Vector3 = function ( x, y, z ) {
 
-  this.x = x || 0;
-  this.y = y || 0;
-  this.z = z || 0;
+	this.x = x || 0;
+	this.y = y || 0;
+	this.z = z || 0;
 
 };
 
 THREE.Vector3.prototype = {
-  
-  set: function ( x, y, z ) {
 
-    this.x = x;
-    this.y = y;
-    this.z = z;
+	set: function ( x, y, z ) {
 
-  },
+		this.x = x;
+		this.y = y;
+		this.z = z;
 
-  copy: function ( v ) {
+	},
 
-    this.x = v.x;
-    this.y = v.y;
-    this.z = v.z;
+	copy: function ( v ) {
 
-  },
+		this.x = v.x;
+		this.y = v.y;
+		this.z = v.z;
 
-  add: function( v1, v2 ) {
+	},
 
-    this.x = v1.x + v2.x;
-    this.y = v1.y + v2.y;
-    this.z = v1.z + v2.z;
+	add: function( v1, v2 ) {
 
-  },
+		this.x = v1.x + v2.x;
+		this.y = v1.y + v2.y;
+		this.z = v1.z + v2.z;
 
-  addSelf: function ( v ) {
+	},
 
-    this.x += v.x;
-    this.y += v.y;
-    this.z += v.z;
+	addSelf: function ( v ) {
 
-  },
+		this.x += v.x;
+		this.y += v.y;
+		this.z += v.z;
 
-  addScalar: function ( s ) {
+	},
 
-    this.x += s;
-    this.y += s;
-    this.z += s;
+	addScalar: function ( s ) {
 
-  },
+		this.x += s;
+		this.y += s;
+		this.z += s;
 
-  sub: function( v1, v2 ) {
+	},
 
-    this.x = v1.x - v2.x;
-    this.y = v1.y - v2.y;
-    this.z = v1.z - v2.z;
+	sub: function( v1, v2 ) {
 
-  },
+		this.x = v1.x - v2.x;
+		this.y = v1.y - v2.y;
+		this.z = v1.z - v2.z;
 
-  subSelf: function ( v ) {
+	},
 
-    this.x -= v.x;
-    this.y -= v.y;
-    this.z -= v.z;
+	subSelf: function ( v ) {
 
-  },
+		this.x -= v.x;
+		this.y -= v.y;
+		this.z -= v.z;
 
-  cross: function ( v1, v2 ) {
+	},
 
-    this.x = v1.y * v2.z - v1.z * v2.y;
-    this.y = v1.z * v2.x - v1.x * v2.z;
-    this.z = v1.x * v2.y - v1.y * v2.x;
+	cross: function ( v1, v2 ) {
 
-  },
+		this.x = v1.y * v2.z - v1.z * v2.y;
+		this.y = v1.z * v2.x - v1.x * v2.z;
+		this.z = v1.x * v2.y - v1.y * v2.x;
 
-  crossSelf: function ( v ) {
+	},
 
-    var tx = this.x, ty = this.y, tz = this.z;
+	crossSelf: function ( v ) {
 
-    this.x = ty * v.z - tz * v.y;
-    this.y = tz * v.x - tx * v.z;
-    this.z = tx * v.y - ty * v.x;
+		var tx = this.x, ty = this.y, tz = this.z;
 
-  },
+		this.x = ty * v.z - tz * v.y;
+		this.y = tz * v.x - tx * v.z;
+		this.z = tx * v.y - ty * v.x;
 
-  multiplySelf: function ( v ) {
+	},
 
-    this.x *= v.x;
-    this.y *= v.y;
-    this.z *= v.z;
-  },
+	multiplySelf: function ( v ) {
 
-  multiplyScalar: function ( s ) {
+		this.x *= v.x;
+		this.y *= v.y;
+		this.z *= v.z;
 
-    this.x *= s;
-    this.y *= s;
-    this.z *= s;
+	},
 
-  },
+	multiplyScalar: function ( s ) {
 
-  dot: function ( v ) {
+		this.x *= s;
+		this.y *= s;
+		this.z *= s;
 
-    return this.x * v.x + this.y * v.y + this.z * v.z;
+	},
 
-  },
+	dot: function ( v ) {
 
-  distanceTo: function ( v ) {
+		return this.x * v.x + this.y * v.y + this.z * v.z;
 
-    return Math.sqrt( this.distanceToSquared( v ) );
+	},
 
-  },
+	distanceTo: function ( v ) {
 
-  distanceToSquared: function ( v ) {
+		return Math.sqrt( this.distanceToSquared( v ) );
 
-    var dx = this.x - v.x, dy = this.y - v.y, dz = this.z - v.z;
-    return dx * dx + dy * dy + dz * dz;
+	},
 
-  },
+	distanceToSquared: function ( v ) {
 
-  length: function () {
+		var dx = this.x - v.x, dy = this.y - v.y, dz = this.z - v.z;
+		return dx * dx + dy * dy + dz * dz;
 
-    return Math.sqrt( this.x * this.x + this.y * this.y + this.z * this.z );
+	},
 
-  },
+	length: function () {
 
-  lengthSq: function () {
+		return Math.sqrt( 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;
+	},
 
-  },
+	lengthSq: function () {
 
-  negate: function () {
+		return this.x * this.x + this.y * this.y + this.z * this.z;
 
-    this.x = - this.x;
-    this.y = - this.y;
-    this.z = - this.z;
+	},
 
-  },
+	negate: function () {
 
-  normalize: function () {
+		this.x = - this.x;
+		this.y = - this.y;
+		this.z = - this.z;
 
-    if (this.length() > 0) {
+	},
 
-      this.multiplyScalar( 1 / this.length() );
+	normalize: function () {
 
-    } else {
+		if ( this.length() > 0 ) {
 
-      this.multiplyScalar( 0 );
+			this.multiplyScalar( 1 / this.length() );
 
-    }
+		} else {
 
-  },
+			this.multiplyScalar( 0 );
 
-  clone: function () {
+		}
 
-    return new THREE.Vector3( this.x, this.y, this.z );
+	},
 
-  },
+	isZero: function () {
 
-  toString: function () {
+		var almostZero = 0.0001;
+		return ( Math.abs( this.x ) < almostZero ) && ( Math.abs( this.y ) < almostZero ) && ( Math.abs( this.z ) < almostZero );
 
-    return 'THREE.Vector3 ( ' + this.x + ', ' + this.y + ', ' + this.z + ' )';
+	},
+
+	clone: function () {
+
+		return new THREE.Vector3( this.x, this.y, this.z );
+
+	},
+
+	toString: function () {
+
+		return 'THREE.Vector3 ( ' + this.x + ', ' + this.y + ', ' + this.z + ' )';
+
+	}
 
-  }
-    
 };

+ 46 - 46
src/core/Vector4.js

@@ -5,79 +5,79 @@
 
 THREE.Vector4 = function ( x, y, z, w ) {
 
-  this.x = x || 0;
-  this.y = y || 0;
-  this.z = z || 0;
-  this.w = w || 1;
+	this.x = x || 0;
+	this.y = y || 0;
+	this.z = z || 0;
+	this.w = w || 1;
 
 };
 
 THREE.Vector4.prototype = {
 
-  set: function ( x, y, z, w ) {
+	set: function ( x, y, z, w ) {
 
-    this.x = x;
-    this.y = y;
-    this.z = z;
-    this.w = w;
+		this.x = x;
+		this.y = y;
+		this.z = z;
+		this.w = w;
 
-  },
+	},
 
-  copy: function ( v ) {
+	copy: function ( v ) {
 
-    this.x = v.x;
-    this.y = v.y;
-    this.z = v.z;
-    this.w = v.w;
+		this.x = v.x;
+		this.y = v.y;
+		this.z = v.z;
+		this.w = v.w;
 
-  },
+	},
 
-  add: function ( v1, v2 ) {
+	add: function ( v1, v2 ) {
 
-    this.x = v1.x + v2.x;
-    this.y = v1.y + v2.y;
-    this.z = v1.z + v2.z;
-    this.w = v1.w + v2.w;
+		this.x = v1.x + v2.x;
+		this.y = v1.y + v2.y;
+		this.z = v1.z + v2.z;
+		this.w = v1.w + v2.w;
 
-  },
+	},
 
-  addSelf: function ( v ) {
+	addSelf: function ( v ) {
 
-    this.x += v.x;
-    this.y += v.y;
-    this.z += v.z;
-    this.w += v.w;
+		this.x += v.x;
+		this.y += v.y;
+		this.z += v.z;
+		this.w += v.w;
 
-  },
+	},
 
-  sub: function ( v1, v2 ) {
+	sub: function ( v1, v2 ) {
 
-    this.x = v1.x - v2.x;
-    this.y = v1.y - v2.y;
-    this.z = v1.z - v2.z;
-    this.w = v1.w - v2.w;
+		this.x = v1.x - v2.x;
+		this.y = v1.y - v2.y;
+		this.z = v1.z - v2.z;
+		this.w = v1.w - v2.w;
 
-  },
+	},
 
-  subSelf: function ( v ) {
+	subSelf: function ( v ) {
 
-    this.x -= v.x;
-    this.y -= v.y;
-    this.z -= v.z;
-    this.w -= v.w;
+		this.x -= v.x;
+		this.y -= v.y;
+		this.z -= v.z;
+		this.w -= v.w;
 
-  },
+	},
 
-  clone: function () {
+	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 );
 
-  },
+	},
 
-  toString: function () {
+	toString: function () {
 
-    return 'THREE.Vector4 (' + this.x + ', ' + this.y + ', ' + this.z + ', ' + this.w + ')';
+		return 'THREE.Vector4 (' + this.x + ', ' + this.y + ', ' + this.z + ', ' + this.w + ')';
 
-  }
+	}
 
 };

+ 0 - 15
src/materials/BitmapUVMappingMaterial.js

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

+ 0 - 13
src/materials/FaceColorFillMaterial.js

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

+ 0 - 15
src/materials/FaceColorStrokeMaterial.js

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

+ 2 - 2
src/materials/ColorStrokeMaterial.js → src/materials/LineColorMaterial.js

@@ -2,7 +2,7 @@
  * @author mr.doob / http://mrdoob.com/
  */
 
-THREE.ColorStrokeMaterial = function ( lineWidth, hex, opacity ) {
+THREE.LineColorMaterial = function ( hex, opacity, lineWidth ) {
 
 	this.lineWidth = lineWidth || 1;
 
@@ -10,7 +10,7 @@ THREE.ColorStrokeMaterial = function ( lineWidth, hex, opacity ) {
 
 	this.toString = function () {
 
-		return 'THREE.ColorStrokeMaterial ( lineWidth: ' + this.lineWidth + ', color: ' + this.color + ' )';
+		return 'THREE.LineColorMaterial ( color: ' + this.color + ', lineWidth: ' + this.lineWidth + ' )';
 
 	};
 

+ 15 - 0
src/materials/MeshBitmapUVMappingMaterial.js

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

+ 2 - 2
src/materials/ColorFillMaterial.js → src/materials/MeshColorFillMaterial.js

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

+ 17 - 0
src/materials/MeshColorStrokeMaterial.js

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

+ 13 - 0
src/materials/MeshFaceColorFillMaterial.js

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

+ 15 - 0
src/materials/MeshFaceColorStrokeMaterial.js

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

+ 304 - 131
src/renderers/CanvasRenderer.js

@@ -45,9 +45,8 @@ THREE.CanvasRenderer = function () {
 		var e, el, m, ml, element, material, pi2 = Math.PI * 2,
 		v1x, v1y, v2x, v2y, v3x, v3y, v4x, v4y, width, height,
 
-		uv1 = new THREE.Vector2(), uv2 = new THREE.Vector2(), uv3 = new THREE.Vector2(),
-		suv1 = new THREE.Vector2(), suv2 = new THREE.Vector2(), suv3 = new THREE.Vector2(),
-		suv1x, suv1y, suv2x, suv2y, suv3x, suv3y, denom, m11, m12, m21, m22, dx, dy,
+		uv1 = new THREE.Vector2(), uv2 = new THREE.Vector2(), uv3 = new THREE.Vector2(), uv4 = new THREE.Vector2(),
+		suv1 = new THREE.Vector2(), suv2 = new THREE.Vector2(), suv3 = new THREE.Vector2(), suv4 = new THREE.Vector2(),
 		bitmap, bitmapWidth, bitmapHeight;
 
 		if ( this.autoClear ) {
@@ -58,7 +57,7 @@ THREE.CanvasRenderer = function () {
 
 		/* DEBUG
 		_context.fillStyle = 'rgba(0, 255, 255, 0.5)';
-		_context.fillRect(_clipRect.getX(), _clipRect.getY(), _clipRect.getWidth(), _clipRect.getHeight());
+		_context.fillRect( _clipRect.getX(), _clipRect.getY(), _clipRect.getWidth(), _clipRect.getHeight() );
 		*/
 
 		this.project( scene, camera );
@@ -69,12 +68,71 @@ THREE.CanvasRenderer = function () {
 
 			_bboxRect.empty();
 
-			_context.beginPath();
-
 			if ( element instanceof THREE.RenderableParticle ) {
 
 				v1x = element.x * _widthHalf; v1y = element.y * _heightHalf;
 
+				for ( m = 0, ml = element.material.length; m < ml; m++ ) {
+
+					material = element.material[ m ];
+
+					if ( material instanceof THREE.ParticleCircleMaterial ) {
+
+						width = element.scale.x * _widthHalf;
+						height = element.scale.y * _heightHalf;
+
+						_bboxRect.set( v1x - width, v1y - height, v1x + width, v1y + height );
+
+						if ( !_clipRect.instersects( _bboxRect ) ) {
+
+							continue;
+
+						}
+
+						_context.save();
+						_context.translate( v1x, v1y );
+						_context.rotate( - element.rotation );
+						_context.scale( width, height );
+
+						_context.beginPath();
+						_context.arc( 0, 0, 1, 0, pi2, true );
+						_context.closePath();
+
+						_context.fillStyle = material.color.__styleString;
+						_context.fill();
+
+						_context.restore();
+
+					} else if ( material instanceof THREE.ParticleBitmapMaterial ) {
+
+						bitmap = material.bitmap;
+						bitmapWidth = bitmap.width / 2;
+						bitmapHeight = bitmap.height / 2;
+
+						width = element.scale.x * _widthHalf * bitmapWidth;
+						height = element.scale.y * _heightHalf * bitmapHeight;
+
+						_bboxRect.set( v1x - width, v1y - height, v1x + width, v1y + height );
+
+						if ( !_clipRect.instersects( _bboxRect ) ) {
+
+							continue;
+
+						}
+
+						_context.save();
+						_context.translate( v1x - width, v1y + height );
+						_context.rotate( - element.rotation );
+						_context.scale( element.scale.x * _widthHalf, - ( element.scale.y * _heightHalf ) );
+
+						_context.drawImage( bitmap, 0, 0 );
+
+						_context.restore();
+
+					}
+
+				}
+
 			} else if ( element instanceof THREE.RenderableLine ) {
 
 				v1x = element.v1.x * _widthHalf; v1y = element.v1.y * _heightHalf;
@@ -89,8 +147,29 @@ THREE.CanvasRenderer = function () {
 
 				}
 
+				_context.beginPath();
 				_context.moveTo( v1x, v1y );
 				_context.lineTo( v2x, v2y );
+				_context.closePath();
+
+				for ( m = 0, ml = element.material.length; m < ml; m++ ) {
+
+					material = element.material[ m ];
+
+					if ( material instanceof THREE.LineColorMaterial ) {
+
+						_context.lineWidth = material.lineWidth;
+						_context.lineJoin = "round";
+						_context.lineCap = "round";
+
+						_context.strokeStyle = material.color.__styleString;
+						_context.stroke();
+
+						_bboxRect.inflate( _context.lineWidth );
+
+					}
+
+				}
 
 			} else if ( element instanceof THREE.RenderableFace3 ) {
 
@@ -120,10 +199,108 @@ THREE.CanvasRenderer = function () {
 
 				}
 
-				_context.moveTo( v1x, v1y );
-				_context.lineTo( v2x, v2y );
-				_context.lineTo( v3x, v3y );
-				_context.lineTo( v1x, v1y );
+				for ( m = 0, ml = element.material.length; m < ml; m++ ) {
+
+					material = element.material[ m ];
+
+					if ( material instanceof THREE.MeshColorFillMaterial ) {
+
+						_context.beginPath();
+						_context.moveTo( v1x, v1y );
+						_context.lineTo( v2x, v2y );
+						_context.lineTo( v3x, v3y );
+						_context.lineTo( v1x, v1y );
+						_context.closePath();
+
+						_context.fillStyle = material.color.__styleString;
+						_context.fill();
+
+					} else if ( material instanceof THREE.MeshColorStrokeMaterial ) {
+
+						_context.beginPath();
+						_context.moveTo( v1x, v1y );
+						_context.lineTo( v2x, v2y );
+						_context.lineTo( v3x, v3y );
+						_context.lineTo( v1x, v1y );
+						_context.closePath();
+
+						_context.lineWidth = material.lineWidth;
+						_context.lineJoin = "round";
+						_context.lineCap = "round";
+
+						_context.strokeStyle = material.color.__styleString;
+						_context.stroke();
+
+						_bboxRect.inflate( _context.lineWidth );
+
+					} else if ( material instanceof THREE.MeshFaceColorFillMaterial ) {
+
+						_context.beginPath();
+						_context.moveTo( v1x, v1y );
+						_context.lineTo( v2x, v2y );
+						_context.lineTo( v3x, v3y );
+						_context.lineTo( v1x, v1y );
+						_context.closePath();
+
+						_context.fillStyle = element.color.__styleString;
+						_context.fill();
+
+					} else if ( material instanceof THREE.MeshFaceColorStrokeMaterial ) {
+
+						_context.beginPath();
+						_context.moveTo( v1x, v1y );
+						_context.lineTo( v2x, v2y );
+						_context.lineTo( v3x, v3y );
+						_context.lineTo( v1x, v1y );
+						_context.closePath();
+
+						_context.lineWidth = material.lineWidth;
+						_context.lineJoin = "round";
+						_context.lineCap = "round";
+
+						_context.strokeStyle = element.color.__styleString;
+						_context.stroke();
+
+						_bboxRect.inflate( _context.lineWidth );
+
+
+					} else if ( material instanceof THREE.MeshBitmapUVMappingMaterial ) {
+
+						bitmap = material.bitmap;
+						bitmapWidth = bitmap.width;
+						bitmapHeight = bitmap.height;
+
+						uv1.copy( element.uvs[ 0 ] ); uv2.copy( element.uvs[ 1 ] ); uv3.copy( element.uvs[ 2 ] );
+						suv1.copy( uv1 ); suv2.copy( uv2 ); suv3.copy( uv3 );
+
+						suv1.x *= bitmapWidth; suv1.y *= bitmapHeight;
+						suv2.x *= bitmapWidth; suv2.y *= bitmapHeight;
+						suv3.x *= bitmapWidth; suv3.y *= bitmapHeight;
+
+						/*
+						if ( element.overdraw ) {
+
+							expand( suv1, suv2 );
+							expand( suv2, suv3 );
+							expand( suv3, suv1 );
+
+							suv1.x = ( uv1.x === 0 ) ? 1 : ( uv1.x === 1 ) ? suv1.x - 1 : suv1.x;
+							suv1.y = ( uv1.y === 0 ) ? 1 : ( uv1.y === 1 ) ? suv1.y - 1 : suv1.y;
+
+							suv2.x = ( uv2.x === 0 ) ? 1 : ( uv2.x === 1 ) ? suv2.x - 1 : suv2.x;
+							suv2.y = ( uv2.y === 0 ) ? 1 : ( uv2.y === 1 ) ? suv2.y - 1 : suv2.y;
+
+							suv3.x = ( uv3.x === 0 ) ? 1 : ( uv3.x === 1 ) ? suv3.x - 1 : suv3.x;
+							suv3.y = ( uv3.y === 0 ) ? 1 : ( uv3.y === 1 ) ? suv3.y - 1 : suv3.y;
+
+						}
+						*/
+
+						drawTexturedTriangle( bitmap, v1x, v1y, v2x, v2y, v3x, v3y, suv1.x, suv1.y, suv2.x, suv2.y, suv3.x, suv3.y );
+
+					}
+
+				}
 
 			} else if ( element instanceof THREE.RenderableFace4 ) {
 
@@ -157,174 +334,170 @@ THREE.CanvasRenderer = function () {
 
 				}
 
-				_context.moveTo( v1x, v1y );
-				_context.lineTo( v2x, v2y );
-				_context.lineTo( v3x, v3y );
-				_context.lineTo( v4x, v4y );
-				_context.lineTo( v1x, v1y );
+				for ( m = 0, ml = element.material.length; m < ml; m++ ) {
 
-			}
+					material = element.material[ m ];
 
-			_context.closePath();
+					if ( material instanceof THREE.MeshColorFillMaterial ) {
 
-			for ( m = 0, ml = element.material.length; m < ml; m++ ) {
+						_context.beginPath();
+						_context.moveTo( v1x, v1y );
+						_context.lineTo( v2x, v2y );
+						_context.lineTo( v3x, v3y );
+						_context.lineTo( v4x, v4y );
+						_context.lineTo( v1x, v1y );
+						_context.closePath();
 
-				material = element.material[ m ];
+						_context.fillStyle = material.color.__styleString;
+						_context.fill();
 
-				if ( material instanceof THREE.ParticleCircleMaterial ) {
 
-					width = element.scale.x * _widthHalf;
-					height = element.scale.y * _heightHalf;
+					} else if ( material instanceof THREE.MeshColorStrokeMaterial ) {
 
-					_bboxRect.set( v1x - width, v1y - height, v1x + width, v1y + height );
+						_context.beginPath();
+						_context.moveTo( v1x, v1y );
+						_context.lineTo( v2x, v2y );
+						_context.lineTo( v3x, v3y );
+						_context.lineTo( v4x, v4y );
+						_context.lineTo( v1x, v1y );
+						_context.closePath();
 
-					if ( !_clipRect.instersects( _bboxRect ) ) {
+						_context.lineWidth = material.lineWidth;
+						_context.lineJoin = "round";
+						_context.lineCap = "round";
 
-						continue;
+						_context.strokeStyle = material.color.__styleString;
+						_context.stroke();
 
-					}
-
-					_context.save();
-					_context.translate( v1x, v1y );
-					_context.rotate( - element.rotation );
-					_context.scale( width, height );
-					_context.arc( 0, 0, 1, 0, pi2, true );
-					_context.restore();
-
-					_context.fillStyle = material.color.__styleString;
-					_context.fill();
+						_bboxRect.inflate( _context.lineWidth );
 
-				} else if ( material instanceof THREE.ParticleBitmapMaterial ) {
+					} else if ( material instanceof THREE.MeshFaceColorFillMaterial ) {
 
-					bitmap = material.bitmap;
-					bitmapWidth = bitmap.width / 2;
-					bitmapHeight = bitmap.height / 2;
+						_context.beginPath();
+						_context.moveTo( v1x, v1y );
+						_context.lineTo( v2x, v2y );
+						_context.lineTo( v3x, v3y );
+						_context.lineTo( v4x, v4y );
+						_context.lineTo( v1x, v1y );
+						_context.closePath();
 
-					width = element.scale.x * _widthHalf * bitmapWidth;
-					height = element.scale.y * _heightHalf * bitmapHeight;
+						_context.fillStyle = element.color.__styleString;
+						_context.fill();
 
-					_bboxRect.set( v1x - width, v1y - height, v1x + width, v1y + height );
+					} else if ( material instanceof THREE.MeshFaceColorStrokeMaterial ) {
 
-					if ( !_clipRect.instersects( _bboxRect ) ) {
-
-						continue;
-
-					}
+						_context.beginPath();
+						_context.moveTo( v1x, v1y );
+						_context.lineTo( v2x, v2y );
+						_context.lineTo( v3x, v3y );
+						_context.lineTo( v4x, v4y );
+						_context.lineTo( v1x, v1y );
+						_context.closePath();
 
-					_context.save();
-					_context.translate( v1x - width, v1y + height );
-					_context.rotate( - element.rotation );
-					_context.scale( element.scale.x * _widthHalf, - ( element.scale.y * _heightHalf ) );
-					_context.drawImage( bitmap, 0, 0 );
-					_context.restore();
+						_context.lineWidth = material.lineWidth;
+						_context.lineJoin = "round";
+						_context.lineCap = "round";
 
-				} else if ( material instanceof THREE.ColorFillMaterial ) {
+						_context.strokeStyle = element.color.__styleString;
+						_context.stroke();
 
-					_context.fillStyle = material.color.__styleString;
-					_context.fill();
+						_bboxRect.inflate( _context.lineWidth );
 
-				} else if ( material instanceof THREE.FaceColorFillMaterial ) {
+					} else if ( material instanceof THREE.MeshBitmapUVMappingMaterial ) {
 
-					_context.fillStyle = element.color.__styleString;
-					_context.fill();
+						bitmap = material.bitmap;
+						bitmapWidth = bitmap.width;
+						bitmapHeight = bitmap.height;
 
-				} else if ( material instanceof THREE.ColorStrokeMaterial ) {
+						uv1.copy( element.uvs[ 0 ] ); uv2.copy( element.uvs[ 1 ] ); uv3.copy( element.uvs[ 2 ] ); uv4.copy( element.uvs[ 3 ] );
+						suv1.copy( uv1 ); suv2.copy( uv2 ); suv3.copy( uv3 );  suv4.copy( uv4 );
 
-					_context.lineWidth = material.lineWidth;
-					_context.lineJoin = "round";
-					_context.lineCap = "round";
+						suv1.x *= bitmapWidth; suv1.y *= bitmapHeight;
+						suv2.x *= bitmapWidth; suv2.y *= bitmapHeight;
+						suv3.x *= bitmapWidth; suv3.y *= bitmapHeight;
+						suv4.x *= bitmapWidth; suv4.y *= bitmapHeight;
 
-					_context.strokeStyle = material.color.__styleString;
-					_context.stroke();
+						/*
+						if ( element.overdraw ) {
 
-					_bboxRect.inflate( _context.lineWidth );
+							expand( suv1, suv2 );
+							expand( suv2, suv3 );
+							expand( suv3, suv4 );
+							expand( suv4, suv1 );
 
-				} else if ( material instanceof THREE.FaceColorStrokeMaterial ) {
+							suv1.x = ( uv1.x === 0 ) ? 1 : ( uv1.x === 1 ) ? suv1.x - 1 : suv1.x;
+							suv1.y = ( uv1.y === 0 ) ? 1 : ( uv1.y === 1 ) ? suv1.y - 1 : suv1.y;
 
-					_context.lineWidth = material.lineWidth;
-					_context.lineJoin = "round";
-					_context.lineCap = "round";
+							suv2.x = ( uv2.x === 0 ) ? 1 : ( uv2.x === 1 ) ? suv2.x - 1 : suv2.x;
+							suv2.y = ( uv2.y === 0 ) ? 1 : ( uv2.y === 1 ) ? suv2.y - 1 : suv2.y;
 
-					_context.strokeStyle = element.color.__styleString;
-					_context.stroke();
+							suv3.x = ( uv3.x === 0 ) ? 1 : ( uv3.x === 1 ) ? suv3.x - 1 : suv3.x;
+							suv3.y = ( uv3.y === 0 ) ? 1 : ( uv3.y === 1 ) ? suv3.y - 1 : suv3.y;
 
-					_bboxRect.inflate( _context.lineWidth );
+							suv4.x = ( uv4.x === 0 ) ? 1 : ( uv4.x === 1 ) ? suv4.x - 1 : suv4.x;
+							suv4.y = ( uv4.y === 0 ) ? 1 : ( uv4.y === 1 ) ? suv4.y - 1 : suv4.y;
+						}
+						*/
 
-				} else if ( material instanceof THREE.BitmapUVMappingMaterial ) {
+						drawTexturedTriangle( bitmap, v1x, v1y, v2x, v2y, v4x, v4y, suv1.x, suv1.y, suv2.x, suv2.y, suv4.x, suv4.y );
+						drawTexturedTriangle( bitmap, v2x, v2y, v3x, v3y, v4x, v4y, suv2.x, suv2.y, suv3.x, suv3.y, suv4.x, suv4.y );
 
-					bitmap = material.bitmap;
-					bitmapWidth = bitmap.width;
-					bitmapHeight = bitmap.height;
-
-					uv1.copy( element.uvs[ 0 ] ); uv2.copy( element.uvs[ 1 ] ); uv3.copy( element.uvs[ 2 ] );
-					suv1.copy( uv1 ); suv2.copy( uv2 ); suv3.copy( uv3 );
-
-					suv1.x *= bitmapWidth; suv1.y *= bitmapHeight;
-					suv2.x *= bitmapWidth; suv2.y *= bitmapHeight;
-					suv3.x *= bitmapWidth; suv3.y *= bitmapHeight;
-
-					if ( element.overdraw ) {
-
-						expand( suv1, suv2 );
-						expand( suv2, suv3 );
-						expand( suv3, suv1 );
-
-						suv1.x = ( uv1.x === 0 ) ? 1 : ( uv1.x === 1 ) ? suv1.x - 1 : suv1.x;
-						suv1.y = ( uv1.y === 0 ) ? 1 : ( uv1.y === 1 ) ? suv1.y - 1 : suv1.y;
+					}
 
-						suv2.x = ( uv2.x === 0 ) ? 1 : ( uv2.x === 1 ) ? suv2.x - 1 : suv2.x;
-						suv2.y = ( uv2.y === 0 ) ? 1 : ( uv2.y === 1 ) ? suv2.y - 1 : suv2.y;
+				}
 
-						suv3.x = ( uv3.x === 0 ) ? 1 : ( uv3.x === 1 ) ? suv3.x - 1 : suv3.x;
-						suv3.y = ( uv3.y === 0 ) ? 1 : ( uv3.y === 1 ) ? suv3.y - 1 : suv3.y;
+			}
 
-					}
+			/* DEBUG
+			_context.lineWidth = 1;
+			_context.strokeStyle = 'rgba( 0, 255, 0, 0.5 )';
+			_context.strokeRect( _bboxRect.getX(), _bboxRect.getY(), _bboxRect.getWidth(), _bboxRect.getHeight() );
+			*/
 
-					suv1x = suv1.x; suv1y = suv1.y;
-					suv2x = suv2.x; suv2y = suv2.y;
-					suv3x = suv3.x; suv3y = suv3.y;
+			_clearRect.addRectangle( _bboxRect );
 
-					// Textured triangle drawing by Thatcher Ulrich.
-					// http://tulrich.com/geekstuff/canvas/jsgl.js
+		}
 
-					_context.save();
-					_context.clip();
+		/* DEBUG
+		_context.lineWidth = 1;
+		_context.strokeStyle = 'rgba( 255, 0, 0, 0.5 )';
+		_context.strokeRect( _clearRect.getX(), _clearRect.getY(), _clearRect.getWidth(), _clearRect.getHeight() );
+		*/
 
-					denom = suv1x * ( suv3y - suv2y ) - suv2x * suv3y + suv3x * suv2y + ( suv2x - suv3x ) * suv1y;
+	};
 
-					m11 = - ( suv1y * (v3x - v2x ) - suv2y * v3x + suv3y * v2x + ( suv2y - suv3y ) * v1x ) / denom;
-					m12 = ( suv2y * v3y + suv1y * ( v2y - v3y ) - suv3y * v2y + ( suv3y - suv2y) * v1y ) / denom;
-					m21 = ( suv1x * ( v3x - v2x ) - suv2x * v3x + suv3x * v2x + ( suv2x - suv3x ) * v1x ) / denom;
-					m22 = - ( suv2x * v3y + suv1x * ( v2y - v3y ) - suv3x * v2y + ( suv3x - suv2x ) * v1y ) / denom;
-					dx = ( suv1x * ( suv3y * v2x - suv2y * v3x ) + suv1y * ( suv2x * v3x - suv3x * v2x ) + ( suv3x * suv2y - suv2x * suv3y ) * v1x ) / denom;
-					dy = ( suv1x * ( suv3y * v2y - suv2y * v3y ) + suv1y * ( suv2x * v3y - suv3x * v2y ) + ( suv3x * suv2y - suv2x * suv3y ) * v1y ) / denom;
+	function drawTexturedTriangle( bitmap, v1x, v1y, v2x, v2y, v3x, v3y, suv1x, suv1y, suv2x, suv2y, suv3x, suv3y )  {
 
-					_context.transform( m11, m12, m21, m22, dx, dy );
+		// Textured triangle drawing by Thatcher Ulrich.
+		// http://tulrich.com/geekstuff/canvas/jsgl.js
 
-					_context.drawImage( bitmap, 0, 0 );
-					_context.restore();
+		var denom, m11, m12, m21, m22, dx, dy;
 
-				}
+		_context.beginPath();
+		_context.moveTo( v1x, v1y );
+		_context.lineTo( v2x, v2y );
+		_context.lineTo( v3x, v3y );
+		_context.lineTo( v1x, v1y );
+		_context.closePath();
 
-				/* DEBUG
-				_context.lineWidth = 1;
-				_context.strokeStyle = 'rgba( 0, 255, 0, 0.5 )';
-				_context.strokeRect( _bboxRect.getX(), _bboxRect.getY(), _bboxRect.getWidth(), _bboxRect.getHeight() );
-				*/
+		_context.save();
+		_context.clip();
 
-				_clearRect.addRectangle( _bboxRect );
+		denom = suv1x * ( suv3y - suv2y ) - suv2x * suv3y + suv3x * suv2y + ( suv2x - suv3x ) * suv1y;
 
-			}
+		m11 = - ( suv1y * (v3x - v2x ) - suv2y * v3x + suv3y * v2x + ( suv2y - suv3y ) * v1x ) / denom;
+		m12 = ( suv2y * v3y + suv1y * ( v2y - v3y ) - suv3y * v2y + ( suv3y - suv2y) * v1y ) / denom;
+		m21 = ( suv1x * ( v3x - v2x ) - suv2x * v3x + suv3x * v2x + ( suv2x - suv3x ) * v1x ) / denom;
+		m22 = - ( suv2x * v3y + suv1x * ( v2y - v3y ) - suv3x * v2y + ( suv3x - suv2x ) * v1y ) / denom;
+		dx = ( suv1x * ( suv3y * v2x - suv2y * v3x ) + suv1y * ( suv2x * v3x - suv3x * v2x ) + ( suv3x * suv2y - suv2x * suv3y ) * v1x ) / denom;
+		dy = ( suv1x * ( suv3y * v2y - suv2y * v3y ) + suv1y * ( suv2x * v3y - suv3x * v2y ) + ( suv3x * suv2y - suv2x * suv3y ) * v1y ) / denom;
 
-		}
+		_context.transform( m11, m12, m21, m22, dx, dy );
 
-		/* DEBUG
-		_context.lineWidth = 1;
-		_context.strokeStyle = 'rgba( 255, 0, 0, 0.5 )';
-		_context.strokeRect( _clearRect.getX(), _clearRect.getY(), _clearRect.getWidth(), _clearRect.getHeight() );
-		*/
+		_context.drawImage( bitmap, 0, 0 );
+		_context.restore();
 
-	};
+	}
 
 	function expand( a, b ) {
 

+ 14 - 27
src/renderers/Renderer.js

@@ -68,8 +68,6 @@ THREE.Renderer = function() {
 
 					face = object.geometry.faces[ f ];
 
-					// TODO: Use normals for culling... maybe not?
-
 					if ( face instanceof THREE.Face3 ) {
 
 						v1 = object.geometry.vertices[ face.a ];
@@ -80,21 +78,16 @@ THREE.Renderer = function() {
 						   ( 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 ) ) {
 
-							face.screen.z = Math.max( v1.screen.z, Math.max( v2.screen.z, v3.screen.z ) );
-
 							if ( !face3Pool[ face3count ] ) {
 
 								face3Pool[ face3count ] = new THREE.RenderableFace3();
 
 							}
 
-							face3Pool[ face3count ].v1.x = v1.screen.x;
-							face3Pool[ face3count ].v1.y = v1.screen.y;
-							face3Pool[ face3count ].v2.x = v2.screen.x;
-							face3Pool[ face3count ].v2.y = v2.screen.y;
-							face3Pool[ face3count ].v3.x = v3.screen.x;
-							face3Pool[ face3count ].v3.y = v3.screen.y;
-							face3Pool[ face3count ].z = face.screen.z;
+							face3Pool[ face3count ].v1.copy( v1.screen );
+							face3Pool[ face3count ].v2.copy( v2.screen );
+							face3Pool[ face3count ].v3.copy( v3.screen );
+							face3Pool[ face3count ].z = Math.max( v1.screen.z, Math.max( v2.screen.z, v3.screen.z ) );
 
 							face3Pool[ face3count ].material = object.material;
 							face3Pool[ face3count ].overdraw = object.overdraw;
@@ -119,23 +112,17 @@ THREE.Renderer = function() {
 						   ( v2.screen.x - v3.screen.x ) * ( v4.screen.y - v3.screen.y ) -
 						   ( v2.screen.y - v3.screen.y ) * ( v4.screen.x - v3.screen.x ) < 0 ) ) ) {
 
-							face.screen.z = Math.max( v1.screen.z, Math.max( v2.screen.z, Math.max( v3.screen.z, v4.screen.z ) ) );
-
 							if ( !face4Pool[ face4count ] ) {
 
 								face4Pool[ face4count ] = new THREE.RenderableFace4();
 
 							}
 
-							face4Pool[ face4count ].v1.x = v1.screen.x;
-							face4Pool[ face4count ].v1.y = v1.screen.y;
-							face4Pool[ face4count ].v2.x = v2.screen.x;
-							face4Pool[ face4count ].v2.y = v2.screen.y;
-							face4Pool[ face4count ].v3.x = v3.screen.x;
-							face4Pool[ face4count ].v3.y = v3.screen.y;
-							face4Pool[ face4count ].v4.x = v4.screen.x;
-							face4Pool[ face4count ].v4.y = v4.screen.y;
-							face4Pool[ face4count ].z = face.screen.z;
+							face4Pool[ face4count ].v1.copy( v1.screen );
+							face4Pool[ face4count ].v2.copy( v2.screen );
+							face4Pool[ face4count ].v3.copy( v3.screen );
+							face4Pool[ face4count ].v4.copy( v4.screen );
+							face4Pool[ face4count ].z = Math.max( v1.screen.z, Math.max( v2.screen.z, Math.max( v3.screen.z, v4.screen.z ) ) );
 
 							face4Pool[ face4count ].material = object.material;
 							face4Pool[ face4count ].overdraw = object.overdraw;
@@ -146,7 +133,9 @@ THREE.Renderer = function() {
 
 							face4count++;
 						}
+
 					}
+
 				}
 
 			} else if ( object instanceof THREE.Line ) {
@@ -175,10 +164,8 @@ THREE.Renderer = function() {
 
 							}
 
-							linePool[ lineCount ].v1.x = vertex.screen.x;
-							linePool[ lineCount ].v1.y = vertex.screen.y;
-							linePool[ lineCount ].v2.x = vertex2.screen.x;
-							linePool[ lineCount ].v2.y = vertex2.screen.y;
+							linePool[ lineCount ].v1.copy( vertex.screen );
+							linePool[ lineCount ].v2.copy( vertex2.screen );
 							linePool[ lineCount ].z = Math.max( vertex.screen.z, vertex2.screen.z );
 							linePool[ lineCount ].material = object.material;
 
@@ -218,7 +205,7 @@ THREE.Renderer = function() {
 					particlePool[ particleCount ].material = object.material;
 					particlePool[ particleCount ].color = object.color;
 
-					this.renderList.push( particlePool[particleCount] );
+					this.renderList.push( particlePool[ particleCount ] );
 
 					particleCount++;
 

+ 4 - 4
src/renderers/SVGRenderer.js

@@ -137,19 +137,19 @@ THREE.SVGRenderer = function () {
 
 				// TODO: Move out of materials loop
 
-				if ( material instanceof THREE.ColorFillMaterial ) {
+				if ( material instanceof THREE.MeshColorFillMaterial ) {
 
 					svgNode.setAttribute( 'style', 'fill: ' + material.color.__styleString );
 
-				} else if ( material instanceof THREE.FaceColorFillMaterial ) {
+				} else if ( material instanceof THREE.MeshFaceColorFillMaterial ) {
 
 					svgNode.setAttribute( 'style', 'fill: ' + element.color.__styleString );
 
-				} else if ( material instanceof THREE.ColorStrokeMaterial ) {
+				} else if ( material instanceof THREE.MeshColorStrokeMaterial ) {
 
 					svgNode.setAttribute( 'style', 'fill: none; stroke: ' + material.color.__styleString + '; stroke-width: ' + material.lineWidth + '; stroke-linecap: round; stroke-linejoin: round' );
 
-				} else if ( material instanceof THREE.FaceColorStrokeMaterial ) {
+				} else if ( material instanceof THREE.MeshFaceColorStrokeMaterial ) {
 
 					svgNode.setAttribute( 'style', 'fill: none; stroke: ' + element.color.__styleString + '; stroke-width: ' + material.lineWidth + '; stroke-linecap: round; stroke-linejoin: round' );
 

+ 2 - 2
src/renderers/WebGLRenderer.js

@@ -139,7 +139,7 @@ THREE.WebGLRenderer = function () {
 
 					material = object.material[ m ];
 
-					if ( material instanceof THREE.ColorFillMaterial ) {
+					if ( material instanceof THREE.MeshColorFillMaterial ) {
 
 						if ( !material.__webGLColorBuffer ) {
 
@@ -160,7 +160,7 @@ THREE.WebGLRenderer = function () {
 						_gl.bindBuffer( _gl.ARRAY_BUFFER, material.__webGLColorBuffer );
 						_gl.vertexAttribPointer( _program.color, 4, _gl.FLOAT, false, 0, 0 );
 
-					} else if ( material instanceof THREE.FaceColorFillMaterial ) {
+					} else if ( material instanceof THREE.MeshFaceColorFillMaterial ) {
 
 						_gl.bindBuffer( _gl.ARRAY_BUFFER, object.__webGLColorBuffer );
 						_gl.enableVertexAttribArray( _program.color );

+ 8 - 7
utils/deployer.py

@@ -3,7 +3,7 @@ import os
 
 # MERGER
 
-rev = 13
+rev = 14
 
 files = []
 files.append('Three.js')
@@ -19,14 +19,15 @@ files.append('core/Face4.js')
 files.append('core/Geometry.js')
 files.append('cameras/Camera.js')
 files.append('objects/Object3D.js')
-files.append('objects/Particle.js')
 files.append('objects/Line.js')
 files.append('objects/Mesh.js')
-files.append('materials/BitmapUVMappingMaterial.js')
-files.append('materials/ColorFillMaterial.js')
-files.append('materials/ColorStrokeMaterial.js')
-files.append('materials/FaceColorFillMaterial.js')
-files.append('materials/FaceColorStrokeMaterial.js')
+files.append('objects/Particle.js')
+files.append('materials/LineColorMaterial.js')
+files.append('materials/MeshBitmapUVMappingMaterial.js')
+files.append('materials/MeshColorFillMaterial.js')
+files.append('materials/MeshColorStrokeMaterial.js')
+files.append('materials/MeshFaceColorFillMaterial.js')
+files.append('materials/MeshFaceColorStrokeMaterial.js')
 files.append('materials/ParticleBitmapMaterial.js')
 files.append('materials/ParticleCircleMaterial.js')
 files.append('scenes/Scene.js')

+ 8 - 7
utils/deployer_debug.py

@@ -3,7 +3,7 @@ import os
 
 # MERGER
 
-rev = 13
+rev = 14
 
 files = []
 files.append('Three.js')
@@ -19,14 +19,15 @@ files.append('core/Face4.js')
 files.append('core/Geometry.js')
 files.append('cameras/Camera.js')
 files.append('objects/Object3D.js')
-files.append('objects/Particle.js')
 files.append('objects/Line.js')
 files.append('objects/Mesh.js')
-files.append('materials/BitmapUVMappingMaterial.js')
-files.append('materials/ColorFillMaterial.js')
-files.append('materials/ColorStrokeMaterial.js')
-files.append('materials/FaceColorFillMaterial.js')
-files.append('materials/FaceColorStrokeMaterial.js')
+files.append('objects/Particle.js')
+files.append('materials/LineColorMaterial.js')
+files.append('materials/MeshBitmapUVMappingMaterial.js')
+files.append('materials/MeshColorFillMaterial.js')
+files.append('materials/MeshColorStrokeMaterial.js')
+files.append('materials/MeshFaceColorFillMaterial.js')
+files.append('materials/MeshFaceColorStrokeMaterial.js')
 files.append('materials/ParticleBitmapMaterial.js')
 files.append('materials/ParticleCircleMaterial.js')
 files.append('scenes/Scene.js')

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