1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- import { Mesh } from '../objects/Mesh';
- import { MeshBasicMaterial } from '../materials/MeshBasicMaterial';
- import { SphereBufferGeometry } from '../geometries/SphereGeometry';
- /**
- * @author alteredq / http://alteredqualia.com/
- * @author mrdoob / http://mrdoob.com/
- */
- function PointLightHelper( light, sphereSize ) {
- this.light = light;
- this.light.updateMatrixWorld();
- var geometry = new SphereBufferGeometry( sphereSize, 4, 2 );
- var material = new MeshBasicMaterial( { wireframe: true, fog: false } );
- material.color.copy( this.light.color );
- Mesh.call( this, geometry, material );
- this.matrix = this.light.matrixWorld;
- this.matrixAutoUpdate = false;
- /*
- var distanceGeometry = new THREE.IcosahedronGeometry( 1, 2 );
- var distanceMaterial = new THREE.MeshBasicMaterial( { color: hexColor, fog: false, wireframe: true, opacity: 0.1, transparent: true } );
- this.lightSphere = new THREE.Mesh( bulbGeometry, bulbMaterial );
- this.lightDistance = new THREE.Mesh( distanceGeometry, distanceMaterial );
- var d = light.distance;
- if ( d === 0.0 ) {
- this.lightDistance.visible = false;
- } else {
- this.lightDistance.scale.set( d, d, d );
- }
- this.add( this.lightDistance );
- */
- }
- PointLightHelper.prototype = Object.create( Mesh.prototype );
- PointLightHelper.prototype.constructor = PointLightHelper;
- PointLightHelper.prototype.dispose = function () {
- this.geometry.dispose();
- this.material.dispose();
- };
- PointLightHelper.prototype.update = function () {
- this.material.color.copy( this.light.color );
- /*
- var d = this.light.distance;
- if ( d === 0.0 ) {
- this.lightDistance.visible = false;
- } else {
- this.lightDistance.visible = true;
- this.lightDistance.scale.set( d, d, d );
- }
- */
- };
- export { PointLightHelper };
|