Ver Fonte

Removed ArrowHelper from SpotLightHelper.
I think it's a bit redundant.

Mr.doob há 12 anos atrás
pai
commit
4074675d7a
2 ficheiros alterados com 3 adições e 12 exclusões
  1. 1 2
      editor/js/ui/Viewport.js
  2. 2 10
      src/extras/helpers/SpotLightHelper.js

+ 1 - 2
editor/js/ui/Viewport.js

@@ -312,9 +312,8 @@ var Viewport = function ( signals ) {
 		} else if ( object instanceof THREE.SpotLight ) {
 
 			var sphereSize = 5;
-			var arrowLength = 30;
 
-			var lightGizmo = new THREE.SpotLightHelper( object, sphereSize, arrowLength );
+			var lightGizmo = new THREE.SpotLightHelper( object, sphereSize );
 			sceneHelpers.add( lightGizmo );
 			sceneHelpers.add( lightGizmo.targetSphere );
 			sceneHelpers.add( lightGizmo.targetLine );

+ 2 - 10
src/extras/helpers/SpotLightHelper.js

@@ -4,7 +4,7 @@
  *	- shows spot light color, intensity, position, orientation, light cone and target
  */
 
-THREE.SpotLightHelper = function ( light, sphereSize, arrowLength ) {
+THREE.SpotLightHelper = function ( light, sphereSize ) {
 
 	THREE.Object3D.call( this );
 
@@ -46,7 +46,6 @@ THREE.SpotLightHelper = function ( light, sphereSize, arrowLength ) {
 	var raysMaterial = new THREE.LineBasicMaterial( { color: hexColor, fog: false } );
 	var coneMaterial = new THREE.MeshBasicMaterial( { color: hexColor, fog: false, wireframe: true, opacity: 0.3, transparent: true } );
 
-	this.lightArrow = new THREE.ArrowHelper( this.direction, null, arrowLength, hexColor );
 	this.lightSphere = new THREE.Mesh( bulbGeometry, bulbMaterial );
 	this.lightCone = new THREE.Mesh( coneGeometry, coneMaterial );
 
@@ -54,14 +53,10 @@ THREE.SpotLightHelper = function ( light, sphereSize, arrowLength ) {
 	var coneWidth = coneLength * Math.tan( light.angle * 0.5 ) * 2;
 	this.lightCone.scale.set( coneWidth, coneWidth, coneLength );
 
-	this.lightArrow.cone.material.fog = false;
-	this.lightArrow.line.material.fog = false;
-
 	this.lightRays = new THREE.Line( raysGeometry, raysMaterial, THREE.LinePieces );
 
 	this.gyroscope = new THREE.Gyroscope();
 
-	this.gyroscope.add( this.lightArrow );
 	this.gyroscope.add( this.lightSphere );
 	this.gyroscope.add( this.lightRays );
 
@@ -115,7 +110,6 @@ THREE.SpotLightHelper.prototype.update = function () {
 	// pointing from light to target
 
 	this.direction.sub( this.light.target.position, this.light.position );
-	this.lightArrow.setDirection( this.direction );
 
 	// update light cone orientation and size
 
@@ -134,7 +128,6 @@ THREE.SpotLightHelper.prototype.update = function () {
 	this.color.g *= intensity;
 	this.color.b *= intensity;
 
-	this.lightArrow.setColor( this.color.getHex() );
 	this.lightSphere.material.color.copy( this.color );
 	this.lightRays.material.color.copy( this.color );
 	this.lightCone.material.color.copy( this.color );
@@ -150,5 +143,4 @@ THREE.SpotLightHelper.prototype.update = function () {
 	this.targetLine.geometry.computeLineDistances();
 	this.targetLine.geometry.verticesNeedUpdate = true;
 
-}
-
+};