Browse Source

Reverted AmbientLights changes.

Mr.doob 14 years ago
parent
commit
78344033fa

+ 8 - 2
src/renderers/CanvasRenderer.js

@@ -374,7 +374,7 @@ THREE.CanvasRenderer = function ( parameters ) {
 			var l, ll, light, lightColor,
 			lights = scene.lights;
 
-			_ambientLight.copy( scene.ambientColor );
+			_ambientLight.setRGB( 0, 0, 0 );
 			_directionalLights.setRGB( 0, 0, 0 );
 			_pointLights.setRGB( 0, 0, 0 );
 
@@ -383,7 +383,13 @@ THREE.CanvasRenderer = function ( parameters ) {
 				light = lights[ l ];
 				lightColor = light.color;
 
-				if ( light instanceof THREE.DirectionalLight ) {
+				if ( light instanceof THREE.AmbientLight ) {
+
+					_ambientLight.r += lightColor.r;
+					_ambientLight.g += lightColor.g;
+					_ambientLight.b += lightColor.b;
+
+				} else if ( light instanceof THREE.DirectionalLight ) {
 
 					// for particles
 

+ 8 - 2
src/renderers/SVGRenderer.js

@@ -245,7 +245,7 @@ THREE.SVGRenderer = function () {
 		var l, ll, light, lightColor,
 		lights = scene.lights;
 
-		_ambientLight.copy( scene.ambientColor );
+		_ambientLight.setRGB( 0, 0, 0 );
 		_directionalLights.setRGB( 0, 0, 0 );
 		_pointLights.setRGB( 0, 0, 0 );
 
@@ -254,7 +254,13 @@ THREE.SVGRenderer = function () {
 			light = lights[ l ];
 			lightColor = light.color;
 
-			if ( light instanceof THREE.DirectionalLight ) {
+			if ( light instanceof THREE.AmbientLight ) {
+
+				_ambientLight.r += lightColor.r;
+				_ambientLight.g += lightColor.g;
+				_ambientLight.b += lightColor.b;
+
+			} else if ( light instanceof THREE.DirectionalLight ) {
 
 				_directionalLights.r += lightColor.r;
 				_directionalLights.g += lightColor.g;

+ 2 - 2
src/renderers/WebGLRenderer.js

@@ -410,13 +410,13 @@ THREE.WebGLRenderer = function ( parameters ) {
 			intensity = light.intensity;
 			distance = light.distance;
 
-			if ( /*light instanceof THREE.AmbientLight ) {
+			if ( light instanceof THREE.AmbientLight ) {
 
 				r += color.r;
 				g += color.g;
 				b += color.b;
 
-			} else if (*/ light instanceof THREE.DirectionalLight ) {
+			} else if ( light instanceof THREE.DirectionalLight ) {
 
 				doffset = dlength * 3;
 

+ 0 - 9
src/scenes/Scene.js

@@ -7,7 +7,6 @@ THREE.Scene = function () {
 
 	THREE.Object3D.call( this );
 
-	this.ambientColor = new THREE.Color();
 	this.fog = null;
 
 	this.matrixAutoUpdate = false;
@@ -30,14 +29,6 @@ THREE.Scene.prototype.supr = THREE.Object3D.prototype;
 
 THREE.Scene.prototype.add = function ( object ) {
 
-	if ( object instanceof THREE.AmbientLight ) {
-
-		console.warn( 'DEPRECATED: AmbientLight( hex ) is now scene.ambientColor.setHex( hex ).' );
-		this.ambientColor.setHex( object.color.getHex() );
-		return;
-
-	}
-
 	this.supr.add.call( this, object );
 	this.addChildRecurse( object );