1 | /**
|
---|
2 | * @author alteredq / http://alteredqualia.com/
|
---|
3 | * @author mrdoob / http://mrdoob.com/
|
---|
4 | */
|
---|
5 |
|
---|
6 | THREE.PointLightHelper = function ( light, sphereSize ) {
|
---|
7 |
|
---|
8 | this.light = light;
|
---|
9 | this.light.updateMatrixWorld();
|
---|
10 |
|
---|
11 | var geometry = new THREE.SphereGeometry( sphereSize, 4, 2 );
|
---|
12 | var material = new THREE.MeshBasicMaterial( { wireframe: true, fog: false } );
|
---|
13 | material.color.copy( this.light.color ).multiplyScalar( this.light.intensity );
|
---|
14 |
|
---|
15 | THREE.Mesh.call( this, geometry, material );
|
---|
16 |
|
---|
17 | this.matrixWorld = this.light.matrixWorld;
|
---|
18 | this.matrixAutoUpdate = false;
|
---|
19 |
|
---|
20 | /*
|
---|
21 | var distanceGeometry = new THREE.IcosahedronGeometry( 1, 2 );
|
---|
22 | var distanceMaterial = new THREE.MeshBasicMaterial( { color: hexColor, fog: false, wireframe: true, opacity: 0.1, transparent: true } );
|
---|
23 |
|
---|
24 | this.lightSphere = new THREE.Mesh( bulbGeometry, bulbMaterial );
|
---|
25 | this.lightDistance = new THREE.Mesh( distanceGeometry, distanceMaterial );
|
---|
26 |
|
---|
27 | var d = light.distance;
|
---|
28 |
|
---|
29 | if ( d === 0.0 ) {
|
---|
30 |
|
---|
31 | this.lightDistance.visible = false;
|
---|
32 |
|
---|
33 | } else {
|
---|
34 |
|
---|
35 | this.lightDistance.scale.set( d, d, d );
|
---|
36 |
|
---|
37 | }
|
---|
38 |
|
---|
39 | this.add( this.lightDistance );
|
---|
40 | */
|
---|
41 |
|
---|
42 | };
|
---|
43 |
|
---|
44 | THREE.PointLightHelper.prototype = Object.create( THREE.Mesh.prototype );
|
---|
45 |
|
---|
46 | THREE.PointLightHelper.prototype.dispose = function () {
|
---|
47 |
|
---|
48 | this.geometry.dispose();
|
---|
49 | this.material.dispose();
|
---|
50 | };
|
---|
51 |
|
---|
52 | THREE.PointLightHelper.prototype.update = function () {
|
---|
53 |
|
---|
54 | this.material.color.copy( this.light.color ).multiplyScalar( this.light.intensity );
|
---|
55 |
|
---|
56 | /*
|
---|
57 | var d = this.light.distance;
|
---|
58 |
|
---|
59 | if ( d === 0.0 ) {
|
---|
60 |
|
---|
61 | this.lightDistance.visible = false;
|
---|
62 |
|
---|
63 | } else {
|
---|
64 |
|
---|
65 | this.lightDistance.visible = true;
|
---|
66 | this.lightDistance.scale.set( d, d, d );
|
---|
67 |
|
---|
68 | }
|
---|
69 | */
|
---|
70 |
|
---|
71 | };
|
---|
72 |
|
---|