Mr.doob 4 years ago
parent
commit
335bb2ff06
6 changed files with 39 additions and 15 deletions
  1. 14 6
      build/three.js
  2. 0 0
      build/three.min.js
  3. 22 6
      build/three.module.js
  4. 1 1
      editor/sw.js
  5. 1 1
      package.json
  6. 1 1
      src/constants.js

+ 14 - 6
build/three.js

@@ -9,7 +9,7 @@
 	(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.THREE = {}));
 }(this, (function (exports) { 'use strict';
 
-	const REVISION = '127dev';
+	const REVISION = '127';
 	const MOUSE = {
 		LEFT: 0,
 		MIDDLE: 1,
@@ -303,6 +303,14 @@
 		mapLinear: function (x, a1, a2, b1, b2) {
 			return b1 + (x - a1) * (b2 - b1) / (a2 - a1);
 		},
+		// https://www.gamedev.net/tutorials/programming/general-and-gameplay-programming/inverse-lerp-a-super-useful-yet-often-overlooked-function-r5230/
+		inverseLerp: function (x, y, value) {
+			if (x !== y) {
+				return (value - x) / (y - x);
+			} else {
+				return 0;
+			}
+		},
 		// https://en.wikipedia.org/wiki/Linear_interpolation
 		lerp: function (x, y, t) {
 			return (1 - t) * x + t * y;
@@ -18389,10 +18397,10 @@
 	WebGL1Renderer.prototype.isWebGL1Renderer = true;
 
 	class FogExp2 {
-		constructor(color, density) {
+		constructor(color, density = 0.00025) {
 			this.name = '';
 			this.color = new Color(color);
-			this.density = density !== undefined ? density : 0.00025;
+			this.density = density;
 		}
 
 		clone() {
@@ -18414,11 +18422,11 @@
 	FogExp2.prototype.isFogExp2 = true;
 
 	class Fog {
-		constructor(color, near, far) {
+		constructor(color, near = 1, far = 1000) {
 			this.name = '';
 			this.color = new Color(color);
-			this.near = near !== undefined ? near : 1;
-			this.far = far !== undefined ? far : 1000;
+			this.near = near;
+			this.far = far;
 		}
 
 		clone() {

File diff suppressed because it is too large
+ 0 - 0
build/three.min.js


+ 22 - 6
build/three.module.js

@@ -3,7 +3,7 @@
  * Copyright 2010-2021 Three.js Authors
  * SPDX-License-Identifier: MIT
  */
-const REVISION = '127dev';
+const REVISION = '127';
 const MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 };
 const TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 };
 const CullFaceNone = 0;
@@ -347,6 +347,22 @@ const MathUtils = {
 
 	},
 
+	// https://www.gamedev.net/tutorials/programming/general-and-gameplay-programming/inverse-lerp-a-super-useful-yet-often-overlooked-function-r5230/
+
+	inverseLerp: function ( x, y, value ) {
+
+		if ( x !== y ) {
+
+			return ( value - x ) / ( y - x );
+
+		 } else {
+
+			return 0;
+
+		 }
+
+	},
+
 	// https://en.wikipedia.org/wiki/Linear_interpolation
 
 	lerp: function ( x, y, t ) {
@@ -25275,12 +25291,12 @@ WebGL1Renderer.prototype.isWebGL1Renderer = true;
 
 class FogExp2 {
 
-	constructor( color, density ) {
+	constructor( color, density = 0.00025 ) {
 
 		this.name = '';
 
 		this.color = new Color( color );
-		this.density = ( density !== undefined ) ? density : 0.00025;
+		this.density = density;
 
 	}
 
@@ -25306,14 +25322,14 @@ FogExp2.prototype.isFogExp2 = true;
 
 class Fog {
 
-	constructor( color, near, far ) {
+	constructor( color, near = 1, far = 1000 ) {
 
 		this.name = '';
 
 		this.color = new Color( color );
 
-		this.near = ( near !== undefined ) ? near : 1;
-		this.far = ( far !== undefined ) ? far : 1000;
+		this.near = near;
+		this.far = far;
 
 	}
 

+ 1 - 1
editor/sw.js

@@ -1,4 +1,4 @@
-const cacheName = 'threejs-editor-r126';
+const cacheName = 'threejs-editor-r127';
 
 const assets = [
 	'./',

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "three",
-  "version": "0.126.0",
+  "version": "0.127.0",
   "description": "JavaScript 3D library",
   "main": "build/three.js",
   "module": "build/three.module.js",

+ 1 - 1
src/constants.js

@@ -1,4 +1,4 @@
-export const REVISION = '127dev';
+export const REVISION = '127';
 export const MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 };
 export const TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 };
 export const CullFaceNone = 0;

Some files were not shown because too many files changed in this diff