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