1 /**
2 * @author alteredq / http://alteredqualia.com/
3 *
4 * - shows point light color, intensity, position and distance
5 */
6
7 /**@constructor*/
8 THREE.PointLightHelper = function ( light, sphereSize ) {
9
10 THREE.Object3D.call( this );
11
12 this.light = light;
13
14 // position
15
16 this.position = light.position;
17
18 // color
19
20 this.color = light.color.clone();
21
22 var intensity = THREE.Math.clamp( light.intensity, 0, 1 );
23
24 this.color.r *= intensity;
25 this.color.g *= intensity;
26 this.color.b *= intensity;
27
28 var hexColor = this.color.getHex();
29
30 // light helper
31
32 var bulbGeometry = new THREE.SphereGeometry( sphereSize, 16, 8 );
33 var raysGeometry = new THREE.AsteriskGeometry( sphereSize * 1.25, sphereSize * 2.25 );
34 var distanceGeometry = new THREE.IcosahedronGeometry( 1, 2 );
35
36 var bulbMaterial = new THREE.MeshBasicMaterial( { color: hexColor, fog: false } );
37 var raysMaterial = new THREE.LineBasicMaterial( { color: hexColor, fog: false } );
38 var distanceMaterial = new THREE.MeshBasicMaterial( { color: hexColor, fog: false, wireframe: true, opacity: 0.1, transparent: true } );
39
40 this.lightSphere = new THREE.Mesh( bulbGeometry, bulbMaterial );
41 this.lightRays = new THREE.Line( raysGeometry, raysMaterial, THREE.LinePieces );
42 this.lightDistance = new THREE.Mesh( distanceGeometry, distanceMaterial );
43
44 var d = light.distance;
45
46 if ( d === 0.0 ) {
47
48 this.lightDistance.visible = false;
49
50 } else {
51
52 this.lightDistance.scale.set( d, d, d );
53
54 }
55
56 this.add( this.lightSphere );
57 this.add( this.lightRays );
58 this.add( this.lightDistance );
59
60 //
61
62 this.lightSphere.properties.isGizmo = true;
63 this.lightSphere.properties.gizmoSubject = light;
64 this.lightSphere.properties.gizmoRoot = this;
65
66 //
67
68 this.properties.isGizmo = true;
69
70 }
71
72 THREE.PointLightHelper.prototype = Object.create( THREE.Object3D.prototype );
73
74 THREE.PointLightHelper.prototype.update = function () {
75
76 // update sphere and rays colors to light color * light intensity
77
78 this.color.copy( this.light.color );
79
80 var intensity = THREE.Math.clamp( this.light.intensity, 0, 1 );
81 this.color.r *= intensity;
82 this.color.g *= intensity;
83 this.color.b *= intensity;
84
85 this.lightSphere.material.color.copy( this.color );
86 this.lightRays.material.color.copy( this.color );
87 this.lightDistance.material.color.copy( this.color );
88
89 //
90
91 var d = this.light.distance;
92
93 if ( d === 0.0 ) {
94
95 this.lightDistance.visible = false;
96
97 } else {
98
99 this.lightDistance.visible = true;
100 this.lightDistance.scale.set( d, d, d );
101
102 }
103
104 }
105
106
nike free rn
new balance hombre baratas
cinturones gucci
ugg rebajas
cinturon gucci
ray ban baratas
nike cortez
peuterey mujer
christian louboutin madrid
mbt zapatos
gafas ray ban baratas
mbt ofertas
air max blancas
mbt barcelona
nike air max 90
woolrich barcelona
nike mujer
botas ugg
gafas de sol carrera aratas
air max 2016 baratas
oakley baratas
nike air max 2016