1 /**
  2  * @author alteredq / http://alteredqualia.com/
  3  *
  4  *	- shows hemisphere light intensity, sky and ground colors and directions
  5  */
  6 
  7 /**@constructor*/
  8 THREE.HemisphereLightHelper = function ( light, sphereSize, arrowLength, domeSize ) {
  9 
 10 	THREE.Object3D.call( this );
 11 
 12 	this.light = light;
 13 
 14 	// position
 15 
 16 	this.position = light.position;
 17 
 18 	//
 19 
 20 	var intensity = THREE.Math.clamp( light.intensity, 0, 1 );
 21 
 22 	// sky color
 23 
 24 	this.color = light.color.clone();
 25 
 26 	this.color.r *= intensity;
 27 	this.color.g *= intensity;
 28 	this.color.b *= intensity;
 29 
 30 	var hexColor = this.color.getHex();
 31 
 32 	// ground color
 33 
 34 	this.groundColor = light.groundColor.clone();
 35 
 36 	this.groundColor.r *= intensity;
 37 	this.groundColor.g *= intensity;
 38 	this.groundColor.b *= intensity;
 39 
 40 	var hexColorGround = this.groundColor.getHex();
 41 
 42 	// double colored light bulb
 43 
 44 	var bulbGeometry = new THREE.SphereGeometry( sphereSize, 16, 8, 0, Math.PI * 2, 0, Math.PI * 0.5 );
 45 	var bulbGroundGeometry = new THREE.SphereGeometry( sphereSize, 16, 8, 0, Math.PI * 2, Math.PI * 0.5, Math.PI );
 46 
 47 	var bulbSkyMaterial = new THREE.MeshBasicMaterial( { color: hexColor, fog: false } );
 48 	var bulbGroundMaterial = new THREE.MeshBasicMaterial( { color: hexColorGround, fog: false } );
 49 
 50 	for ( var i = 0, il = bulbGeometry.faces.length; i < il; i ++ ) {
 51 
 52 		bulbGeometry.faces[ i ].materialIndex = 0;
 53 
 54 	}
 55 
 56 	for ( var i = 0, il = bulbGroundGeometry.faces.length; i < il; i ++ ) {
 57 
 58 		bulbGroundGeometry.faces[ i ].materialIndex = 1;
 59 
 60 	}
 61 
 62 	THREE.GeometryUtils.merge( bulbGeometry, bulbGroundGeometry );
 63 
 64 	this.lightSphere = new THREE.Mesh( bulbGeometry, new THREE.MeshFaceMaterial( [ bulbSkyMaterial, bulbGroundMaterial ] ) );
 65 
 66 	// arrows for sky and ground light directions
 67 
 68 	this.lightArrow = new THREE.ArrowHelper( new THREE.Vector3( 0, 1, 0 ), new THREE.Vector3( 0, ( sphereSize + arrowLength ) * 1.1, 0 ), arrowLength, hexColor );
 69 	this.lightArrow.rotation.x = Math.PI;
 70 
 71 	this.lightArrowGround = new THREE.ArrowHelper( new THREE.Vector3( 0, 1, 0 ), new THREE.Vector3( 0, ( sphereSize + arrowLength ) * -1.1, 0 ), arrowLength, hexColorGround );
 72 
 73 	var joint = new THREE.Object3D();
 74 	joint.rotation.x = -Math.PI * 0.5;
 75 
 76 	joint.add( this.lightSphere );
 77 	joint.add( this.lightArrow );
 78 	joint.add( this.lightArrowGround );
 79 
 80 	this.add( joint );
 81 
 82 	//
 83 
 84 	this.lightSphere.properties.isGizmo = true;
 85 	this.lightSphere.properties.gizmoSubject = light;
 86 	this.lightSphere.properties.gizmoRoot = this;
 87 
 88 	//
 89 
 90 	this.properties.isGizmo = true;
 91 
 92 	//
 93 
 94 	this.target = new THREE.Vector3();
 95 	this.lookAt( this.target );
 96 
 97 }
 98 
 99 THREE.HemisphereLightHelper.prototype = Object.create( THREE.Object3D.prototype );
100 
101 THREE.HemisphereLightHelper.prototype.update = function () {
102 
103 	// update sphere sky and ground colors to light color * light intensity
104 
105 	var intensity = THREE.Math.clamp( this.light.intensity, 0, 1 );
106 
107 	this.color.copy( this.light.color );
108 	this.groundColor.copy( this.light.groundColor );
109 
110 	this.color.r *= intensity;
111 	this.color.g *= intensity;
112 	this.color.b *= intensity;
113 
114 	this.groundColor.r *= intensity;
115 	this.groundColor.g *= intensity;
116 	this.groundColor.b *= intensity;
117 
118 	this.lightSphere.material.materials[ 0 ].color.copy( this.color );
119 	this.lightSphere.material.materials[ 1 ].color.copy( this.groundColor );
120 
121 	this.lightArrow.setColor( this.color.getHex() );
122 	this.lightArrowGround.setColor( this.groundColor.getHex() );
123 
124 	this.lookAt( this.target );
125 
126 }
127 
128 

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

mbt skor nike sverige louboutin skor hollister sverige polo ralph lauren skjorta woolrich jacka dam canada goose jacka woolrich jacka ray ban rea canada goose rea michael kors rea new balance skor ralph lauren skjorta new balance rea uggs sverige lacoste rea christian louboutin skor moncler jacka nike shox barbour jacka uggs rea