Pārlūkot izejas kodu

resolved conflicts

Jing Ma 8 gadi atpakaļ
vecāks
revīzija
f3edce8db6

+ 6 - 0
.github/ISSUE_TEMPLATE.md

@@ -2,6 +2,12 @@
 
 ##### Description of the problem 
 
+Describe the problem/request in detail.
+Code snippet, screenshot, and small-test help us understand.
+
+You can edit for small-test.
+http://jsfiddle.net/akmcv7Lh/ (current revision)
+http://jsfiddle.net/hw9rcLL8/ (dev)
 
 ##### Three.js version
 

+ 4 - 4
docs/api/lights/DirectionalLight.html

@@ -13,7 +13,7 @@
 		<h1>[name]</h1>
 
 		<div class="desc">
-			A light that gets emitted in a specific direction. This light will behave	as though it is
+			A light that gets emitted in a specific direction. This light will behave as though it is
 			infinitely far away and the rays produced from it are all parallel. The common use case
 			for this is to simulate daylight; the sun is far enough away that its position can be
 			considered to be infinite, and all light rays coming from it are parallel.<br /><br />
@@ -29,7 +29,7 @@
 
 			This means that its direction is calculated as pointing
 			from the light's [page:Object3D.position position] to	the [page:.target target]'s position
-			(as opposed to a a 'Free Direct Light' that just has a rotation component).<br /><br />
+			(as opposed to a 'Free Direct Light' that just has a rotation component).<br /><br />
 
 			The reason for this is to allow the light to cast shadows - the [page:.shadow shadow]
 			camera needs a position to calculate shadows from.<br /><br />
@@ -81,9 +81,9 @@ scene.add( directionalLight );
 
 		<h3>[property:Boolean isDirectionalLight]</h3>
 		<div>
-			Used to check whether this or derived classes are dircrectional lights. Default is *true*.<br /><br />
+			Used to check whether this or derived classes are directional lights. Default is *true*.<br /><br />
 
-			You should not change this, as it used internally for optimisation.
+			You should not change this, as it is used internally for optimisation.
 		</div>
 
 

+ 78 - 80
docs/api/lights/Light.html

@@ -1,81 +1,79 @@
-<!DOCTYPE html>
-<html lang="en">
-	<head>
+<!DOCTYPE html>
+<html lang="en">
+	<head>
 		<meta charset="utf-8" />
-		<base href="../../" />
-		<script src="list.js"></script>
-		<script src="page.js"></script>
-		<link type="text/css" rel="stylesheet" href="page.css" />
-	</head>
-	<body>
-		[page:Object3D] &rarr;
-
-		<h1>[name]</h1>
-
-		<div class="desc">
-			Abstract base class for lights - all other light types inherit the properties and methods
-			described here.
-		</div>
-
-
-		<h2>Constructor</h2>
-
-
-		<h3>[name]( [page:Integer color], [page:float intensity] )</h3>
-		<div>
-		[page:Integer color] - (optional) hexadecimal color of the light. Default is 0xffffff (white).<br />
-		[page:Float intensity] - (optional) numeric value of the light's strength/intensity. Default is 1.<br /><br />
-
-		Creates a new [name]. Note that this is not intended to be called directly (use one of <thead>
-			derived classes instead).
-		</thead>)
-		</div>
-
-		<h2>Properties</h2>
-		<div>
-			See the base [page:Object3D Object3D] class for common properties.
-		</div>
-
-		<h3>[property:Color color]</h3>
-		<div>
-			Color of the light. Defaults to a new [page:Color] set to white, if not passed in the constructor.<br />
-		</div>
-
-		<h3>[property:Float intensity]</h3>
-		<div>
-			The light's intensity, or strength.<br />
-			In [page:WebGLRenderer.physicallyCorrectLights physically correct] mode, the product of
-			[page:.color color] * intensity is interpreted as luminous intensity measured in candela.<br />
-			Default - *1.0*.
-		</div>
-
-		<h3>[property:Boolean isLight]</h3>
-		<div>
-			Used to check whether this or derived classes are lights. Default is *true*.<br /><br />
-
-			You should not change this, as it used internally for optimisation.
-		</div>
-
-
-		<h2>Methods</h2>
-		<div>
-			See the base [page:Object3D Object3D] class for common methods.
-		</div>
-
-
-		<h3>[method:Light copy]( [page:Light source] )</h3>
-		<div>
-		Copies the value of [page:.color color] and [page:.intensity intensity] from the
-		[page:Light source] light into this one.
-		</div>
-
-		<h3>[method:JSON toJSON]( [page:String meta] )</h3>
-		<div>
-		Return Light data in JSON format.
-		</div>
-
-		<h2>Source</h2>
-
-		[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
-	</body>
-</html>
+		<base href="../../" />
+		<script src="list.js"></script>
+		<script src="page.js"></script>
+		<link type="text/css" rel="stylesheet" href="page.css" />
+	</head>
+	<body>
+		[page:Object3D] &rarr;
+
+		<h1>[name]</h1>
+
+		<div class="desc">
+			Abstract base class for lights - all other light types inherit the properties and methods
+			described here.
+		</div>
+
+
+		<h2>Constructor</h2>
+
+
+		<h3>[name]( [page:Integer color], [page:float intensity] )</h3>
+		<div>
+		[page:Integer color] - (optional) hexadecimal color of the light. Default is 0xffffff (white).<br />
+		[page:Float intensity] - (optional) numeric value of the light's strength/intensity. Default is 1.<br /><br />
+
+		Creates a new [name]. Note that this is not intended to be called directly (use one of derived classes instead).
+		</div>
+
+		<h2>Properties</h2>
+		<div>
+			See the base [page:Object3D Object3D] class for common properties.
+		</div>
+
+		<h3>[property:Color color]</h3>
+		<div>
+			Color of the light. Defaults to a new [page:Color] set to white, if not passed in the constructor.<br />
+		</div>
+
+		<h3>[property:Float intensity]</h3>
+		<div>
+			The light's intensity, or strength.<br />
+			In [page:WebGLRenderer.physicallyCorrectLights physically correct] mode, the product of
+			[page:.color color] * intensity is interpreted as luminous intensity measured in candela.<br />
+			Default - *1.0*.
+		</div>
+
+		<h3>[property:Boolean isLight]</h3>
+		<div>
+			Used to check whether this or derived classes are lights. Default is *true*.<br /><br />
+
+			You should not change this, as it used internally for optimisation.
+		</div>
+
+
+		<h2>Methods</h2>
+		<div>
+			See the base [page:Object3D Object3D] class for common methods.
+		</div>
+
+
+		<h3>[method:Light copy]( [page:Light source] )</h3>
+		<div>
+		Copies the value of [page:.color color] and [page:.intensity intensity] from the
+		[page:Light source] light into this one.
+		</div>
+
+		<h3>[method:JSON toJSON]( [page:String meta] )</h3>
+		<div>
+		Return Light data in JSON format.
+		</div>
+
+		<h2>Source</h2>
+
+		[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
+	</body>
+</html>

+ 1 - 1
docs/api/lights/SpotLight.html

@@ -155,7 +155,7 @@
 			The Spotlight points from its [page:.position position] to target.position. The default
 			position of the target is *(0, 0, 0)*.<br />
 
-			*Note*: For the the target's position to be changed to anything other than the default,
+			*Note*: For the target's position to be changed to anything other than the default,
 			it must be added to the [page:Scene scene] using
 			<code>
 				scene.add( light.target );

+ 1 - 1
docs/index.html

@@ -215,7 +215,7 @@
 				<span></span>
 			</a>
 			<div class="filterBlock" >
-				<input type="text" id="filterInput" placeholder="Type to filter"/>
+				<input type="text" id="filterInput" placeholder="Type to filter" autofocus/>
 				<a href="#" id="clearFilterButton" >x</a>
 			</div>
 			<div id="content"></div>

+ 1 - 1
examples/index.html

@@ -232,7 +232,7 @@
 				<span></span>
 			</a>
 			<div class="filterBlock" >
-				<input type="text" id="filterInput" placeholder="Type to filter"/>
+				<input type="text" id="filterInput" placeholder="Type to filter" autofocus/>
 				<a href="#" id="clearFilterButton" >x</a>
 			</div>
 			<div id="content"></div>

+ 39 - 13
examples/js/loaders/GLTFLoader.js

@@ -567,18 +567,31 @@ THREE.GLTFLoader = ( function () {
 			results = [];
 
 			var length = object.length;
+
 			for ( var idx = 0; idx < length; idx ++ ) {
+
 				var value = callback.call( thisObj || this, object[ idx ], idx );
+
 				if ( value ) {
+
 					fns.push( value );
+
 					if ( value instanceof Promise ) {
+
 						value.then( function( key, value ) {
+
 							results[ idx ] = value;
+
 						}.bind( this, key ));
+
 					} else {
+
 						results[ idx ] = value;
+
 					}
+
 				}
+
 			}
 
 		} else {
@@ -586,25 +599,41 @@ THREE.GLTFLoader = ( function () {
 			results = {};
 
 			for ( var key in object ) {
+
 				if ( object.hasOwnProperty( key ) ) {
+
 					var value = callback.call( thisObj || this, object[ key ], key );
+
 					if ( value ) {
+
 						fns.push( value );
+
 						if ( value instanceof Promise ) {
+
 							value.then( function( key, value ) {
+
 								results[ key ] = value;
+
 							}.bind( this, key ));
+
 						} else {
+
 							results[ key ] = value;
+
 						}
+
 					}
+
 				}
+
 			}
 
 		}
 
 		return Promise.all( fns ).then( function() {
+
 			return results;
+
 		});
 
 	}
@@ -1142,15 +1171,20 @@ THREE.GLTFLoader = ( function () {
 
 				if ( khr_material ) {
 
+					// don't copy over unused values to avoid material warning spam
+					var keys = [ 'ambient', 'emission', 'transparent', 'transparency', 'doubleSided' ];
+
 					switch ( khr_material.technique ) {
 
 						case 'BLINN' :
 						case 'PHONG' :
 							materialType = THREE.MeshPhongMaterial;
+							keys.push( 'diffuse', 'specular', 'shininess' );
 							break;
 
 						case 'LAMBERT' :
 							materialType = THREE.MeshLambertMaterial;
+							keys.push( 'diffuse' );
 							break;
 
 						case 'CONSTANT' :
@@ -1160,18 +1194,11 @@ THREE.GLTFLoader = ( function () {
 
 					}
 
-					// don't copy over unused values to avoid material warning spam
-					var c = ['ambient', 'transparent', 'transparency', 'doubleSided'];
-					var allowedValues = {
-						'CONSTANT': c.concat('emission'),
-						'LAMBERT':  c.concat('emission', 'diffuse'),
-						'BLINN':    c.concat('emission', 'diffuse', 'specular', 'shininess'),
-						'PHONG':    c.concat('emission', 'diffuse', 'specular', 'shininess')
-					};
-
-					allowedValues[khr_material.technique].forEach(function(v){
-						materialValues[v] = khr_material.values[v];
-					});
+					keys.forEach( function( v ) {
+
+						if ( khr_material.values[ v ] !== undefined ) materialValues[ v ] = khr_material.values[ v ];
+
+					} );
 
 					if ( khr_material.doubleSided || materialValues.doubleSided ) {
 
@@ -1639,7 +1666,6 @@ THREE.GLTFLoader = ( function () {
 
 						var attributes = primitive.attributes;
 
-
 						for ( var attributeId in attributes ) {
 
 							var attributeEntry = attributes[ attributeId ];