Browse Source

Merge branch 'dev' of https://github.com/mrdoob/three.js into dev

Luis Blanco 5 years ago
parent
commit
93a7c58ee4

+ 1 - 1
docs/api/zh/math/Quaternion.html

@@ -109,7 +109,7 @@
 
 
 		<h3>[method:Float lengthSq]()</h3>
 		<h3>[method:Float lengthSq]()</h3>
 		<p>
 		<p>
-			Computes the [link:https://en.wikipedia.org/wiki/Euclidean_distance Euclidean length]
+			Computes the squared [link:https://en.wikipedia.org/wiki/Euclidean_distance Euclidean length]
 			(straight-line length) of this quaternion, considered as a 4 dimensional
 			(straight-line length) of this quaternion, considered as a 4 dimensional
 			vector. This can be useful if you are comparing the lengths of two quaternions,
 			vector. This can be useful if you are comparing the lengths of two quaternions,
 			as this is a slightly more efficient calculation than [page:.length length]().
 			as this is a slightly more efficient calculation than [page:.length length]().

+ 1 - 1
docs/list.js

@@ -463,7 +463,7 @@ var list = {
 				"浏览器支持": "manual/zh/introduction/Browser-support",
 				"浏览器支持": "manual/zh/introduction/Browser-support",
 				"WebGL兼容性检查": "manual/zh/introduction/WebGL-compatibility-check",
 				"WebGL兼容性检查": "manual/zh/introduction/WebGL-compatibility-check",
 				"如何在本地运行Three.js": "manual/zh/introduction/How-to-run-things-locally",
 				"如何在本地运行Three.js": "manual/zh/introduction/How-to-run-things-locally",
-				"Typescript setup": "manual/zh/introduction/Typescript-setup",
+				"Typescript设置": "manual/zh/introduction/Typescript-setup",
 				"如何使用WebGL 2": "manual/zh/introduction/How-to-use-WebGL2",
 				"如何使用WebGL 2": "manual/zh/introduction/How-to-use-WebGL2",
 				"画线": "manual/zh/introduction/Drawing-lines",
 				"画线": "manual/zh/introduction/Drawing-lines",
 				"创建文字": "manual/zh/introduction/Creating-text",
 				"创建文字": "manual/zh/introduction/Creating-text",

+ 7 - 12
docs/manual/zh/introduction/Typescript-setup.html

@@ -8,22 +8,19 @@
 		<link type="text/css" rel="stylesheet" href="page.css" />
 		<link type="text/css" rel="stylesheet" href="page.css" />
 	</head>
 	</head>
 	<body>
 	<body>
-		<h1>[name]</h1>
+		<h1>TypeScript设置([name]</h1>
 
 
 		<p>
 		<p>
-			three.js is a JavaScript-based library. However, it's possible to use it in a TypeScript project, as the library
-			exposes [link:https://www.typescriptlang.org/docs/handbook/declaration-files/introduction.html Declaration Files] (*d.ts* files).
+			three.js是一个基于JavaScript的库。但是,可以在TypeScript项目中使用它,因为该库公开了声明文件 [link:https://www.typescriptlang.org/docs/handbook/declaration-files/introduction.html Declaration Files](*d.ts* 文件)。
 		</p>
 		</p>
 
 
 		<p>
 		<p>
-			A minimal configuration is required for the TypeScript compiler to
-			discover three.js types.<br>
-			You will need to set the [link:https://www.typescriptlang.org/docs/handbook/module-resolution.html moduleResolution]
-			option to *node*, and the [link:https://www.typescriptlang.org/docs/handbook/compiler-options.html target] option to *es6* or newer.
+			TypeScript编译器需要最少的配置即可发现three.js类型。<br>
+			你将需要设置 [link:https://www.typescriptlang.org/docs/handbook/module-resolution.html moduleResolution] (模块解析)为 *node* 和 [link:https://www.typescriptlang.org/docs/handbook/compiler-options.html target] (目标) 为 *es6* 或更高版本。
 		</p>
 		</p>
 
 
 		<code>
 		<code>
-		// Example of minimal `tsconfig.json` file
+		// tsconfig.json文件最少配置例子
 		{
 		{
 			"compilerOptions": {
 			"compilerOptions": {
 				"target": "es6",
 				"target": "es6",
@@ -34,13 +31,11 @@
 		</code>
 		</code>
 
 
 		<p>
 		<p>
-			Note: As of today, it's not yet possible to use three.js typings without using those two options.
+			注意:到目前为止,如果不使用这两个选项,则无法使用three.js类型。
 		</p>
 		</p>
 
 
 		<p>
 		<p>
-			Note: It happens that some declarations are incorrect and/or missing.
-			Contributing to Declaration Files is really helpful for the community, making three.js
-			typings better and more accurate.
+			注意:某些声明可能不正确或缺失。为声明文件做贡献对社区真的很有帮助,使Three.js开发会更好更准确。
 		</p>
 		</p>
 	</body>
 	</body>
 </html>
 </html>

+ 2 - 2
editor/js/Strings.js

@@ -737,8 +737,8 @@ var Strings = function ( config ) {
 			'sidebar/object/penumbra': '边缘',
 			'sidebar/object/penumbra': '边缘',
 			'sidebar/object/decay': '衰减',
 			'sidebar/object/decay': '衰减',
 			'sidebar/object/shadow': '阴影',
 			'sidebar/object/shadow': '阴影',
-			'sidebar/object/shadowRadius': 'Shadow Radius',
-			'sidebar/object/shadowBias': 'Shadow Bias',
+			'sidebar/object/shadowRadius': '阴影半径',
+			'sidebar/object/shadowBias': '阴影偏移',
 			'sidebar/object/cast': '产生',
 			'sidebar/object/cast': '产生',
 			'sidebar/object/receive': '接受',
 			'sidebar/object/receive': '接受',
 			'sidebar/object/visible': '可见性',
 			'sidebar/object/visible': '可见性',

+ 9 - 1
examples/physics_cannon_instancing.html

@@ -7,17 +7,20 @@
 		<link type="text/css" rel="stylesheet" href="main.css">
 		<link type="text/css" rel="stylesheet" href="main.css">
 	</head>
 	</head>
 	<body>
 	<body>
+
 		<div id="info">
 		<div id="info">
 			<a href="https://threejs.org" target="_blank" rel="noopener">three.js</a> physics - cannon.js instancing
 			<a href="https://threejs.org" target="_blank" rel="noopener">three.js</a> physics - cannon.js instancing
 		</div>
 		</div>
+
 		<script src="./js/libs/cannon.js"></script>
 		<script src="./js/libs/cannon.js"></script>
 		<script type="module">
 		<script type="module">
 
 
 			import * as THREE from '../build/three.module.js';
 			import * as THREE from '../build/three.module.js';
 			import { OrbitControls } from './jsm/controls/OrbitControls.js';
 			import { OrbitControls } from './jsm/controls/OrbitControls.js';
 			import { CannonPhysics } from './jsm/physics/CannonPhysics.js';
 			import { CannonPhysics } from './jsm/physics/CannonPhysics.js';
+			import Stats from './jsm/libs/stats.module.js';
 
 
-			var camera, scene, renderer;
+			var camera, scene, renderer, stats;
 			var physics, position;
 			var physics, position;
 
 
 			init();
 			init();
@@ -103,6 +106,9 @@
 				renderer.outputEncoding = THREE.sRGBEncoding;
 				renderer.outputEncoding = THREE.sRGBEncoding;
 				document.body.appendChild( renderer.domElement );
 				document.body.appendChild( renderer.domElement );
 
 
+				stats = new Stats();
+				document.body.appendChild( stats.dom );
+
 				//
 				//
 
 
 				new OrbitControls( camera, renderer.domElement );
 				new OrbitControls( camera, renderer.domElement );
@@ -121,6 +127,8 @@
 
 
 				renderer.render( scene, camera );
 				renderer.render( scene, camera );
 
 
+				stats.update();
+
 			}
 			}
 
 
 		</script>
 		</script>

+ 9 - 5
examples/webgl_materials_envmaps_hdr.html

@@ -58,19 +58,22 @@
 				var lightMaterial = new THREE.MeshLambertMaterial( { color: 0x000000, emissive: 0xffffff, emissiveIntensity: 10 } );
 				var lightMaterial = new THREE.MeshLambertMaterial( { color: 0x000000, emissive: 0xffffff, emissiveIntensity: 10 } );
 
 
 				var light1 = new THREE.Mesh( geometry, lightMaterial );
 				var light1 = new THREE.Mesh( geometry, lightMaterial );
+				light1.material.color.setHex( 0xff0000 );
 				light1.position.set( - 5, 2, 0 );
 				light1.position.set( - 5, 2, 0 );
 				light1.scale.set( 0.1, 1, 1 );
 				light1.scale.set( 0.1, 1, 1 );
 				envScene.add( light1 );
 				envScene.add( light1 );
 
 
-				var light2 = new THREE.Mesh( geometry, lightMaterial );
+				var light2 = new THREE.Mesh( geometry, lightMaterial.clone() );
+				light2.material.color.setHex( 0x00ff00 );
 				light2.position.set( 0, 5, 0 );
 				light2.position.set( 0, 5, 0 );
 				light2.scale.set( 1, 0.1, 1 );
 				light2.scale.set( 1, 0.1, 1 );
 				envScene.add( light2 );
 				envScene.add( light2 );
 
 
-				var light2 = new THREE.Mesh( geometry, lightMaterial );
-				light2.position.set( 2, 1, 5 );
-				light2.scale.set( 1.5, 2, 0.1 );
-				envScene.add( light2 );
+				var light3 = new THREE.Mesh( geometry, lightMaterial.clone() );
+				light3.material.color.setHex( 0x0000ff );
+				light3.position.set( 2, 1, 5 );
+				light3.scale.set( 1.5, 2, 0.1 );
+				envScene.add( light3 );
 
 
 				return envScene;
 				return envScene;
 
 
@@ -94,6 +97,7 @@
 				//
 				//
 
 
 				var geometry = new THREE.TorusKnotBufferGeometry( 18, 8, 150, 20 );
 				var geometry = new THREE.TorusKnotBufferGeometry( 18, 8, 150, 20 );
+				//var geometry = new THREE.SphereBufferGeometry( 26, 64, 32 );
 				var material = new THREE.MeshStandardMaterial( {
 				var material = new THREE.MeshStandardMaterial( {
 					color: 0xffffff,
 					color: 0xffffff,
 					metalness: params.metalness,
 					metalness: params.metalness,

+ 1 - 2
src/animation/AnimationClip.d.ts

@@ -35,8 +35,7 @@ export class AnimationClip {
 	static parse( json: any ): AnimationClip;
 	static parse( json: any ): AnimationClip;
 	static parseAnimation(
 	static parseAnimation(
 		animation: any,
 		animation: any,
-		bones: Bone[],
-		nodeName: string
+		bones: Bone[]
 	): AnimationClip;
 	): AnimationClip;
 	static toJSON(): any;
 	static toJSON(): any;
 
 

+ 0 - 2
src/renderers/webgl/WebGLShadowMap.js

@@ -119,8 +119,6 @@ function WebGLShadowMap( _renderer, _objects, maxTextureSize ) {
 
 
 			if ( _shadowMapSize.x > maxTextureSize || _shadowMapSize.y > maxTextureSize ) {
 			if ( _shadowMapSize.x > maxTextureSize || _shadowMapSize.y > maxTextureSize ) {
 
 
-				console.warn( 'THREE.WebGLShadowMap:', light, 'has shadow exceeding max texture size, reducing' );
-
 				if ( _shadowMapSize.x > maxTextureSize ) {
 				if ( _shadowMapSize.x > maxTextureSize ) {
 
 
 					_viewportSize.x = Math.floor( maxTextureSize / shadowFrameExtents.x );
 					_viewportSize.x = Math.floor( maxTextureSize / shadowFrameExtents.x );