Browse Source

Updated builds.

Mr.doob 4 years ago
parent
commit
e630876332
3 changed files with 119 additions and 2 deletions
  1. 60 1
      build/three.js
  2. 0 0
      build/three.min.js
  3. 59 1
      build/three.module.js

+ 60 - 1
build/three.js

@@ -63,7 +63,7 @@
 		};
 	}
 
-	var REVISION = '122';
+	var REVISION = '123dev';
 	var MOUSE = {
 		LEFT: 0,
 		MIDDLE: 1,
@@ -34832,6 +34832,64 @@
 		return AxesHelper;
 	}(LineSegments);
 
+	var _floatView = new Float32Array(1);
+
+	var _int32View = new Int32Array(_floatView.buffer);
+
+	var DataUtils = {
+		// Converts float32 to float16 (stored as uint16 value).
+		toHalfFloat: function toHalfFloat(val) {
+			// Source: http://gamedev.stackexchange.com/questions/17326/conversion-of-a-number-from-single-precision-floating-point-representation-to-a/17410#17410
+
+			/* This method is faster than the OpenEXR implementation (very often
+			* used, eg. in Ogre), with the additional benefit of rounding, inspired
+			* by James Tursa?s half-precision code. */
+			_floatView[0] = val;
+			var x = _int32View[0];
+			var bits = x >> 16 & 0x8000;
+			/* Get the sign */
+
+			var m = x >> 12 & 0x07ff;
+			/* Keep one extra bit for rounding */
+
+			var e = x >> 23 & 0xff;
+			/* Using int is faster here */
+
+			/* If zero, or denormal, or exponent underflows too much for a denormal
+				* half, return signed zero. */
+
+			if (e < 103) return bits;
+			/* If NaN, return NaN. If Inf or exponent overflow, return Inf. */
+
+			if (e > 142) {
+				bits |= 0x7c00;
+				/* If exponent was 0xff and one mantissa bit was set, it means NaN,
+							* not Inf, so make sure we set one mantissa bit too. */
+
+				bits |= (e == 255 ? 0 : 1) && x & 0x007fffff;
+				return bits;
+			}
+			/* If exponent underflows but not too much, return a denormal */
+
+
+			if (e < 113) {
+				m |= 0x0800;
+				/* Extra rounding may overflow and set mantissa to 0 and exponent
+					* to 1, which is OK. */
+
+				bits |= (m >> 114 - e) + (m >> 113 - e & 1);
+				return bits;
+			}
+
+			bits |= e - 112 << 10 | m >> 1;
+			/* Extra rounding. An overflow will set mantissa to 0 and increment
+				* the exponent, which is OK. */
+
+			bits += m & 1;
+			return bits;
+		}
+	};
+
 	var _ENCODINGS;
 	var LOD_MIN = 4;
 	var LOD_MAX = 8;
@@ -36902,6 +36960,7 @@
 	exports.DataTexture2DArray = DataTexture2DArray;
 	exports.DataTexture3D = DataTexture3D;
 	exports.DataTextureLoader = DataTextureLoader;
+	exports.DataUtils = DataUtils;
 	exports.DecrementStencilOp = DecrementStencilOp;
 	exports.DecrementWrapStencilOp = DecrementWrapStencilOp;
 	exports.DefaultLoadingManager = DefaultLoadingManager;

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


File diff suppressed because it is too large
+ 59 - 1
build/three.module.js


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