Browse Source

* autoClear property for renderers.
* Removed SVG rgba() workaround for WebKit. (WebKit now supports it);

Mr.doob 15 years ago
parent
commit
2a3d1e35cb

+ 9 - 2
README.md

@@ -55,7 +55,7 @@ This code creates a camera, then creates a scene object, adds a bunch of random
 			scene = new THREE.Scene();
 			scene = new THREE.Scene();
 
 
 			renderer = new THREE.CanvasRenderer();
 			renderer = new THREE.CanvasRenderer();
-			renderer.setSize(window.innerWidth, window.innerHeight);
+			renderer.setSize( window.innerWidth, window.innerHeight );
 
 
 			for (var i = 0; i < 1000; i++) {
 			for (var i = 0; i < 1000; i++) {
 
 
@@ -115,7 +115,14 @@ If you are interested on messing with the actual library, instead of importing t
 
 
 ### Change Log ###
 ### Change Log ###
 
 
-2010 06 06 - **r8** (23.597 kb)
+2010 06 20 - **r9** (23.641 kb)
+
+* JSLinted
+* autoClear property for renderers.
+* Removed SVG rgba() workaround for WebKit. (WebKit now supports it)
+
+
+2010 06 06 - **r8** (23.496 kb)
 
 
 * Moved UVs to Geometry.
 * Moved UVs to Geometry.
 * CanvasRenderer expands screen space points (workaround for antialias gaps).
 * CanvasRenderer expands screen space points (workaround for antialias gaps).

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


+ 0 - 1
examples/geometry_cube.html

@@ -64,7 +64,6 @@
 				camera = new THREE.Camera(0, 150, 400);
 				camera = new THREE.Camera(0, 150, 400);
 				camera.focus = 300;
 				camera.focus = 300;
 				camera.target.position.y = 150;
 				camera.target.position.y = 150;
-				camera.updateMatrix();
 
 
 				scene = new THREE.Scene();
 				scene = new THREE.Scene();
 
 

+ 3 - 3
examples/geometry_terrain.html

@@ -193,8 +193,8 @@
 
 
 			function loop() {
 			function loop() {
 
 
-				camera.position.x += (mouseX - camera.position.x) * .05;
-				camera.position.y += (-mouseY - camera.position.y) * .05;
+				camera.position.x += (mouseX - camera.position.x) * 0.05;
+				camera.position.y += (-mouseY - camera.position.y) * 0.05;
 
 
 				renderer.render(scene, camera);
 				renderer.render(scene, camera);
 				stats.update();
 				stats.update();
@@ -282,7 +282,7 @@
 
 
 						vector3.x = src_data[ index - 4 ] - src_data[ index + 4 ];
 						vector3.x = src_data[ index - 4 ] - src_data[ index + 4 ];
 						vector3.y = 2;
 						vector3.y = 2;
-						vector3.z = src_data[ index - ( width * 4 ) ] - src_data[ index + ( width * 4 ) ];;
+						vector3.z = src_data[ index - ( width * 4 ) ] - src_data[ index + ( width * 4 ) ];
 						vector3.normalize();
 						vector3.normalize();
 
 
 						shade = vector3.dot(sun);
 						shade = vector3.dot(sun);

+ 6 - 6
src/cameras/Camera.js

@@ -2,15 +2,15 @@
  * @author mr.doob / http://mrdoob.com/
  * @author mr.doob / http://mrdoob.com/
  */
  */
 
 
-THREE.Camera = function (x, y, z) {
+THREE.Camera = function ( x, y, z ) {
 
 
-	this.position = new THREE.Vector3(x, y, z);
-	this.target = { position: new THREE.Vector3(0, 0, 0) };
+	this.position = new THREE.Vector3( x, y, z );
+	this.target = { position: new THREE.Vector3( 0, 0, 0 ) };
 
 
 	this.matrix = new THREE.Matrix4();
 	this.matrix = new THREE.Matrix4();
-	this.projectionMatrix = THREE.Matrix4.makePerspective(45, 1 /*SCREEN_WIDTH/SCREEN_HEIGHT*/, 0.001, 1000);
+	this.projectionMatrix = THREE.Matrix4.makePerspective( 45, 1 /*SCREEN_WIDTH/SCREEN_HEIGHT*/, 0.001, 1000 );
 
 
-	this.up = new THREE.Vector3(0, 1, 0);
+	this.up = new THREE.Vector3( 0, 1, 0 );
 	this.roll = 0;
 	this.roll = 0;
 
 
 	// TODO: Need to remove this
 	// TODO: Need to remove this
@@ -21,7 +21,7 @@ THREE.Camera = function (x, y, z) {
 
 
 	this.updateMatrix = function () {
 	this.updateMatrix = function () {
 
 
-		this.matrix.lookAt(this.position, this.target.position, this.up);
+		this.matrix.lookAt( this.position, this.target.position, this.up );
 
 
 	};
 	};
 
 

+ 5 - 14
src/core/Matrix4.js

@@ -36,20 +36,11 @@ THREE.Matrix4 = function () {
 		y.copy( x );
 		y.copy( x );
 		y.crossSelf( z );
 		y.crossSelf( z );
 		y.normalize();
 		y.normalize();
-		y.negate(); //
-
-		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 );
+		y.negate();
+
+		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 ) {
 	this.transform = function ( v ) {

+ 11 - 4
src/renderers/CanvasRenderer.js

@@ -14,6 +14,7 @@ THREE.CanvasRenderer = function () {
 	_vector2 = new THREE.Vector2();
 	_vector2 = new THREE.Vector2();
 
 
 	this.domElement = _viewport;
 	this.domElement = _viewport;
+	this.autoClear = true;
 
 
 	this.setSize = function ( width, height ) {
 	this.setSize = function ( width, height ) {
 
 
@@ -26,6 +27,15 @@ THREE.CanvasRenderer = function () {
 
 
 	};
 	};
 
 
+	this.clear = function () {
+
+		_clearRect.inflate( 1 );
+		_clearRect.minSelf( _clipRect );
+		_context.clearRect( _clearRect.getX(), _clearRect.getY(), _clearRect.getWidth(), _clearRect.getHeight() );
+		_clearRect.empty();
+
+	};
+
 	this.render = function ( scene, camera ) {
 	this.render = function ( scene, camera ) {
 
 
 		var i, j, element, pi2 = Math.PI * 2,
 		var i, j, element, pi2 = Math.PI * 2,
@@ -38,10 +48,7 @@ THREE.CanvasRenderer = function () {
 		bitmap, bitmap_width, bitmap_height,
 		bitmap, bitmap_width, bitmap_height,
 		size;
 		size;
 
 
-		_clearRect.inflate( 1 );
-		_clearRect.minSelf( _clipRect );
-		_context.clearRect( _clearRect.getX(), _clearRect.getY(), _clearRect.getWidth(), _clearRect.getHeight() );
-		_clearRect.empty();
+		this.autoClear && this.clear();
 
 
 		/*
 		/*
 		_context.fillStyle = 'rgba(255, 255, 0, 0.5)';
 		_context.fillStyle = 'rgba(255, 255, 0, 0.5)';

+ 13 - 6
src/renderers/SVGRenderer.js

@@ -13,6 +13,7 @@ THREE.SVGRenderer = function () {
 	_quality = 1;
 	_quality = 1;
 
 
 	this.domElement = _viewport;
 	this.domElement = _viewport;
+	this.autoClear = true;
 
 
 	this.setQuality = function( quality ) {
 	this.setQuality = function( quality ) {
 
 
@@ -35,6 +36,16 @@ THREE.SVGRenderer = function () {
 
 
 	};
 	};
 
 
+	this.clear = function () {
+
+		while ( _viewport.childNodes.length > 0 ) {
+
+			_viewport.removeChild( _viewport.childNodes[ 0 ] );
+
+		}
+
+	};
+
 	this.render = function ( scene, camera ) {
 	this.render = function ( scene, camera ) {
 
 
 		var i, j, element, elementsLength, material, materialLength,
 		var i, j, element, elementsLength, material, materialLength,
@@ -42,13 +53,9 @@ THREE.SVGRenderer = function () {
 		v1x, v1y, v2x, v2y, v3x, v3y, v4x, v4y,
 		v1x, v1y, v2x, v2y, v3x, v3y, v4x, v4y,
 		size;
 		size;
 
 
-		this.project( scene, camera );
-
-		while ( _viewport.childNodes.length > 0 ) {
-
-			_viewport.removeChild( _viewport.childNodes[ 0 ] );
+		this.autoClear && this.clear();
 
 
-		}
+		this.project( scene, camera );
 
 
 		elementsLength = this.renderList.length;
 		elementsLength = this.renderList.length;
 
 

+ 1 - 1
utils/deployer.py

@@ -3,7 +3,7 @@ import os
 
 
 # MERGER
 # MERGER
 
 
-rev = 8;
+rev = 9;
 
 
 files = [];
 files = [];
 files.append('Three.js');
 files.append('Three.js');

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