Browse Source

Added overrideColor to PointLightHelper

Lewy Blue 8 years ago
parent
commit
e6f4276c84
1 changed files with 8 additions and 4 deletions
  1. 8 4
      src/helpers/PointLightHelper.js

+ 8 - 4
src/helpers/PointLightHelper.js

@@ -7,20 +7,24 @@ import { SphereBufferGeometry } from '../geometries/SphereGeometry';
  * @author mrdoob / http://mrdoob.com/
  * @author mrdoob / http://mrdoob.com/
  */
  */
 
 
-function PointLightHelper( light, sphereSize ) {
+function PointLightHelper( light, sphereSize, overrideColor ) {
 
 
 	this.light = light;
 	this.light = light;
 	this.light.updateMatrixWorld();
 	this.light.updateMatrixWorld();
 
 
+	this.overrideColor = overrideColor;
+
 	var geometry = new SphereBufferGeometry( sphereSize, 4, 2 );
 	var geometry = new SphereBufferGeometry( sphereSize, 4, 2 );
-	var material = new MeshBasicMaterial( { wireframe: true, fog: false } );
-	material.color.copy( this.light.color );
+	var material = new MeshBasicMaterial( { wireframe: true, fog: false, color: this.overrideColor } );
 
 
 	Mesh.call( this, geometry, material );
 	Mesh.call( this, geometry, material );
 
 
 	this.matrix = this.light.matrixWorld;
 	this.matrix = this.light.matrixWorld;
 	this.matrixAutoUpdate = false;
 	this.matrixAutoUpdate = false;
 
 
+	this.update();
+
+
 	/*
 	/*
 	var distanceGeometry = new THREE.IcosahedronGeometry( 1, 2 );
 	var distanceGeometry = new THREE.IcosahedronGeometry( 1, 2 );
 	var distanceMaterial = new THREE.MeshBasicMaterial( { color: hexColor, fog: false, wireframe: true, opacity: 0.1, transparent: true } );
 	var distanceMaterial = new THREE.MeshBasicMaterial( { color: hexColor, fog: false, wireframe: true, opacity: 0.1, transparent: true } );
@@ -57,7 +61,7 @@ PointLightHelper.prototype.dispose = function () {
 
 
 PointLightHelper.prototype.update = function () {
 PointLightHelper.prototype.update = function () {
 
 
-	this.material.color.copy( this.light.color );
+	if ( ! this.overrideColor ) this.material.color.copy( this.light.color );
 
 
 	/*
 	/*
 	var d = this.light.distance;
 	var d = this.light.distance;