From 18991001ff12e9e50e62f9e167276676a1873aec Mon Sep 17 00:00:00 2001 From: Volker Buzek Date: Fri, 14 Jun 2019 08:46:58 +0200 Subject: [PATCH 01/75] fix(WebGLTextures): iOS UIWebView OffscreenCanvas.getContext("2d") cordova iOS (as of 5.0) still uses UIWebView, which provides OffscreenCanvas, also OffscreenCanvas.getContext("webgl"), but not OffscreenCanvas.getContext("2d")! --- src/renderers/webgl/WebGLTextures.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/renderers/webgl/WebGLTextures.js b/src/renderers/webgl/WebGLTextures.js index dab6548f214487..65f7709c1c42ec 100644 --- a/src/renderers/webgl/WebGLTextures.js +++ b/src/renderers/webgl/WebGLTextures.js @@ -10,9 +10,11 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils, var _videoTextures = {}; var _canvas; - // + // cordova iOS (as of 5.0) still uses UIWebView, which provides OffscreenCanvas, + // also OffscreenCanvas.getContext("webgl"), but not OffscreenCanvas.getContext("2d")! - var useOffscreenCanvas = typeof OffscreenCanvas !== 'undefined'; + var useOffscreenCanvas = typeof OffscreenCanvas !== 'undefined' + && (new OffscreenCanvas(1, 1).getContext("2d")) !== null; function createCanvas( width, height ) { From d4f6bfed63be7344669c1bbb1284d2e065a7b5d0 Mon Sep 17 00:00:00 2001 From: Volker Buzek Date: Fri, 14 Jun 2019 08:56:40 +0200 Subject: [PATCH 02/75] refactor: linting --- src/renderers/webgl/WebGLTextures.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/renderers/webgl/WebGLTextures.js b/src/renderers/webgl/WebGLTextures.js index 65f7709c1c42ec..59c32156495614 100644 --- a/src/renderers/webgl/WebGLTextures.js +++ b/src/renderers/webgl/WebGLTextures.js @@ -14,7 +14,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils, // also OffscreenCanvas.getContext("webgl"), but not OffscreenCanvas.getContext("2d")! var useOffscreenCanvas = typeof OffscreenCanvas !== 'undefined' - && (new OffscreenCanvas(1, 1).getContext("2d")) !== null; + && ( new OffscreenCanvas( 1, 1 ).getContext( "2d" ) ) !== null; function createCanvas( width, height ) { From 7d1fc45d7237dee86fd7558c5014480c69419136 Mon Sep 17 00:00:00 2001 From: Mugen87 Date: Sun, 18 Aug 2019 15:09:49 +0200 Subject: [PATCH 03/75] BoxGeometry: Introduce ES6 classes and ES6-ES5 conversion for builds. --- package-lock.json | 154 ++++++++++++++++++++++ package.json | 1 + rollup.config.js | 54 +++++--- src/geometries/BoxGeometry.js | 233 +++++++++++++++++----------------- 4 files changed, 306 insertions(+), 136 deletions(-) diff --git a/package-lock.json b/package-lock.json index 047cef301ac738..b6e1f483277658 100644 --- a/package-lock.json +++ b/package-lock.json @@ -119,6 +119,12 @@ "integrity": "sha512-jPTiwtOxaHNaAPg/dmrJ/beuzLRnXtB0kQPQ8JpotKJgTB6rX6c8mlf315941pyjBSaPg8NHXS9fhP4u17DpGA==", "dev": true }, + "acorn-dynamic-import": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/acorn-dynamic-import/-/acorn-dynamic-import-4.0.0.tgz", + "integrity": "sha512-d3OEjQV4ROpoflsnUA8HozoIR504TFxNivYEUi6uwz0IYhBkTDXGuWlNdMtybRt3nqVx/L6XqMt0FxkXuWKZhw==", + "dev": true + }, "acorn-jsx": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.0.1.tgz", @@ -198,6 +204,30 @@ "concat-map": "0.0.1" } }, + "buble": { + "version": "0.19.8", + "resolved": "https://registry.npmjs.org/buble/-/buble-0.19.8.tgz", + "integrity": "sha512-IoGZzrUTY5fKXVkgGHw3QeXFMUNBFv+9l8a4QJKG1JhG3nCMHTdEX1DCOg8568E2Q9qvAQIiSokv6Jsgx8p2cA==", + "dev": true, + "requires": { + "acorn": "^6.1.1", + "acorn-dynamic-import": "^4.0.0", + "acorn-jsx": "^5.0.1", + "chalk": "^2.4.2", + "magic-string": "^0.25.3", + "minimist": "^1.2.0", + "os-homedir": "^2.0.0", + "regexpu-core": "^4.5.4" + }, + "dependencies": { + "minimist": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", + "dev": true + } + } + }, "callsites": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", @@ -683,6 +713,12 @@ "integrity": "sha1-De4/7TH81GlhjOc0IJn8GvoL2xM=", "dev": true }, + "estree-walker": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-0.6.1.tgz", + "integrity": "sha512-SqmZANLWS0mnatqbSfRP5g8OXZC12Fgg1IwNtLsyHDzJizORW4khDfjPqJZsemPWBB2uqykUah5YpQ6epsqC/w==", + "dev": true + }, "esutils": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", @@ -1172,6 +1208,12 @@ "esprima": "^4.0.0" } }, + "jsesc": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", + "integrity": "sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=", + "dev": true + }, "json-parse-better-errors": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", @@ -1231,6 +1273,15 @@ "integrity": "sha1-vyJJiGzlFM2hEvrpIYzcBlIR/Jw=", "dev": true }, + "magic-string": { + "version": "0.25.3", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.3.tgz", + "integrity": "sha512-6QK0OpF/phMz0Q2AxILkX2mFhi7m+WMwTRg0LQKq/WBB0cDP4rYH3Wp4/d3OTXlrPLVJT/RFqj8tFeAR4nk8AA==", + "dev": true, + "requires": { + "sourcemap-codec": "^1.4.4" + } + }, "map-age-cleaner": { "version": "0.1.3", "resolved": "https://registry.npmjs.org/map-age-cleaner/-/map-age-cleaner-0.1.3.tgz", @@ -1400,6 +1451,12 @@ "wordwrap": "~1.0.0" } }, + "os-homedir": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-2.0.0.tgz", + "integrity": "sha512-saRNz0DSC5C/I++gFIaJTXoFJMRwiP5zHar5vV3xQ2TkgEw6hDCcU5F272JjUylpiVgBrZNQHnfjkLabTfb92Q==", + "dev": true + }, "os-locale": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-3.1.0.tgz", @@ -1622,12 +1679,56 @@ "util-deprecate": "^1.0.1" } }, + "regenerate": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.4.0.tgz", + "integrity": "sha512-1G6jJVDWrt0rK99kBjvEtziZNCICAuvIPkSiUFIQxVP06RCVpq3dmDo2oi6ABpYaDYaTRr67BEhL8r1wgEZZKg==", + "dev": true + }, + "regenerate-unicode-properties": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/regenerate-unicode-properties/-/regenerate-unicode-properties-8.1.0.tgz", + "integrity": "sha512-LGZzkgtLY79GeXLm8Dp0BVLdQlWICzBnJz/ipWUgo59qBaZ+BHtq51P2q1uVZlppMuUAT37SDk39qUbjTWB7bA==", + "dev": true, + "requires": { + "regenerate": "^1.4.0" + } + }, "regexpp": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-2.0.1.tgz", "integrity": "sha512-lv0M6+TkDVniA3aD1Eg0DVpfU/booSu7Eev3TDO/mZKHBfVjgCGTV4t4buppESEYDtkArYFOxTJWv6S5C+iaNw==", "dev": true }, + "regexpu-core": { + "version": "4.5.5", + "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-4.5.5.tgz", + "integrity": "sha512-FpI67+ky9J+cDizQUJlIlNZFKual/lUkFr1AG6zOCpwZ9cLrg8UUVakyUQJD7fCDIe9Z2nwTQJNPyonatNmDFQ==", + "dev": true, + "requires": { + "regenerate": "^1.4.0", + "regenerate-unicode-properties": "^8.1.0", + "regjsgen": "^0.5.0", + "regjsparser": "^0.6.0", + "unicode-match-property-ecmascript": "^1.0.4", + "unicode-match-property-value-ecmascript": "^1.1.0" + } + }, + "regjsgen": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.5.0.tgz", + "integrity": "sha512-RnIrLhrXCX5ow/E5/Mh2O4e/oa1/jW0eaBKTSy3LaCj+M3Bqvm97GWDp2yUtzIs4LEn65zR2yiYGFqb2ApnzDA==", + "dev": true + }, + "regjsparser": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.6.0.tgz", + "integrity": "sha512-RQ7YyokLiQBomUJuUG8iGVvkgOLxwyZM8k6d3q5SAXpg4r5TZJZigKFvC6PpD+qQ98bCDC5YelPeA3EucDoNeQ==", + "dev": true, + "requires": { + "jsesc": "~0.5.0" + } + }, "remove-trailing-separator": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz", @@ -1711,6 +1812,25 @@ } } }, + "rollup-plugin-buble": { + "version": "0.19.8", + "resolved": "https://registry.npmjs.org/rollup-plugin-buble/-/rollup-plugin-buble-0.19.8.tgz", + "integrity": "sha512-8J4zPk2DQdk3rxeZvxgzhHh/rm5nJkjwgcsUYisCQg1QbT5yagW+hehYEW7ZNns/NVbDCTv4JQ7h4fC8qKGOKw==", + "dev": true, + "requires": { + "buble": "^0.19.8", + "rollup-pluginutils": "^2.3.3" + } + }, + "rollup-pluginutils": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/rollup-pluginutils/-/rollup-pluginutils-2.8.1.tgz", + "integrity": "sha512-J5oAoysWar6GuZo0s+3bZ6sVZAC0pfqKz68De7ZgDi5z63jOVZn1uJL/+z1jeKHNbGII8kAyHF5q8LnxSX5lQg==", + "dev": true, + "requires": { + "estree-walker": "^0.6.1" + } + }, "run-async": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.3.0.tgz", @@ -1791,6 +1911,12 @@ "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", "dev": true }, + "sourcemap-codec": { + "version": "1.4.6", + "resolved": "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.6.tgz", + "integrity": "sha512-1ZooVLYFxC448piVLBbtOxFcXwnymH9oUF8nRd3CuYDVvkRBxRl6pB4Mtas5a4drtL+E8LDgFkQNcgIw6tc8Hg==", + "dev": true + }, "spawn-command": { "version": "0.0.2-1", "resolved": "https://registry.npmjs.org/spawn-command/-/spawn-command-0.0.2-1.tgz", @@ -2001,6 +2127,34 @@ "integrity": "sha512-7KxJovlYhTX5RaRbUdkAXN1KUZ8PwWlTzQdHV6xNqvuFOs7+WBo10TQUqT19Q/Jz2hk5v9TQDIhyLhhJY4p5AA==", "dev": true }, + "unicode-canonical-property-names-ecmascript": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-1.0.4.tgz", + "integrity": "sha512-jDrNnXWHd4oHiTZnx/ZG7gtUTVp+gCcTTKr8L0HjlwphROEW3+Him+IpvC+xcJEFegapiMZyZe02CyuOnRmbnQ==", + "dev": true + }, + "unicode-match-property-ecmascript": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/unicode-match-property-ecmascript/-/unicode-match-property-ecmascript-1.0.4.tgz", + "integrity": "sha512-L4Qoh15vTfntsn4P1zqnHulG0LdXgjSO035fEpdtp6YxXhMT51Q6vgM5lYdG/5X3MjS+k/Y9Xw4SFCY9IkR0rg==", + "dev": true, + "requires": { + "unicode-canonical-property-names-ecmascript": "^1.0.4", + "unicode-property-aliases-ecmascript": "^1.0.4" + } + }, + "unicode-match-property-value-ecmascript": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-1.1.0.tgz", + "integrity": "sha512-hDTHvaBk3RmFzvSl0UVrUmC3PuW9wKVnpoUDYH0JDkSIovzw+J5viQmeYHxVSBptubnr7PbH2e0fnpDRQnQl5g==", + "dev": true + }, + "unicode-property-aliases-ecmascript": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-1.0.5.tgz", + "integrity": "sha512-L5RAqCfXqAwR3RriF8pM0lU0w4Ryf/GgzONwi6KnL1taJQa7x1TCxdJnILX59WIGOwR57IVxn7Nej0fz1Ny6fw==", + "dev": true + }, "union": { "version": "0.4.6", "resolved": "https://registry.npmjs.org/union/-/union-0.4.6.tgz", diff --git a/package.json b/package.json index 77f1cf39e0f3ef..4a9a8556c969cf 100644 --- a/package.json +++ b/package.json @@ -78,6 +78,7 @@ "http-server": "^0.11.1", "qunit": "^2.9.2", "rollup": "^1.19.4", + "rollup-plugin-buble": "^0.19.8", "typescript": "^3.5.2" }, "jspm": { diff --git a/rollup.config.js b/rollup.config.js index c72666cc549de2..051942dabaf647 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -1,3 +1,5 @@ +import buble from 'rollup-plugin-buble'; + function glconstants() { var constants = { @@ -193,23 +195,35 @@ function glsl() { } -export default { - input: 'src/Three.js', - plugins: [ - glconstants(), - glsl() - ], - output: [ - { - format: 'umd', - name: 'THREE', - file: 'build/three.js', - indent: '\t' - }, - { - format: 'esm', - file: 'build/three.module.js', - indent: '\t' - } - ] -}; +export default [ + { + input: 'src/Three.js', + plugins: [ + glconstants(), + glsl(), + buble() + ], + output: [ + { + format: 'umd', + name: 'THREE', + file: 'build/three.js', + indent: '\t', + } + ] + }, + { + input: 'src/Three.js', + plugins: [ + glconstants(), + glsl() + ], + output: [ + { + format: 'esm', + file: 'build/three.module.js', + indent: '\t' + } + ] + } +]; diff --git a/src/geometries/BoxGeometry.js b/src/geometries/BoxGeometry.js index b4dc0143616293..f34dc6c7dad664 100644 --- a/src/geometries/BoxGeometry.js +++ b/src/geometries/BoxGeometry.js @@ -10,194 +10,195 @@ import { Vector3 } from '../math/Vector3.js'; // BoxGeometry -function BoxGeometry( width, height, depth, widthSegments, heightSegments, depthSegments ) { +class BoxGeometry extends Geometry { - Geometry.call( this ); + constructor( width, height, depth, widthSegments, heightSegments, depthSegments ) { - this.type = 'BoxGeometry'; + super(); - this.parameters = { - width: width, - height: height, - depth: depth, - widthSegments: widthSegments, - heightSegments: heightSegments, - depthSegments: depthSegments - }; + this.type = 'BoxGeometry'; - this.fromBufferGeometry( new BoxBufferGeometry( width, height, depth, widthSegments, heightSegments, depthSegments ) ); - this.mergeVertices(); + this.parameters = { + width: width, + height: height, + depth: depth, + widthSegments: widthSegments, + heightSegments: heightSegments, + depthSegments: depthSegments + }; -} + this.fromBufferGeometry( new BoxBufferGeometry( width, height, depth, widthSegments, heightSegments, depthSegments ) ); + this.mergeVertices(); + + } -BoxGeometry.prototype = Object.create( Geometry.prototype ); -BoxGeometry.prototype.constructor = BoxGeometry; +} // BoxBufferGeometry -function BoxBufferGeometry( width, height, depth, widthSegments, heightSegments, depthSegments ) { +class BoxBufferGeometry extends BufferGeometry { + + constructor( width, height, depth, widthSegments, heightSegments, depthSegments ) { + + super(); - BufferGeometry.call( this ); + this.type = 'BoxBufferGeometry'; - this.type = 'BoxBufferGeometry'; + this.parameters = { + width: width, + height: height, + depth: depth, + widthSegments: widthSegments, + heightSegments: heightSegments, + depthSegments: depthSegments + }; - this.parameters = { - width: width, - height: height, - depth: depth, - widthSegments: widthSegments, - heightSegments: heightSegments, - depthSegments: depthSegments - }; + var scope = this; - var scope = this; + width = width || 1; + height = height || 1; + depth = depth || 1; - width = width || 1; - height = height || 1; - depth = depth || 1; + // segments - // segments + widthSegments = Math.floor( widthSegments ) || 1; + heightSegments = Math.floor( heightSegments ) || 1; + depthSegments = Math.floor( depthSegments ) || 1; - widthSegments = Math.floor( widthSegments ) || 1; - heightSegments = Math.floor( heightSegments ) || 1; - depthSegments = Math.floor( depthSegments ) || 1; + // buffers - // buffers + var indices = []; + var vertices = []; + var normals = []; + var uvs = []; - var indices = []; - var vertices = []; - var normals = []; - var uvs = []; + // helper variables - // helper variables + var numberOfVertices = 0; + var groupStart = 0; - var numberOfVertices = 0; - var groupStart = 0; + // build each side of the box geometry - // build each side of the box geometry + buildPlane( 'z', 'y', 'x', - 1, - 1, depth, height, width, depthSegments, heightSegments, 0 ); // px + buildPlane( 'z', 'y', 'x', 1, - 1, depth, height, - width, depthSegments, heightSegments, 1 ); // nx + buildPlane( 'x', 'z', 'y', 1, 1, width, depth, height, widthSegments, depthSegments, 2 ); // py + buildPlane( 'x', 'z', 'y', 1, - 1, width, depth, - height, widthSegments, depthSegments, 3 ); // ny + buildPlane( 'x', 'y', 'z', 1, - 1, width, height, depth, widthSegments, heightSegments, 4 ); // pz + buildPlane( 'x', 'y', 'z', - 1, - 1, width, height, - depth, widthSegments, heightSegments, 5 ); // nz - buildPlane( 'z', 'y', 'x', - 1, - 1, depth, height, width, depthSegments, heightSegments, 0 ); // px - buildPlane( 'z', 'y', 'x', 1, - 1, depth, height, - width, depthSegments, heightSegments, 1 ); // nx - buildPlane( 'x', 'z', 'y', 1, 1, width, depth, height, widthSegments, depthSegments, 2 ); // py - buildPlane( 'x', 'z', 'y', 1, - 1, width, depth, - height, widthSegments, depthSegments, 3 ); // ny - buildPlane( 'x', 'y', 'z', 1, - 1, width, height, depth, widthSegments, heightSegments, 4 ); // pz - buildPlane( 'x', 'y', 'z', - 1, - 1, width, height, - depth, widthSegments, heightSegments, 5 ); // nz + // build geometry - // build geometry + this.setIndex( indices ); + this.addAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) ); + this.addAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) ); + this.addAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) ); - this.setIndex( indices ); - this.addAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) ); - this.addAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) ); - this.addAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) ); + function buildPlane( u, v, w, udir, vdir, width, height, depth, gridX, gridY, materialIndex ) { - function buildPlane( u, v, w, udir, vdir, width, height, depth, gridX, gridY, materialIndex ) { + var segmentWidth = width / gridX; + var segmentHeight = height / gridY; - var segmentWidth = width / gridX; - var segmentHeight = height / gridY; + var widthHalf = width / 2; + var heightHalf = height / 2; + var depthHalf = depth / 2; - var widthHalf = width / 2; - var heightHalf = height / 2; - var depthHalf = depth / 2; + var gridX1 = gridX + 1; + var gridY1 = gridY + 1; - var gridX1 = gridX + 1; - var gridY1 = gridY + 1; + var vertexCounter = 0; + var groupCount = 0; - var vertexCounter = 0; - var groupCount = 0; + var ix, iy; - var ix, iy; + var vector = new Vector3(); - var vector = new Vector3(); + // generate vertices, normals and uvs - // generate vertices, normals and uvs + for ( iy = 0; iy < gridY1; iy ++ ) { - for ( iy = 0; iy < gridY1; iy ++ ) { + var y = iy * segmentHeight - heightHalf; - var y = iy * segmentHeight - heightHalf; + for ( ix = 0; ix < gridX1; ix ++ ) { - for ( ix = 0; ix < gridX1; ix ++ ) { + var x = ix * segmentWidth - widthHalf; - var x = ix * segmentWidth - widthHalf; + // set values to correct vector component - // set values to correct vector component + vector[ u ] = x * udir; + vector[ v ] = y * vdir; + vector[ w ] = depthHalf; - vector[ u ] = x * udir; - vector[ v ] = y * vdir; - vector[ w ] = depthHalf; + // now apply vector to vertex buffer - // now apply vector to vertex buffer + vertices.push( vector.x, vector.y, vector.z ); - vertices.push( vector.x, vector.y, vector.z ); + // set values to correct vector component - // set values to correct vector component + vector[ u ] = 0; + vector[ v ] = 0; + vector[ w ] = depth > 0 ? 1 : - 1; - vector[ u ] = 0; - vector[ v ] = 0; - vector[ w ] = depth > 0 ? 1 : - 1; + // now apply vector to normal buffer - // now apply vector to normal buffer + normals.push( vector.x, vector.y, vector.z ); - normals.push( vector.x, vector.y, vector.z ); + // uvs - // uvs + uvs.push( ix / gridX ); + uvs.push( 1 - ( iy / gridY ) ); - uvs.push( ix / gridX ); - uvs.push( 1 - ( iy / gridY ) ); + // counters - // counters + vertexCounter += 1; - vertexCounter += 1; + } } - } + // indices - // indices + // 1. you need three indices to draw a single face + // 2. a single segment consists of two faces + // 3. so we need to generate six (2*3) indices per segment - // 1. you need three indices to draw a single face - // 2. a single segment consists of two faces - // 3. so we need to generate six (2*3) indices per segment + for ( iy = 0; iy < gridY; iy ++ ) { - for ( iy = 0; iy < gridY; iy ++ ) { + for ( ix = 0; ix < gridX; ix ++ ) { - for ( ix = 0; ix < gridX; ix ++ ) { + var a = numberOfVertices + ix + gridX1 * iy; + var b = numberOfVertices + ix + gridX1 * ( iy + 1 ); + var c = numberOfVertices + ( ix + 1 ) + gridX1 * ( iy + 1 ); + var d = numberOfVertices + ( ix + 1 ) + gridX1 * iy; - var a = numberOfVertices + ix + gridX1 * iy; - var b = numberOfVertices + ix + gridX1 * ( iy + 1 ); - var c = numberOfVertices + ( ix + 1 ) + gridX1 * ( iy + 1 ); - var d = numberOfVertices + ( ix + 1 ) + gridX1 * iy; + // faces - // faces + indices.push( a, b, d ); + indices.push( b, c, d ); - indices.push( a, b, d ); - indices.push( b, c, d ); + // increase counter - // increase counter + groupCount += 6; - groupCount += 6; + } } - } + // add a group to the geometry. this will ensure multi material support - // add a group to the geometry. this will ensure multi material support + scope.addGroup( groupStart, groupCount, materialIndex ); - scope.addGroup( groupStart, groupCount, materialIndex ); + // calculate new start value for groups - // calculate new start value for groups + groupStart += groupCount; - groupStart += groupCount; + // update total number of vertices - // update total number of vertices + numberOfVertices += vertexCounter; - numberOfVertices += vertexCounter; + } } } -BoxBufferGeometry.prototype = Object.create( BufferGeometry.prototype ); -BoxBufferGeometry.prototype.constructor = BoxBufferGeometry; - - export { BoxGeometry, BoxBufferGeometry }; From 248002c286a46522de47e2aae22d7368ef502388 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20Mar=C3=A9chal?= Date: Mon, 19 Aug 2019 12:43:58 +0200 Subject: [PATCH 04/75] Generate lightProbe from CubeCamera --- examples/js/lights/LightProbeGenerator.js | 99 ++++++++++++++++++++ examples/jsm/lights/LightProbeGenerator.d.ts | 4 +- examples/jsm/lights/LightProbeGenerator.js | 99 ++++++++++++++++++++ 3 files changed, 201 insertions(+), 1 deletion(-) diff --git a/examples/js/lights/LightProbeGenerator.js b/examples/js/lights/LightProbeGenerator.js index b958cde7d107c8..5a87f0757057c1 100644 --- a/examples/js/lights/LightProbeGenerator.js +++ b/examples/js/lights/LightProbeGenerator.js @@ -116,6 +116,105 @@ THREE.LightProbeGenerator = { return new THREE.LightProbe( sh ); + }, + + fromCubeCamera: function ( renderer, cubeCamera ) { + + // The cubeCamera renderTarget must be set to RGBA in order to make readRenderTargetPixels works + var norm, lengthSq, weight, totalWeight = 0; + + var coord = new THREE.Vector3(); + + var dir = new THREE.Vector3(); + + var color = new THREE.Color(); + + var shBasis = [ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]; + + var sh = new THREE.SphericalHarmonics3(); + var shCoefficients = sh.coefficients; + + for ( var faceIndex = 0; faceIndex < 6; faceIndex ++ ) { + + var imageWidth = cubeCamera.renderTarget.width; // assumed to be square + var data = new Uint8Array(imageWidth * imageWidth * 4); + renderer.readRenderTargetPixels(cubeCamera.renderTarget, 0, 0, imageWidth, imageWidth, data, faceIndex); + + var pixelSize = 2 / imageWidth; + + for ( var i = 0, il = data.length; i < il; i += 4 ) { // RGBA assumed + + // pixel color + color.setRGB( data[ i ] / 255, data[ i + 1 ] / 255, data[ i + 2 ] / 255 ); + // pixel coordinate on unit cube + + if (renderer.gammaOutput) { + // convert to linear color space + color.copySRGBToLinear( color ); + } + + var pixelIndex = i / 4; + + var col = - 1 + ( pixelIndex % imageWidth + 0.5 ) * pixelSize; + + var row = 1 - ( Math.floor( pixelIndex / imageWidth ) + 0.5 ) * pixelSize; + + switch ( faceIndex ) { + + case 0: coord.set( 1, row, col ); break; + + case 1: coord.set( - 1, row, - col ); break; + + case 2: coord.set( - col, 1, - row ); break; + + case 3: coord.set( - col, - 1, row ); break; + + case 4: coord.set( - col, row, 1 ); break; + + case 5: coord.set( col, row, - 1 ); break; + + } + + // weight assigned to this pixel + + lengthSq = coord.lengthSq(); + + weight = 4 / ( Math.sqrt( lengthSq ) * lengthSq ); + + totalWeight += weight; + + // direction vector to this pixel + dir.copy( coord ).normalize(); + + // evaluate SH basis functions in direction dir + THREE.SphericalHarmonics3.getBasisAt( dir, shBasis ); + + // accummuulate + for ( var j = 0; j < 9; j ++ ) { + + shCoefficients[ j ].x += shBasis[ j ] * color.r * weight; + shCoefficients[ j ].y += shBasis[ j ] * color.g * weight; + shCoefficients[ j ].z += shBasis[ j ] * color.b * weight; + + } + + } + + } + + // normalize + norm = ( 4 * Math.PI ) / totalWeight; + + for ( var j = 0; j < 9; j ++ ) { + + shCoefficients[ j ].x *= norm; + shCoefficients[ j ].y *= norm; + shCoefficients[ j ].z *= norm; + + } + + return new THREE.LightProbe( sh ); + } }; diff --git a/examples/jsm/lights/LightProbeGenerator.d.ts b/examples/jsm/lights/LightProbeGenerator.d.ts index ec4aad96e080c4..0fa4ea33a01720 100644 --- a/examples/jsm/lights/LightProbeGenerator.d.ts +++ b/examples/jsm/lights/LightProbeGenerator.d.ts @@ -1,10 +1,12 @@ import { CubeTexture, - LightProbe + LightProbe, + WebGLRenderer } from '../../../src/Three'; export namespace LightProbeGenerator { export function fromCubeTexture(cubeTexture: CubeTexture): LightProbe; + export function fromCubeCamera(renderer: WebGLRenderer, cubeCamera: CubeCamera): LightProbe; } diff --git a/examples/jsm/lights/LightProbeGenerator.js b/examples/jsm/lights/LightProbeGenerator.js index 69626fb3cde48b..45680506d0ada0 100644 --- a/examples/jsm/lights/LightProbeGenerator.js +++ b/examples/jsm/lights/LightProbeGenerator.js @@ -123,6 +123,105 @@ var LightProbeGenerator = { return new LightProbe( sh ); + }, + + fromCubeCamera: function ( renderer, cubeCamera ) { + + // The cubeCamera renderTarget must be set to RGBA in order to make readRenderTargetPixels works + var norm, lengthSq, weight, totalWeight = 0; + + var coord = new Vector3(); + + var dir = new Vector3(); + + var color = new Color(); + + var shBasis = [ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]; + + var sh = new SphericalHarmonics3(); + var shCoefficients = sh.coefficients; + + for ( var faceIndex = 0; faceIndex < 6; faceIndex ++ ) { + + var imageWidth = cubeCamera.renderTarget.width; // assumed to be square + var data = new Uint8Array(imageWidth * imageWidth * 4); + renderer.readRenderTargetPixels(cubeCamera.renderTarget, 0, 0, imageWidth, imageWidth, data, faceIndex); + + var pixelSize = 2 / imageWidth; + + for ( var i = 0, il = data.length; i < il; i += 4 ) { // RGBA assumed + + // pixel color + color.setRGB( data[ i ] / 255, data[ i + 1 ] / 255, data[ i + 2 ] / 255 ); + // pixel coordinate on unit cube + + if (renderer.gammaOutput) { + // convert to linear color space + color.copySRGBToLinear( color ); + } + + var pixelIndex = i / 4; + + var col = - 1 + ( pixelIndex % imageWidth + 0.5 ) * pixelSize; + + var row = 1 - ( Math.floor( pixelIndex / imageWidth ) + 0.5 ) * pixelSize; + + switch ( faceIndex ) { + + case 0: coord.set( 1, row, col ); break; + + case 1: coord.set( - 1, row, - col ); break; + + case 2: coord.set( - col, 1, - row ); break; + + case 3: coord.set( - col, - 1, row ); break; + + case 4: coord.set( - col, row, 1 ); break; + + case 5: coord.set( col, row, - 1 ); break; + + } + + // weight assigned to this pixel + + lengthSq = coord.lengthSq(); + + weight = 4 / ( Math.sqrt( lengthSq ) * lengthSq ); + + totalWeight += weight; + + // direction vector to this pixel + dir.copy( coord ).normalize(); + + // evaluate SH basis functions in direction dir + THREE.SphericalHarmonics3.getBasisAt( dir, shBasis ); + + // accummuulate + for ( var j = 0; j < 9; j ++ ) { + + shCoefficients[ j ].x += shBasis[ j ] * color.r * weight; + shCoefficients[ j ].y += shBasis[ j ] * color.g * weight; + shCoefficients[ j ].z += shBasis[ j ] * color.b * weight; + + } + + } + + } + + // normalize + norm = ( 4 * Math.PI ) / totalWeight; + + for ( var j = 0; j < 9; j ++ ) { + + shCoefficients[ j ].x *= norm; + shCoefficients[ j ].y *= norm; + shCoefficients[ j ].z *= norm; + + } + + return new LightProbe( sh ); + } }; From 1980decbc2d429de225d78f6a578463d40f52ebe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20Mar=C3=A9chal?= Date: Tue, 20 Aug 2019 11:42:47 +0200 Subject: [PATCH 05/75] Fix THREE.SphericalHarmonics3 to SphericalHarmonics3 in jsm --- examples/jsm/lights/LightProbeGenerator.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/jsm/lights/LightProbeGenerator.js b/examples/jsm/lights/LightProbeGenerator.js index 45680506d0ada0..ad432b3cd1fb6a 100644 --- a/examples/jsm/lights/LightProbeGenerator.js +++ b/examples/jsm/lights/LightProbeGenerator.js @@ -194,7 +194,7 @@ var LightProbeGenerator = { dir.copy( coord ).normalize(); // evaluate SH basis functions in direction dir - THREE.SphericalHarmonics3.getBasisAt( dir, shBasis ); + SphericalHarmonics3.getBasisAt( dir, shBasis ); // accummuulate for ( var j = 0; j < 9; j ++ ) { From 92f81d990a9c433ffee1c592a5522591bc0f7718 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20Mar=C3=A9chal?= Date: Tue, 20 Aug 2019 11:42:59 +0200 Subject: [PATCH 06/75] Add example --- examples/textures/cube/cornell/nx.png | Bin 0 -> 1369 bytes examples/textures/cube/cornell/ny.png | Bin 0 -> 1072 bytes examples/textures/cube/cornell/nz.png | Bin 0 -> 1370 bytes examples/textures/cube/cornell/px.png | Bin 0 -> 1369 bytes examples/textures/cube/cornell/py.png | Bin 0 -> 1365 bytes examples/textures/cube/cornell/pz.png | Bin 0 -> 1371 bytes examples/webgl_lightprobe_cubecamera.html | 117 ++++++++++++++++++++++ 7 files changed, 117 insertions(+) create mode 100644 examples/textures/cube/cornell/nx.png create mode 100644 examples/textures/cube/cornell/ny.png create mode 100644 examples/textures/cube/cornell/nz.png create mode 100644 examples/textures/cube/cornell/px.png create mode 100644 examples/textures/cube/cornell/py.png create mode 100644 examples/textures/cube/cornell/pz.png create mode 100644 examples/webgl_lightprobe_cubecamera.html diff --git a/examples/textures/cube/cornell/nx.png b/examples/textures/cube/cornell/nx.png new file mode 100644 index 0000000000000000000000000000000000000000..acfb768062b6257972e768a4541188599dd5345d GIT binary patch literal 1369 zcmeAS@N?(olHy`uVBq!ia0y~yU<5K58911L)MWvCLk0$>`&A(kB|(Yh3I#>^X_+~x z3MG{VsS2qTnQ06R6}R3__w7^Bd=^Fp4iCBlBoJ$YCzd#-8DE8{P+FXEo{ zuS2@tUC*cFKkH6|i@8Pfch)+tz5caZiTi?0tMRfxHa#<8)BCnkPf^LpkfV2Wo;@^*J&_z!{$_AZ|c z6yYrJh%9Dc&{GCs#)_r(Wk5mp5>H=O_QxC|oGh#>Za6gpbIfl~7sn7_Zn*5o%fP^K z#NfdG=Z|~YqBy;;Y5vGoIlz#>V89^3z{9}Cz}&z{buMj8MRG3^lNLUqdVpZKmlmN8 dwxl7OF;brCzr3D80x)GTc)I$ztaD0e0st8?%%=bV literal 0 HcmV?d00001 diff --git a/examples/textures/cube/cornell/ny.png b/examples/textures/cube/cornell/ny.png new file mode 100644 index 0000000000000000000000000000000000000000..98e284476012a92698667acd810f74e95e800d42 GIT binary patch literal 1072 zcmeAS@N?(olHy`uVBq!ia0y~yU<5K58911L)MWvCLk0$>J5?bOB|(Yh3I#>^X_+~x z3MG{VsS2qTnQ06R6}R3_kDer>$>aJzvUU1|NdiKr6)RoN@TL9SH=!gf++HTJ+V0un zNg4{F1*}$0ulWAnuXp>=*uF_daaH9hP1%a1zM0%sbus6!UJ?xd`|ZNI`EMS+Gm3K5 zzAnD{m^PBe{|0yQ4@6DF`&i6ih)oh>p_hD83 z<4gZO$nhS`;Ie&qAl8HLirrq0Foj62DEHp-d16swu4|LxkL%Tl?|Gk8J|%bh^MDrR zw~Q~Hd$!H}(j1#-{%4C)RYl#eLr=;+YL+FN$S;oHt!=0nr1{2oZ*J;WgAXnmslMJC zZT*Y#SEq;^7t`)AyHRi)MCSPG2&A!xOvSU zWHOdSXszHpQ?tHx+WkF$LW?T$S|<7kD4+Qeawz;`bTBv1Pku`HvKXEcGIn{fJL3$#K#ktGo&m`7vTvIc%a4SQLmk_g* zjKYDgz=`%^vX&tsCTyX;S+8boRq-^;^g4NI&*H95*I@6oXVcd1s3`gRmUgllm-;C-f|J%V^ul+%& zigRyEoRj{-=@-0T{8u*laGd$yRUUgrWtoYJnycEXfXSUL$=lt9;Xep2*t>i(P=vF< zBeIx*K~EWk87r3BmjMOYOFVsD*&lO=aI#v?Tf^@T6uRo^;ur$V3I`2Ax#!S=ul{dS fxfcMLLl`tjGwL!h&O3eREyxp|u6{1-oD!M2UQ^vB|(Yh3I#>^X_+~x z3MG{VsS2qTnQ06R6}R3__nq`ufv5HRoTR=6m6jug1~XReJSbByH^a~BZ}`>N%`;qm zjwVQ|RLocKwD|u=?xDDz)*;1}m3o%$F)NoG66Ni`UV2sJ@~-_cTi)}3E66s=a@4)v zUGpwbv}`Z`hAnT8FSd=?E%oO1MeiqX1JY95lD~g`>+xgLHB|)5=gYDfPf!xw`nWHBo>-Jvtk~~}-5+LF%+C~mz3ud35yfYB z7587vxb10wEl=}Hm0L;wpAUz=h&`HHmRutLcu!b(a9fb&8`r%$sar36Y?!jCEmh>O z`^9acTwTeXyhp4u!Fi@;Huu^csYkP)bll;zo%x{0;8856ykvb)Uf;19E4@YjE)#ur)cC7GuV>!9 zi`)(wIliSYcY9S#HUB6Y!RQ!kWGxo)xNxV%ly^H-yEiYGe@x`jR?`!|${0EYq75Ze zN*2xVoMPmfY^L<$#e-nO;%P_NIVNb8b1~<*7(K8!e?ua9%dbtJQjc9^63~j|$=J}y zpsniqFQVv4K{sMDs|nf8Zc8O1q%N=1=x5bDMojWm=g1?%?K| zZ;rB_ee9xcEb!PxA#XB+&@A=MFQy3j7fp`T>G562leI+HZ@DKA%Vp0s&3SL$J=ym} z%%rwky53FCr{sTA%#0UiJHOwtTX605FSm)T8Sf6Q%$(BLoExzE&D8!xm9%y{W;-5;PJdx@v7EBj*(5l&WV?=yajfm!Car;B3`&A(kB|(Yh3I#>^X_+~x z3MG{VsS2qTnQ06R6}R3_kDl~cfyecK z41du5&0KG)<|h>1KJQ+=p{n%8_Qlgr++KL*M9(?7=eH+*NL^kl|7l+Mqt$QU^gkCZ z_S+@5cV|DF;jBaQCXe(~*t6y{vuIDyVO_iUn5{pzuD8qDB>8M{JK^`nZ~HdA{iNY) zaY=5%y^Jkym&j*t7pdB-w9CD&BB6@=qu*}BS^XE+-<>*RK?qlMuzqx;Esu@j(lwc! zM?VC9$(`Es=tdIjMz&e%Uc6H}7k*pd(aXjAYW3QXjYm$*<<%`tjWiQ~e5TZ~bMu7+ z=6PZc?Ms_x9XPXn>xHh_;d{LLPV^c~;ylM;d~fQ9i67OUKFjEtxyz;f{+2_#DwfGj zGdy`#YB590v1=jI_pNRTuPolfq^+>RJMB2z>B2ZYzopfACm-oZEO+NQUTSjURvAO5 zK=ek5l#(UN6E#$=dTw?sSlsM?@KmJIdtjOQ;^s?Ayx6}GexHJP&`& zUm2NkuSk2YRnW@g>ugJ3-z(N<-f5O{WT7&zwB08S^Q_sglufIg-(_cQS?QZp*t^-< zbjI1Zm@O;oKj|S^u**lDP<|g76!1HUgBJSQH8B(qwwnm(z~s9 z>hEOjz5nRg{E6JcclRrZtL^fAXSZGV0L#C1AGtAS~sfi20~-G$*l2rk&Wd@@jkv%n*= zn1O*?2!t6g-L3lr6l5>)^mS!_%ptQ1_K5O1|9}#b7^BLl6#SuH1P?w0|djpv+f^YEB|(Yh3I#>^X_+~x z3MG{VsS2qTnQ06R6}R3__bpP<2E)%58k?(c;6|1-p{O*s(F8H&uyRZA$9p*xl{APFYkW)hJSmt z^z?7--%~i;!e4N*+qJ4J`u5Uw1CwUZMXRhmpSN7t^dxoR`egBa-1o{ic9-6MYAK@l z%vPbkHiS@x#- z6m34H!LV>+@+$3pt6Rz|h3_|t3S1FQJI=*TR8TK zc00PMcg=Ls3^qwqc9M~;(F!{^=?4R2&{My}hF%XgnddL1i+ip`gzY=CBZ|SP(1j zV9qx+$In(5Px2hG5bU_E($Mnkq>k0nBa`o>h;cs-&}f!=*>X8ki1}cN(CY=W?>67j z-^uE`|7h=iWpTA#|C?fFyfE8&{?5Jy*IxhXRpP#2(`vjdkWJ5wXVse@2W$U4&;1eI zIQ@e63)L?|Rh)ZU;++0VD@y)&%=ka6ZT{w;6P};AucHG@?QBWj?k+$Y2!1;6t_M<_ z1s;*b3=De8Ak0{?)V>TT$X?><>&pI^Lxht}v^~-w9hh5wd%8G=0CU1+M_vX7jw1#K z_CJ5z%NE7yea(|=pA@G7g9HN)0~-T#1LFaP1O{qzX=5s~duir$h$Ykx5M-x=L!K6) c4zc7x)an;3f4N-NbbykLr>mdKI;Vst0LpF8-2eap literal 0 HcmV?d00001 diff --git a/examples/textures/cube/cornell/pz.png b/examples/textures/cube/cornell/pz.png new file mode 100644 index 0000000000000000000000000000000000000000..65b273a43ac931a24e4f7273bcf4856debfdc8ec GIT binary patch literal 1371 zcmeAS@N?(olHy`uVBq!ia0y~yU<5K58911L)MWvCLk0$>hgBgFB|(Yh3I#>^X_+~x z3MG{VsS2qTnQ06R6}R3__bpOZnFC6Ln96t4mPTIp| zJX?5#_V_%Zqi>&UpGu zX?}HBYwUYro!s9aGx)Eq@BBWqY-8ST8!y46 zd(5Atd$-N~lKgg>)B13i?XtnQMIeqOKIX1ZoLD#nQ zB>m9%wav@1FlS?91p8U$rL0;<0;&TR`Aub;yE^yEh9gJRrK6r5+mxesto3%&q_l+x z*=%eZ_`I1-8)xQcFBILrrlMD7qIIH*@EpOkJ=zbIAN!v=dr`u;v~$t@Er)hhER&mN zc=D{&VuqGu*FvW6Tip^~DIDJ@DsV-0b8@q(-1Khem-C`GS#TfA^ihm+Z(ftnK7nJS zXt$%Ade=-B&0v!><)%J9J5lX)&zc5?l|{=94!Ef>_kHf^wRFqY(T-1x(Pda@p~Pll z;m|O3l2W~nWzmXN8C9~G+0l+De!C|g?Q%ai9PTf=()J~DW#;L#v$kK#dafsXeE;*j zh1L3d=anc;Jy-H-roZ)Hopjj~TNRagWh-xd2z1*UcsoRXVFIBI4T{_WK9jsm^Hy$|I6 z#7RHmSGSY3MS_3l_p#JFJh*@MgSf)>i4RKDl^y`oJX?~ty9wy$!fk$L9 z0|U1Z2s2)~TlWVj$X?><>&pI^Lxhvf;7sfj1z?`}?djqe0?ZGW9eEiTIF1+`*#G=- zFIyC+_chOh(aMZ$49pFT2N)6<3>YLBco?Y7rH!db?nPqK#3$4a5DfRyBGe(4#Bet= XGyn5H@GJ+IG8jBv{an^LB{Ts5ER@a> literal 0 HcmV?d00001 diff --git a/examples/webgl_lightprobe_cubecamera.html b/examples/webgl_lightprobe_cubecamera.html new file mode 100644 index 00000000000000..cbe995b16e6729 --- /dev/null +++ b/examples/webgl_lightprobe_cubecamera.html @@ -0,0 +1,117 @@ + + + + three.js webgl - light probe + + + + + + +
+ three.js webgl - light probe +
+ + + + + From 8fa0e30de776b66db37b56d4c90fac56ac2d97b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20Mar=C3=A9chal?= Date: Tue, 20 Aug 2019 12:29:24 +0200 Subject: [PATCH 07/75] add example to files.js --- examples/files.js | 1 + examples/webgl_lightprobe_cubecamera.html | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/files.js b/examples/files.js index 277020fad2ff2e..97ec3d8d40ed66 100644 --- a/examples/files.js +++ b/examples/files.js @@ -61,6 +61,7 @@ var files = { "webgl_layers", "webgl_lensflares", "webgl_lightprobe", + "webgl_lightprobe_cubecamera", "webgl_lights_hemisphere", "webgl_lights_physical", "webgl_lights_pointlights", diff --git a/examples/webgl_lightprobe_cubecamera.html b/examples/webgl_lightprobe_cubecamera.html index cbe995b16e6729..eb6bb1a052745c 100644 --- a/examples/webgl_lightprobe_cubecamera.html +++ b/examples/webgl_lightprobe_cubecamera.html @@ -1,7 +1,7 @@ - three.js webgl - light probe + three.js webgl - light probe from cubeCamera @@ -9,7 +9,7 @@
- three.js webgl - light probe + three.js webgl - light probe from cubeCamera
+ + + + + +

[name]

+ +

+ This is used internally by [page:PointLight PointLights] for calculating shadows +

+ + +

Example

+

+ +//Create a WebGLRenderer and turn on shadows in the renderer +var renderer = new THREE.WebGLRenderer(); +renderer.shadowMap.enabled = true; +renderer.shadowMap.type = THREE.PCFSoftShadowMap; // default THREE.PCFShadowMap + +//Create a PointLight and turn on shadows for the light +var light = new THREE.PointLight( 0xffffff, 1, 100 ); +light.position.set( 0, 10, 0 ); +light.castShadow = true; // default false +scene.add( light ); + +//Set up shadow properties for the light +light.shadow.mapSize.width = 512; // default +light.shadow.mapSize.height = 512; // default +light.shadow.camera.near = 0.5; // default +light.shadow.camera.far = 500 // default + +//Create a sphere that cast shadows (but does not receive them) +var sphereGeometry = new THREE.SphereBufferGeometry( 5, 32, 32 ); +var sphereMaterial = new THREE.MeshStandardMaterial( { color: 0xff0000 } ); +var sphere = new THREE.Mesh( sphereGeometry, sphereMaterial ); +sphere.castShadow = true; //default is false +sphere.receiveShadow = false; //default +scene.add( sphere ); + +//Create a plane that receives shadows (but does not cast them) +var planeGeometry = new THREE.PlaneBufferGeometry( 20, 20, 32, 32 ); +var planeMaterial = new THREE.MeshStandardMaterial( { color: 0x00ff00 } ) +var plane = new THREE.Mesh( planeGeometry, planeMaterial ); +plane.receiveShadow = true; +scene.add( plane ); + +//Create a helper for the shadow camera (optional) +var helper = new THREE.CameraHelper( light.shadow.camera ); +scene.add( helper ); + +

+ +

Constructor

+

[name]( )

+

+ Creates a new [name]. This is not intended to be called directly - it is called + internally by [page:PointLight]. +

+ +

Properties

+

+ See the base [page:LightShadow LightShadow] class for common properties. +

+ +

Methods

+

+ See the base [page:LightShadow LightShadow] class for common methods. +

+ +

Source

+ +

+ [link:https://github.com/mrdoob/three.js/blob/master/src/lights/[name].js src/lights/[name].js] +

+ + diff --git a/docs/list.js b/docs/list.js index a87e986502f833..53f7eefa37c706 100644 --- a/docs/list.js +++ b/docs/list.js @@ -654,8 +654,9 @@ var list = { }, "灯光 / 阴影": { - "DirectionalLightShadow": "api/zh/lights/shadows/DirectionalLightShadow", "LightShadow": "api/zh/lights/shadows/LightShadow", + "PointLightShadow": "api/zh/lights/shadows/PointLightShadow", + "DirectionalLightShadow": "api/zh/lights/shadows/DirectionalLightShadow", "SpotLightShadow": "api/zh/lights/shadows/SpotLightShadow" }, @@ -801,7 +802,9 @@ var list = { "加载器": { "BabylonLoader": "examples/zh/loaders/BabylonLoader", - "GLTFLoader": "examples/zh/loaders/GLTFLoader", + "BasisTextureLoader": "examples/zh/loaders/BasisTextureLoader", + "DRACOLoader": "examples/zh/loaders/DRACOLoader", + "GLTFLoader": "examples/zh/loaders/GLTFLoader", "MMDLoader": "examples/zh/loaders/MMDLoader", "MTLLoader": "examples/zh/loaders/MTLLoader", "OBJLoader": "examples/zh/loaders/OBJLoader", @@ -818,14 +821,15 @@ var list = { "Lensflare": "examples/zh/objects/Lensflare", }, - "Post-Processing": { + "后期处理": { "EffectComposer": "examples/zh/postprocessing/EffectComposer" }, "导出器": { "GLTFExporter": "examples/zh/exporters/GLTFExporter", - "PLYExporter": "examples/zh/exporters/PLYExporter" - }, + "PLYExporter": "examples/zh/exporters/PLYExporter", + "ColladaExporter": "examples/zh/exporters/ColladaExporter" + }, "插件": { "LookupTable": "examples/zh/Lut", @@ -848,7 +852,8 @@ var list = { "实用工具": { "BufferGeometryUtils": "examples/zh/utils/BufferGeometryUtils", - "SceneUtils": "examples/zh/utils/SceneUtils" + "SceneUtils": "examples/zh/utils/SceneUtils", + "SkeletonUtils": "examples/zh/utils/SkeletonUtils" } }, From 3b8b2facc7e96ef4684e63a484f2fba9079f0ecf Mon Sep 17 00:00:00 2001 From: WestLangley Date: Thu, 29 Aug 2019 01:00:21 -0400 Subject: [PATCH 14/75] Added tonemapping --- examples/webgl_materials_physical_clearcoat.html | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/examples/webgl_materials_physical_clearcoat.html b/examples/webgl_materials_physical_clearcoat.html index bd1215e9e859b1..80447eb4133e39 100644 --- a/examples/webgl_materials_physical_clearcoat.html +++ b/examples/webgl_materials_physical_clearcoat.html @@ -66,6 +66,7 @@ var textureLoader = new THREE.TextureLoader(); var diffuse = textureLoader.load( "textures/carbon/Carbon.png" ); + diffuse.encoding = THREE.sRGBEncoding; diffuse.wrapS = THREE.RepeatWrapping; diffuse.wrapT = THREE.RepeatWrapping; diffuse.repeat.x = 10; @@ -183,7 +184,11 @@ // - renderer.gammaInput = true; + renderer.toneMapping = THREE.ACESFilmicToneMapping; + renderer.toneMappingExposure = 1; + + // + renderer.gammaOutput = true; // From a9ff84e4a5204eb2b5380670fdd2aca008b69689 Mon Sep 17 00:00:00 2001 From: gogoend Date: Thu, 29 Aug 2019 13:06:02 +0800 Subject: [PATCH 15/75] Zh doc: remove the old canvas example links. --- docs/api/zh/cameras/OrthographicCamera.html | 1 - docs/api/zh/cameras/PerspectiveCamera.html | 2 -- docs/api/zh/lights/AmbientLight.html | 4 ---- docs/api/zh/lights/DirectionalLight.html | 1 - docs/api/zh/lights/PointLight.html | 1 - docs/api/zh/materials/LineDashedMaterial.html | 1 - 6 files changed, 10 deletions(-) diff --git a/docs/api/zh/cameras/OrthographicCamera.html b/docs/api/zh/cameras/OrthographicCamera.html index 13b7f8b032fd91..2a66ada51700fe 100644 --- a/docs/api/zh/cameras/OrthographicCamera.html +++ b/docs/api/zh/cameras/OrthographicCamera.html @@ -25,7 +25,6 @@

正交相机([name])

示例

-

[example:canvas_camera_orthographic camera / orthographic ]

[example:webgl_camera camera ]

[example:webgl_interactive_cubes_ortho interactive / cubes / ortho ]

[example:webgl_materials_cubemap_dynamic materials / cubemap / dynamic ]

diff --git a/docs/api/zh/cameras/PerspectiveCamera.html b/docs/api/zh/cameras/PerspectiveCamera.html index ffe6d8de48c59f..e9e47d9a08c154 100644 --- a/docs/api/zh/cameras/PerspectiveCamera.html +++ b/docs/api/zh/cameras/PerspectiveCamera.html @@ -22,8 +22,6 @@

透视相机([name])

示例

-

[example:canvas_geometry_birds geometry / birds ]

-

[example:canvas_geometry_cube geometry / cube ]

[example:webgl_animation_skinning_blending animation / skinning / blending ]

[example:webgl_animation_skinning_morph animation / skinning / blending ]

[example:webgl_effects_stereo effects / stereo ]

diff --git a/docs/api/zh/lights/AmbientLight.html b/docs/api/zh/lights/AmbientLight.html index f36d0b5ac0cd30..dd1e18bff46bfe 100644 --- a/docs/api/zh/lights/AmbientLight.html +++ b/docs/api/zh/lights/AmbientLight.html @@ -21,10 +21,6 @@

[name]

示例

- [example:canvas_camera_orthographic camera / orthographic ]
- [example:canvas_interactive_voxelpainter interactive / voxelpainter ]
- [example:canvas_materials materials ]
- [example:canvas_sandbox sandbox ]
[example:webgl_animation_cloth animation / cloth ]
[example:webgl_animation_skinning_blending animation / skinning / blending ]

diff --git a/docs/api/zh/lights/DirectionalLight.html b/docs/api/zh/lights/DirectionalLight.html index 5d81631c76220e..f3adc80e638f5c 100644 --- a/docs/api/zh/lights/DirectionalLight.html +++ b/docs/api/zh/lights/DirectionalLight.html @@ -36,7 +36,6 @@

关于位置、目标和旋转说明

示例

- [example:canvas_morphtargets_horse morphtargets / horse ]
[example:misc_controls_fly controls / fly ]
[example:webvr_cubes cubes ]
[example:webgl_effects_parallaxbarrier effects / parallaxbarrier ]
diff --git a/docs/api/zh/lights/PointLight.html b/docs/api/zh/lights/PointLight.html index a2b6cdb0cee714..31826d8cb6aeab 100644 --- a/docs/api/zh/lights/PointLight.html +++ b/docs/api/zh/lights/PointLight.html @@ -22,7 +22,6 @@

点光源([name])

示例

- [example:canvas_lights_pointlights lights / pointlights ]
[example:webgl_lights_pointlights lights / pointlights ]
[example:webgl_lights_pointlights2 lights / pointlights2 ]
[example:webgldeferred_animation animation ]
diff --git a/docs/api/zh/materials/LineDashedMaterial.html b/docs/api/zh/materials/LineDashedMaterial.html index 6d1bd6ebca767a..af96a0d1925551 100644 --- a/docs/api/zh/materials/LineDashedMaterial.html +++ b/docs/api/zh/materials/LineDashedMaterial.html @@ -18,7 +18,6 @@

例子(Examples)

[example:webgl_lines_dashed WebGL / lines / dashed]
- [example:canvas_lines_dashed Canvas / lines /dashed]

From c3113b7b1dd4d0be8f7ab78df2a54f3f55346dc5 Mon Sep 17 00:00:00 2001 From: WestLangley Date: Thu, 29 Aug 2019 01:13:04 -0400 Subject: [PATCH 16/75] Properly group indirect diffuse and indirect specular terms --- .../ShaderChunk/lights_physical_pars_fragment.glsl.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js b/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js index d9868e417dab02..2aa411d1a1aea9 100644 --- a/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js +++ b/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js @@ -140,8 +140,7 @@ void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradia float clearcoatInv = 1.0 - clearcoatDHR; - // Both indirect specular and diffuse light accumulate here - // if energy preservation enabled, and PMREM provided. + // Both indirect specular and indirect diffuse light accumulate here vec3 singleScattering = vec3( 0.0 ); vec3 multiScattering = vec3( 0.0 ); @@ -152,7 +151,8 @@ void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradia vec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) ); reflectedLight.indirectSpecular += clearcoatInv * radiance * singleScattering; - reflectedLight.indirectDiffuse += multiScattering * cosineWeightedIrradiance; + reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance; + reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance; } From 144bf2a146b9afa2e0a6fb28911d0373aa578971 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20Mar=C3=A9chal?= Date: Thu, 29 Aug 2019 09:32:35 +0200 Subject: [PATCH 17/75] Cleanup and white space formatting --- examples/js/lights/LightProbeGenerator.js | 4 ++-- examples/jsm/lights/LightProbeGenerator.js | 4 ++-- examples/textures/cube/cornell/nx.png | Bin 1369 -> 0 bytes examples/textures/cube/cornell/ny.png | Bin 1072 -> 0 bytes examples/textures/cube/cornell/nz.png | Bin 1370 -> 0 bytes examples/textures/cube/cornell/px.png | Bin 1369 -> 0 bytes examples/textures/cube/cornell/py.png | Bin 1365 -> 0 bytes examples/textures/cube/cornell/pz.png | Bin 1371 -> 0 bytes 8 files changed, 4 insertions(+), 4 deletions(-) delete mode 100644 examples/textures/cube/cornell/nx.png delete mode 100644 examples/textures/cube/cornell/ny.png delete mode 100644 examples/textures/cube/cornell/nz.png delete mode 100644 examples/textures/cube/cornell/px.png delete mode 100644 examples/textures/cube/cornell/py.png delete mode 100644 examples/textures/cube/cornell/pz.png diff --git a/examples/js/lights/LightProbeGenerator.js b/examples/js/lights/LightProbeGenerator.js index 8019307e4538a4..e3a802024f8808 100644 --- a/examples/js/lights/LightProbeGenerator.js +++ b/examples/js/lights/LightProbeGenerator.js @@ -137,8 +137,8 @@ THREE.LightProbeGenerator = { for ( var faceIndex = 0; faceIndex < 6; faceIndex ++ ) { var imageWidth = renderTarget.width; // assumed to be square - var data = new Uint8Array(imageWidth * imageWidth * 4); - renderer.readRenderTargetPixels(renderTarget, 0, 0, imageWidth, imageWidth, data, faceIndex); + var data = new Uint8Array( imageWidth * imageWidth * 4 ); + renderer.readRenderTargetPixels( renderTarget, 0, 0, imageWidth, imageWidth, data, faceIndex ); var pixelSize = 2 / imageWidth; diff --git a/examples/jsm/lights/LightProbeGenerator.js b/examples/jsm/lights/LightProbeGenerator.js index ccb91a5adb323c..aebe9b898450a4 100644 --- a/examples/jsm/lights/LightProbeGenerator.js +++ b/examples/jsm/lights/LightProbeGenerator.js @@ -144,8 +144,8 @@ var LightProbeGenerator = { for ( var faceIndex = 0; faceIndex < 6; faceIndex ++ ) { var imageWidth = renderTarget.width; // assumed to be square - var data = new Uint8Array(imageWidth * imageWidth * 4); - renderer.readRenderTargetPixels(renderTarget, 0, 0, imageWidth, imageWidth, data, faceIndex); + var data = new Uint8Array( imageWidth * imageWidth * 4 ); + renderer.readRenderTargetPixels( renderTarget, 0, 0, imageWidth, imageWidth, data, faceIndex ); var pixelSize = 2 / imageWidth; diff --git a/examples/textures/cube/cornell/nx.png b/examples/textures/cube/cornell/nx.png deleted file mode 100644 index acfb768062b6257972e768a4541188599dd5345d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1369 zcmeAS@N?(olHy`uVBq!ia0y~yU<5K58911L)MWvCLk0$>`&A(kB|(Yh3I#>^X_+~x z3MG{VsS2qTnQ06R6}R3__w7^Bd=^Fp4iCBlBoJ$YCzd#-8DE8{P+FXEo{ zuS2@tUC*cFKkH6|i@8Pfch)+tz5caZiTi?0tMRfxHa#<8)BCnkPf^LpkfV2Wo;@^*J&_z!{$_AZ|c z6yYrJh%9Dc&{GCs#)_r(Wk5mp5>H=O_QxC|oGh#>Za6gpbIfl~7sn7_Zn*5o%fP^K z#NfdG=Z|~YqBy;;Y5vGoIlz#>V89^3z{9}Cz}&z{buMj8MRG3^lNLUqdVpZKmlmN8 dwxl7OF;brCzr3D80x)GTc)I$ztaD0e0st8?%%=bV diff --git a/examples/textures/cube/cornell/ny.png b/examples/textures/cube/cornell/ny.png deleted file mode 100644 index 98e284476012a92698667acd810f74e95e800d42..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1072 zcmeAS@N?(olHy`uVBq!ia0y~yU<5K58911L)MWvCLk0$>J5?bOB|(Yh3I#>^X_+~x z3MG{VsS2qTnQ06R6}R3_kDer>$>aJzvUU1|NdiKr6)RoN@TL9SH=!gf++HTJ+V0un zNg4{F1*}$0ulWAnuXp>=*uF_daaH9hP1%a1zM0%sbus6!UJ?xd`|ZNI`EMS+Gm3K5 zzAnD{m^PBe{|0yQ4@6DF`&i6ih)oh>p_hD83 z<4gZO$nhS`;Ie&qAl8HLirrq0Foj62DEHp-d16swu4|LxkL%Tl?|Gk8J|%bh^MDrR zw~Q~Hd$!H}(j1#-{%4C)RYl#eLr=;+YL+FN$S;oHt!=0nr1{2oZ*J;WgAXnmslMJC zZT*Y#SEq;^7t`)AyHRi)MCSPG2&A!xOvSU zWHOdSXszHpQ?tHx+WkF$LW?T$S|<7kD4+Qeawz;`bTBv1Pku`HvKXEcGIn{fJL3$#K#ktGo&m`7vTvIc%a4SQLmk_g* zjKYDgz=`%^vX&tsCTyX;S+8boRq-^;^g4NI&*H95*I@6oXVcd1s3`gRmUgllm-;C-f|J%V^ul+%& zigRyEoRj{-=@-0T{8u*laGd$yRUUgrWtoYJnycEXfXSUL$=lt9;Xep2*t>i(P=vF< zBeIx*K~EWk87r3BmjMOYOFVsD*&lO=aI#v?Tf^@T6uRo^;ur$V3I`2Ax#!S=ul{dS fxfcMLLl`tjGwL!h&O3eREyxp|u6{1-oD!M2UQ^vB|(Yh3I#>^X_+~x z3MG{VsS2qTnQ06R6}R3__nq`ufv5HRoTR=6m6jug1~XReJSbByH^a~BZ}`>N%`;qm zjwVQ|RLocKwD|u=?xDDz)*;1}m3o%$F)NoG66Ni`UV2sJ@~-_cTi)}3E66s=a@4)v zUGpwbv}`Z`hAnT8FSd=?E%oO1MeiqX1JY95lD~g`>+xgLHB|)5=gYDfPf!xw`nWHBo>-Jvtk~~}-5+LF%+C~mz3ud35yfYB z7587vxb10wEl=}Hm0L;wpAUz=h&`HHmRutLcu!b(a9fb&8`r%$sar36Y?!jCEmh>O z`^9acTwTeXyhp4u!Fi@;Huu^csYkP)bll;zo%x{0;8856ykvb)Uf;19E4@YjE)#ur)cC7GuV>!9 zi`)(wIliSYcY9S#HUB6Y!RQ!kWGxo)xNxV%ly^H-yEiYGe@x`jR?`!|${0EYq75Ze zN*2xVoMPmfY^L<$#e-nO;%P_NIVNb8b1~<*7(K8!e?ua9%dbtJQjc9^63~j|$=J}y zpsniqFQVv4K{sMDs|nf8Zc8O1q%N=1=x5bDMojWm=g1?%?K| zZ;rB_ee9xcEb!PxA#XB+&@A=MFQy3j7fp`T>G562leI+HZ@DKA%Vp0s&3SL$J=ym} z%%rwky53FCr{sTA%#0UiJHOwtTX605FSm)T8Sf6Q%$(BLoExzE&D8!xm9%y{W;-5;PJdx@v7EBj*(5l&WV?=yajfm!Car;B3`&A(kB|(Yh3I#>^X_+~x z3MG{VsS2qTnQ06R6}R3_kDl~cfyecK z41du5&0KG)<|h>1KJQ+=p{n%8_Qlgr++KL*M9(?7=eH+*NL^kl|7l+Mqt$QU^gkCZ z_S+@5cV|DF;jBaQCXe(~*t6y{vuIDyVO_iUn5{pzuD8qDB>8M{JK^`nZ~HdA{iNY) zaY=5%y^Jkym&j*t7pdB-w9CD&BB6@=qu*}BS^XE+-<>*RK?qlMuzqx;Esu@j(lwc! zM?VC9$(`Es=tdIjMz&e%Uc6H}7k*pd(aXjAYW3QXjYm$*<<%`tjWiQ~e5TZ~bMu7+ z=6PZc?Ms_x9XPXn>xHh_;d{LLPV^c~;ylM;d~fQ9i67OUKFjEtxyz;f{+2_#DwfGj zGdy`#YB590v1=jI_pNRTuPolfq^+>RJMB2z>B2ZYzopfACm-oZEO+NQUTSjURvAO5 zK=ek5l#(UN6E#$=dTw?sSlsM?@KmJIdtjOQ;^s?Ayx6}GexHJP&`& zUm2NkuSk2YRnW@g>ugJ3-z(N<-f5O{WT7&zwB08S^Q_sglufIg-(_cQS?QZp*t^-< zbjI1Zm@O;oKj|S^u**lDP<|g76!1HUgBJSQH8B(qwwnm(z~s9 z>hEOjz5nRg{E6JcclRrZtL^fAXSZGV0L#C1AGtAS~sfi20~-G$*l2rk&Wd@@jkv%n*= zn1O*?2!t6g-L3lr6l5>)^mS!_%ptQ1_K5O1|9}#b7^BLl6#SuH1P?w0|djpv+f^YEB|(Yh3I#>^X_+~x z3MG{VsS2qTnQ06R6}R3__bpP<2E)%58k?(c;6|1-p{O*s(F8H&uyRZA$9p*xl{APFYkW)hJSmt z^z?7--%~i;!e4N*+qJ4J`u5Uw1CwUZMXRhmpSN7t^dxoR`egBa-1o{ic9-6MYAK@l z%vPbkHiS@x#- z6m34H!LV>+@+$3pt6Rz|h3_|t3S1FQJI=*TR8TK zc00PMcg=Ls3^qwqc9M~;(F!{^=?4R2&{My}hF%XgnddL1i+ip`gzY=CBZ|SP(1j zV9qx+$In(5Px2hG5bU_E($Mnkq>k0nBa`o>h;cs-&}f!=*>X8ki1}cN(CY=W?>67j z-^uE`|7h=iWpTA#|C?fFyfE8&{?5Jy*IxhXRpP#2(`vjdkWJ5wXVse@2W$U4&;1eI zIQ@e63)L?|Rh)ZU;++0VD@y)&%=ka6ZT{w;6P};AucHG@?QBWj?k+$Y2!1;6t_M<_ z1s;*b3=De8Ak0{?)V>TT$X?><>&pI^Lxht}v^~-w9hh5wd%8G=0CU1+M_vX7jw1#K z_CJ5z%NE7yea(|=pA@G7g9HN)0~-T#1LFaP1O{qzX=5s~duir$h$Ykx5M-x=L!K6) c4zc7x)an;3f4N-NbbykLr>mdKI;Vst0LpF8-2eap diff --git a/examples/textures/cube/cornell/pz.png b/examples/textures/cube/cornell/pz.png deleted file mode 100644 index 65b273a43ac931a24e4f7273bcf4856debfdc8ec..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1371 zcmeAS@N?(olHy`uVBq!ia0y~yU<5K58911L)MWvCLk0$>hgBgFB|(Yh3I#>^X_+~x z3MG{VsS2qTnQ06R6}R3__bpOZnFC6Ln96t4mPTIp| zJX?5#_V_%Zqi>&UpGu zX?}HBYwUYro!s9aGx)Eq@BBWqY-8ST8!y46 zd(5Atd$-N~lKgg>)B13i?XtnQMIeqOKIX1ZoLD#nQ zB>m9%wav@1FlS?91p8U$rL0;<0;&TR`Aub;yE^yEh9gJRrK6r5+mxesto3%&q_l+x z*=%eZ_`I1-8)xQcFBILrrlMD7qIIH*@EpOkJ=zbIAN!v=dr`u;v~$t@Er)hhER&mN zc=D{&VuqGu*FvW6Tip^~DIDJ@DsV-0b8@q(-1Khem-C`GS#TfA^ihm+Z(ftnK7nJS zXt$%Ade=-B&0v!><)%J9J5lX)&zc5?l|{=94!Ef>_kHf^wRFqY(T-1x(Pda@p~Pll z;m|O3l2W~nWzmXN8C9~G+0l+De!C|g?Q%ai9PTf=()J~DW#;L#v$kK#dafsXeE;*j zh1L3d=anc;Jy-H-roZ)Hopjj~TNRagWh-xd2z1*UcsoRXVFIBI4T{_WK9jsm^Hy$|I6 z#7RHmSGSY3MS_3l_p#JFJh*@MgSf)>i4RKDl^y`oJX?~ty9wy$!fk$L9 z0|U1Z2s2)~TlWVj$X?><>&pI^Lxhvf;7sfj1z?`}?djqe0?ZGW9eEiTIF1+`*#G=- zFIyC+_chOh(aMZ$49pFT2N)6<3>YLBco?Y7rH!db?nPqK#3$4a5DfRyBGe(4#Bet= XGyn5H@GJ+IG8jBv{an^LB{Ts5ER@a> From 93a721bb334438b5afb1581bc639aa736b006b6a Mon Sep 17 00:00:00 2001 From: gogoend Date: Thu, 29 Aug 2019 16:56:44 +0800 Subject: [PATCH 18/75] zh doc: Sync with the en doc. --- docs/api/zh/cameras/ArrayCamera.html | 2 +- docs/api/zh/lights/shadows/LightShadow.html | 78 ++++++++----------- .../zh/lights/shadows/PointLightShadow.html | 19 +++-- docs/api/zh/loaders/Loader.html | 6 +- docs/api/zh/materials/Material.html | 5 ++ 5 files changed, 49 insertions(+), 61 deletions(-) diff --git a/docs/api/zh/cameras/ArrayCamera.html b/docs/api/zh/cameras/ArrayCamera.html index 23936e55bff793..813d14f6268b55 100644 --- a/docs/api/zh/cameras/ArrayCamera.html +++ b/docs/api/zh/cameras/ArrayCamera.html @@ -8,7 +8,7 @@ - [page:PerspectiveCamera] → + [page:Object3D] → [page:Camera] → [page:PerspectiveCamera] →

摄像机阵列([name])

diff --git a/docs/api/zh/lights/shadows/LightShadow.html b/docs/api/zh/lights/shadows/LightShadow.html index b20431bc480469..03cb2a9bce7584 100644 --- a/docs/api/zh/lights/shadows/LightShadow.html +++ b/docs/api/zh/lights/shadows/LightShadow.html @@ -12,58 +12,17 @@

[name]

- 这在 [page:PointLight PointLights] 内部用于计算阴影,也可用作其他阴影类的基类。 + 该类作为其他阴影类的基类来使用。

-

例子

-

- -//Create a WebGLRenderer and turn on shadows in the renderer -var renderer = new THREE.WebGLRenderer(); -renderer.shadowMap.enabled = true; -renderer.shadowMap.type = THREE.PCFSoftShadowMap; // default THREE.PCFShadowMap - -//Create a PointLight and turn on shadows for the light -var light = new THREE.PointLight( 0xffffff, 1, 100 ); -light.position.set( 0, 10, 0 ); -light.castShadow = true; // default false -scene.add( light ); - -//Set up shadow properties for the light -light.shadow.mapSize.width = 512; // default -light.shadow.mapSize.height = 512; // default -light.shadow.camera.near = 0.5; // default -light.shadow.camera.far = 500 // default - -//Create a sphere that cast shadows (but does not receive them) -var sphereGeometry = new THREE.SphereBufferGeometry( 5, 32, 32 ); -var sphereMaterial = new THREE.MeshStandardMaterial( { color: 0xff0000 } ); -var sphere = new THREE.Mesh( sphereGeometry, sphereMaterial ); -sphere.castShadow = true; //default is false -sphere.receiveShadow = false; //default -scene.add( sphere ); - -//Create a plane that receives shadows (but does not cast them) -var planeGeometry = new THREE.PlaneBufferGeometry( 20, 20, 32, 32 ); -var planeMaterial = new THREE.MeshStandardMaterial( { color: 0x00ff00 } ) -var plane = new THREE.Mesh( planeGeometry, planeMaterial ); -plane.receiveShadow = true; -scene.add( plane ); - -//Create a helper for the shadow camera (optional) -var helper = new THREE.CameraHelper( light.shadow.camera ); -scene.add( helper ); - -

-

构造函数

[name]( [param:Camera camera] )

[page:Camera camera] - 在光的世界里

- 创建一个新的[name]。这不能直接调用的 - 它由[page:PointLight]在内部调用,或者由其他阴影用作基类。 + 创建一个新的[name]。这不能直接调用的 - 它由其他阴影用作基类。

属性

@@ -84,7 +43,6 @@

[property:WebGLRenderTarget map]

使用内置摄像头生成的深度图;超出像素深度的位置在阴影中。在渲染期间内部计算。

-

[property:Vector2 mapSize]

一个[Page:Vector2]定义阴影贴图的宽度和高度。

@@ -113,9 +71,34 @@

[property:Float radius]

方法

+ +

[method:Vector2 getFrameExtents]()

+

+ Used internally by the renderer to extend the shadow map to contain all viewports +

+ +

[method:null updateMatrices]( [param:Light light], [param:Camera viewCamera], [param:number viewportIndex])

+

+ Update the matrices for the camera and shadow, used internally by the renderer.

+ + light -- the light for which the shadow is being rendered.
+ viewCamera -- the camera view for which the shadow is being rendered.
+ viewportIndex -- calculates the matrix for this viewport +

+ +

[method:Frustum getFrustum]()

+

+ Gets the shadow cameras frustum. Used internally by the renderer to cull objects. +

+ +

[method:number getViewportCount]()

+

+ Used internally by the renderer to get the number of viewports that need to be rendered for this shadow. +

+

[method:LightShadow copy]( [param:LightShadow source] )

- 将[page:LightShadow]中的所有属性的值复制到 SpotLight。 + 将[page:LightShadow source]中的所有属性的值复制到该Light。

[method:LightShadow clone]()

@@ -129,7 +112,8 @@

[method:Object toJSON]()

源码

- - [link:https://github.com/mrdoob/three.js/blob/master/src/lights/[name].js src/lights/[name].js] +

+ [link:https://github.com/mrdoob/three.js/blob/master/src/lights/[name].js src/lights/[name].js] +

diff --git a/docs/api/zh/lights/shadows/PointLightShadow.html b/docs/api/zh/lights/shadows/PointLightShadow.html index ccaf1489d8823d..86a534fa154a77 100644 --- a/docs/api/zh/lights/shadows/PointLightShadow.html +++ b/docs/api/zh/lights/shadows/PointLightShadow.html @@ -12,11 +12,11 @@

[name]

- This is used internally by [page:PointLight PointLights] for calculating shadows + 该类在内部由[page:PointLight PointLights]所使用,以用于计算阴影。

-

Example

+

示例

//Create a WebGLRenderer and turn on shadows in the renderer @@ -57,24 +57,23 @@

Example

-

Constructor

+

构造函数

[name]( )

- Creates a new [name]. This is not intended to be called directly - it is called - internally by [page:PointLight]. + 创建一个新的[name]。该方法不是直接调用的 —— 其在内部由[page:PointLight]调用。

-

Properties

+

属性

- See the base [page:LightShadow LightShadow] class for common properties. + 共有属性请参见其基类[page:LightShadow LightShadow]。

-

Methods

+

方法

- See the base [page:LightShadow LightShadow] class for common methods. + 共有方法请参见其基类[page:LightShadow LightShadow]。

-

Source

+

源代码

[link:https://github.com/mrdoob/three.js/blob/master/src/lights/[name].js src/lights/[name].js] diff --git a/docs/api/zh/loaders/Loader.html b/docs/api/zh/loaders/Loader.html index 3abb1c6a91d635..3aa0eb57c35888 100644 --- a/docs/api/zh/loaders/Loader.html +++ b/docs/api/zh/loaders/Loader.html @@ -8,12 +8,12 @@ -

[name]

+

加载器([name])

-

所有加载器的基类

+

用于实现加载器的基类。

-

构造方法

+

构造函数

[name]( [param:LoadingManager manager] )

diff --git a/docs/api/zh/materials/Material.html b/docs/api/zh/materials/Material.html index f2ccee091c5cb9..4db830a1f5ed75 100644 --- a/docs/api/zh/materials/Material.html +++ b/docs/api/zh/materials/Material.html @@ -232,6 +232,11 @@

[property:Integer side]

默认为[page:Materials THREE.FrontSide]。其他选项有[page:Materials THREE.BackSide]和[page:Materials THREE.DoubleSide]。

+

[property:Boolean toneMapped]

+

+Defines whether this material is tone mapped according to the renderer's [page:WebGLRenderer.toneMapping toneMapping] setting. Default is *true*. +

+

[property:Boolean transparent]

定义此材质是否透明。这对渲染有影响,因为透明对象需要特殊处理,并在非透明对象之后渲染。 From 96c59d5db27fd8ba6702f181c2cb19686e3e02fd Mon Sep 17 00:00:00 2001 From: yomboprime Date: Thu, 29 Aug 2019 18:44:02 +0200 Subject: [PATCH 19/75] LightningStrike: Make plasma sphere use physical transparency --- examples/webgl_lightningstrike.html | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/examples/webgl_lightningstrike.html b/examples/webgl_lightningstrike.html index d48cf6247dfe69..7d0fb728c680df 100644 --- a/examples/webgl_lightningstrike.html +++ b/examples/webgl_lightningstrike.html @@ -422,12 +422,11 @@ var sphereMaterial = new THREE.MeshPhysicalMaterial( { transparent: true, + transparency: .96, depthWrite: false, - opacity: 0.15, - color: 0, - metalness: 1, + color: 'white', + metalness: 0, roughness: 0, - reflectivity: 0, envMap: textureCube } ); From 920ce423cd93f04017480a914ab6cfcb646d7f90 Mon Sep 17 00:00:00 2001 From: Samuel Date: Fri, 30 Aug 2019 14:41:04 +0800 Subject: [PATCH 20/75] Fix depthTexture types in WebGLRenderTarget.d.ts Added depthTexture argument to WebGLRenderTargetOptions and changed depthTexture property on WebGLRenderTarget to be of DepthTexture type instead of Texture type. --- src/renderers/WebGLRenderTarget.d.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/renderers/WebGLRenderTarget.d.ts b/src/renderers/WebGLRenderTarget.d.ts index 1a4ef3c4ff764b..754483c6bc0768 100644 --- a/src/renderers/WebGLRenderTarget.d.ts +++ b/src/renderers/WebGLRenderTarget.d.ts @@ -1,5 +1,6 @@ import { Vector4 } from './../math/Vector4'; import { Texture } from './../textures/Texture'; +import { DepthTexture } from './../textures/DepthTexture'; import { EventDispatcher } from './../core/EventDispatcher'; import { Wrapping, TextureFilter, TextureDataType } from '../constants'; @@ -14,6 +15,7 @@ export interface WebGLRenderTargetOptions { depthBuffer?: boolean; // true; stencilBuffer?: boolean; // true; generateMipmaps?: boolean; // true; + depthTexture?: DepthTexture; } export class WebGLRenderTarget extends EventDispatcher { @@ -33,7 +35,7 @@ export class WebGLRenderTarget extends EventDispatcher { texture: Texture; depthBuffer: boolean; stencilBuffer: boolean; - depthTexture: Texture; + depthTexture: DepthTexture; /** * @deprecated Use {@link Texture#wrapS texture.wrapS} instead. */ From 27c24e861733bcbbc088e4f1e58316b286cc6bd5 Mon Sep 17 00:00:00 2001 From: gogoend Date: Fri, 30 Aug 2019 19:35:08 +0800 Subject: [PATCH 21/75] zh docs: Sync the zh docs to the latest en doc. --- docs/api/zh/constants/Renderer.html | 4 +++- docs/api/zh/core/Layers.html | 10 ++++++++++ docs/api/zh/lights/shadows/LightShadow.html | 6 ++++++ docs/api/zh/renderers/WebGLRenderer.html | 2 +- 4 files changed, 20 insertions(+), 2 deletions(-) diff --git a/docs/api/zh/constants/Renderer.html b/docs/api/zh/constants/Renderer.html index cec1e30fa14da1..e8e3ce103d9d85 100644 --- a/docs/api/zh/constants/Renderer.html +++ b/docs/api/zh/constants/Renderer.html @@ -39,13 +39,15 @@

阴影类型

THREE.BasicShadowMap THREE.PCFShadowMap THREE.PCFSoftShadowMap + THREE.VSMShadowMap

这些常量定义了WebGLRenderer中[page:WebGLRenderer.shadowMap.type shadowMap.type]的属性。

[page:constant BasicShadowMap] 能够给出没有经过过滤的阴影映射 —— 速度最快,但质量最差。
[page:constant PCFShadowMap] 为默认值,使用Percentage-Closer Filtering (PCF)算法来过滤阴影映射。
- [page:constant PCFSoftShadowMap] 使用Percentage-Closer Soft Shadows (PCSS) 算法来过滤阴影映射。 + [page:constant PCFSoftShadowMap] 使用Percentage-Closer Soft Shadows (PCSS) 算法来过滤阴影映射。
+ [page:constant VSMShadowMap] filters shadow maps using the Variance Shadow Map (VSM) algorithm.

色调映射

diff --git a/docs/api/zh/core/Layers.html b/docs/api/zh/core/Layers.html index c28dc2e391c225..5a95835bc4f1df 100644 --- a/docs/api/zh/core/Layers.html +++ b/docs/api/zh/core/Layers.html @@ -75,6 +75,16 @@

[method:null toggle]( [param:Integer layer] )

根据参数切换对象所属图层。

+

[method:null enableAll]()

+

+ Add membership to all layers. +

+ +

[method:null disableAll]()

+

+ Remove membership from all layers. +

+

源代码

diff --git a/docs/api/zh/lights/shadows/LightShadow.html b/docs/api/zh/lights/shadows/LightShadow.html index 03cb2a9bce7584..57d18b2b5a7bc8 100644 --- a/docs/api/zh/lights/shadows/LightShadow.html +++ b/docs/api/zh/lights/shadows/LightShadow.html @@ -43,6 +43,12 @@

[property:WebGLRenderTarget map]

使用内置摄像头生成的深度图;超出像素深度的位置在阴影中。在渲染期间内部计算。

+

[property:WebGLRenderTarget mapPass]

+

+ The distribution map generated using the internal camera; an occlusion is calculated based + on the distribution of depths. Computed internally during rendering. +

+

[property:Vector2 mapSize]

一个[Page:Vector2]定义阴影贴图的宽度和高度。

diff --git a/docs/api/zh/renderers/WebGLRenderer.html b/docs/api/zh/renderers/WebGLRenderer.html index 8f6fd0adda648b..d2f9b026c38933 100644 --- a/docs/api/zh/renderers/WebGLRenderer.html +++ b/docs/api/zh/renderers/WebGLRenderer.html @@ -227,7 +227,7 @@

[property:Boolean shadowMap.needsUpdate]

[property:Integer shadowMap.type]

定义阴影贴图类型 (未过滤, 关闭部分过滤, 关闭部分双线性过滤)

-

可选值有THREE.BasicShadowMap, THREE.PCFShadowMap (默认)和 THREE.PCFSoftShadowMap。 详见[page:Renderer Renderer constants]

+

可选值有THREE.BasicShadowMap, THREE.PCFShadowMap (默认), THREE.PCFSoftShadowMap 和 THREE.VSMShadowMap。详见[page:Renderer Renderer constants]

[property:Boolean sortObjects]

From 8692fd44a2450a87c4c0c4c56178e1a2222d5780 Mon Sep 17 00:00:00 2001 From: gogoend Date: Fri, 30 Aug 2019 20:48:47 +0800 Subject: [PATCH 22/75] zh doc: fix for the wrong tab in list.js --- docs/list.js | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/docs/list.js b/docs/list.js index 53f7eefa37c706..2ad7e1a71e2e7d 100644 --- a/docs/list.js +++ b/docs/list.js @@ -802,9 +802,9 @@ var list = { "加载器": { "BabylonLoader": "examples/zh/loaders/BabylonLoader", - "BasisTextureLoader": "examples/zh/loaders/BasisTextureLoader", - "DRACOLoader": "examples/zh/loaders/DRACOLoader", - "GLTFLoader": "examples/zh/loaders/GLTFLoader", + "BasisTextureLoader": "examples/zh/loaders/BasisTextureLoader", + "DRACOLoader": "examples/zh/loaders/DRACOLoader", + "GLTFLoader": "examples/zh/loaders/GLTFLoader", "MMDLoader": "examples/zh/loaders/MMDLoader", "MTLLoader": "examples/zh/loaders/MTLLoader", "OBJLoader": "examples/zh/loaders/OBJLoader", @@ -828,8 +828,8 @@ var list = { "导出器": { "GLTFExporter": "examples/zh/exporters/GLTFExporter", "PLYExporter": "examples/zh/exporters/PLYExporter", - "ColladaExporter": "examples/zh/exporters/ColladaExporter" - }, + "ColladaExporter": "examples/zh/exporters/ColladaExporter" + }, "插件": { "LookupTable": "examples/zh/Lut", @@ -847,13 +847,12 @@ var list = { "CSS2DRenderer": "examples/zh/renderers/CSS2DRenderer", "CSS3DRenderer": "examples/zh/renderers/CSS3DRenderer", "SVGRenderer": "examples/zh/renderers/SVGRenderer" - }, "实用工具": { "BufferGeometryUtils": "examples/zh/utils/BufferGeometryUtils", - "SceneUtils": "examples/zh/utils/SceneUtils", - "SkeletonUtils": "examples/zh/utils/SkeletonUtils" + "SceneUtils": "examples/zh/utils/SceneUtils", + "SkeletonUtils": "examples/zh/utils/SkeletonUtils" } }, From d8a1530132fa3d5075be217e1e0d0de569e059db Mon Sep 17 00:00:00 2001 From: "Mr.doob" Date: Fri, 30 Aug 2019 17:51:49 -0700 Subject: [PATCH 23/75] r109dev --- src/constants.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/constants.js b/src/constants.js index faddeb0c79e346..e8ae3baa98f8c6 100644 --- a/src/constants.js +++ b/src/constants.js @@ -1,4 +1,4 @@ -export var REVISION = '108'; +export var REVISION = '109dev'; export var MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 }; export var TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 }; export var CullFaceNone = 0; From a0caac6580c56b359a9ff891b4cb2b67af6c7bcb Mon Sep 17 00:00:00 2001 From: "Mr.doob" Date: Fri, 30 Aug 2019 17:52:05 -0700 Subject: [PATCH 24/75] Updated builds. --- build/three.js | 4 ++-- build/three.min.js | 4 ++-- build/three.module.js | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/build/three.js b/build/three.js index 00aeed275c9f4c..e1b720e8d5a086 100644 --- a/build/three.js +++ b/build/three.js @@ -181,7 +181,7 @@ } ); - var REVISION = '108'; + var REVISION = '109dev'; var MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 }; var TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 }; var CullFaceNone = 0; @@ -14086,7 +14086,7 @@ var lights_physical_fragment = "PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 );\n#ifdef REFLECTIVITY\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#endif\n#ifdef CLEARCOAT\n\tmaterial.clearcoat = saturate( clearcoat );\tmaterial.clearcoatRoughness = clamp( clearcoatRoughness, 0.04, 1.0 );\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheen;\n#endif"; - var lights_physical_pars_fragment = "struct PhysicalMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n#ifdef CLEARCOAT\n\tfloat clearcoat;\n\tfloat clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tvec3 sheenColor;\n#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearcoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.specularRoughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNL = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = ccDotNL * directLight.color;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tccIrradiance *= PI;\n\t\t#endif\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t\treflectedLight.directSpecular += ccIrradiance * material.clearcoat * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_Sheen(\n\t\t\tmaterial.specularRoughness,\n\t\t\tdirectLight.direction,\n\t\t\tgeometry,\n\t\t\tmaterial.sheenColor\n\t\t);\n\t#else\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.normal, material.specularColor, material.specularRoughness);\n\t#endif\n\treflectedLight.directDiffuse += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNV = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular += clearcoatRadiance * material.clearcoat * BRDF_Specular_GGX_Environment( geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t\tfloat ccDotNL = ccDotNV;\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\tfloat clearcoatInv = 1.0 - clearcoatDHR;\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\tBRDF_Specular_Multiscattering_Environment( geometry, material.specularColor, material.specularRoughness, singleScattering, multiScattering );\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\n\treflectedLight.indirectSpecular += clearcoatInv * radiance * singleScattering;\n\treflectedLight.indirectDiffuse += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}"; + var lights_physical_pars_fragment = "struct PhysicalMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n#ifdef CLEARCOAT\n\tfloat clearcoat;\n\tfloat clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tvec3 sheenColor;\n#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearcoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.specularRoughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNL = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = ccDotNL * directLight.color;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tccIrradiance *= PI;\n\t\t#endif\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t\treflectedLight.directSpecular += ccIrradiance * material.clearcoat * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_Sheen(\n\t\t\tmaterial.specularRoughness,\n\t\t\tdirectLight.direction,\n\t\t\tgeometry,\n\t\t\tmaterial.sheenColor\n\t\t);\n\t#else\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.normal, material.specularColor, material.specularRoughness);\n\t#endif\n\treflectedLight.directDiffuse += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNV = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular += clearcoatRadiance * material.clearcoat * BRDF_Specular_GGX_Environment( geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t\tfloat ccDotNL = ccDotNV;\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\tfloat clearcoatInv = 1.0 - clearcoatDHR;\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\tBRDF_Specular_Multiscattering_Environment( geometry, material.specularColor, material.specularRoughness, singleScattering, multiScattering );\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\n\treflectedLight.indirectSpecular += clearcoatInv * radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}"; var lights_fragment_begin = "\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = normalize( vViewPosition );\n#ifdef CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tdirectLight.color *= all( bvec2( pointLight.shadow, directLight.visible ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tdirectLight.color *= all( bvec2( spotLight.shadow, directLight.visible ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectLight.color *= all( bvec2( directionalLight.shadow, directLight.visible ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif"; diff --git a/build/three.min.js b/build/three.min.js index af2a3848a12964..70af345405f62c 100644 --- a/build/three.min.js +++ b/build/three.min.js @@ -592,7 +592,7 @@ lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tun lights_pars_begin:"uniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in GeometricContext geometry ) {\n\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t\tfloat shadowCameraNear;\n\t\tfloat shadowCameraFar;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tdirectLight.color = pointLight.color;\n\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\tdirectLight.visible = ( directLight.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( angleCos > spotLight.coneCos ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif", lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifdef TOON\n\t\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\t#else\n\t\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\t\tvec3 irradiance = dotNL * directLight.color;\n\t#endif\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)", lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 );\n#ifdef REFLECTIVITY\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#endif\n#ifdef CLEARCOAT\n\tmaterial.clearcoat = saturate( clearcoat );\tmaterial.clearcoatRoughness = clamp( clearcoatRoughness, 0.04, 1.0 );\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheen;\n#endif", -lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n#ifdef CLEARCOAT\n\tfloat clearcoat;\n\tfloat clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tvec3 sheenColor;\n#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearcoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.specularRoughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNL = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = ccDotNL * directLight.color;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tccIrradiance *= PI;\n\t\t#endif\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t\treflectedLight.directSpecular += ccIrradiance * material.clearcoat * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_Sheen(\n\t\t\tmaterial.specularRoughness,\n\t\t\tdirectLight.direction,\n\t\t\tgeometry,\n\t\t\tmaterial.sheenColor\n\t\t);\n\t#else\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.normal, material.specularColor, material.specularRoughness);\n\t#endif\n\treflectedLight.directDiffuse += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNV = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular += clearcoatRadiance * material.clearcoat * BRDF_Specular_GGX_Environment( geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t\tfloat ccDotNL = ccDotNV;\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\tfloat clearcoatInv = 1.0 - clearcoatDHR;\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\tBRDF_Specular_Multiscattering_Environment( geometry, material.specularColor, material.specularRoughness, singleScattering, multiScattering );\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\n\treflectedLight.indirectSpecular += clearcoatInv * radiance * singleScattering;\n\treflectedLight.indirectDiffuse += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}", +lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n#ifdef CLEARCOAT\n\tfloat clearcoat;\n\tfloat clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tvec3 sheenColor;\n#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearcoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.specularRoughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNL = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = ccDotNL * directLight.color;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tccIrradiance *= PI;\n\t\t#endif\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t\treflectedLight.directSpecular += ccIrradiance * material.clearcoat * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_Sheen(\n\t\t\tmaterial.specularRoughness,\n\t\t\tdirectLight.direction,\n\t\t\tgeometry,\n\t\t\tmaterial.sheenColor\n\t\t);\n\t#else\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.normal, material.specularColor, material.specularRoughness);\n\t#endif\n\treflectedLight.directDiffuse += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNV = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular += clearcoatRadiance * material.clearcoat * BRDF_Specular_GGX_Environment( geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t\tfloat ccDotNL = ccDotNV;\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\tfloat clearcoatInv = 1.0 - clearcoatDHR;\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\tBRDF_Specular_Multiscattering_Environment( geometry, material.specularColor, material.specularRoughness, singleScattering, multiScattering );\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\n\treflectedLight.indirectSpecular += clearcoatInv * radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}", lights_fragment_begin:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = normalize( vViewPosition );\n#ifdef CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tdirectLight.color *= all( bvec2( pointLight.shadow, directLight.visible ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tdirectLight.color *= all( bvec2( spotLight.shadow, directLight.visible ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectLight.color *= all( bvec2( directionalLight.shadow, directLight.visible ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif", lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec3 lightMapIrradiance = texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getLightProbeIndirectIrradiance( geometry, maxMipLevel );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.normal, material.specularRoughness, maxMipLevel );\n\t#ifdef CLEARCOAT\n\t\tclearcoatRadiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness, maxMipLevel );\n\t#endif\n#endif", lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n#endif", @@ -984,7 +984,7 @@ return a};k.MeshLambertMaterial=mc;k.MeshMatcapMaterial=nc;k.MeshNormalMaterial= 1003;k.NearestMipMapLinearFilter=1005;k.NearestMipMapNearestFilter=1004;k.NearestMipmapLinearFilter=1005;k.NearestMipmapNearestFilter=1004;k.NeverDepth=0;k.NeverStencilFunc=512;k.NoBlending=0;k.NoColors=0;k.NoToneMapping=0;k.NormalBlending=1;k.NotEqualDepth=7;k.NotEqualStencilFunc=517;k.NumberKeyframeTrack=$c;k.Object3D=B;k.ObjectLoader=jf;k.ObjectSpaceNormalMap=1;k.OctahedronBufferGeometry=bc;k.OctahedronGeometry=Td;k.OneFactor=201;k.OneMinusDstAlphaFactor=207;k.OneMinusDstColorFactor=209;k.OneMinusSrcAlphaFactor= 205;k.OneMinusSrcColorFactor=203;k.OrthographicCamera=ne;k.PCFShadowMap=1;k.PCFSoftShadowMap=2;k.ParametricBufferGeometry=Nc;k.ParametricGeometry=Qd;k.Particle=function(a){console.warn("THREE.Particle has been renamed to THREE.Sprite.");return new Kd(a)};k.ParticleBasicMaterial=function(a){console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial.");return new Qa(a)};k.ParticleSystem=function(a,b){console.warn("THREE.ParticleSystem has been renamed to THREE.Points.");return new Kc(a, b)};k.ParticleSystemMaterial=function(a){console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial.");return new Qa(a)};k.Path=Wa;k.PerspectiveCamera=la;k.Plane=cb;k.PlaneBufferGeometry=$b;k.PlaneGeometry=Fd;k.PlaneHelper=te;k.PointCloud=function(a,b){console.warn("THREE.PointCloud has been renamed to THREE.Points.");return new Kc(a,b)};k.PointCloudMaterial=function(a){console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial.");return new Qa(a)};k.PointLight= -$e;k.PointLightHelper=gd;k.Points=Kc;k.PointsMaterial=Qa;k.PolarGridHelper=of;k.PolyhedronBufferGeometry=pa;k.PolyhedronGeometry=Rd;k.PositionalAudio=yg;k.PositionalAudioHelper=kd;k.PropertyBinding=ma;k.PropertyMixer=Ag;k.QuadraticBezierCurve=Ua;k.QuadraticBezierCurve3=hb;k.Quaternion=na;k.QuaternionKeyframeTrack=ke;k.QuaternionLinearInterpolant=Se;k.REVISION="108";k.RGBADepthPacking=3201;k.RGBAFormat=1023;k.RGBA_ASTC_10x10_Format=37819;k.RGBA_ASTC_10x5_Format=37816;k.RGBA_ASTC_10x6_Format=37817; +$e;k.PointLightHelper=gd;k.Points=Kc;k.PointsMaterial=Qa;k.PolarGridHelper=of;k.PolyhedronBufferGeometry=pa;k.PolyhedronGeometry=Rd;k.PositionalAudio=yg;k.PositionalAudioHelper=kd;k.PropertyBinding=ma;k.PropertyMixer=Ag;k.QuadraticBezierCurve=Ua;k.QuadraticBezierCurve3=hb;k.Quaternion=na;k.QuaternionKeyframeTrack=ke;k.QuaternionLinearInterpolant=Se;k.REVISION="109dev";k.RGBADepthPacking=3201;k.RGBAFormat=1023;k.RGBA_ASTC_10x10_Format=37819;k.RGBA_ASTC_10x5_Format=37816;k.RGBA_ASTC_10x6_Format=37817; k.RGBA_ASTC_10x8_Format=37818;k.RGBA_ASTC_12x10_Format=37820;k.RGBA_ASTC_12x12_Format=37821;k.RGBA_ASTC_4x4_Format=37808;k.RGBA_ASTC_5x4_Format=37809;k.RGBA_ASTC_5x5_Format=37810;k.RGBA_ASTC_6x5_Format=37811;k.RGBA_ASTC_6x6_Format=37812;k.RGBA_ASTC_8x5_Format=37813;k.RGBA_ASTC_8x6_Format=37814;k.RGBA_ASTC_8x8_Format=37815;k.RGBA_PVRTC_2BPPV1_Format=35843;k.RGBA_PVRTC_4BPPV1_Format=35842;k.RGBA_S3TC_DXT1_Format=33777;k.RGBA_S3TC_DXT3_Format=33778;k.RGBA_S3TC_DXT5_Format=33779;k.RGBDEncoding=3006;k.RGBEEncoding= 3002;k.RGBEFormat=1023;k.RGBFormat=1022;k.RGBM16Encoding=3005;k.RGBM7Encoding=3004;k.RGB_ETC1_Format=36196;k.RGB_PVRTC_2BPPV1_Format=35841;k.RGB_PVRTC_4BPPV1_Format=35840;k.RGB_S3TC_DXT1_Format=33776;k.RawShaderMaterial=Zc;k.Ray=Sb;k.Raycaster=Zh;k.RectAreaLight=df;k.RectAreaLightHelper=hd;k.RedFormat=1028;k.ReinhardToneMapping=2;k.RepeatWrapping=1E3;k.ReplaceStencilOp=7681;k.ReverseSubtractEquation=102;k.RingBufferGeometry=Vc;k.RingGeometry=ee;k.Scene=wd;k.SceneUtils={createMultiMaterialObject:function(){console.error("THREE.SceneUtils has been moved to /examples/js/utils/SceneUtils.js")}, detach:function(){console.error("THREE.SceneUtils has been moved to /examples/js/utils/SceneUtils.js")},attach:function(){console.error("THREE.SceneUtils has been moved to /examples/js/utils/SceneUtils.js")}};k.ShaderChunk=K;k.ShaderLib=db;k.ShaderMaterial=va;k.ShadowMaterial=ic;k.Shape=Jb;k.ShapeBufferGeometry=gc;k.ShapeGeometry=fc;k.ShapePath=qg;k.ShapeUtils=qb;k.ShortType=1011;k.Skeleton=Me;k.SkeletonHelper=fd;k.SkinnedMesh=Nd;k.SmoothShading=2;k.Sphere=nb;k.SphereBufferGeometry=Ib;k.SphereGeometry= diff --git a/build/three.module.js b/build/three.module.js index 9ebd9d0eaaa4f8..76c55dcf8dfa9c 100644 --- a/build/three.module.js +++ b/build/three.module.js @@ -175,7 +175,7 @@ Object.assign( EventDispatcher.prototype, { } ); -var REVISION = '108'; +var REVISION = '109dev'; var MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 }; var TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 }; var CullFaceNone = 0; @@ -14080,7 +14080,7 @@ var lights_phong_pars_fragment = "varying vec3 vViewPosition;\n#ifndef FLAT_SHAD var lights_physical_fragment = "PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 );\n#ifdef REFLECTIVITY\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#endif\n#ifdef CLEARCOAT\n\tmaterial.clearcoat = saturate( clearcoat );\tmaterial.clearcoatRoughness = clamp( clearcoatRoughness, 0.04, 1.0 );\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheen;\n#endif"; -var lights_physical_pars_fragment = "struct PhysicalMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n#ifdef CLEARCOAT\n\tfloat clearcoat;\n\tfloat clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tvec3 sheenColor;\n#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearcoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.specularRoughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNL = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = ccDotNL * directLight.color;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tccIrradiance *= PI;\n\t\t#endif\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t\treflectedLight.directSpecular += ccIrradiance * material.clearcoat * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_Sheen(\n\t\t\tmaterial.specularRoughness,\n\t\t\tdirectLight.direction,\n\t\t\tgeometry,\n\t\t\tmaterial.sheenColor\n\t\t);\n\t#else\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.normal, material.specularColor, material.specularRoughness);\n\t#endif\n\treflectedLight.directDiffuse += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNV = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular += clearcoatRadiance * material.clearcoat * BRDF_Specular_GGX_Environment( geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t\tfloat ccDotNL = ccDotNV;\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\tfloat clearcoatInv = 1.0 - clearcoatDHR;\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\tBRDF_Specular_Multiscattering_Environment( geometry, material.specularColor, material.specularRoughness, singleScattering, multiScattering );\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\n\treflectedLight.indirectSpecular += clearcoatInv * radiance * singleScattering;\n\treflectedLight.indirectDiffuse += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}"; +var lights_physical_pars_fragment = "struct PhysicalMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n#ifdef CLEARCOAT\n\tfloat clearcoat;\n\tfloat clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tvec3 sheenColor;\n#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearcoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.specularRoughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNL = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = ccDotNL * directLight.color;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tccIrradiance *= PI;\n\t\t#endif\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t\treflectedLight.directSpecular += ccIrradiance * material.clearcoat * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_Sheen(\n\t\t\tmaterial.specularRoughness,\n\t\t\tdirectLight.direction,\n\t\t\tgeometry,\n\t\t\tmaterial.sheenColor\n\t\t);\n\t#else\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.normal, material.specularColor, material.specularRoughness);\n\t#endif\n\treflectedLight.directDiffuse += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNV = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular += clearcoatRadiance * material.clearcoat * BRDF_Specular_GGX_Environment( geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t\tfloat ccDotNL = ccDotNV;\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\tfloat clearcoatInv = 1.0 - clearcoatDHR;\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\tBRDF_Specular_Multiscattering_Environment( geometry, material.specularColor, material.specularRoughness, singleScattering, multiScattering );\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\n\treflectedLight.indirectSpecular += clearcoatInv * radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}"; var lights_fragment_begin = "\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = normalize( vViewPosition );\n#ifdef CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tdirectLight.color *= all( bvec2( pointLight.shadow, directLight.visible ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tdirectLight.color *= all( bvec2( spotLight.shadow, directLight.visible ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectLight.color *= all( bvec2( directionalLight.shadow, directLight.visible ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif"; From 857e491c5aa84c64a71d88847ba85c4fd98c3a81 Mon Sep 17 00:00:00 2001 From: Mugen87 Date: Sat, 31 Aug 2019 16:28:00 +0200 Subject: [PATCH 25/75] Examples: Inherit loaders from Loader II. --- docs/examples/en/loaders/OBJLoader.html | 9 +++------ docs/examples/en/loaders/PCDLoader.html | 11 +++-------- docs/examples/en/loaders/PDBLoader.html | 12 +++--------- docs/examples/en/loaders/PRWMLoader.html | 18 +++--------------- docs/examples/en/loaders/SVGLoader.html | 12 +++--------- docs/examples/zh/loaders/OBJLoader.html | 9 +++------ docs/examples/zh/loaders/PCDLoader.html | 11 +++-------- docs/examples/zh/loaders/PDBLoader.html | 12 +++--------- docs/examples/zh/loaders/PRWMLoader.html | 18 +++--------------- docs/examples/zh/loaders/SVGLoader.html | 12 +++--------- docs/list.js | 8 ++++---- examples/js/loaders/MD2Loader.js | 13 +++---------- examples/js/loaders/OBJLoader.js | 14 +++----------- examples/js/loaders/PCDLoader.js | 14 ++++---------- examples/js/loaders/PDBLoader.js | 13 +++---------- examples/js/loaders/PRWMLoader.js | 15 ++++----------- examples/js/loaders/SVGLoader.js | 13 +++---------- examples/js/loaders/VTKLoader.js | 13 ++++--------- examples/jsm/loaders/MD2Loader.js | 15 ++++----------- examples/jsm/loaders/OBJLoader.js | 16 ++++------------ examples/jsm/loaders/PCDLoader.js | 16 +++++----------- examples/jsm/loaders/PDBLoader.js | 17 +++++------------ examples/jsm/loaders/PRWMLoader.js | 17 +++++------------ examples/jsm/loaders/SVGLoader.js | 15 ++++----------- examples/jsm/loaders/TDSLoader.js | 2 +- examples/jsm/loaders/VTKLoader.js | 16 +++++----------- 26 files changed, 91 insertions(+), 250 deletions(-) diff --git a/docs/examples/en/loaders/OBJLoader.html b/docs/examples/en/loaders/OBJLoader.html index 9deeb616b49b18..28ec22bda53e1b 100644 --- a/docs/examples/en/loaders/OBJLoader.html +++ b/docs/examples/en/loaders/OBJLoader.html @@ -8,6 +8,7 @@ + [page:Loader] →

[name]

@@ -64,9 +65,10 @@

[name]( [param:LoadingManager manager] )

Properties

- +

See the base [page:Loader] class for common properties.

Methods

+

See the base [page:Loader] class for common methods.

[method:null load]( [param:String url], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )

@@ -97,11 +99,6 @@

[method:OBJLoader setMaterials]( [param:MTLLoader.MaterialCreator materials] Sets materials loaded by MTLLoader or any other supplier of a [page:MTLLoaderMaterialCreator MTLLoader.MaterialCreator].

-

[method:OBJLoader setPath]( [param:String path] )

-

- Sets the base path or URL from which to load files. This can be useful to avoid repetition if you are calling [page:OBJLoader.load .load] multiple times on the same directory. -

-

Source

diff --git a/docs/examples/en/loaders/PCDLoader.html b/docs/examples/en/loaders/PCDLoader.html index cd8d62843727cd..469cb13da16a23 100644 --- a/docs/examples/en/loaders/PCDLoader.html +++ b/docs/examples/en/loaders/PCDLoader.html @@ -8,6 +8,7 @@ + [page:Loader] →

[name]

@@ -62,6 +63,7 @@

[name]( [param:LoadingManager manager] )

Properties

+

See the base [page:Loader] class for common properties.

[page:Boolean littleEndian]

@@ -69,6 +71,7 @@

[page:Boolean littleEndian]

Methods

+

See the base [page:Loader] class for common methods.

[method:null load]( [param:String url], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )

@@ -93,14 +96,6 @@

[method:Object3D parse]( [param:Arraybuffer data],[param:String url] )

The object is converted to [page:Points] with a [page:BufferGeometry] and a [page:PointsMaterial].

-

[method:PCDLoader setPath]( [param:String path] )

-

- [page:String path] — Base path. -

-

- Set the base path for the file. -

-

Source

diff --git a/docs/examples/en/loaders/PDBLoader.html b/docs/examples/en/loaders/PDBLoader.html index fd6556e63b76cc..46bd0cf7ca0203 100644 --- a/docs/examples/en/loaders/PDBLoader.html +++ b/docs/examples/en/loaders/PDBLoader.html @@ -8,6 +8,7 @@ + [page:Loader] →

[name]

@@ -64,9 +65,10 @@

[name]( [param:LoadingManager manager] )

Properties

- +

See the base [page:Loader] class for common properties.

Methods

+

See the base [page:Loader] class for common methods.

[method:null load]( [param:String url], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )

@@ -87,14 +89,6 @@

[method:Object parse]( [param:String text] )

Parse a pdb text and return a JSON structure.

-

[method:PDBLoader setPath]( [param:String path] )

-

- [page:String path] — Base path. -

-

- Set the base path for the file. -

-

Source

diff --git a/docs/examples/en/loaders/PRWMLoader.html b/docs/examples/en/loaders/PRWMLoader.html index 545b77bdf0610c..4e58a4b5d9ea82 100644 --- a/docs/examples/en/loaders/PRWMLoader.html +++ b/docs/examples/en/loaders/PRWMLoader.html @@ -8,6 +8,7 @@ + [page:Loader] →

[name]

@@ -65,9 +66,10 @@

[name]( [param:LoadingManager manager] )

Properties

- +

See the base [page:Loader] class for common properties.

Methods

+

See the base [page:Loader] class for common methods.

[method:null load]( [param:String url], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )

@@ -94,25 +96,11 @@

PRWMLoader.isBigEndianPlatform( )

Return true if the endianness of the platform is Big Endian, false otherwise.

-

[method:PRWMLoader setPath]( [param:String path] )

-

- [page:String path] — Base path. -

-

- Set the base path for the file. -

-

Source

[link:https://github.com/mrdoob/three.js/blob/master/examples/js/loaders/PRWMLoader.js examples/js/loaders/PRWMLoader.js]

-

Additional notes

- -

- This loader is additionally available on npm as three-prwm-loader. -

- diff --git a/docs/examples/en/loaders/SVGLoader.html b/docs/examples/en/loaders/SVGLoader.html index 18e88a789dee49..55148bdaf1894c 100644 --- a/docs/examples/en/loaders/SVGLoader.html +++ b/docs/examples/en/loaders/SVGLoader.html @@ -8,6 +8,7 @@ + [page:Loader] →

[name]

@@ -85,9 +86,10 @@

[name]( [param:LoadingManager manager] )

Properties

- +

See the base [page:Loader] class for common properties.

Methods

+

See the base [page:Loader] class for common methods.

[method:null load]( [param:String url], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )

@@ -100,14 +102,6 @@

[method:null load]( [param:String url], [param:Function onLoad], [param:Func Begin loading from url and call onLoad with the response content.

-

[method:SVGLoader setPath]( [param:String path] )

-

- [page:String path] — Base path. -

-

- Set the base path for the file. -

-

Source

diff --git a/docs/examples/zh/loaders/OBJLoader.html b/docs/examples/zh/loaders/OBJLoader.html index 9deeb616b49b18..28ec22bda53e1b 100644 --- a/docs/examples/zh/loaders/OBJLoader.html +++ b/docs/examples/zh/loaders/OBJLoader.html @@ -8,6 +8,7 @@ + [page:Loader] →

[name]

@@ -64,9 +65,10 @@

[name]( [param:LoadingManager manager] )

Properties

- +

See the base [page:Loader] class for common properties.

Methods

+

See the base [page:Loader] class for common methods.

[method:null load]( [param:String url], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )

@@ -97,11 +99,6 @@

[method:OBJLoader setMaterials]( [param:MTLLoader.MaterialCreator materials] Sets materials loaded by MTLLoader or any other supplier of a [page:MTLLoaderMaterialCreator MTLLoader.MaterialCreator].

-

[method:OBJLoader setPath]( [param:String path] )

-

- Sets the base path or URL from which to load files. This can be useful to avoid repetition if you are calling [page:OBJLoader.load .load] multiple times on the same directory. -

-

Source

diff --git a/docs/examples/zh/loaders/PCDLoader.html b/docs/examples/zh/loaders/PCDLoader.html index cd8d62843727cd..469cb13da16a23 100644 --- a/docs/examples/zh/loaders/PCDLoader.html +++ b/docs/examples/zh/loaders/PCDLoader.html @@ -8,6 +8,7 @@ + [page:Loader] →

[name]

@@ -62,6 +63,7 @@

[name]( [param:LoadingManager manager] )

Properties

+

See the base [page:Loader] class for common properties.

[page:Boolean littleEndian]

@@ -69,6 +71,7 @@

[page:Boolean littleEndian]

Methods

+

See the base [page:Loader] class for common methods.

[method:null load]( [param:String url], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )

@@ -93,14 +96,6 @@

[method:Object3D parse]( [param:Arraybuffer data],[param:String url] )

The object is converted to [page:Points] with a [page:BufferGeometry] and a [page:PointsMaterial].

-

[method:PCDLoader setPath]( [param:String path] )

-

- [page:String path] — Base path. -

-

- Set the base path for the file. -

-

Source

diff --git a/docs/examples/zh/loaders/PDBLoader.html b/docs/examples/zh/loaders/PDBLoader.html index fd6556e63b76cc..46bd0cf7ca0203 100644 --- a/docs/examples/zh/loaders/PDBLoader.html +++ b/docs/examples/zh/loaders/PDBLoader.html @@ -8,6 +8,7 @@ + [page:Loader] →

[name]

@@ -64,9 +65,10 @@

[name]( [param:LoadingManager manager] )

Properties

- +

See the base [page:Loader] class for common properties.

Methods

+

See the base [page:Loader] class for common methods.

[method:null load]( [param:String url], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )

@@ -87,14 +89,6 @@

[method:Object parse]( [param:String text] )

Parse a pdb text and return a JSON structure.

-

[method:PDBLoader setPath]( [param:String path] )

-

- [page:String path] — Base path. -

-

- Set the base path for the file. -

-

Source

diff --git a/docs/examples/zh/loaders/PRWMLoader.html b/docs/examples/zh/loaders/PRWMLoader.html index 545b77bdf0610c..4e58a4b5d9ea82 100644 --- a/docs/examples/zh/loaders/PRWMLoader.html +++ b/docs/examples/zh/loaders/PRWMLoader.html @@ -8,6 +8,7 @@ + [page:Loader] →

[name]

@@ -65,9 +66,10 @@

[name]( [param:LoadingManager manager] )

Properties

- +

See the base [page:Loader] class for common properties.

Methods

+

See the base [page:Loader] class for common methods.

[method:null load]( [param:String url], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )

@@ -94,25 +96,11 @@

PRWMLoader.isBigEndianPlatform( )

Return true if the endianness of the platform is Big Endian, false otherwise.

-

[method:PRWMLoader setPath]( [param:String path] )

-

- [page:String path] — Base path. -

-

- Set the base path for the file. -

-

Source

[link:https://github.com/mrdoob/three.js/blob/master/examples/js/loaders/PRWMLoader.js examples/js/loaders/PRWMLoader.js]

-

Additional notes

- -

- This loader is additionally available on npm as three-prwm-loader. -

- diff --git a/docs/examples/zh/loaders/SVGLoader.html b/docs/examples/zh/loaders/SVGLoader.html index 18e88a789dee49..55148bdaf1894c 100644 --- a/docs/examples/zh/loaders/SVGLoader.html +++ b/docs/examples/zh/loaders/SVGLoader.html @@ -8,6 +8,7 @@ + [page:Loader] →

[name]

@@ -85,9 +86,10 @@

[name]( [param:LoadingManager manager] )

Properties

- +

See the base [page:Loader] class for common properties.

Methods

+

See the base [page:Loader] class for common methods.

[method:null load]( [param:String url], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )

@@ -100,14 +102,6 @@

[method:null load]( [param:String url], [param:Function onLoad], [param:Func Begin loading from url and call onLoad with the response content.

-

[method:SVGLoader setPath]( [param:String path] )

-

- [page:String path] — Base path. -

-

- Set the base path for the file. -

-

Source

diff --git a/docs/list.js b/docs/list.js index 2ad7e1a71e2e7d..fd191b0d7d7a4d 100644 --- a/docs/list.js +++ b/docs/list.js @@ -375,9 +375,9 @@ var list = { "LoaderSupport": "examples/en/loaders/LoaderSupport", "PCDLoader": "examples/en/loaders/PCDLoader", "PDBLoader": "examples/en/loaders/PDBLoader", + "PRWMLoader": "examples/en/loaders/PRWMLoader", "SVGLoader": "examples/en/loaders/SVGLoader", - "TGALoader": "examples/en/loaders/TGALoader", - "PRWMLoader": "examples/en/loaders/PRWMLoader" + "TGALoader": "examples/en/loaders/TGALoader" }, "Objects": { @@ -812,9 +812,9 @@ var list = { "LoaderSupport": "examples/zh/loaders/LoaderSupport", "PCDLoader": "examples/zh/loaders/PCDLoader", "PDBLoader": "examples/zh/loaders/PDBLoader", + "PRWMLoader": "examples/zh/loaders/PRWMLoader", "SVGLoader": "examples/zh/loaders/SVGLoader", - "TGALoader": "examples/zh/loaders/TGALoader", - "PRWMLoader": "examples/zh/loaders/PRWMLoader" + "TGALoader": "examples/zh/loaders/TGALoader" }, "物体": { diff --git a/examples/js/loaders/MD2Loader.js b/examples/js/loaders/MD2Loader.js index c8878c9f624864..fffa41933aeed3 100644 --- a/examples/js/loaders/MD2Loader.js +++ b/examples/js/loaders/MD2Loader.js @@ -4,11 +4,11 @@ THREE.MD2Loader = function ( manager ) { - this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager; + THREE.Loader.call( this, manager ); }; -THREE.MD2Loader.prototype = { +THREE.MD2Loader.prototype = Object.assign( Object.create( THREE.Loader.prototype ), { constructor: THREE.MD2Loader, @@ -27,13 +27,6 @@ THREE.MD2Loader.prototype = { }, - setPath: function ( value ) { - - this.path = value; - return this; - - }, - parse: ( function () { var normalData = [ @@ -384,4 +377,4 @@ THREE.MD2Loader.prototype = { } )() -}; +} ); diff --git a/examples/js/loaders/OBJLoader.js b/examples/js/loaders/OBJLoader.js index 8e2ae4c53b622d..2f4e039932b851 100644 --- a/examples/js/loaders/OBJLoader.js +++ b/examples/js/loaders/OBJLoader.js @@ -364,13 +364,13 @@ THREE.OBJLoader = ( function () { function OBJLoader( manager ) { - this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager; + THREE.Loader.call( this, manager ); this.materials = null; } - OBJLoader.prototype = { + OBJLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype ), { constructor: OBJLoader, @@ -388,14 +388,6 @@ THREE.OBJLoader = ( function () { }, - setPath: function ( value ) { - - this.path = value; - - return this; - - }, - setMaterials: function ( materials ) { this.materials = materials; @@ -790,7 +782,7 @@ THREE.OBJLoader = ( function () { } - }; + } ); return OBJLoader; diff --git a/examples/js/loaders/PCDLoader.js b/examples/js/loaders/PCDLoader.js index fe5e554acdaf5f..bccc6f85d90d74 100644 --- a/examples/js/loaders/PCDLoader.js +++ b/examples/js/loaders/PCDLoader.js @@ -10,13 +10,14 @@ THREE.PCDLoader = function ( manager ) { - this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager; + THREE.Loader.call( this, manager ); + this.littleEndian = true; }; -THREE.PCDLoader.prototype = { +THREE.PCDLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype ), { constructor: THREE.PCDLoader, @@ -51,13 +52,6 @@ THREE.PCDLoader.prototype = { }, - setPath: function ( value ) { - - this.path = value; - return this; - - }, - parse: function ( data, url ) { function parseHeader( data ) { @@ -305,4 +299,4 @@ THREE.PCDLoader.prototype = { } -}; +} ); diff --git a/examples/js/loaders/PDBLoader.js b/examples/js/loaders/PDBLoader.js index 3de2385acd991f..9b7f0cd4b07d5e 100644 --- a/examples/js/loaders/PDBLoader.js +++ b/examples/js/loaders/PDBLoader.js @@ -5,11 +5,11 @@ THREE.PDBLoader = function ( manager ) { - this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager; + THREE.Loader.call( this, manager ); }; -THREE.PDBLoader.prototype = { +THREE.PDBLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype ), { constructor: THREE.PDBLoader, @@ -27,13 +27,6 @@ THREE.PDBLoader.prototype = { }, - setPath: function ( value ) { - - this.path = value; - return this; - - }, - // Based on CanvasMol PDB parser parse: function ( text ) { @@ -214,4 +207,4 @@ THREE.PDBLoader.prototype = { } -}; +} ); diff --git a/examples/js/loaders/PRWMLoader.js b/examples/js/loaders/PRWMLoader.js index a25cfecc9df098..4172f7e00539f6 100644 --- a/examples/js/loaders/PRWMLoader.js +++ b/examples/js/loaders/PRWMLoader.js @@ -224,13 +224,13 @@ THREE.PRWMLoader = ( function () { function PRWMLoader( manager ) { - this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager; + THREE.Loader.call( this, manager ); } - PRWMLoader.prototype = { + PRWMLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype ), { - constructor: THREE.PRWMLoader, + constructor: PRWMLoader, load: function ( url, onLoad, onProgress, onError ) { @@ -250,13 +250,6 @@ THREE.PRWMLoader = ( function () { }, - setPath: function ( value ) { - - this.path = value; - return this; - - }, - parse: function ( arrayBuffer ) { var data = decodePrwm( arrayBuffer ), @@ -282,7 +275,7 @@ THREE.PRWMLoader = ( function () { } - }; + } ); PRWMLoader.isBigEndianPlatform = function () { diff --git a/examples/js/loaders/SVGLoader.js b/examples/js/loaders/SVGLoader.js index a55f621e9a84f0..a4bcd20501fefb 100644 --- a/examples/js/loaders/SVGLoader.js +++ b/examples/js/loaders/SVGLoader.js @@ -6,11 +6,11 @@ THREE.SVGLoader = function ( manager ) { - this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager; + THREE.Loader.call( this, manager ); }; -THREE.SVGLoader.prototype = { +THREE.SVGLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype ), { constructor: THREE.SVGLoader, @@ -28,13 +28,6 @@ THREE.SVGLoader.prototype = { }, - setPath: function ( value ) { - - this.path = value; - return this; - - }, - parse: function ( text ) { function parseNode( node, style ) { @@ -1172,7 +1165,7 @@ THREE.SVGLoader.prototype = { } -}; +} ); THREE.SVGLoader.getStrokeStyle = function ( width, color, lineJoin, lineCap, miterLimit ) { diff --git a/examples/js/loaders/VTKLoader.js b/examples/js/loaders/VTKLoader.js index f7cd93a6ba9735..f0f57cf5393c98 100644 --- a/examples/js/loaders/VTKLoader.js +++ b/examples/js/loaders/VTKLoader.js @@ -11,11 +11,13 @@ THREE.VTKLoader = function ( manager ) { - this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager; + THREE.Loader.call( this, manager ); }; -Object.assign( THREE.VTKLoader.prototype, THREE.EventDispatcher.prototype, { +THREE.VTKLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype ), { + + constructor: THREE.VTKLoader, load: function ( url, onLoad, onProgress, onError ) { @@ -32,13 +34,6 @@ Object.assign( THREE.VTKLoader.prototype, THREE.EventDispatcher.prototype, { }, - setPath: function ( value ) { - - this.path = value; - return this; - - }, - parse: function ( data ) { function parseASCII( data ) { diff --git a/examples/jsm/loaders/MD2Loader.js b/examples/jsm/loaders/MD2Loader.js index d198ebaf72690f..f2289175ee6fe2 100644 --- a/examples/jsm/loaders/MD2Loader.js +++ b/examples/jsm/loaders/MD2Loader.js @@ -5,19 +5,19 @@ import { AnimationClip, BufferGeometry, - DefaultLoadingManager, FileLoader, Float32BufferAttribute, + Loader, Vector3 } from "../../../build/three.module.js"; var MD2Loader = function ( manager ) { - this.manager = ( manager !== undefined ) ? manager : DefaultLoadingManager; + Loader.call( this, manager ); }; -MD2Loader.prototype = { +MD2Loader.prototype = Object.assign( Object.create( Loader.prototype ), { constructor: MD2Loader, @@ -36,13 +36,6 @@ MD2Loader.prototype = { }, - setPath: function ( value ) { - - this.path = value; - return this; - - }, - parse: ( function () { var normalData = [ @@ -393,6 +386,6 @@ MD2Loader.prototype = { } )() -}; +} ); export { MD2Loader }; diff --git a/examples/jsm/loaders/OBJLoader.js b/examples/jsm/loaders/OBJLoader.js index 3d1d21462982cd..e849f73d6711b2 100644 --- a/examples/jsm/loaders/OBJLoader.js +++ b/examples/jsm/loaders/OBJLoader.js @@ -4,12 +4,12 @@ import { BufferGeometry, - DefaultLoadingManager, FileLoader, Float32BufferAttribute, Group, LineBasicMaterial, LineSegments, + Loader, Material, Mesh, MeshPhongMaterial, @@ -381,13 +381,13 @@ var OBJLoader = ( function () { function OBJLoader( manager ) { - this.manager = ( manager !== undefined ) ? manager : DefaultLoadingManager; + Loader.call( this, manager ); this.materials = null; } - OBJLoader.prototype = { + OBJLoader.prototype = Object.assign( Object.create( Loader.prototype ), { constructor: OBJLoader, @@ -405,14 +405,6 @@ var OBJLoader = ( function () { }, - setPath: function ( value ) { - - this.path = value; - - return this; - - }, - setMaterials: function ( materials ) { this.materials = materials; @@ -807,7 +799,7 @@ var OBJLoader = ( function () { } - }; + } ); return OBJLoader; diff --git a/examples/jsm/loaders/PCDLoader.js b/examples/jsm/loaders/PCDLoader.js index 259e2f7663f6b4..23f820afea66e4 100644 --- a/examples/jsm/loaders/PCDLoader.js +++ b/examples/jsm/loaders/PCDLoader.js @@ -10,9 +10,9 @@ import { BufferGeometry, - DefaultLoadingManager, FileLoader, Float32BufferAttribute, + Loader, LoaderUtils, Points, PointsMaterial, @@ -21,13 +21,14 @@ import { var PCDLoader = function ( manager ) { - this.manager = ( manager !== undefined ) ? manager : DefaultLoadingManager; + Loader.call( this, manager ); + this.littleEndian = true; }; -PCDLoader.prototype = { +PCDLoader.prototype = Object.assign( Object.create( Loader.prototype ), { constructor: PCDLoader, @@ -62,13 +63,6 @@ PCDLoader.prototype = { }, - setPath: function ( value ) { - - this.path = value; - return this; - - }, - parse: function ( data, url ) { function parseHeader( data ) { @@ -316,6 +310,6 @@ PCDLoader.prototype = { } -}; +} ); export { PCDLoader }; diff --git a/examples/jsm/loaders/PDBLoader.js b/examples/jsm/loaders/PDBLoader.js index f0ba967054301a..580245f2835963 100644 --- a/examples/jsm/loaders/PDBLoader.js +++ b/examples/jsm/loaders/PDBLoader.js @@ -5,18 +5,18 @@ import { BufferGeometry, - DefaultLoadingManager, FileLoader, - Float32BufferAttribute + Float32BufferAttribute, + Loader } from "../../../build/three.module.js"; var PDBLoader = function ( manager ) { - this.manager = ( manager !== undefined ) ? manager : DefaultLoadingManager; + Loader.call( this, manager ); }; -PDBLoader.prototype = { +PDBLoader.prototype = Object.assign( Object.create( Loader.prototype ), { constructor: PDBLoader, @@ -34,13 +34,6 @@ PDBLoader.prototype = { }, - setPath: function ( value ) { - - this.path = value; - return this; - - }, - // Based on CanvasMol PDB parser parse: function ( text ) { @@ -221,6 +214,6 @@ PDBLoader.prototype = { } -}; +} ); export { PDBLoader }; diff --git a/examples/jsm/loaders/PRWMLoader.js b/examples/jsm/loaders/PRWMLoader.js index bdb7af1de77a4d..561bc466951dfe 100644 --- a/examples/jsm/loaders/PRWMLoader.js +++ b/examples/jsm/loaders/PRWMLoader.js @@ -6,8 +6,8 @@ import { BufferAttribute, BufferGeometry, - DefaultLoadingManager, - FileLoader + FileLoader, + Loader } from "../../../build/three.module.js"; var PRWMLoader = ( function () { @@ -231,11 +231,11 @@ var PRWMLoader = ( function () { function PRWMLoader( manager ) { - this.manager = ( manager !== undefined ) ? manager : DefaultLoadingManager; + Loader.call( this, manager ); } - PRWMLoader.prototype = { + PRWMLoader.prototype = Object.assign( Object.create( Loader.prototype ), { constructor: PRWMLoader, @@ -257,13 +257,6 @@ var PRWMLoader = ( function () { }, - setPath: function ( value ) { - - this.path = value; - return this; - - }, - parse: function ( arrayBuffer ) { var data = decodePrwm( arrayBuffer ), @@ -289,7 +282,7 @@ var PRWMLoader = ( function () { } - }; + } ); PRWMLoader.isBigEndianPlatform = function () { diff --git a/examples/jsm/loaders/SVGLoader.js b/examples/jsm/loaders/SVGLoader.js index eb3e1e846898fb..30cf5133db2ff2 100644 --- a/examples/jsm/loaders/SVGLoader.js +++ b/examples/jsm/loaders/SVGLoader.js @@ -7,9 +7,9 @@ import { BufferGeometry, Color, - DefaultLoadingManager, FileLoader, Float32BufferAttribute, + Loader, Matrix3, Path, ShapePath, @@ -19,11 +19,11 @@ import { var SVGLoader = function ( manager ) { - this.manager = ( manager !== undefined ) ? manager : DefaultLoadingManager; + Loader.call( this, manager ); }; -SVGLoader.prototype = { +SVGLoader.prototype = Object.assign( Object.create( Loader.prototype ), { constructor: SVGLoader, @@ -41,13 +41,6 @@ SVGLoader.prototype = { }, - setPath: function ( value ) { - - this.path = value; - return this; - - }, - parse: function ( text ) { function parseNode( node, style ) { @@ -1185,7 +1178,7 @@ SVGLoader.prototype = { } -}; +} ); SVGLoader.getStrokeStyle = function ( width, color, lineJoin, lineCap, miterLimit ) { diff --git a/examples/jsm/loaders/TDSLoader.js b/examples/jsm/loaders/TDSLoader.js index 30a7ce14781df1..d5d39c69215017 100644 --- a/examples/jsm/loaders/TDSLoader.js +++ b/examples/jsm/loaders/TDSLoader.js @@ -56,7 +56,7 @@ TDSLoader.prototype = Object.assign( Object.create( Loader.prototype ), { var scope = this; - var path = this.path !== undefined ? this.path : LoaderUtils.extractUrlBase( url ); + var path = ( scope.path === '' ) ? LoaderUtils.extractUrlBase( url ) : scope.path; var loader = new FileLoader( this.manager ); loader.setPath( this.path ); diff --git a/examples/jsm/loaders/VTKLoader.js b/examples/jsm/loaders/VTKLoader.js index 981bec5d7a73bf..2f3bf27001d6b4 100644 --- a/examples/jsm/loaders/VTKLoader.js +++ b/examples/jsm/loaders/VTKLoader.js @@ -12,21 +12,22 @@ import { BufferAttribute, BufferGeometry, - DefaultLoadingManager, - EventDispatcher, FileLoader, Float32BufferAttribute, + Loader, LoaderUtils } from "../../../build/three.module.js"; import { Zlib } from "../libs/inflate.module.min.js"; var VTKLoader = function ( manager ) { - this.manager = ( manager !== undefined ) ? manager : DefaultLoadingManager; + Loader.call( this, manager ); }; -Object.assign( VTKLoader.prototype, EventDispatcher.prototype, { +VTKLoader.prototype = Object.assign( Object.create( Loader.prototype ), { + + constructor: VTKLoader, load: function ( url, onLoad, onProgress, onError ) { @@ -43,13 +44,6 @@ Object.assign( VTKLoader.prototype, EventDispatcher.prototype, { }, - setPath: function ( value ) { - - this.path = value; - return this; - - }, - parse: function ( data ) { function parseASCII( data ) { From 015c121691e05461e029de397664f7898b20844d Mon Sep 17 00:00:00 2001 From: Mugen87 Date: Sat, 31 Aug 2019 17:12:39 +0200 Subject: [PATCH 26/75] Examples: Inherit from Loader III. --- docs/examples/en/loaders/GLTFLoader.html | 25 +- docs/examples/en/loaders/LoaderSupport.html | 543 ------------------ docs/examples/en/loaders/MMDLoader.html | 25 +- docs/examples/en/loaders/MTLLoader.html | 34 +- docs/examples/en/loaders/TGALoader.html | 13 +- docs/examples/zh/loaders/GLTFLoader.html | 25 +- docs/examples/zh/loaders/LoaderSupport.html | 543 ------------------ docs/examples/zh/loaders/MMDLoader.html | 31 +- docs/examples/zh/loaders/MTLLoader.html | 34 +- docs/examples/zh/loaders/TGALoader.html | 13 +- docs/list.js | 2 - examples/js/loaders/GLTFLoader.js | 42 +- examples/js/loaders/MMDLoader.js | 45 +- examples/js/loaders/MTLLoader.js | 62 +- examples/js/loaders/NRRDLoader.js | 16 +- examples/js/loaders/TGALoader.js | 21 +- .../js/loaders/deprecated/LegacyGLTFLoader.js | 32 +- .../js/loaders/deprecated/LegacyJSONLoader.js | 35 +- examples/jsm/loaders/GLTFLoader.d.ts | 10 +- examples/jsm/loaders/GLTFLoader.js | 43 +- examples/jsm/loaders/MD2Loader.d.ts | 6 +- examples/jsm/loaders/MMDLoader.d.ts | 10 +- examples/jsm/loaders/MMDLoader.js | 46 +- examples/jsm/loaders/MTLLoader.d.ts | 11 +- examples/jsm/loaders/MTLLoader.js | 62 +- examples/jsm/loaders/NRRDLoader.js | 18 +- examples/jsm/loaders/OBJLoader.d.ts | 6 +- examples/jsm/loaders/PCDLoader.d.ts | 7 +- examples/jsm/loaders/PDBLoader.d.ts | 7 +- examples/jsm/loaders/PRWMLoader.d.ts | 6 +- examples/jsm/loaders/SVGLoader.d.ts | 7 +- examples/jsm/loaders/TGALoader.d.ts | 8 +- examples/jsm/loaders/TGALoader.js | 23 +- examples/jsm/loaders/VTKLoader.d.ts | 7 +- .../loaders/deprecated/LegacyGLTFLoader.d.ts | 10 +- .../loaders/deprecated/LegacyGLTFLoader.js | 33 +- .../loaders/deprecated/LegacyJSONLoader.d.ts | 10 +- .../loaders/deprecated/LegacyJSONLoader.js | 36 +- 38 files changed, 143 insertions(+), 1764 deletions(-) delete mode 100644 docs/examples/en/loaders/LoaderSupport.html delete mode 100644 docs/examples/zh/loaders/LoaderSupport.html diff --git a/docs/examples/en/loaders/GLTFLoader.html b/docs/examples/en/loaders/GLTFLoader.html index 2f0c0def4195b9..0e5fe0583bc25f 100644 --- a/docs/examples/en/loaders/GLTFLoader.html +++ b/docs/examples/en/loaders/GLTFLoader.html @@ -9,6 +9,7 @@ [page:Loader] → +

[name]

A loader for glTF 2.0 resources.

@@ -161,9 +162,10 @@

[name]( [param:LoadingManager manager] )

Properties

- +

See the base [page:Loader] class for common properties.

Methods

+

See the base [page:Loader] class for common methods.

[method:null load]( [param:String url], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )

@@ -176,27 +178,6 @@

[method:null load]( [param:String url], [param:Function onLoad], [param:Func Begin loading from url and call the callback function with the parsed response content.

-

[method:GLTFLoader setPath]( [param:String path] )

-

- [page:String path] — Base path. -

-

- Set the base path for the .gltf/.glb file. -

- -

[method:GLTFLoader setResourcePath]( [param:String path] )

-

- [page:String path] — Base path for loading additional resources e.g. textures and .bin data. -

-

- Set the base path for additional resources. -

- -

[method:null setCrossOrigin]( [param:String value] )

-

- [page:String value] — The crossOrigin string to implement CORS for loading the url from a different domain that allows CORS. -

-

[method:null setDRACOLoader]( [param:DRACOLoader dracoLoader] )

[page:DRACOLoader dracoLoader] — Instance of THREE.DRACOLoader, to be used for decoding assets compressed with the KHR_draco_mesh_compression extension. diff --git a/docs/examples/en/loaders/LoaderSupport.html b/docs/examples/en/loaders/LoaderSupport.html deleted file mode 100644 index eaf18174b81ca5..00000000000000 --- a/docs/examples/en/loaders/LoaderSupport.html +++ /dev/null @@ -1,543 +0,0 @@ - - - - - - - - - - - -

[name]

- -

Supporting classes for file loaders and web worker based loaders.

- -

Sub-Classes

- [page:LoaderSupport.Builder]
- [page:LoaderSupport.LoadedMeshUserOverride]
- [page:LoaderSupport.WorkerSupport]
- [page:LoaderSupport.WorkerRunnerRefImpl]
- [page:LoaderSupport.WorkerDirector]
- [page:LoaderSupport.ResourceDescriptor]
- [page:LoaderSupport.PrepData]
- [page:LoaderSupport.Callbacks]
- [page:LoaderSupport.Validator]
- - -

Example

- - [example:webgl_loader_obj2_meshspray] - Example using [page:LoaderSupport.LoaderWorkerDirector] and [page:LoaderSupport.LoaderWorkerSupport].
- -

Classes

-
- -

Builder

-

Constructor

- -

Builder()

-

- Builds one or many [page:Mesh] from one raw set of Arraybuffers, materialGroup descriptions and further parameters. - Supports vertex, vertexColor, normal, uv and index buffers. -

- - -

Methods

- -

[method:null setLogging] ( [param:Boolean enabled], [param:Boolean debug] )

-

- [page:Boolean enabled] True or false.
- [page:Boolean debug] True or false. -

-

- Enable or disable logging in general (except warn and error), plus enable or disable debug logging. -

- - -

[method:null init] ()

-

- Initializes the Builder (currently only default material initialisation). -

- - -

[method:null setMaterials] ( Array of [param:Material materials] )

-

- Array of [page:Material materials] - Array of [page:Material Materials] -

-

- Set materials loaded by any supplier of an Array of [page:Material Materials]. -

- - -

[method:Array processPayload] ( Object payload )

-

- [page:Object payload] - Raw Mesh or Material descriptions. -

-

- Delegates processing of the payload (mesh building or material update) to the corresponding functions (BW-compatibility). -

- - -

[method:Array buildMeshes] ( Object meshPayload )

-

- [page:Object meshPayload] - Raw mesh description (buffers, params, materials) used to build one to many meshes. -

-

- Builds one or multiple meshes from the data described in the payload (buffers, params, material info). -

- - -

[method:null updateMaterials] ( Object materialPayload )

-

- [page:Object materialPayload] - Material update instructions -

-

- Updates the materials with contained material objects (sync) or from alteration instructions (async). -

- - -

[method:Object getMaterialsJSON] ()

-

- Returns the mapping object of material name and corresponding jsonified material. -

- - -

[method:Object getMaterials] ()

-

- Returns the mapping object of material name and corresponding material. -

-
-
- - -

LoadedMeshUserOverride

-

Constructor

- -

LoadedMeshUserOverride( [param:Boolean disregardMesh], [param:BufferGeometry bufferGeometry] )

-

- [page:Boolean disregardMesh] - Tell implementation to completely disregard this mesh
- [page:Boolean alteredMesh] - Tell implementation that mesh(es) have been altered or added -

-

- Object to return by callback onMeshAlter. Used to disregard a certain mesh or to return one to many meshes. -

- - -

Methods

- -

[method:null addMesh] ( [param:Mesh mesh] )

-

- [page:Mesh mesh] - Mesh -

-

- Add a mesh created within callback. -

- - -

[method:boolean isDisregardMesh] ()

-

- Answers if mesh shall be disregarded completely. -

- - -

[method:boolean providesAlteredMeshes] ()

-

- Answers if new mesh(es) were created. -

-
-
- - -

WorkerSupport

-

Constructor

- -

WorkerSupport()

-

- This class provides means to transform existing parser code into a web worker. - It defines a simple communication protocol which allows to configure the worker and receive raw mesh data during execution. -

- - -

Methods

- -

[method:null setLogging]( [param:Boolean enabled], [param:Boolean debug] )

-

- [page:Boolean enabled] True or false.
- [page:Boolean debug] True or false. -

-

- Enable or disable logging in general (except warn and error), plus enable or disable debug logging. -

- - -

[method:null setForceWorkerDataCopy]( [param:Boolean forceWorkerDataCopy] )

-

- [page:Boolean forceWorkerDataCopy] True or false. -

-

- Forces all ArrayBuffers to be transferred to worker to be copied. -

- - -

[method:null validate] ( [param:Function functionCodeBuilder], Array of [param:String libLocations], [param:String libPath], [param:LoaderSupport.WorkerRunnerRefImpl runnerImpl] )

-

- [page:Function functionCodeBuilder] - Function that is invoked with funcBuildObject and funcBuildSingleton that allows stringification of objects and singletons.
- Array of [page:String libLocations] - URL of libraries that shall be added to worker code relative to libPath.
- [page:String libPath] - Base path used for loading libraries.
- [page:LoaderSupport.WorkerRunnerRefImpl runnerImpl] - The default worker parser wrapper implementation (communication and execution). An extended class could be passed here. -

-

- Validate the status of worker code and the derived worker. -

- - -

[method:null setTerminateRequested] ( [param:Boolean terminateRequested] )

-

- [page:Boolean terminateRequested] - True or false. -

-

- Request termination of worker once parser is finished. -

- - -

[method:null setCallbacks] ( [param:Function builder], [param:Function onLoad] )

-

- [page:Function builder] - The builder function. Default is [page:LoaderSupport.Builder].
- [page:Function onLoad] - The function that is called when parsing is complete. -

-

- Specify functions that should be build when new raw mesh data becomes available and when the parser is finished. -

- - -

[method:null run] ( [param:Object payload] )

-

- [page:Object payload] - Raw mesh description (buffers, params, materials) used to build one to many meshes. -

-

- Runs the parser with the provided configuration. -

-
-
- - -

WorkerRunnerRefImpl

-

Constructor

- -

WorkerRunnerRefImpl()

-

- Default implementation of the WorkerRunner responsible for creation and configuration of the parser within the worker. -

- - -

Methods

- -

[method:null applyProperties] ( [param:Object parser], [param:Object params] )

-

- [page:Object parser] - The parser instance
- [page:Object params] - The parameter object -

-

- Applies values from parameter object via set functions or via direct assignment. -

- - -

[method:null run] ( [param:Object payload] )

-

- [page:Object payload] - Raw mesh description (buffers, params, materials) used to build one to many meshes. -

-

- Configures the Parser implementation according the supplied configuration object. -

-
-
- - -

WorkerDirector

-

Constructor

- -

WorkerDirector( [param:String classDef] )

-

- [page:String classDef] - Class definition to be used for construction -

-

- Orchestrate loading of multiple OBJ files/data from an instruction queue with a configurable amount of workers (1-16).
- - Workflow:
- - prepareWorkers
- - enqueueForRun
- - processQueue
- - tearDown -

- - -

Methods

- -

[method:null setLogging]( [param:Boolean enabled], [param:Boolean debug] )

-

- [page:Boolean enabled] True or false.
- [page:Boolean debug] True or false. -

-

- Enable or disable logging in general (except warn and error), plus enable or disable debug logging. -

- - -

[method:null setForceWorkerDataCopy]( [param:Boolean forceWorkerDataCopy] )

-

- [page:Boolean forceWorkerDataCopy] True or false. -

-

- Forces all ArrayBuffers to be transferred to worker to be copied. -

- - -

[method:null prepareWorkers]( [param:WWOBJLoader2.Callbacks globalCallbacks], [param:Number maxQueueSize], [param:Number maxWebWorkers] )

-

- [page:LoaderSupport.Callbacks globalCallbacks] - Register global callbacks used by all web workers
- [page:Number maxQueueSize] - Set the maximum size of the instruction queue (1-1024)
- [page:Number maxWebWorkers] - Set the maximum amount of workers (1-16) -

-

- Create or destroy workers according limits. Set the name and register callbacks for dynamically created web workers. -

- - -

[method:null enqueueForRun]( [param:LoaderSupport.PrepData runParams] )

-

- [page:LoaderSupport.PrepData runParams] -

-

- Store run instructions in internal instructionQueue. -

- - -

[method:null processQueue]()

-

- Process the instructionQueue until it is depleted. -

- - -

[method:null tearDown]( [param:Function callbackOnFinishedProcessing] )

-

- [page:Function callbackOnFinishedProcessing] - Function called once all workers finished processing. -

-

- Terminate all workers. -

- - -

[method:null getMaxQueueSize]()

-

- Returns the maximum length of the instruction queue. -

- - -

[method:null getMaxWebWorkers]()

-

- Returns the maximum number of workers. -

- -

[method:Boolean isRunning]()

-

- Returns if any workers are running. -

- - -

[method:null setCrossOrigin]( [param:String crossOrigin] )

-

- [page:String crossOrigin] - CORS value -

-

- Sets the CORS string to be used. -

-
-
- - -

ResourceDescriptor

-

Constructor

- -

ResourceDescriptor( [param:String url], [param:String extension] )

-

- [page:String url] - URL to the file
- [page:String extension] - The file extension (type) -

-

- A resource description used by [page:LoaderSupport.PrepData] and others. -

- -

Methods

- -

[method:null setContent]( [param:Object content )

-

- [page:Object content] - The file content as ArrayBuffer or text -

-

- Set the content of this resource -

- - -

[method:null setResourcePath] ( [param:String resourcePath] )

-

- [page:String resourcePath] - URL -

-

- Allows to specify resourcePath for dependencies of specified resource. -

-
-
- - -

PrepData

-

Constructor

- -

PrepData( [param:String modelName] )

-

- [page:String modelName] - Overall name of the model -

-

- Configuration instructions to be used by run method. -

- - -

Methods

- -

[method:null setLogging]( [param:Boolean enabled], [param:Boolean debug] )

-

- [page:Boolean enabled] True or false.
- [page:Boolean debug] True or false. -

-

- Enable or disable logging in general (except warn and error), plus enable or disable debug logging. -

- - -

[method:Callbacks getCallbacks]()

-

- Returns all callbacks as [page:LoaderSupport.Callbacks]. -

- - -

[method:null addResource]( [param:LoaderSupport.ResourceDescriptor resource] )

-

- [page:LoaderSupport.ResourceDescriptor resource] Adds a [page:LoaderSupport.ResourceDescriptor] -

-

- Add a resource description. -

- - -

[method:null checkResourceDescriptorFiles] ( [param:LoaderSupport.ResourceDescriptor resources], [param:Object fileDesc] )

-

- [page:LoaderSupport.ResourceDescriptor resources] - Array of [page:LoaderSupport.ResourceDescriptor]
- [page:Object fileDesc] - Object describing which resources are of interest (ext, type (string or UInt8Array) and ignore (boolean)) -

-

- Identify files or content of interest from an Array of [page:LoaderSupport.ResourceDescriptor]. - Returns Object with each "ext" and the corresponding [page:LoaderSupport.ResourceDescriptor] -

- - -

[method:PrepData clone] ()

-

- Clones this object and returns it afterwards. Callbacks and resources are not cloned deep (references!). -

-
-
- - -

Callbacks

-

Constructor

- -

Callbacks()

-

- Callbacks utilized by loaders and builder. -

- - -

Methods

- -

[method:null setCallbackOnProgress]( [param:Function callbackOnProgress] )

-

- [page:Function callbackOnProgress] - Callback function for described functionality -

-

- Register callback function that is invoked by internal function "announceProgress" to print feedback. -

- -

[method:null setCallbackOnReportError]( [param:Function callbackOnReportError] )

-

- [page:Function callbackOnReportError] - Callback function for described functionality -

-

- Register callback function that is invoked when an error is reported. -

- -

[method:null setCallbackOnMeshAlter]( [param:Function callbackOnMeshAlter] )

-

- [page:Function callbackOnMeshAlter] - Callback function for described functionality -

-

- Register callback function that is called every time a mesh was loaded. - Use [page:LoadedMeshUserOverride] for alteration instructions (geometry, material or disregard mesh). -

- - -

[method:null setCallbackOnLoad]( [param:Function callbackOnLoad] )

-

- [page:Function callbackOnLoad] - Callback function for described functionality -

-

- Register callback function that is called once loading of the complete OBJ file is completed. -

- -

[method:null setCallbackOnLoadMaterials]( [param:Function callbackOnLoadMaterials] )

-

- [page:Function callbackOnLoadMaterials] - Callback function for described functionality -

-

- Register callback function that is called when materials have been loaded. -

-
-
- - -

Validator

-

Constructor

- -

Validator()

-

- Validation functions. -

- - -

Methods

- -

[method:Boolean isValid]( [param:Object input] )

-

- [page:Object input] - Can be anything -

-

- If given input is null or undefined, false is returned otherwise true. -

- - -

[method:null verifyInput]( [param:Object input], [param:Object defaultValue] )

-

- [page:Object input] - Can be anything
- [page:Object defaultValue] - Can be anything -

-

- If given input is null or undefined, the defaultValue is returned otherwise the given input. -

-
-
- -

Source

- -

- [link:https://github.com/mrdoob/three.js/blob/master/examples/js/loaders/LoaderSupport.js examples/js/loaders/LoaderSupport.js] -

- - - diff --git a/docs/examples/en/loaders/MMDLoader.html b/docs/examples/en/loaders/MMDLoader.html index 8a7728ee0ceda9..182d6b0958516d 100644 --- a/docs/examples/en/loaders/MMDLoader.html +++ b/docs/examples/en/loaders/MMDLoader.html @@ -9,6 +9,7 @@ [page:Loader] → +

[name]

A loader for MMD resources.

@@ -66,9 +67,10 @@

[name]( [param:LoadingManager manager] )

Properties

- +

See the base [page:Loader] class for common properties.

Methods

+

See the base [page:Loader] class for common methods.

[method:null load]( [param:String url], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )

@@ -105,11 +107,6 @@

[method:null loadWithAnimation]( [param:String modelUrl], [param:String vmdU Begin loading PMD/PMX model file and VMD motion file(s) from urls and fire the callback function with an [page:Object] containing parsed [page:SkinnedMesh] and [page:AnimationClip] fitting to the [page:SkinnedMesh].

-

[method:MMDLoader setCrossOrigin]( [param:String crossOrigin] )

-

- [page:String crossOrigin] — The crossOrigin string to implement CORS for loading the url from a different domain that allows CORS. -

-

[method:MMDLoader setAnimationPath]( [param:String animationPath] )

[page:String animationPath] — Base path for loading animation data (VMD/VPD files). @@ -118,22 +115,6 @@

[method:MMDLoader setAnimationPath]( [param:String animationPath] )

Set the base path for additional resources like textures.

-

[method:MMDLoader setPath]( [param:String path] )

-

- [page:String path] — Base path. -

-

- Sets the base path or URL from which to load files. -

- -

[method:MMDLoader setResourcePath]( [param:String resourcePath] )

-

- [page:String resourcePath] — Base path for loading additional resources e.g. textures. -

-

- Set the base path for additional resources like textures. -

-

Source

diff --git a/docs/examples/en/loaders/MTLLoader.html b/docs/examples/en/loaders/MTLLoader.html index 8028dcec1f5ac0..cb33f2009ffae4 100644 --- a/docs/examples/en/loaders/MTLLoader.html +++ b/docs/examples/en/loaders/MTLLoader.html @@ -8,6 +8,7 @@ + [page:Loader] →

[name]

@@ -27,10 +28,10 @@

[name]( [param:LoadingManager loadingManager] )

Properties

- +

See the base [page:Loader] class for common properties.

Methods

- +

See the base [page:Loader] class for common methods.

[method:null load]( [param:String url], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )

@@ -43,35 +44,6 @@

[method:null load]( [param:String url], [param:Function onLoad], [param:Func Begin loading from url and return the loaded material.

- -

[method:MTLLoader setPath]( [param:String path] )

-

- [page:String path] — required
-

-

- Set base path for MTL file. -

- - -

[method:MTLLoader setResourcePath]( [param:String path] )

-

- [page:String path] — required
-

-

- Set base path for additional resources like textures. If set, this path will be used as the base path. -

- - -

[method:MTLLoader setCrossOrigin]( [param:String value] )

-

- [page:String value] — required
-

-

- If set, assigns the [link:https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes crossOrigin] - attribute of the image to the value of *crossOrigin*, prior to starting the load. Default is *"anonymous"*. -

- -

[method:MTLLoader setMaterialOptions]( [param:Object options] )

[page:Object options] — required diff --git a/docs/examples/en/loaders/TGALoader.html b/docs/examples/en/loaders/TGALoader.html index 834d4e22f2b777..969b383e50cb4e 100644 --- a/docs/examples/en/loaders/TGALoader.html +++ b/docs/examples/en/loaders/TGALoader.html @@ -8,6 +8,8 @@ + [page:Loader] → +

[name]

A loader for loading a .tga resource.
@@ -62,8 +64,11 @@

[name]( [param:LoadingManager manager] )

Creates a new [name].

+

Properties

+

See the base [page:Loader] class for common properties.

Methods

+

See the base [page:Loader] class for common methods.

[method:DataTexture load]( [param:String url], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )

@@ -76,14 +81,6 @@

[method:DataTexture load]( [param:String url], [param:Function onLoad], [par Begin loading from url and pass the loaded [page:DataTexture texture] to onLoad. The [page:DataTexture texture] is also directly returned for immediate use (but may not be fully loaded).

-

[method:TGALoader setPath]( [param:String path] )

-

- [page:String path] — Base path. -

-

- Set the base path for the file. -

-

Source

diff --git a/docs/examples/zh/loaders/GLTFLoader.html b/docs/examples/zh/loaders/GLTFLoader.html index 2f0c0def4195b9..0e5fe0583bc25f 100644 --- a/docs/examples/zh/loaders/GLTFLoader.html +++ b/docs/examples/zh/loaders/GLTFLoader.html @@ -9,6 +9,7 @@ [page:Loader] → +

[name]

A loader for glTF 2.0 resources.

@@ -161,9 +162,10 @@

[name]( [param:LoadingManager manager] )

Properties

- +

See the base [page:Loader] class for common properties.

Methods

+

See the base [page:Loader] class for common methods.

[method:null load]( [param:String url], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )

@@ -176,27 +178,6 @@

[method:null load]( [param:String url], [param:Function onLoad], [param:Func Begin loading from url and call the callback function with the parsed response content.

-

[method:GLTFLoader setPath]( [param:String path] )

-

- [page:String path] — Base path. -

-

- Set the base path for the .gltf/.glb file. -

- -

[method:GLTFLoader setResourcePath]( [param:String path] )

-

- [page:String path] — Base path for loading additional resources e.g. textures and .bin data. -

-

- Set the base path for additional resources. -

- -

[method:null setCrossOrigin]( [param:String value] )

-

- [page:String value] — The crossOrigin string to implement CORS for loading the url from a different domain that allows CORS. -

-

[method:null setDRACOLoader]( [param:DRACOLoader dracoLoader] )

[page:DRACOLoader dracoLoader] — Instance of THREE.DRACOLoader, to be used for decoding assets compressed with the KHR_draco_mesh_compression extension. diff --git a/docs/examples/zh/loaders/LoaderSupport.html b/docs/examples/zh/loaders/LoaderSupport.html deleted file mode 100644 index eaf18174b81ca5..00000000000000 --- a/docs/examples/zh/loaders/LoaderSupport.html +++ /dev/null @@ -1,543 +0,0 @@ - - - - - - - - - - - -

[name]

- -

Supporting classes for file loaders and web worker based loaders.

- -

Sub-Classes

- [page:LoaderSupport.Builder]
- [page:LoaderSupport.LoadedMeshUserOverride]
- [page:LoaderSupport.WorkerSupport]
- [page:LoaderSupport.WorkerRunnerRefImpl]
- [page:LoaderSupport.WorkerDirector]
- [page:LoaderSupport.ResourceDescriptor]
- [page:LoaderSupport.PrepData]
- [page:LoaderSupport.Callbacks]
- [page:LoaderSupport.Validator]
- - -

Example

- - [example:webgl_loader_obj2_meshspray] - Example using [page:LoaderSupport.LoaderWorkerDirector] and [page:LoaderSupport.LoaderWorkerSupport].
- -

Classes

-
- -

Builder

-

Constructor

- -

Builder()

-

- Builds one or many [page:Mesh] from one raw set of Arraybuffers, materialGroup descriptions and further parameters. - Supports vertex, vertexColor, normal, uv and index buffers. -

- - -

Methods

- -

[method:null setLogging] ( [param:Boolean enabled], [param:Boolean debug] )

-

- [page:Boolean enabled] True or false.
- [page:Boolean debug] True or false. -

-

- Enable or disable logging in general (except warn and error), plus enable or disable debug logging. -

- - -

[method:null init] ()

-

- Initializes the Builder (currently only default material initialisation). -

- - -

[method:null setMaterials] ( Array of [param:Material materials] )

-

- Array of [page:Material materials] - Array of [page:Material Materials] -

-

- Set materials loaded by any supplier of an Array of [page:Material Materials]. -

- - -

[method:Array processPayload] ( Object payload )

-

- [page:Object payload] - Raw Mesh or Material descriptions. -

-

- Delegates processing of the payload (mesh building or material update) to the corresponding functions (BW-compatibility). -

- - -

[method:Array buildMeshes] ( Object meshPayload )

-

- [page:Object meshPayload] - Raw mesh description (buffers, params, materials) used to build one to many meshes. -

-

- Builds one or multiple meshes from the data described in the payload (buffers, params, material info). -

- - -

[method:null updateMaterials] ( Object materialPayload )

-

- [page:Object materialPayload] - Material update instructions -

-

- Updates the materials with contained material objects (sync) or from alteration instructions (async). -

- - -

[method:Object getMaterialsJSON] ()

-

- Returns the mapping object of material name and corresponding jsonified material. -

- - -

[method:Object getMaterials] ()

-

- Returns the mapping object of material name and corresponding material. -

-
-
- - -

LoadedMeshUserOverride

-

Constructor

- -

LoadedMeshUserOverride( [param:Boolean disregardMesh], [param:BufferGeometry bufferGeometry] )

-

- [page:Boolean disregardMesh] - Tell implementation to completely disregard this mesh
- [page:Boolean alteredMesh] - Tell implementation that mesh(es) have been altered or added -

-

- Object to return by callback onMeshAlter. Used to disregard a certain mesh or to return one to many meshes. -

- - -

Methods

- -

[method:null addMesh] ( [param:Mesh mesh] )

-

- [page:Mesh mesh] - Mesh -

-

- Add a mesh created within callback. -

- - -

[method:boolean isDisregardMesh] ()

-

- Answers if mesh shall be disregarded completely. -

- - -

[method:boolean providesAlteredMeshes] ()

-

- Answers if new mesh(es) were created. -

-
-
- - -

WorkerSupport

-

Constructor

- -

WorkerSupport()

-

- This class provides means to transform existing parser code into a web worker. - It defines a simple communication protocol which allows to configure the worker and receive raw mesh data during execution. -

- - -

Methods

- -

[method:null setLogging]( [param:Boolean enabled], [param:Boolean debug] )

-

- [page:Boolean enabled] True or false.
- [page:Boolean debug] True or false. -

-

- Enable or disable logging in general (except warn and error), plus enable or disable debug logging. -

- - -

[method:null setForceWorkerDataCopy]( [param:Boolean forceWorkerDataCopy] )

-

- [page:Boolean forceWorkerDataCopy] True or false. -

-

- Forces all ArrayBuffers to be transferred to worker to be copied. -

- - -

[method:null validate] ( [param:Function functionCodeBuilder], Array of [param:String libLocations], [param:String libPath], [param:LoaderSupport.WorkerRunnerRefImpl runnerImpl] )

-

- [page:Function functionCodeBuilder] - Function that is invoked with funcBuildObject and funcBuildSingleton that allows stringification of objects and singletons.
- Array of [page:String libLocations] - URL of libraries that shall be added to worker code relative to libPath.
- [page:String libPath] - Base path used for loading libraries.
- [page:LoaderSupport.WorkerRunnerRefImpl runnerImpl] - The default worker parser wrapper implementation (communication and execution). An extended class could be passed here. -

-

- Validate the status of worker code and the derived worker. -

- - -

[method:null setTerminateRequested] ( [param:Boolean terminateRequested] )

-

- [page:Boolean terminateRequested] - True or false. -

-

- Request termination of worker once parser is finished. -

- - -

[method:null setCallbacks] ( [param:Function builder], [param:Function onLoad] )

-

- [page:Function builder] - The builder function. Default is [page:LoaderSupport.Builder].
- [page:Function onLoad] - The function that is called when parsing is complete. -

-

- Specify functions that should be build when new raw mesh data becomes available and when the parser is finished. -

- - -

[method:null run] ( [param:Object payload] )

-

- [page:Object payload] - Raw mesh description (buffers, params, materials) used to build one to many meshes. -

-

- Runs the parser with the provided configuration. -

-
-
- - -

WorkerRunnerRefImpl

-

Constructor

- -

WorkerRunnerRefImpl()

-

- Default implementation of the WorkerRunner responsible for creation and configuration of the parser within the worker. -

- - -

Methods

- -

[method:null applyProperties] ( [param:Object parser], [param:Object params] )

-

- [page:Object parser] - The parser instance
- [page:Object params] - The parameter object -

-

- Applies values from parameter object via set functions or via direct assignment. -

- - -

[method:null run] ( [param:Object payload] )

-

- [page:Object payload] - Raw mesh description (buffers, params, materials) used to build one to many meshes. -

-

- Configures the Parser implementation according the supplied configuration object. -

-
-
- - -

WorkerDirector

-

Constructor

- -

WorkerDirector( [param:String classDef] )

-

- [page:String classDef] - Class definition to be used for construction -

-

- Orchestrate loading of multiple OBJ files/data from an instruction queue with a configurable amount of workers (1-16).
- - Workflow:
- - prepareWorkers
- - enqueueForRun
- - processQueue
- - tearDown -

- - -

Methods

- -

[method:null setLogging]( [param:Boolean enabled], [param:Boolean debug] )

-

- [page:Boolean enabled] True or false.
- [page:Boolean debug] True or false. -

-

- Enable or disable logging in general (except warn and error), plus enable or disable debug logging. -

- - -

[method:null setForceWorkerDataCopy]( [param:Boolean forceWorkerDataCopy] )

-

- [page:Boolean forceWorkerDataCopy] True or false. -

-

- Forces all ArrayBuffers to be transferred to worker to be copied. -

- - -

[method:null prepareWorkers]( [param:WWOBJLoader2.Callbacks globalCallbacks], [param:Number maxQueueSize], [param:Number maxWebWorkers] )

-

- [page:LoaderSupport.Callbacks globalCallbacks] - Register global callbacks used by all web workers
- [page:Number maxQueueSize] - Set the maximum size of the instruction queue (1-1024)
- [page:Number maxWebWorkers] - Set the maximum amount of workers (1-16) -

-

- Create or destroy workers according limits. Set the name and register callbacks for dynamically created web workers. -

- - -

[method:null enqueueForRun]( [param:LoaderSupport.PrepData runParams] )

-

- [page:LoaderSupport.PrepData runParams] -

-

- Store run instructions in internal instructionQueue. -

- - -

[method:null processQueue]()

-

- Process the instructionQueue until it is depleted. -

- - -

[method:null tearDown]( [param:Function callbackOnFinishedProcessing] )

-

- [page:Function callbackOnFinishedProcessing] - Function called once all workers finished processing. -

-

- Terminate all workers. -

- - -

[method:null getMaxQueueSize]()

-

- Returns the maximum length of the instruction queue. -

- - -

[method:null getMaxWebWorkers]()

-

- Returns the maximum number of workers. -

- -

[method:Boolean isRunning]()

-

- Returns if any workers are running. -

- - -

[method:null setCrossOrigin]( [param:String crossOrigin] )

-

- [page:String crossOrigin] - CORS value -

-

- Sets the CORS string to be used. -

-
-
- - -

ResourceDescriptor

-

Constructor

- -

ResourceDescriptor( [param:String url], [param:String extension] )

-

- [page:String url] - URL to the file
- [page:String extension] - The file extension (type) -

-

- A resource description used by [page:LoaderSupport.PrepData] and others. -

- -

Methods

- -

[method:null setContent]( [param:Object content )

-

- [page:Object content] - The file content as ArrayBuffer or text -

-

- Set the content of this resource -

- - -

[method:null setResourcePath] ( [param:String resourcePath] )

-

- [page:String resourcePath] - URL -

-

- Allows to specify resourcePath for dependencies of specified resource. -

-
-
- - -

PrepData

-

Constructor

- -

PrepData( [param:String modelName] )

-

- [page:String modelName] - Overall name of the model -

-

- Configuration instructions to be used by run method. -

- - -

Methods

- -

[method:null setLogging]( [param:Boolean enabled], [param:Boolean debug] )

-

- [page:Boolean enabled] True or false.
- [page:Boolean debug] True or false. -

-

- Enable or disable logging in general (except warn and error), plus enable or disable debug logging. -

- - -

[method:Callbacks getCallbacks]()

-

- Returns all callbacks as [page:LoaderSupport.Callbacks]. -

- - -

[method:null addResource]( [param:LoaderSupport.ResourceDescriptor resource] )

-

- [page:LoaderSupport.ResourceDescriptor resource] Adds a [page:LoaderSupport.ResourceDescriptor] -

-

- Add a resource description. -

- - -

[method:null checkResourceDescriptorFiles] ( [param:LoaderSupport.ResourceDescriptor resources], [param:Object fileDesc] )

-

- [page:LoaderSupport.ResourceDescriptor resources] - Array of [page:LoaderSupport.ResourceDescriptor]
- [page:Object fileDesc] - Object describing which resources are of interest (ext, type (string or UInt8Array) and ignore (boolean)) -

-

- Identify files or content of interest from an Array of [page:LoaderSupport.ResourceDescriptor]. - Returns Object with each "ext" and the corresponding [page:LoaderSupport.ResourceDescriptor] -

- - -

[method:PrepData clone] ()

-

- Clones this object and returns it afterwards. Callbacks and resources are not cloned deep (references!). -

-
-
- - -

Callbacks

-

Constructor

- -

Callbacks()

-

- Callbacks utilized by loaders and builder. -

- - -

Methods

- -

[method:null setCallbackOnProgress]( [param:Function callbackOnProgress] )

-

- [page:Function callbackOnProgress] - Callback function for described functionality -

-

- Register callback function that is invoked by internal function "announceProgress" to print feedback. -

- -

[method:null setCallbackOnReportError]( [param:Function callbackOnReportError] )

-

- [page:Function callbackOnReportError] - Callback function for described functionality -

-

- Register callback function that is invoked when an error is reported. -

- -

[method:null setCallbackOnMeshAlter]( [param:Function callbackOnMeshAlter] )

-

- [page:Function callbackOnMeshAlter] - Callback function for described functionality -

-

- Register callback function that is called every time a mesh was loaded. - Use [page:LoadedMeshUserOverride] for alteration instructions (geometry, material or disregard mesh). -

- - -

[method:null setCallbackOnLoad]( [param:Function callbackOnLoad] )

-

- [page:Function callbackOnLoad] - Callback function for described functionality -

-

- Register callback function that is called once loading of the complete OBJ file is completed. -

- -

[method:null setCallbackOnLoadMaterials]( [param:Function callbackOnLoadMaterials] )

-

- [page:Function callbackOnLoadMaterials] - Callback function for described functionality -

-

- Register callback function that is called when materials have been loaded. -

-
-
- - -

Validator

-

Constructor

- -

Validator()

-

- Validation functions. -

- - -

Methods

- -

[method:Boolean isValid]( [param:Object input] )

-

- [page:Object input] - Can be anything -

-

- If given input is null or undefined, false is returned otherwise true. -

- - -

[method:null verifyInput]( [param:Object input], [param:Object defaultValue] )

-

- [page:Object input] - Can be anything
- [page:Object defaultValue] - Can be anything -

-

- If given input is null or undefined, the defaultValue is returned otherwise the given input. -

-
-
- -

Source

- -

- [link:https://github.com/mrdoob/three.js/blob/master/examples/js/loaders/LoaderSupport.js examples/js/loaders/LoaderSupport.js] -

- - - diff --git a/docs/examples/zh/loaders/MMDLoader.html b/docs/examples/zh/loaders/MMDLoader.html index 431aef4a74b147..b4ad1bd84ec060 100644 --- a/docs/examples/zh/loaders/MMDLoader.html +++ b/docs/examples/zh/loaders/MMDLoader.html @@ -9,6 +9,7 @@ [page:Loader] → +

MMD加载器([name])

一个用于加载MMD资源的加载器。

@@ -65,10 +66,11 @@

[name]( [param:LoadingManager manager] )

创建一个新的[name]。

-

属性

- +

属性

+

共有属性请参见其基类[page:Loader]。

-

方法

+

方法

+

共有方法请参见其基类[page:Loader]。

[method:null load]( [param:String url], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )

@@ -102,12 +104,7 @@

[method:null loadWithAnimation]( [param:String modelUrl], [param:String vmdU [page:Function onError] — (可选)如果加载过程中发生错误时被调用的函数,该函数接受一个错误来作为参数。

- 开始从URL中加载PMD/PMX模型文件和VMD动画文件(可能有多个文件),并使用一个[page:Object] —— 包含有已解析的[page:SkinnedMesh]和适应[page:SkinnedMesh]的[page:AnimationClip],来触发回调函数。 -

- -

[method:MMDLoader setCrossOrigin]( [param:String crossOrigin] )

-

- [page:String crossOrigin] — crossOrigin字符串,用于实现CORS,以便从一个允许CORS的其它域加载url。 + 开始从URL中加载PMD/PMX模型文件和VMD动画文件(可能有多个文件),并使用一个[page:Object] —— 包含有已解析的[page:SkinnedMesh]和适应[page:SkinnedMesh]的[page:AnimationClip],来触发回调函数。

[method:MMDLoader setAnimationPath]( [param:String animationPath] )

@@ -118,22 +115,6 @@

[method:MMDLoader setAnimationPath]( [param:String animationPath] )

设置额外资源(例如贴图)的基础路径。

-

[method:MMDLoader setPath]( [param:String path] )

-

- [page:String path] — 基础路径。 -

-

- 设置用于加载文件的基础路径或URL。 -

- -

[method:MMDLoader setResourcePath]( [param:String resourcePath] )

-

- [page:String resourcePath] — 用于加载额外资源(例如贴图)的基础路径。 -

-

- 设置额外资源(例如贴图)的基础路径。 -

-

源代码

diff --git a/docs/examples/zh/loaders/MTLLoader.html b/docs/examples/zh/loaders/MTLLoader.html index 8028dcec1f5ac0..cb33f2009ffae4 100644 --- a/docs/examples/zh/loaders/MTLLoader.html +++ b/docs/examples/zh/loaders/MTLLoader.html @@ -8,6 +8,7 @@ + [page:Loader] →

[name]

@@ -27,10 +28,10 @@

[name]( [param:LoadingManager loadingManager] )

Properties

- +

See the base [page:Loader] class for common properties.

Methods

- +

See the base [page:Loader] class for common methods.

[method:null load]( [param:String url], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )

@@ -43,35 +44,6 @@

[method:null load]( [param:String url], [param:Function onLoad], [param:Func Begin loading from url and return the loaded material.

- -

[method:MTLLoader setPath]( [param:String path] )

-

- [page:String path] — required
-

-

- Set base path for MTL file. -

- - -

[method:MTLLoader setResourcePath]( [param:String path] )

-

- [page:String path] — required
-

-

- Set base path for additional resources like textures. If set, this path will be used as the base path. -

- - -

[method:MTLLoader setCrossOrigin]( [param:String value] )

-

- [page:String value] — required
-

-

- If set, assigns the [link:https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes crossOrigin] - attribute of the image to the value of *crossOrigin*, prior to starting the load. Default is *"anonymous"*. -

- -

[method:MTLLoader setMaterialOptions]( [param:Object options] )

[page:Object options] — required diff --git a/docs/examples/zh/loaders/TGALoader.html b/docs/examples/zh/loaders/TGALoader.html index 834d4e22f2b777..969b383e50cb4e 100644 --- a/docs/examples/zh/loaders/TGALoader.html +++ b/docs/examples/zh/loaders/TGALoader.html @@ -8,6 +8,8 @@ + [page:Loader] → +

[name]

A loader for loading a .tga resource.
@@ -62,8 +64,11 @@

[name]( [param:LoadingManager manager] )

Creates a new [name].

+

Properties

+

See the base [page:Loader] class for common properties.

Methods

+

See the base [page:Loader] class for common methods.

[method:DataTexture load]( [param:String url], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )

@@ -76,14 +81,6 @@

[method:DataTexture load]( [param:String url], [param:Function onLoad], [par Begin loading from url and pass the loaded [page:DataTexture texture] to onLoad. The [page:DataTexture texture] is also directly returned for immediate use (but may not be fully loaded).

-

[method:TGALoader setPath]( [param:String path] )

-

- [page:String path] — Base path. -

-

- Set the base path for the file. -

-

Source

diff --git a/docs/list.js b/docs/list.js index fd191b0d7d7a4d..06a3cc356592da 100644 --- a/docs/list.js +++ b/docs/list.js @@ -372,7 +372,6 @@ var list = { "MTLLoader": "examples/en/loaders/MTLLoader", "OBJLoader": "examples/en/loaders/OBJLoader", "OBJLoader2": "examples/en/loaders/OBJLoader2", - "LoaderSupport": "examples/en/loaders/LoaderSupport", "PCDLoader": "examples/en/loaders/PCDLoader", "PDBLoader": "examples/en/loaders/PDBLoader", "PRWMLoader": "examples/en/loaders/PRWMLoader", @@ -809,7 +808,6 @@ var list = { "MTLLoader": "examples/zh/loaders/MTLLoader", "OBJLoader": "examples/zh/loaders/OBJLoader", "OBJLoader2": "examples/zh/loaders/OBJLoader2", - "LoaderSupport": "examples/zh/loaders/LoaderSupport", "PCDLoader": "examples/zh/loaders/PCDLoader", "PDBLoader": "examples/zh/loaders/PDBLoader", "PRWMLoader": "examples/zh/loaders/PRWMLoader", diff --git a/examples/js/loaders/GLTFLoader.js b/examples/js/loaders/GLTFLoader.js index c071cec5240591..bd8c0c86fb95a1 100644 --- a/examples/js/loaders/GLTFLoader.js +++ b/examples/js/loaders/GLTFLoader.js @@ -10,29 +10,28 @@ THREE.GLTFLoader = ( function () { function GLTFLoader( manager ) { - this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager; + THREE.Loader.call( this, manager ); + this.dracoLoader = null; this.ddsLoader = null; } - GLTFLoader.prototype = { + GLTFLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype ), { constructor: GLTFLoader, - crossOrigin: 'anonymous', - load: function ( url, onLoad, onProgress, onError ) { var scope = this; var resourcePath; - if ( this.resourcePath !== undefined ) { + if ( this.resourcePath !== '' ) { resourcePath = this.resourcePath; - } else if ( this.path !== undefined ) { + } else if ( this.path !== '' ) { resourcePath = this.path; @@ -97,27 +96,6 @@ THREE.GLTFLoader = ( function () { }, - setCrossOrigin: function ( value ) { - - this.crossOrigin = value; - return this; - - }, - - setPath: function ( value ) { - - this.path = value; - return this; - - }, - - setResourcePath: function ( value ) { - - this.resourcePath = value; - return this; - - }, - setDRACOLoader: function ( dracoLoader ) { this.dracoLoader = dracoLoader; @@ -236,7 +214,7 @@ THREE.GLTFLoader = ( function () { } - }; + } ); /* GLTFREGISTRY */ @@ -726,7 +704,7 @@ THREE.GLTFLoader = ( function () { materialParams.vertexShader = shader.vertexShader; materialParams.fragmentShader = fragmentShader; materialParams.uniforms = uniforms; - materialParams.defines = { 'STANDARD': '' } + materialParams.defines = { 'STANDARD': '' }; materialParams.color = new THREE.Color( 1.0, 1.0, 1.0 ); materialParams.opacity = 1.0; @@ -1187,11 +1165,11 @@ THREE.GLTFLoader = ( function () { // Invalid URL if ( typeof url !== 'string' || url === '' ) return ''; - + // Host Relative URL if ( /^https?:\/\//i.test( path ) && /^\//.test( url ) ) { - path = path.replace( /(^https?:\/\/[^\/]+).*/i , '$1' ); + path = path.replace( /(^https?:\/\/[^\/]+).*/i, '$1' ); } @@ -1899,7 +1877,7 @@ THREE.GLTFLoader = ( function () { } - bufferAttribute = new THREE.InterleavedBufferAttribute( ib, itemSize, (byteOffset % byteStride) / elementBytes, normalized ); + bufferAttribute = new THREE.InterleavedBufferAttribute( ib, itemSize, ( byteOffset % byteStride ) / elementBytes, normalized ); } else { diff --git a/examples/js/loaders/MMDLoader.js b/examples/js/loaders/MMDLoader.js index f825c732e73662..6ade921f8659e2 100644 --- a/examples/js/loaders/MMDLoader.js +++ b/examples/js/loaders/MMDLoader.js @@ -36,7 +36,7 @@ THREE.MMDLoader = ( function () { */ function MMDLoader( manager ) { - this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager; + THREE.Loader.call( this, manager ); this.loader = new THREE.FileLoader( this.manager ); @@ -46,23 +46,10 @@ THREE.MMDLoader = ( function () { } - MMDLoader.prototype = { + MMDLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype ), { constructor: MMDLoader, - crossOrigin: 'anonymous', - - /** - * @param {string} crossOrigin - * @return {THREE.MMDLoader} - */ - setCrossOrigin: function ( crossOrigin ) { - - this.crossOrigin = crossOrigin; - return this; - - }, - /** * @param {string} animationPath * @return {THREE.MMDLoader} @@ -74,28 +61,6 @@ THREE.MMDLoader = ( function () { }, - /** - * @param {string} path - * @return {THREE.MMDLoader} - */ - setPath: function ( path ) { - - this.path = path; - return this; - - }, - - /** - * @param {string} resourcePath - * @return {THREE.MMDLoader} - */ - setResoucePath: function ( resourcePath ) { - - this.resourcePath = resourcePath; - return this; - - }, - // Load MMD assets as Three.js Object /** @@ -114,11 +79,11 @@ THREE.MMDLoader = ( function () { var resourcePath; - if ( this.resourcePath !== undefined ) { + if ( this.resourcePath !== '' ) { resourcePath = this.resourcePath; - } else if ( this.path !== undefined ) { + } else if ( this.path !== '' ) { resourcePath = this.path; @@ -340,7 +305,7 @@ THREE.MMDLoader = ( function () { } - }; + } ); // Utilities diff --git a/examples/js/loaders/MTLLoader.js b/examples/js/loaders/MTLLoader.js index 4e7d9159a032d9..4620dfa95d0c7f 100644 --- a/examples/js/loaders/MTLLoader.js +++ b/examples/js/loaders/MTLLoader.js @@ -6,16 +6,14 @@ THREE.MTLLoader = function ( manager ) { - this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager; + THREE.Loader.call( this, manager ); }; -THREE.MTLLoader.prototype = { +THREE.MTLLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype ), { constructor: THREE.MTLLoader, - crossOrigin: 'anonymous', - /** * Loads and parses a MTL asset from a URL. * @@ -33,7 +31,7 @@ THREE.MTLLoader.prototype = { var scope = this; - var path = ( this.path === undefined ) ? THREE.LoaderUtils.extractUrlBase( url ) : this.path; + var path = ( this.path === '' ) ? THREE.LoaderUtils.extractUrlBase( url ) : this.path; var loader = new THREE.FileLoader( this.manager ); loader.setPath( this.path ); @@ -45,58 +43,6 @@ THREE.MTLLoader.prototype = { }, - /** - * Set base path for resolving references. - * If set this path will be prepended to each loaded and found reference. - * - * @see setResourcePath - * @param {String} path - * @return {THREE.MTLLoader} - * - * @example - * mtlLoader.setPath( 'assets/obj/' ); - * mtlLoader.load( 'my.mtl', ... ); - */ - setPath: function ( path ) { - - this.path = path; - return this; - - }, - - /** - * Set base path for additional resources like textures. - * - * @see setPath - * @param {String} path - * @return {THREE.MTLLoader} - * - * @example - * mtlLoader.setPath( 'assets/obj/' ); - * mtlLoader.setResourcePath( 'assets/textures/' ); - * mtlLoader.load( 'my.mtl', ... ); - */ - setResourcePath: function ( path ) { - - this.resourcePath = path; - return this; - - }, - - setTexturePath: function ( path ) { - - console.warn( 'THREE.MTLLoader: .setTexturePath() has been renamed to .setResourcePath().' ); - return this.setResourcePath( path ); - - }, - - setCrossOrigin: function ( value ) { - - this.crossOrigin = value; - return this; - - }, - setMaterialOptions: function ( value ) { this.materialOptions = value; @@ -174,7 +120,7 @@ THREE.MTLLoader.prototype = { } -}; +} ); /** * Create a new THREE-MTLLoader.MaterialCreator diff --git a/examples/js/loaders/NRRDLoader.js b/examples/js/loaders/NRRDLoader.js index 1eaa5b53c18c51..28edafc8f0a6f4 100644 --- a/examples/js/loaders/NRRDLoader.js +++ b/examples/js/loaders/NRRDLoader.js @@ -4,12 +4,11 @@ THREE.NRRDLoader = function ( manager ) { - this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager; - + THREE.Loader.call( this, manager ); }; -THREE.NRRDLoader.prototype = { +THREE.NRRDLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype ), { constructor: THREE.NRRDLoader, @@ -28,13 +27,6 @@ THREE.NRRDLoader.prototype = { }, - setPath: function ( value ) { - - this.path = value; - return this; - - }, - parse: function ( data ) { // this parser is largely inspired from the XTK NRRD parser : https://github.com/xtk/X @@ -62,7 +54,7 @@ THREE.NRRDLoader.prototype = { switch ( type ) { - // 1 byte data types + // 1 byte data types case 'uchar': break; case 'schar': @@ -600,4 +592,4 @@ THREE.NRRDLoader.prototype = { } } -}; +} ); diff --git a/examples/js/loaders/TGALoader.js b/examples/js/loaders/TGALoader.js index b84c95941fc5f8..368d9723edb120 100644 --- a/examples/js/loaders/TGALoader.js +++ b/examples/js/loaders/TGALoader.js @@ -6,11 +6,11 @@ THREE.TGALoader = function ( manager ) { - this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager; + THREE.Loader.call( this, manager ); }; -THREE.TGALoader.prototype = { +THREE.TGALoader.prototype = Object.assign( Object.create( THREE.Loader.prototype ), { constructor: THREE.TGALoader, @@ -60,7 +60,7 @@ THREE.TGALoader.prototype = { } break; - // check colormap type + // check colormap type case TGA_TYPE_RGB: case TGA_TYPE_GREY: @@ -73,12 +73,12 @@ THREE.TGALoader.prototype = { } break; - // What the need of a file without data ? + // What the need of a file without data ? case TGA_TYPE_NO_DATA: console.error( 'THREE.TGALoader: No data.' ); - // Invalid type ? + // Invalid type ? default: console.error( 'THREE.TGALoader: Invalid type "%s".', header.image_type ); @@ -471,7 +471,7 @@ THREE.TGALoader.prototype = { flags: content[ offset ++ ] }; - // check tga if it is valid format + // check tga if it is valid format tgaCheckHeader( header ); @@ -538,13 +538,6 @@ THREE.TGALoader.prototype = { return useOffscreen ? canvas.transferToImageBitmap() : canvas; - }, - - setPath: function ( value ) { - - this.path = value; - return this; - } -}; +} ); diff --git a/examples/js/loaders/deprecated/LegacyGLTFLoader.js b/examples/js/loaders/deprecated/LegacyGLTFLoader.js index 7d8cb23b16e603..ee9bbe8793beec 100644 --- a/examples/js/loaders/deprecated/LegacyGLTFLoader.js +++ b/examples/js/loaders/deprecated/LegacyGLTFLoader.js @@ -9,27 +9,25 @@ THREE.LegacyGLTFLoader = ( function () { function LegacyGLTFLoader( manager ) { - this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager; + THREE.Loader.call( this, manager ); } - LegacyGLTFLoader.prototype = { + LegacyGLTFLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype ), { constructor: LegacyGLTFLoader, - crossOrigin: 'anonymous', - load: function ( url, onLoad, onProgress, onError ) { var scope = this; var resourcePath; - if ( this.resourcePath !== undefined ) { + if ( this.resourcePath !== '' ) { resourcePath = this.resourcePath; - } else if ( this.path !== undefined ) { + } else if ( this.path !== '' ) { resourcePath = this.path; @@ -52,26 +50,6 @@ THREE.LegacyGLTFLoader = ( function () { }, - setCrossOrigin: function ( value ) { - - this.crossOrigin = value; - return this; - - }, - - setPath: function ( value ) { - - this.path = value; - - }, - - setResourcePath: function ( value ) { - - this.resourcePath = value; - return this; - - }, - parse: function ( data, path, callback ) { var content; @@ -121,7 +99,7 @@ THREE.LegacyGLTFLoader = ( function () { } - }; + } ); /* GLTFREGISTRY */ diff --git a/examples/js/loaders/deprecated/LegacyJSONLoader.js b/examples/js/loaders/deprecated/LegacyJSONLoader.js index 5fb0b94d984a0f..713cf4658d5f2a 100644 --- a/examples/js/loaders/deprecated/LegacyJSONLoader.js +++ b/examples/js/loaders/deprecated/LegacyJSONLoader.js @@ -14,21 +14,21 @@ THREE.LegacyJSONLoader = ( function () { } - this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager; + THREE.Loader.call( this, manager ); this.withCredentials = false; } - Object.assign( LegacyJSONLoader.prototype, { + LegacyJSONLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype ), { - crossOrigin: 'anonymous', + constructor: LegacyJSONLoader, load: function ( url, onLoad, onProgress, onError ) { var scope = this; - var path = ( this.path === undefined ) ? THREE.LoaderUtils.extractUrlBase( url ) : this.path; + var path = ( this.path === '' ) ? THREE.LoaderUtils.extractUrlBase( url ) : this.path; var loader = new THREE.FileLoader( this.manager ); loader.setPath( this.path ); @@ -62,27 +62,6 @@ THREE.LegacyJSONLoader = ( function () { }, - setPath: function ( value ) { - - this.path = value; - return this; - - }, - - setResourcePath: function ( value ) { - - this.resourcePath = value; - return this; - - }, - - setCrossOrigin: function ( value ) { - - this.crossOrigin = value; - return this; - - }, - parse: ( function () { var _BlendingMode = { @@ -144,7 +123,7 @@ THREE.LegacyJSONLoader = ( function () { break; case 'colorAmbient': case 'mapAmbient': - console.warn( 'THREE.Loader.createMaterial:', name, 'is no longer supported.' ); + console.warn( 'THREE.LegacyJSONLoader.createMaterial:', name, 'is no longer supported.' ); break; case 'colorDiffuse': json.color = _color.fromArray( value ).getHex(); @@ -256,7 +235,7 @@ THREE.LegacyJSONLoader = ( function () { json.side = THREE.DoubleSide; break; case 'transparency': - console.warn( 'THREE.Loader.createMaterial: transparency has been renamed to opacity' ); + console.warn( 'THREE.LegacyJSONLoader.createMaterial: transparency has been renamed to opacity' ); json.opacity = value; break; case 'depthTest': @@ -274,7 +253,7 @@ THREE.LegacyJSONLoader = ( function () { if ( value === 'face' ) json.vertexColors = THREE.FaceColors; break; default: - console.error( 'THREE.Loader.createMaterial: Unsupported', name, value ); + console.error( 'THREE.LegacyJSONLoader.createMaterial: Unsupported', name, value ); break; } diff --git a/examples/jsm/loaders/GLTFLoader.d.ts b/examples/jsm/loaders/GLTFLoader.d.ts index 0222c47b62c860..e7c89ae8ec00dd 100644 --- a/examples/jsm/loaders/GLTFLoader.d.ts +++ b/examples/jsm/loaders/GLTFLoader.d.ts @@ -1,6 +1,7 @@ import { AnimationClip, Camera, + Loader, LoadingManager, Scene } from '../../../src/Three'; @@ -16,19 +17,12 @@ export interface GLTF { asset: object; } -export class GLTFLoader { +export class GLTFLoader extends Loader { constructor(manager?: LoadingManager); - manager: LoadingManager; dracoLoader: DRACOLoader | null; ddsLoader: DDSLoader | null; - path: string; - crossOrigin: string; - resourcePath: string; load(url: string, onLoad: (gltf: GLTF) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void) : void; - setPath(path: string) : GLTFLoader; - setResourcePath(path: string) : GLTFLoader; - setCrossOrigin(value: string): GLTFLoader; setDRACOLoader(dracoLoader: DRACOLoader): GLTFLoader; setDDSLoader(ddsLoader: DDSLoader): GLTFLoader; parse(data: ArrayBuffer | string, path: string, onLoad: (gltf: GLTF) => void, onError?: (event: ErrorEvent) => void) : void; diff --git a/examples/jsm/loaders/GLTFLoader.js b/examples/jsm/loaders/GLTFLoader.js index 472c68531bd7a1..adf5cddce42126 100644 --- a/examples/jsm/loaders/GLTFLoader.js +++ b/examples/jsm/loaders/GLTFLoader.js @@ -13,7 +13,6 @@ import { BufferGeometry, ClampToEdgeWrapping, Color, - DefaultLoadingManager, DirectionalLight, DoubleSide, FileLoader, @@ -75,29 +74,28 @@ var GLTFLoader = ( function () { function GLTFLoader( manager ) { - this.manager = ( manager !== undefined ) ? manager : DefaultLoadingManager; + Loader.call( this, manager ); + this.dracoLoader = null; this.ddsLoader = null; } - GLTFLoader.prototype = { + GLTFLoader.prototype = Object.assign( Object.create( Loader.prototype ), { constructor: GLTFLoader, - crossOrigin: 'anonymous', - load: function ( url, onLoad, onProgress, onError ) { var scope = this; var resourcePath; - if ( this.resourcePath !== undefined ) { + if ( this.resourcePath !== '' ) { resourcePath = this.resourcePath; - } else if ( this.path !== undefined ) { + } else if ( this.path !== '' ) { resourcePath = this.path; @@ -162,27 +160,6 @@ var GLTFLoader = ( function () { }, - setCrossOrigin: function ( value ) { - - this.crossOrigin = value; - return this; - - }, - - setPath: function ( value ) { - - this.path = value; - return this; - - }, - - setResourcePath: function ( value ) { - - this.resourcePath = value; - return this; - - }, - setDRACOLoader: function ( dracoLoader ) { this.dracoLoader = dracoLoader; @@ -301,7 +278,7 @@ var GLTFLoader = ( function () { } - }; + } ); /* GLTFREGISTRY */ @@ -791,7 +768,7 @@ var GLTFLoader = ( function () { materialParams.vertexShader = shader.vertexShader; materialParams.fragmentShader = fragmentShader; materialParams.uniforms = uniforms; - materialParams.defines = { 'STANDARD': '' } + materialParams.defines = { 'STANDARD': '' }; materialParams.color = new Color( 1.0, 1.0, 1.0 ); materialParams.opacity = 1.0; @@ -1252,11 +1229,11 @@ var GLTFLoader = ( function () { // Invalid URL if ( typeof url !== 'string' || url === '' ) return ''; - + // Host Relative URL if ( /^https?:\/\//i.test( path ) && /^\//.test( url ) ) { - path = path.replace( /(^https?:\/\/[^\/]+).*/i , '$1' ); + path = path.replace( /(^https?:\/\/[^\/]+).*/i, '$1' ); } @@ -1964,7 +1941,7 @@ var GLTFLoader = ( function () { } - bufferAttribute = new InterleavedBufferAttribute( ib, itemSize, (byteOffset % byteStride) / elementBytes, normalized ); + bufferAttribute = new InterleavedBufferAttribute( ib, itemSize, ( byteOffset % byteStride ) / elementBytes, normalized ); } else { diff --git a/examples/jsm/loaders/MD2Loader.d.ts b/examples/jsm/loaders/MD2Loader.d.ts index 5aef9caa26e7dc..ab3a7021128982 100644 --- a/examples/jsm/loaders/MD2Loader.d.ts +++ b/examples/jsm/loaders/MD2Loader.d.ts @@ -1,14 +1,12 @@ import { BufferGeometry, + Loader, LoadingManager } from '../../../src/Three'; -export class MD2Loader { +export class MD2Loader extends Loader { constructor(manager?: LoadingManager); - manager: LoadingManager; - path: string; load(url: string, onLoad: (geometry: BufferGeometry) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void): void; - setPath(path: string): this; parse(data: ArrayBuffer): BufferGeometry; } diff --git a/examples/jsm/loaders/MMDLoader.d.ts b/examples/jsm/loaders/MMDLoader.d.ts index 1aaa53d0fea45b..70de07275d2b4d 100644 --- a/examples/jsm/loaders/MMDLoader.d.ts +++ b/examples/jsm/loaders/MMDLoader.d.ts @@ -1,6 +1,7 @@ import { AnimationClip, FileLoader, + Loader, LoadingManager, SkinnedMesh } from '../../../src/Three'; @@ -10,17 +11,13 @@ export interface MMDLoaderAnimationObject { mesh: SkinnedMesh; } -export class MMDLoader { +export class MMDLoader extends Loader { constructor(manager?: LoadingManager); animationBuilder: object; animationPath: string; - crossOrigin: string; loader: FileLoader; - manager: LoadingManager; meshBuilder: object; - path: string; parser: object | null; - resourcePath: string; load(url: string, onLoad: (mesh: SkinnedMesh) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void): void; loadAnimation(url: string, onLoad: (object: SkinnedMesh | AnimationClip) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void): void; @@ -30,7 +27,4 @@ export class MMDLoader { loadVPD(url: string, onLoad: (object: object) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void): void; loadWithAnimation(url: string, vmdUrl: string | string[], onLoad: (object: MMDLoaderAnimationObject) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void): void; setAnimationPath(animationPath: string): this; - setCrossOrigin(crossOrigin: string): this; - setPath(path: string): this; - setResoucePath(resourcePath: string): this; } diff --git a/examples/jsm/loaders/MMDLoader.js b/examples/jsm/loaders/MMDLoader.js index 4547a9e25f9b1a..629196c7696649 100644 --- a/examples/jsm/loaders/MMDLoader.js +++ b/examples/jsm/loaders/MMDLoader.js @@ -36,7 +36,6 @@ import { BufferGeometry, Color, CustomBlending, - DefaultLoadingManager, DoubleSide, DstAlphaFactor, Euler, @@ -73,7 +72,7 @@ var MMDLoader = ( function () { */ function MMDLoader( manager ) { - this.manager = ( manager !== undefined ) ? manager : DefaultLoadingManager; + Loader.call( this, manager ); this.loader = new FileLoader( this.manager ); @@ -83,23 +82,10 @@ var MMDLoader = ( function () { } - MMDLoader.prototype = { + MMDLoader.prototype = Object.assign( Object.create( Loader.prototype ), { constructor: MMDLoader, - crossOrigin: 'anonymous', - - /** - * @param {string} crossOrigin - * @return {MMDLoader} - */ - setCrossOrigin: function ( crossOrigin ) { - - this.crossOrigin = crossOrigin; - return this; - - }, - /** * @param {string} animationPath * @return {MMDLoader} @@ -111,28 +97,6 @@ var MMDLoader = ( function () { }, - /** - * @param {string} path - * @return {MMDLoader} - */ - setPath: function ( path ) { - - this.path = path; - return this; - - }, - - /** - * @param {string} resourcePath - * @return {MMDLoader} - */ - setResoucePath: function ( resourcePath ) { - - this.resourcePath = resourcePath; - return this; - - }, - // Load MMD assets as Three.js Object /** @@ -151,11 +115,11 @@ var MMDLoader = ( function () { var resourcePath; - if ( this.resourcePath !== undefined ) { + if ( this.resourcePath !== '' ) { resourcePath = this.resourcePath; - } else if ( this.path !== undefined ) { + } else if ( this.path !== '' ) { resourcePath = this.path; @@ -377,7 +341,7 @@ var MMDLoader = ( function () { } - }; + } ); // Utilities diff --git a/examples/jsm/loaders/MTLLoader.d.ts b/examples/jsm/loaders/MTLLoader.d.ts index 43f8b10a5af48a..c5399dd78264d3 100644 --- a/examples/jsm/loaders/MTLLoader.d.ts +++ b/examples/jsm/loaders/MTLLoader.d.ts @@ -2,7 +2,7 @@ import { Material, LoadingManager, Mapping, - EventDispatcher, + Loader, BufferGeometry, Side, Texture, @@ -39,20 +39,13 @@ export interface MaterialCreatorOptions { invertTrProperty?: boolean; } -export class MTLLoader extends EventDispatcher { +export class MTLLoader extends Loader { constructor(manager?: LoadingManager); - manager: LoadingManager; materialOptions: MaterialCreatorOptions; - path: string; - texturePath: string; - crossOrigin: boolean; load(url: string, onLoad: (materialCreator: MaterialCreator) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void): void; parse(text: string) : MaterialCreator; - setPath(path: string) : void; - setTexturePath(path: string) : void; setBaseUrl(path: string) : void; - setCrossOrigin(value: boolean) : void; setMaterialOptions(value: MaterialCreatorOptions) : void; } diff --git a/examples/jsm/loaders/MTLLoader.js b/examples/jsm/loaders/MTLLoader.js index c1441d295e85ec..6d79a0e363060a 100644 --- a/examples/jsm/loaders/MTLLoader.js +++ b/examples/jsm/loaders/MTLLoader.js @@ -19,16 +19,14 @@ import { var MTLLoader = function ( manager ) { - this.manager = ( manager !== undefined ) ? manager : DefaultLoadingManager; + Loader.call( this, manager ); }; -MTLLoader.prototype = { +MTLLoader.prototype = Object.assign( Object.create( Loader.prototype ), { constructor: MTLLoader, - crossOrigin: 'anonymous', - /** * Loads and parses a MTL asset from a URL. * @@ -46,7 +44,7 @@ MTLLoader.prototype = { var scope = this; - var path = ( this.path === undefined ) ? LoaderUtils.extractUrlBase( url ) : this.path; + var path = ( this.path === '' ) ? LoaderUtils.extractUrlBase( url ) : this.path; var loader = new FileLoader( this.manager ); loader.setPath( this.path ); @@ -58,58 +56,6 @@ MTLLoader.prototype = { }, - /** - * Set base path for resolving references. - * If set this path will be prepended to each loaded and found reference. - * - * @see setResourcePath - * @param {String} path - * @return {MTLLoader} - * - * @example - * mtlLoader.setPath( 'assets/obj/' ); - * mtlLoader.load( 'my.mtl', ... ); - */ - setPath: function ( path ) { - - this.path = path; - return this; - - }, - - /** - * Set base path for additional resources like textures. - * - * @see setPath - * @param {String} path - * @return {MTLLoader} - * - * @example - * mtlLoader.setPath( 'assets/obj/' ); - * mtlLoader.setResourcePath( 'assets/textures/' ); - * mtlLoader.load( 'my.mtl', ... ); - */ - setResourcePath: function ( path ) { - - this.resourcePath = path; - return this; - - }, - - setTexturePath: function ( path ) { - - console.warn( 'THREE.MTLLoader: .setTexturePath() has been renamed to .setResourcePath().' ); - return this.setResourcePath( path ); - - }, - - setCrossOrigin: function ( value ) { - - this.crossOrigin = value; - return this; - - }, - setMaterialOptions: function ( value ) { this.materialOptions = value; @@ -187,7 +133,7 @@ MTLLoader.prototype = { } -}; +} ); /** * Create a new THREE-MTLLoader.MaterialCreator diff --git a/examples/jsm/loaders/NRRDLoader.js b/examples/jsm/loaders/NRRDLoader.js index c440d637172099..f0afb4ef37f3b1 100644 --- a/examples/jsm/loaders/NRRDLoader.js +++ b/examples/jsm/loaders/NRRDLoader.js @@ -3,8 +3,8 @@ */ import { - DefaultLoadingManager, FileLoader, + Loader, Matrix4, Vector3 } from "../../../build/three.module.js"; @@ -13,12 +13,11 @@ import { Volume } from "../misc/Volume.js"; var NRRDLoader = function ( manager ) { - this.manager = ( manager !== undefined ) ? manager : DefaultLoadingManager; - + Loader.call( this, manager ); }; -NRRDLoader.prototype = { +NRRDLoader.prototype = Object.assign( Object.create( Loader.prototype ), { constructor: NRRDLoader, @@ -37,13 +36,6 @@ NRRDLoader.prototype = { }, - setPath: function ( value ) { - - this.path = value; - return this; - - }, - parse: function ( data ) { // this parser is largely inspired from the XTK NRRD parser : https://github.com/xtk/X @@ -71,7 +63,7 @@ NRRDLoader.prototype = { switch ( type ) { - // 1 byte data types + // 1 byte data types case 'uchar': break; case 'schar': @@ -609,6 +601,6 @@ NRRDLoader.prototype = { } } -}; +} ); export { NRRDLoader }; diff --git a/examples/jsm/loaders/OBJLoader.d.ts b/examples/jsm/loaders/OBJLoader.d.ts index f1ce41fa50a208..e5d715292c17ec 100644 --- a/examples/jsm/loaders/OBJLoader.d.ts +++ b/examples/jsm/loaders/OBJLoader.d.ts @@ -1,5 +1,6 @@ import { Material, + Loader, LoadingManager, Group } from '../../../src/Three'; @@ -7,14 +8,11 @@ import { MaterialCreator } from './MTLLoader'; -export class OBJLoader { +export class OBJLoader extends Loader { constructor(manager?: LoadingManager); - manager: LoadingManager; materials: MaterialCreator; - path: string; load(url: string, onLoad: (group: Group) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void): void; parse(data: string) : Group; - setPath(value: string) : this; setMaterials(materials: MaterialCreator) : this; } diff --git a/examples/jsm/loaders/PCDLoader.d.ts b/examples/jsm/loaders/PCDLoader.d.ts index 775748df912946..ddd1b15789abf3 100644 --- a/examples/jsm/loaders/PCDLoader.d.ts +++ b/examples/jsm/loaders/PCDLoader.d.ts @@ -1,17 +1,14 @@ import { Points, + Lodaer, LoadingManager } from '../../../src/Three'; -export class PCDLoader { +export class PCDLoader extends Loader { constructor(manager?: LoadingManager); - manager: LoadingManager; littleEndian: boolean; - path: string; load(url: string, onLoad: (points: Points) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void) : void; - setPath(path: string) : this; - parse(data: ArrayBuffer | string, url: string) : Points; } diff --git a/examples/jsm/loaders/PDBLoader.d.ts b/examples/jsm/loaders/PDBLoader.d.ts index 1cdc7ac4802dde..86e037670a34c1 100644 --- a/examples/jsm/loaders/PDBLoader.d.ts +++ b/examples/jsm/loaders/PDBLoader.d.ts @@ -1,5 +1,6 @@ import { BufferGeometry, + Loader, LoadingManager } from '../../../src/Three'; @@ -13,13 +14,9 @@ export interface PDB { } -export class PDBLoader { +export class PDBLoader extends Loader { constructor(manager?: LoadingManager); - manager: LoadingManager; - path: string; load(url: string, onLoad: (pdb: PDB) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void) : void; - setPath(path: string) : this; - parse(text: string) : PDB; } diff --git a/examples/jsm/loaders/PRWMLoader.d.ts b/examples/jsm/loaders/PRWMLoader.d.ts index ed8dd552f72253..41ad6d492ef70d 100644 --- a/examples/jsm/loaders/PRWMLoader.d.ts +++ b/examples/jsm/loaders/PRWMLoader.d.ts @@ -1,16 +1,14 @@ import { BufferGeometry, + Loader, LoadingManager } from '../../../src/Three'; -export class PRWMLoader { +export class PRWMLoader extends Loader { constructor(manager?: LoadingManager); - manager: LoadingManager; - path: string; load(url: string, onLoad: (geometry: BufferGeometry) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void) : void; - setPath(path: string) : this; parse(data: ArrayBuffer) : BufferGeometry; static isBigEndianPlatform(): boolean; diff --git a/examples/jsm/loaders/SVGLoader.d.ts b/examples/jsm/loaders/SVGLoader.d.ts index ab2450af11e79b..076317de10964b 100644 --- a/examples/jsm/loaders/SVGLoader.d.ts +++ b/examples/jsm/loaders/SVGLoader.d.ts @@ -1,4 +1,5 @@ import { + Loader, LoadingManager, ShapePath, BufferGeometry, @@ -18,14 +19,10 @@ export interface StrokeStyle { strokeMiterLimit: number; } -export class SVGLoader { +export class SVGLoader extends Loader { constructor(manager?: LoadingManager); - manager: LoadingManager; - path: string; load(url: string, onLoad: (data: SVGResult) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void) : void; - setPath(path: string) : this; - parse(text: string) : SVGResult; static getStrokeStyle(width: number, color: string, lineJoin: string, lineCap: string, miterLimit: number): StrokeStyle; diff --git a/examples/jsm/loaders/TGALoader.d.ts b/examples/jsm/loaders/TGALoader.d.ts index cf4481a8bcc1e1..1fe0f5258c65d2 100644 --- a/examples/jsm/loaders/TGALoader.d.ts +++ b/examples/jsm/loaders/TGALoader.d.ts @@ -1,16 +1,12 @@ import { Texture, + Loader, LoadingManager } from '../../../src/Three'; - -export class TGALoader { +export class TGALoader extends Loader { constructor(manager?: LoadingManager); - manager: LoadingManager; - path: string; load(url: string, onLoad: (texture: Texture) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void) : void; - setPath(path: string) : this; - parse(data: ArrayBuffer) : Texture; } diff --git a/examples/jsm/loaders/TGALoader.js b/examples/jsm/loaders/TGALoader.js index b47435a599326e..ea499afe9d9eb0 100644 --- a/examples/jsm/loaders/TGALoader.js +++ b/examples/jsm/loaders/TGALoader.js @@ -5,18 +5,18 @@ */ import { - DefaultLoadingManager, FileLoader, + Loader, Texture } from "../../../build/three.module.js"; var TGALoader = function ( manager ) { - this.manager = ( manager !== undefined ) ? manager : DefaultLoadingManager; + Loader.call( this, manager ); }; -TGALoader.prototype = { +TGALoader.prototype = Object.assign( Object.create( Loader.prototype ), { constructor: TGALoader, @@ -66,7 +66,7 @@ TGALoader.prototype = { } break; - // check colormap type + // check colormap type case TGA_TYPE_RGB: case TGA_TYPE_GREY: @@ -79,12 +79,12 @@ TGALoader.prototype = { } break; - // What the need of a file without data ? + // What the need of a file without data ? case TGA_TYPE_NO_DATA: console.error( 'THREE.TGALoader: No data.' ); - // Invalid type ? + // Invalid type ? default: console.error( 'THREE.TGALoader: Invalid type "%s".', header.image_type ); @@ -477,7 +477,7 @@ TGALoader.prototype = { flags: content[ offset ++ ] }; - // check tga if it is valid format + // check tga if it is valid format tgaCheckHeader( header ); @@ -544,15 +544,8 @@ TGALoader.prototype = { return useOffscreen ? canvas.transferToImageBitmap() : canvas; - }, - - setPath: function ( value ) { - - this.path = value; - return this; - } -}; +} ); export { TGALoader }; diff --git a/examples/jsm/loaders/VTKLoader.d.ts b/examples/jsm/loaders/VTKLoader.d.ts index c0d5c4f2fe61ed..c7c411d822f8a3 100644 --- a/examples/jsm/loaders/VTKLoader.d.ts +++ b/examples/jsm/loaders/VTKLoader.d.ts @@ -1,15 +1,12 @@ import { BufferGeometry, + Loader, LoadingManager } from '../../../src/Three'; -export class VRMLLoader { +export class VRMLLoader extends Loader { constructor(manager?: LoadingManager); - manager: LoadingManager; - path: string; load(url: string, onLoad: (geometry: BufferGeometry) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void): void; - setPath(path: string): this; - parse(data: ArrayBuffer | string, path: string): BufferGeometry; } diff --git a/examples/jsm/loaders/deprecated/LegacyGLTFLoader.d.ts b/examples/jsm/loaders/deprecated/LegacyGLTFLoader.d.ts index d150ad815b1189..bd3a611b0feca5 100644 --- a/examples/jsm/loaders/deprecated/LegacyGLTFLoader.d.ts +++ b/examples/jsm/loaders/deprecated/LegacyGLTFLoader.d.ts @@ -1,6 +1,7 @@ import { AnimationClip, Camera, + Loader, LoadingManager, Scene } from '../../../../src/Three'; @@ -12,16 +13,9 @@ export interface GLTF { cameras: Camera[]; } -export class LegacyGLTFLoader { +export class LegacyGLTFLoader extends Loader { constructor(manager?: LoadingManager); - crossOrigin: string; - manager: LoadingManager; - path: string; - resourcePath: string; load(url: string, onLoad: (gltf: GLTF) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void): void; - setPath(path: string): this; - setResourcePath(path: string): this; - setCrossOrigin(value: string): this; parse(data: ArrayBuffer | string, path: string, callback: (gltf: GLTF) => void): void; } diff --git a/examples/jsm/loaders/deprecated/LegacyGLTFLoader.js b/examples/jsm/loaders/deprecated/LegacyGLTFLoader.js index 19ef4053d79e4a..5c59cae59c5255 100644 --- a/examples/jsm/loaders/deprecated/LegacyGLTFLoader.js +++ b/examples/jsm/loaders/deprecated/LegacyGLTFLoader.js @@ -19,7 +19,6 @@ import { ClampToEdgeWrapping, Color, CustomBlending, - DefaultLoadingManager, DirectionalLight, DoubleSide, DstAlphaFactor, @@ -100,27 +99,25 @@ var LegacyGLTFLoader = ( function () { function LegacyGLTFLoader( manager ) { - this.manager = ( manager !== undefined ) ? manager : DefaultLoadingManager; + Loader.call( this, manager ); } - LegacyGLTFLoader.prototype = { + LegacyGLTFLoader.prototype = Object.assign( Object.create( Loader.prototype ), { constructor: LegacyGLTFLoader, - crossOrigin: 'anonymous', - load: function ( url, onLoad, onProgress, onError ) { var scope = this; var resourcePath; - if ( this.resourcePath !== undefined ) { + if ( this.resourcePath !== '' ) { resourcePath = this.resourcePath; - } else if ( this.path !== undefined ) { + } else if ( this.path !== '' ) { resourcePath = this.path; @@ -143,26 +140,6 @@ var LegacyGLTFLoader = ( function () { }, - setCrossOrigin: function ( value ) { - - this.crossOrigin = value; - return this; - - }, - - setPath: function ( value ) { - - this.path = value; - - }, - - setResourcePath: function ( value ) { - - this.resourcePath = value; - return this; - - }, - parse: function ( data, path, callback ) { var content; @@ -212,7 +189,7 @@ var LegacyGLTFLoader = ( function () { } - }; + } ); /* GLTFREGISTRY */ diff --git a/examples/jsm/loaders/deprecated/LegacyJSONLoader.d.ts b/examples/jsm/loaders/deprecated/LegacyJSONLoader.d.ts index 9dc8ada786285b..33d442ef95a886 100644 --- a/examples/jsm/loaders/deprecated/LegacyJSONLoader.d.ts +++ b/examples/jsm/loaders/deprecated/LegacyJSONLoader.d.ts @@ -1,5 +1,6 @@ import { Geometry, + Loader, LoadingManager, Material } from '../../../../src/Three'; @@ -9,17 +10,10 @@ export interface LegacyJSONLoaderResult { materials: Material[]; } -export class LegacyJSONLoader { +export class LegacyJSONLoader extends Loader { constructor(manager?: LoadingManager); - crossOrigin: string; - manager: LoadingManager; - path: string; - resourcePath: string; withCredentials: boolean; load(url: string, onLoad: (object: LegacyJSONLoaderResult) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void): void; - setCrossOrigin(value: string): this; - setPath(value: string): this; - setResourcePath(value: string): this; parse(json: object, path: string): LegacyJSONLoaderResult; } diff --git a/examples/jsm/loaders/deprecated/LegacyJSONLoader.js b/examples/jsm/loaders/deprecated/LegacyJSONLoader.js index 8f7537db518d7b..def0ab0ff4c3ee 100644 --- a/examples/jsm/loaders/deprecated/LegacyJSONLoader.js +++ b/examples/jsm/loaders/deprecated/LegacyJSONLoader.js @@ -9,7 +9,6 @@ import { BackSide, Color, CustomBlending, - DefaultLoadingManager, DoubleSide, Face3, FaceColors, @@ -43,21 +42,21 @@ var LegacyJSONLoader = ( function () { } - this.manager = ( manager !== undefined ) ? manager : DefaultLoadingManager; + Loader.call( this, manager ); this.withCredentials = false; } - Object.assign( LegacyJSONLoader.prototype, { + LegacyJSONLoader.prototype = Object.assign( Object.create( Loader.prototype ), { - crossOrigin: 'anonymous', + constructor: LegacyJSONLoader, load: function ( url, onLoad, onProgress, onError ) { var scope = this; - var path = ( this.path === undefined ) ? LoaderUtils.extractUrlBase( url ) : this.path; + var path = ( this.path === '' ) ? LoaderUtils.extractUrlBase( url ) : this.path; var loader = new FileLoader( this.manager ); loader.setPath( this.path ); @@ -91,27 +90,6 @@ var LegacyJSONLoader = ( function () { }, - setPath: function ( value ) { - - this.path = value; - return this; - - }, - - setResourcePath: function ( value ) { - - this.resourcePath = value; - return this; - - }, - - setCrossOrigin: function ( value ) { - - this.crossOrigin = value; - return this; - - }, - parse: ( function () { var _BlendingMode = { @@ -173,7 +151,7 @@ var LegacyJSONLoader = ( function () { break; case 'colorAmbient': case 'mapAmbient': - console.warn( 'THREE.Loader.createMaterial:', name, 'is no longer supported.' ); + console.warn( 'THREE.LegacyJSONLoader.createMaterial:', name, 'is no longer supported.' ); break; case 'colorDiffuse': json.color = _color.fromArray( value ).getHex(); @@ -285,7 +263,7 @@ var LegacyJSONLoader = ( function () { json.side = DoubleSide; break; case 'transparency': - console.warn( 'THREE.Loader.createMaterial: transparency has been renamed to opacity' ); + console.warn( 'THREE.LegacyJSONLoader.createMaterial: transparency has been renamed to opacity' ); json.opacity = value; break; case 'depthTest': @@ -303,7 +281,7 @@ var LegacyJSONLoader = ( function () { if ( value === 'face' ) json.vertexColors = FaceColors; break; default: - console.error( 'THREE.Loader.createMaterial: Unsupported', name, value ); + console.error( 'THREE.LegacyJSONLoader.createMaterial: Unsupported', name, value ); break; } From 7d603a807723fa568a3beb2f2e01e20dff81c1c5 Mon Sep 17 00:00:00 2001 From: Mugen87 Date: Sat, 31 Aug 2019 17:32:31 +0200 Subject: [PATCH 27/75] Examples: Inherit from Loader IV. --- examples/js/loaders/HDRCubeTextureLoader.js | 157 +++++++++-------- examples/js/loaders/TTFLoader.js | 17 +- examples/js/loaders/VRMLoader.js | 30 +--- examples/js/loaders/XLoader.js | 34 +--- .../jsm/loaders/HDRCubeTextureLoader.d.ts | 6 +- examples/jsm/loaders/HDRCubeTextureLoader.js | 159 +++++++++--------- examples/jsm/loaders/MTLLoader.d.ts | 1 - examples/jsm/loaders/TTFLoader.d.ts | 7 +- examples/jsm/loaders/TTFLoader.js | 21 +-- examples/jsm/loaders/VRMLoader.d.ts | 13 +- examples/jsm/loaders/VRMLoader.js | 32 +--- examples/jsm/loaders/XLoader.d.ts | 12 +- examples/jsm/loaders/XLoader.js | 36 +--- 13 files changed, 193 insertions(+), 332 deletions(-) diff --git a/examples/js/loaders/HDRCubeTextureLoader.js b/examples/js/loaders/HDRCubeTextureLoader.js index ca49180cdde266..60a2962de0d990 100644 --- a/examples/js/loaders/HDRCubeTextureLoader.js +++ b/examples/js/loaders/HDRCubeTextureLoader.js @@ -5,134 +5,127 @@ THREE.HDRCubeTextureLoader = function ( manager ) { - this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager; + THREE.Loader.call( this, manager ); + this.hdrLoader = new THREE.RGBELoader(); this.type = THREE.UnsignedByteType; }; -THREE.HDRCubeTextureLoader.prototype.load = function ( urls, onLoad, onProgress, onError ) { +THREE.HDRCubeTextureLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype ), { - if ( ! Array.isArray( urls ) ) { + constructor: THREE.HDRCubeTextureLoader, - console.warn( 'THREE.HDRCubeTextureLoader signature has changed. Use .setDataType() instead.' ); + load: function ( urls, onLoad, onProgress, onError ) { - this.setDataType( urls ); + if ( ! Array.isArray( urls ) ) { - urls = onLoad; - onLoad = onProgress; - onProgress = onError; - onError = arguments[ 4 ]; + console.warn( 'THREE.HDRCubeTextureLoader signature has changed. Use .setDataType() instead.' ); - } + this.setDataType( urls ); - var texture = new THREE.CubeTexture(); + urls = onLoad; + onLoad = onProgress; + onProgress = onError; + onError = arguments[ 4 ]; - texture.type = this.type; + } - switch ( texture.type ) { + var texture = new THREE.CubeTexture(); - case THREE.UnsignedByteType: + texture.type = this.type; - texture.encoding = THREE.RGBEEncoding; - texture.format = THREE.RGBAFormat; - texture.minFilter = THREE.NearestFilter; - texture.magFilter = THREE.NearestFilter; - texture.generateMipmaps = false; - break; + switch ( texture.type ) { - case THREE.FloatType: + case THREE.UnsignedByteType: - texture.encoding = THREE.LinearEncoding; - texture.format = THREE.RGBFormat; - texture.minFilter = THREE.LinearFilter; - texture.magFilter = THREE.LinearFilter; - texture.generateMipmaps = false; - break; + texture.encoding = THREE.RGBEEncoding; + texture.format = THREE.RGBAFormat; + texture.minFilter = THREE.NearestFilter; + texture.magFilter = THREE.NearestFilter; + texture.generateMipmaps = false; + break; - case THREE.HalfFloatType: + case THREE.FloatType: - texture.encoding = THREE.LinearEncoding; - texture.format = THREE.RGBFormat; - texture.minFilter = THREE.LinearFilter; - texture.magFilter = THREE.LinearFilter; - texture.generateMipmaps = false; - break; + texture.encoding = THREE.LinearEncoding; + texture.format = THREE.RGBFormat; + texture.minFilter = THREE.LinearFilter; + texture.magFilter = THREE.LinearFilter; + texture.generateMipmaps = false; + break; - } + case THREE.HalfFloatType: - var scope = this; + texture.encoding = THREE.LinearEncoding; + texture.format = THREE.RGBFormat; + texture.minFilter = THREE.LinearFilter; + texture.magFilter = THREE.LinearFilter; + texture.generateMipmaps = false; + break; - var loaded = 0; + } - function loadHDRData( i, onLoad, onProgress, onError ) { + var scope = this; - new THREE.FileLoader( scope.manager ) - .setPath( scope.path ) - .setResponseType( 'arraybuffer' ) - .load( urls[ i ], function ( buffer ) { + var loaded = 0; - loaded ++; + function loadHDRData( i, onLoad, onProgress, onError ) { - var texData = scope.hdrLoader._parser( buffer ); + new THREE.FileLoader( scope.manager ) + .setPath( scope.path ) + .setResponseType( 'arraybuffer' ) + .load( urls[ i ], function ( buffer ) { - if ( ! texData ) return; + loaded ++; - if ( texData.data !== undefined ) { + var texData = scope.hdrLoader._parser( buffer ); - var dataTexture = new THREE.DataTexture( texData.data, texData.width, texData.height ); + if ( ! texData ) return; - dataTexture.type = texture.type; - dataTexture.encoding = texture.encoding; - dataTexture.format = texture.format; - dataTexture.minFilter = texture.minFilter; - dataTexture.magFilter = texture.magFilter; - dataTexture.generateMipmaps = texture.generateMipmaps; + if ( texData.data !== undefined ) { - texture.images[ i ] = dataTexture; + var dataTexture = new THREE.DataTexture( texData.data, texData.width, texData.height ); - } + dataTexture.type = texture.type; + dataTexture.encoding = texture.encoding; + dataTexture.format = texture.format; + dataTexture.minFilter = texture.minFilter; + dataTexture.magFilter = texture.magFilter; + dataTexture.generateMipmaps = texture.generateMipmaps; - if ( loaded === 6 ) { + texture.images[ i ] = dataTexture; - texture.needsUpdate = true; - if ( onLoad ) onLoad( texture ); + } - } + if ( loaded === 6 ) { - }, onProgress, onError ); + texture.needsUpdate = true; + if ( onLoad ) onLoad( texture ); - } + } - for ( var i = 0; i < urls.length; i ++ ) { + }, onProgress, onError ); - loadHDRData( i, onLoad, onProgress, onError ); + } - } + for ( var i = 0; i < urls.length; i ++ ) { - return texture; + loadHDRData( i, onLoad, onProgress, onError ); -}; + } -THREE.HDRCubeTextureLoader.prototype.setPath = function ( value ) { + return texture; - this.path = value; - return this; + }, -}; + setDataType: function ( value ) { -THREE.HDRCubeTextureLoader.prototype.setDataType = function ( value ) { + this.type = value; + this.hdrLoader.setDataType( value ); - this.type = value; - this.hdrLoader.setDataType( value ); - return this; + return this; -}; - -THREE.HDRCubeTextureLoader.prototype.setType = function ( value ) { - - console.warn( 'THREE.HDRCubeTextureLoader: .setType() has been renamed to .setDataType().' ); - - return this.setDataType( value ); + } -}; +} ); diff --git a/examples/js/loaders/TTFLoader.js b/examples/js/loaders/TTFLoader.js index c15c047acae612..b7842e2af88910 100644 --- a/examples/js/loaders/TTFLoader.js +++ b/examples/js/loaders/TTFLoader.js @@ -10,12 +10,14 @@ THREE.TTFLoader = function ( manager ) { - this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager; + THREE.Loader.call( this, manager ); + this.reversed = false; }; -THREE.TTFLoader.prototype = { + +THREE.TTFLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype ), { constructor: THREE.TTFLoader, @@ -34,13 +36,6 @@ THREE.TTFLoader.prototype = { }, - setPath: function ( value ) { - - this.path = value; - return this; - - }, - parse: function ( arraybuffer ) { function convert( font, reversed ) { @@ -49,7 +44,7 @@ THREE.TTFLoader.prototype = { var glyphs = {}; var scale = ( 100000 ) / ( ( font.unitsPerEm || 2048 ) * 72 ); - + var glyphIndexMap = font.encoding.cmap.glyphIndexMap; var unicodes = Object.keys( glyphIndexMap ); @@ -202,4 +197,4 @@ THREE.TTFLoader.prototype = { } -}; +} ); diff --git a/examples/js/loaders/VRMLoader.js b/examples/js/loaders/VRMLoader.js index 024f6db51e6189..791cfb68a7a1ad 100644 --- a/examples/js/loaders/VRMLoader.js +++ b/examples/js/loaders/VRMLoader.js @@ -17,17 +17,16 @@ THREE.VRMLoader = ( function () { } - this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager; + THREE.Loader.call( this, manager ); + this.gltfLoader = new THREE.GLTFLoader( this.manager ); } - VRMLoader.prototype = { + VRMLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype ), { constructor: VRMLoader, - crossOrigin: 'anonymous', - load: function ( url, onLoad, onProgress, onError ) { var scope = this; @@ -40,27 +39,6 @@ THREE.VRMLoader = ( function () { }, - setCrossOrigin: function ( value ) { - - this.glTFLoader.setCrossOrigin( value ); - return this; - - }, - - setPath: function ( value ) { - - this.glTFLoader.setPath( value ); - return this; - - }, - - setResourcePath: function ( value ) { - - this.glTFLoader.setResourcePath( value ); - return this; - - }, - setDRACOLoader: function ( dracoLoader ) { this.glTFLoader.setDRACOLoader( dracoLoader ); @@ -80,7 +58,7 @@ THREE.VRMLoader = ( function () { } - }; + } ); return VRMLoader; diff --git a/examples/js/loaders/XLoader.js b/examples/js/loaders/XLoader.js index 8f7157372da45a..71ff7a0fa07be1 100644 --- a/examples/js/loaders/XLoader.js +++ b/examples/js/loaders/XLoader.js @@ -201,10 +201,11 @@ THREE.XLoader = ( function () { function XLoader( manager ) { + THREE.Loader.call( this, manager ); + classCallCheck( this, XLoader ); this.debug = false; - this.manager = manager !== undefined ? manager : THREE.DefaultLoadingManager; this.texloader = new THREE.TextureLoader( this.manager ); this.url = ""; this._putMatLength = 0; @@ -228,9 +229,6 @@ THREE.XLoader = ( function () { } createClass( XLoader, [ { - key: 'crossOrigin', - value: 'anonymous' - }, { key: '_setArgOption', value: function _setArgOption( _arg ) { @@ -278,30 +276,6 @@ THREE.XLoader = ( function () { }, onProgress, onError ); - } - }, { - key: 'setCrossOrigin', - value: function setCrossOrigin( value ) { - - this.crossOrigin = value; - return this; - - } - }, { - key: 'setPath', - value: function setPath( value ) { - - this.path = value; - return this; - - } - }, { - key: 'setResourcePath', - value: function setResourcePath( value ) { - - this.resourcePath = value; - return this; - } }, { key: '_readLine', @@ -482,11 +456,11 @@ THREE.XLoader = ( function () { var path; - if ( this.resourcePath !== undefined ) { + if ( this.resourcePath !== '' ) { path = this.resourcePath; - } else if ( this.path !== undefined ) { + } else if ( this.path !== '' ) { path = this.path; diff --git a/examples/jsm/loaders/HDRCubeTextureLoader.d.ts b/examples/jsm/loaders/HDRCubeTextureLoader.d.ts index 99adc6833e9898..1b8426854f63c8 100644 --- a/examples/jsm/loaders/HDRCubeTextureLoader.d.ts +++ b/examples/jsm/loaders/HDRCubeTextureLoader.d.ts @@ -1,19 +1,17 @@ import { CubeTexture, + Loader, LoadingManager, TextureDataType } from '../../../src/Three'; import { RGBELoader } from './RGBELoader'; -export class HDRCubeTextureLoader { +export class HDRCubeTextureLoader extends Loader { constructor(manager?: LoadingManager); - manager: LoadingManager; hdrLoader: RGBELoader; - path: string; type: TextureDataType; load(urls: string[], onLoad: (texture: CubeTexture) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void): void; - setPath(value: string): this; setDataType(type: TextureDataType): this; } diff --git a/examples/jsm/loaders/HDRCubeTextureLoader.js b/examples/jsm/loaders/HDRCubeTextureLoader.js index 2c090efae736eb..eecec30cf56a48 100644 --- a/examples/jsm/loaders/HDRCubeTextureLoader.js +++ b/examples/jsm/loaders/HDRCubeTextureLoader.js @@ -6,12 +6,12 @@ import { CubeTexture, DataTexture, - DefaultLoadingManager, FileLoader, FloatType, HalfFloatType, LinearEncoding, LinearFilter, + Loader, NearestFilter, RGBAFormat, RGBEEncoding, @@ -22,136 +22,129 @@ import { RGBELoader } from "../loaders/RGBELoader.js"; var HDRCubeTextureLoader = function ( manager ) { - this.manager = ( manager !== undefined ) ? manager : DefaultLoadingManager; + Loader.call( this, manager ); + this.hdrLoader = new RGBELoader(); this.type = UnsignedByteType; }; -HDRCubeTextureLoader.prototype.load = function ( urls, onLoad, onProgress, onError ) { +HDRCubeTextureLoader.prototype = Object.assign( Object.create( Loader.prototype ), { - if ( ! Array.isArray( urls ) ) { + constructor: HDRCubeTextureLoader, - console.warn( 'THREE.HDRCubeTextureLoader signature has changed. Use .setDataType() instead.' ); + load: function ( urls, onLoad, onProgress, onError ) { - this.setDataType( urls ); + if ( ! Array.isArray( urls ) ) { - urls = onLoad; - onLoad = onProgress; - onProgress = onError; - onError = arguments[ 4 ]; + console.warn( 'THREE.HDRCubeTextureLoader signature has changed. Use .setDataType() instead.' ); - } + this.setDataType( urls ); - var texture = new CubeTexture(); + urls = onLoad; + onLoad = onProgress; + onProgress = onError; + onError = arguments[ 4 ]; - texture.type = this.type; + } - switch ( texture.type ) { + var texture = new CubeTexture(); - case UnsignedByteType: + texture.type = this.type; - texture.encoding = RGBEEncoding; - texture.format = RGBAFormat; - texture.minFilter = NearestFilter; - texture.magFilter = NearestFilter; - texture.generateMipmaps = false; - break; + switch ( texture.type ) { - case FloatType: + case UnsignedByteType: - texture.encoding = LinearEncoding; - texture.format = RGBFormat; - texture.minFilter = LinearFilter; - texture.magFilter = LinearFilter; - texture.generateMipmaps = false; - break; + texture.encoding = RGBEEncoding; + texture.format = RGBAFormat; + texture.minFilter = NearestFilter; + texture.magFilter = NearestFilter; + texture.generateMipmaps = false; + break; - case HalfFloatType: + case FloatType: - texture.encoding = LinearEncoding; - texture.format = RGBFormat; - texture.minFilter = LinearFilter; - texture.magFilter = LinearFilter; - texture.generateMipmaps = false; - break; + texture.encoding = LinearEncoding; + texture.format = RGBFormat; + texture.minFilter = LinearFilter; + texture.magFilter = LinearFilter; + texture.generateMipmaps = false; + break; - } + case HalfFloatType: - var scope = this; + texture.encoding = LinearEncoding; + texture.format = RGBFormat; + texture.minFilter = LinearFilter; + texture.magFilter = LinearFilter; + texture.generateMipmaps = false; + break; - var loaded = 0; + } - function loadHDRData( i, onLoad, onProgress, onError ) { + var scope = this; - new FileLoader( scope.manager ) - .setPath( scope.path ) - .setResponseType( 'arraybuffer' ) - .load( urls[ i ], function ( buffer ) { + var loaded = 0; - loaded ++; + function loadHDRData( i, onLoad, onProgress, onError ) { - var texData = scope.hdrLoader._parser( buffer ); + new FileLoader( scope.manager ) + .setPath( scope.path ) + .setResponseType( 'arraybuffer' ) + .load( urls[ i ], function ( buffer ) { - if ( ! texData ) return; + loaded ++; - if ( texData.data !== undefined ) { + var texData = scope.hdrLoader._parser( buffer ); - var dataTexture = new DataTexture( texData.data, texData.width, texData.height ); + if ( ! texData ) return; - dataTexture.type = texture.type; - dataTexture.encoding = texture.encoding; - dataTexture.format = texture.format; - dataTexture.minFilter = texture.minFilter; - dataTexture.magFilter = texture.magFilter; - dataTexture.generateMipmaps = texture.generateMipmaps; + if ( texData.data !== undefined ) { - texture.images[ i ] = dataTexture; + var dataTexture = new DataTexture( texData.data, texData.width, texData.height ); - } + dataTexture.type = texture.type; + dataTexture.encoding = texture.encoding; + dataTexture.format = texture.format; + dataTexture.minFilter = texture.minFilter; + dataTexture.magFilter = texture.magFilter; + dataTexture.generateMipmaps = texture.generateMipmaps; - if ( loaded === 6 ) { + texture.images[ i ] = dataTexture; - texture.needsUpdate = true; - if ( onLoad ) onLoad( texture ); + } - } + if ( loaded === 6 ) { - }, onProgress, onError ); + texture.needsUpdate = true; + if ( onLoad ) onLoad( texture ); - } + } - for ( var i = 0; i < urls.length; i ++ ) { + }, onProgress, onError ); - loadHDRData( i, onLoad, onProgress, onError ); + } - } + for ( var i = 0; i < urls.length; i ++ ) { - return texture; + loadHDRData( i, onLoad, onProgress, onError ); -}; + } -HDRCubeTextureLoader.prototype.setPath = function ( value ) { + return texture; - this.path = value; - return this; + }, -}; + setDataType: function ( value ) { -HDRCubeTextureLoader.prototype.setDataType = function ( value ) { + this.type = value; + this.hdrLoader.setDataType( value ); - this.type = value; - this.hdrLoader.setDataType( value ); - return this; + return this; -}; - -HDRCubeTextureLoader.prototype.setType = function ( value ) { - - console.warn( 'THREE.HDRCubeTextureLoader: .setType() has been renamed to .setDataType().' ); - - return this.setDataType( value ); + } -}; +} ); export { HDRCubeTextureLoader }; diff --git a/examples/jsm/loaders/MTLLoader.d.ts b/examples/jsm/loaders/MTLLoader.d.ts index c5399dd78264d3..da8af326ff11da 100644 --- a/examples/jsm/loaders/MTLLoader.d.ts +++ b/examples/jsm/loaders/MTLLoader.d.ts @@ -45,7 +45,6 @@ export class MTLLoader extends Loader { load(url: string, onLoad: (materialCreator: MaterialCreator) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void): void; parse(text: string) : MaterialCreator; - setBaseUrl(path: string) : void; setMaterialOptions(value: MaterialCreatorOptions) : void; } diff --git a/examples/jsm/loaders/TTFLoader.d.ts b/examples/jsm/loaders/TTFLoader.d.ts index 40c25011d41986..2c47dd06c182ca 100644 --- a/examples/jsm/loaders/TTFLoader.d.ts +++ b/examples/jsm/loaders/TTFLoader.d.ts @@ -1,16 +1,13 @@ import { BufferGeometry, + Loader, LoadingManager } from '../../../src/Three'; -export class TTFLoader { +export class TTFLoader extends Loader { constructor(manager?: LoadingManager); - manager: LoadingManager; - path: string; reversed: boolean; load(url: string, onLoad: (json: object) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void): void; - setPath(path: string): this; - parse(arraybuffer: ArrayBuffer): object; } diff --git a/examples/jsm/loaders/TTFLoader.js b/examples/jsm/loaders/TTFLoader.js index b4dc1dc6cd7aea..5ea06fa18ca7c6 100644 --- a/examples/jsm/loaders/TTFLoader.js +++ b/examples/jsm/loaders/TTFLoader.js @@ -9,18 +9,20 @@ */ import { - DefaultLoadingManager, - FileLoader + FileLoader, + Loader } from "../../../build/three.module.js"; var TTFLoader = function ( manager ) { - this.manager = ( manager !== undefined ) ? manager : DefaultLoadingManager; + Loader.call( this, manager ); + this.reversed = false; }; -TTFLoader.prototype = { + +TTFLoader.prototype = Object.assign( Object.create( Loader.prototype ), { constructor: TTFLoader, @@ -39,13 +41,6 @@ TTFLoader.prototype = { }, - setPath: function ( value ) { - - this.path = value; - return this; - - }, - parse: function ( arraybuffer ) { function convert( font, reversed ) { @@ -54,7 +49,7 @@ TTFLoader.prototype = { var glyphs = {}; var scale = ( 100000 ) / ( ( font.unitsPerEm || 2048 ) * 72 ); - + var glyphIndexMap = font.encoding.cmap.glyphIndexMap; var unicodes = Object.keys( glyphIndexMap ); @@ -207,6 +202,6 @@ TTFLoader.prototype = { } -}; +} ); export { TTFLoader }; diff --git a/examples/jsm/loaders/VRMLoader.d.ts b/examples/jsm/loaders/VRMLoader.d.ts index fbb04532ee4586..76004fa7ef887b 100644 --- a/examples/jsm/loaders/VRMLoader.d.ts +++ b/examples/jsm/loaders/VRMLoader.d.ts @@ -1,23 +1,16 @@ import { + Loader, LoadingManager } from '../../../src/Three'; import { GLTFLoader, GLTF } from './GLTFLoader'; import { DRACOLoader } from './DRACOLoader'; -export class VRMLoader { +export class VRMLoader extends Loader { constructor(manager?: LoadingManager); gltfLoader: GLTFLoader; - manager: LoadingManager; - path: string; - resourcePath: string; - crossOrigin: string; load(url: string, onLoad: (scene: GLTF) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void) : void; - setDRACOLoader(dracoLoader: DRACOLoader): this; - setPath(path: string): this; - setResourcePath(path: string): this; - setCrossOrigin(path: string): this; - parse(gltf: GLTF, onLoad: (scene: GLTF) => void): void; + setDRACOLoader(dracoLoader: DRACOLoader): this; } diff --git a/examples/jsm/loaders/VRMLoader.js b/examples/jsm/loaders/VRMLoader.js index a93cd8a77a902f..4a645508be2cbf 100644 --- a/examples/jsm/loaders/VRMLoader.js +++ b/examples/jsm/loaders/VRMLoader.js @@ -3,7 +3,7 @@ */ import { - DefaultLoadingManager + Loader } from "../../../build/three.module.js"; import { GLTFLoader } from "../loaders/GLTFLoader.js"; @@ -22,17 +22,16 @@ var VRMLoader = ( function () { } - this.manager = ( manager !== undefined ) ? manager : DefaultLoadingManager; + Loader.call( this, manager ); + this.gltfLoader = new GLTFLoader( this.manager ); } - VRMLoader.prototype = { + VRMLoader.prototype = Object.assign( Object.create( Loader.prototype ), { constructor: VRMLoader, - crossOrigin: 'anonymous', - load: function ( url, onLoad, onProgress, onError ) { var scope = this; @@ -45,27 +44,6 @@ var VRMLoader = ( function () { }, - setCrossOrigin: function ( value ) { - - this.glTFLoader.setCrossOrigin( value ); - return this; - - }, - - setPath: function ( value ) { - - this.glTFLoader.setPath( value ); - return this; - - }, - - setResourcePath: function ( value ) { - - this.glTFLoader.setResourcePath( value ); - return this; - - }, - setDRACOLoader: function ( dracoLoader ) { this.glTFLoader.setDRACOLoader( dracoLoader ); @@ -85,7 +63,7 @@ var VRMLoader = ( function () { } - }; + } ); return VRMLoader; diff --git a/examples/jsm/loaders/XLoader.d.ts b/examples/jsm/loaders/XLoader.d.ts index 9734567f0a038c..d972d7800a285e 100644 --- a/examples/jsm/loaders/XLoader.d.ts +++ b/examples/jsm/loaders/XLoader.d.ts @@ -1,5 +1,6 @@ import { Mesh, + Loader, LoadingManager } from '../../../src/Three'; @@ -8,16 +9,9 @@ export interface XResult { models: Mesh[]; } -export class VRMLLoader { +export class XLoader extends Loader { constructor(manager?: LoadingManager); - crossOrigin: string; - manager: LoadingManager; - path: string; - resourcePath: string; - load(url: string, onLoad: (object: object) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void): void; - setCrossOrigin(path: string): this; + load(url: string, onLoad: (object: XResult) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void): void; parse(data: ArrayBuffer | string, onLoad: (object: object) => void): object; - setPath(path: string): this; - setResourcePath(path: string): this; } diff --git a/examples/jsm/loaders/XLoader.js b/examples/jsm/loaders/XLoader.js index a55ce4592985e3..70c0d60425758f 100644 --- a/examples/jsm/loaders/XLoader.js +++ b/examples/jsm/loaders/XLoader.js @@ -7,10 +7,10 @@ import { AnimationMixer, Bone, BufferGeometry, - DefaultLoadingManager, FileLoader, Float32BufferAttribute, FrontSide, + Loader, LoaderUtils, Matrix4, Mesh, @@ -223,10 +223,11 @@ var XLoader = ( function () { function XLoader( manager ) { + Loader.call( this, manager ); + classCallCheck( this, XLoader ); this.debug = false; - this.manager = manager !== undefined ? manager : DefaultLoadingManager; this.texloader = new TextureLoader( this.manager ); this.url = ""; this._putMatLength = 0; @@ -250,9 +251,6 @@ var XLoader = ( function () { } createClass( XLoader, [ { - key: 'crossOrigin', - value: 'anonymous' - }, { key: '_setArgOption', value: function _setArgOption( _arg ) { @@ -300,30 +298,6 @@ var XLoader = ( function () { }, onProgress, onError ); - } - }, { - key: 'setCrossOrigin', - value: function setCrossOrigin( value ) { - - this.crossOrigin = value; - return this; - - } - }, { - key: 'setPath', - value: function setPath( value ) { - - this.path = value; - return this; - - } - }, { - key: 'setResourcePath', - value: function setResourcePath( value ) { - - this.resourcePath = value; - return this; - } }, { key: '_readLine', @@ -504,11 +478,11 @@ var XLoader = ( function () { var path; - if ( this.resourcePath !== undefined ) { + if ( this.resourcePath !== '' ) { path = this.resourcePath; - } else if ( this.path !== undefined ) { + } else if ( this.path !== '' ) { path = this.path; From 2f1f4c27ea22651d1c2a57e4d9bc26da795e74fc Mon Sep 17 00:00:00 2001 From: demi Date: Sat, 31 Aug 2019 22:05:15 +0300 Subject: [PATCH 28/75] add missing setFromObject method --- src/helpers/BoxHelper.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/helpers/BoxHelper.d.ts b/src/helpers/BoxHelper.d.ts index 662a383ecaca81..0de73c8a040a3a 100644 --- a/src/helpers/BoxHelper.d.ts +++ b/src/helpers/BoxHelper.d.ts @@ -8,4 +8,6 @@ export class BoxHelper extends LineSegments { update( object?: Object3D ): void; + setFromObject( object: Object3D ): this; + } From a04ba516b28a79136bfabf861693f17914dfd0a7 Mon Sep 17 00:00:00 2001 From: aardgoose Date: Sat, 31 Aug 2019 20:33:44 +0100 Subject: [PATCH 29/75] document length parameter behaviour --- .../en/core/bufferAttributeTypes/BufferAttributeTypes.html | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/api/en/core/bufferAttributeTypes/BufferAttributeTypes.html b/docs/api/en/core/bufferAttributeTypes/BufferAttributeTypes.html index 9c6e587327b8cd..de3addae7d08cf 100644 --- a/docs/api/en/core/bufferAttributeTypes/BufferAttributeTypes.html +++ b/docs/api/en/core/bufferAttributeTypes/BufferAttributeTypes.html @@ -33,9 +33,11 @@

Constructor

All of the above are called in the same way.

-

TypedBufferAttribute( [param:Array array], [param:Integer itemSize], [param:Boolean normalized] )

+

TypedBufferAttribute( [param:Array_or_Integer array], [param:Integer itemSize], [param:Boolean normalized] )

- array -- this can be a typed or untyped (normal) array. It will be converted to the Type specified.

+ array -- this can be a typed or untyped (normal) array or an integer length. + An array value will be converted to the Type specified. + If a length is given a new TypedArray will created, initialized with all elements set to zero.

itemSize -- the number of values of the array that should be associated with a particular vertex.

From c3d0a13276bae432d6c3814c7b3e636d9e9f679f Mon Sep 17 00:00:00 2001 From: Mugen87 Date: Sun, 1 Sep 2019 11:25:40 +0200 Subject: [PATCH 30/75] Docs: Fix link to example in TGALoader page. --- docs/examples/en/loaders/TGALoader.html | 2 +- docs/examples/zh/loaders/TGALoader.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/examples/en/loaders/TGALoader.html b/docs/examples/en/loaders/TGALoader.html index 969b383e50cb4e..1101c3b681adc8 100644 --- a/docs/examples/en/loaders/TGALoader.html +++ b/docs/examples/en/loaders/TGALoader.html @@ -52,7 +52,7 @@

Example

} ); - [example:webgl_materials_texture_tga] + [example:webgl_loader_texture_tga]

Constructor

diff --git a/docs/examples/zh/loaders/TGALoader.html b/docs/examples/zh/loaders/TGALoader.html index 969b383e50cb4e..1101c3b681adc8 100644 --- a/docs/examples/zh/loaders/TGALoader.html +++ b/docs/examples/zh/loaders/TGALoader.html @@ -52,7 +52,7 @@

Example

} ); - [example:webgl_materials_texture_tga] + [example:webgl_loader_texture_tga]

Constructor

From 84c3bd50b9901e474231e06e2f33101ad2f58435 Mon Sep 17 00:00:00 2001 From: Mugen87 Date: Sun, 1 Sep 2019 11:44:32 +0200 Subject: [PATCH 31/75] CompressedTextureLoader: Refactor parsing. --- examples/js/loaders/DDSLoader.js | 355 +++++++++++++------------ examples/js/loaders/KTXLoader.js | 31 +-- examples/js/loaders/PVRLoader.js | 42 +-- examples/jsm/loaders/DDSLoader.d.ts | 1 - examples/jsm/loaders/DDSLoader.js | 355 +++++++++++++------------ examples/jsm/loaders/KTXLoader.d.ts | 1 - examples/jsm/loaders/KTXLoader.js | 31 +-- examples/jsm/loaders/PVRLoader.d.ts | 3 +- examples/jsm/loaders/PVRLoader.js | 42 +-- src/loaders/CompressedTextureLoader.js | 7 +- 10 files changed, 433 insertions(+), 435 deletions(-) diff --git a/examples/js/loaders/DDSLoader.js b/examples/js/loaders/DDSLoader.js index 2f60f4b304356f..00f55527539b3f 100644 --- a/examples/js/loaders/DDSLoader.js +++ b/examples/js/loaders/DDSLoader.js @@ -6,267 +6,268 @@ THREE.DDSLoader = function ( manager ) { THREE.CompressedTextureLoader.call( this, manager ); - this._parser = THREE.DDSLoader.parse; - }; -THREE.DDSLoader.prototype = Object.create( THREE.CompressedTextureLoader.prototype ); -THREE.DDSLoader.prototype.constructor = THREE.DDSLoader; +THREE.DDSLoader.prototype = Object.assign( Object.create( THREE.CompressedTextureLoader.prototype ), { -THREE.DDSLoader.parse = function ( buffer, loadMipmaps ) { + constructor: THREE.DDSLoader, - var dds = { mipmaps: [], width: 0, height: 0, format: null, mipmapCount: 1 }; + parse: function ( buffer, loadMipmaps ) { - // Adapted from @toji's DDS utils - // https://github.com/toji/webgl-texture-utils/blob/master/texture-util/dds.js + var dds = { mipmaps: [], width: 0, height: 0, format: null, mipmapCount: 1 }; - // All values and structures referenced from: - // http://msdn.microsoft.com/en-us/library/bb943991.aspx/ + // Adapted from @toji's DDS utils + // https://github.com/toji/webgl-texture-utils/blob/master/texture-util/dds.js - var DDS_MAGIC = 0x20534444; + // All values and structures referenced from: + // http://msdn.microsoft.com/en-us/library/bb943991.aspx/ - var DDSD_CAPS = 0x1, - DDSD_HEIGHT = 0x2, - DDSD_WIDTH = 0x4, - DDSD_PITCH = 0x8, - DDSD_PIXELFORMAT = 0x1000, - DDSD_MIPMAPCOUNT = 0x20000, - DDSD_LINEARSIZE = 0x80000, - DDSD_DEPTH = 0x800000; + var DDS_MAGIC = 0x20534444; - var DDSCAPS_COMPLEX = 0x8, - DDSCAPS_MIPMAP = 0x400000, - DDSCAPS_TEXTURE = 0x1000; + var DDSD_CAPS = 0x1, + DDSD_HEIGHT = 0x2, + DDSD_WIDTH = 0x4, + DDSD_PITCH = 0x8, + DDSD_PIXELFORMAT = 0x1000, + DDSD_MIPMAPCOUNT = 0x20000, + DDSD_LINEARSIZE = 0x80000, + DDSD_DEPTH = 0x800000; - var DDSCAPS2_CUBEMAP = 0x200, - DDSCAPS2_CUBEMAP_POSITIVEX = 0x400, - DDSCAPS2_CUBEMAP_NEGATIVEX = 0x800, - DDSCAPS2_CUBEMAP_POSITIVEY = 0x1000, - DDSCAPS2_CUBEMAP_NEGATIVEY = 0x2000, - DDSCAPS2_CUBEMAP_POSITIVEZ = 0x4000, - DDSCAPS2_CUBEMAP_NEGATIVEZ = 0x8000, - DDSCAPS2_VOLUME = 0x200000; + var DDSCAPS_COMPLEX = 0x8, + DDSCAPS_MIPMAP = 0x400000, + DDSCAPS_TEXTURE = 0x1000; - var DDPF_ALPHAPIXELS = 0x1, - DDPF_ALPHA = 0x2, - DDPF_FOURCC = 0x4, - DDPF_RGB = 0x40, - DDPF_YUV = 0x200, - DDPF_LUMINANCE = 0x20000; + var DDSCAPS2_CUBEMAP = 0x200, + DDSCAPS2_CUBEMAP_POSITIVEX = 0x400, + DDSCAPS2_CUBEMAP_NEGATIVEX = 0x800, + DDSCAPS2_CUBEMAP_POSITIVEY = 0x1000, + DDSCAPS2_CUBEMAP_NEGATIVEY = 0x2000, + DDSCAPS2_CUBEMAP_POSITIVEZ = 0x4000, + DDSCAPS2_CUBEMAP_NEGATIVEZ = 0x8000, + DDSCAPS2_VOLUME = 0x200000; - function fourCCToInt32( value ) { + var DDPF_ALPHAPIXELS = 0x1, + DDPF_ALPHA = 0x2, + DDPF_FOURCC = 0x4, + DDPF_RGB = 0x40, + DDPF_YUV = 0x200, + DDPF_LUMINANCE = 0x20000; - return value.charCodeAt( 0 ) + - ( value.charCodeAt( 1 ) << 8 ) + - ( value.charCodeAt( 2 ) << 16 ) + - ( value.charCodeAt( 3 ) << 24 ); + function fourCCToInt32( value ) { - } + return value.charCodeAt( 0 ) + + ( value.charCodeAt( 1 ) << 8 ) + + ( value.charCodeAt( 2 ) << 16 ) + + ( value.charCodeAt( 3 ) << 24 ); - function int32ToFourCC( value ) { + } - return String.fromCharCode( - value & 0xff, - ( value >> 8 ) & 0xff, - ( value >> 16 ) & 0xff, - ( value >> 24 ) & 0xff - ); + function int32ToFourCC( value ) { - } + return String.fromCharCode( + value & 0xff, + ( value >> 8 ) & 0xff, + ( value >> 16 ) & 0xff, + ( value >> 24 ) & 0xff + ); - function loadARGBMip( buffer, dataOffset, width, height ) { + } + + function loadARGBMip( buffer, dataOffset, width, height ) { - var dataLength = width * height * 4; - var srcBuffer = new Uint8Array( buffer, dataOffset, dataLength ); - var byteArray = new Uint8Array( dataLength ); - var dst = 0; - var src = 0; - for ( var y = 0; y < height; y ++ ) { + var dataLength = width * height * 4; + var srcBuffer = new Uint8Array( buffer, dataOffset, dataLength ); + var byteArray = new Uint8Array( dataLength ); + var dst = 0; + var src = 0; + for ( var y = 0; y < height; y ++ ) { - for ( var x = 0; x < width; x ++ ) { + for ( var x = 0; x < width; x ++ ) { - var b = srcBuffer[ src ]; src ++; - var g = srcBuffer[ src ]; src ++; - var r = srcBuffer[ src ]; src ++; - var a = srcBuffer[ src ]; src ++; - byteArray[ dst ] = r; dst ++; //r - byteArray[ dst ] = g; dst ++; //g - byteArray[ dst ] = b; dst ++; //b - byteArray[ dst ] = a; dst ++; //a + var b = srcBuffer[ src ]; src ++; + var g = srcBuffer[ src ]; src ++; + var r = srcBuffer[ src ]; src ++; + var a = srcBuffer[ src ]; src ++; + byteArray[ dst ] = r; dst ++; //r + byteArray[ dst ] = g; dst ++; //g + byteArray[ dst ] = b; dst ++; //b + byteArray[ dst ] = a; dst ++; //a + + } } + return byteArray; } - return byteArray; - } + var FOURCC_DXT1 = fourCCToInt32( "DXT1" ); + var FOURCC_DXT3 = fourCCToInt32( "DXT3" ); + var FOURCC_DXT5 = fourCCToInt32( "DXT5" ); + var FOURCC_ETC1 = fourCCToInt32( "ETC1" ); - var FOURCC_DXT1 = fourCCToInt32( "DXT1" ); - var FOURCC_DXT3 = fourCCToInt32( "DXT3" ); - var FOURCC_DXT5 = fourCCToInt32( "DXT5" ); - var FOURCC_ETC1 = fourCCToInt32( "ETC1" ); + var headerLengthInt = 31; // The header length in 32 bit ints - var headerLengthInt = 31; // The header length in 32 bit ints + // Offsets into the header array - // Offsets into the header array + var off_magic = 0; - var off_magic = 0; + var off_size = 1; + var off_flags = 2; + var off_height = 3; + var off_width = 4; - var off_size = 1; - var off_flags = 2; - var off_height = 3; - var off_width = 4; + var off_mipmapCount = 7; - var off_mipmapCount = 7; + var off_pfFlags = 20; + var off_pfFourCC = 21; + var off_RGBBitCount = 22; + var off_RBitMask = 23; + var off_GBitMask = 24; + var off_BBitMask = 25; + var off_ABitMask = 26; - var off_pfFlags = 20; - var off_pfFourCC = 21; - var off_RGBBitCount = 22; - var off_RBitMask = 23; - var off_GBitMask = 24; - var off_BBitMask = 25; - var off_ABitMask = 26; + var off_caps = 27; + var off_caps2 = 28; + var off_caps3 = 29; + var off_caps4 = 30; - var off_caps = 27; - var off_caps2 = 28; - var off_caps3 = 29; - var off_caps4 = 30; + // Parse header - // Parse header + var header = new Int32Array( buffer, 0, headerLengthInt ); - var header = new Int32Array( buffer, 0, headerLengthInt ); + if ( header[ off_magic ] !== DDS_MAGIC ) { - if ( header[ off_magic ] !== DDS_MAGIC ) { + console.error( 'THREE.DDSLoader.parse: Invalid magic number in DDS header.' ); + return dds; - console.error( 'THREE.DDSLoader.parse: Invalid magic number in DDS header.' ); - return dds; + } - } + if ( ! header[ off_pfFlags ] & DDPF_FOURCC ) { - if ( ! header[ off_pfFlags ] & DDPF_FOURCC ) { + console.error( 'THREE.DDSLoader.parse: Unsupported format, must contain a FourCC code.' ); + return dds; - console.error( 'THREE.DDSLoader.parse: Unsupported format, must contain a FourCC code.' ); - return dds; + } - } + var blockBytes; - var blockBytes; + var fourCC = header[ off_pfFourCC ]; - var fourCC = header[ off_pfFourCC ]; + var isRGBAUncompressed = false; - var isRGBAUncompressed = false; + switch ( fourCC ) { - switch ( fourCC ) { + case FOURCC_DXT1: - case FOURCC_DXT1: + blockBytes = 8; + dds.format = THREE.RGB_S3TC_DXT1_Format; + break; - blockBytes = 8; - dds.format = THREE.RGB_S3TC_DXT1_Format; - break; + case FOURCC_DXT3: - case FOURCC_DXT3: + blockBytes = 16; + dds.format = THREE.RGBA_S3TC_DXT3_Format; + break; - blockBytes = 16; - dds.format = THREE.RGBA_S3TC_DXT3_Format; - break; + case FOURCC_DXT5: - case FOURCC_DXT5: + blockBytes = 16; + dds.format = THREE.RGBA_S3TC_DXT5_Format; + break; - blockBytes = 16; - dds.format = THREE.RGBA_S3TC_DXT5_Format; - break; + case FOURCC_ETC1: - case FOURCC_ETC1: + blockBytes = 8; + dds.format = THREE.RGB_ETC1_Format; + break; - blockBytes = 8; - dds.format = THREE.RGB_ETC1_Format; - break; + default: - default: + if ( header[ off_RGBBitCount ] === 32 + && header[ off_RBitMask ] & 0xff0000 + && header[ off_GBitMask ] & 0xff00 + && header[ off_BBitMask ] & 0xff + && header[ off_ABitMask ] & 0xff000000 ) { - if ( header[ off_RGBBitCount ] === 32 - && header[ off_RBitMask ] & 0xff0000 - && header[ off_GBitMask ] & 0xff00 - && header[ off_BBitMask ] & 0xff - && header[ off_ABitMask ] & 0xff000000 ) { + isRGBAUncompressed = true; + blockBytes = 64; + dds.format = THREE.RGBAFormat; - isRGBAUncompressed = true; - blockBytes = 64; - dds.format = THREE.RGBAFormat; + } else { - } else { + console.error( 'THREE.DDSLoader.parse: Unsupported FourCC code ', int32ToFourCC( fourCC ) ); + return dds; - console.error( 'THREE.DDSLoader.parse: Unsupported FourCC code ', int32ToFourCC( fourCC ) ); - return dds; + } - } + } - } + dds.mipmapCount = 1; - dds.mipmapCount = 1; + if ( header[ off_flags ] & DDSD_MIPMAPCOUNT && loadMipmaps !== false ) { - if ( header[ off_flags ] & DDSD_MIPMAPCOUNT && loadMipmaps !== false ) { + dds.mipmapCount = Math.max( 1, header[ off_mipmapCount ] ); - dds.mipmapCount = Math.max( 1, header[ off_mipmapCount ] ); + } - } + var caps2 = header[ off_caps2 ]; + dds.isCubemap = caps2 & DDSCAPS2_CUBEMAP ? true : false; + if ( dds.isCubemap && ( + ! ( caps2 & DDSCAPS2_CUBEMAP_POSITIVEX ) || + ! ( caps2 & DDSCAPS2_CUBEMAP_NEGATIVEX ) || + ! ( caps2 & DDSCAPS2_CUBEMAP_POSITIVEY ) || + ! ( caps2 & DDSCAPS2_CUBEMAP_NEGATIVEY ) || + ! ( caps2 & DDSCAPS2_CUBEMAP_POSITIVEZ ) || + ! ( caps2 & DDSCAPS2_CUBEMAP_NEGATIVEZ ) + ) ) { - var caps2 = header[ off_caps2 ]; - dds.isCubemap = caps2 & DDSCAPS2_CUBEMAP ? true : false; - if ( dds.isCubemap && ( - ! ( caps2 & DDSCAPS2_CUBEMAP_POSITIVEX ) || - ! ( caps2 & DDSCAPS2_CUBEMAP_NEGATIVEX ) || - ! ( caps2 & DDSCAPS2_CUBEMAP_POSITIVEY ) || - ! ( caps2 & DDSCAPS2_CUBEMAP_NEGATIVEY ) || - ! ( caps2 & DDSCAPS2_CUBEMAP_POSITIVEZ ) || - ! ( caps2 & DDSCAPS2_CUBEMAP_NEGATIVEZ ) - ) ) { - - console.error( 'THREE.DDSLoader.parse: Incomplete cubemap faces' ); - return dds; + console.error( 'THREE.DDSLoader.parse: Incomplete cubemap faces' ); + return dds; - } + } - dds.width = header[ off_width ]; - dds.height = header[ off_height ]; + dds.width = header[ off_width ]; + dds.height = header[ off_height ]; - var dataOffset = header[ off_size ] + 4; + var dataOffset = header[ off_size ] + 4; - // Extract mipmaps buffers + // Extract mipmaps buffers - var faces = dds.isCubemap ? 6 : 1; + var faces = dds.isCubemap ? 6 : 1; - for ( var face = 0; face < faces; face ++ ) { + for ( var face = 0; face < faces; face ++ ) { - var width = dds.width; - var height = dds.height; + var width = dds.width; + var height = dds.height; - for ( var i = 0; i < dds.mipmapCount; i ++ ) { + for ( var i = 0; i < dds.mipmapCount; i ++ ) { - if ( isRGBAUncompressed ) { + if ( isRGBAUncompressed ) { - var byteArray = loadARGBMip( buffer, dataOffset, width, height ); - var dataLength = byteArray.length; + var byteArray = loadARGBMip( buffer, dataOffset, width, height ); + var dataLength = byteArray.length; - } else { + } else { - var dataLength = Math.max( 4, width ) / 4 * Math.max( 4, height ) / 4 * blockBytes; - var byteArray = new Uint8Array( buffer, dataOffset, dataLength ); + var dataLength = Math.max( 4, width ) / 4 * Math.max( 4, height ) / 4 * blockBytes; + var byteArray = new Uint8Array( buffer, dataOffset, dataLength ); - } + } + + var mipmap = { "data": byteArray, "width": width, "height": height }; + dds.mipmaps.push( mipmap ); - var mipmap = { "data": byteArray, "width": width, "height": height }; - dds.mipmaps.push( mipmap ); + dataOffset += dataLength; - dataOffset += dataLength; + width = Math.max( width >> 1, 1 ); + height = Math.max( height >> 1, 1 ); - width = Math.max( width >> 1, 1 ); - height = Math.max( height >> 1, 1 ); + } } - } + return dds; - return dds; + } -}; +} ); diff --git a/examples/js/loaders/KTXLoader.js b/examples/js/loaders/KTXLoader.js index 055fc51da1e3e6..d96d4af3871f43 100644 --- a/examples/js/loaders/KTXLoader.js +++ b/examples/js/loaders/KTXLoader.js @@ -12,27 +12,28 @@ THREE.KTXLoader = function ( manager ) { THREE.CompressedTextureLoader.call( this, manager ); - this._parser = THREE.KTXLoader.parse; - }; -THREE.KTXLoader.prototype = Object.create( THREE.CompressedTextureLoader.prototype ); -THREE.KTXLoader.prototype.constructor = THREE.KTXLoader; +THREE.KTXLoader.prototype = Object.assign( Object.create( THREE.CompressedTextureLoader.prototype ), { -THREE.KTXLoader.parse = function ( buffer, loadMipmaps ) { + constructor: THREE.KTXLoader, - var ktx = new KhronosTextureContainer( buffer, 1 ); + parse: function ( buffer, loadMipmaps ) { - return { - mipmaps: ktx.mipmaps( loadMipmaps ), - width: ktx.pixelWidth, - height: ktx.pixelHeight, - format: ktx.glInternalFormat, - isCubemap: ktx.numberOfFaces === 6, - mipmapCount: ktx.numberOfMipmapLevels - }; + var ktx = new KhronosTextureContainer( buffer, 1 ); -}; + return { + mipmaps: ktx.mipmaps( loadMipmaps ), + width: ktx.pixelWidth, + height: ktx.pixelHeight, + format: ktx.glInternalFormat, + isCubemap: ktx.numberOfFaces === 6, + mipmapCount: ktx.numberOfMipmapLevels + }; + + } + +} ); var KhronosTextureContainer = ( function () { diff --git a/examples/js/loaders/PVRLoader.js b/examples/js/loaders/PVRLoader.js index a4007eedf85b54..a5b89ad0caa069 100644 --- a/examples/js/loaders/PVRLoader.js +++ b/examples/js/loaders/PVRLoader.js @@ -12,44 +12,44 @@ THREE.PVRLoader = function ( manager ) { THREE.CompressedTextureLoader.call( this, manager ); - this._parser = THREE.PVRLoader.parse; - }; -THREE.PVRLoader.prototype = Object.create( THREE.CompressedTextureLoader.prototype ); -THREE.PVRLoader.prototype.constructor = THREE.PVRLoader; +THREE.PVRLoader.prototype = Object.assign( Object.create( THREE.CompressedTextureLoader.prototype ), { + constructor: THREE.PVRLoader, -THREE.PVRLoader.parse = function ( buffer, loadMipmaps ) { + parse: function ( buffer, loadMipmaps ) { - var headerLengthInt = 13; - var header = new Uint32Array( buffer, 0, headerLengthInt ); + var headerLengthInt = 13; + var header = new Uint32Array( buffer, 0, headerLengthInt ); - var pvrDatas = { - buffer: buffer, - header: header, - loadMipmaps: loadMipmaps - }; + var pvrDatas = { + buffer: buffer, + header: header, + loadMipmaps: loadMipmaps + }; - if ( header[ 0 ] === 0x03525650 ) { + if ( header[ 0 ] === 0x03525650 ) { - // PVR v3 + // PVR v3 - return THREE.PVRLoader._parseV3( pvrDatas ); + return THREE.PVRLoader._parseV3( pvrDatas ); - } else if ( header[ 11 ] === 0x21525650 ) { + } else if ( header[ 11 ] === 0x21525650 ) { - // PVR v2 + // PVR v2 - return THREE.PVRLoader._parseV2( pvrDatas ); + return THREE.PVRLoader._parseV2( pvrDatas ); - } else { + } else { - console.error( 'THREE.PVRLoader: Unknown PVR format.' ); + console.error( 'THREE.PVRLoader: Unknown PVR format.' ); + + } } -}; +} ); THREE.PVRLoader._parseV3 = function ( pvrDatas ) { diff --git a/examples/jsm/loaders/DDSLoader.d.ts b/examples/jsm/loaders/DDSLoader.d.ts index 81fcf1491e003f..aacb602f00ea38 100644 --- a/examples/jsm/loaders/DDSLoader.d.ts +++ b/examples/jsm/loaders/DDSLoader.d.ts @@ -18,5 +18,4 @@ export class DDSLoader extends CompressedTextureLoader { constructor(manager?: LoadingManager); parse(buffer: ArrayBuffer, loadMipmaps: boolean) : DDS; - _parser(buffer: ArrayBuffer, loadMipmaps: boolean) : DDS; } diff --git a/examples/jsm/loaders/DDSLoader.js b/examples/jsm/loaders/DDSLoader.js index 15a1fc087cc305..6d72ff6a551bd3 100644 --- a/examples/jsm/loaders/DDSLoader.js +++ b/examples/jsm/loaders/DDSLoader.js @@ -15,269 +15,270 @@ var DDSLoader = function ( manager ) { CompressedTextureLoader.call( this, manager ); - this._parser = DDSLoader.parse; - }; -DDSLoader.prototype = Object.create( CompressedTextureLoader.prototype ); -DDSLoader.prototype.constructor = DDSLoader; +DDSLoader.prototype = Object.assign( Object.create( CompressedTextureLoader.prototype ), { -DDSLoader.parse = function ( buffer, loadMipmaps ) { + constructor: DDSLoader, - var dds = { mipmaps: [], width: 0, height: 0, format: null, mipmapCount: 1 }; + parse: function ( buffer, loadMipmaps ) { - // Adapted from @toji's DDS utils - // https://github.com/toji/webgl-texture-utils/blob/master/texture-util/dds.js + var dds = { mipmaps: [], width: 0, height: 0, format: null, mipmapCount: 1 }; - // All values and structures referenced from: - // http://msdn.microsoft.com/en-us/library/bb943991.aspx/ + // Adapted from @toji's DDS utils + // https://github.com/toji/webgl-texture-utils/blob/master/texture-util/dds.js - var DDS_MAGIC = 0x20534444; + // All values and structures referenced from: + // http://msdn.microsoft.com/en-us/library/bb943991.aspx/ - var DDSD_CAPS = 0x1, - DDSD_HEIGHT = 0x2, - DDSD_WIDTH = 0x4, - DDSD_PITCH = 0x8, - DDSD_PIXELFORMAT = 0x1000, - DDSD_MIPMAPCOUNT = 0x20000, - DDSD_LINEARSIZE = 0x80000, - DDSD_DEPTH = 0x800000; + var DDS_MAGIC = 0x20534444; - var DDSCAPS_COMPLEX = 0x8, - DDSCAPS_MIPMAP = 0x400000, - DDSCAPS_TEXTURE = 0x1000; + var DDSD_CAPS = 0x1, + DDSD_HEIGHT = 0x2, + DDSD_WIDTH = 0x4, + DDSD_PITCH = 0x8, + DDSD_PIXELFORMAT = 0x1000, + DDSD_MIPMAPCOUNT = 0x20000, + DDSD_LINEARSIZE = 0x80000, + DDSD_DEPTH = 0x800000; - var DDSCAPS2_CUBEMAP = 0x200, - DDSCAPS2_CUBEMAP_POSITIVEX = 0x400, - DDSCAPS2_CUBEMAP_NEGATIVEX = 0x800, - DDSCAPS2_CUBEMAP_POSITIVEY = 0x1000, - DDSCAPS2_CUBEMAP_NEGATIVEY = 0x2000, - DDSCAPS2_CUBEMAP_POSITIVEZ = 0x4000, - DDSCAPS2_CUBEMAP_NEGATIVEZ = 0x8000, - DDSCAPS2_VOLUME = 0x200000; + var DDSCAPS_COMPLEX = 0x8, + DDSCAPS_MIPMAP = 0x400000, + DDSCAPS_TEXTURE = 0x1000; - var DDPF_ALPHAPIXELS = 0x1, - DDPF_ALPHA = 0x2, - DDPF_FOURCC = 0x4, - DDPF_RGB = 0x40, - DDPF_YUV = 0x200, - DDPF_LUMINANCE = 0x20000; + var DDSCAPS2_CUBEMAP = 0x200, + DDSCAPS2_CUBEMAP_POSITIVEX = 0x400, + DDSCAPS2_CUBEMAP_NEGATIVEX = 0x800, + DDSCAPS2_CUBEMAP_POSITIVEY = 0x1000, + DDSCAPS2_CUBEMAP_NEGATIVEY = 0x2000, + DDSCAPS2_CUBEMAP_POSITIVEZ = 0x4000, + DDSCAPS2_CUBEMAP_NEGATIVEZ = 0x8000, + DDSCAPS2_VOLUME = 0x200000; - function fourCCToInt32( value ) { + var DDPF_ALPHAPIXELS = 0x1, + DDPF_ALPHA = 0x2, + DDPF_FOURCC = 0x4, + DDPF_RGB = 0x40, + DDPF_YUV = 0x200, + DDPF_LUMINANCE = 0x20000; - return value.charCodeAt( 0 ) + - ( value.charCodeAt( 1 ) << 8 ) + - ( value.charCodeAt( 2 ) << 16 ) + - ( value.charCodeAt( 3 ) << 24 ); + function fourCCToInt32( value ) { - } + return value.charCodeAt( 0 ) + + ( value.charCodeAt( 1 ) << 8 ) + + ( value.charCodeAt( 2 ) << 16 ) + + ( value.charCodeAt( 3 ) << 24 ); - function int32ToFourCC( value ) { + } - return String.fromCharCode( - value & 0xff, - ( value >> 8 ) & 0xff, - ( value >> 16 ) & 0xff, - ( value >> 24 ) & 0xff - ); + function int32ToFourCC( value ) { - } + return String.fromCharCode( + value & 0xff, + ( value >> 8 ) & 0xff, + ( value >> 16 ) & 0xff, + ( value >> 24 ) & 0xff + ); - function loadARGBMip( buffer, dataOffset, width, height ) { + } + + function loadARGBMip( buffer, dataOffset, width, height ) { - var dataLength = width * height * 4; - var srcBuffer = new Uint8Array( buffer, dataOffset, dataLength ); - var byteArray = new Uint8Array( dataLength ); - var dst = 0; - var src = 0; - for ( var y = 0; y < height; y ++ ) { + var dataLength = width * height * 4; + var srcBuffer = new Uint8Array( buffer, dataOffset, dataLength ); + var byteArray = new Uint8Array( dataLength ); + var dst = 0; + var src = 0; + for ( var y = 0; y < height; y ++ ) { - for ( var x = 0; x < width; x ++ ) { + for ( var x = 0; x < width; x ++ ) { - var b = srcBuffer[ src ]; src ++; - var g = srcBuffer[ src ]; src ++; - var r = srcBuffer[ src ]; src ++; - var a = srcBuffer[ src ]; src ++; - byteArray[ dst ] = r; dst ++; //r - byteArray[ dst ] = g; dst ++; //g - byteArray[ dst ] = b; dst ++; //b - byteArray[ dst ] = a; dst ++; //a + var b = srcBuffer[ src ]; src ++; + var g = srcBuffer[ src ]; src ++; + var r = srcBuffer[ src ]; src ++; + var a = srcBuffer[ src ]; src ++; + byteArray[ dst ] = r; dst ++; //r + byteArray[ dst ] = g; dst ++; //g + byteArray[ dst ] = b; dst ++; //b + byteArray[ dst ] = a; dst ++; //a + + } } + return byteArray; } - return byteArray; - } + var FOURCC_DXT1 = fourCCToInt32( "DXT1" ); + var FOURCC_DXT3 = fourCCToInt32( "DXT3" ); + var FOURCC_DXT5 = fourCCToInt32( "DXT5" ); + var FOURCC_ETC1 = fourCCToInt32( "ETC1" ); - var FOURCC_DXT1 = fourCCToInt32( "DXT1" ); - var FOURCC_DXT3 = fourCCToInt32( "DXT3" ); - var FOURCC_DXT5 = fourCCToInt32( "DXT5" ); - var FOURCC_ETC1 = fourCCToInt32( "ETC1" ); + var headerLengthInt = 31; // The header length in 32 bit ints - var headerLengthInt = 31; // The header length in 32 bit ints + // Offsets into the header array - // Offsets into the header array + var off_magic = 0; - var off_magic = 0; + var off_size = 1; + var off_flags = 2; + var off_height = 3; + var off_width = 4; - var off_size = 1; - var off_flags = 2; - var off_height = 3; - var off_width = 4; + var off_mipmapCount = 7; - var off_mipmapCount = 7; + var off_pfFlags = 20; + var off_pfFourCC = 21; + var off_RGBBitCount = 22; + var off_RBitMask = 23; + var off_GBitMask = 24; + var off_BBitMask = 25; + var off_ABitMask = 26; - var off_pfFlags = 20; - var off_pfFourCC = 21; - var off_RGBBitCount = 22; - var off_RBitMask = 23; - var off_GBitMask = 24; - var off_BBitMask = 25; - var off_ABitMask = 26; + var off_caps = 27; + var off_caps2 = 28; + var off_caps3 = 29; + var off_caps4 = 30; - var off_caps = 27; - var off_caps2 = 28; - var off_caps3 = 29; - var off_caps4 = 30; + // Parse header - // Parse header + var header = new Int32Array( buffer, 0, headerLengthInt ); - var header = new Int32Array( buffer, 0, headerLengthInt ); + if ( header[ off_magic ] !== DDS_MAGIC ) { - if ( header[ off_magic ] !== DDS_MAGIC ) { + console.error( 'THREE.DDSLoader.parse: Invalid magic number in DDS header.' ); + return dds; - console.error( 'THREE.DDSLoader.parse: Invalid magic number in DDS header.' ); - return dds; + } - } + if ( ! header[ off_pfFlags ] & DDPF_FOURCC ) { - if ( ! header[ off_pfFlags ] & DDPF_FOURCC ) { + console.error( 'THREE.DDSLoader.parse: Unsupported format, must contain a FourCC code.' ); + return dds; - console.error( 'THREE.DDSLoader.parse: Unsupported format, must contain a FourCC code.' ); - return dds; + } - } + var blockBytes; - var blockBytes; + var fourCC = header[ off_pfFourCC ]; - var fourCC = header[ off_pfFourCC ]; + var isRGBAUncompressed = false; - var isRGBAUncompressed = false; + switch ( fourCC ) { - switch ( fourCC ) { + case FOURCC_DXT1: - case FOURCC_DXT1: + blockBytes = 8; + dds.format = RGB_S3TC_DXT1_Format; + break; - blockBytes = 8; - dds.format = RGB_S3TC_DXT1_Format; - break; + case FOURCC_DXT3: - case FOURCC_DXT3: + blockBytes = 16; + dds.format = RGBA_S3TC_DXT3_Format; + break; - blockBytes = 16; - dds.format = RGBA_S3TC_DXT3_Format; - break; + case FOURCC_DXT5: - case FOURCC_DXT5: + blockBytes = 16; + dds.format = RGBA_S3TC_DXT5_Format; + break; - blockBytes = 16; - dds.format = RGBA_S3TC_DXT5_Format; - break; + case FOURCC_ETC1: - case FOURCC_ETC1: + blockBytes = 8; + dds.format = RGB_ETC1_Format; + break; - blockBytes = 8; - dds.format = RGB_ETC1_Format; - break; + default: - default: + if ( header[ off_RGBBitCount ] === 32 + && header[ off_RBitMask ] & 0xff0000 + && header[ off_GBitMask ] & 0xff00 + && header[ off_BBitMask ] & 0xff + && header[ off_ABitMask ] & 0xff000000 ) { - if ( header[ off_RGBBitCount ] === 32 - && header[ off_RBitMask ] & 0xff0000 - && header[ off_GBitMask ] & 0xff00 - && header[ off_BBitMask ] & 0xff - && header[ off_ABitMask ] & 0xff000000 ) { + isRGBAUncompressed = true; + blockBytes = 64; + dds.format = RGBAFormat; - isRGBAUncompressed = true; - blockBytes = 64; - dds.format = RGBAFormat; + } else { - } else { + console.error( 'THREE.DDSLoader.parse: Unsupported FourCC code ', int32ToFourCC( fourCC ) ); + return dds; - console.error( 'THREE.DDSLoader.parse: Unsupported FourCC code ', int32ToFourCC( fourCC ) ); - return dds; + } - } + } - } + dds.mipmapCount = 1; - dds.mipmapCount = 1; + if ( header[ off_flags ] & DDSD_MIPMAPCOUNT && loadMipmaps !== false ) { - if ( header[ off_flags ] & DDSD_MIPMAPCOUNT && loadMipmaps !== false ) { + dds.mipmapCount = Math.max( 1, header[ off_mipmapCount ] ); - dds.mipmapCount = Math.max( 1, header[ off_mipmapCount ] ); + } - } + var caps2 = header[ off_caps2 ]; + dds.isCubemap = caps2 & DDSCAPS2_CUBEMAP ? true : false; + if ( dds.isCubemap && ( + ! ( caps2 & DDSCAPS2_CUBEMAP_POSITIVEX ) || + ! ( caps2 & DDSCAPS2_CUBEMAP_NEGATIVEX ) || + ! ( caps2 & DDSCAPS2_CUBEMAP_POSITIVEY ) || + ! ( caps2 & DDSCAPS2_CUBEMAP_NEGATIVEY ) || + ! ( caps2 & DDSCAPS2_CUBEMAP_POSITIVEZ ) || + ! ( caps2 & DDSCAPS2_CUBEMAP_NEGATIVEZ ) + ) ) { - var caps2 = header[ off_caps2 ]; - dds.isCubemap = caps2 & DDSCAPS2_CUBEMAP ? true : false; - if ( dds.isCubemap && ( - ! ( caps2 & DDSCAPS2_CUBEMAP_POSITIVEX ) || - ! ( caps2 & DDSCAPS2_CUBEMAP_NEGATIVEX ) || - ! ( caps2 & DDSCAPS2_CUBEMAP_POSITIVEY ) || - ! ( caps2 & DDSCAPS2_CUBEMAP_NEGATIVEY ) || - ! ( caps2 & DDSCAPS2_CUBEMAP_POSITIVEZ ) || - ! ( caps2 & DDSCAPS2_CUBEMAP_NEGATIVEZ ) - ) ) { - - console.error( 'THREE.DDSLoader.parse: Incomplete cubemap faces' ); - return dds; + console.error( 'THREE.DDSLoader.parse: Incomplete cubemap faces' ); + return dds; - } + } - dds.width = header[ off_width ]; - dds.height = header[ off_height ]; + dds.width = header[ off_width ]; + dds.height = header[ off_height ]; - var dataOffset = header[ off_size ] + 4; + var dataOffset = header[ off_size ] + 4; - // Extract mipmaps buffers + // Extract mipmaps buffers - var faces = dds.isCubemap ? 6 : 1; + var faces = dds.isCubemap ? 6 : 1; - for ( var face = 0; face < faces; face ++ ) { + for ( var face = 0; face < faces; face ++ ) { - var width = dds.width; - var height = dds.height; + var width = dds.width; + var height = dds.height; - for ( var i = 0; i < dds.mipmapCount; i ++ ) { + for ( var i = 0; i < dds.mipmapCount; i ++ ) { - if ( isRGBAUncompressed ) { + if ( isRGBAUncompressed ) { - var byteArray = loadARGBMip( buffer, dataOffset, width, height ); - var dataLength = byteArray.length; + var byteArray = loadARGBMip( buffer, dataOffset, width, height ); + var dataLength = byteArray.length; - } else { + } else { - var dataLength = Math.max( 4, width ) / 4 * Math.max( 4, height ) / 4 * blockBytes; - var byteArray = new Uint8Array( buffer, dataOffset, dataLength ); + var dataLength = Math.max( 4, width ) / 4 * Math.max( 4, height ) / 4 * blockBytes; + var byteArray = new Uint8Array( buffer, dataOffset, dataLength ); - } + } + + var mipmap = { "data": byteArray, "width": width, "height": height }; + dds.mipmaps.push( mipmap ); - var mipmap = { "data": byteArray, "width": width, "height": height }; - dds.mipmaps.push( mipmap ); + dataOffset += dataLength; - dataOffset += dataLength; + width = Math.max( width >> 1, 1 ); + height = Math.max( height >> 1, 1 ); - width = Math.max( width >> 1, 1 ); - height = Math.max( height >> 1, 1 ); + } } - } + return dds; - return dds; + } -}; +} ); export { DDSLoader }; diff --git a/examples/jsm/loaders/KTXLoader.d.ts b/examples/jsm/loaders/KTXLoader.d.ts index 26501c26d430e7..2358bb97005cf7 100644 --- a/examples/jsm/loaders/KTXLoader.d.ts +++ b/examples/jsm/loaders/KTXLoader.d.ts @@ -18,5 +18,4 @@ export class KTXLoader extends CompressedTextureLoader { constructor(manager?: LoadingManager); parse(buffer: ArrayBuffer, loadMipmaps: boolean) : KTX; - _parser(buffer: ArrayBuffer, loadMipmaps: boolean) : KTX; } diff --git a/examples/jsm/loaders/KTXLoader.js b/examples/jsm/loaders/KTXLoader.js index 09bfa55c200e78..a93cd80c0ad3c9 100644 --- a/examples/jsm/loaders/KTXLoader.js +++ b/examples/jsm/loaders/KTXLoader.js @@ -16,27 +16,28 @@ var KTXLoader = function ( manager ) { CompressedTextureLoader.call( this, manager ); - this._parser = KTXLoader.parse; - }; -KTXLoader.prototype = Object.create( CompressedTextureLoader.prototype ); -KTXLoader.prototype.constructor = KTXLoader; +KTXLoader.prototype = Object.assign( Object.create( CompressedTextureLoader.prototype ), { -KTXLoader.parse = function ( buffer, loadMipmaps ) { + constructor: KTXLoader, - var ktx = new KhronosTextureContainer( buffer, 1 ); + parse: function ( buffer, loadMipmaps ) { - return { - mipmaps: ktx.mipmaps( loadMipmaps ), - width: ktx.pixelWidth, - height: ktx.pixelHeight, - format: ktx.glInternalFormat, - isCubemap: ktx.numberOfFaces === 6, - mipmapCount: ktx.numberOfMipmapLevels - }; + var ktx = new KhronosTextureContainer( buffer, 1 ); -}; + return { + mipmaps: ktx.mipmaps( loadMipmaps ), + width: ktx.pixelWidth, + height: ktx.pixelHeight, + format: ktx.glInternalFormat, + isCubemap: ktx.numberOfFaces === 6, + mipmapCount: ktx.numberOfMipmapLevels + }; + + } + +} ); var KhronosTextureContainer = ( function () { diff --git a/examples/jsm/loaders/PVRLoader.d.ts b/examples/jsm/loaders/PVRLoader.d.ts index 3627a30048b444..addc7d7be10d17 100644 --- a/examples/jsm/loaders/PVRLoader.d.ts +++ b/examples/jsm/loaders/PVRLoader.d.ts @@ -16,6 +16,5 @@ export interface PVR { export class PVRLoader extends CompressedTextureLoader { constructor(manager?: LoadingManager); - parse(buffer: ArrayBuffer, loadMipmaps: boolean) : PVR; - _parser(buffer: ArrayBuffer, loadMipmaps: boolean) : PVR; + parse(buffer: ArrayBuffer, loadMipmaps: boolean): PVR; } diff --git a/examples/jsm/loaders/PVRLoader.js b/examples/jsm/loaders/PVRLoader.js index a35c2495c480ba..c20ec85a331127 100644 --- a/examples/jsm/loaders/PVRLoader.js +++ b/examples/jsm/loaders/PVRLoader.js @@ -20,44 +20,44 @@ var PVRLoader = function ( manager ) { CompressedTextureLoader.call( this, manager ); - this._parser = PVRLoader.parse; - }; -PVRLoader.prototype = Object.create( CompressedTextureLoader.prototype ); -PVRLoader.prototype.constructor = PVRLoader; +PVRLoader.prototype = Object.assign( Object.create( CompressedTextureLoader.prototype ), { + constructor: PVRLoader, -PVRLoader.parse = function ( buffer, loadMipmaps ) { + parse: function ( buffer, loadMipmaps ) { - var headerLengthInt = 13; - var header = new Uint32Array( buffer, 0, headerLengthInt ); + var headerLengthInt = 13; + var header = new Uint32Array( buffer, 0, headerLengthInt ); - var pvrDatas = { - buffer: buffer, - header: header, - loadMipmaps: loadMipmaps - }; + var pvrDatas = { + buffer: buffer, + header: header, + loadMipmaps: loadMipmaps + }; - if ( header[ 0 ] === 0x03525650 ) { + if ( header[ 0 ] === 0x03525650 ) { - // PVR v3 + // PVR v3 - return PVRLoader._parseV3( pvrDatas ); + return PVRLoader._parseV3( pvrDatas ); - } else if ( header[ 11 ] === 0x21525650 ) { + } else if ( header[ 11 ] === 0x21525650 ) { - // PVR v2 + // PVR v2 - return PVRLoader._parseV2( pvrDatas ); + return PVRLoader._parseV2( pvrDatas ); - } else { + } else { - console.error( 'THREE.PVRLoader: Unknown PVR format.' ); + console.error( 'THREE.PVRLoader: Unknown PVR format.' ); + + } } -}; +} ); PVRLoader._parseV3 = function ( pvrDatas ) { diff --git a/src/loaders/CompressedTextureLoader.js b/src/loaders/CompressedTextureLoader.js index c8b630a3c1b9da..ad64627e1622ce 100644 --- a/src/loaders/CompressedTextureLoader.js +++ b/src/loaders/CompressedTextureLoader.js @@ -13,9 +13,6 @@ function CompressedTextureLoader( manager ) { Loader.call( this, manager ); - // override in sub classes - this._parser = null; - } CompressedTextureLoader.prototype = Object.assign( Object.create( Loader.prototype ), { @@ -39,7 +36,7 @@ CompressedTextureLoader.prototype = Object.assign( Object.create( Loader.prototy loader.load( url[ i ], function ( buffer ) { - var texDatas = scope._parser( buffer, true ); + var texDatas = scope.parse( buffer, true ); images[ i ] = { width: texDatas.width, @@ -82,7 +79,7 @@ CompressedTextureLoader.prototype = Object.assign( Object.create( Loader.prototy loader.load( url, function ( buffer ) { - var texDatas = scope._parser( buffer, true ); + var texDatas = scope.parse( buffer, true ); if ( texDatas.isCubemap ) { From 37bafb56b39ea54fb1903ee7c4eaa2a1c71e0b34 Mon Sep 17 00:00:00 2001 From: Mugen87 Date: Sun, 1 Sep 2019 18:21:45 +0200 Subject: [PATCH 32/75] Examples: Inherit from Loader V. --- examples/js/loaders/LDrawLoader.js | 16 +++--------- examples/js/loaders/LWOLoader.js | 33 ++++--------------------- examples/jsm/loaders/LDrawLoader.d.ts | 6 ++--- examples/jsm/loaders/LDrawLoader.js | 18 +++----------- examples/jsm/loaders/LWOLoader.d.ts | 9 ++----- examples/jsm/loaders/LWOLoader.js | 35 +++++---------------------- 6 files changed, 22 insertions(+), 95 deletions(-) diff --git a/examples/js/loaders/LDrawLoader.js b/examples/js/loaders/LDrawLoader.js index 39c2672186c8ca..9a51861c3ee083 100644 --- a/examples/js/loaders/LDrawLoader.js +++ b/examples/js/loaders/LDrawLoader.js @@ -522,7 +522,7 @@ THREE.LDrawLoader = ( function () { function LDrawLoader( manager ) { - this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager; + THREE.Loader.call( this, manager ); // This is a stack of 'parse scopes' with one level per subobject loaded file. // Each level contains a material lib and also other runtime variables passed between parent and child subobjects @@ -530,8 +530,6 @@ THREE.LDrawLoader = ( function () { // Each material library is an object map keyed by colour codes. this.parseScopesStack = null; - this.path = ''; - // Array of THREE.Material this.materials = []; @@ -576,7 +574,7 @@ THREE.LDrawLoader = ( function () { LDrawLoader.FILE_LOCATION_TRY_ABSOLUTE = 5; LDrawLoader.FILE_LOCATION_NOT_FOUND = 6; - LDrawLoader.prototype = { + LDrawLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype ), { constructor: LDrawLoader, @@ -608,14 +606,6 @@ THREE.LDrawLoader = ( function () { }, - setPath: function ( value ) { - - this.path = value; - - return this; - - }, - setMaterials: function ( materials ) { // Clears parse scopes stack, adds new scope with material library @@ -1947,7 +1937,7 @@ THREE.LDrawLoader = ( function () { } - }; + } ); return LDrawLoader; diff --git a/examples/js/loaders/LWOLoader.js b/examples/js/loaders/LWOLoader.js index bbbe153c161fb4..722896af629343 100644 --- a/examples/js/loaders/LWOLoader.js +++ b/examples/js/loaders/LWOLoader.js @@ -2021,25 +2021,23 @@ var lwoTree; THREE.LWOLoader = function ( manager, parameters ) { - this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager; + THREE.Loader.call( this, manager ); parameters = parameters || {}; - this.resourcePath = ( parameters.resourcePath !== undefined ) ? parameters.resourcePath : undefined; + this.resourcePath = ( parameters.resourcePath !== undefined ) ? parameters.resourcePath : ''; }; -THREE.LWOLoader.prototype = { +THREE.LWOLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype ), { constructor: THREE.LWOLoader, - crossOrigin: 'anonymous', - load: function ( url, onLoad, onProgress, onError ) { var self = this; - var path = ( self.path === undefined ) ? extractParentUrl( url, 'Objects' ) : self.path; + var path = ( self.path === '' ) ? extractParentUrl( url, 'Objects' ) : self.path; // give the mesh a default name based on the filename var modelName = url.split( path ).pop().split( '.' )[ 0 ]; @@ -2058,27 +2056,6 @@ THREE.LWOLoader.prototype = { }, - setCrossOrigin: function ( value ) { - - this.crossOrigin = value; - return this; - - }, - - setPath: function ( value ) { - - this.path = value; - return this; - - }, - - setResourcePath: function ( value ) { - - this.resourcePath = value; - return this; - - }, - parse: function ( iffBuffer, path, modelName ) { lwoTree = new IFFParser().parse( iffBuffer ); @@ -2091,7 +2068,7 @@ THREE.LWOLoader.prototype = { } -}; +} ); // Parse the lwoTree object function LWOTreeParser( textureLoader ) { diff --git a/examples/jsm/loaders/LDrawLoader.d.ts b/examples/jsm/loaders/LDrawLoader.d.ts index c33cfcf68379cb..c7538d9652b352 100644 --- a/examples/jsm/loaders/LDrawLoader.d.ts +++ b/examples/jsm/loaders/LDrawLoader.d.ts @@ -1,16 +1,14 @@ import { + Loader, LoadingManager, Group, Material } from '../../../src/Three'; -export class LDrawLoader { +export class LDrawLoader extends Loader { constructor(manager?: LoadingManager); - manager: LoadingManager; - path: string; load(url: string, onLoad: (data: Group) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void) : void; - setPath(path: string) : this; setFileMap(fileMap: Record): void; setMaterials(materials: Material[]): void; diff --git a/examples/jsm/loaders/LDrawLoader.js b/examples/jsm/loaders/LDrawLoader.js index cea13fec934eba..9a0ea7f730d3e2 100644 --- a/examples/jsm/loaders/LDrawLoader.js +++ b/examples/jsm/loaders/LDrawLoader.js @@ -10,12 +10,12 @@ import { BufferAttribute, BufferGeometry, Color, - DefaultLoadingManager, FileLoader, Float32BufferAttribute, Group, LineBasicMaterial, LineSegments, + Loader, Matrix4, Mesh, MeshPhongMaterial, @@ -540,7 +540,7 @@ var LDrawLoader = ( function () { function LDrawLoader( manager ) { - this.manager = ( manager !== undefined ) ? manager : DefaultLoadingManager; + Loader.call( this, manager ); // This is a stack of 'parse scopes' with one level per subobject loaded file. // Each level contains a material lib and also other runtime variables passed between parent and child subobjects @@ -548,8 +548,6 @@ var LDrawLoader = ( function () { // Each material library is an object map keyed by colour codes. this.parseScopesStack = null; - this.path = ''; - // Array of THREE.Material this.materials = []; @@ -594,7 +592,7 @@ var LDrawLoader = ( function () { LDrawLoader.FILE_LOCATION_TRY_ABSOLUTE = 5; LDrawLoader.FILE_LOCATION_NOT_FOUND = 6; - LDrawLoader.prototype = { + LDrawLoader.prototype = Object.assign( Object.create( Loader.prototype ), { constructor: LDrawLoader, @@ -626,14 +624,6 @@ var LDrawLoader = ( function () { }, - setPath: function ( value ) { - - this.path = value; - - return this; - - }, - setMaterials: function ( materials ) { // Clears parse scopes stack, adds new scope with material library @@ -1965,7 +1955,7 @@ var LDrawLoader = ( function () { } - }; + } ); return LDrawLoader; diff --git a/examples/jsm/loaders/LWOLoader.d.ts b/examples/jsm/loaders/LWOLoader.d.ts index a54937d34d6b37..a1fd32ad1444f9 100644 --- a/examples/jsm/loaders/LWOLoader.d.ts +++ b/examples/jsm/loaders/LWOLoader.d.ts @@ -1,4 +1,5 @@ import { + Loader, LoadingManager, Material, Object3D @@ -18,15 +19,9 @@ export interface LWOLoaderParameters { } -export class LWOLoader { +export class LWOLoader extends Loader { constructor(manager?: LoadingManager, parameters?: LWOLoaderParameters); - crossOrigin: string; - path: string; - resourcePath: string; load(url: string, onLoad: (lwo: LWO) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void) : void; - setPath(path: string): this; - setResourcePath(path: string): this; - setCrossOrigin(value: string): this; parse(data: ArrayBuffer, path: string, modelName: string): LWO; } diff --git a/examples/jsm/loaders/LWOLoader.js b/examples/jsm/loaders/LWOLoader.js index ca1ab0f2578ebb..cb58987713d274 100644 --- a/examples/jsm/loaders/LWOLoader.js +++ b/examples/jsm/loaders/LWOLoader.js @@ -24,7 +24,6 @@ import { BufferGeometry, ClampToEdgeWrapping, Color, - DefaultLoadingManager, DoubleSide, EquirectangularReflectionMapping, EquirectangularRefractionMapping, @@ -33,6 +32,7 @@ import { FrontSide, LineBasicMaterial, LineSegments, + Loader, LoaderUtils, Mesh, MeshPhongMaterial, @@ -2050,25 +2050,23 @@ var lwoTree; var LWOLoader = function ( manager, parameters ) { - this.manager = ( manager !== undefined ) ? manager : DefaultLoadingManager; + Loader.call( this, manager ); parameters = parameters || {}; - this.resourcePath = ( parameters.resourcePath !== undefined ) ? parameters.resourcePath : undefined; + this.resourcePath = ( parameters.resourcePath !== undefined ) ? parameters.resourcePath : ''; }; -LWOLoader.prototype = { +LWOLoader.prototype = Object.assign( Object.create( Loader.prototype ), { constructor: LWOLoader, - crossOrigin: 'anonymous', - load: function ( url, onLoad, onProgress, onError ) { var self = this; - var path = ( self.path === undefined ) ? extractParentUrl( url, 'Objects' ) : self.path; + var path = ( self.path === '' ) ? extractParentUrl( url, 'Objects' ) : self.path; // give the mesh a default name based on the filename var modelName = url.split( path ).pop().split( '.' )[ 0 ]; @@ -2087,27 +2085,6 @@ LWOLoader.prototype = { }, - setCrossOrigin: function ( value ) { - - this.crossOrigin = value; - return this; - - }, - - setPath: function ( value ) { - - this.path = value; - return this; - - }, - - setResourcePath: function ( value ) { - - this.resourcePath = value; - return this; - - }, - parse: function ( iffBuffer, path, modelName ) { lwoTree = new IFFParser().parse( iffBuffer ); @@ -2120,7 +2097,7 @@ LWOLoader.prototype = { } -}; +} ); // Parse the lwoTree object function LWOTreeParser( textureLoader ) { From 364ab4698eb625af08d7099095f41ace02a738a4 Mon Sep 17 00:00:00 2001 From: Mugen87 Date: Mon, 2 Sep 2019 11:12:50 +0200 Subject: [PATCH 33/75] DataTextureLoader: Refactor parsing. --- examples/js/loaders/EXRLoader.js | 1277 +++++++++-------- examples/js/loaders/HDRCubeTextureLoader.js | 2 +- examples/js/loaders/RGBELoader.js | 673 +++++---- examples/jsm/loaders/EXRLoader.d.ts | 2 +- examples/jsm/loaders/EXRLoader.js | 1278 +++++++++--------- examples/jsm/loaders/HDRCubeTextureLoader.js | 2 +- examples/jsm/loaders/RGBELoader.d.ts | 2 +- examples/jsm/loaders/RGBELoader.js | 674 +++++---- src/loaders/CompressedTextureLoader.js | 2 + src/loaders/DataTextureLoader.js | 7 +- 10 files changed, 1953 insertions(+), 1966 deletions(-) diff --git a/examples/js/loaders/EXRLoader.js b/examples/js/loaders/EXRLoader.js index 9172fa35be35f6..590b8eaf3528e7 100644 --- a/examples/js/loaders/EXRLoader.js +++ b/examples/js/loaders/EXRLoader.js @@ -75,544 +75,541 @@ THREE.EXRLoader = function ( manager ) { - this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager; + THREE.DataTextureLoader.call( this, manager ); + this.type = THREE.FloatType; }; -THREE.EXRLoader.prototype = Object.create( THREE.DataTextureLoader.prototype ); - -THREE.EXRLoader.prototype.setDataType = function ( value ) { +THREE.EXRLoader.prototype = Object.assign( Object.create( THREE.DataTextureLoader.prototype ), { - this.type = value; - return this; - -}; + constructor: THREE.EXRLoader, -THREE.EXRLoader.prototype.setType = function ( value ) { + setDataType: function ( value ) { - console.warn( 'THREE.EXRLoader: .setType() has been renamed to .setDataType().' ); + this.type = value; + return this; - return this.setDataType( value ); + }, -}; + parse: function ( buffer ) { -THREE.EXRLoader.prototype._parser = function ( buffer ) { + const USHORT_RANGE = ( 1 << 16 ); + const BITMAP_SIZE = ( USHORT_RANGE >> 3 ); - const USHORT_RANGE = ( 1 << 16 ); - const BITMAP_SIZE = ( USHORT_RANGE >> 3 ); + const HUF_ENCBITS = 16; // literal (value) bit length + const HUF_DECBITS = 14; // decoding bit size (>= 8) - const HUF_ENCBITS = 16; // literal (value) bit length - const HUF_DECBITS = 14; // decoding bit size (>= 8) + const HUF_ENCSIZE = ( 1 << HUF_ENCBITS ) + 1; // encoding table size + const HUF_DECSIZE = 1 << HUF_DECBITS; // decoding table size + const HUF_DECMASK = HUF_DECSIZE - 1; - const HUF_ENCSIZE = ( 1 << HUF_ENCBITS ) + 1; // encoding table size - const HUF_DECSIZE = 1 << HUF_DECBITS; // decoding table size - const HUF_DECMASK = HUF_DECSIZE - 1; + const SHORT_ZEROCODE_RUN = 59; + const LONG_ZEROCODE_RUN = 63; + const SHORTEST_LONG_RUN = 2 + LONG_ZEROCODE_RUN - SHORT_ZEROCODE_RUN; - const SHORT_ZEROCODE_RUN = 59; - const LONG_ZEROCODE_RUN = 63; - const SHORTEST_LONG_RUN = 2 + LONG_ZEROCODE_RUN - SHORT_ZEROCODE_RUN; + const BYTES_PER_HALF = 2; - const BYTES_PER_HALF = 2; + const ULONG_SIZE = 8; + const FLOAT32_SIZE = 4; + const INT32_SIZE = 4; + const INT16_SIZE = 2; + const INT8_SIZE = 1; - const ULONG_SIZE = 8; - const FLOAT32_SIZE = 4; - const INT32_SIZE = 4; - const INT16_SIZE = 2; - const INT8_SIZE = 1; + function reverseLutFromBitmap( bitmap, lut ) { - function reverseLutFromBitmap( bitmap, lut ) { + var k = 0; - var k = 0; + for ( var i = 0; i < USHORT_RANGE; ++ i ) { - for ( var i = 0; i < USHORT_RANGE; ++ i ) { + if ( ( i == 0 ) || ( bitmap[ i >> 3 ] & ( 1 << ( i & 7 ) ) ) ) { - if ( ( i == 0 ) || ( bitmap[ i >> 3 ] & ( 1 << ( i & 7 ) ) ) ) { + lut[ k ++ ] = i; - lut[ k ++ ] = i; + } } - } + var n = k - 1; - var n = k - 1; + while ( k < USHORT_RANGE ) lut[ k ++ ] = 0; - while ( k < USHORT_RANGE ) lut[ k ++ ] = 0; + return n; - return n; + } - } + function hufClearDecTable( hdec ) { - function hufClearDecTable( hdec ) { + for ( var i = 0; i < HUF_DECSIZE; i ++ ) { - for ( var i = 0; i < HUF_DECSIZE; i ++ ) { + hdec[ i ] = {}; + hdec[ i ].len = 0; + hdec[ i ].lit = 0; + hdec[ i ].p = null; - hdec[ i ] = {}; - hdec[ i ].len = 0; - hdec[ i ].lit = 0; - hdec[ i ].p = null; + } } - } + const getBitsReturn = { l: 0, c: 0, lc: 0 }; - const getBitsReturn = { l: 0, c: 0, lc: 0 }; + function getBits( nBits, c, lc, uInt8Array, inOffset ) { - function getBits( nBits, c, lc, uInt8Array, inOffset ) { + while ( lc < nBits ) { - while ( lc < nBits ) { + c = ( c << 8 ) | parseUint8Array( uInt8Array, inOffset ); + lc += 8; - c = ( c << 8 ) | parseUint8Array( uInt8Array, inOffset ); - lc += 8; + } - } + lc -= nBits; - lc -= nBits; + getBitsReturn.l = ( c >> lc ) & ( ( 1 << nBits ) - 1 ); + getBitsReturn.c = c; + getBitsReturn.lc = lc; - getBitsReturn.l = ( c >> lc ) & ( ( 1 << nBits ) - 1 ); - getBitsReturn.c = c; - getBitsReturn.lc = lc; + } - } + const hufTableBuffer = new Array( 59 ); - const hufTableBuffer = new Array( 59 ); + function hufCanonicalCodeTable( hcode ) { - function hufCanonicalCodeTable( hcode ) { + for ( var i = 0; i <= 58; ++ i ) hufTableBuffer[ i ] = 0; + for ( var i = 0; i < HUF_ENCSIZE; ++ i ) hufTableBuffer[ hcode[ i ] ] += 1; - for ( var i = 0; i <= 58; ++ i ) hufTableBuffer[ i ] = 0; - for ( var i = 0; i < HUF_ENCSIZE; ++ i ) hufTableBuffer[ hcode[ i ] ] += 1; + var c = 0; - var c = 0; + for ( var i = 58; i > 0; -- i ) { - for ( var i = 58; i > 0; -- i ) { + var nc = ( ( c + hufTableBuffer[ i ] ) >> 1 ); + hufTableBuffer[ i ] = c; + c = nc; - var nc = ( ( c + hufTableBuffer[ i ] ) >> 1 ); - hufTableBuffer[ i ] = c; - c = nc; + } - } + for ( var i = 0; i < HUF_ENCSIZE; ++ i ) { - for ( var i = 0; i < HUF_ENCSIZE; ++ i ) { + var l = hcode[ i ]; + if ( l > 0 ) hcode[ i ] = l | ( hufTableBuffer[ l ] ++ << 6 ); - var l = hcode[ i ]; - if ( l > 0 ) hcode[ i ] = l | ( hufTableBuffer[ l ] ++ << 6 ); + } } - } + function hufUnpackEncTable( uInt8Array, inDataView, inOffset, ni, im, iM, hcode ) { - function hufUnpackEncTable( uInt8Array, inDataView, inOffset, ni, im, iM, hcode ) { + var p = inOffset; + var c = 0; + var lc = 0; - var p = inOffset; - var c = 0; - var lc = 0; + for ( ; im <= iM; im ++ ) { - for ( ; im <= iM; im ++ ) { + if ( p.value - inOffset.value > ni ) return false; - if ( p.value - inOffset.value > ni ) return false; + getBits( 6, c, lc, uInt8Array, p ); - getBits( 6, c, lc, uInt8Array, p ); + var l = getBitsReturn.l; + c = getBitsReturn.c; + lc = getBitsReturn.lc; - var l = getBitsReturn.l; - c = getBitsReturn.c; - lc = getBitsReturn.lc; + hcode[ im ] = l; - hcode[ im ] = l; + if ( l == LONG_ZEROCODE_RUN ) { - if ( l == LONG_ZEROCODE_RUN ) { + if ( p.value - inOffset.value > ni ) { - if ( p.value - inOffset.value > ni ) { + throw 'Something wrong with hufUnpackEncTable'; - throw 'Something wrong with hufUnpackEncTable'; + } - } + getBits( 8, c, lc, uInt8Array, p ); - getBits( 8, c, lc, uInt8Array, p ); + var zerun = getBitsReturn.l + SHORTEST_LONG_RUN; + c = getBitsReturn.c; + lc = getBitsReturn.lc; - var zerun = getBitsReturn.l + SHORTEST_LONG_RUN; - c = getBitsReturn.c; - lc = getBitsReturn.lc; + if ( im + zerun > iM + 1 ) { - if ( im + zerun > iM + 1 ) { + throw 'Something wrong with hufUnpackEncTable'; - throw 'Something wrong with hufUnpackEncTable'; + } - } + while ( zerun -- ) hcode[ im ++ ] = 0; - while ( zerun -- ) hcode[ im ++ ] = 0; + im --; - im --; + } else if ( l >= SHORT_ZEROCODE_RUN ) { - } else if ( l >= SHORT_ZEROCODE_RUN ) { + var zerun = l - SHORT_ZEROCODE_RUN + 2; - var zerun = l - SHORT_ZEROCODE_RUN + 2; + if ( im + zerun > iM + 1 ) { - if ( im + zerun > iM + 1 ) { + throw 'Something wrong with hufUnpackEncTable'; - throw 'Something wrong with hufUnpackEncTable'; + } - } + while ( zerun -- ) hcode[ im ++ ] = 0; - while ( zerun -- ) hcode[ im ++ ] = 0; + im --; - im --; + } } + hufCanonicalCodeTable( hcode ); + } - hufCanonicalCodeTable( hcode ); + function hufLength( code ) { - } + return code & 63; - function hufLength( code ) { + } - return code & 63; + function hufCode( code ) { - } + return code >> 6; - function hufCode( code ) { + } - return code >> 6; + function hufBuildDecTable( hcode, im, iM, hdecod ) { - } + for ( ; im <= iM; im ++ ) { - function hufBuildDecTable( hcode, im, iM, hdecod ) { + var c = hufCode( hcode[ im ] ); + var l = hufLength( hcode[ im ] ); - for ( ; im <= iM; im ++ ) { + if ( c >> l ) { - var c = hufCode( hcode[ im ] ); - var l = hufLength( hcode[ im ] ); + throw 'Invalid table entry'; - if ( c >> l ) { + } - throw 'Invalid table entry'; + if ( l > HUF_DECBITS ) { - } + var pl = hdecod[ ( c >> ( l - HUF_DECBITS ) ) ]; - if ( l > HUF_DECBITS ) { + if ( pl.len ) { - var pl = hdecod[ ( c >> ( l - HUF_DECBITS ) ) ]; + throw 'Invalid table entry'; - if ( pl.len ) { + } - throw 'Invalid table entry'; + pl.lit ++; - } + if ( pl.p ) { - pl.lit ++; + var p = pl.p; + pl.p = new Array( pl.lit ); - if ( pl.p ) { + for ( var i = 0; i < pl.lit - 1; ++ i ) { - var p = pl.p; - pl.p = new Array( pl.lit ); + pl.p[ i ] = p[ i ]; - for ( var i = 0; i < pl.lit - 1; ++ i ) { + } - pl.p[ i ] = p[ i ]; + } else { + + pl.p = new Array( 1 ); } - } else { + pl.p[ pl.lit - 1 ] = im; - pl.p = new Array( 1 ); + } else if ( l ) { - } + var plOffset = 0; - pl.p[ pl.lit - 1 ] = im; + for ( var i = 1 << ( HUF_DECBITS - l ); i > 0; i -- ) { - } else if ( l ) { + var pl = hdecod[ ( c << ( HUF_DECBITS - l ) ) + plOffset ]; - var plOffset = 0; + if ( pl.len || pl.p ) { - for ( var i = 1 << ( HUF_DECBITS - l ); i > 0; i -- ) { + throw 'Invalid table entry'; - var pl = hdecod[ ( c << ( HUF_DECBITS - l ) ) + plOffset ]; + } - if ( pl.len || pl.p ) { + pl.len = l; + pl.lit = im; - throw 'Invalid table entry'; + plOffset ++; } - pl.len = l; - pl.lit = im; - - plOffset ++; - } } + return true; + } - return true; + const getCharReturn = { c: 0, lc: 0 }; - } + function getChar( c, lc, uInt8Array, inOffset ) { - const getCharReturn = { c: 0, lc: 0 }; + c = ( c << 8 ) | parseUint8Array( uInt8Array, inOffset ); + lc += 8; - function getChar( c, lc, uInt8Array, inOffset ) { + getCharReturn.c = c; + getCharReturn.lc = lc; - c = ( c << 8 ) | parseUint8Array( uInt8Array, inOffset ); - lc += 8; + } - getCharReturn.c = c; - getCharReturn.lc = lc; + const getCodeReturn = { c: 0, lc: 0 }; - } + function getCode( po, rlc, c, lc, uInt8Array, inDataView, inOffset, outBuffer, outBufferOffset, outBufferEndOffset ) { - const getCodeReturn = { c: 0, lc: 0 }; + if ( po == rlc ) { - function getCode( po, rlc, c, lc, uInt8Array, inDataView, inOffset, outBuffer, outBufferOffset, outBufferEndOffset ) { + if ( lc < 8 ) { - if ( po == rlc ) { + getChar( c, lc, uInt8Array, inOffset ); + c = getCharReturn.c; + lc = getCharReturn.lc; - if ( lc < 8 ) { + } - getChar( c, lc, uInt8Array, inOffset ); - c = getCharReturn.c; - lc = getCharReturn.lc; + lc -= 8; - } + var cs = ( c >> lc ); + var cs = new Uint8Array( [ cs ] )[ 0 ]; - lc -= 8; + if ( outBufferOffset.value + cs > outBufferEndOffset ) { - var cs = ( c >> lc ); - var cs = new Uint8Array( [ cs ] )[ 0 ]; + return false; - if ( outBufferOffset.value + cs > outBufferEndOffset ) { + } - return false; + var s = outBuffer[ outBufferOffset.value - 1 ]; - } + while ( cs -- > 0 ) { - var s = outBuffer[ outBufferOffset.value - 1 ]; + outBuffer[ outBufferOffset.value ++ ] = s; - while ( cs -- > 0 ) { + } - outBuffer[ outBufferOffset.value ++ ] = s; + } else if ( outBufferOffset.value < outBufferEndOffset ) { - } + outBuffer[ outBufferOffset.value ++ ] = po; - } else if ( outBufferOffset.value < outBufferEndOffset ) { + } else { - outBuffer[ outBufferOffset.value ++ ] = po; + return false; - } else { + } - return false; + getCodeReturn.c = c; + getCodeReturn.lc = lc; } - getCodeReturn.c = c; - getCodeReturn.lc = lc; - - } + function UInt16( value ) { - function UInt16( value ) { + return ( value & 0xFFFF ); - return ( value & 0xFFFF ); + } - } + function Int16( value ) { - function Int16( value ) { + var ref = UInt16( value ); + return ( ref > 0x7FFF ) ? ref - 0x10000 : ref; - var ref = UInt16( value ); - return ( ref > 0x7FFF ) ? ref - 0x10000 : ref; + } - } + const wdec14Return = { a: 0, b: 0 }; - const wdec14Return = { a: 0, b: 0 }; + function wdec14( l, h ) { - function wdec14( l, h ) { + var ls = Int16( l ); + var hs = Int16( h ); - var ls = Int16( l ); - var hs = Int16( h ); + var hi = hs; + var ai = ls + ( hi & 1 ) + ( hi >> 1 ); - var hi = hs; - var ai = ls + ( hi & 1 ) + ( hi >> 1 ); + var as = ai; + var bs = ai - hi; - var as = ai; - var bs = ai - hi; + wdec14Return.a = as; + wdec14Return.b = bs; - wdec14Return.a = as; - wdec14Return.b = bs; + } - } + function wav2Decode( j, buffer, nx, ox, ny, oy ) { - function wav2Decode( j, buffer, nx, ox, ny, oy ) { + var n = ( nx > ny ) ? ny : nx; + var p = 1; + var p2; - var n = ( nx > ny ) ? ny : nx; - var p = 1; - var p2; + while ( p <= n ) p <<= 1; - while ( p <= n ) p <<= 1; + p >>= 1; + p2 = p; + p >>= 1; - p >>= 1; - p2 = p; - p >>= 1; + while ( p >= 1 ) { - while ( p >= 1 ) { + var py = 0; + var ey = py + oy * ( ny - p2 ); + var oy1 = oy * p; + var oy2 = oy * p2; + var ox1 = ox * p; + var ox2 = ox * p2; + var i00, i01, i10, i11; - var py = 0; - var ey = py + oy * ( ny - p2 ); - var oy1 = oy * p; - var oy2 = oy * p2; - var ox1 = ox * p; - var ox2 = ox * p2; - var i00, i01, i10, i11; + for ( ; py <= ey; py += oy2 ) { - for ( ; py <= ey; py += oy2 ) { + var px = py; + var ex = py + ox * ( nx - p2 ); - var px = py; - var ex = py + ox * ( nx - p2 ); + for ( ; px <= ex; px += ox2 ) { - for ( ; px <= ex; px += ox2 ) { + var p01 = px + ox1; + var p10 = px + oy1; + var p11 = p10 + ox1; - var p01 = px + ox1; - var p10 = px + oy1; - var p11 = p10 + ox1; + wdec14( buffer[ px + j ], buffer[ p10 + j ] ); - wdec14( buffer[ px + j ], buffer[ p10 + j ] ); + i00 = wdec14Return.a; + i10 = wdec14Return.b; - i00 = wdec14Return.a; - i10 = wdec14Return.b; + wdec14( buffer[ p01 + j ], buffer[ p11 + j ] ); - wdec14( buffer[ p01 + j ], buffer[ p11 + j ] ); + i01 = wdec14Return.a; + i11 = wdec14Return.b; - i01 = wdec14Return.a; - i11 = wdec14Return.b; + wdec14( i00, i01 ); - wdec14( i00, i01 ); + buffer[ px + j ] = wdec14Return.a; + buffer[ p01 + j ] = wdec14Return.b; - buffer[ px + j ] = wdec14Return.a; - buffer[ p01 + j ] = wdec14Return.b; + wdec14( i10, i11 ); - wdec14( i10, i11 ); + buffer[ p10 + j ] = wdec14Return.a; + buffer[ p11 + j ] = wdec14Return.b; - buffer[ p10 + j ] = wdec14Return.a; - buffer[ p11 + j ] = wdec14Return.b; + } - } + if ( nx & p ) { - if ( nx & p ) { + var p10 = px + oy1; - var p10 = px + oy1; + wdec14( buffer[ px + j ], buffer[ p10 + j ] ); - wdec14( buffer[ px + j ], buffer[ p10 + j ] ); + i00 = wdec14Return.a; + buffer[ p10 + j ] = wdec14Return.b; - i00 = wdec14Return.a; - buffer[ p10 + j ] = wdec14Return.b; + buffer[ px + j ] = i00; - buffer[ px + j ] = i00; + } } - } + if ( ny & p ) { - if ( ny & p ) { + var px = py; + var ex = py + ox * ( nx - p2 ); - var px = py; - var ex = py + ox * ( nx - p2 ); + for ( ; px <= ex; px += ox2 ) { - for ( ; px <= ex; px += ox2 ) { + var p01 = px + ox1; - var p01 = px + ox1; + wdec14( buffer[ px + j ], buffer[ p01 + j ] ); - wdec14( buffer[ px + j ], buffer[ p01 + j ] ); + i00 = wdec14Return.a; + buffer[ p01 + j ] = wdec14Return.b; - i00 = wdec14Return.a; - buffer[ p01 + j ] = wdec14Return.b; + buffer[ px + j ] = i00; - buffer[ px + j ] = i00; + } } + p2 = p; + p >>= 1; + } - p2 = p; - p >>= 1; + return py; } - return py; + function hufDecode( encodingTable, decodingTable, uInt8Array, inDataView, inOffset, ni, rlc, no, outBuffer, outOffset ) { - } + var c = 0; + var lc = 0; + var outBufferEndOffset = no; + var inOffsetEnd = Math.trunc( inOffset.value + ( ni + 7 ) / 8 ); - function hufDecode( encodingTable, decodingTable, uInt8Array, inDataView, inOffset, ni, rlc, no, outBuffer, outOffset ) { + while ( inOffset.value < inOffsetEnd ) { - var c = 0; - var lc = 0; - var outBufferEndOffset = no; - var inOffsetEnd = Math.trunc( inOffset.value + ( ni + 7 ) / 8 ); + getChar( c, lc, uInt8Array, inOffset ); - while ( inOffset.value < inOffsetEnd ) { + c = getCharReturn.c; + lc = getCharReturn.lc; - getChar( c, lc, uInt8Array, inOffset ); + while ( lc >= HUF_DECBITS ) { - c = getCharReturn.c; - lc = getCharReturn.lc; + var index = ( c >> ( lc - HUF_DECBITS ) ) & HUF_DECMASK; + var pl = decodingTable[ index ]; - while ( lc >= HUF_DECBITS ) { + if ( pl.len ) { - var index = ( c >> ( lc - HUF_DECBITS ) ) & HUF_DECMASK; - var pl = decodingTable[ index ]; + lc -= pl.len; - if ( pl.len ) { + getCode( pl.lit, rlc, c, lc, uInt8Array, inDataView, inOffset, outBuffer, outOffset, outBufferEndOffset ); - lc -= pl.len; - - getCode( pl.lit, rlc, c, lc, uInt8Array, inDataView, inOffset, outBuffer, outOffset, outBufferEndOffset ); + c = getCodeReturn.c; + lc = getCodeReturn.lc; - c = getCodeReturn.c; - lc = getCodeReturn.lc; + } else { - } else { + if ( ! pl.p ) { - if ( ! pl.p ) { + throw 'hufDecode issues'; - throw 'hufDecode issues'; + } - } + var j; - var j; + for ( j = 0; j < pl.lit; j ++ ) { - for ( j = 0; j < pl.lit; j ++ ) { + var l = hufLength( encodingTable[ pl.p[ j ] ] ); - var l = hufLength( encodingTable[ pl.p[ j ] ] ); + while ( lc < l && inOffset.value < inOffsetEnd ) { - while ( lc < l && inOffset.value < inOffsetEnd ) { + getChar( c, lc, uInt8Array, inOffset ); - getChar( c, lc, uInt8Array, inOffset ); + c = getCharReturn.c; + lc = getCharReturn.lc; - c = getCharReturn.c; - lc = getCharReturn.lc; + } - } + if ( lc >= l ) { - if ( lc >= l ) { + if ( hufCode( encodingTable[ pl.p[ j ] ] ) == ( ( c >> ( lc - l ) ) & ( ( 1 << l ) - 1 ) ) ) { - if ( hufCode( encodingTable[ pl.p[ j ] ] ) == ( ( c >> ( lc - l ) ) & ( ( 1 << l ) - 1 ) ) ) { + lc -= l; - lc -= l; + getCode( pl.p[ j ], rlc, c, lc, uInt8Array, inDataView, inOffset, outBuffer, outOffset, outBufferEndOffset ); - getCode( pl.p[ j ], rlc, c, lc, uInt8Array, inDataView, inOffset, outBuffer, outOffset, outBufferEndOffset ); + c = getCodeReturn.c; + lc = getCodeReturn.lc; - c = getCodeReturn.c; - lc = getCodeReturn.lc; + break; - break; + } } } - } + if ( j == pl.lit ) { - if ( j == pl.lit ) { + throw 'hufDecode issues'; - throw 'hufDecode issues'; + } } @@ -620,598 +617,598 @@ THREE.EXRLoader.prototype._parser = function ( buffer ) { } - } + var i = ( 8 - ni ) & 7; - var i = ( 8 - ni ) & 7; + c >>= i; + lc -= i; - c >>= i; - lc -= i; + while ( lc > 0 ) { - while ( lc > 0 ) { + var pl = decodingTable[ ( c << ( HUF_DECBITS - lc ) ) & HUF_DECMASK ]; - var pl = decodingTable[ ( c << ( HUF_DECBITS - lc ) ) & HUF_DECMASK ]; + if ( pl.len ) { - if ( pl.len ) { + lc -= pl.len; - lc -= pl.len; + getCode( pl.lit, rlc, c, lc, uInt8Array, inDataView, inOffset, outBuffer, outOffset, outBufferEndOffset ); - getCode( pl.lit, rlc, c, lc, uInt8Array, inDataView, inOffset, outBuffer, outOffset, outBufferEndOffset ); + c = getCodeReturn.c; + lc = getCodeReturn.lc; - c = getCodeReturn.c; - lc = getCodeReturn.lc; + } else { - } else { + throw 'hufDecode issues'; - throw 'hufDecode issues'; + } } + return true; + } - return true; + function hufUncompress( uInt8Array, inDataView, inOffset, nCompressed, outBuffer, outOffset, nRaw ) { - } + var initialInOffset = inOffset.value; - function hufUncompress( uInt8Array, inDataView, inOffset, nCompressed, outBuffer, outOffset, nRaw ) { + var im = parseUint32( inDataView, inOffset ); + var iM = parseUint32( inDataView, inOffset ); - var initialInOffset = inOffset.value; + inOffset.value += 4; - var im = parseUint32( inDataView, inOffset ); - var iM = parseUint32( inDataView, inOffset ); + var nBits = parseUint32( inDataView, inOffset ); - inOffset.value += 4; + inOffset.value += 4; - var nBits = parseUint32( inDataView, inOffset ); + if ( im < 0 || im >= HUF_ENCSIZE || iM < 0 || iM >= HUF_ENCSIZE ) { - inOffset.value += 4; + throw 'Something wrong with HUF_ENCSIZE'; - if ( im < 0 || im >= HUF_ENCSIZE || iM < 0 || iM >= HUF_ENCSIZE ) { + } - throw 'Something wrong with HUF_ENCSIZE'; + var freq = new Array( HUF_ENCSIZE ); + var hdec = new Array( HUF_DECSIZE ); - } + hufClearDecTable( hdec ); - var freq = new Array( HUF_ENCSIZE ); - var hdec = new Array( HUF_DECSIZE ); + var ni = nCompressed - ( inOffset.value - initialInOffset ); - hufClearDecTable( hdec ); + hufUnpackEncTable( uInt8Array, inDataView, inOffset, ni, im, iM, freq ); - var ni = nCompressed - ( inOffset.value - initialInOffset ); + if ( nBits > 8 * ( nCompressed - ( inOffset.value - initialInOffset ) ) ) { - hufUnpackEncTable( uInt8Array, inDataView, inOffset, ni, im, iM, freq ); + throw 'Something wrong with hufUncompress'; - if ( nBits > 8 * ( nCompressed - ( inOffset.value - initialInOffset ) ) ) { + } - throw 'Something wrong with hufUncompress'; + hufBuildDecTable( freq, im, iM, hdec ); - } + hufDecode( freq, hdec, uInt8Array, inDataView, inOffset, nBits, iM, nRaw, outBuffer, outOffset ); - hufBuildDecTable( freq, im, iM, hdec ); - - hufDecode( freq, hdec, uInt8Array, inDataView, inOffset, nBits, iM, nRaw, outBuffer, outOffset ); + } - } + function applyLut( lut, data, nData ) { - function applyLut( lut, data, nData ) { + for ( var i = 0; i < nData; ++ i ) { - for ( var i = 0; i < nData; ++ i ) { + data[ i ] = lut[ data[ i ] ]; - data[ i ] = lut[ data[ i ] ]; + } } - } + function decompressPIZ( outBuffer, outOffset, uInt8Array, inDataView, inOffset, tmpBufSize, num_channels, exrChannelInfos, dataWidth, num_lines ) { - function decompressPIZ( outBuffer, outOffset, uInt8Array, inDataView, inOffset, tmpBufSize, num_channels, exrChannelInfos, dataWidth, num_lines ) { + var bitmap = new Uint8Array( BITMAP_SIZE ); - var bitmap = new Uint8Array( BITMAP_SIZE ); + var minNonZero = parseUint16( inDataView, inOffset ); + var maxNonZero = parseUint16( inDataView, inOffset ); - var minNonZero = parseUint16( inDataView, inOffset ); - var maxNonZero = parseUint16( inDataView, inOffset ); + if ( maxNonZero >= BITMAP_SIZE ) { - if ( maxNonZero >= BITMAP_SIZE ) { + throw 'Something is wrong with PIZ_COMPRESSION BITMAP_SIZE'; - throw 'Something is wrong with PIZ_COMPRESSION BITMAP_SIZE'; + } - } + if ( minNonZero <= maxNonZero ) { - if ( minNonZero <= maxNonZero ) { + for ( var i = 0; i < maxNonZero - minNonZero + 1; i ++ ) { - for ( var i = 0; i < maxNonZero - minNonZero + 1; i ++ ) { + bitmap[ i + minNonZero ] = parseUint8( inDataView, inOffset ); - bitmap[ i + minNonZero ] = parseUint8( inDataView, inOffset ); + } } - } + var lut = new Uint16Array( USHORT_RANGE ); + reverseLutFromBitmap( bitmap, lut ); - var lut = new Uint16Array( USHORT_RANGE ); - reverseLutFromBitmap( bitmap, lut ); + var length = parseUint32( inDataView, inOffset ); - var length = parseUint32( inDataView, inOffset ); + hufUncompress( uInt8Array, inDataView, inOffset, length, outBuffer, outOffset, tmpBufSize ); - hufUncompress( uInt8Array, inDataView, inOffset, length, outBuffer, outOffset, tmpBufSize ); + var pizChannelData = new Array( num_channels ); - var pizChannelData = new Array( num_channels ); + var outBufferEnd = 0; - var outBufferEnd = 0; + for ( var i = 0; i < num_channels; i ++ ) { - for ( var i = 0; i < num_channels; i ++ ) { + pizChannelData[ i ] = {}; + pizChannelData[ i ][ 'start' ] = outBufferEnd; + pizChannelData[ i ][ 'end' ] = pizChannelData[ i ][ 'start' ]; + pizChannelData[ i ][ 'nx' ] = dataWidth; + pizChannelData[ i ][ 'ny' ] = num_lines; + pizChannelData[ i ][ 'size' ] = 1; - pizChannelData[ i ] = {}; - pizChannelData[ i ][ 'start' ] = outBufferEnd; - pizChannelData[ i ][ 'end' ] = pizChannelData[ i ][ 'start' ]; - pizChannelData[ i ][ 'nx' ] = dataWidth; - pizChannelData[ i ][ 'ny' ] = num_lines; - pizChannelData[ i ][ 'size' ] = 1; + outBufferEnd += pizChannelData[ i ].nx * pizChannelData[ i ].ny * pizChannelData[ i ].size; - outBufferEnd += pizChannelData[ i ].nx * pizChannelData[ i ].ny * pizChannelData[ i ].size; + } - } + var fooOffset = 0; - var fooOffset = 0; + for ( var i = 0; i < num_channels; i ++ ) { - for ( var i = 0; i < num_channels; i ++ ) { + for ( var j = 0; j < pizChannelData[ i ].size; ++ j ) { - for ( var j = 0; j < pizChannelData[ i ].size; ++ j ) { + fooOffset += wav2Decode( + j + fooOffset, + outBuffer, + pizChannelData[ i ].nx, + pizChannelData[ i ].size, + pizChannelData[ i ].ny, + pizChannelData[ i ].nx * pizChannelData[ i ].size + ); - fooOffset += wav2Decode( - j + fooOffset, - outBuffer, - pizChannelData[ i ].nx, - pizChannelData[ i ].size, - pizChannelData[ i ].ny, - pizChannelData[ i ].nx * pizChannelData[ i ].size - ); + } } - } + applyLut( lut, outBuffer, outBufferEnd ); - applyLut( lut, outBuffer, outBufferEnd ); + return true; - return true; + } - } + function parseNullTerminatedString( buffer, offset ) { - function parseNullTerminatedString( buffer, offset ) { + var uintBuffer = new Uint8Array( buffer ); + var endOffset = 0; - var uintBuffer = new Uint8Array( buffer ); - var endOffset = 0; + while ( uintBuffer[ offset.value + endOffset ] != 0 ) { - while ( uintBuffer[ offset.value + endOffset ] != 0 ) { + endOffset += 1; - endOffset += 1; + } - } + var stringValue = new TextDecoder().decode( + uintBuffer.slice( offset.value, offset.value + endOffset ) + ); - var stringValue = new TextDecoder().decode( - uintBuffer.slice( offset.value, offset.value + endOffset ) - ); + offset.value = offset.value + endOffset + 1; - offset.value = offset.value + endOffset + 1; + return stringValue; - return stringValue; + } - } + function parseFixedLengthString( buffer, offset, size ) { - function parseFixedLengthString( buffer, offset, size ) { + var stringValue = new TextDecoder().decode( + new Uint8Array( buffer ).slice( offset.value, offset.value + size ) + ); - var stringValue = new TextDecoder().decode( - new Uint8Array( buffer ).slice( offset.value, offset.value + size ) - ); + offset.value = offset.value + size; - offset.value = offset.value + size; + return stringValue; - return stringValue; + } - } + function parseUlong( dataView, offset ) { - function parseUlong( dataView, offset ) { + var uLong = dataView.getUint32( 0, true ); - var uLong = dataView.getUint32( 0, true ); + offset.value = offset.value + ULONG_SIZE; - offset.value = offset.value + ULONG_SIZE; + return uLong; - return uLong; + } - } + function parseUint32( dataView, offset ) { - function parseUint32( dataView, offset ) { + var Uint32 = dataView.getUint32( offset.value, true ); - var Uint32 = dataView.getUint32( offset.value, true ); + offset.value = offset.value + INT32_SIZE; - offset.value = offset.value + INT32_SIZE; + return Uint32; - return Uint32; + } - } + function parseUint8Array( uInt8Array, offset ) { - function parseUint8Array( uInt8Array, offset ) { + var Uint8 = uInt8Array[ offset.value ]; - var Uint8 = uInt8Array[ offset.value ]; + offset.value = offset.value + INT8_SIZE; - offset.value = offset.value + INT8_SIZE; + return Uint8; - return Uint8; + } - } + function parseUint8( dataView, offset ) { - function parseUint8( dataView, offset ) { + var Uint8 = dataView.getUint8( offset.value ); - var Uint8 = dataView.getUint8( offset.value ); + offset.value = offset.value + INT8_SIZE; - offset.value = offset.value + INT8_SIZE; + return Uint8; - return Uint8; + } - } + function parseFloat32( dataView, offset ) { - function parseFloat32( dataView, offset ) { + var float = dataView.getFloat32( offset.value, true ); - var float = dataView.getFloat32( offset.value, true ); + offset.value += FLOAT32_SIZE; - offset.value += FLOAT32_SIZE; + return float; - return float; + } - } + // https://stackoverflow.com/questions/5678432/decompressing-half-precision-floats-in-javascript + function decodeFloat16( binary ) { - // https://stackoverflow.com/questions/5678432/decompressing-half-precision-floats-in-javascript - function decodeFloat16( binary ) { + var exponent = ( binary & 0x7C00 ) >> 10, + fraction = binary & 0x03FF; - var exponent = ( binary & 0x7C00 ) >> 10, - fraction = binary & 0x03FF; + return ( binary >> 15 ? - 1 : 1 ) * ( + exponent ? + ( + exponent === 0x1F ? + fraction ? NaN : Infinity : + Math.pow( 2, exponent - 15 ) * ( 1 + fraction / 0x400 ) + ) : + 6.103515625e-5 * ( fraction / 0x400 ) + ); - return ( binary >> 15 ? - 1 : 1 ) * ( - exponent ? - ( - exponent === 0x1F ? - fraction ? NaN : Infinity : - Math.pow( 2, exponent - 15 ) * ( 1 + fraction / 0x400 ) - ) : - 6.103515625e-5 * ( fraction / 0x400 ) - ); + } - } + function parseUint16( dataView, offset ) { - function parseUint16( dataView, offset ) { + var Uint16 = dataView.getUint16( offset.value, true ); - var Uint16 = dataView.getUint16( offset.value, true ); + offset.value += INT16_SIZE; - offset.value += INT16_SIZE; + return Uint16; - return Uint16; + } - } + function parseFloat16( buffer, offset ) { - function parseFloat16( buffer, offset ) { + return decodeFloat16( parseUint16( buffer, offset ) ); - return decodeFloat16( parseUint16( buffer, offset ) ); + } - } + function parseChlist( dataView, buffer, offset, size ) { - function parseChlist( dataView, buffer, offset, size ) { + var startOffset = offset.value; + var channels = []; - var startOffset = offset.value; - var channels = []; + while ( offset.value < ( startOffset + size - 1 ) ) { - while ( offset.value < ( startOffset + size - 1 ) ) { + var name = parseNullTerminatedString( buffer, offset ); + var pixelType = parseUint32( dataView, offset ); // TODO: Cast this to UINT, HALF or FLOAT + var pLinear = parseUint8( dataView, offset ); + offset.value += 3; // reserved, three chars + var xSampling = parseUint32( dataView, offset ); + var ySampling = parseUint32( dataView, offset ); - var name = parseNullTerminatedString( buffer, offset ); - var pixelType = parseUint32( dataView, offset ); // TODO: Cast this to UINT, HALF or FLOAT - var pLinear = parseUint8( dataView, offset ); - offset.value += 3; // reserved, three chars - var xSampling = parseUint32( dataView, offset ); - var ySampling = parseUint32( dataView, offset ); + channels.push( { + name: name, + pixelType: pixelType, + pLinear: pLinear, + xSampling: xSampling, + ySampling: ySampling + } ); - channels.push( { - name: name, - pixelType: pixelType, - pLinear: pLinear, - xSampling: xSampling, - ySampling: ySampling - } ); + } - } + offset.value += 1; - offset.value += 1; + return channels; - return channels; + } - } + function parseChromaticities( dataView, offset ) { - function parseChromaticities( dataView, offset ) { + var redX = parseFloat32( dataView, offset ); + var redY = parseFloat32( dataView, offset ); + var greenX = parseFloat32( dataView, offset ); + var greenY = parseFloat32( dataView, offset ); + var blueX = parseFloat32( dataView, offset ); + var blueY = parseFloat32( dataView, offset ); + var whiteX = parseFloat32( dataView, offset ); + var whiteY = parseFloat32( dataView, offset ); - var redX = parseFloat32( dataView, offset ); - var redY = parseFloat32( dataView, offset ); - var greenX = parseFloat32( dataView, offset ); - var greenY = parseFloat32( dataView, offset ); - var blueX = parseFloat32( dataView, offset ); - var blueY = parseFloat32( dataView, offset ); - var whiteX = parseFloat32( dataView, offset ); - var whiteY = parseFloat32( dataView, offset ); + return { redX: redX, redY: redY, greenX: greenX, greenY: greenY, blueX: blueX, blueY: blueY, whiteX: whiteX, whiteY: whiteY }; - return { redX: redX, redY: redY, greenX: greenX, greenY: greenY, blueX: blueX, blueY: blueY, whiteX: whiteX, whiteY: whiteY }; + } - } + function parseCompression( dataView, offset ) { - function parseCompression( dataView, offset ) { + var compressionCodes = [ + 'NO_COMPRESSION', + 'RLE_COMPRESSION', + 'ZIPS_COMPRESSION', + 'ZIP_COMPRESSION', + 'PIZ_COMPRESSION', + 'PXR24_COMPRESSION', + 'B44_COMPRESSION', + 'B44A_COMPRESSION', + 'DWAA_COMPRESSION', + 'DWAB_COMPRESSION' + ]; - var compressionCodes = [ - 'NO_COMPRESSION', - 'RLE_COMPRESSION', - 'ZIPS_COMPRESSION', - 'ZIP_COMPRESSION', - 'PIZ_COMPRESSION', - 'PXR24_COMPRESSION', - 'B44_COMPRESSION', - 'B44A_COMPRESSION', - 'DWAA_COMPRESSION', - 'DWAB_COMPRESSION' - ]; + var compression = parseUint8( dataView, offset ); - var compression = parseUint8( dataView, offset ); + return compressionCodes[ compression ]; - return compressionCodes[ compression ]; + } - } + function parseBox2i( dataView, offset ) { - function parseBox2i( dataView, offset ) { + var xMin = parseUint32( dataView, offset ); + var yMin = parseUint32( dataView, offset ); + var xMax = parseUint32( dataView, offset ); + var yMax = parseUint32( dataView, offset ); - var xMin = parseUint32( dataView, offset ); - var yMin = parseUint32( dataView, offset ); - var xMax = parseUint32( dataView, offset ); - var yMax = parseUint32( dataView, offset ); + return { xMin: xMin, yMin: yMin, xMax: xMax, yMax: yMax }; - return { xMin: xMin, yMin: yMin, xMax: xMax, yMax: yMax }; + } - } + function parseLineOrder( dataView, offset ) { - function parseLineOrder( dataView, offset ) { + var lineOrders = [ + 'INCREASING_Y' + ]; - var lineOrders = [ - 'INCREASING_Y' - ]; + var lineOrder = parseUint8( dataView, offset ); - var lineOrder = parseUint8( dataView, offset ); + return lineOrders[ lineOrder ]; - return lineOrders[ lineOrder ]; + } - } + function parseV2f( dataView, offset ) { - function parseV2f( dataView, offset ) { + var x = parseFloat32( dataView, offset ); + var y = parseFloat32( dataView, offset ); - var x = parseFloat32( dataView, offset ); - var y = parseFloat32( dataView, offset ); + return [ x, y ]; - return [ x, y ]; + } - } + function parseValue( dataView, buffer, offset, type, size ) { - function parseValue( dataView, buffer, offset, type, size ) { + if ( type === 'string' || type === 'iccProfile' ) { - if ( type === 'string' || type === 'iccProfile' ) { + return parseFixedLengthString( buffer, offset, size ); - return parseFixedLengthString( buffer, offset, size ); + } else if ( type === 'chlist' ) { - } else if ( type === 'chlist' ) { + return parseChlist( dataView, buffer, offset, size ); - return parseChlist( dataView, buffer, offset, size ); + } else if ( type === 'chromaticities' ) { - } else if ( type === 'chromaticities' ) { + return parseChromaticities( dataView, offset ); - return parseChromaticities( dataView, offset ); + } else if ( type === 'compression' ) { - } else if ( type === 'compression' ) { + return parseCompression( dataView, offset ); - return parseCompression( dataView, offset ); + } else if ( type === 'box2i' ) { - } else if ( type === 'box2i' ) { + return parseBox2i( dataView, offset ); - return parseBox2i( dataView, offset ); + } else if ( type === 'lineOrder' ) { - } else if ( type === 'lineOrder' ) { + return parseLineOrder( dataView, offset ); - return parseLineOrder( dataView, offset ); + } else if ( type === 'float' ) { - } else if ( type === 'float' ) { + return parseFloat32( dataView, offset ); - return parseFloat32( dataView, offset ); + } else if ( type === 'v2f' ) { - } else if ( type === 'v2f' ) { + return parseV2f( dataView, offset ); - return parseV2f( dataView, offset ); + } else if ( type === 'int' ) { - } else if ( type === 'int' ) { + return parseUint32( dataView, offset ); - return parseUint32( dataView, offset ); + } else { - } else { + throw 'Cannot parse value for unsupported type: ' + type; - throw 'Cannot parse value for unsupported type: ' + type; + } } - } + var bufferDataView = new DataView( buffer ); + var uInt8Array = new Uint8Array( buffer ); - var bufferDataView = new DataView( buffer ); - var uInt8Array = new Uint8Array( buffer ); + var EXRHeader = {}; - var EXRHeader = {}; + bufferDataView.getUint32( 0, true ); // magic + bufferDataView.getUint8( 4, true ); // versionByteZero + bufferDataView.getUint8( 5, true ); // fullMask - bufferDataView.getUint32( 0, true ); // magic - bufferDataView.getUint8( 4, true ); // versionByteZero - bufferDataView.getUint8( 5, true ); // fullMask + // start of header - // start of header + var offset = { value: 8 }; // start at 8, after magic stuff - var offset = { value: 8 }; // start at 8, after magic stuff + var keepReading = true; - var keepReading = true; + while ( keepReading ) { - while ( keepReading ) { + var attributeName = parseNullTerminatedString( buffer, offset ); - var attributeName = parseNullTerminatedString( buffer, offset ); + if ( attributeName == 0 ) { - if ( attributeName == 0 ) { + keepReading = false; - keepReading = false; + } else { - } else { + var attributeType = parseNullTerminatedString( buffer, offset ); + var attributeSize = parseUint32( bufferDataView, offset ); + var attributeValue = parseValue( bufferDataView, buffer, offset, attributeType, attributeSize ); - var attributeType = parseNullTerminatedString( buffer, offset ); - var attributeSize = parseUint32( bufferDataView, offset ); - var attributeValue = parseValue( bufferDataView, buffer, offset, attributeType, attributeSize ); + EXRHeader[ attributeName ] = attributeValue; - EXRHeader[ attributeName ] = attributeValue; + } } - } + // offsets - // offsets + var dataWindowHeight = EXRHeader.dataWindow.yMax + 1; + var scanlineBlockSize = 1; // 1 for NO_COMPRESSION - var dataWindowHeight = EXRHeader.dataWindow.yMax + 1; - var scanlineBlockSize = 1; // 1 for NO_COMPRESSION + if ( EXRHeader.compression === 'PIZ_COMPRESSION' ) { - if ( EXRHeader.compression === 'PIZ_COMPRESSION' ) { + scanlineBlockSize = 32; - scanlineBlockSize = 32; + } - } + var numBlocks = dataWindowHeight / scanlineBlockSize; - var numBlocks = dataWindowHeight / scanlineBlockSize; + for ( var i = 0; i < numBlocks; i ++ ) { - for ( var i = 0; i < numBlocks; i ++ ) { + parseUlong( bufferDataView, offset ); // scanlineOffset - parseUlong( bufferDataView, offset ); // scanlineOffset + } - } + // we should be passed the scanline offset table, start reading pixel data - // we should be passed the scanline offset table, start reading pixel data + var width = EXRHeader.dataWindow.xMax - EXRHeader.dataWindow.xMin + 1; + var height = EXRHeader.dataWindow.yMax - EXRHeader.dataWindow.yMin + 1; + var numChannels = EXRHeader.channels.length; - var width = EXRHeader.dataWindow.xMax - EXRHeader.dataWindow.xMin + 1; - var height = EXRHeader.dataWindow.yMax - EXRHeader.dataWindow.yMin + 1; - var numChannels = EXRHeader.channels.length; + switch ( this.type ) { - switch ( this.type ) { + case THREE.FloatType: - case THREE.FloatType: + var byteArray = new Float32Array( width * height * numChannels ); + break; - var byteArray = new Float32Array( width * height * numChannels ); - break; + case THREE.HalfFloatType: - case THREE.HalfFloatType: + var byteArray = new Uint16Array( width * height * numChannels ); + break; - var byteArray = new Uint16Array( width * height * numChannels ); - break; + default: - default: + console.error( 'THREE.EXRLoader: unsupported type: ', this.type ); + break; - console.error( 'THREE.EXRLoader: unsupported type: ', this.type ); - break; + } - } + var channelOffsets = { + R: 0, + G: 1, + B: 2, + A: 3 + }; - var channelOffsets = { - R: 0, - G: 1, - B: 2, - A: 3 - }; + if ( EXRHeader.compression === 'NO_COMPRESSION' ) { - if ( EXRHeader.compression === 'NO_COMPRESSION' ) { + for ( var y = 0; y < height; y ++ ) { - for ( var y = 0; y < height; y ++ ) { + var y_scanline = parseUint32( bufferDataView, offset ); + parseUint32( bufferDataView, offset ); // dataSize - var y_scanline = parseUint32( bufferDataView, offset ); - parseUint32( bufferDataView, offset ); // dataSize + for ( var channelID = 0; channelID < EXRHeader.channels.length; channelID ++ ) { + + var cOff = channelOffsets[ EXRHeader.channels[ channelID ].name ]; - for ( var channelID = 0; channelID < EXRHeader.channels.length; channelID ++ ) { + if ( EXRHeader.channels[ channelID ].pixelType === 1 ) { // half - var cOff = channelOffsets[ EXRHeader.channels[ channelID ].name ]; + for ( var x = 0; x < width; x ++ ) { - if ( EXRHeader.channels[ channelID ].pixelType === 1 ) { // half + switch ( this.type ) { - for ( var x = 0; x < width; x ++ ) { + case THREE.FloatType: - switch ( this.type ) { + var val = parseFloat16( bufferDataView, offset ); + break; - case THREE.FloatType: + case THREE.HalfFloatType: - var val = parseFloat16( bufferDataView, offset ); - break; + var val = parseUint16( bufferDataView, offset ); + break; - case THREE.HalfFloatType: + } - var val = parseUint16( bufferDataView, offset ); - break; + byteArray[ ( ( ( height - y_scanline ) * ( width * numChannels ) ) + ( x * numChannels ) ) + cOff ] = val; } - byteArray[ ( ( ( height - y_scanline ) * ( width * numChannels ) ) + ( x * numChannels ) ) + cOff ] = val; - - } + } else { - } else { + throw 'EXRLoader._parser: unsupported pixelType ' + EXRHeader.channels[ channelID ].pixelType + '. Only pixelType is 1 (HALF) is supported.'; - throw 'EXRLoader._parser: unsupported pixelType ' + EXRHeader.channels[ channelID ].pixelType + '. Only pixelType is 1 (HALF) is supported.'; + } } } - } + } else if ( EXRHeader.compression === 'PIZ_COMPRESSION' ) { - } else if ( EXRHeader.compression === 'PIZ_COMPRESSION' ) { + for ( var scanlineBlockIdx = 0; scanlineBlockIdx < height / scanlineBlockSize; scanlineBlockIdx ++ ) { - for ( var scanlineBlockIdx = 0; scanlineBlockIdx < height / scanlineBlockSize; scanlineBlockIdx ++ ) { + parseUint32( bufferDataView, offset ); // line_no + parseUint32( bufferDataView, offset ); // data_len - parseUint32( bufferDataView, offset ); // line_no - parseUint32( bufferDataView, offset ); // data_len + var tmpBufferSize = width * scanlineBlockSize * ( EXRHeader.channels.length * BYTES_PER_HALF ); + var tmpBuffer = new Uint16Array( tmpBufferSize ); + var tmpOffset = { value: 0 }; - var tmpBufferSize = width * scanlineBlockSize * ( EXRHeader.channels.length * BYTES_PER_HALF ); - var tmpBuffer = new Uint16Array( tmpBufferSize ); - var tmpOffset = { value: 0 }; + decompressPIZ( tmpBuffer, tmpOffset, uInt8Array, bufferDataView, offset, tmpBufferSize, numChannels, EXRHeader.channels, width, scanlineBlockSize ); - decompressPIZ( tmpBuffer, tmpOffset, uInt8Array, bufferDataView, offset, tmpBufferSize, numChannels, EXRHeader.channels, width, scanlineBlockSize ); + for ( var line_y = 0; line_y < scanlineBlockSize; line_y ++ ) { - for ( var line_y = 0; line_y < scanlineBlockSize; line_y ++ ) { + for ( var channelID = 0; channelID < EXRHeader.channels.length; channelID ++ ) { - for ( var channelID = 0; channelID < EXRHeader.channels.length; channelID ++ ) { + var cOff = channelOffsets[ EXRHeader.channels[ channelID ].name ]; - var cOff = channelOffsets[ EXRHeader.channels[ channelID ].name ]; + if ( EXRHeader.channels[ channelID ].pixelType === 1 ) { // half - if ( EXRHeader.channels[ channelID ].pixelType === 1 ) { // half + for ( var x = 0; x < width; x ++ ) { - for ( var x = 0; x < width; x ++ ) { + var idx = ( channelID * ( scanlineBlockSize * width ) ) + ( line_y * width ) + x; - var idx = ( channelID * ( scanlineBlockSize * width ) ) + ( line_y * width ) + x; + switch ( this.type ) { - switch ( this.type ) { + case THREE.FloatType: - case THREE.FloatType: + var val = decodeFloat16( tmpBuffer[ idx ] ); + break; - var val = decodeFloat16( tmpBuffer[ idx ] ); - break; + case THREE.HalfFloatType: - case THREE.HalfFloatType: + var val = tmpBuffer[ idx ]; + break; - var val = tmpBuffer[ idx ]; - break; + } - } + var true_y = line_y + ( scanlineBlockIdx * scanlineBlockSize ); - var true_y = line_y + ( scanlineBlockIdx * scanlineBlockSize ); + byteArray[ ( ( ( height - true_y ) * ( width * numChannels ) ) + ( x * numChannels ) ) + cOff ] = val; - byteArray[ ( ( ( height - true_y ) * ( width * numChannels ) ) + ( x * numChannels ) ) + cOff ] = val; + } - } + } else { - } else { + throw 'EXRLoader._parser: unsupported pixelType ' + EXRHeader.channels[ channelID ].pixelType + '. Only pixelType is 1 (HALF) is supported.'; - throw 'EXRLoader._parser: unsupported pixelType ' + EXRHeader.channels[ channelID ].pixelType + '. Only pixelType is 1 (HALF) is supported.'; + } } @@ -1219,21 +1216,21 @@ THREE.EXRLoader.prototype._parser = function ( buffer ) { } - } + } else { - } else { + throw 'EXRLoader._parser: ' + EXRHeader.compression + ' is unsupported'; - throw 'EXRLoader._parser: ' + EXRHeader.compression + ' is unsupported'; + } - } + return { + header: EXRHeader, + width: width, + height: height, + data: byteArray, + format: EXRHeader.channels.length == 4 ? THREE.RGBAFormat : THREE.RGBFormat, + type: this.type + }; - return { - header: EXRHeader, - width: width, - height: height, - data: byteArray, - format: EXRHeader.channels.length == 4 ? THREE.RGBAFormat : THREE.RGBFormat, - type: this.type - }; + } -}; +} ); diff --git a/examples/js/loaders/HDRCubeTextureLoader.js b/examples/js/loaders/HDRCubeTextureLoader.js index 60a2962de0d990..1318c68865a6f5 100644 --- a/examples/js/loaders/HDRCubeTextureLoader.js +++ b/examples/js/loaders/HDRCubeTextureLoader.js @@ -79,7 +79,7 @@ THREE.HDRCubeTextureLoader.prototype = Object.assign( Object.create( THREE.Loade loaded ++; - var texData = scope.hdrLoader._parser( buffer ); + var texData = scope.hdrLoader.parse( buffer ); if ( ! texData ) return; diff --git a/examples/js/loaders/RGBELoader.js b/examples/js/loaders/RGBELoader.js index 88ea82b2f18130..c74e4b7632f411 100644 --- a/examples/js/loaders/RGBELoader.js +++ b/examples/js/loaders/RGBELoader.js @@ -7,523 +7,520 @@ THREE.RGBELoader = function ( manager ) { - this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager; + THREE.DataTextureLoader.call( this, manager ); + this.type = THREE.UnsignedByteType; }; -// extend THREE.DataTextureLoader -THREE.RGBELoader.prototype = Object.create( THREE.DataTextureLoader.prototype ); +THREE.RGBELoader.prototype = Object.assign( Object.create( THREE.DataTextureLoader.prototype ), { -// adapted from http://www.graphics.cornell.edu/~bjw/rgbe.html -THREE.RGBELoader.prototype._parser = function ( buffer ) { + constructor: THREE.RGBELoader, - var - /* return codes for rgbe routines */ - //RGBE_RETURN_SUCCESS = 0, - RGBE_RETURN_FAILURE = - 1, + // adapted from http://www.graphics.cornell.edu/~bjw/rgbe.html - /* default error routine. change this to change error handling */ - rgbe_read_error = 1, - rgbe_write_error = 2, - rgbe_format_error = 3, - rgbe_memory_error = 4, - rgbe_error = function ( rgbe_error_code, msg ) { + parse: function ( buffer ) { - switch ( rgbe_error_code ) { + var + /* return codes for rgbe routines */ + //RGBE_RETURN_SUCCESS = 0, + RGBE_RETURN_FAILURE = - 1, - case rgbe_read_error: console.error( "THREE.RGBELoader Read Error: " + ( msg || '' ) ); - break; - case rgbe_write_error: console.error( "THREE.RGBELoader Write Error: " + ( msg || '' ) ); - break; - case rgbe_format_error: console.error( "THREE.RGBELoader Bad File Format: " + ( msg || '' ) ); - break; - default: - case rgbe_memory_error: console.error( "THREE.RGBELoader: Error: " + ( msg || '' ) ); + /* default error routine. change this to change error handling */ + rgbe_read_error = 1, + rgbe_write_error = 2, + rgbe_format_error = 3, + rgbe_memory_error = 4, + rgbe_error = function ( rgbe_error_code, msg ) { - } - return RGBE_RETURN_FAILURE; + switch ( rgbe_error_code ) { - }, + case rgbe_read_error: console.error( "THREE.RGBELoader Read Error: " + ( msg || '' ) ); + break; + case rgbe_write_error: console.error( "THREE.RGBELoader Write Error: " + ( msg || '' ) ); + break; + case rgbe_format_error: console.error( "THREE.RGBELoader Bad File Format: " + ( msg || '' ) ); + break; + default: + case rgbe_memory_error: console.error( "THREE.RGBELoader: Error: " + ( msg || '' ) ); - /* offsets to red, green, and blue components in a data (float) pixel */ - //RGBE_DATA_RED = 0, - //RGBE_DATA_GREEN = 1, - //RGBE_DATA_BLUE = 2, + } + return RGBE_RETURN_FAILURE; - /* number of floats per pixel, use 4 since stored in rgba image format */ - //RGBE_DATA_SIZE = 4, + }, - /* flags indicating which fields in an rgbe_header_info are valid */ - RGBE_VALID_PROGRAMTYPE = 1, - RGBE_VALID_FORMAT = 2, - RGBE_VALID_DIMENSIONS = 4, + /* offsets to red, green, and blue components in a data (float) pixel */ + //RGBE_DATA_RED = 0, + //RGBE_DATA_GREEN = 1, + //RGBE_DATA_BLUE = 2, - NEWLINE = "\n", + /* number of floats per pixel, use 4 since stored in rgba image format */ + //RGBE_DATA_SIZE = 4, - fgets = function ( buffer, lineLimit, consume ) { + /* flags indicating which fields in an rgbe_header_info are valid */ + RGBE_VALID_PROGRAMTYPE = 1, + RGBE_VALID_FORMAT = 2, + RGBE_VALID_DIMENSIONS = 4, - lineLimit = ! lineLimit ? 1024 : lineLimit; - var p = buffer.pos, - i = - 1, len = 0, s = '', chunkSize = 128, - chunk = String.fromCharCode.apply( null, new Uint16Array( buffer.subarray( p, p + chunkSize ) ) ) - ; - while ( ( 0 > ( i = chunk.indexOf( NEWLINE ) ) ) && ( len < lineLimit ) && ( p < buffer.byteLength ) ) { + NEWLINE = "\n", - s += chunk; len += chunk.length; - p += chunkSize; - chunk += String.fromCharCode.apply( null, new Uint16Array( buffer.subarray( p, p + chunkSize ) ) ); + fgets = function ( buffer, lineLimit, consume ) { - } + lineLimit = ! lineLimit ? 1024 : lineLimit; + var p = buffer.pos, + i = - 1, len = 0, s = '', chunkSize = 128, + chunk = String.fromCharCode.apply( null, new Uint16Array( buffer.subarray( p, p + chunkSize ) ) ) + ; + while ( ( 0 > ( i = chunk.indexOf( NEWLINE ) ) ) && ( len < lineLimit ) && ( p < buffer.byteLength ) ) { - if ( - 1 < i ) { + s += chunk; len += chunk.length; + p += chunkSize; + chunk += String.fromCharCode.apply( null, new Uint16Array( buffer.subarray( p, p + chunkSize ) ) ); - /*for (i=l-1; i>=0; i--) { - byteCode = m.charCodeAt(i); - if (byteCode > 0x7f && byteCode <= 0x7ff) byteLen++; - else if (byteCode > 0x7ff && byteCode <= 0xffff) byteLen += 2; - if (byteCode >= 0xDC00 && byteCode <= 0xDFFF) i--; //trail surrogate - }*/ - if ( false !== consume ) buffer.pos += len + i + 1; - return s + chunk.slice( 0, i ); + } - } - return false; + if ( - 1 < i ) { - }, + /*for (i=l-1; i>=0; i--) { + byteCode = m.charCodeAt(i); + if (byteCode > 0x7f && byteCode <= 0x7ff) byteLen++; + else if (byteCode > 0x7ff && byteCode <= 0xffff) byteLen += 2; + if (byteCode >= 0xDC00 && byteCode <= 0xDFFF) i--; //trail surrogate + }*/ + if ( false !== consume ) buffer.pos += len + i + 1; + return s + chunk.slice( 0, i ); - /* minimal header reading. modify if you want to parse more information */ - RGBE_ReadHeader = function ( buffer ) { + } + return false; - var line, match, + }, - // regexes to parse header info fields - magic_token_re = /^#\?(\S+)$/, - gamma_re = /^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/, - exposure_re = /^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/, - format_re = /^\s*FORMAT=(\S+)\s*$/, - dimensions_re = /^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/, + /* minimal header reading. modify if you want to parse more information */ + RGBE_ReadHeader = function ( buffer ) { - // RGBE format header struct - header = { + var line, match, - valid: 0, /* indicate which fields are valid */ + // regexes to parse header info fields + magic_token_re = /^#\?(\S+)$/, + gamma_re = /^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/, + exposure_re = /^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/, + format_re = /^\s*FORMAT=(\S+)\s*$/, + dimensions_re = /^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/, - string: '', /* the actual header string */ + // RGBE format header struct + header = { - comments: '', /* comments found in header */ + valid: 0, /* indicate which fields are valid */ - programtype: 'RGBE', /* listed at beginning of file to identify it after "#?". defaults to "RGBE" */ + string: '', /* the actual header string */ - format: '', /* RGBE format, default 32-bit_rle_rgbe */ + comments: '', /* comments found in header */ - gamma: 1.0, /* image has already been gamma corrected with given gamma. defaults to 1.0 (no correction) */ + programtype: 'RGBE', /* listed at beginning of file to identify it after "#?". defaults to "RGBE" */ - exposure: 1.0, /* a value of 1.0 in an image corresponds to watts/steradian/m^2. defaults to 1.0 */ + format: '', /* RGBE format, default 32-bit_rle_rgbe */ - width: 0, height: 0 /* image dimensions, width/height */ + gamma: 1.0, /* image has already been gamma corrected with given gamma. defaults to 1.0 (no correction) */ - }; + exposure: 1.0, /* a value of 1.0 in an image corresponds to watts/steradian/m^2. defaults to 1.0 */ - if ( buffer.pos >= buffer.byteLength || ! ( line = fgets( buffer ) ) ) { + width: 0, height: 0 /* image dimensions, width/height */ - return rgbe_error( rgbe_read_error, "no header found" ); + }; - } - /* if you want to require the magic token then uncomment the next line */ - if ( ! ( match = line.match( magic_token_re ) ) ) { + if ( buffer.pos >= buffer.byteLength || ! ( line = fgets( buffer ) ) ) { - return rgbe_error( rgbe_format_error, "bad initial token" ); + return rgbe_error( rgbe_read_error, "no header found" ); - } - header.valid |= RGBE_VALID_PROGRAMTYPE; - header.programtype = match[ 1 ]; - header.string += line + "\n"; - - while ( true ) { - - line = fgets( buffer ); - if ( false === line ) break; - header.string += line + "\n"; - - if ( '#' === line.charAt( 0 ) ) { + } + /* if you want to require the magic token then uncomment the next line */ + if ( ! ( match = line.match( magic_token_re ) ) ) { - header.comments += line + "\n"; - continue; // comment line + return rgbe_error( rgbe_format_error, "bad initial token" ); } + header.valid |= RGBE_VALID_PROGRAMTYPE; + header.programtype = match[ 1 ]; + header.string += line + "\n"; - if ( match = line.match( gamma_re ) ) { + while ( true ) { - header.gamma = parseFloat( match[ 1 ], 10 ); + line = fgets( buffer ); + if ( false === line ) break; + header.string += line + "\n"; - } - if ( match = line.match( exposure_re ) ) { + if ( '#' === line.charAt( 0 ) ) { - header.exposure = parseFloat( match[ 1 ], 10 ); + header.comments += line + "\n"; + continue; // comment line - } - if ( match = line.match( format_re ) ) { + } - header.valid |= RGBE_VALID_FORMAT; - header.format = match[ 1 ];//'32-bit_rle_rgbe'; + if ( match = line.match( gamma_re ) ) { - } - if ( match = line.match( dimensions_re ) ) { + header.gamma = parseFloat( match[ 1 ], 10 ); - header.valid |= RGBE_VALID_DIMENSIONS; - header.height = parseInt( match[ 1 ], 10 ); - header.width = parseInt( match[ 2 ], 10 ); + } + if ( match = line.match( exposure_re ) ) { - } + header.exposure = parseFloat( match[ 1 ], 10 ); - if ( ( header.valid & RGBE_VALID_FORMAT ) && ( header.valid & RGBE_VALID_DIMENSIONS ) ) break; + } + if ( match = line.match( format_re ) ) { - } + header.valid |= RGBE_VALID_FORMAT; + header.format = match[ 1 ];//'32-bit_rle_rgbe'; - if ( ! ( header.valid & RGBE_VALID_FORMAT ) ) { + } + if ( match = line.match( dimensions_re ) ) { - return rgbe_error( rgbe_format_error, "missing format specifier" ); + header.valid |= RGBE_VALID_DIMENSIONS; + header.height = parseInt( match[ 1 ], 10 ); + header.width = parseInt( match[ 2 ], 10 ); - } - if ( ! ( header.valid & RGBE_VALID_DIMENSIONS ) ) { + } - return rgbe_error( rgbe_format_error, "missing image size specifier" ); + if ( ( header.valid & RGBE_VALID_FORMAT ) && ( header.valid & RGBE_VALID_DIMENSIONS ) ) break; - } + } - return header; + if ( ! ( header.valid & RGBE_VALID_FORMAT ) ) { - }, + return rgbe_error( rgbe_format_error, "missing format specifier" ); - RGBE_ReadPixels_RLE = function ( buffer, w, h ) { + } + if ( ! ( header.valid & RGBE_VALID_DIMENSIONS ) ) { - var data_rgba, offset, pos, count, byteValue, - scanline_buffer, ptr, ptr_end, i, l, off, isEncodedRun, - scanline_width = w, num_scanlines = h, rgbeStart - ; + return rgbe_error( rgbe_format_error, "missing image size specifier" ); - if ( - // run length encoding is not allowed so read flat - ( ( scanline_width < 8 ) || ( scanline_width > 0x7fff ) ) || - // this file is not run length encoded - ( ( 2 !== buffer[ 0 ] ) || ( 2 !== buffer[ 1 ] ) || ( buffer[ 2 ] & 0x80 ) ) - ) { + } - // return the flat buffer - return new Uint8Array( buffer ); + return header; - } + }, - if ( scanline_width !== ( ( buffer[ 2 ] << 8 ) | buffer[ 3 ] ) ) { + RGBE_ReadPixels_RLE = function ( buffer, w, h ) { - return rgbe_error( rgbe_format_error, "wrong scanline width" ); + var data_rgba, offset, pos, count, byteValue, + scanline_buffer, ptr, ptr_end, i, l, off, isEncodedRun, + scanline_width = w, num_scanlines = h, rgbeStart + ; - } + if ( + // run length encoding is not allowed so read flat + ( ( scanline_width < 8 ) || ( scanline_width > 0x7fff ) ) || + // this file is not run length encoded + ( ( 2 !== buffer[ 0 ] ) || ( 2 !== buffer[ 1 ] ) || ( buffer[ 2 ] & 0x80 ) ) + ) { - data_rgba = new Uint8Array( 4 * w * h ); + // return the flat buffer + return new Uint8Array( buffer ); - if ( ! data_rgba || ! data_rgba.length ) { + } - return rgbe_error( rgbe_memory_error, "unable to allocate buffer space" ); + if ( scanline_width !== ( ( buffer[ 2 ] << 8 ) | buffer[ 3 ] ) ) { - } + return rgbe_error( rgbe_format_error, "wrong scanline width" ); - offset = 0; pos = 0; ptr_end = 4 * scanline_width; - rgbeStart = new Uint8Array( 4 ); - scanline_buffer = new Uint8Array( ptr_end ); + } - // read in each successive scanline - while ( ( num_scanlines > 0 ) && ( pos < buffer.byteLength ) ) { + data_rgba = new Uint8Array( 4 * w * h ); - if ( pos + 4 > buffer.byteLength ) { + if ( ! data_rgba || ! data_rgba.length ) { - return rgbe_error( rgbe_read_error ); + return rgbe_error( rgbe_memory_error, "unable to allocate buffer space" ); } - rgbeStart[ 0 ] = buffer[ pos ++ ]; - rgbeStart[ 1 ] = buffer[ pos ++ ]; - rgbeStart[ 2 ] = buffer[ pos ++ ]; - rgbeStart[ 3 ] = buffer[ pos ++ ]; + offset = 0; pos = 0; ptr_end = 4 * scanline_width; + rgbeStart = new Uint8Array( 4 ); + scanline_buffer = new Uint8Array( ptr_end ); - if ( ( 2 != rgbeStart[ 0 ] ) || ( 2 != rgbeStart[ 1 ] ) || ( ( ( rgbeStart[ 2 ] << 8 ) | rgbeStart[ 3 ] ) != scanline_width ) ) { + // read in each successive scanline + while ( ( num_scanlines > 0 ) && ( pos < buffer.byteLength ) ) { - return rgbe_error( rgbe_format_error, "bad rgbe scanline format" ); + if ( pos + 4 > buffer.byteLength ) { - } + return rgbe_error( rgbe_read_error ); - // read each of the four channels for the scanline into the buffer - // first red, then green, then blue, then exponent - ptr = 0; - while ( ( ptr < ptr_end ) && ( pos < buffer.byteLength ) ) { + } - count = buffer[ pos ++ ]; - isEncodedRun = count > 128; - if ( isEncodedRun ) count -= 128; + rgbeStart[ 0 ] = buffer[ pos ++ ]; + rgbeStart[ 1 ] = buffer[ pos ++ ]; + rgbeStart[ 2 ] = buffer[ pos ++ ]; + rgbeStart[ 3 ] = buffer[ pos ++ ]; - if ( ( 0 === count ) || ( ptr + count > ptr_end ) ) { + if ( ( 2 != rgbeStart[ 0 ] ) || ( 2 != rgbeStart[ 1 ] ) || ( ( ( rgbeStart[ 2 ] << 8 ) | rgbeStart[ 3 ] ) != scanline_width ) ) { - return rgbe_error( rgbe_format_error, "bad scanline data" ); + return rgbe_error( rgbe_format_error, "bad rgbe scanline format" ); } - if ( isEncodedRun ) { + // read each of the four channels for the scanline into the buffer + // first red, then green, then blue, then exponent + ptr = 0; + while ( ( ptr < ptr_end ) && ( pos < buffer.byteLength ) ) { + + count = buffer[ pos ++ ]; + isEncodedRun = count > 128; + if ( isEncodedRun ) count -= 128; - // a (encoded) run of the same value - byteValue = buffer[ pos ++ ]; - for ( i = 0; i < count; i ++ ) { + if ( ( 0 === count ) || ( ptr + count > ptr_end ) ) { - scanline_buffer[ ptr ++ ] = byteValue; + return rgbe_error( rgbe_format_error, "bad scanline data" ); } - //ptr += count; - } else { + if ( isEncodedRun ) { + + // a (encoded) run of the same value + byteValue = buffer[ pos ++ ]; + for ( i = 0; i < count; i ++ ) { - // a literal-run - scanline_buffer.set( buffer.subarray( pos, pos + count ), ptr ); - ptr += count; pos += count; + scanline_buffer[ ptr ++ ] = byteValue; + + } + //ptr += count; + + } else { + + // a literal-run + scanline_buffer.set( buffer.subarray( pos, pos + count ), ptr ); + ptr += count; pos += count; + + } } - } + // now convert data from buffer into rgba + // first red, then green, then blue, then exponent (alpha) + l = scanline_width; //scanline_buffer.byteLength; + for ( i = 0; i < l; i ++ ) { - // now convert data from buffer into rgba - // first red, then green, then blue, then exponent (alpha) - l = scanline_width; //scanline_buffer.byteLength; - for ( i = 0; i < l; i ++ ) { + off = 0; + data_rgba[ offset ] = scanline_buffer[ i + off ]; + off += scanline_width; //1; + data_rgba[ offset + 1 ] = scanline_buffer[ i + off ]; + off += scanline_width; //1; + data_rgba[ offset + 2 ] = scanline_buffer[ i + off ]; + off += scanline_width; //1; + data_rgba[ offset + 3 ] = scanline_buffer[ i + off ]; + offset += 4; - off = 0; - data_rgba[ offset ] = scanline_buffer[ i + off ]; - off += scanline_width; //1; - data_rgba[ offset + 1 ] = scanline_buffer[ i + off ]; - off += scanline_width; //1; - data_rgba[ offset + 2 ] = scanline_buffer[ i + off ]; - off += scanline_width; //1; - data_rgba[ offset + 3 ] = scanline_buffer[ i + off ]; - offset += 4; + } + + num_scanlines --; } - num_scanlines --; + return data_rgba; - } + }; - return data_rgba; + var RGBEByteToRGBFloat = function ( sourceArray, sourceOffset, destArray, destOffset ) { - }; + var e = sourceArray[ sourceOffset + 3 ]; + var scale = Math.pow( 2.0, e - 128.0 ) / 255.0; - var RGBEByteToRGBFloat = function ( sourceArray, sourceOffset, destArray, destOffset ) { + destArray[ destOffset + 0 ] = sourceArray[ sourceOffset + 0 ] * scale; + destArray[ destOffset + 1 ] = sourceArray[ sourceOffset + 1 ] * scale; + destArray[ destOffset + 2 ] = sourceArray[ sourceOffset + 2 ] * scale; - var e = sourceArray[ sourceOffset + 3 ]; - var scale = Math.pow( 2.0, e - 128.0 ) / 255.0; + }; - destArray[ destOffset + 0 ] = sourceArray[ sourceOffset + 0 ] * scale; - destArray[ destOffset + 1 ] = sourceArray[ sourceOffset + 1 ] * scale; - destArray[ destOffset + 2 ] = sourceArray[ sourceOffset + 2 ] * scale; + var RGBEByteToRGBHalf = ( function () { - }; + // Source: http://gamedev.stackexchange.com/questions/17326/conversion-of-a-number-from-single-precision-floating-point-representation-to-a/17410#17410 - var RGBEByteToRGBHalf = ( function () { + var floatView = new Float32Array( 1 ); + var int32View = new Int32Array( floatView.buffer ); - // 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. */ + function toHalf( val ) { - var floatView = new Float32Array( 1 ); - var int32View = new Int32Array( floatView.buffer ); + floatView[ 0 ] = val; + var x = int32View[ 0 ]; - /* 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. */ - function toHalf( val ) { + 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 */ - floatView[ 0 ] = val; - var x = int32View[ 0 ]; + /* If zero, or denormal, or exponent underflows too much for a denormal + * half, return signed zero. */ + if ( e < 103 ) return bits; - 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 NaN, return NaN. If Inf or exponent overflow, return Inf. */ + if ( e > 142 ) { - /* If zero, or denormal, or exponent underflows too much for a denormal - * half, return signed zero. */ - if ( e < 103 ) return bits; + 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 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; - /* 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 ); + 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; } - 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; + return function ( sourceArray, sourceOffset, destArray, destOffset ) { - } + var e = sourceArray[ sourceOffset + 3 ]; + var scale = Math.pow( 2.0, e - 128.0 ) / 255.0; - return function ( sourceArray, sourceOffset, destArray, destOffset ) { + destArray[ destOffset + 0 ] = toHalf( sourceArray[ sourceOffset + 0 ] * scale ); + destArray[ destOffset + 1 ] = toHalf( sourceArray[ sourceOffset + 1 ] * scale ); + destArray[ destOffset + 2 ] = toHalf( sourceArray[ sourceOffset + 2 ] * scale ); - var e = sourceArray[ sourceOffset + 3 ]; - var scale = Math.pow( 2.0, e - 128.0 ) / 255.0; + }; - destArray[ destOffset + 0 ] = toHalf( sourceArray[ sourceOffset + 0 ] * scale ); - destArray[ destOffset + 1 ] = toHalf( sourceArray[ sourceOffset + 1 ] * scale ); - destArray[ destOffset + 2 ] = toHalf( sourceArray[ sourceOffset + 2 ] * scale ); + } )(); - }; + var byteArray = new Uint8Array( buffer ); + byteArray.pos = 0; + var rgbe_header_info = RGBE_ReadHeader( byteArray ); - } )(); + if ( RGBE_RETURN_FAILURE !== rgbe_header_info ) { - var byteArray = new Uint8Array( buffer ); - byteArray.pos = 0; - var rgbe_header_info = RGBE_ReadHeader( byteArray ); + var w = rgbe_header_info.width, + h = rgbe_header_info.height, + image_rgba_data = RGBE_ReadPixels_RLE( byteArray.subarray( byteArray.pos ), w, h ); - if ( RGBE_RETURN_FAILURE !== rgbe_header_info ) { + if ( RGBE_RETURN_FAILURE !== image_rgba_data ) { - var w = rgbe_header_info.width, - h = rgbe_header_info.height, - image_rgba_data = RGBE_ReadPixels_RLE( byteArray.subarray( byteArray.pos ), w, h ); + switch ( this.type ) { - if ( RGBE_RETURN_FAILURE !== image_rgba_data ) { + case THREE.UnsignedByteType: - switch ( this.type ) { + var data = image_rgba_data; + var format = THREE.RGBEFormat; // handled as THREE.RGBAFormat in shaders + var type = THREE.UnsignedByteType; + break; - case THREE.UnsignedByteType: + case THREE.FloatType: - var data = image_rgba_data; - var format = THREE.RGBEFormat; // handled as THREE.RGBAFormat in shaders - var type = THREE.UnsignedByteType; - break; + var numElements = ( image_rgba_data.length / 4 ) * 3; + var floatArray = new Float32Array( numElements ); - case THREE.FloatType: + for ( var j = 0; j < numElements; j ++ ) { - var numElements = ( image_rgba_data.length / 4 ) * 3; - var floatArray = new Float32Array( numElements ); + RGBEByteToRGBFloat( image_rgba_data, j * 4, floatArray, j * 3 ); - for ( var j = 0; j < numElements; j ++ ) { + } - RGBEByteToRGBFloat( image_rgba_data, j * 4, floatArray, j * 3 ); + var data = floatArray; + var format = THREE.RGBFormat; + var type = THREE.FloatType; + break; - } + case THREE.HalfFloatType: - var data = floatArray; - var format = THREE.RGBFormat; - var type = THREE.FloatType; - break; + var numElements = ( image_rgba_data.length / 4 ) * 3; + var halfArray = new Uint16Array( numElements ); - case THREE.HalfFloatType: + for ( var j = 0; j < numElements; j ++ ) { - var numElements = ( image_rgba_data.length / 4 ) * 3; - var halfArray = new Uint16Array( numElements ); + RGBEByteToRGBHalf( image_rgba_data, j * 4, halfArray, j * 3 ); - for ( var j = 0; j < numElements; j ++ ) { + } - RGBEByteToRGBHalf( image_rgba_data, j * 4, halfArray, j * 3 ); + var data = halfArray; + var format = THREE.RGBFormat; + var type = THREE.HalfFloatType; + break; - } + default: - var data = halfArray; - var format = THREE.RGBFormat; - var type = THREE.HalfFloatType; - break; + console.error( 'THREE.RGBELoader: unsupported type: ', this.type ); + break; - default: + } - console.error( 'THREE.RGBELoader: unsupported type: ', this.type ); - break; + return { + width: w, height: h, + data: data, + header: rgbe_header_info.string, + gamma: rgbe_header_info.gamma, + exposure: rgbe_header_info.exposure, + format: format, + type: type + }; } - return { - width: w, height: h, - data: data, - header: rgbe_header_info.string, - gamma: rgbe_header_info.gamma, - exposure: rgbe_header_info.exposure, - format: format, - type: type - }; - } - } - - return null; - -}; - -THREE.RGBELoader.prototype.setDataType = function ( value ) { + return null; - this.type = value; - return this; + }, -}; + setDataType: function ( value ) { -THREE.RGBELoader.prototype.setType = function ( value ) { + this.type = value; + return this; - console.warn( 'THREE.RGBELoader: .setType() has been renamed to .setDataType().' ); + }, - return this.setDataType( value ); + load: function ( url, onLoad, onProgress, onError ) { -}; + function onLoadCallback( texture, texData ) { -THREE.RGBELoader.prototype.load = function ( url, onLoad, onProgress, onError ) { + switch ( texture.type ) { - function onLoadCallback( texture, texData ) { + case THREE.UnsignedByteType: - switch ( texture.type ) { + texture.encoding = THREE.RGBEEncoding; + texture.minFilter = THREE.NearestFilter; + texture.magFilter = THREE.NearestFilter; + texture.generateMipmaps = false; + texture.flipY = true; + break; - case THREE.UnsignedByteType: + case THREE.FloatType: - texture.encoding = THREE.RGBEEncoding; - texture.minFilter = THREE.NearestFilter; - texture.magFilter = THREE.NearestFilter; - texture.generateMipmaps = false; - texture.flipY = true; - break; + texture.encoding = THREE.LinearEncoding; + texture.minFilter = THREE.LinearFilter; + texture.magFilter = THREE.LinearFilter; + texture.generateMipmaps = false; + texture.flipY = true; + break; - case THREE.FloatType: + case THREE.HalfFloatType: - texture.encoding = THREE.LinearEncoding; - texture.minFilter = THREE.LinearFilter; - texture.magFilter = THREE.LinearFilter; - texture.generateMipmaps = false; - texture.flipY = true; - break; + texture.encoding = THREE.LinearEncoding; + texture.minFilter = THREE.LinearFilter; + texture.magFilter = THREE.LinearFilter; + texture.generateMipmaps = false; + texture.flipY = true; + break; - case THREE.HalfFloatType: + } - texture.encoding = THREE.LinearEncoding; - texture.minFilter = THREE.LinearFilter; - texture.magFilter = THREE.LinearFilter; - texture.generateMipmaps = false; - texture.flipY = true; - break; + if ( onLoad ) onLoad( texture, texData ); } - if ( onLoad ) onLoad( texture, texData ); + return THREE.DataTextureLoader.prototype.load.call( this, url, onLoadCallback, onProgress, onError ); } - return THREE.DataTextureLoader.prototype.load.call( this, url, onLoadCallback, onProgress, onError ); - -}; +} ); diff --git a/examples/jsm/loaders/EXRLoader.d.ts b/examples/jsm/loaders/EXRLoader.d.ts index 98c918fd47e015..f510c05e100380 100644 --- a/examples/jsm/loaders/EXRLoader.d.ts +++ b/examples/jsm/loaders/EXRLoader.d.ts @@ -18,6 +18,6 @@ export class EXRLoader extends DataTextureLoader { constructor(manager?: LoadingManager); type: TextureDataType; - _parser(buffer: ArrayBuffer) : EXR; + parse(buffer: ArrayBuffer) : EXR; setDataType(type: TextureDataType): this; } diff --git a/examples/jsm/loaders/EXRLoader.js b/examples/jsm/loaders/EXRLoader.js index 984814d73e8583..a0676850c9d265 100644 --- a/examples/jsm/loaders/EXRLoader.js +++ b/examples/jsm/loaders/EXRLoader.js @@ -10,7 +10,6 @@ import { DataTextureLoader, - DefaultLoadingManager, FloatType, HalfFloatType, RGBAFormat, @@ -84,544 +83,541 @@ import { var EXRLoader = function ( manager ) { - this.manager = ( manager !== undefined ) ? manager : DefaultLoadingManager; + DataTextureLoader.call( this, manager ); + this.type = FloatType; }; -EXRLoader.prototype = Object.create( DataTextureLoader.prototype ); - -EXRLoader.prototype.setDataType = function ( value ) { +EXRLoader.prototype = Object.assign( Object.create( DataTextureLoader.prototype ), { - this.type = value; - return this; - -}; + constructor: EXRLoader, -EXRLoader.prototype.setType = function ( value ) { + setDataType: function ( value ) { - console.warn( 'THREE.EXRLoader: .setType() has been renamed to .setDataType().' ); + this.type = value; + return this; - return this.setDataType( value ); + }, -}; + parse: function ( buffer ) { -EXRLoader.prototype._parser = function ( buffer ) { + const USHORT_RANGE = ( 1 << 16 ); + const BITMAP_SIZE = ( USHORT_RANGE >> 3 ); - const USHORT_RANGE = ( 1 << 16 ); - const BITMAP_SIZE = ( USHORT_RANGE >> 3 ); + const HUF_ENCBITS = 16; // literal (value) bit length + const HUF_DECBITS = 14; // decoding bit size (>= 8) - const HUF_ENCBITS = 16; // literal (value) bit length - const HUF_DECBITS = 14; // decoding bit size (>= 8) + const HUF_ENCSIZE = ( 1 << HUF_ENCBITS ) + 1; // encoding table size + const HUF_DECSIZE = 1 << HUF_DECBITS; // decoding table size + const HUF_DECMASK = HUF_DECSIZE - 1; - const HUF_ENCSIZE = ( 1 << HUF_ENCBITS ) + 1; // encoding table size - const HUF_DECSIZE = 1 << HUF_DECBITS; // decoding table size - const HUF_DECMASK = HUF_DECSIZE - 1; + const SHORT_ZEROCODE_RUN = 59; + const LONG_ZEROCODE_RUN = 63; + const SHORTEST_LONG_RUN = 2 + LONG_ZEROCODE_RUN - SHORT_ZEROCODE_RUN; - const SHORT_ZEROCODE_RUN = 59; - const LONG_ZEROCODE_RUN = 63; - const SHORTEST_LONG_RUN = 2 + LONG_ZEROCODE_RUN - SHORT_ZEROCODE_RUN; + const BYTES_PER_HALF = 2; - const BYTES_PER_HALF = 2; + const ULONG_SIZE = 8; + const FLOAT32_SIZE = 4; + const INT32_SIZE = 4; + const INT16_SIZE = 2; + const INT8_SIZE = 1; - const ULONG_SIZE = 8; - const FLOAT32_SIZE = 4; - const INT32_SIZE = 4; - const INT16_SIZE = 2; - const INT8_SIZE = 1; + function reverseLutFromBitmap( bitmap, lut ) { - function reverseLutFromBitmap( bitmap, lut ) { + var k = 0; - var k = 0; + for ( var i = 0; i < USHORT_RANGE; ++ i ) { - for ( var i = 0; i < USHORT_RANGE; ++ i ) { + if ( ( i == 0 ) || ( bitmap[ i >> 3 ] & ( 1 << ( i & 7 ) ) ) ) { - if ( ( i == 0 ) || ( bitmap[ i >> 3 ] & ( 1 << ( i & 7 ) ) ) ) { + lut[ k ++ ] = i; - lut[ k ++ ] = i; + } } - } + var n = k - 1; - var n = k - 1; + while ( k < USHORT_RANGE ) lut[ k ++ ] = 0; - while ( k < USHORT_RANGE ) lut[ k ++ ] = 0; + return n; - return n; + } - } + function hufClearDecTable( hdec ) { - function hufClearDecTable( hdec ) { + for ( var i = 0; i < HUF_DECSIZE; i ++ ) { - for ( var i = 0; i < HUF_DECSIZE; i ++ ) { + hdec[ i ] = {}; + hdec[ i ].len = 0; + hdec[ i ].lit = 0; + hdec[ i ].p = null; - hdec[ i ] = {}; - hdec[ i ].len = 0; - hdec[ i ].lit = 0; - hdec[ i ].p = null; + } } - } + const getBitsReturn = { l: 0, c: 0, lc: 0 }; - const getBitsReturn = { l: 0, c: 0, lc: 0 }; + function getBits( nBits, c, lc, uInt8Array, inOffset ) { - function getBits( nBits, c, lc, uInt8Array, inOffset ) { + while ( lc < nBits ) { - while ( lc < nBits ) { + c = ( c << 8 ) | parseUint8Array( uInt8Array, inOffset ); + lc += 8; - c = ( c << 8 ) | parseUint8Array( uInt8Array, inOffset ); - lc += 8; + } - } + lc -= nBits; - lc -= nBits; + getBitsReturn.l = ( c >> lc ) & ( ( 1 << nBits ) - 1 ); + getBitsReturn.c = c; + getBitsReturn.lc = lc; - getBitsReturn.l = ( c >> lc ) & ( ( 1 << nBits ) - 1 ); - getBitsReturn.c = c; - getBitsReturn.lc = lc; + } - } + const hufTableBuffer = new Array( 59 ); - const hufTableBuffer = new Array( 59 ); + function hufCanonicalCodeTable( hcode ) { - function hufCanonicalCodeTable( hcode ) { + for ( var i = 0; i <= 58; ++ i ) hufTableBuffer[ i ] = 0; + for ( var i = 0; i < HUF_ENCSIZE; ++ i ) hufTableBuffer[ hcode[ i ] ] += 1; - for ( var i = 0; i <= 58; ++ i ) hufTableBuffer[ i ] = 0; - for ( var i = 0; i < HUF_ENCSIZE; ++ i ) hufTableBuffer[ hcode[ i ] ] += 1; + var c = 0; - var c = 0; + for ( var i = 58; i > 0; -- i ) { - for ( var i = 58; i > 0; -- i ) { + var nc = ( ( c + hufTableBuffer[ i ] ) >> 1 ); + hufTableBuffer[ i ] = c; + c = nc; - var nc = ( ( c + hufTableBuffer[ i ] ) >> 1 ); - hufTableBuffer[ i ] = c; - c = nc; + } - } + for ( var i = 0; i < HUF_ENCSIZE; ++ i ) { - for ( var i = 0; i < HUF_ENCSIZE; ++ i ) { + var l = hcode[ i ]; + if ( l > 0 ) hcode[ i ] = l | ( hufTableBuffer[ l ] ++ << 6 ); - var l = hcode[ i ]; - if ( l > 0 ) hcode[ i ] = l | ( hufTableBuffer[ l ] ++ << 6 ); + } } - } + function hufUnpackEncTable( uInt8Array, inDataView, inOffset, ni, im, iM, hcode ) { - function hufUnpackEncTable( uInt8Array, inDataView, inOffset, ni, im, iM, hcode ) { + var p = inOffset; + var c = 0; + var lc = 0; - var p = inOffset; - var c = 0; - var lc = 0; + for ( ; im <= iM; im ++ ) { - for ( ; im <= iM; im ++ ) { + if ( p.value - inOffset.value > ni ) return false; - if ( p.value - inOffset.value > ni ) return false; + getBits( 6, c, lc, uInt8Array, p ); - getBits( 6, c, lc, uInt8Array, p ); + var l = getBitsReturn.l; + c = getBitsReturn.c; + lc = getBitsReturn.lc; - var l = getBitsReturn.l; - c = getBitsReturn.c; - lc = getBitsReturn.lc; + hcode[ im ] = l; - hcode[ im ] = l; + if ( l == LONG_ZEROCODE_RUN ) { - if ( l == LONG_ZEROCODE_RUN ) { + if ( p.value - inOffset.value > ni ) { - if ( p.value - inOffset.value > ni ) { + throw 'Something wrong with hufUnpackEncTable'; - throw 'Something wrong with hufUnpackEncTable'; + } - } + getBits( 8, c, lc, uInt8Array, p ); - getBits( 8, c, lc, uInt8Array, p ); + var zerun = getBitsReturn.l + SHORTEST_LONG_RUN; + c = getBitsReturn.c; + lc = getBitsReturn.lc; - var zerun = getBitsReturn.l + SHORTEST_LONG_RUN; - c = getBitsReturn.c; - lc = getBitsReturn.lc; + if ( im + zerun > iM + 1 ) { - if ( im + zerun > iM + 1 ) { + throw 'Something wrong with hufUnpackEncTable'; - throw 'Something wrong with hufUnpackEncTable'; + } - } + while ( zerun -- ) hcode[ im ++ ] = 0; - while ( zerun -- ) hcode[ im ++ ] = 0; + im --; - im --; + } else if ( l >= SHORT_ZEROCODE_RUN ) { - } else if ( l >= SHORT_ZEROCODE_RUN ) { + var zerun = l - SHORT_ZEROCODE_RUN + 2; - var zerun = l - SHORT_ZEROCODE_RUN + 2; + if ( im + zerun > iM + 1 ) { - if ( im + zerun > iM + 1 ) { + throw 'Something wrong with hufUnpackEncTable'; - throw 'Something wrong with hufUnpackEncTable'; + } - } + while ( zerun -- ) hcode[ im ++ ] = 0; - while ( zerun -- ) hcode[ im ++ ] = 0; + im --; - im --; + } } + hufCanonicalCodeTable( hcode ); + } - hufCanonicalCodeTable( hcode ); + function hufLength( code ) { - } + return code & 63; - function hufLength( code ) { + } - return code & 63; + function hufCode( code ) { - } + return code >> 6; - function hufCode( code ) { + } - return code >> 6; + function hufBuildDecTable( hcode, im, iM, hdecod ) { - } + for ( ; im <= iM; im ++ ) { - function hufBuildDecTable( hcode, im, iM, hdecod ) { + var c = hufCode( hcode[ im ] ); + var l = hufLength( hcode[ im ] ); - for ( ; im <= iM; im ++ ) { + if ( c >> l ) { - var c = hufCode( hcode[ im ] ); - var l = hufLength( hcode[ im ] ); + throw 'Invalid table entry'; - if ( c >> l ) { + } - throw 'Invalid table entry'; + if ( l > HUF_DECBITS ) { - } + var pl = hdecod[ ( c >> ( l - HUF_DECBITS ) ) ]; - if ( l > HUF_DECBITS ) { + if ( pl.len ) { - var pl = hdecod[ ( c >> ( l - HUF_DECBITS ) ) ]; + throw 'Invalid table entry'; - if ( pl.len ) { + } - throw 'Invalid table entry'; + pl.lit ++; - } + if ( pl.p ) { - pl.lit ++; + var p = pl.p; + pl.p = new Array( pl.lit ); - if ( pl.p ) { + for ( var i = 0; i < pl.lit - 1; ++ i ) { - var p = pl.p; - pl.p = new Array( pl.lit ); + pl.p[ i ] = p[ i ]; - for ( var i = 0; i < pl.lit - 1; ++ i ) { + } - pl.p[ i ] = p[ i ]; + } else { + + pl.p = new Array( 1 ); } - } else { + pl.p[ pl.lit - 1 ] = im; - pl.p = new Array( 1 ); + } else if ( l ) { - } + var plOffset = 0; - pl.p[ pl.lit - 1 ] = im; + for ( var i = 1 << ( HUF_DECBITS - l ); i > 0; i -- ) { - } else if ( l ) { + var pl = hdecod[ ( c << ( HUF_DECBITS - l ) ) + plOffset ]; - var plOffset = 0; + if ( pl.len || pl.p ) { - for ( var i = 1 << ( HUF_DECBITS - l ); i > 0; i -- ) { + throw 'Invalid table entry'; - var pl = hdecod[ ( c << ( HUF_DECBITS - l ) ) + plOffset ]; + } - if ( pl.len || pl.p ) { + pl.len = l; + pl.lit = im; - throw 'Invalid table entry'; + plOffset ++; } - pl.len = l; - pl.lit = im; - - plOffset ++; - } } + return true; + } - return true; + const getCharReturn = { c: 0, lc: 0 }; - } + function getChar( c, lc, uInt8Array, inOffset ) { - const getCharReturn = { c: 0, lc: 0 }; + c = ( c << 8 ) | parseUint8Array( uInt8Array, inOffset ); + lc += 8; - function getChar( c, lc, uInt8Array, inOffset ) { + getCharReturn.c = c; + getCharReturn.lc = lc; - c = ( c << 8 ) | parseUint8Array( uInt8Array, inOffset ); - lc += 8; + } - getCharReturn.c = c; - getCharReturn.lc = lc; + const getCodeReturn = { c: 0, lc: 0 }; - } + function getCode( po, rlc, c, lc, uInt8Array, inDataView, inOffset, outBuffer, outBufferOffset, outBufferEndOffset ) { - const getCodeReturn = { c: 0, lc: 0 }; + if ( po == rlc ) { - function getCode( po, rlc, c, lc, uInt8Array, inDataView, inOffset, outBuffer, outBufferOffset, outBufferEndOffset ) { + if ( lc < 8 ) { - if ( po == rlc ) { + getChar( c, lc, uInt8Array, inOffset ); + c = getCharReturn.c; + lc = getCharReturn.lc; - if ( lc < 8 ) { + } - getChar( c, lc, uInt8Array, inOffset ); - c = getCharReturn.c; - lc = getCharReturn.lc; + lc -= 8; - } + var cs = ( c >> lc ); + var cs = new Uint8Array( [ cs ] )[ 0 ]; - lc -= 8; + if ( outBufferOffset.value + cs > outBufferEndOffset ) { - var cs = ( c >> lc ); - var cs = new Uint8Array( [ cs ] )[ 0 ]; + return false; - if ( outBufferOffset.value + cs > outBufferEndOffset ) { + } - return false; + var s = outBuffer[ outBufferOffset.value - 1 ]; - } + while ( cs -- > 0 ) { - var s = outBuffer[ outBufferOffset.value - 1 ]; + outBuffer[ outBufferOffset.value ++ ] = s; - while ( cs -- > 0 ) { + } - outBuffer[ outBufferOffset.value ++ ] = s; + } else if ( outBufferOffset.value < outBufferEndOffset ) { - } + outBuffer[ outBufferOffset.value ++ ] = po; - } else if ( outBufferOffset.value < outBufferEndOffset ) { + } else { - outBuffer[ outBufferOffset.value ++ ] = po; + return false; - } else { + } - return false; + getCodeReturn.c = c; + getCodeReturn.lc = lc; } - getCodeReturn.c = c; - getCodeReturn.lc = lc; - - } + function UInt16( value ) { - function UInt16( value ) { + return ( value & 0xFFFF ); - return ( value & 0xFFFF ); + } - } + function Int16( value ) { - function Int16( value ) { + var ref = UInt16( value ); + return ( ref > 0x7FFF ) ? ref - 0x10000 : ref; - var ref = UInt16( value ); - return ( ref > 0x7FFF ) ? ref - 0x10000 : ref; + } - } + const wdec14Return = { a: 0, b: 0 }; - const wdec14Return = { a: 0, b: 0 }; + function wdec14( l, h ) { - function wdec14( l, h ) { + var ls = Int16( l ); + var hs = Int16( h ); - var ls = Int16( l ); - var hs = Int16( h ); + var hi = hs; + var ai = ls + ( hi & 1 ) + ( hi >> 1 ); - var hi = hs; - var ai = ls + ( hi & 1 ) + ( hi >> 1 ); + var as = ai; + var bs = ai - hi; - var as = ai; - var bs = ai - hi; + wdec14Return.a = as; + wdec14Return.b = bs; - wdec14Return.a = as; - wdec14Return.b = bs; + } - } + function wav2Decode( j, buffer, nx, ox, ny, oy ) { - function wav2Decode( j, buffer, nx, ox, ny, oy ) { + var n = ( nx > ny ) ? ny : nx; + var p = 1; + var p2; - var n = ( nx > ny ) ? ny : nx; - var p = 1; - var p2; + while ( p <= n ) p <<= 1; - while ( p <= n ) p <<= 1; + p >>= 1; + p2 = p; + p >>= 1; - p >>= 1; - p2 = p; - p >>= 1; + while ( p >= 1 ) { - while ( p >= 1 ) { + var py = 0; + var ey = py + oy * ( ny - p2 ); + var oy1 = oy * p; + var oy2 = oy * p2; + var ox1 = ox * p; + var ox2 = ox * p2; + var i00, i01, i10, i11; - var py = 0; - var ey = py + oy * ( ny - p2 ); - var oy1 = oy * p; - var oy2 = oy * p2; - var ox1 = ox * p; - var ox2 = ox * p2; - var i00, i01, i10, i11; + for ( ; py <= ey; py += oy2 ) { - for ( ; py <= ey; py += oy2 ) { + var px = py; + var ex = py + ox * ( nx - p2 ); - var px = py; - var ex = py + ox * ( nx - p2 ); + for ( ; px <= ex; px += ox2 ) { - for ( ; px <= ex; px += ox2 ) { + var p01 = px + ox1; + var p10 = px + oy1; + var p11 = p10 + ox1; - var p01 = px + ox1; - var p10 = px + oy1; - var p11 = p10 + ox1; + wdec14( buffer[ px + j ], buffer[ p10 + j ] ); - wdec14( buffer[ px + j ], buffer[ p10 + j ] ); + i00 = wdec14Return.a; + i10 = wdec14Return.b; - i00 = wdec14Return.a; - i10 = wdec14Return.b; + wdec14( buffer[ p01 + j ], buffer[ p11 + j ] ); - wdec14( buffer[ p01 + j ], buffer[ p11 + j ] ); + i01 = wdec14Return.a; + i11 = wdec14Return.b; - i01 = wdec14Return.a; - i11 = wdec14Return.b; + wdec14( i00, i01 ); - wdec14( i00, i01 ); + buffer[ px + j ] = wdec14Return.a; + buffer[ p01 + j ] = wdec14Return.b; - buffer[ px + j ] = wdec14Return.a; - buffer[ p01 + j ] = wdec14Return.b; + wdec14( i10, i11 ); - wdec14( i10, i11 ); + buffer[ p10 + j ] = wdec14Return.a; + buffer[ p11 + j ] = wdec14Return.b; - buffer[ p10 + j ] = wdec14Return.a; - buffer[ p11 + j ] = wdec14Return.b; + } - } + if ( nx & p ) { - if ( nx & p ) { + var p10 = px + oy1; - var p10 = px + oy1; + wdec14( buffer[ px + j ], buffer[ p10 + j ] ); - wdec14( buffer[ px + j ], buffer[ p10 + j ] ); + i00 = wdec14Return.a; + buffer[ p10 + j ] = wdec14Return.b; - i00 = wdec14Return.a; - buffer[ p10 + j ] = wdec14Return.b; + buffer[ px + j ] = i00; - buffer[ px + j ] = i00; + } } - } + if ( ny & p ) { - if ( ny & p ) { + var px = py; + var ex = py + ox * ( nx - p2 ); - var px = py; - var ex = py + ox * ( nx - p2 ); + for ( ; px <= ex; px += ox2 ) { - for ( ; px <= ex; px += ox2 ) { + var p01 = px + ox1; - var p01 = px + ox1; + wdec14( buffer[ px + j ], buffer[ p01 + j ] ); - wdec14( buffer[ px + j ], buffer[ p01 + j ] ); + i00 = wdec14Return.a; + buffer[ p01 + j ] = wdec14Return.b; - i00 = wdec14Return.a; - buffer[ p01 + j ] = wdec14Return.b; + buffer[ px + j ] = i00; - buffer[ px + j ] = i00; + } } + p2 = p; + p >>= 1; + } - p2 = p; - p >>= 1; + return py; } - return py; + function hufDecode( encodingTable, decodingTable, uInt8Array, inDataView, inOffset, ni, rlc, no, outBuffer, outOffset ) { - } + var c = 0; + var lc = 0; + var outBufferEndOffset = no; + var inOffsetEnd = Math.trunc( inOffset.value + ( ni + 7 ) / 8 ); - function hufDecode( encodingTable, decodingTable, uInt8Array, inDataView, inOffset, ni, rlc, no, outBuffer, outOffset ) { + while ( inOffset.value < inOffsetEnd ) { - var c = 0; - var lc = 0; - var outBufferEndOffset = no; - var inOffsetEnd = Math.trunc( inOffset.value + ( ni + 7 ) / 8 ); + getChar( c, lc, uInt8Array, inOffset ); - while ( inOffset.value < inOffsetEnd ) { + c = getCharReturn.c; + lc = getCharReturn.lc; - getChar( c, lc, uInt8Array, inOffset ); + while ( lc >= HUF_DECBITS ) { - c = getCharReturn.c; - lc = getCharReturn.lc; + var index = ( c >> ( lc - HUF_DECBITS ) ) & HUF_DECMASK; + var pl = decodingTable[ index ]; - while ( lc >= HUF_DECBITS ) { + if ( pl.len ) { - var index = ( c >> ( lc - HUF_DECBITS ) ) & HUF_DECMASK; - var pl = decodingTable[ index ]; + lc -= pl.len; - if ( pl.len ) { + getCode( pl.lit, rlc, c, lc, uInt8Array, inDataView, inOffset, outBuffer, outOffset, outBufferEndOffset ); - lc -= pl.len; - - getCode( pl.lit, rlc, c, lc, uInt8Array, inDataView, inOffset, outBuffer, outOffset, outBufferEndOffset ); + c = getCodeReturn.c; + lc = getCodeReturn.lc; - c = getCodeReturn.c; - lc = getCodeReturn.lc; + } else { - } else { + if ( ! pl.p ) { - if ( ! pl.p ) { + throw 'hufDecode issues'; - throw 'hufDecode issues'; + } - } + var j; - var j; + for ( j = 0; j < pl.lit; j ++ ) { - for ( j = 0; j < pl.lit; j ++ ) { + var l = hufLength( encodingTable[ pl.p[ j ] ] ); - var l = hufLength( encodingTable[ pl.p[ j ] ] ); + while ( lc < l && inOffset.value < inOffsetEnd ) { - while ( lc < l && inOffset.value < inOffsetEnd ) { + getChar( c, lc, uInt8Array, inOffset ); - getChar( c, lc, uInt8Array, inOffset ); + c = getCharReturn.c; + lc = getCharReturn.lc; - c = getCharReturn.c; - lc = getCharReturn.lc; + } - } + if ( lc >= l ) { - if ( lc >= l ) { + if ( hufCode( encodingTable[ pl.p[ j ] ] ) == ( ( c >> ( lc - l ) ) & ( ( 1 << l ) - 1 ) ) ) { - if ( hufCode( encodingTable[ pl.p[ j ] ] ) == ( ( c >> ( lc - l ) ) & ( ( 1 << l ) - 1 ) ) ) { + lc -= l; - lc -= l; + getCode( pl.p[ j ], rlc, c, lc, uInt8Array, inDataView, inOffset, outBuffer, outOffset, outBufferEndOffset ); - getCode( pl.p[ j ], rlc, c, lc, uInt8Array, inDataView, inOffset, outBuffer, outOffset, outBufferEndOffset ); + c = getCodeReturn.c; + lc = getCodeReturn.lc; - c = getCodeReturn.c; - lc = getCodeReturn.lc; + break; - break; + } } } - } + if ( j == pl.lit ) { - if ( j == pl.lit ) { + throw 'hufDecode issues'; - throw 'hufDecode issues'; + } } @@ -629,598 +625,598 @@ EXRLoader.prototype._parser = function ( buffer ) { } - } + var i = ( 8 - ni ) & 7; - var i = ( 8 - ni ) & 7; + c >>= i; + lc -= i; - c >>= i; - lc -= i; + while ( lc > 0 ) { - while ( lc > 0 ) { + var pl = decodingTable[ ( c << ( HUF_DECBITS - lc ) ) & HUF_DECMASK ]; - var pl = decodingTable[ ( c << ( HUF_DECBITS - lc ) ) & HUF_DECMASK ]; + if ( pl.len ) { - if ( pl.len ) { + lc -= pl.len; - lc -= pl.len; + getCode( pl.lit, rlc, c, lc, uInt8Array, inDataView, inOffset, outBuffer, outOffset, outBufferEndOffset ); - getCode( pl.lit, rlc, c, lc, uInt8Array, inDataView, inOffset, outBuffer, outOffset, outBufferEndOffset ); + c = getCodeReturn.c; + lc = getCodeReturn.lc; - c = getCodeReturn.c; - lc = getCodeReturn.lc; + } else { - } else { + throw 'hufDecode issues'; - throw 'hufDecode issues'; + } } + return true; + } - return true; + function hufUncompress( uInt8Array, inDataView, inOffset, nCompressed, outBuffer, outOffset, nRaw ) { - } + var initialInOffset = inOffset.value; - function hufUncompress( uInt8Array, inDataView, inOffset, nCompressed, outBuffer, outOffset, nRaw ) { + var im = parseUint32( inDataView, inOffset ); + var iM = parseUint32( inDataView, inOffset ); - var initialInOffset = inOffset.value; + inOffset.value += 4; - var im = parseUint32( inDataView, inOffset ); - var iM = parseUint32( inDataView, inOffset ); + var nBits = parseUint32( inDataView, inOffset ); - inOffset.value += 4; + inOffset.value += 4; - var nBits = parseUint32( inDataView, inOffset ); + if ( im < 0 || im >= HUF_ENCSIZE || iM < 0 || iM >= HUF_ENCSIZE ) { - inOffset.value += 4; + throw 'Something wrong with HUF_ENCSIZE'; - if ( im < 0 || im >= HUF_ENCSIZE || iM < 0 || iM >= HUF_ENCSIZE ) { + } - throw 'Something wrong with HUF_ENCSIZE'; + var freq = new Array( HUF_ENCSIZE ); + var hdec = new Array( HUF_DECSIZE ); - } + hufClearDecTable( hdec ); - var freq = new Array( HUF_ENCSIZE ); - var hdec = new Array( HUF_DECSIZE ); + var ni = nCompressed - ( inOffset.value - initialInOffset ); - hufClearDecTable( hdec ); + hufUnpackEncTable( uInt8Array, inDataView, inOffset, ni, im, iM, freq ); - var ni = nCompressed - ( inOffset.value - initialInOffset ); + if ( nBits > 8 * ( nCompressed - ( inOffset.value - initialInOffset ) ) ) { - hufUnpackEncTable( uInt8Array, inDataView, inOffset, ni, im, iM, freq ); + throw 'Something wrong with hufUncompress'; - if ( nBits > 8 * ( nCompressed - ( inOffset.value - initialInOffset ) ) ) { + } - throw 'Something wrong with hufUncompress'; + hufBuildDecTable( freq, im, iM, hdec ); - } + hufDecode( freq, hdec, uInt8Array, inDataView, inOffset, nBits, iM, nRaw, outBuffer, outOffset ); - hufBuildDecTable( freq, im, iM, hdec ); - - hufDecode( freq, hdec, uInt8Array, inDataView, inOffset, nBits, iM, nRaw, outBuffer, outOffset ); + } - } + function applyLut( lut, data, nData ) { - function applyLut( lut, data, nData ) { + for ( var i = 0; i < nData; ++ i ) { - for ( var i = 0; i < nData; ++ i ) { + data[ i ] = lut[ data[ i ] ]; - data[ i ] = lut[ data[ i ] ]; + } } - } + function decompressPIZ( outBuffer, outOffset, uInt8Array, inDataView, inOffset, tmpBufSize, num_channels, exrChannelInfos, dataWidth, num_lines ) { - function decompressPIZ( outBuffer, outOffset, uInt8Array, inDataView, inOffset, tmpBufSize, num_channels, exrChannelInfos, dataWidth, num_lines ) { + var bitmap = new Uint8Array( BITMAP_SIZE ); - var bitmap = new Uint8Array( BITMAP_SIZE ); + var minNonZero = parseUint16( inDataView, inOffset ); + var maxNonZero = parseUint16( inDataView, inOffset ); - var minNonZero = parseUint16( inDataView, inOffset ); - var maxNonZero = parseUint16( inDataView, inOffset ); + if ( maxNonZero >= BITMAP_SIZE ) { - if ( maxNonZero >= BITMAP_SIZE ) { + throw 'Something is wrong with PIZ_COMPRESSION BITMAP_SIZE'; - throw 'Something is wrong with PIZ_COMPRESSION BITMAP_SIZE'; + } - } + if ( minNonZero <= maxNonZero ) { - if ( minNonZero <= maxNonZero ) { + for ( var i = 0; i < maxNonZero - minNonZero + 1; i ++ ) { - for ( var i = 0; i < maxNonZero - minNonZero + 1; i ++ ) { + bitmap[ i + minNonZero ] = parseUint8( inDataView, inOffset ); - bitmap[ i + minNonZero ] = parseUint8( inDataView, inOffset ); + } } - } + var lut = new Uint16Array( USHORT_RANGE ); + reverseLutFromBitmap( bitmap, lut ); - var lut = new Uint16Array( USHORT_RANGE ); - reverseLutFromBitmap( bitmap, lut ); + var length = parseUint32( inDataView, inOffset ); - var length = parseUint32( inDataView, inOffset ); + hufUncompress( uInt8Array, inDataView, inOffset, length, outBuffer, outOffset, tmpBufSize ); - hufUncompress( uInt8Array, inDataView, inOffset, length, outBuffer, outOffset, tmpBufSize ); + var pizChannelData = new Array( num_channels ); - var pizChannelData = new Array( num_channels ); + var outBufferEnd = 0; - var outBufferEnd = 0; + for ( var i = 0; i < num_channels; i ++ ) { - for ( var i = 0; i < num_channels; i ++ ) { + pizChannelData[ i ] = {}; + pizChannelData[ i ][ 'start' ] = outBufferEnd; + pizChannelData[ i ][ 'end' ] = pizChannelData[ i ][ 'start' ]; + pizChannelData[ i ][ 'nx' ] = dataWidth; + pizChannelData[ i ][ 'ny' ] = num_lines; + pizChannelData[ i ][ 'size' ] = 1; - pizChannelData[ i ] = {}; - pizChannelData[ i ][ 'start' ] = outBufferEnd; - pizChannelData[ i ][ 'end' ] = pizChannelData[ i ][ 'start' ]; - pizChannelData[ i ][ 'nx' ] = dataWidth; - pizChannelData[ i ][ 'ny' ] = num_lines; - pizChannelData[ i ][ 'size' ] = 1; + outBufferEnd += pizChannelData[ i ].nx * pizChannelData[ i ].ny * pizChannelData[ i ].size; - outBufferEnd += pizChannelData[ i ].nx * pizChannelData[ i ].ny * pizChannelData[ i ].size; + } - } + var fooOffset = 0; - var fooOffset = 0; + for ( var i = 0; i < num_channels; i ++ ) { - for ( var i = 0; i < num_channels; i ++ ) { + for ( var j = 0; j < pizChannelData[ i ].size; ++ j ) { - for ( var j = 0; j < pizChannelData[ i ].size; ++ j ) { + fooOffset += wav2Decode( + j + fooOffset, + outBuffer, + pizChannelData[ i ].nx, + pizChannelData[ i ].size, + pizChannelData[ i ].ny, + pizChannelData[ i ].nx * pizChannelData[ i ].size + ); - fooOffset += wav2Decode( - j + fooOffset, - outBuffer, - pizChannelData[ i ].nx, - pizChannelData[ i ].size, - pizChannelData[ i ].ny, - pizChannelData[ i ].nx * pizChannelData[ i ].size - ); + } } - } + applyLut( lut, outBuffer, outBufferEnd ); - applyLut( lut, outBuffer, outBufferEnd ); + return true; - return true; + } - } + function parseNullTerminatedString( buffer, offset ) { - function parseNullTerminatedString( buffer, offset ) { + var uintBuffer = new Uint8Array( buffer ); + var endOffset = 0; - var uintBuffer = new Uint8Array( buffer ); - var endOffset = 0; + while ( uintBuffer[ offset.value + endOffset ] != 0 ) { - while ( uintBuffer[ offset.value + endOffset ] != 0 ) { + endOffset += 1; - endOffset += 1; + } - } + var stringValue = new TextDecoder().decode( + uintBuffer.slice( offset.value, offset.value + endOffset ) + ); - var stringValue = new TextDecoder().decode( - uintBuffer.slice( offset.value, offset.value + endOffset ) - ); + offset.value = offset.value + endOffset + 1; - offset.value = offset.value + endOffset + 1; + return stringValue; - return stringValue; + } - } + function parseFixedLengthString( buffer, offset, size ) { - function parseFixedLengthString( buffer, offset, size ) { + var stringValue = new TextDecoder().decode( + new Uint8Array( buffer ).slice( offset.value, offset.value + size ) + ); - var stringValue = new TextDecoder().decode( - new Uint8Array( buffer ).slice( offset.value, offset.value + size ) - ); + offset.value = offset.value + size; - offset.value = offset.value + size; + return stringValue; - return stringValue; + } - } + function parseUlong( dataView, offset ) { - function parseUlong( dataView, offset ) { + var uLong = dataView.getUint32( 0, true ); - var uLong = dataView.getUint32( 0, true ); + offset.value = offset.value + ULONG_SIZE; - offset.value = offset.value + ULONG_SIZE; + return uLong; - return uLong; + } - } + function parseUint32( dataView, offset ) { - function parseUint32( dataView, offset ) { + var Uint32 = dataView.getUint32( offset.value, true ); - var Uint32 = dataView.getUint32( offset.value, true ); + offset.value = offset.value + INT32_SIZE; - offset.value = offset.value + INT32_SIZE; + return Uint32; - return Uint32; + } - } + function parseUint8Array( uInt8Array, offset ) { - function parseUint8Array( uInt8Array, offset ) { + var Uint8 = uInt8Array[ offset.value ]; - var Uint8 = uInt8Array[ offset.value ]; + offset.value = offset.value + INT8_SIZE; - offset.value = offset.value + INT8_SIZE; + return Uint8; - return Uint8; + } - } + function parseUint8( dataView, offset ) { - function parseUint8( dataView, offset ) { + var Uint8 = dataView.getUint8( offset.value ); - var Uint8 = dataView.getUint8( offset.value ); + offset.value = offset.value + INT8_SIZE; - offset.value = offset.value + INT8_SIZE; + return Uint8; - return Uint8; + } - } + function parseFloat32( dataView, offset ) { - function parseFloat32( dataView, offset ) { + var float = dataView.getFloat32( offset.value, true ); - var float = dataView.getFloat32( offset.value, true ); + offset.value += FLOAT32_SIZE; - offset.value += FLOAT32_SIZE; + return float; - return float; + } - } + // https://stackoverflow.com/questions/5678432/decompressing-half-precision-floats-in-javascript + function decodeFloat16( binary ) { - // https://stackoverflow.com/questions/5678432/decompressing-half-precision-floats-in-javascript - function decodeFloat16( binary ) { + var exponent = ( binary & 0x7C00 ) >> 10, + fraction = binary & 0x03FF; - var exponent = ( binary & 0x7C00 ) >> 10, - fraction = binary & 0x03FF; + return ( binary >> 15 ? - 1 : 1 ) * ( + exponent ? + ( + exponent === 0x1F ? + fraction ? NaN : Infinity : + Math.pow( 2, exponent - 15 ) * ( 1 + fraction / 0x400 ) + ) : + 6.103515625e-5 * ( fraction / 0x400 ) + ); - return ( binary >> 15 ? - 1 : 1 ) * ( - exponent ? - ( - exponent === 0x1F ? - fraction ? NaN : Infinity : - Math.pow( 2, exponent - 15 ) * ( 1 + fraction / 0x400 ) - ) : - 6.103515625e-5 * ( fraction / 0x400 ) - ); + } - } + function parseUint16( dataView, offset ) { - function parseUint16( dataView, offset ) { + var Uint16 = dataView.getUint16( offset.value, true ); - var Uint16 = dataView.getUint16( offset.value, true ); + offset.value += INT16_SIZE; - offset.value += INT16_SIZE; + return Uint16; - return Uint16; + } - } + function parseFloat16( buffer, offset ) { - function parseFloat16( buffer, offset ) { + return decodeFloat16( parseUint16( buffer, offset ) ); - return decodeFloat16( parseUint16( buffer, offset ) ); + } - } + function parseChlist( dataView, buffer, offset, size ) { - function parseChlist( dataView, buffer, offset, size ) { + var startOffset = offset.value; + var channels = []; - var startOffset = offset.value; - var channels = []; + while ( offset.value < ( startOffset + size - 1 ) ) { - while ( offset.value < ( startOffset + size - 1 ) ) { + var name = parseNullTerminatedString( buffer, offset ); + var pixelType = parseUint32( dataView, offset ); // TODO: Cast this to UINT, HALF or FLOAT + var pLinear = parseUint8( dataView, offset ); + offset.value += 3; // reserved, three chars + var xSampling = parseUint32( dataView, offset ); + var ySampling = parseUint32( dataView, offset ); - var name = parseNullTerminatedString( buffer, offset ); - var pixelType = parseUint32( dataView, offset ); // TODO: Cast this to UINT, HALF or FLOAT - var pLinear = parseUint8( dataView, offset ); - offset.value += 3; // reserved, three chars - var xSampling = parseUint32( dataView, offset ); - var ySampling = parseUint32( dataView, offset ); + channels.push( { + name: name, + pixelType: pixelType, + pLinear: pLinear, + xSampling: xSampling, + ySampling: ySampling + } ); - channels.push( { - name: name, - pixelType: pixelType, - pLinear: pLinear, - xSampling: xSampling, - ySampling: ySampling - } ); + } - } + offset.value += 1; - offset.value += 1; + return channels; - return channels; + } - } + function parseChromaticities( dataView, offset ) { - function parseChromaticities( dataView, offset ) { + var redX = parseFloat32( dataView, offset ); + var redY = parseFloat32( dataView, offset ); + var greenX = parseFloat32( dataView, offset ); + var greenY = parseFloat32( dataView, offset ); + var blueX = parseFloat32( dataView, offset ); + var blueY = parseFloat32( dataView, offset ); + var whiteX = parseFloat32( dataView, offset ); + var whiteY = parseFloat32( dataView, offset ); - var redX = parseFloat32( dataView, offset ); - var redY = parseFloat32( dataView, offset ); - var greenX = parseFloat32( dataView, offset ); - var greenY = parseFloat32( dataView, offset ); - var blueX = parseFloat32( dataView, offset ); - var blueY = parseFloat32( dataView, offset ); - var whiteX = parseFloat32( dataView, offset ); - var whiteY = parseFloat32( dataView, offset ); + return { redX: redX, redY: redY, greenX: greenX, greenY: greenY, blueX: blueX, blueY: blueY, whiteX: whiteX, whiteY: whiteY }; - return { redX: redX, redY: redY, greenX: greenX, greenY: greenY, blueX: blueX, blueY: blueY, whiteX: whiteX, whiteY: whiteY }; + } - } + function parseCompression( dataView, offset ) { - function parseCompression( dataView, offset ) { + var compressionCodes = [ + 'NO_COMPRESSION', + 'RLE_COMPRESSION', + 'ZIPS_COMPRESSION', + 'ZIP_COMPRESSION', + 'PIZ_COMPRESSION', + 'PXR24_COMPRESSION', + 'B44_COMPRESSION', + 'B44A_COMPRESSION', + 'DWAA_COMPRESSION', + 'DWAB_COMPRESSION' + ]; - var compressionCodes = [ - 'NO_COMPRESSION', - 'RLE_COMPRESSION', - 'ZIPS_COMPRESSION', - 'ZIP_COMPRESSION', - 'PIZ_COMPRESSION', - 'PXR24_COMPRESSION', - 'B44_COMPRESSION', - 'B44A_COMPRESSION', - 'DWAA_COMPRESSION', - 'DWAB_COMPRESSION' - ]; + var compression = parseUint8( dataView, offset ); - var compression = parseUint8( dataView, offset ); + return compressionCodes[ compression ]; - return compressionCodes[ compression ]; + } - } + function parseBox2i( dataView, offset ) { - function parseBox2i( dataView, offset ) { + var xMin = parseUint32( dataView, offset ); + var yMin = parseUint32( dataView, offset ); + var xMax = parseUint32( dataView, offset ); + var yMax = parseUint32( dataView, offset ); - var xMin = parseUint32( dataView, offset ); - var yMin = parseUint32( dataView, offset ); - var xMax = parseUint32( dataView, offset ); - var yMax = parseUint32( dataView, offset ); + return { xMin: xMin, yMin: yMin, xMax: xMax, yMax: yMax }; - return { xMin: xMin, yMin: yMin, xMax: xMax, yMax: yMax }; + } - } + function parseLineOrder( dataView, offset ) { - function parseLineOrder( dataView, offset ) { + var lineOrders = [ + 'INCREASING_Y' + ]; - var lineOrders = [ - 'INCREASING_Y' - ]; + var lineOrder = parseUint8( dataView, offset ); - var lineOrder = parseUint8( dataView, offset ); + return lineOrders[ lineOrder ]; - return lineOrders[ lineOrder ]; + } - } + function parseV2f( dataView, offset ) { - function parseV2f( dataView, offset ) { + var x = parseFloat32( dataView, offset ); + var y = parseFloat32( dataView, offset ); - var x = parseFloat32( dataView, offset ); - var y = parseFloat32( dataView, offset ); + return [ x, y ]; - return [ x, y ]; + } - } + function parseValue( dataView, buffer, offset, type, size ) { - function parseValue( dataView, buffer, offset, type, size ) { + if ( type === 'string' || type === 'iccProfile' ) { - if ( type === 'string' || type === 'iccProfile' ) { + return parseFixedLengthString( buffer, offset, size ); - return parseFixedLengthString( buffer, offset, size ); + } else if ( type === 'chlist' ) { - } else if ( type === 'chlist' ) { + return parseChlist( dataView, buffer, offset, size ); - return parseChlist( dataView, buffer, offset, size ); + } else if ( type === 'chromaticities' ) { - } else if ( type === 'chromaticities' ) { + return parseChromaticities( dataView, offset ); - return parseChromaticities( dataView, offset ); + } else if ( type === 'compression' ) { - } else if ( type === 'compression' ) { + return parseCompression( dataView, offset ); - return parseCompression( dataView, offset ); + } else if ( type === 'box2i' ) { - } else if ( type === 'box2i' ) { + return parseBox2i( dataView, offset ); - return parseBox2i( dataView, offset ); + } else if ( type === 'lineOrder' ) { - } else if ( type === 'lineOrder' ) { + return parseLineOrder( dataView, offset ); - return parseLineOrder( dataView, offset ); + } else if ( type === 'float' ) { - } else if ( type === 'float' ) { + return parseFloat32( dataView, offset ); - return parseFloat32( dataView, offset ); + } else if ( type === 'v2f' ) { - } else if ( type === 'v2f' ) { + return parseV2f( dataView, offset ); - return parseV2f( dataView, offset ); + } else if ( type === 'int' ) { - } else if ( type === 'int' ) { + return parseUint32( dataView, offset ); - return parseUint32( dataView, offset ); + } else { - } else { + throw 'Cannot parse value for unsupported type: ' + type; - throw 'Cannot parse value for unsupported type: ' + type; + } } - } + var bufferDataView = new DataView( buffer ); + var uInt8Array = new Uint8Array( buffer ); - var bufferDataView = new DataView( buffer ); - var uInt8Array = new Uint8Array( buffer ); + var EXRHeader = {}; - var EXRHeader = {}; + bufferDataView.getUint32( 0, true ); // magic + bufferDataView.getUint8( 4, true ); // versionByteZero + bufferDataView.getUint8( 5, true ); // fullMask - bufferDataView.getUint32( 0, true ); // magic - bufferDataView.getUint8( 4, true ); // versionByteZero - bufferDataView.getUint8( 5, true ); // fullMask + // start of header - // start of header + var offset = { value: 8 }; // start at 8, after magic stuff - var offset = { value: 8 }; // start at 8, after magic stuff + var keepReading = true; - var keepReading = true; + while ( keepReading ) { - while ( keepReading ) { + var attributeName = parseNullTerminatedString( buffer, offset ); - var attributeName = parseNullTerminatedString( buffer, offset ); + if ( attributeName == 0 ) { - if ( attributeName == 0 ) { + keepReading = false; - keepReading = false; + } else { - } else { + var attributeType = parseNullTerminatedString( buffer, offset ); + var attributeSize = parseUint32( bufferDataView, offset ); + var attributeValue = parseValue( bufferDataView, buffer, offset, attributeType, attributeSize ); - var attributeType = parseNullTerminatedString( buffer, offset ); - var attributeSize = parseUint32( bufferDataView, offset ); - var attributeValue = parseValue( bufferDataView, buffer, offset, attributeType, attributeSize ); + EXRHeader[ attributeName ] = attributeValue; - EXRHeader[ attributeName ] = attributeValue; + } } - } + // offsets - // offsets + var dataWindowHeight = EXRHeader.dataWindow.yMax + 1; + var scanlineBlockSize = 1; // 1 for NO_COMPRESSION - var dataWindowHeight = EXRHeader.dataWindow.yMax + 1; - var scanlineBlockSize = 1; // 1 for NO_COMPRESSION + if ( EXRHeader.compression === 'PIZ_COMPRESSION' ) { - if ( EXRHeader.compression === 'PIZ_COMPRESSION' ) { + scanlineBlockSize = 32; - scanlineBlockSize = 32; + } - } + var numBlocks = dataWindowHeight / scanlineBlockSize; - var numBlocks = dataWindowHeight / scanlineBlockSize; + for ( var i = 0; i < numBlocks; i ++ ) { - for ( var i = 0; i < numBlocks; i ++ ) { + parseUlong( bufferDataView, offset ); // scanlineOffset - parseUlong( bufferDataView, offset ); // scanlineOffset + } - } + // we should be passed the scanline offset table, start reading pixel data - // we should be passed the scanline offset table, start reading pixel data + var width = EXRHeader.dataWindow.xMax - EXRHeader.dataWindow.xMin + 1; + var height = EXRHeader.dataWindow.yMax - EXRHeader.dataWindow.yMin + 1; + var numChannels = EXRHeader.channels.length; - var width = EXRHeader.dataWindow.xMax - EXRHeader.dataWindow.xMin + 1; - var height = EXRHeader.dataWindow.yMax - EXRHeader.dataWindow.yMin + 1; - var numChannels = EXRHeader.channels.length; + switch ( this.type ) { - switch ( this.type ) { + case FloatType: - case FloatType: + var byteArray = new Float32Array( width * height * numChannels ); + break; - var byteArray = new Float32Array( width * height * numChannels ); - break; + case HalfFloatType: - case HalfFloatType: + var byteArray = new Uint16Array( width * height * numChannels ); + break; - var byteArray = new Uint16Array( width * height * numChannels ); - break; + default: - default: + console.error( 'THREE.EXRLoader: unsupported type: ', this.type ); + break; - console.error( 'THREE.EXRLoader: unsupported type: ', this.type ); - break; + } - } + var channelOffsets = { + R: 0, + G: 1, + B: 2, + A: 3 + }; - var channelOffsets = { - R: 0, - G: 1, - B: 2, - A: 3 - }; + if ( EXRHeader.compression === 'NO_COMPRESSION' ) { - if ( EXRHeader.compression === 'NO_COMPRESSION' ) { + for ( var y = 0; y < height; y ++ ) { - for ( var y = 0; y < height; y ++ ) { + var y_scanline = parseUint32( bufferDataView, offset ); + parseUint32( bufferDataView, offset ); // dataSize - var y_scanline = parseUint32( bufferDataView, offset ); - parseUint32( bufferDataView, offset ); // dataSize + for ( var channelID = 0; channelID < EXRHeader.channels.length; channelID ++ ) { + + var cOff = channelOffsets[ EXRHeader.channels[ channelID ].name ]; - for ( var channelID = 0; channelID < EXRHeader.channels.length; channelID ++ ) { + if ( EXRHeader.channels[ channelID ].pixelType === 1 ) { // half - var cOff = channelOffsets[ EXRHeader.channels[ channelID ].name ]; + for ( var x = 0; x < width; x ++ ) { - if ( EXRHeader.channels[ channelID ].pixelType === 1 ) { // half + switch ( this.type ) { - for ( var x = 0; x < width; x ++ ) { + case FloatType: - switch ( this.type ) { + var val = parseFloat16( bufferDataView, offset ); + break; - case FloatType: + case HalfFloatType: - var val = parseFloat16( bufferDataView, offset ); - break; + var val = parseUint16( bufferDataView, offset ); + break; - case HalfFloatType: + } - var val = parseUint16( bufferDataView, offset ); - break; + byteArray[ ( ( ( height - y_scanline ) * ( width * numChannels ) ) + ( x * numChannels ) ) + cOff ] = val; } - byteArray[ ( ( ( height - y_scanline ) * ( width * numChannels ) ) + ( x * numChannels ) ) + cOff ] = val; - - } + } else { - } else { + throw 'EXRLoader._parser: unsupported pixelType ' + EXRHeader.channels[ channelID ].pixelType + '. Only pixelType is 1 (HALF) is supported.'; - throw 'EXRLoader._parser: unsupported pixelType ' + EXRHeader.channels[ channelID ].pixelType + '. Only pixelType is 1 (HALF) is supported.'; + } } } - } + } else if ( EXRHeader.compression === 'PIZ_COMPRESSION' ) { - } else if ( EXRHeader.compression === 'PIZ_COMPRESSION' ) { + for ( var scanlineBlockIdx = 0; scanlineBlockIdx < height / scanlineBlockSize; scanlineBlockIdx ++ ) { - for ( var scanlineBlockIdx = 0; scanlineBlockIdx < height / scanlineBlockSize; scanlineBlockIdx ++ ) { + parseUint32( bufferDataView, offset ); // line_no + parseUint32( bufferDataView, offset ); // data_len - parseUint32( bufferDataView, offset ); // line_no - parseUint32( bufferDataView, offset ); // data_len + var tmpBufferSize = width * scanlineBlockSize * ( EXRHeader.channels.length * BYTES_PER_HALF ); + var tmpBuffer = new Uint16Array( tmpBufferSize ); + var tmpOffset = { value: 0 }; - var tmpBufferSize = width * scanlineBlockSize * ( EXRHeader.channels.length * BYTES_PER_HALF ); - var tmpBuffer = new Uint16Array( tmpBufferSize ); - var tmpOffset = { value: 0 }; + decompressPIZ( tmpBuffer, tmpOffset, uInt8Array, bufferDataView, offset, tmpBufferSize, numChannels, EXRHeader.channels, width, scanlineBlockSize ); - decompressPIZ( tmpBuffer, tmpOffset, uInt8Array, bufferDataView, offset, tmpBufferSize, numChannels, EXRHeader.channels, width, scanlineBlockSize ); + for ( var line_y = 0; line_y < scanlineBlockSize; line_y ++ ) { - for ( var line_y = 0; line_y < scanlineBlockSize; line_y ++ ) { + for ( var channelID = 0; channelID < EXRHeader.channels.length; channelID ++ ) { - for ( var channelID = 0; channelID < EXRHeader.channels.length; channelID ++ ) { + var cOff = channelOffsets[ EXRHeader.channels[ channelID ].name ]; - var cOff = channelOffsets[ EXRHeader.channels[ channelID ].name ]; + if ( EXRHeader.channels[ channelID ].pixelType === 1 ) { // half - if ( EXRHeader.channels[ channelID ].pixelType === 1 ) { // half + for ( var x = 0; x < width; x ++ ) { - for ( var x = 0; x < width; x ++ ) { + var idx = ( channelID * ( scanlineBlockSize * width ) ) + ( line_y * width ) + x; - var idx = ( channelID * ( scanlineBlockSize * width ) ) + ( line_y * width ) + x; + switch ( this.type ) { - switch ( this.type ) { + case FloatType: - case FloatType: + var val = decodeFloat16( tmpBuffer[ idx ] ); + break; - var val = decodeFloat16( tmpBuffer[ idx ] ); - break; + case HalfFloatType: - case HalfFloatType: + var val = tmpBuffer[ idx ]; + break; - var val = tmpBuffer[ idx ]; - break; + } - } + var true_y = line_y + ( scanlineBlockIdx * scanlineBlockSize ); - var true_y = line_y + ( scanlineBlockIdx * scanlineBlockSize ); + byteArray[ ( ( ( height - true_y ) * ( width * numChannels ) ) + ( x * numChannels ) ) + cOff ] = val; - byteArray[ ( ( ( height - true_y ) * ( width * numChannels ) ) + ( x * numChannels ) ) + cOff ] = val; + } - } + } else { - } else { + throw 'EXRLoader._parser: unsupported pixelType ' + EXRHeader.channels[ channelID ].pixelType + '. Only pixelType is 1 (HALF) is supported.'; - throw 'EXRLoader._parser: unsupported pixelType ' + EXRHeader.channels[ channelID ].pixelType + '. Only pixelType is 1 (HALF) is supported.'; + } } @@ -1228,23 +1224,23 @@ EXRLoader.prototype._parser = function ( buffer ) { } - } + } else { - } else { + throw 'EXRLoader._parser: ' + EXRHeader.compression + ' is unsupported'; - throw 'EXRLoader._parser: ' + EXRHeader.compression + ' is unsupported'; + } - } + return { + header: EXRHeader, + width: width, + height: height, + data: byteArray, + format: EXRHeader.channels.length == 4 ? RGBAFormat : RGBFormat, + type: this.type + }; - return { - header: EXRHeader, - width: width, - height: height, - data: byteArray, - format: EXRHeader.channels.length == 4 ? RGBAFormat : RGBFormat, - type: this.type - }; + } -}; +} ); export { EXRLoader }; diff --git a/examples/jsm/loaders/HDRCubeTextureLoader.js b/examples/jsm/loaders/HDRCubeTextureLoader.js index eecec30cf56a48..7e84c7bf60893e 100644 --- a/examples/jsm/loaders/HDRCubeTextureLoader.js +++ b/examples/jsm/loaders/HDRCubeTextureLoader.js @@ -96,7 +96,7 @@ HDRCubeTextureLoader.prototype = Object.assign( Object.create( Loader.prototype loaded ++; - var texData = scope.hdrLoader._parser( buffer ); + var texData = scope.hdrLoader.parse( buffer ); if ( ! texData ) return; diff --git a/examples/jsm/loaders/RGBELoader.d.ts b/examples/jsm/loaders/RGBELoader.d.ts index 7c3dca56d2d420..def67a3e1cfe87 100644 --- a/examples/jsm/loaders/RGBELoader.d.ts +++ b/examples/jsm/loaders/RGBELoader.d.ts @@ -20,6 +20,6 @@ export class RGBELoader extends DataTextureLoader { constructor(manager?: LoadingManager); type: TextureDataType; - _parser(buffer: ArrayBuffer): RGBE; + parse(buffer: ArrayBuffer): RGBE; setDataType(type: TextureDataType): this; } diff --git a/examples/jsm/loaders/RGBELoader.js b/examples/jsm/loaders/RGBELoader.js index cd7b934405e8c8..4628bd81e4b3be 100644 --- a/examples/jsm/loaders/RGBELoader.js +++ b/examples/jsm/loaders/RGBELoader.js @@ -4,7 +4,6 @@ import { DataTextureLoader, - DefaultLoadingManager, FloatType, HalfFloatType, LinearEncoding, @@ -21,525 +20,522 @@ import { var RGBELoader = function ( manager ) { - this.manager = ( manager !== undefined ) ? manager : DefaultLoadingManager; + DataTextureLoader.call( this, manager ); + this.type = UnsignedByteType; }; -// extend DataTextureLoader -RGBELoader.prototype = Object.create( DataTextureLoader.prototype ); +RGBELoader.prototype = Object.assign( Object.create( DataTextureLoader.prototype ), { -// adapted from http://www.graphics.cornell.edu/~bjw/rgbe.html -RGBELoader.prototype._parser = function ( buffer ) { + constructor: RGBELoader, - var - /* return codes for rgbe routines */ - //RGBE_RETURN_SUCCESS = 0, - RGBE_RETURN_FAILURE = - 1, + // adapted from http://www.graphics.cornell.edu/~bjw/rgbe.html - /* default error routine. change this to change error handling */ - rgbe_read_error = 1, - rgbe_write_error = 2, - rgbe_format_error = 3, - rgbe_memory_error = 4, - rgbe_error = function ( rgbe_error_code, msg ) { + parse: function ( buffer ) { - switch ( rgbe_error_code ) { + var + /* return codes for rgbe routines */ + //RGBE_RETURN_SUCCESS = 0, + RGBE_RETURN_FAILURE = - 1, - case rgbe_read_error: console.error( "RGBELoader Read Error: " + ( msg || '' ) ); - break; - case rgbe_write_error: console.error( "RGBELoader Write Error: " + ( msg || '' ) ); - break; - case rgbe_format_error: console.error( "RGBELoader Bad File Format: " + ( msg || '' ) ); - break; - default: - case rgbe_memory_error: console.error( "RGBELoader: Error: " + ( msg || '' ) ); + /* default error routine. change this to change error handling */ + rgbe_read_error = 1, + rgbe_write_error = 2, + rgbe_format_error = 3, + rgbe_memory_error = 4, + rgbe_error = function ( rgbe_error_code, msg ) { - } - return RGBE_RETURN_FAILURE; + switch ( rgbe_error_code ) { - }, + case rgbe_read_error: console.error( "RGBELoader Read Error: " + ( msg || '' ) ); + break; + case rgbe_write_error: console.error( "RGBELoader Write Error: " + ( msg || '' ) ); + break; + case rgbe_format_error: console.error( "RGBELoader Bad File Format: " + ( msg || '' ) ); + break; + default: + case rgbe_memory_error: console.error( "RGBELoader: Error: " + ( msg || '' ) ); - /* offsets to red, green, and blue components in a data (float) pixel */ - //RGBE_DATA_RED = 0, - //RGBE_DATA_GREEN = 1, - //RGBE_DATA_BLUE = 2, + } + return RGBE_RETURN_FAILURE; - /* number of floats per pixel, use 4 since stored in rgba image format */ - //RGBE_DATA_SIZE = 4, + }, - /* flags indicating which fields in an rgbe_header_info are valid */ - RGBE_VALID_PROGRAMTYPE = 1, - RGBE_VALID_FORMAT = 2, - RGBE_VALID_DIMENSIONS = 4, + /* offsets to red, green, and blue components in a data (float) pixel */ + //RGBE_DATA_RED = 0, + //RGBE_DATA_GREEN = 1, + //RGBE_DATA_BLUE = 2, - NEWLINE = "\n", + /* number of floats per pixel, use 4 since stored in rgba image format */ + //RGBE_DATA_SIZE = 4, - fgets = function ( buffer, lineLimit, consume ) { + /* flags indicating which fields in an rgbe_header_info are valid */ + RGBE_VALID_PROGRAMTYPE = 1, + RGBE_VALID_FORMAT = 2, + RGBE_VALID_DIMENSIONS = 4, - lineLimit = ! lineLimit ? 1024 : lineLimit; - var p = buffer.pos, - i = - 1, len = 0, s = '', chunkSize = 128, - chunk = String.fromCharCode.apply( null, new Uint16Array( buffer.subarray( p, p + chunkSize ) ) ) - ; - while ( ( 0 > ( i = chunk.indexOf( NEWLINE ) ) ) && ( len < lineLimit ) && ( p < buffer.byteLength ) ) { + NEWLINE = "\n", - s += chunk; len += chunk.length; - p += chunkSize; - chunk += String.fromCharCode.apply( null, new Uint16Array( buffer.subarray( p, p + chunkSize ) ) ); + fgets = function ( buffer, lineLimit, consume ) { - } + lineLimit = ! lineLimit ? 1024 : lineLimit; + var p = buffer.pos, + i = - 1, len = 0, s = '', chunkSize = 128, + chunk = String.fromCharCode.apply( null, new Uint16Array( buffer.subarray( p, p + chunkSize ) ) ) + ; + while ( ( 0 > ( i = chunk.indexOf( NEWLINE ) ) ) && ( len < lineLimit ) && ( p < buffer.byteLength ) ) { - if ( - 1 < i ) { + s += chunk; len += chunk.length; + p += chunkSize; + chunk += String.fromCharCode.apply( null, new Uint16Array( buffer.subarray( p, p + chunkSize ) ) ); - /*for (i=l-1; i>=0; i--) { - byteCode = m.charCodeAt(i); - if (byteCode > 0x7f && byteCode <= 0x7ff) byteLen++; - else if (byteCode > 0x7ff && byteCode <= 0xffff) byteLen += 2; - if (byteCode >= 0xDC00 && byteCode <= 0xDFFF) i--; //trail surrogate - }*/ - if ( false !== consume ) buffer.pos += len + i + 1; - return s + chunk.slice( 0, i ); + } - } - return false; + if ( - 1 < i ) { - }, + /*for (i=l-1; i>=0; i--) { + byteCode = m.charCodeAt(i); + if (byteCode > 0x7f && byteCode <= 0x7ff) byteLen++; + else if (byteCode > 0x7ff && byteCode <= 0xffff) byteLen += 2; + if (byteCode >= 0xDC00 && byteCode <= 0xDFFF) i--; //trail surrogate + }*/ + if ( false !== consume ) buffer.pos += len + i + 1; + return s + chunk.slice( 0, i ); - /* minimal header reading. modify if you want to parse more information */ - RGBE_ReadHeader = function ( buffer ) { + } + return false; - var line, match, + }, - // regexes to parse header info fields - magic_token_re = /^#\?(\S+)$/, - gamma_re = /^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/, - exposure_re = /^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/, - format_re = /^\s*FORMAT=(\S+)\s*$/, - dimensions_re = /^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/, + /* minimal header reading. modify if you want to parse more information */ + RGBE_ReadHeader = function ( buffer ) { - // RGBE format header struct - header = { + var line, match, - valid: 0, /* indicate which fields are valid */ + // regexes to parse header info fields + magic_token_re = /^#\?(\S+)$/, + gamma_re = /^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/, + exposure_re = /^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/, + format_re = /^\s*FORMAT=(\S+)\s*$/, + dimensions_re = /^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/, - string: '', /* the actual header string */ + // RGBE format header struct + header = { - comments: '', /* comments found in header */ + valid: 0, /* indicate which fields are valid */ - programtype: 'RGBE', /* listed at beginning of file to identify it after "#?". defaults to "RGBE" */ + string: '', /* the actual header string */ - format: '', /* RGBE format, default 32-bit_rle_rgbe */ + comments: '', /* comments found in header */ - gamma: 1.0, /* image has already been gamma corrected with given gamma. defaults to 1.0 (no correction) */ + programtype: 'RGBE', /* listed at beginning of file to identify it after "#?". defaults to "RGBE" */ - exposure: 1.0, /* a value of 1.0 in an image corresponds to watts/steradian/m^2. defaults to 1.0 */ + format: '', /* RGBE format, default 32-bit_rle_rgbe */ - width: 0, height: 0 /* image dimensions, width/height */ + gamma: 1.0, /* image has already been gamma corrected with given gamma. defaults to 1.0 (no correction) */ - }; + exposure: 1.0, /* a value of 1.0 in an image corresponds to watts/steradian/m^2. defaults to 1.0 */ - if ( buffer.pos >= buffer.byteLength || ! ( line = fgets( buffer ) ) ) { + width: 0, height: 0 /* image dimensions, width/height */ - return rgbe_error( rgbe_read_error, "no header found" ); + }; - } - /* if you want to require the magic token then uncomment the next line */ - if ( ! ( match = line.match( magic_token_re ) ) ) { + if ( buffer.pos >= buffer.byteLength || ! ( line = fgets( buffer ) ) ) { - return rgbe_error( rgbe_format_error, "bad initial token" ); + return rgbe_error( rgbe_read_error, "no header found" ); - } - header.valid |= RGBE_VALID_PROGRAMTYPE; - header.programtype = match[ 1 ]; - header.string += line + "\n"; - - while ( true ) { - - line = fgets( buffer ); - if ( false === line ) break; - header.string += line + "\n"; - - if ( '#' === line.charAt( 0 ) ) { + } + /* if you want to require the magic token then uncomment the next line */ + if ( ! ( match = line.match( magic_token_re ) ) ) { - header.comments += line + "\n"; - continue; // comment line + return rgbe_error( rgbe_format_error, "bad initial token" ); } + header.valid |= RGBE_VALID_PROGRAMTYPE; + header.programtype = match[ 1 ]; + header.string += line + "\n"; - if ( match = line.match( gamma_re ) ) { + while ( true ) { - header.gamma = parseFloat( match[ 1 ], 10 ); + line = fgets( buffer ); + if ( false === line ) break; + header.string += line + "\n"; - } - if ( match = line.match( exposure_re ) ) { + if ( '#' === line.charAt( 0 ) ) { - header.exposure = parseFloat( match[ 1 ], 10 ); + header.comments += line + "\n"; + continue; // comment line - } - if ( match = line.match( format_re ) ) { + } - header.valid |= RGBE_VALID_FORMAT; - header.format = match[ 1 ];//'32-bit_rle_rgbe'; + if ( match = line.match( gamma_re ) ) { - } - if ( match = line.match( dimensions_re ) ) { + header.gamma = parseFloat( match[ 1 ], 10 ); - header.valid |= RGBE_VALID_DIMENSIONS; - header.height = parseInt( match[ 1 ], 10 ); - header.width = parseInt( match[ 2 ], 10 ); + } + if ( match = line.match( exposure_re ) ) { - } + header.exposure = parseFloat( match[ 1 ], 10 ); - if ( ( header.valid & RGBE_VALID_FORMAT ) && ( header.valid & RGBE_VALID_DIMENSIONS ) ) break; + } + if ( match = line.match( format_re ) ) { - } + header.valid |= RGBE_VALID_FORMAT; + header.format = match[ 1 ];//'32-bit_rle_rgbe'; - if ( ! ( header.valid & RGBE_VALID_FORMAT ) ) { + } + if ( match = line.match( dimensions_re ) ) { - return rgbe_error( rgbe_format_error, "missing format specifier" ); + header.valid |= RGBE_VALID_DIMENSIONS; + header.height = parseInt( match[ 1 ], 10 ); + header.width = parseInt( match[ 2 ], 10 ); - } - if ( ! ( header.valid & RGBE_VALID_DIMENSIONS ) ) { + } - return rgbe_error( rgbe_format_error, "missing image size specifier" ); + if ( ( header.valid & RGBE_VALID_FORMAT ) && ( header.valid & RGBE_VALID_DIMENSIONS ) ) break; - } + } - return header; + if ( ! ( header.valid & RGBE_VALID_FORMAT ) ) { - }, + return rgbe_error( rgbe_format_error, "missing format specifier" ); - RGBE_ReadPixels_RLE = function ( buffer, w, h ) { + } + if ( ! ( header.valid & RGBE_VALID_DIMENSIONS ) ) { - var data_rgba, offset, pos, count, byteValue, - scanline_buffer, ptr, ptr_end, i, l, off, isEncodedRun, - scanline_width = w, num_scanlines = h, rgbeStart - ; + return rgbe_error( rgbe_format_error, "missing image size specifier" ); - if ( - // run length encoding is not allowed so read flat - ( ( scanline_width < 8 ) || ( scanline_width > 0x7fff ) ) || - // this file is not run length encoded - ( ( 2 !== buffer[ 0 ] ) || ( 2 !== buffer[ 1 ] ) || ( buffer[ 2 ] & 0x80 ) ) - ) { + } - // return the flat buffer - return new Uint8Array( buffer ); + return header; - } + }, - if ( scanline_width !== ( ( buffer[ 2 ] << 8 ) | buffer[ 3 ] ) ) { + RGBE_ReadPixels_RLE = function ( buffer, w, h ) { - return rgbe_error( rgbe_format_error, "wrong scanline width" ); + var data_rgba, offset, pos, count, byteValue, + scanline_buffer, ptr, ptr_end, i, l, off, isEncodedRun, + scanline_width = w, num_scanlines = h, rgbeStart + ; - } + if ( + // run length encoding is not allowed so read flat + ( ( scanline_width < 8 ) || ( scanline_width > 0x7fff ) ) || + // this file is not run length encoded + ( ( 2 !== buffer[ 0 ] ) || ( 2 !== buffer[ 1 ] ) || ( buffer[ 2 ] & 0x80 ) ) + ) { - data_rgba = new Uint8Array( 4 * w * h ); + // return the flat buffer + return new Uint8Array( buffer ); - if ( ! data_rgba || ! data_rgba.length ) { + } - return rgbe_error( rgbe_memory_error, "unable to allocate buffer space" ); + if ( scanline_width !== ( ( buffer[ 2 ] << 8 ) | buffer[ 3 ] ) ) { - } + return rgbe_error( rgbe_format_error, "wrong scanline width" ); - offset = 0; pos = 0; ptr_end = 4 * scanline_width; - rgbeStart = new Uint8Array( 4 ); - scanline_buffer = new Uint8Array( ptr_end ); + } - // read in each successive scanline - while ( ( num_scanlines > 0 ) && ( pos < buffer.byteLength ) ) { + data_rgba = new Uint8Array( 4 * w * h ); - if ( pos + 4 > buffer.byteLength ) { + if ( ! data_rgba || ! data_rgba.length ) { - return rgbe_error( rgbe_read_error ); + return rgbe_error( rgbe_memory_error, "unable to allocate buffer space" ); } - rgbeStart[ 0 ] = buffer[ pos ++ ]; - rgbeStart[ 1 ] = buffer[ pos ++ ]; - rgbeStart[ 2 ] = buffer[ pos ++ ]; - rgbeStart[ 3 ] = buffer[ pos ++ ]; + offset = 0; pos = 0; ptr_end = 4 * scanline_width; + rgbeStart = new Uint8Array( 4 ); + scanline_buffer = new Uint8Array( ptr_end ); - if ( ( 2 != rgbeStart[ 0 ] ) || ( 2 != rgbeStart[ 1 ] ) || ( ( ( rgbeStart[ 2 ] << 8 ) | rgbeStart[ 3 ] ) != scanline_width ) ) { + // read in each successive scanline + while ( ( num_scanlines > 0 ) && ( pos < buffer.byteLength ) ) { - return rgbe_error( rgbe_format_error, "bad rgbe scanline format" ); + if ( pos + 4 > buffer.byteLength ) { - } + return rgbe_error( rgbe_read_error ); - // read each of the four channels for the scanline into the buffer - // first red, then green, then blue, then exponent - ptr = 0; - while ( ( ptr < ptr_end ) && ( pos < buffer.byteLength ) ) { + } - count = buffer[ pos ++ ]; - isEncodedRun = count > 128; - if ( isEncodedRun ) count -= 128; + rgbeStart[ 0 ] = buffer[ pos ++ ]; + rgbeStart[ 1 ] = buffer[ pos ++ ]; + rgbeStart[ 2 ] = buffer[ pos ++ ]; + rgbeStart[ 3 ] = buffer[ pos ++ ]; - if ( ( 0 === count ) || ( ptr + count > ptr_end ) ) { + if ( ( 2 != rgbeStart[ 0 ] ) || ( 2 != rgbeStart[ 1 ] ) || ( ( ( rgbeStart[ 2 ] << 8 ) | rgbeStart[ 3 ] ) != scanline_width ) ) { - return rgbe_error( rgbe_format_error, "bad scanline data" ); + return rgbe_error( rgbe_format_error, "bad rgbe scanline format" ); } - if ( isEncodedRun ) { + // read each of the four channels for the scanline into the buffer + // first red, then green, then blue, then exponent + ptr = 0; + while ( ( ptr < ptr_end ) && ( pos < buffer.byteLength ) ) { + + count = buffer[ pos ++ ]; + isEncodedRun = count > 128; + if ( isEncodedRun ) count -= 128; - // a (encoded) run of the same value - byteValue = buffer[ pos ++ ]; - for ( i = 0; i < count; i ++ ) { + if ( ( 0 === count ) || ( ptr + count > ptr_end ) ) { - scanline_buffer[ ptr ++ ] = byteValue; + return rgbe_error( rgbe_format_error, "bad scanline data" ); } - //ptr += count; - } else { + if ( isEncodedRun ) { + + // a (encoded) run of the same value + byteValue = buffer[ pos ++ ]; + for ( i = 0; i < count; i ++ ) { - // a literal-run - scanline_buffer.set( buffer.subarray( pos, pos + count ), ptr ); - ptr += count; pos += count; + scanline_buffer[ ptr ++ ] = byteValue; + + } + //ptr += count; + + } else { + + // a literal-run + scanline_buffer.set( buffer.subarray( pos, pos + count ), ptr ); + ptr += count; pos += count; + + } } - } + // now convert data from buffer into rgba + // first red, then green, then blue, then exponent (alpha) + l = scanline_width; //scanline_buffer.byteLength; + for ( i = 0; i < l; i ++ ) { - // now convert data from buffer into rgba - // first red, then green, then blue, then exponent (alpha) - l = scanline_width; //scanline_buffer.byteLength; - for ( i = 0; i < l; i ++ ) { + off = 0; + data_rgba[ offset ] = scanline_buffer[ i + off ]; + off += scanline_width; //1; + data_rgba[ offset + 1 ] = scanline_buffer[ i + off ]; + off += scanline_width; //1; + data_rgba[ offset + 2 ] = scanline_buffer[ i + off ]; + off += scanline_width; //1; + data_rgba[ offset + 3 ] = scanline_buffer[ i + off ]; + offset += 4; - off = 0; - data_rgba[ offset ] = scanline_buffer[ i + off ]; - off += scanline_width; //1; - data_rgba[ offset + 1 ] = scanline_buffer[ i + off ]; - off += scanline_width; //1; - data_rgba[ offset + 2 ] = scanline_buffer[ i + off ]; - off += scanline_width; //1; - data_rgba[ offset + 3 ] = scanline_buffer[ i + off ]; - offset += 4; + } + + num_scanlines --; } - num_scanlines --; + return data_rgba; - } + }; - return data_rgba; + var RGBEByteToRGBFloat = function ( sourceArray, sourceOffset, destArray, destOffset ) { - }; + var e = sourceArray[ sourceOffset + 3 ]; + var scale = Math.pow( 2.0, e - 128.0 ) / 255.0; - var RGBEByteToRGBFloat = function ( sourceArray, sourceOffset, destArray, destOffset ) { + destArray[ destOffset + 0 ] = sourceArray[ sourceOffset + 0 ] * scale; + destArray[ destOffset + 1 ] = sourceArray[ sourceOffset + 1 ] * scale; + destArray[ destOffset + 2 ] = sourceArray[ sourceOffset + 2 ] * scale; - var e = sourceArray[ sourceOffset + 3 ]; - var scale = Math.pow( 2.0, e - 128.0 ) / 255.0; + }; - destArray[ destOffset + 0 ] = sourceArray[ sourceOffset + 0 ] * scale; - destArray[ destOffset + 1 ] = sourceArray[ sourceOffset + 1 ] * scale; - destArray[ destOffset + 2 ] = sourceArray[ sourceOffset + 2 ] * scale; + var RGBEByteToRGBHalf = ( function () { - }; + // Source: http://gamedev.stackexchange.com/questions/17326/conversion-of-a-number-from-single-precision-floating-point-representation-to-a/17410#17410 - var RGBEByteToRGBHalf = ( function () { + var floatView = new Float32Array( 1 ); + var int32View = new Int32Array( floatView.buffer ); - // 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. */ + function toHalf( val ) { - var floatView = new Float32Array( 1 ); - var int32View = new Int32Array( floatView.buffer ); + floatView[ 0 ] = val; + var x = int32View[ 0 ]; - /* 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. */ - function toHalf( val ) { + 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 */ - floatView[ 0 ] = val; - var x = int32View[ 0 ]; + /* If zero, or denormal, or exponent underflows too much for a denormal + * half, return signed zero. */ + if ( e < 103 ) return bits; - 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 NaN, return NaN. If Inf or exponent overflow, return Inf. */ + if ( e > 142 ) { - /* If zero, or denormal, or exponent underflows too much for a denormal - * half, return signed zero. */ - if ( e < 103 ) return bits; + 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 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; - /* 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 ); + 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; } - 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; + return function ( sourceArray, sourceOffset, destArray, destOffset ) { - } + var e = sourceArray[ sourceOffset + 3 ]; + var scale = Math.pow( 2.0, e - 128.0 ) / 255.0; - return function ( sourceArray, sourceOffset, destArray, destOffset ) { + destArray[ destOffset + 0 ] = toHalf( sourceArray[ sourceOffset + 0 ] * scale ); + destArray[ destOffset + 1 ] = toHalf( sourceArray[ sourceOffset + 1 ] * scale ); + destArray[ destOffset + 2 ] = toHalf( sourceArray[ sourceOffset + 2 ] * scale ); - var e = sourceArray[ sourceOffset + 3 ]; - var scale = Math.pow( 2.0, e - 128.0 ) / 255.0; + }; - destArray[ destOffset + 0 ] = toHalf( sourceArray[ sourceOffset + 0 ] * scale ); - destArray[ destOffset + 1 ] = toHalf( sourceArray[ sourceOffset + 1 ] * scale ); - destArray[ destOffset + 2 ] = toHalf( sourceArray[ sourceOffset + 2 ] * scale ); + } )(); - }; + var byteArray = new Uint8Array( buffer ); + byteArray.pos = 0; + var rgbe_header_info = RGBE_ReadHeader( byteArray ); - } )(); + if ( RGBE_RETURN_FAILURE !== rgbe_header_info ) { - var byteArray = new Uint8Array( buffer ); - byteArray.pos = 0; - var rgbe_header_info = RGBE_ReadHeader( byteArray ); + var w = rgbe_header_info.width, + h = rgbe_header_info.height, + image_rgba_data = RGBE_ReadPixels_RLE( byteArray.subarray( byteArray.pos ), w, h ); - if ( RGBE_RETURN_FAILURE !== rgbe_header_info ) { + if ( RGBE_RETURN_FAILURE !== image_rgba_data ) { - var w = rgbe_header_info.width, - h = rgbe_header_info.height, - image_rgba_data = RGBE_ReadPixels_RLE( byteArray.subarray( byteArray.pos ), w, h ); + switch ( this.type ) { - if ( RGBE_RETURN_FAILURE !== image_rgba_data ) { + case UnsignedByteType: - switch ( this.type ) { + var data = image_rgba_data; + var format = RGBEFormat; // handled as THREE.RGBAFormat in shaders + var type = UnsignedByteType; + break; - case UnsignedByteType: + case FloatType: - var data = image_rgba_data; - var format = RGBEFormat; // handled as THREE.RGBAFormat in shaders - var type = UnsignedByteType; - break; + var numElements = ( image_rgba_data.length / 4 ) * 3; + var floatArray = new Float32Array( numElements ); - case FloatType: + for ( var j = 0; j < numElements; j ++ ) { - var numElements = ( image_rgba_data.length / 4 ) * 3; - var floatArray = new Float32Array( numElements ); + RGBEByteToRGBFloat( image_rgba_data, j * 4, floatArray, j * 3 ); - for ( var j = 0; j < numElements; j ++ ) { + } - RGBEByteToRGBFloat( image_rgba_data, j * 4, floatArray, j * 3 ); + var data = floatArray; + var format = RGBFormat; + var type = FloatType; + break; - } + case HalfFloatType: - var data = floatArray; - var format = RGBFormat; - var type = FloatType; - break; + var numElements = ( image_rgba_data.length / 4 ) * 3; + var halfArray = new Uint16Array( numElements ); - case HalfFloatType: + for ( var j = 0; j < numElements; j ++ ) { - var numElements = ( image_rgba_data.length / 4 ) * 3; - var halfArray = new Uint16Array( numElements ); + RGBEByteToRGBHalf( image_rgba_data, j * 4, halfArray, j * 3 ); - for ( var j = 0; j < numElements; j ++ ) { + } - RGBEByteToRGBHalf( image_rgba_data, j * 4, halfArray, j * 3 ); + var data = halfArray; + var format = RGBFormat; + var type = HalfFloatType; + break; - } + default: - var data = halfArray; - var format = RGBFormat; - var type = HalfFloatType; - break; + console.error( 'THREE.RGBELoader: unsupported type: ', this.type ); + break; - default: + } - console.error( 'THREE.RGBELoader: unsupported type: ', this.type ); - break; + return { + width: w, height: h, + data: data, + header: rgbe_header_info.string, + gamma: rgbe_header_info.gamma, + exposure: rgbe_header_info.exposure, + format: format, + type: type + }; } - return { - width: w, height: h, - data: data, - header: rgbe_header_info.string, - gamma: rgbe_header_info.gamma, - exposure: rgbe_header_info.exposure, - format: format, - type: type - }; - } - } - - return null; - -}; - -RGBELoader.prototype.setDataType = function ( value ) { + return null; - this.type = value; - return this; + }, -}; + setDataType: function ( value ) { -RGBELoader.prototype.setType = function ( value ) { + this.type = value; + return this; - console.warn( 'THREE.RGBELoader: .setType() has been renamed to .setDataType().' ); + }, - return this.setDataType( value ); + load: function ( url, onLoad, onProgress, onError ) { -}; + function onLoadCallback( texture, texData ) { -RGBELoader.prototype.load = function ( url, onLoad, onProgress, onError ) { + switch ( texture.type ) { - function onLoadCallback( texture, texData ) { + case UnsignedByteType: - switch ( texture.type ) { + texture.encoding = RGBEEncoding; + texture.minFilter = NearestFilter; + texture.magFilter = NearestFilter; + texture.generateMipmaps = false; + texture.flipY = true; + break; - case UnsignedByteType: + case FloatType: - texture.encoding = RGBEEncoding; - texture.minFilter = NearestFilter; - texture.magFilter = NearestFilter; - texture.generateMipmaps = false; - texture.flipY = true; - break; + texture.encoding = LinearEncoding; + texture.minFilter = LinearFilter; + texture.magFilter = LinearFilter; + texture.generateMipmaps = false; + texture.flipY = true; + break; - case FloatType: + case HalfFloatType: - texture.encoding = LinearEncoding; - texture.minFilter = LinearFilter; - texture.magFilter = LinearFilter; - texture.generateMipmaps = false; - texture.flipY = true; - break; + texture.encoding = LinearEncoding; + texture.minFilter = LinearFilter; + texture.magFilter = LinearFilter; + texture.generateMipmaps = false; + texture.flipY = true; + break; - case HalfFloatType: + } - texture.encoding = LinearEncoding; - texture.minFilter = LinearFilter; - texture.magFilter = LinearFilter; - texture.generateMipmaps = false; - texture.flipY = true; - break; + if ( onLoad ) onLoad( texture, texData ); } - if ( onLoad ) onLoad( texture, texData ); + return DataTextureLoader.prototype.load.call( this, url, onLoadCallback, onProgress, onError ); } - return DataTextureLoader.prototype.load.call( this, url, onLoadCallback, onProgress, onError ); - -}; +} ); export { RGBELoader }; diff --git a/src/loaders/CompressedTextureLoader.js b/src/loaders/CompressedTextureLoader.js index ad64627e1622ce..d92c651741e8f0 100644 --- a/src/loaders/CompressedTextureLoader.js +++ b/src/loaders/CompressedTextureLoader.js @@ -7,6 +7,8 @@ import { Loader } from './Loader.js'; * @author mrdoob / http://mrdoob.com/ * * Abstract Base class to block based textures loader (dds, pvr, ...) + * + * Sub classes have to implement the parse() method which will be used in load(). */ function CompressedTextureLoader( manager ) { diff --git a/src/loaders/DataTextureLoader.js b/src/loaders/DataTextureLoader.js index 5330a5746ddf92..834e8d2698207f 100644 --- a/src/loaders/DataTextureLoader.js +++ b/src/loaders/DataTextureLoader.js @@ -7,15 +7,14 @@ import { Loader } from './Loader.js'; * @author Nikos M. / https://github.com/foo123/ * * Abstract Base class to load generic binary textures formats (rgbe, hdr, ...) + * + * Sub classes have to implement the parse() method which will be used in load(). */ function DataTextureLoader( manager ) { Loader.call( this, manager ); - // override in sub classes - this._parser = null; - } DataTextureLoader.prototype = Object.assign( Object.create( Loader.prototype ), { @@ -33,7 +32,7 @@ DataTextureLoader.prototype = Object.assign( Object.create( Loader.prototype ), loader.setPath( this.path ); loader.load( url, function ( buffer ) { - var texData = scope._parser( buffer ); + var texData = scope.parse( buffer ); if ( ! texData ) return; From 3de103cc946fdab723aa6b77d26b8e6e82c37334 Mon Sep 17 00:00:00 2001 From: Mugen87 Date: Mon, 2 Sep 2019 13:46:06 +0200 Subject: [PATCH 34/75] Examples: Clean up. --- .../loaders/sea3d/physics/SEA3DAmmoLoader.js | 4 +- examples/jsm/nodes/accessors/PositionNode.js | 1 - examples/jsm/nodes/misc/TextureCubeNode.js | 1 - examples/webgl_loader_gltf_extensions.html | 2 +- examples/webgl_materials_nodes.html | 56 +++++++++---------- 5 files changed, 29 insertions(+), 35 deletions(-) diff --git a/examples/jsm/loaders/sea3d/physics/SEA3DAmmoLoader.js b/examples/jsm/loaders/sea3d/physics/SEA3DAmmoLoader.js index 7020f1f7444760..685647f948621f 100644 --- a/examples/jsm/loaders/sea3d/physics/SEA3DAmmoLoader.js +++ b/examples/jsm/loaders/sea3d/physics/SEA3DAmmoLoader.js @@ -172,7 +172,7 @@ var AMMO = { }, containsConstraint: function ( ctrt ) { - return this.constraints.indexOf( rb ) > - 1; + return this.constraints.indexOf( ctrt ) > - 1; }, @@ -249,8 +249,6 @@ var AMMO = { var mConvexHull = new Ammo.btConvexHullShape(); - var v0 = new Ammo.btVector3( 0, 0, 0 ); - var vertex = geometry.getAttribute( 'position' ).array; var indexes = geometry.getIndex().array; diff --git a/examples/jsm/nodes/accessors/PositionNode.js b/examples/jsm/nodes/accessors/PositionNode.js index b33f98a99c6a42..03b3b2d3f778d7 100644 --- a/examples/jsm/nodes/accessors/PositionNode.js +++ b/examples/jsm/nodes/accessors/PositionNode.js @@ -3,7 +3,6 @@ */ import { TempNode } from '../core/TempNode.js'; -import { NormalNode } from '../accessors/NormalNode.js'; import { NodeLib } from '../core/NodeLib.js'; function PositionNode( scope ) { diff --git a/examples/jsm/nodes/misc/TextureCubeNode.js b/examples/jsm/nodes/misc/TextureCubeNode.js index 866421217a527e..16a8af8395612a 100644 --- a/examples/jsm/nodes/misc/TextureCubeNode.js +++ b/examples/jsm/nodes/misc/TextureCubeNode.js @@ -9,7 +9,6 @@ import { TextureCubeUVNode } from './TextureCubeUVNode.js'; import { ReflectNode } from '../accessors/ReflectNode.js'; import { NormalNode } from '../accessors/NormalNode.js'; import { ColorSpaceNode } from '../utils/ColorSpaceNode.js'; -import { SpecularMIPLevelNode } from '../utils/SpecularMIPLevelNode.js'; function TextureCubeNode( value, textureSize, uv, bias ) { diff --git a/examples/webgl_loader_gltf_extensions.html b/examples/webgl_loader_gltf_extensions.html index 6b5c3560fcbf89..11ed8ba05cfa97 100644 --- a/examples/webgl_loader_gltf_extensions.html +++ b/examples/webgl_loader_gltf_extensions.html @@ -268,7 +268,7 @@ loader = new GLTFLoader(); var dracoLoader = new DRACOLoader(); - dracoLoader.setDecoderPath( 'js/libs/draco/gltf/' ) + dracoLoader.setDecoderPath( 'js/libs/draco/gltf/' ); loader.setDRACOLoader( dracoLoader ); loader.setDDSLoader( new DDSLoader() ); diff --git a/examples/webgl_materials_nodes.html b/examples/webgl_materials_nodes.html index c9ddab192f3527..7969ae469871b8 100644 --- a/examples/webgl_materials_nodes.html +++ b/examples/webgl_materials_nodes.html @@ -560,8 +560,6 @@ // NODES - var mask = new Nodes.SwitchNode( new Nodes.TextureNode( getTexture( "decalDiffuse" ) ), 'w' ); - var normalScale = new Nodes.FloatNode( .3 ); var radiance = new Nodes.FloatNode( 1 ); @@ -579,8 +577,8 @@ var envNode = new Nodes.TextureCubeNode( new Nodes.TextureNode( premTexture ) ); var subSlotNode = new Nodes.SubSlotNode(); - subSlotNode.slots['radiance'] = new Nodes.OperatorNode( radiance, envNode, Nodes.OperatorNode.MUL ); - subSlotNode.slots['irradiance'] = new Nodes.OperatorNode( irradiance, envNode, Nodes.OperatorNode.MUL ); + subSlotNode.slots[ 'radiance' ] = new Nodes.OperatorNode( radiance, envNode, Nodes.OperatorNode.MUL ); + subSlotNode.slots[ 'irradiance' ] = new Nodes.OperatorNode( irradiance, envNode, Nodes.OperatorNode.MUL ); mtl.environment = subSlotNode; @@ -2496,7 +2494,7 @@ function biasMode( val ) { - switch( val ) { + switch ( val ) { case 'prem': @@ -2595,42 +2593,42 @@ case 'node-reflect': - // MATERIAL + // MATERIAL - var node = new Nodes.ReflectNode(); + var node = new Nodes.ReflectNode(); - var nodeMaterial = new Nodes.StandardNodeMaterial(); - nodeMaterial.environment = new Nodes.CubeTextureNode( cubemap, node ); - nodeMaterial.roughness.value = .5; - nodeMaterial.metalness.value = 1; + var nodeMaterial = new Nodes.StandardNodeMaterial(); + nodeMaterial.environment = new Nodes.CubeTextureNode( cubemap, node ); + nodeMaterial.roughness.value = .5; + nodeMaterial.metalness.value = 1; - var standardMaterial = new THREE.MeshStandardMaterial( { - color: nodeMaterial.color.value, - side: defaultSide, - envMap: cubemap, - roughness: nodeMaterial.roughness.value, - metalness: 1 - } ); + var standardMaterial = new THREE.MeshStandardMaterial( { + color: nodeMaterial.color.value, + side: defaultSide, + envMap: cubemap, + roughness: nodeMaterial.roughness.value, + metalness: 1 + } ); - mtl = nodeMaterial; + mtl = nodeMaterial; - // GUI + // GUI - addGui( 'node', true, function ( val ) { + addGui( 'node', true, function ( val ) { - mtl = val ? nodeMaterial : standardMaterial; - mesh.material = mtl; + mtl = val ? nodeMaterial : standardMaterial; + mesh.material = mtl; - } ); + } ); - addGui( 'roughness', nodeMaterial.roughness.value, function ( val ) { + addGui( 'roughness', nodeMaterial.roughness.value, function ( val ) { - nodeMaterial.roughness.value = val; - standardMaterial.roughness = val; + nodeMaterial.roughness.value = val; + standardMaterial.roughness = val; - }, false, 0, 1 ); + }, false, 0, 1 ); - break; + break; case 'varying': From 7768d5b1d9e71ecb44acd868d57b0569317ee9e3 Mon Sep 17 00:00:00 2001 From: Mugen87 Date: Mon, 2 Sep 2019 19:50:50 +0200 Subject: [PATCH 35/75] Examples: Fix TS files. --- examples/jsm/loaders/PCDLoader.d.ts | 2 +- examples/jsm/nodes/misc/TextureCubeUVNode.d.ts | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/examples/jsm/loaders/PCDLoader.d.ts b/examples/jsm/loaders/PCDLoader.d.ts index ddd1b15789abf3..ece544a15bef73 100644 --- a/examples/jsm/loaders/PCDLoader.d.ts +++ b/examples/jsm/loaders/PCDLoader.d.ts @@ -1,6 +1,6 @@ import { Points, - Lodaer, + Loader, LoadingManager } from '../../../src/Three'; diff --git a/examples/jsm/nodes/misc/TextureCubeUVNode.d.ts b/examples/jsm/nodes/misc/TextureCubeUVNode.d.ts index 3982c4c0994903..71346c428980c8 100644 --- a/examples/jsm/nodes/misc/TextureCubeUVNode.d.ts +++ b/examples/jsm/nodes/misc/TextureCubeUVNode.d.ts @@ -3,15 +3,13 @@ import { NodeBuilder } from '../core/NodeBuilder'; import { FloatNode } from '../inputs/FloatNode'; import { StructNode } from '../core/StructNode'; import { FunctionNode } from '../core/FunctionNode'; -import { BlinnExponentToRoughnessNode } from '../bsdfs/BlinnExponentToRoughnessNode'; import { Node } from '../core/Node'; export class TextureCubeUVNode extends TempNode { - constructor(uv: Node, textureSize: FloatNode, blinnExponentToRoughness: BlinnExponentToRoughnessNode); + constructor(uv: Node, textureSize: FloatNode); uv: Node; textureSize: FloatNode; - blinnExponentToRoughness: BlinnExponentToRoughnessNode; nodeType: string; generate(builder: NodeBuilder, output: string): string; From abf2eb26c6a75d69bdf14acd2af62bab5049b00c Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Mon, 2 Sep 2019 19:30:34 -0700 Subject: [PATCH 36/75] Rename SpecularMIPLevelNode.d..ts to SpecularMIPLevelNode.d.ts --- .../{SpecularMIPLevelNode.d..ts => SpecularMIPLevelNode.d.ts} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename examples/jsm/nodes/utils/{SpecularMIPLevelNode.d..ts => SpecularMIPLevelNode.d.ts} (100%) diff --git a/examples/jsm/nodes/utils/SpecularMIPLevelNode.d..ts b/examples/jsm/nodes/utils/SpecularMIPLevelNode.d.ts similarity index 100% rename from examples/jsm/nodes/utils/SpecularMIPLevelNode.d..ts rename to examples/jsm/nodes/utils/SpecularMIPLevelNode.d.ts From 80f49cfca980e50fb3ad48a58a1e64dd8c7ec996 Mon Sep 17 00:00:00 2001 From: Olli Etuaho Date: Mon, 2 Sep 2019 23:58:34 +0300 Subject: [PATCH 37/75] Fix toggling receiveShadow without changing material Fix the case where there are two objects with the same material in the scene and one has receiveShadow=true and the other has receiveShadow=false. This also prevents possible extra shader compiles when the same material is reused with receiveShadow enabled or disabled in the same scene. --- examples/webgl_shadowmap_receiveshadow.html | 88 +++++++++++++++++++ src/renderers/WebGLRenderer.js | 7 ++ .../ShaderChunk/lights_fragment_begin.glsl.js | 6 +- .../ShaderChunk/lights_pars_begin.glsl.js | 1 + src/renderers/webgl/WebGLPrograms.js | 2 +- 5 files changed, 100 insertions(+), 4 deletions(-) create mode 100644 examples/webgl_shadowmap_receiveshadow.html diff --git a/examples/webgl_shadowmap_receiveshadow.html b/examples/webgl_shadowmap_receiveshadow.html new file mode 100644 index 00000000000000..f00bf405aa9ed1 --- /dev/null +++ b/examples/webgl_shadowmap_receiveshadow.html @@ -0,0 +1,88 @@ + + + + three.js webgl - shadow map - per-object receive shadow + + + + + + + + + + diff --git a/src/renderers/WebGLRenderer.js b/src/renderers/WebGLRenderer.js index 2d15ed7f151bb9..7f0cfbd62baab1 100644 --- a/src/renderers/WebGLRenderer.js +++ b/src/renderers/WebGLRenderer.js @@ -1792,6 +1792,13 @@ function WebGLRenderer( parameters ) { } + if ( refreshMaterial || materialProperties.receiveShadow !== object.receiveShadow ) { + + materialProperties.receiveShadow = object.receiveShadow; + p_uniforms.setValue( _gl, 'receiveShadow', object.receiveShadow ); + + } + if ( refreshMaterial ) { p_uniforms.setValue( _gl, 'toneMappingExposure', _this.toneMappingExposure ); diff --git a/src/renderers/shaders/ShaderChunk/lights_fragment_begin.glsl.js b/src/renderers/shaders/ShaderChunk/lights_fragment_begin.glsl.js index 29ae92c9715d31..de6084067d380e 100644 --- a/src/renderers/shaders/ShaderChunk/lights_fragment_begin.glsl.js +++ b/src/renderers/shaders/ShaderChunk/lights_fragment_begin.glsl.js @@ -40,7 +40,7 @@ IncidentLight directLight; getPointDirectLightIrradiance( pointLight, geometry, directLight ); #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) - directLight.color *= all( bvec2( pointLight.shadow, directLight.visible ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; + directLight.color *= all( bvec3( pointLight.shadow, directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; #endif RE_Direct( directLight, geometry, material, reflectedLight ); @@ -61,7 +61,7 @@ IncidentLight directLight; getSpotDirectLightIrradiance( spotLight, geometry, directLight ); #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) - directLight.color *= all( bvec2( spotLight.shadow, directLight.visible ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0; + directLight.color *= all( bvec3( spotLight.shadow, directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0; #endif RE_Direct( directLight, geometry, material, reflectedLight ); @@ -82,7 +82,7 @@ IncidentLight directLight; getDirectionalDirectLightIrradiance( directionalLight, geometry, directLight ); #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) - directLight.color *= all( bvec2( directionalLight.shadow, directLight.visible ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; + directLight.color *= all( bvec3( directionalLight.shadow, directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; #endif RE_Direct( directLight, geometry, material, reflectedLight ); diff --git a/src/renderers/shaders/ShaderChunk/lights_pars_begin.glsl.js b/src/renderers/shaders/ShaderChunk/lights_pars_begin.glsl.js index 7c520211f64d83..1036f525592a14 100644 --- a/src/renderers/shaders/ShaderChunk/lights_pars_begin.glsl.js +++ b/src/renderers/shaders/ShaderChunk/lights_pars_begin.glsl.js @@ -1,4 +1,5 @@ export default /* glsl */` +uniform bool receiveShadow; uniform vec3 ambientLightColor; uniform vec3 lightProbe[ 9 ]; diff --git a/src/renderers/webgl/WebGLPrograms.js b/src/renderers/webgl/WebGLPrograms.js index c8a93646c437a8..e6dda01b17e5b2 100644 --- a/src/renderers/webgl/WebGLPrograms.js +++ b/src/renderers/webgl/WebGLPrograms.js @@ -205,7 +205,7 @@ function WebGLPrograms( renderer, extensions, capabilities ) { dithering: material.dithering, - shadowMapEnabled: renderer.shadowMap.enabled && object.receiveShadow && shadows.length > 0, + shadowMapEnabled: renderer.shadowMap.enabled && shadows.length > 0, shadowMapType: renderer.shadowMap.type, toneMapping: material.toneMapped ? renderer.toneMapping : NoToneMapping, From f3205d7cc2b1478c8e80fd06490d552b2d44eb6f Mon Sep 17 00:00:00 2001 From: Mugen87 Date: Tue, 3 Sep 2019 11:41:57 +0200 Subject: [PATCH 38/75] Update builds. --- build/three.js | 16 ++++++------ build/three.min.js | 58 +++++++++++++++++++++---------------------- build/three.module.js | 16 ++++++------ 3 files changed, 42 insertions(+), 48 deletions(-) diff --git a/build/three.js b/build/three.js index e1b720e8d5a086..a3ab1e4b7bcc78 100644 --- a/build/three.js +++ b/build/three.js @@ -34984,15 +34984,14 @@ * @author mrdoob / http://mrdoob.com/ * * Abstract Base class to block based textures loader (dds, pvr, ...) + * + * Sub classes have to implement the parse() method which will be used in load(). */ function CompressedTextureLoader( manager ) { Loader.call( this, manager ); - // override in sub classes - this._parser = null; - } CompressedTextureLoader.prototype = Object.assign( Object.create( Loader.prototype ), { @@ -35016,7 +35015,7 @@ loader.load( url[ i ], function ( buffer ) { - var texDatas = scope._parser( buffer, true ); + var texDatas = scope.parse( buffer, true ); images[ i ] = { width: texDatas.width, @@ -35059,7 +35058,7 @@ loader.load( url, function ( buffer ) { - var texDatas = scope._parser( buffer, true ); + var texDatas = scope.parse( buffer, true ); if ( texDatas.isCubemap ) { @@ -35113,15 +35112,14 @@ * @author Nikos M. / https://github.com/foo123/ * * Abstract Base class to load generic binary textures formats (rgbe, hdr, ...) + * + * Sub classes have to implement the parse() method which will be used in load(). */ function DataTextureLoader( manager ) { Loader.call( this, manager ); - // override in sub classes - this._parser = null; - } DataTextureLoader.prototype = Object.assign( Object.create( Loader.prototype ), { @@ -35139,7 +35137,7 @@ loader.setPath( this.path ); loader.load( url, function ( buffer ) { - var texData = scope._parser( buffer ); + var texData = scope.parse( buffer ); if ( ! texData ) return; diff --git a/build/three.min.js b/build/three.min.js index 70af345405f62c..db278e4afb7100 100644 --- a/build/three.min.js +++ b/build/three.min.js @@ -1,4 +1,3 @@ -// threejs.org/license (function(k,xa){"object"===typeof exports&&"undefined"!==typeof module?xa(exports):"function"===typeof define&&define.amd?define(["exports"],xa):(k=k||self,xa(k.THREE={}))})(this,function(k){function xa(){}function v(a,b){this.x=a||0;this.y=b||0}function na(a,b,c,d){this._x=a||0;this._y=b||0;this._z=c||0;this._w=void 0!==d?d:1}function n(a,b,c){this.x=a||0;this.y=b||0;this.z=c||0}function ta(){this.elements=[1,0,0,0,1,0,0,0,1];0this.duration&&this.resetDuration()}function fk(a){switch(a.toLowerCase()){case "scalar":case "double":case "float":case "number":case "integer":return $c;case "vector":case "vector2":case "vector3":case "vector4":return ad; case "color":return Re;case "quaternion":return ke;case "bool":case "boolean":return Qe;case "string":return Te}throw Error("THREE.KeyframeTrack: Unsupported typeName: "+a);}function gk(a){if(void 0===a.type)throw Error("THREE.KeyframeTrack: track type undefined, can not parse");var b=fk(a.type);if(void 0===a.times){var c=[],d=[];Z.flattenJSON(a.keys,c,d,"value");a.times=c;a.values=d}return void 0!==b.parse?b.parse(a):new b(a.name,a.times,a.values,a.interpolation)}function kg(a,b,c){var d=this,e= !1,f=0,g=0,h=void 0;this.onStart=void 0;this.onLoad=a;this.onProgress=b;this.onError=c;this.itemStart=function(a){g++;if(!1===e&&void 0!==d.onStart)d.onStart(a,f,g);e=!0};this.itemEnd=function(a){f++;if(void 0!==d.onProgress)d.onProgress(a,f,g);if(f===g&&(e=!1,void 0!==d.onLoad))d.onLoad()};this.itemError=function(a){if(void 0!==d.onError)d.onError(a)};this.resolveURL=function(a){return h?h(a):a};this.setURLModifier=function(a){h=a;return this}}function aa(a){this.manager=void 0!==a?a:Th;this.crossOrigin= -"anonymous";this.resourcePath=this.path=""}function Na(a){aa.call(this,a)}function lg(a){aa.call(this,a)}function mg(a){aa.call(this,a);this._parser=null}function Ue(a){aa.call(this,a);this._parser=null}function bd(a){aa.call(this,a)}function Ve(a){aa.call(this,a)}function We(a){aa.call(this,a)}function F(){this.type="Curve";this.arcLengthDivisions=200}function Ia(a,b,c,d,e,f,g,h){F.call(this);this.type="EllipseCurve";this.aX=a||0;this.aY=b||0;this.xRadius=c||1;this.yRadius=d||1;this.aStartAngle= -e||0;this.aEndAngle=f||2*Math.PI;this.aClockwise=g||!1;this.aRotation=h||0}function cd(a,b,c,d,e,f){Ia.call(this,a,b,c,c,d,e,f);this.type="ArcCurve"}function ng(){var a=0,b=0,c=0,d=0;return{initCatmullRom:function(e,f,g,h,l){e=l*(g-e);h=l*(h-f);a=f;b=e;c=-3*f+3*g-2*e-h;d=2*f-2*g+e+h},initNonuniformCatmullRom:function(e,f,g,h,l,m,k){e=((f-e)/l-(g-e)/(l+m)+(g-f)/m)*m;h=((g-f)/m-(h-f)/(m+k)+(h-g)/k)*m;a=f;b=e;c=-3*f+3*g-2*e-h;d=2*f-2*g+e+h},calc:function(e){var f=e*e;return a+b*e+c*f+d*f*e}}}function sa(a, -b,c,d){F.call(this);this.type="CatmullRomCurve3";this.points=a||[];this.closed=b||!1;this.curveType=c||"centripetal";this.tension=d||.5}function Uh(a,b,c,d,e){b=.5*(d-b);e=.5*(e-c);var f=a*a;return(2*c-2*d+b+e)*a*f+(-3*c+3*d-2*b-e)*f+b*a+c}function le(a,b,c,d){var e=1-a;return e*e*b+2*(1-a)*a*c+a*a*d}function me(a,b,c,d,e){var f=1-a,g=1-a;return f*f*f*b+3*g*g*a*c+3*(1-a)*a*a*d+a*a*a*e}function Sa(a,b,c,d){F.call(this);this.type="CubicBezierCurve";this.v0=a||new v;this.v1=b||new v;this.v2=c||new v; -this.v3=d||new v}function gb(a,b,c,d){F.call(this);this.type="CubicBezierCurve3";this.v0=a||new n;this.v1=b||new n;this.v2=c||new n;this.v3=d||new n}function Da(a,b){F.call(this);this.type="LineCurve";this.v1=a||new v;this.v2=b||new v}function Ta(a,b){F.call(this);this.type="LineCurve3";this.v1=a||new n;this.v2=b||new n}function Ua(a,b,c){F.call(this);this.type="QuadraticBezierCurve";this.v0=a||new v;this.v1=b||new v;this.v2=c||new v}function hb(a,b,c){F.call(this);this.type="QuadraticBezierCurve3"; -this.v0=a||new n;this.v1=b||new n;this.v2=c||new n}function Va(a){F.call(this);this.type="SplineCurve";this.points=a||[]}function sb(){F.call(this);this.type="CurvePath";this.curves=[];this.autoClose=!1}function Wa(a){sb.call(this);this.type="Path";this.currentPoint=new v;a&&this.setFromPoints(a)}function Jb(a){Wa.call(this,a);this.uuid=O.generateUUID();this.type="Shape";this.holes=[]}function V(a,b){B.call(this);this.type="Light";this.color=new J(a);this.intensity=void 0!==b?b:1;this.receiveShadow= -void 0}function Xe(a,b,c){V.call(this,a,c);this.type="HemisphereLight";this.castShadow=void 0;this.position.copy(B.DefaultUp);this.updateMatrix();this.groundColor=new J(b)}function ib(a){this.camera=a;this.bias=0;this.radius=1;this.mapSize=new v(512,512);this.mapPass=this.map=null;this.matrix=new P;this._frustum=new Ed;this._frameExtents=new v(1,1);this._viewportCount=1;this._viewports=[new da(0,0,1,1)]}function Ye(){ib.call(this,new la(50,1,.5,500))}function Ze(a,b,c,d,e,f){V.call(this,a,b);this.type= -"SpotLight";this.position.copy(B.DefaultUp);this.updateMatrix();this.target=new B;Object.defineProperty(this,"power",{get:function(){return this.intensity*Math.PI},set:function(a){this.intensity=a/Math.PI}});this.distance=void 0!==c?c:0;this.angle=void 0!==d?d:Math.PI/3;this.penumbra=void 0!==e?e:0;this.decay=void 0!==f?f:1;this.shadow=new Ye}function og(){ib.call(this,new la(90,1,.5,500));this._frameExtents=new v(4,2);this._viewportCount=6;this._viewports=[new da(2,1,1,1),new da(0,1,1,1),new da(3, -1,1,1),new da(1,1,1,1),new da(3,0,1,1),new da(1,0,1,1)];this._cubeDirections=[new n(1,0,0),new n(-1,0,0),new n(0,0,1),new n(0,0,-1),new n(0,1,0),new n(0,-1,0)];this._cubeUps=[new n(0,1,0),new n(0,1,0),new n(0,1,0),new n(0,1,0),new n(0,0,1),new n(0,0,-1)]}function $e(a,b,c,d){V.call(this,a,b);this.type="PointLight";Object.defineProperty(this,"power",{get:function(){return 4*this.intensity*Math.PI},set:function(a){this.intensity=a/(4*Math.PI)}});this.distance=void 0!==c?c:0;this.decay=void 0!==d?d: -1;this.shadow=new og}function ne(a,b,c,d,e,f){bb.call(this);this.type="OrthographicCamera";this.zoom=1;this.view=null;this.left=void 0!==a?a:-1;this.right=void 0!==b?b:1;this.top=void 0!==c?c:1;this.bottom=void 0!==d?d:-1;this.near=void 0!==e?e:.1;this.far=void 0!==f?f:2E3;this.updateProjectionMatrix()}function af(){ib.call(this,new ne(-5,5,5,-5,.5,500))}function bf(a,b){V.call(this,a,b);this.type="DirectionalLight";this.position.copy(B.DefaultUp);this.updateMatrix();this.target=new B;this.shadow= -new af}function cf(a,b){V.call(this,a,b);this.type="AmbientLight";this.castShadow=void 0}function df(a,b,c,d){V.call(this,a,b);this.type="RectAreaLight";this.width=void 0!==c?c:10;this.height=void 0!==d?d:10}function ef(a){aa.call(this,a);this.textures={}}function ff(){D.call(this);this.type="InstancedBufferGeometry";this.maxInstancedCount=void 0}function gf(a,b,c,d){"number"===typeof c&&(d=c,c=!1,console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.")); -N.call(this,a,b,c);this.meshPerAttribute=d||1}function hf(a){aa.call(this,a)}function jf(a){aa.call(this,a)}function pg(a){"undefined"===typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported.");"undefined"===typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported.");aa.call(this,a);this.options=void 0}function qg(){this.type="ShapePath";this.color=new J;this.subPaths=[];this.currentPath=null}function rg(a){this.type="Font";this.data= -a}function sg(a){aa.call(this,a)}function kf(a){aa.call(this,a)}function lf(){this.coefficients=[];for(var a=0;9>a;a++)this.coefficients.push(new n)}function Xa(a,b){V.call(this,void 0,b);this.sh=void 0!==a?a:new lf}function tg(a,b,c){Xa.call(this,void 0,c);a=(new J).set(a);c=(new J).set(b);b=new n(a.r,a.g,a.b);a=new n(c.r,c.g,c.b);c=Math.sqrt(Math.PI);var d=c*Math.sqrt(.75);this.sh.coefficients[0].copy(b).add(a).multiplyScalar(c);this.sh.coefficients[1].copy(b).sub(a).multiplyScalar(d)}function ug(a, -b){Xa.call(this,void 0,b);a=(new J).set(a);this.sh.coefficients[0].set(a.r,a.g,a.b).multiplyScalar(2*Math.sqrt(Math.PI))}function Vh(){this.type="StereoCamera";this.aspect=1;this.eyeSep=.064;this.cameraL=new la;this.cameraL.layers.enable(1);this.cameraL.matrixAutoUpdate=!1;this.cameraR=new la;this.cameraR.layers.enable(2);this.cameraR.matrixAutoUpdate=!1;this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}function vg(a){this.autoStart=void 0!==a?a:!0;this.elapsedTime= -this.oldTime=this.startTime=0;this.running=!1}function wg(){B.call(this);this.type="AudioListener";this.context=xg.getContext();this.gain=this.context.createGain();this.gain.connect(this.context.destination);this.filter=null;this.timeDelta=0;this._clock=new vg}function dd(a){B.call(this);this.type="Audio";this.listener=a;this.context=a.context;this.gain=this.context.createGain();this.gain.connect(a.getInput());this.autoplay=!1;this.buffer=null;this.detune=0;this.loop=!1;this.offset=this.startTime= -0;this.duration=void 0;this.playbackRate=1;this.isPlaying=!1;this.hasPlaybackControl=!0;this.sourceType="empty";this.filters=[]}function yg(a){dd.call(this,a);this.panner=this.context.createPanner();this.panner.panningModel="HRTF";this.panner.connect(this.gain)}function zg(a,b){this.analyser=a.context.createAnalyser();this.analyser.fftSize=void 0!==b?b:2048;this.data=new Uint8Array(this.analyser.frequencyBinCount);a.getOutput().connect(this.analyser)}function Ag(a,b,c){this.binding=a;this.valueSize= -c;a=Float64Array;switch(b){case "quaternion":b=this._slerp;break;case "string":case "bool":a=Array;b=this._select;break;default:b=this._lerp}this.buffer=new a(4*c);this._mixBufferRegion=b;this.referenceCount=this.useCount=this.cumulativeWeight=0}function Wh(a,b,c){c=c||ma.parseTrackName(b);this._targetGroup=a;this._bindings=a.subscribe_(b,c)}function ma(a,b,c){this.path=b;this.parsedPath=c||ma.parseTrackName(b);this.node=ma.findNode(a,this.parsedPath.nodeName)||a;this.rootNode=a}function Xh(){this.uuid= -O.generateUUID();this._objects=Array.prototype.slice.call(arguments);this.nCachedObjects_=0;var a={};this._indicesByUUID=a;for(var b=0,c=arguments.length;b!==c;++b)a[arguments[b].uuid]=b;this._paths=[];this._parsedPaths=[];this._bindings=[];this._bindingsIndicesByPath={};var d=this;this.stats={objects:{get total(){return d._objects.length},get inUse(){return this.total-d.nCachedObjects_}},get bindingsPerObject(){return d._bindings.length}}}function Yh(a,b,c){this._mixer=a;this._clip=b;this._localRoot= -c||null;a=b.tracks;b=a.length;c=Array(b);for(var d={endingStart:2400,endingEnd:2400},e=0;e!==b;++e){var f=a[e].createInterpolant(null);c[e]=f;f.settings=d}this._interpolantSettings=d;this._interpolants=c;this._propertyBindings=Array(b);this._weightInterpolant=this._timeScaleInterpolant=this._byClipCacheIndex=this._cacheIndex=null;this.loop=2201;this._loopCount=-1;this._startTime=null;this.time=0;this._effectiveWeight=this.weight=this._effectiveTimeScale=this.timeScale=1;this.repetitions=Infinity; -this.paused=!1;this.enabled=!0;this.clampWhenFinished=!1;this.zeroSlopeAtEnd=this.zeroSlopeAtStart=!0}function Bg(a){this._root=a;this._initMemoryManager();this.time=this._accuIndex=0;this.timeScale=1}function mf(a,b){"string"===typeof a&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),a=b);this.value=a}function Cg(a,b,c){ac.call(this,a,b);this.meshPerAttribute=c||1}function Zh(a,b,c,d){this.ray=new Sb(a,b);this.near=c||0;this.far=d||Infinity;this.camera=null;this.params={Mesh:{}, -Line:{},LOD:{},Points:{threshold:1},Sprite:{}};Object.defineProperties(this.params,{PointCloud:{get:function(){console.warn("THREE.Raycaster: params.PointCloud has been renamed to params.Points.");return this.Points}}})}function $h(a,b){return a.distance-b.distance}function Dg(a,b,c,d){if(!1!==a.visible&&(a.raycast(b,c),!0===d)){a=a.children;d=0;for(var e=a.length;dc;c++,d++){var e=c/32*Math.PI*2,f=d/32*Math.PI*2;b.push(Math.cos(e),Math.sin(e),1, -Math.cos(f),Math.sin(f),1)}a.addAttribute("position",new A(b,3));b=new Y({fog:!1});this.cone=new R(a,b);this.add(this.cone);this.update()}function ci(a){var b=[];a&&a.isBone&&b.push(a);for(var c=0;ca;a++)this.coefficients.push(new n)}function Xa(a,b){V.call(this,void 0,b);this.sh=void 0!==a?a:new lf}function tg(a,b,c){Xa.call(this,void 0,c);a=(new J).set(a);c=(new J).set(b);b=new n(a.r,a.g,a.b);a=new n(c.r,c.g,c.b);c=Math.sqrt(Math.PI);var d=c*Math.sqrt(.75);this.sh.coefficients[0].copy(b).add(a).multiplyScalar(c);this.sh.coefficients[1].copy(b).sub(a).multiplyScalar(d)}function ug(a,b){Xa.call(this,void 0,b);a=(new J).set(a);this.sh.coefficients[0].set(a.r,a.g,a.b).multiplyScalar(2*Math.sqrt(Math.PI))} +function Vh(){this.type="StereoCamera";this.aspect=1;this.eyeSep=.064;this.cameraL=new la;this.cameraL.layers.enable(1);this.cameraL.matrixAutoUpdate=!1;this.cameraR=new la;this.cameraR.layers.enable(2);this.cameraR.matrixAutoUpdate=!1;this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}function vg(a){this.autoStart=void 0!==a?a:!0;this.elapsedTime=this.oldTime=this.startTime=0;this.running=!1}function wg(){B.call(this);this.type="AudioListener";this.context=xg.getContext(); +this.gain=this.context.createGain();this.gain.connect(this.context.destination);this.filter=null;this.timeDelta=0;this._clock=new vg}function dd(a){B.call(this);this.type="Audio";this.listener=a;this.context=a.context;this.gain=this.context.createGain();this.gain.connect(a.getInput());this.autoplay=!1;this.buffer=null;this.detune=0;this.loop=!1;this.offset=this.startTime=0;this.duration=void 0;this.playbackRate=1;this.isPlaying=!1;this.hasPlaybackControl=!0;this.sourceType="empty";this.filters=[]} +function yg(a){dd.call(this,a);this.panner=this.context.createPanner();this.panner.panningModel="HRTF";this.panner.connect(this.gain)}function zg(a,b){this.analyser=a.context.createAnalyser();this.analyser.fftSize=void 0!==b?b:2048;this.data=new Uint8Array(this.analyser.frequencyBinCount);a.getOutput().connect(this.analyser)}function Ag(a,b,c){this.binding=a;this.valueSize=c;a=Float64Array;switch(b){case "quaternion":b=this._slerp;break;case "string":case "bool":a=Array;b=this._select;break;default:b= +this._lerp}this.buffer=new a(4*c);this._mixBufferRegion=b;this.referenceCount=this.useCount=this.cumulativeWeight=0}function Wh(a,b,c){c=c||ma.parseTrackName(b);this._targetGroup=a;this._bindings=a.subscribe_(b,c)}function ma(a,b,c){this.path=b;this.parsedPath=c||ma.parseTrackName(b);this.node=ma.findNode(a,this.parsedPath.nodeName)||a;this.rootNode=a}function Xh(){this.uuid=O.generateUUID();this._objects=Array.prototype.slice.call(arguments);this.nCachedObjects_=0;var a={};this._indicesByUUID=a; +for(var b=0,c=arguments.length;b!==c;++b)a[arguments[b].uuid]=b;this._paths=[];this._parsedPaths=[];this._bindings=[];this._bindingsIndicesByPath={};var d=this;this.stats={objects:{get total(){return d._objects.length},get inUse(){return this.total-d.nCachedObjects_}},get bindingsPerObject(){return d._bindings.length}}}function Yh(a,b,c){this._mixer=a;this._clip=b;this._localRoot=c||null;a=b.tracks;b=a.length;c=Array(b);for(var d={endingStart:2400,endingEnd:2400},e=0;e!==b;++e){var f=a[e].createInterpolant(null); +c[e]=f;f.settings=d}this._interpolantSettings=d;this._interpolants=c;this._propertyBindings=Array(b);this._weightInterpolant=this._timeScaleInterpolant=this._byClipCacheIndex=this._cacheIndex=null;this.loop=2201;this._loopCount=-1;this._startTime=null;this.time=0;this._effectiveWeight=this.weight=this._effectiveTimeScale=this.timeScale=1;this.repetitions=Infinity;this.paused=!1;this.enabled=!0;this.clampWhenFinished=!1;this.zeroSlopeAtEnd=this.zeroSlopeAtStart=!0}function Bg(a){this._root=a;this._initMemoryManager(); +this.time=this._accuIndex=0;this.timeScale=1}function mf(a,b){"string"===typeof a&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),a=b);this.value=a}function Cg(a,b,c){ac.call(this,a,b);this.meshPerAttribute=c||1}function Zh(a,b,c,d){this.ray=new Sb(a,b);this.near=c||0;this.far=d||Infinity;this.camera=null;this.params={Mesh:{},Line:{},LOD:{},Points:{threshold:1},Sprite:{}};Object.defineProperties(this.params,{PointCloud:{get:function(){console.warn("THREE.Raycaster: params.PointCloud has been renamed to params.Points."); +return this.Points}}})}function $h(a,b){return a.distance-b.distance}function Dg(a,b,c,d){if(!1!==a.visible&&(a.raycast(b,c),!0===d)){a=a.children;d=0;for(var e=a.length;dc;c++,d++){var e=c/32*Math.PI*2,f=d/32*Math.PI*2;b.push(Math.cos(e),Math.sin(e),1,Math.cos(f),Math.sin(f),1)}a.addAttribute("position",new A(b,3));b=new Y({fog:!1});this.cone=new R(a,b);this.add(this.cone);this.update()}function ci(a){var b=[];a&&a.isBone&&b.push(a);for(var c= +0;c Date: Tue, 3 Sep 2019 12:39:19 +0200 Subject: [PATCH 39/75] DragControls: Remove deprecated API and checks. --- examples/js/controls/DragControls.js | 36 -------------------------- examples/jsm/controls/DragControls.js | 37 --------------------------- 2 files changed, 73 deletions(-) diff --git a/examples/js/controls/DragControls.js b/examples/js/controls/DragControls.js index 6ea844aa8d5c5b..26cb43895746a4 100644 --- a/examples/js/controls/DragControls.js +++ b/examples/js/controls/DragControls.js @@ -6,13 +6,6 @@ THREE.DragControls = function ( _objects, _camera, _domElement ) { - if ( _objects instanceof THREE.Camera ) { - - console.warn( 'THREE.DragControls: Constructor now expects ( objects, camera, domElement )' ); - var temp = _objects; _objects = _camera; _camera = temp; - - } - var _plane = new THREE.Plane(); var _raycaster = new THREE.Raycaster(); @@ -251,35 +244,6 @@ THREE.DragControls = function ( _objects, _camera, _domElement ) { this.deactivate = deactivate; this.dispose = dispose; - // Backward compatibility - - this.setObjects = function () { - - console.error( 'THREE.DragControls: setObjects() has been removed.' ); - - }; - - this.on = function ( type, listener ) { - - console.warn( 'THREE.DragControls: on() has been deprecated. Use addEventListener() instead.' ); - scope.addEventListener( type, listener ); - - }; - - this.off = function ( type, listener ) { - - console.warn( 'THREE.DragControls: off() has been deprecated. Use removeEventListener() instead.' ); - scope.removeEventListener( type, listener ); - - }; - - this.notify = function ( type ) { - - console.error( 'THREE.DragControls: notify() has been deprecated. Use dispatchEvent() instead.' ); - scope.dispatchEvent( { type: type } ); - - }; - }; THREE.DragControls.prototype = Object.create( THREE.EventDispatcher.prototype ); diff --git a/examples/jsm/controls/DragControls.js b/examples/jsm/controls/DragControls.js index f59f24082984e1..10cf9ada958c56 100644 --- a/examples/jsm/controls/DragControls.js +++ b/examples/jsm/controls/DragControls.js @@ -5,7 +5,6 @@ */ import { - Camera, EventDispatcher, Matrix4, Plane, @@ -16,13 +15,6 @@ import { var DragControls = function ( _objects, _camera, _domElement ) { - if ( _objects instanceof Camera ) { - - console.warn( 'THREE.DragControls: Constructor now expects ( objects, camera, domElement )' ); - var temp = _objects; _objects = _camera; _camera = temp; - - } - var _plane = new Plane(); var _raycaster = new Raycaster(); @@ -261,35 +253,6 @@ var DragControls = function ( _objects, _camera, _domElement ) { this.deactivate = deactivate; this.dispose = dispose; - // Backward compatibility - - this.setObjects = function () { - - console.error( 'THREE.DragControls: setObjects() has been removed.' ); - - }; - - this.on = function ( type, listener ) { - - console.warn( 'THREE.DragControls: on() has been deprecated. Use addEventListener() instead.' ); - scope.addEventListener( type, listener ); - - }; - - this.off = function ( type, listener ) { - - console.warn( 'THREE.DragControls: off() has been deprecated. Use removeEventListener() instead.' ); - scope.removeEventListener( type, listener ); - - }; - - this.notify = function ( type ) { - - console.error( 'THREE.DragControls: notify() has been deprecated. Use dispatchEvent() instead.' ); - scope.dispatchEvent( { type: type } ); - - }; - }; DragControls.prototype = Object.create( EventDispatcher.prototype ); From 2171430a306b296fbf8921c50963ec4f467a88b0 Mon Sep 17 00:00:00 2001 From: "Mr.doob" Date: Tue, 3 Sep 2019 14:59:57 -0700 Subject: [PATCH 40/75] Updated package-lock.json. --- package-lock.json | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/package-lock.json b/package-lock.json index bca3781093b544..8f208017354e5a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "three", - "version": "0.107.0", + "version": "0.108.0", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -1348,7 +1348,7 @@ }, "mkdirp": { "version": "0.5.1", - "resolved": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", "dev": true, "requires": { @@ -1487,7 +1487,7 @@ }, "os-tmpdir": { "version": "1.0.2", - "resolved": "http://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", "dev": true }, @@ -1560,7 +1560,7 @@ }, "path-is-absolute": { "version": "1.0.1", - "resolved": "http://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "dev": true }, @@ -1959,7 +1959,7 @@ "spdx-expression-parse": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.0.tgz", - "integrity": "sha1-meEZt6XaAOBUkcn6M4t5BII7QdA=", + "integrity": "sha512-Yg6D3XpRD4kkOmTpdgbUiEJFKghJH03fiC1OPll5h/0sO6neh2jqRDVHOQ4o/LMea0tgCkbMgea5ip/e+MkWyg==", "dev": true, "requires": { "spdx-exceptions": "^2.1.0", @@ -2089,7 +2089,7 @@ }, "through": { "version": "2.3.8", - "resolved": "http://registry.npmjs.org/through/-/through-2.3.8.tgz", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", "dev": true }, @@ -2264,7 +2264,7 @@ }, "wrap-ansi": { "version": "2.1.0", - "resolved": "http://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", "dev": true, "requires": { From e68904fc3813e07e4b57490914575b4d5d9b8531 Mon Sep 17 00:00:00 2001 From: "Mr.doob" Date: Tue, 3 Sep 2019 15:35:43 -0700 Subject: [PATCH 41/75] Rollup: Tweaked Buble transforms. --- rollup.config.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/rollup.config.js b/rollup.config.js index 051942dabaf647..dc1249ed069fd4 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -201,14 +201,19 @@ export default [ plugins: [ glconstants(), glsl(), - buble() + buble( { + transforms: { + arrow: false, + classes: true + } + } ) ], output: [ { format: 'umd', name: 'THREE', file: 'build/three.js', - indent: '\t', + indent: '\t' } ] }, From 5577a7f005e34d1609c2eb58b29a6d66f4e26691 Mon Sep 17 00:00:00 2001 From: "Mr.doob" Date: Tue, 3 Sep 2019 15:40:17 -0700 Subject: [PATCH 42/75] Updated builds. --- build/three.js | 1677 +++++++++++++++++++++-------------------- build/three.min.js | 1374 ++++++++++++++++----------------- build/three.module.js | 232 +++--- 3 files changed, 1647 insertions(+), 1636 deletions(-) diff --git a/build/three.js b/build/three.js index a3ab1e4b7bcc78..48e648fc828925 100644 --- a/build/three.js +++ b/build/three.js @@ -107,7 +107,7 @@ addEventListener: function ( type, listener ) { - if ( this._listeners === undefined ) this._listeners = {}; + if ( this._listeners === undefined ) { this._listeners = {}; } var listeners = this._listeners; @@ -127,7 +127,7 @@ hasEventListener: function ( type, listener ) { - if ( this._listeners === undefined ) return false; + if ( this._listeners === undefined ) { return false; } var listeners = this._listeners; @@ -137,7 +137,7 @@ removeEventListener: function ( type, listener ) { - if ( this._listeners === undefined ) return; + if ( this._listeners === undefined ) { return; } var listeners = this._listeners; var listenerArray = listeners[ type ]; @@ -158,7 +158,7 @@ dispatchEvent: function ( event ) { - if ( this._listeners === undefined ) return; + if ( this._listeners === undefined ) { return; } var listeners = this._listeners; var listenerArray = listeners[ event.type ]; @@ -421,8 +421,8 @@ smoothstep: function ( x, min, max ) { - if ( x <= min ) return 0; - if ( x >= max ) return 1; + if ( x <= min ) { return 0; } + if ( x >= max ) { return 1; } x = ( x - min ) / ( max - min ); @@ -432,8 +432,8 @@ smootherstep: function ( x, min, max ) { - if ( x <= min ) return 0; - if ( x >= max ) return 1; + if ( x <= min ) { return 0; } + if ( x >= max ) { return 1; } x = ( x - min ) / ( max - min ); @@ -881,7 +881,7 @@ var angle = Math.atan2( this.y, this.x ); - if ( angle < 0 ) angle += 2 * Math.PI; + if ( angle < 0 ) { angle += 2 * Math.PI; } return angle; @@ -935,7 +935,7 @@ fromArray: function ( array, offset ) { - if ( offset === undefined ) offset = 0; + if ( offset === undefined ) { offset = 0; } this.x = array[ offset ]; this.y = array[ offset + 1 ]; @@ -946,8 +946,8 @@ toArray: function ( array, offset ) { - if ( array === undefined ) array = []; - if ( offset === undefined ) offset = 0; + if ( array === undefined ) { array = []; } + if ( offset === undefined ) { offset = 0; } array[ offset ] = this.x; array[ offset + 1 ] = this.y; @@ -1252,7 +1252,7 @@ } - if ( update !== false ) this._onChangeCallback(); + if ( update !== false ) { this._onChangeCallback(); } return this; @@ -1389,7 +1389,7 @@ var angle = this.angleTo( q ); - if ( angle === 0 ) return this; + if ( angle === 0 ) { return this; } var t = Math.min( 1, step / angle ); @@ -1504,8 +1504,8 @@ slerp: function ( qb, t ) { - if ( t === 0 ) return this; - if ( t === 1 ) return this.copy( qb ); + if ( t === 0 ) { return this; } + if ( t === 1 ) { return this.copy( qb ); } var x = this._x, y = this._y, z = this._z, w = this._w; @@ -1580,7 +1580,7 @@ fromArray: function ( array, offset ) { - if ( offset === undefined ) offset = 0; + if ( offset === undefined ) { offset = 0; } this._x = array[ offset ]; this._y = array[ offset + 1 ]; @@ -1595,8 +1595,8 @@ toArray: function ( array, offset ) { - if ( array === undefined ) array = []; - if ( offset === undefined ) offset = 0; + if ( array === undefined ) { array = []; } + if ( offset === undefined ) { offset = 0; } array[ offset ] = this._x; array[ offset + 1 ] = this._y; @@ -2273,7 +2273,7 @@ fromArray: function ( array, offset ) { - if ( offset === undefined ) offset = 0; + if ( offset === undefined ) { offset = 0; } this.x = array[ offset ]; this.y = array[ offset + 1 ]; @@ -2285,8 +2285,8 @@ toArray: function ( array, offset ) { - if ( array === undefined ) array = []; - if ( offset === undefined ) offset = 0; + if ( array === undefined ) { array = []; } + if ( offset === undefined ) { offset = 0; } array[ offset ] = this.x; array[ offset + 1 ] = this.y; @@ -2647,7 +2647,7 @@ for ( var i = 0; i < 9; i ++ ) { - if ( te[ i ] !== me[ i ] ) return false; + if ( te[ i ] !== me[ i ] ) { return false; } } @@ -2657,7 +2657,7 @@ fromArray: function ( array, offset ) { - if ( offset === undefined ) offset = 0; + if ( offset === undefined ) { offset = 0; } for ( var i = 0; i < 9; i ++ ) { @@ -2671,8 +2671,8 @@ toArray: function ( array, offset ) { - if ( array === undefined ) array = []; - if ( offset === undefined ) offset = 0; + if ( array === undefined ) { array = []; } + if ( offset === undefined ) { offset = 0; } var te = this.elements; @@ -2718,7 +2718,7 @@ } else { - if ( _canvas === undefined ) _canvas = document.createElementNS( 'http://www.w3.org/1999/xhtml', 'canvas' ); + if ( _canvas === undefined ) { _canvas = document.createElementNS( 'http://www.w3.org/1999/xhtml', 'canvas' ); } _canvas.width = image.width; _canvas.height = image.height; @@ -2978,7 +2978,7 @@ transformUv: function ( uv ) { - if ( this.mapping !== UVMapping ) return uv; + if ( this.mapping !== UVMapping ) { return uv; } uv.applyMatrix3( this.matrix ); @@ -3060,7 +3060,7 @@ set: function ( value ) { - if ( value === true ) this.version ++; + if ( value === true ) { this.version ++; } } @@ -3490,7 +3490,7 @@ ( m13 - m31 ) * ( m13 - m31 ) + ( m21 - m12 ) * ( m21 - m12 ) ); // used to normalize - if ( Math.abs( s ) < 0.001 ) s = 1; + if ( Math.abs( s ) < 0.001 ) { s = 1; } // prevent divide by zero, should not happen if matrix is orthogonal and should be // caught by singularity test above, but I've left it in just in case @@ -3674,7 +3674,7 @@ fromArray: function ( array, offset ) { - if ( offset === undefined ) offset = 0; + if ( offset === undefined ) { offset = 0; } this.x = array[ offset ]; this.y = array[ offset + 1 ]; @@ -3687,8 +3687,8 @@ toArray: function ( array, offset ) { - if ( array === undefined ) array = []; - if ( offset === undefined ) offset = 0; + if ( array === undefined ) { array = []; } + if ( offset === undefined ) { offset = 0; } array[ offset ] = this.x; array[ offset + 1 ] = this.y; @@ -4618,7 +4618,7 @@ // if determine is negative, we need to invert one scale var det = this.determinant(); - if ( det < 0 ) sx = - sx; + if ( det < 0 ) { sx = - sx; } position.x = te[ 12 ]; position.y = te[ 13 ]; @@ -4706,7 +4706,7 @@ for ( var i = 0; i < 16; i ++ ) { - if ( te[ i ] !== me[ i ] ) return false; + if ( te[ i ] !== me[ i ] ) { return false; } } @@ -4716,7 +4716,7 @@ fromArray: function ( array, offset ) { - if ( offset === undefined ) offset = 0; + if ( offset === undefined ) { offset = 0; } for ( var i = 0; i < 16; i ++ ) { @@ -4730,8 +4730,8 @@ toArray: function ( array, offset ) { - if ( array === undefined ) array = []; - if ( offset === undefined ) offset = 0; + if ( array === undefined ) { array = []; } + if ( offset === undefined ) { offset = 0; } var te = this.elements; @@ -5008,7 +5008,7 @@ this._order = order; - if ( update !== false ) this._onChangeCallback(); + if ( update !== false ) { this._onChangeCallback(); } return this; @@ -5049,7 +5049,7 @@ this._x = array[ 0 ]; this._y = array[ 1 ]; this._z = array[ 2 ]; - if ( array[ 3 ] !== undefined ) this._order = array[ 3 ]; + if ( array[ 3 ] !== undefined ) { this._order = array[ 3 ]; } this._onChangeCallback(); @@ -5059,8 +5059,8 @@ toArray: function ( array, offset ) { - if ( array === undefined ) array = []; - if ( offset === undefined ) offset = 0; + if ( array === undefined ) { array = []; } + if ( offset === undefined ) { offset = 0; } array[ offset ] = this._x; array[ offset + 1 ] = this._y; @@ -5275,7 +5275,7 @@ applyMatrix: function ( matrix ) { - if ( this.matrixAutoUpdate ) this.updateMatrix(); + if ( this.matrixAutoUpdate ) { this.updateMatrix(); } this.matrix.premultiply( matrix ); @@ -5564,7 +5564,7 @@ getObjectByProperty: function ( name, value ) { - if ( this[ name ] === value ) return this; + if ( this[ name ] === value ) { return this; } for ( var i = 0, l = this.children.length; i < l; i ++ ) { @@ -5667,7 +5667,7 @@ traverseVisible: function ( callback ) { - if ( this.visible === false ) return; + if ( this.visible === false ) { return; } callback( this ); @@ -5705,7 +5705,7 @@ updateMatrixWorld: function ( force ) { - if ( this.matrixAutoUpdate ) this.updateMatrix(); + if ( this.matrixAutoUpdate ) { this.updateMatrix(); } if ( this.matrixWorldNeedsUpdate || force ) { @@ -5747,7 +5747,7 @@ } - if ( this.matrixAutoUpdate ) this.updateMatrix(); + if ( this.matrixAutoUpdate ) { this.updateMatrix(); } if ( this.parent === null ) { @@ -5811,22 +5811,22 @@ object.uuid = this.uuid; object.type = this.type; - if ( this.name !== '' ) object.name = this.name; - if ( this.castShadow === true ) object.castShadow = true; - if ( this.receiveShadow === true ) object.receiveShadow = true; - if ( this.visible === false ) object.visible = false; - if ( this.frustumCulled === false ) object.frustumCulled = false; - if ( this.renderOrder !== 0 ) object.renderOrder = this.renderOrder; - if ( JSON.stringify( this.userData ) !== '{}' ) object.userData = this.userData; + if ( this.name !== '' ) { object.name = this.name; } + if ( this.castShadow === true ) { object.castShadow = true; } + if ( this.receiveShadow === true ) { object.receiveShadow = true; } + if ( this.visible === false ) { object.visible = false; } + if ( this.frustumCulled === false ) { object.frustumCulled = false; } + if ( this.renderOrder !== 0 ) { object.renderOrder = this.renderOrder; } + if ( JSON.stringify( this.userData ) !== '{}' ) { object.userData = this.userData; } object.layers = this.layers.mask; object.matrix = this.matrix.toArray(); - if ( this.matrixAutoUpdate === false ) object.matrixAutoUpdate = false; + if ( this.matrixAutoUpdate === false ) { object.matrixAutoUpdate = false; } // object specific properties - if ( this.isMesh && this.drawMode !== TrianglesDrawMode ) object.drawMode = this.drawMode; + if ( this.isMesh && this.drawMode !== TrianglesDrawMode ) { object.drawMode = this.drawMode; } // @@ -5916,11 +5916,11 @@ var images = extractFromCache( meta.images ); var shapes = extractFromCache( meta.shapes ); - if ( geometries.length > 0 ) output.geometries = geometries; - if ( materials.length > 0 ) output.materials = materials; - if ( textures.length > 0 ) output.textures = textures; - if ( images.length > 0 ) output.images = images; - if ( shapes.length > 0 ) output.shapes = shapes; + if ( geometries.length > 0 ) { output.geometries = geometries; } + if ( materials.length > 0 ) { output.materials = materials; } + if ( textures.length > 0 ) { output.textures = textures; } + if ( images.length > 0 ) { output.images = images; } + if ( shapes.length > 0 ) { output.shapes = shapes; } } @@ -5955,7 +5955,7 @@ copy: function ( source, recursive ) { - if ( recursive === undefined ) recursive = true; + if ( recursive === undefined ) { recursive = true; } this.name = source.name; @@ -6033,9 +6033,9 @@ Object3D.prototype.copy.call( this, source, recursive ); - if ( source.background !== null ) this.background = source.background.clone(); - if ( source.fog !== null ) this.fog = source.fog.clone(); - if ( source.overrideMaterial !== null ) this.overrideMaterial = source.overrideMaterial.clone(); + if ( source.background !== null ) { this.background = source.background.clone(); } + if ( source.fog !== null ) { this.fog = source.fog.clone(); } + if ( source.overrideMaterial !== null ) { this.overrideMaterial = source.overrideMaterial.clone(); } this.autoUpdate = source.autoUpdate; this.matrixAutoUpdate = source.matrixAutoUpdate; @@ -6048,8 +6048,8 @@ var data = Object3D.prototype.toJSON.call( this, meta ); - if ( this.background !== null ) data.object.background = this.background.toJSON( meta ); - if ( this.fog !== null ) data.object.fog = this.fog.toJSON(); + if ( this.background !== null ) { data.object.background = this.background.toJSON( meta ); } + if ( this.fog !== null ) { data.object.fog = this.fog.toJSON(); } return data; @@ -6133,13 +6133,13 @@ var y = array[ i + 1 ]; var z = array[ i + 2 ]; - if ( x < minX ) minX = x; - if ( y < minY ) minY = y; - if ( z < minZ ) minZ = z; + if ( x < minX ) { minX = x; } + if ( y < minY ) { minY = y; } + if ( z < minZ ) { minZ = z; } - if ( x > maxX ) maxX = x; - if ( y > maxY ) maxY = y; - if ( z > maxZ ) maxZ = z; + if ( x > maxX ) { maxX = x; } + if ( y > maxY ) { maxY = y; } + if ( z > maxZ ) { maxZ = z; } } @@ -6166,13 +6166,13 @@ var y = attribute.getY( i ); var z = attribute.getZ( i ); - if ( x < minX ) minX = x; - if ( y < minY ) minY = y; - if ( z < minZ ) minZ = z; + if ( x < minX ) { minX = x; } + if ( y < minY ) { minY = y; } + if ( z < minZ ) { minZ = z; } - if ( x > maxX ) maxX = x; - if ( y > maxY ) maxY = y; - if ( z > maxZ ) maxZ = z; + if ( x > maxX ) { maxX = x; } + if ( y > maxY ) { maxY = y; } + if ( z > maxZ ) { maxZ = z; } } @@ -6560,7 +6560,7 @@ this.max.min( box.max ); // ensure that if there is no overlap, the result is fully empty, not slightly empty with non-inf/+inf values that will cause subsequence intersects to erroneously return valid values. - if ( this.isEmpty() ) this.makeEmpty(); + if ( this.isEmpty() ) { this.makeEmpty(); } return this; @@ -6578,7 +6578,7 @@ applyMatrix4: function ( matrix ) { // transform of empty box is an empty box. - if ( this.isEmpty() ) return this; + if ( this.isEmpty() ) { return this; } // NOTE: I am using a binary pattern to specify all 2^3 combinations below _points[ 0 ].set( this.min.x, this.min.y, this.min.z ).applyMatrix4( matrix ); // 000 @@ -7060,7 +7060,7 @@ var d2 = _vector$3.dot( _vector$3 ) - tca * tca; var radius2 = sphere.radius * sphere.radius; - if ( d2 > radius2 ) return null; + if ( d2 > radius2 ) { return null; } var thc = Math.sqrt( radius2 - d2 ); @@ -7071,12 +7071,12 @@ var t1 = tca + thc; // test to see if both t0 and t1 are behind the ray - if so, return null - if ( t0 < 0 && t1 < 0 ) return null; + if ( t0 < 0 && t1 < 0 ) { return null; } // test to see if t0 is behind the ray: // if it is, the ray is inside the sphere, so return the second exit point scaled by t1, // in order to always return an intersect point that is in front of the ray. - if ( t0 < 0 ) return this.at( t1, target ); + if ( t0 < 0 ) { return this.at( t1, target ); } // else t0 is in front of the ray, so return the first collision point scaled by t0 return this.at( t0, target ); @@ -7190,14 +7190,14 @@ } - if ( ( tmin > tymax ) || ( tymin > tmax ) ) return null; + if ( ( tmin > tymax ) || ( tymin > tmax ) ) { return null; } // These lines also handle the case where tmin or tmax is NaN // (result of 0 * Infinity). x !== x returns true if x is NaN - if ( tymin > tmin || tmin !== tmin ) tmin = tymin; + if ( tymin > tmin || tmin !== tmin ) { tmin = tymin; } - if ( tymax < tmax || tmax !== tmax ) tmax = tymax; + if ( tymax < tmax || tmax !== tmax ) { tmax = tymax; } if ( invdirz >= 0 ) { @@ -7211,15 +7211,15 @@ } - if ( ( tmin > tzmax ) || ( tzmin > tmax ) ) return null; + if ( ( tmin > tzmax ) || ( tzmin > tmax ) ) { return null; } - if ( tzmin > tmin || tmin !== tmin ) tmin = tzmin; + if ( tzmin > tmin || tmin !== tmin ) { tmin = tzmin; } - if ( tzmax < tmax || tmax !== tmax ) tmax = tzmax; + if ( tzmax < tmax || tmax !== tmax ) { tmax = tzmax; } //return point closest to the ray (positive side) - if ( tmax < 0 ) return null; + if ( tmax < 0 ) { return null; } return this.at( tmin >= 0 ? tmin : tmax, target ); @@ -7251,7 +7251,7 @@ if ( DdN > 0 ) { - if ( backfaceCulling ) return null; + if ( backfaceCulling ) { return null; } sign = 1; } else if ( DdN < 0 ) { @@ -7700,11 +7700,11 @@ function hue2rgb( p, q, t ) { - if ( t < 0 ) t += 1; - if ( t > 1 ) t -= 1; - if ( t < 1 / 6 ) return p + ( q - p ) * 6 * t; - if ( t < 1 / 2 ) return q; - if ( t < 2 / 3 ) return p + ( q - p ) * 6 * ( 2 / 3 - t ); + if ( t < 0 ) { t += 1; } + if ( t > 1 ) { t -= 1; } + if ( t < 1 / 6 ) { return p + ( q - p ) * 6 * t; } + if ( t < 1 / 2 ) { return q; } + if ( t < 2 / 3 ) { return p + ( q - p ) * 6 * ( 2 / 3 - t ); } return p; } @@ -7809,7 +7809,7 @@ function handleAlpha( string ) { - if ( string === undefined ) return; + if ( string === undefined ) { return; } if ( parseFloat( string ) < 1 ) { @@ -7953,7 +7953,7 @@ copyGammaToLinear: function ( color, gammaFactor ) { - if ( gammaFactor === undefined ) gammaFactor = 2.0; + if ( gammaFactor === undefined ) { gammaFactor = 2.0; } this.r = Math.pow( color.r, gammaFactor ); this.g = Math.pow( color.g, gammaFactor ); @@ -7965,7 +7965,7 @@ copyLinearToGamma: function ( color, gammaFactor ) { - if ( gammaFactor === undefined ) gammaFactor = 2.0; + if ( gammaFactor === undefined ) { gammaFactor = 2.0; } var safeInverse = ( gammaFactor > 0 ) ? ( 1.0 / gammaFactor ) : 1.0; @@ -8202,7 +8202,7 @@ fromArray: function ( array, offset ) { - if ( offset === undefined ) offset = 0; + if ( offset === undefined ) { offset = 0; } this.r = array[ offset ]; this.g = array[ offset + 1 ]; @@ -8214,8 +8214,8 @@ toArray: function ( array, offset ) { - if ( array === undefined ) array = []; - if ( offset === undefined ) offset = 0; + if ( array === undefined ) { array = []; } + if ( offset === undefined ) { offset = 0; } array[ offset ] = this.r; array[ offset + 1 ] = this.g; @@ -8377,7 +8377,7 @@ setValues: function ( values ) { - if ( values === undefined ) return; + if ( values === undefined ) { return; } for ( var key in values ) { @@ -8451,20 +8451,20 @@ data.uuid = this.uuid; data.type = this.type; - if ( this.name !== '' ) data.name = this.name; + if ( this.name !== '' ) { data.name = this.name; } - if ( this.color && this.color.isColor ) data.color = this.color.getHex(); + if ( this.color && this.color.isColor ) { data.color = this.color.getHex(); } - if ( this.roughness !== undefined ) data.roughness = this.roughness; - if ( this.metalness !== undefined ) data.metalness = this.metalness; + if ( this.roughness !== undefined ) { data.roughness = this.roughness; } + if ( this.metalness !== undefined ) { data.metalness = this.metalness; } - if ( this.emissive && this.emissive.isColor ) data.emissive = this.emissive.getHex(); - if ( this.emissiveIntensity && this.emissiveIntensity !== 1 ) data.emissiveIntensity = this.emissiveIntensity; + if ( this.emissive && this.emissive.isColor ) { data.emissive = this.emissive.getHex(); } + if ( this.emissiveIntensity && this.emissiveIntensity !== 1 ) { data.emissiveIntensity = this.emissiveIntensity; } - if ( this.specular && this.specular.isColor ) data.specular = this.specular.getHex(); - if ( this.shininess !== undefined ) data.shininess = this.shininess; - if ( this.clearcoat !== undefined ) data.clearcoat = this.clearcoat; - if ( this.clearcoatRoughness !== undefined ) data.clearcoatRoughness = this.clearcoatRoughness; + if ( this.specular && this.specular.isColor ) { data.specular = this.specular.getHex(); } + if ( this.shininess !== undefined ) { data.shininess = this.shininess; } + if ( this.clearcoat !== undefined ) { data.clearcoat = this.clearcoat; } + if ( this.clearcoatRoughness !== undefined ) { data.clearcoatRoughness = this.clearcoatRoughness; } if ( this.clearcoatNormalMap && this.clearcoatNormalMap.isTexture ) { @@ -8473,10 +8473,10 @@ } - if ( this.map && this.map.isTexture ) data.map = this.map.toJSON( meta ).uuid; - if ( this.matcap && this.matcap.isTexture ) data.matcap = this.matcap.toJSON( meta ).uuid; - if ( this.alphaMap && this.alphaMap.isTexture ) data.alphaMap = this.alphaMap.toJSON( meta ).uuid; - if ( this.lightMap && this.lightMap.isTexture ) data.lightMap = this.lightMap.toJSON( meta ).uuid; + if ( this.map && this.map.isTexture ) { data.map = this.map.toJSON( meta ).uuid; } + if ( this.matcap && this.matcap.isTexture ) { data.matcap = this.matcap.toJSON( meta ).uuid; } + if ( this.alphaMap && this.alphaMap.isTexture ) { data.alphaMap = this.alphaMap.toJSON( meta ).uuid; } + if ( this.lightMap && this.lightMap.isTexture ) { data.lightMap = this.lightMap.toJSON( meta ).uuid; } if ( this.aoMap && this.aoMap.isTexture ) { @@ -8508,11 +8508,11 @@ } - if ( this.roughnessMap && this.roughnessMap.isTexture ) data.roughnessMap = this.roughnessMap.toJSON( meta ).uuid; - if ( this.metalnessMap && this.metalnessMap.isTexture ) data.metalnessMap = this.metalnessMap.toJSON( meta ).uuid; + if ( this.roughnessMap && this.roughnessMap.isTexture ) { data.roughnessMap = this.roughnessMap.toJSON( meta ).uuid; } + if ( this.metalnessMap && this.metalnessMap.isTexture ) { data.metalnessMap = this.metalnessMap.toJSON( meta ).uuid; } - if ( this.emissiveMap && this.emissiveMap.isTexture ) data.emissiveMap = this.emissiveMap.toJSON( meta ).uuid; - if ( this.specularMap && this.specularMap.isTexture ) data.specularMap = this.specularMap.toJSON( meta ).uuid; + if ( this.emissiveMap && this.emissiveMap.isTexture ) { data.emissiveMap = this.emissiveMap.toJSON( meta ).uuid; } + if ( this.specularMap && this.specularMap.isTexture ) { data.specularMap = this.specularMap.toJSON( meta ).uuid; } if ( this.envMap && this.envMap.isTexture ) { @@ -8520,8 +8520,8 @@ data.reflectivity = this.reflectivity; // Scale behind envMap data.refractionRatio = this.refractionRatio; - if ( this.combine !== undefined ) data.combine = this.combine; - if ( this.envMapIntensity !== undefined ) data.envMapIntensity = this.envMapIntensity; + if ( this.combine !== undefined ) { data.combine = this.combine; } + if ( this.envMapIntensity !== undefined ) { data.envMapIntensity = this.envMapIntensity; } } @@ -8531,16 +8531,16 @@ } - if ( this.size !== undefined ) data.size = this.size; - if ( this.sizeAttenuation !== undefined ) data.sizeAttenuation = this.sizeAttenuation; + if ( this.size !== undefined ) { data.size = this.size; } + if ( this.sizeAttenuation !== undefined ) { data.sizeAttenuation = this.sizeAttenuation; } - if ( this.blending !== NormalBlending ) data.blending = this.blending; - if ( this.flatShading === true ) data.flatShading = this.flatShading; - if ( this.side !== FrontSide ) data.side = this.side; - if ( this.vertexColors !== NoColors ) data.vertexColors = this.vertexColors; + if ( this.blending !== NormalBlending ) { data.blending = this.blending; } + if ( this.flatShading === true ) { data.flatShading = this.flatShading; } + if ( this.side !== FrontSide ) { data.side = this.side; } + if ( this.vertexColors !== NoColors ) { data.vertexColors = this.vertexColors; } - if ( this.opacity < 1 ) data.opacity = this.opacity; - if ( this.transparent === true ) data.transparent = this.transparent; + if ( this.opacity < 1 ) { data.opacity = this.opacity; } + if ( this.transparent === true ) { data.transparent = this.transparent; } data.depthFunc = this.depthFunc; data.depthTest = this.depthTest; @@ -8555,36 +8555,36 @@ data.stencilZPass = this.stencilZPass; // rotation (SpriteMaterial) - if ( this.rotation && this.rotation !== 0 ) data.rotation = this.rotation; + if ( this.rotation && this.rotation !== 0 ) { data.rotation = this.rotation; } - if ( this.polygonOffset === true ) data.polygonOffset = true; - if ( this.polygonOffsetFactor !== 0 ) data.polygonOffsetFactor = this.polygonOffsetFactor; - if ( this.polygonOffsetUnits !== 0 ) data.polygonOffsetUnits = this.polygonOffsetUnits; + if ( this.polygonOffset === true ) { data.polygonOffset = true; } + if ( this.polygonOffsetFactor !== 0 ) { data.polygonOffsetFactor = this.polygonOffsetFactor; } + if ( this.polygonOffsetUnits !== 0 ) { data.polygonOffsetUnits = this.polygonOffsetUnits; } - if ( this.linewidth && this.linewidth !== 1 ) data.linewidth = this.linewidth; - if ( this.dashSize !== undefined ) data.dashSize = this.dashSize; - if ( this.gapSize !== undefined ) data.gapSize = this.gapSize; - if ( this.scale !== undefined ) data.scale = this.scale; + if ( this.linewidth && this.linewidth !== 1 ) { data.linewidth = this.linewidth; } + if ( this.dashSize !== undefined ) { data.dashSize = this.dashSize; } + if ( this.gapSize !== undefined ) { data.gapSize = this.gapSize; } + if ( this.scale !== undefined ) { data.scale = this.scale; } - if ( this.dithering === true ) data.dithering = true; + if ( this.dithering === true ) { data.dithering = true; } - if ( this.alphaTest > 0 ) data.alphaTest = this.alphaTest; - if ( this.premultipliedAlpha === true ) data.premultipliedAlpha = this.premultipliedAlpha; + if ( this.alphaTest > 0 ) { data.alphaTest = this.alphaTest; } + if ( this.premultipliedAlpha === true ) { data.premultipliedAlpha = this.premultipliedAlpha; } - if ( this.wireframe === true ) data.wireframe = this.wireframe; - if ( this.wireframeLinewidth > 1 ) data.wireframeLinewidth = this.wireframeLinewidth; - if ( this.wireframeLinecap !== 'round' ) data.wireframeLinecap = this.wireframeLinecap; - if ( this.wireframeLinejoin !== 'round' ) data.wireframeLinejoin = this.wireframeLinejoin; + if ( this.wireframe === true ) { data.wireframe = this.wireframe; } + if ( this.wireframeLinewidth > 1 ) { data.wireframeLinewidth = this.wireframeLinewidth; } + if ( this.wireframeLinecap !== 'round' ) { data.wireframeLinecap = this.wireframeLinecap; } + if ( this.wireframeLinejoin !== 'round' ) { data.wireframeLinejoin = this.wireframeLinejoin; } - if ( this.morphTargets === true ) data.morphTargets = true; - if ( this.morphNormals === true ) data.morphNormals = true; - if ( this.skinning === true ) data.skinning = true; + if ( this.morphTargets === true ) { data.morphTargets = true; } + if ( this.morphNormals === true ) { data.morphNormals = true; } + if ( this.skinning === true ) { data.skinning = true; } - if ( this.visible === false ) data.visible = false; + if ( this.visible === false ) { data.visible = false; } - if ( this.toneMapped === false ) data.toneMapped = false; + if ( this.toneMapped === false ) { data.toneMapped = false; } - if ( JSON.stringify( this.userData ) !== '{}' ) data.userData = this.userData; + if ( JSON.stringify( this.userData ) !== '{}' ) { data.userData = this.userData; } // TODO: Copied from Object3D.toJSON @@ -8609,8 +8609,8 @@ var textures = extractFromCache( meta.textures ); var images = extractFromCache( meta.images ); - if ( textures.length > 0 ) data.textures = textures; - if ( images.length > 0 ) data.images = images; + if ( textures.length > 0 ) { data.textures = textures; } + if ( images.length > 0 ) { data.images = images; } } @@ -8689,7 +8689,7 @@ dstPlanes = new Array( n ); for ( var i = 0; i !== n; ++ i ) - dstPlanes[ i ] = srcPlanes[ i ].clone(); + { dstPlanes[ i ] = srcPlanes[ i ].clone(); } } @@ -8853,7 +8853,7 @@ set: function ( value ) { - if ( value === true ) this.version ++; + if ( value === true ) { this.version ++; } } @@ -9027,7 +9027,7 @@ set: function ( value, offset ) { - if ( offset === undefined ) offset = 0; + if ( offset === undefined ) { offset = 0; } this.array.set( value, offset ); @@ -9533,13 +9533,13 @@ function arrayMax( array ) { - if ( array.length === 0 ) return - Infinity; + if ( array.length === 0 ) { return - Infinity; } var max = array[ 0 ]; for ( var i = 1, l = array.length; i < l; ++ i ) { - if ( array[ i ] > max ) max = array[ i ]; + if ( array[ i ] > max ) { max = array[ i ]; } } @@ -10365,7 +10365,7 @@ for ( var key in attributes ) { - if ( geometry.attributes[ key ] === undefined ) continue; + if ( geometry.attributes[ key ] === undefined ) { continue; } var attribute1 = attributes[ key ]; var attributeArray1 = attribute1.array; @@ -10511,8 +10511,8 @@ data.uuid = this.uuid; data.type = this.type; - if ( this.name !== '' ) data.name = this.name; - if ( Object.keys( this.userData ).length > 0 ) data.userData = this.userData; + if ( this.name !== '' ) { data.name = this.name; } + if ( Object.keys( this.userData ).length > 0 ) { data.userData = this.userData; } if ( this.parameters !== undefined ) { @@ -10520,7 +10520,7 @@ for ( var key in parameters ) { - if ( parameters[ key ] !== undefined ) data[ key ] = parameters[ key ]; + if ( parameters[ key ] !== undefined ) { data[ key ] = parameters[ key ]; } } @@ -10549,7 +10549,7 @@ var attributeData = attribute.toJSON(); - if ( attribute.name !== '' ) attributeData.name = attribute.name; + if ( attribute.name !== '' ) { attributeData.name = attribute.name; } data.data.attributes[ key ] = attributeData; @@ -10570,7 +10570,7 @@ var attributeData = attribute.toJSON(); - if ( attribute.name !== '' ) attributeData.name = attribute.name; + if ( attribute.name !== '' ) { attributeData.name = attribute.name; } array.push( attributeData ); @@ -10586,7 +10586,7 @@ } - if ( hasMorphAttributes ) data.data.morphAttributes = morphAttributes; + if ( hasMorphAttributes ) { data.data.morphAttributes = morphAttributes; } var groups = this.groups; @@ -10881,16 +10881,16 @@ var material = this.material; var matrixWorld = this.matrixWorld; - if ( material === undefined ) return; + if ( material === undefined ) { return; } // Checking boundingSphere distance to ray - if ( geometry.boundingSphere === null ) geometry.computeBoundingSphere(); + if ( geometry.boundingSphere === null ) { geometry.computeBoundingSphere(); } _sphere.copy( geometry.boundingSphere ); _sphere.applyMatrix4( matrixWorld ); - if ( raycaster.ray.intersectsSphere( _sphere ) === false ) return; + if ( raycaster.ray.intersectsSphere( _sphere ) === false ) { return; } // @@ -10901,7 +10901,7 @@ if ( geometry.boundingBox !== null ) { - if ( _ray.intersectsBox( geometry.boundingBox ) === false ) return; + if ( _ray.intersectsBox( geometry.boundingBox ) === false ) { return; } } @@ -11049,14 +11049,14 @@ var uvs; var faceVertexUvs = geometry.faceVertexUvs[ 0 ]; - if ( faceVertexUvs.length > 0 ) uvs = faceVertexUvs; + if ( faceVertexUvs.length > 0 ) { uvs = faceVertexUvs; } for ( var f = 0, fl = faces.length; f < fl; f ++ ) { var face = faces[ f ]; var faceMaterial = isMultiMaterial ? material[ face.materialIndex ] : material; - if ( faceMaterial === undefined ) continue; + if ( faceMaterial === undefined ) { continue; } fvA = vertices[ face.a ]; fvB = vertices[ face.b ]; @@ -11111,14 +11111,14 @@ } - if ( intersect === null ) return null; + if ( intersect === null ) { return null; } _intersectionPointWorld.copy( point ); _intersectionPointWorld.applyMatrix4( object.matrixWorld ); var distance = raycaster.ray.origin.distanceTo( _intersectionPointWorld ); - if ( distance < raycaster.near || distance > raycaster.far ) return null; + if ( distance < raycaster.near || distance > raycaster.far ) { return null; } return { distance: distance, @@ -11147,7 +11147,7 @@ var influence = morphInfluences[ i ]; var morphAttribute = morphPosition[ i ]; - if ( influence === 0 ) continue; + if ( influence === 0 ) { continue; } _tempA.fromBufferAttribute( morphAttribute, a ); _tempB.fromBufferAttribute( morphAttribute, b ); @@ -11385,7 +11385,7 @@ var uvs = attributes.uv !== undefined ? attributes.uv.array : undefined; var uvs2 = attributes.uv2 !== undefined ? attributes.uv2.array : undefined; - if ( uvs2 !== undefined ) this.faceVertexUvs[ 1 ] = []; + if ( uvs2 !== undefined ) { this.faceVertexUvs[ 1 ] = []; } for ( var i = 0; i < positions.length; i += 3 ) { @@ -11566,7 +11566,7 @@ computeVertexNormals: function ( areaWeighted ) { - if ( areaWeighted === undefined ) areaWeighted = true; + if ( areaWeighted === undefined ) { areaWeighted = true; } var v, vl, f, fl, face, vertices; @@ -11714,7 +11714,7 @@ } - if ( ! face.__originalVertexNormals ) face.__originalVertexNormals = []; + if ( ! face.__originalVertexNormals ) { face.__originalVertexNormals = []; } for ( i = 0, il = face.vertexNormals.length; i < il; i ++ ) { @@ -11851,7 +11851,7 @@ colors1 = this.colors, colors2 = geometry.colors; - if ( materialIndexOffset === undefined ) materialIndexOffset = 0; + if ( materialIndexOffset === undefined ) { materialIndexOffset = 0; } if ( matrix !== undefined ) { @@ -11867,7 +11867,7 @@ var vertexCopy = vertex.clone(); - if ( matrix !== undefined ) vertexCopy.applyMatrix4( matrix ); + if ( matrix !== undefined ) { vertexCopy.applyMatrix4( matrix ); } vertices1.push( vertexCopy ); @@ -11933,7 +11933,7 @@ var faceVertexUvs2 = geometry.faceVertexUvs[ i ]; - if ( this.faceVertexUvs[ i ] === undefined ) this.faceVertexUvs[ i ] = []; + if ( this.faceVertexUvs[ i ] === undefined ) { this.faceVertexUvs[ i ] = []; } for ( var j = 0, jl = faceVertexUvs2.length; j < jl; j ++ ) { @@ -11962,7 +11962,7 @@ } - if ( mesh.matrixAutoUpdate ) mesh.updateMatrix(); + if ( mesh.matrixAutoUpdate ) { mesh.updateMatrix(); } this.merge( mesh.geometry, mesh.matrix ); @@ -12102,20 +12102,20 @@ var newUvs1, newUvs2; - if ( uvs1 && uvs1.length === length ) newUvs1 = []; - if ( uvs2 && uvs2.length === length ) newUvs2 = []; + if ( uvs1 && uvs1.length === length ) { newUvs1 = []; } + if ( uvs2 && uvs2.length === length ) { newUvs2 = []; } for ( var i = 0; i < length; i ++ ) { var id = faces[ i ]._id; - if ( newUvs1 ) newUvs1.push( uvs1[ id ] ); - if ( newUvs2 ) newUvs2.push( uvs2[ id ] ); + if ( newUvs1 ) { newUvs1.push( uvs1[ id ] ); } + if ( newUvs2 ) { newUvs2.push( uvs2[ id ] ); } } - if ( newUvs1 ) this.faceVertexUvs[ 0 ] = newUvs1; - if ( newUvs2 ) this.faceVertexUvs[ 1 ] = newUvs2; + if ( newUvs1 ) { this.faceVertexUvs[ 0 ] = newUvs1; } + if ( newUvs2 ) { this.faceVertexUvs[ 1 ] = newUvs2; } }, @@ -12133,7 +12133,7 @@ data.uuid = this.uuid; data.type = this.type; - if ( this.name !== '' ) data.name = this.name; + if ( this.name !== '' ) { data.name = this.name; } if ( this.parameters !== undefined ) { @@ -12141,7 +12141,7 @@ for ( var key in parameters ) { - if ( parameters[ key ] !== undefined ) data[ key ] = parameters[ key ]; + if ( parameters[ key ] !== undefined ) { data[ key ] = parameters[ key ]; } } @@ -12304,8 +12304,8 @@ data.data.vertices = vertices; data.data.normals = normals; - if ( colors.length > 0 ) data.data.colors = colors; - if ( uvs.length > 0 ) data.data.uvs = [ uvs ]; // temporal backward compatibility + if ( colors.length > 0 ) { data.data.colors = colors; } + if ( uvs.length > 0 ) { data.data.uvs = [ uvs ]; } // temporal backward compatibility data.data.faces = faces; return data; @@ -12591,194 +12591,204 @@ // BoxGeometry - function BoxGeometry( width, height, depth, widthSegments, heightSegments, depthSegments ) { + var BoxGeometry = /*@__PURE__*/(function (Geometry) { + function BoxGeometry( width, height, depth, widthSegments, heightSegments, depthSegments ) { - Geometry.call( this ); + Geometry.call(this); - this.type = 'BoxGeometry'; + this.type = 'BoxGeometry'; - this.parameters = { - width: width, - height: height, - depth: depth, - widthSegments: widthSegments, - heightSegments: heightSegments, - depthSegments: depthSegments - }; + this.parameters = { + width: width, + height: height, + depth: depth, + widthSegments: widthSegments, + heightSegments: heightSegments, + depthSegments: depthSegments + }; - this.fromBufferGeometry( new BoxBufferGeometry( width, height, depth, widthSegments, heightSegments, depthSegments ) ); - this.mergeVertices(); + this.fromBufferGeometry( new BoxBufferGeometry( width, height, depth, widthSegments, heightSegments, depthSegments ) ); + this.mergeVertices(); - } + } + + if ( Geometry ) BoxGeometry.__proto__ = Geometry; + BoxGeometry.prototype = Object.create( Geometry && Geometry.prototype ); + BoxGeometry.prototype.constructor = BoxGeometry; - BoxGeometry.prototype = Object.create( Geometry.prototype ); - BoxGeometry.prototype.constructor = BoxGeometry; + return BoxGeometry; + }(Geometry)); // BoxBufferGeometry - function BoxBufferGeometry( width, height, depth, widthSegments, heightSegments, depthSegments ) { + var BoxBufferGeometry = /*@__PURE__*/(function (BufferGeometry) { + function BoxBufferGeometry( width, height, depth, widthSegments, heightSegments, depthSegments ) { - BufferGeometry.call( this ); + BufferGeometry.call(this); - this.type = 'BoxBufferGeometry'; + this.type = 'BoxBufferGeometry'; - this.parameters = { - width: width, - height: height, - depth: depth, - widthSegments: widthSegments, - heightSegments: heightSegments, - depthSegments: depthSegments - }; + this.parameters = { + width: width, + height: height, + depth: depth, + widthSegments: widthSegments, + heightSegments: heightSegments, + depthSegments: depthSegments + }; - var scope = this; + var scope = this; - width = width || 1; - height = height || 1; - depth = depth || 1; + width = width || 1; + height = height || 1; + depth = depth || 1; - // segments + // segments - widthSegments = Math.floor( widthSegments ) || 1; - heightSegments = Math.floor( heightSegments ) || 1; - depthSegments = Math.floor( depthSegments ) || 1; + widthSegments = Math.floor( widthSegments ) || 1; + heightSegments = Math.floor( heightSegments ) || 1; + depthSegments = Math.floor( depthSegments ) || 1; - // buffers + // buffers - var indices = []; - var vertices = []; - var normals = []; - var uvs = []; + var indices = []; + var vertices = []; + var normals = []; + var uvs = []; - // helper variables + // helper variables - var numberOfVertices = 0; - var groupStart = 0; + var numberOfVertices = 0; + var groupStart = 0; - // build each side of the box geometry + // build each side of the box geometry - buildPlane( 'z', 'y', 'x', - 1, - 1, depth, height, width, depthSegments, heightSegments, 0 ); // px - buildPlane( 'z', 'y', 'x', 1, - 1, depth, height, - width, depthSegments, heightSegments, 1 ); // nx - buildPlane( 'x', 'z', 'y', 1, 1, width, depth, height, widthSegments, depthSegments, 2 ); // py - buildPlane( 'x', 'z', 'y', 1, - 1, width, depth, - height, widthSegments, depthSegments, 3 ); // ny - buildPlane( 'x', 'y', 'z', 1, - 1, width, height, depth, widthSegments, heightSegments, 4 ); // pz - buildPlane( 'x', 'y', 'z', - 1, - 1, width, height, - depth, widthSegments, heightSegments, 5 ); // nz + buildPlane( 'z', 'y', 'x', - 1, - 1, depth, height, width, depthSegments, heightSegments, 0 ); // px + buildPlane( 'z', 'y', 'x', 1, - 1, depth, height, - width, depthSegments, heightSegments, 1 ); // nx + buildPlane( 'x', 'z', 'y', 1, 1, width, depth, height, widthSegments, depthSegments, 2 ); // py + buildPlane( 'x', 'z', 'y', 1, - 1, width, depth, - height, widthSegments, depthSegments, 3 ); // ny + buildPlane( 'x', 'y', 'z', 1, - 1, width, height, depth, widthSegments, heightSegments, 4 ); // pz + buildPlane( 'x', 'y', 'z', - 1, - 1, width, height, - depth, widthSegments, heightSegments, 5 ); // nz - // build geometry + // build geometry - this.setIndex( indices ); - this.addAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) ); - this.addAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) ); - this.addAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) ); + this.setIndex( indices ); + this.addAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) ); + this.addAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) ); + this.addAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) ); - function buildPlane( u, v, w, udir, vdir, width, height, depth, gridX, gridY, materialIndex ) { + function buildPlane( u, v, w, udir, vdir, width, height, depth, gridX, gridY, materialIndex ) { - var segmentWidth = width / gridX; - var segmentHeight = height / gridY; + var segmentWidth = width / gridX; + var segmentHeight = height / gridY; - var widthHalf = width / 2; - var heightHalf = height / 2; - var depthHalf = depth / 2; + var widthHalf = width / 2; + var heightHalf = height / 2; + var depthHalf = depth / 2; - var gridX1 = gridX + 1; - var gridY1 = gridY + 1; + var gridX1 = gridX + 1; + var gridY1 = gridY + 1; - var vertexCounter = 0; - var groupCount = 0; + var vertexCounter = 0; + var groupCount = 0; - var ix, iy; + var ix, iy; - var vector = new Vector3(); + var vector = new Vector3(); - // generate vertices, normals and uvs + // generate vertices, normals and uvs + + for ( iy = 0; iy < gridY1; iy ++ ) { - for ( iy = 0; iy < gridY1; iy ++ ) { + var y = iy * segmentHeight - heightHalf; - var y = iy * segmentHeight - heightHalf; + for ( ix = 0; ix < gridX1; ix ++ ) { - for ( ix = 0; ix < gridX1; ix ++ ) { + var x = ix * segmentWidth - widthHalf; - var x = ix * segmentWidth - widthHalf; + // set values to correct vector component - // set values to correct vector component + vector[ u ] = x * udir; + vector[ v ] = y * vdir; + vector[ w ] = depthHalf; - vector[ u ] = x * udir; - vector[ v ] = y * vdir; - vector[ w ] = depthHalf; + // now apply vector to vertex buffer - // now apply vector to vertex buffer + vertices.push( vector.x, vector.y, vector.z ); - vertices.push( vector.x, vector.y, vector.z ); + // set values to correct vector component - // set values to correct vector component + vector[ u ] = 0; + vector[ v ] = 0; + vector[ w ] = depth > 0 ? 1 : - 1; - vector[ u ] = 0; - vector[ v ] = 0; - vector[ w ] = depth > 0 ? 1 : - 1; + // now apply vector to normal buffer - // now apply vector to normal buffer + normals.push( vector.x, vector.y, vector.z ); - normals.push( vector.x, vector.y, vector.z ); + // uvs - // uvs + uvs.push( ix / gridX ); + uvs.push( 1 - ( iy / gridY ) ); - uvs.push( ix / gridX ); - uvs.push( 1 - ( iy / gridY ) ); + // counters - // counters + vertexCounter += 1; - vertexCounter += 1; + } } - } + // indices - // indices + // 1. you need three indices to draw a single face + // 2. a single segment consists of two faces + // 3. so we need to generate six (2*3) indices per segment - // 1. you need three indices to draw a single face - // 2. a single segment consists of two faces - // 3. so we need to generate six (2*3) indices per segment + for ( iy = 0; iy < gridY; iy ++ ) { - for ( iy = 0; iy < gridY; iy ++ ) { + for ( ix = 0; ix < gridX; ix ++ ) { - for ( ix = 0; ix < gridX; ix ++ ) { + var a = numberOfVertices + ix + gridX1 * iy; + var b = numberOfVertices + ix + gridX1 * ( iy + 1 ); + var c = numberOfVertices + ( ix + 1 ) + gridX1 * ( iy + 1 ); + var d = numberOfVertices + ( ix + 1 ) + gridX1 * iy; - var a = numberOfVertices + ix + gridX1 * iy; - var b = numberOfVertices + ix + gridX1 * ( iy + 1 ); - var c = numberOfVertices + ( ix + 1 ) + gridX1 * ( iy + 1 ); - var d = numberOfVertices + ( ix + 1 ) + gridX1 * iy; + // faces - // faces + indices.push( a, b, d ); + indices.push( b, c, d ); - indices.push( a, b, d ); - indices.push( b, c, d ); + // increase counter - // increase counter + groupCount += 6; - groupCount += 6; + } } - } + // add a group to the geometry. this will ensure multi material support - // add a group to the geometry. this will ensure multi material support + scope.addGroup( groupStart, groupCount, materialIndex ); - scope.addGroup( groupStart, groupCount, materialIndex ); + // calculate new start value for groups - // calculate new start value for groups + groupStart += groupCount; - groupStart += groupCount; + // update total number of vertices - // update total number of vertices + numberOfVertices += vertexCounter; - numberOfVertices += vertexCounter; + } } - } + if ( BufferGeometry ) BoxBufferGeometry.__proto__ = BufferGeometry; + BoxBufferGeometry.prototype = Object.create( BufferGeometry && BufferGeometry.prototype ); + BoxBufferGeometry.prototype.constructor = BoxBufferGeometry; - BoxBufferGeometry.prototype = Object.create( BufferGeometry.prototype ); - BoxBufferGeometry.prototype.constructor = BoxBufferGeometry; + return BoxBufferGeometry; + }(BufferGeometry)); /** * Uniform Utilities @@ -13032,7 +13042,7 @@ } - if ( Object.keys( this.defines ).length > 0 ) data.defines = this.defines; + if ( Object.keys( this.defines ).length > 0 ) { data.defines = this.defines; } data.vertexShader = this.vertexShader; data.fragmentShader = this.fragmentShader; @@ -13041,11 +13051,11 @@ for ( var key in this.extensions ) { - if ( this.extensions[ key ] === true ) extensions[ key ] = true; + if ( this.extensions[ key ] === true ) { extensions[ key ] = true; } } - if ( Object.keys( extensions ).length > 0 ) data.extensions = extensions; + if ( Object.keys( extensions ).length > 0 ) { data.extensions = extensions; } return data; @@ -13328,7 +13338,7 @@ } var skew = this.filmOffset; - if ( skew !== 0 ) left += near * skew / this.getFilmWidth(); + if ( skew !== 0 ) { left += near * skew / this.getFilmWidth(); } this.projectionMatrix.makePerspective( left, left + width, top, top - height, near, this.far ); @@ -13349,7 +13359,7 @@ data.object.aspect = this.aspect; - if ( this.view !== null ) data.object.view = Object.assign( {}, this.view ); + if ( this.view !== null ) { data.object.view = Object.assign( {}, this.view ); } data.object.filmGauge = this.filmGauge; data.object.filmOffset = this.filmOffset; @@ -13412,7 +13422,7 @@ this.update = function ( renderer, scene ) { - if ( this.parent === null ) this.updateMatrixWorld(); + if ( this.parent === null ) { this.updateMatrixWorld(); } var currentRenderTarget = renderer.getRenderTarget(); @@ -13912,7 +13922,7 @@ var geometry = object.geometry; - if ( geometry.boundingSphere === null ) geometry.computeBoundingSphere(); + if ( geometry.boundingSphere === null ) { geometry.computeBoundingSphere(); } _sphere$1.copy( geometry.boundingSphere ).applyMatrix4( object.matrixWorld ); @@ -14820,8 +14830,7 @@ { color: { value: new Color( 0x00000 ) }, opacity: { value: 1.0 } - }, - ] ), + } ] ), vertexShader: ShaderChunk.shadow_vert, fragmentShader: ShaderChunk.shadow_frag @@ -14861,7 +14870,7 @@ function onAnimationFrame( time, frame ) { - if ( isAnimating === false ) return; + if ( isAnimating === false ) { return; } animationLoop( time, frame ); @@ -14873,8 +14882,8 @@ start: function () { - if ( isAnimating === true ) return; - if ( animationLoop === null ) return; + if ( isAnimating === true ) { return; } + if ( animationLoop === null ) { return; } context.requestAnimationFrame( onAnimationFrame ); @@ -15005,7 +15014,7 @@ function get( attribute ) { - if ( attribute.isInterleavedBufferAttribute ) attribute = attribute.data; + if ( attribute.isInterleavedBufferAttribute ) { attribute = attribute.data; } return buffers.get( attribute ); @@ -15013,7 +15022,7 @@ function remove( attribute ) { - if ( attribute.isInterleavedBufferAttribute ) attribute = attribute.data; + if ( attribute.isInterleavedBufferAttribute ) { attribute = attribute.data; } var data = buffers.get( attribute ); @@ -15029,7 +15038,7 @@ function update( attribute, bufferType ) { - if ( attribute.isInterleavedBufferAttribute ) attribute = attribute.data; + if ( attribute.isInterleavedBufferAttribute ) { attribute = attribute.data; } var data = buffers.get( attribute ); @@ -15458,7 +15467,7 @@ function getMaxAnisotropy() { - if ( maxAnisotropy !== undefined ) return maxAnisotropy; + if ( maxAnisotropy !== undefined ) { return maxAnisotropy; } var extension = extensions.get( 'EXT_texture_filter_anisotropic' ); @@ -15833,7 +15842,7 @@ var buffergeometry = geometries.get( geometry ); - if ( buffergeometry ) return buffergeometry; + if ( buffergeometry ) { return buffergeometry; } geometry.addEventListener( 'dispose', onGeometryDispose ); @@ -15945,7 +15954,7 @@ var previousAttribute = wireframeAttributes.get( geometry ); - if ( previousAttribute ) attributes.remove( previousAttribute ); + if ( previousAttribute ) { attributes.remove( previousAttribute ); } // @@ -16194,8 +16203,8 @@ if ( influence[ 1 ] !== 0 ) { - if ( morphTargets ) geometry.removeAttribute( 'morphTarget' + i ); - if ( morphNormals ) geometry.removeAttribute( 'morphNormal' + i ); + if ( morphTargets ) { geometry.removeAttribute( 'morphTarget' + i ); } + if ( morphNormals ) { geometry.removeAttribute( 'morphNormal' + i ); } } @@ -16227,8 +16236,8 @@ if ( value ) { - if ( morphTargets ) geometry.addAttribute( 'morphTarget' + i, morphTargets[ index ] ); - if ( morphNormals ) geometry.addAttribute( 'morphNormal' + i, morphNormals[ index ] ); + if ( morphTargets ) { geometry.addAttribute( 'morphTarget' + i, morphTargets[ index ] ); } + if ( morphNormals ) { geometry.addAttribute( 'morphNormal' + i, morphNormals[ index ] ); } morphInfluences[ i ] = value; continue; @@ -16467,7 +16476,7 @@ var firstElem = array[ 0 ]; - if ( firstElem <= 0 || firstElem > 0 ) return array; + if ( firstElem <= 0 || firstElem > 0 ) { return array; } // unoptimized: ! isNaN( firstElem ) // see http://jacksondunstan.com/articles/983 @@ -16500,11 +16509,11 @@ function arraysEqual( a, b ) { - if ( a.length !== b.length ) return false; + if ( a.length !== b.length ) { return false; } for ( var i = 0, l = a.length; i < l; i ++ ) { - if ( a[ i ] !== b[ i ] ) return false; + if ( a[ i ] !== b[ i ] ) { return false; } } @@ -16536,7 +16545,7 @@ } for ( var i = 0; i !== n; ++ i ) - r[ i ] = textures.allocateTextureUnit(); + { r[ i ] = textures.allocateTextureUnit(); } return r; @@ -16553,7 +16562,7 @@ var cache = this.cache; - if ( cache[ 0 ] === v ) return; + if ( cache[ 0 ] === v ) { return; } gl.uniform1f( this.addr, v ); @@ -16580,7 +16589,7 @@ } else { - if ( arraysEqual( cache, v ) ) return; + if ( arraysEqual( cache, v ) ) { return; } gl.uniform2fv( this.addr, v ); @@ -16620,7 +16629,7 @@ } else { - if ( arraysEqual( cache, v ) ) return; + if ( arraysEqual( cache, v ) ) { return; } gl.uniform3fv( this.addr, v ); @@ -16649,7 +16658,7 @@ } else { - if ( arraysEqual( cache, v ) ) return; + if ( arraysEqual( cache, v ) ) { return; } gl.uniform4fv( this.addr, v ); @@ -16668,7 +16677,7 @@ if ( elements === undefined ) { - if ( arraysEqual( cache, v ) ) return; + if ( arraysEqual( cache, v ) ) { return; } gl.uniformMatrix2fv( this.addr, false, v ); @@ -16676,7 +16685,7 @@ } else { - if ( arraysEqual( cache, elements ) ) return; + if ( arraysEqual( cache, elements ) ) { return; } mat2array.set( elements ); @@ -16695,7 +16704,7 @@ if ( elements === undefined ) { - if ( arraysEqual( cache, v ) ) return; + if ( arraysEqual( cache, v ) ) { return; } gl.uniformMatrix3fv( this.addr, false, v ); @@ -16703,7 +16712,7 @@ } else { - if ( arraysEqual( cache, elements ) ) return; + if ( arraysEqual( cache, elements ) ) { return; } mat3array.set( elements ); @@ -16722,7 +16731,7 @@ if ( elements === undefined ) { - if ( arraysEqual( cache, v ) ) return; + if ( arraysEqual( cache, v ) ) { return; } gl.uniformMatrix4fv( this.addr, false, v ); @@ -16730,7 +16739,7 @@ } else { - if ( arraysEqual( cache, elements ) ) return; + if ( arraysEqual( cache, elements ) ) { return; } mat4array.set( elements ); @@ -16814,7 +16823,7 @@ var cache = this.cache; - if ( cache[ 0 ] === v ) return; + if ( cache[ 0 ] === v ) { return; } gl.uniform1i( this.addr, v ); @@ -16826,7 +16835,7 @@ var cache = this.cache; - if ( arraysEqual( cache, v ) ) return; + if ( arraysEqual( cache, v ) ) { return; } gl.uniform2iv( this.addr, v ); @@ -16838,7 +16847,7 @@ var cache = this.cache; - if ( arraysEqual( cache, v ) ) return; + if ( arraysEqual( cache, v ) ) { return; } gl.uniform3iv( this.addr, v ); @@ -16850,7 +16859,7 @@ var cache = this.cache; - if ( arraysEqual( cache, v ) ) return; + if ( arraysEqual( cache, v ) ) { return; } gl.uniform4iv( this.addr, v ); @@ -17133,7 +17142,7 @@ idIsIndex = match[ 2 ] === ']', subscript = match[ 3 ]; - if ( idIsIndex ) id = id | 0; // convert to integer + if ( idIsIndex ) { id = id | 0; } // convert to integer if ( subscript === undefined || subscript === '[' && matchEnd + 2 === pathLength ) { @@ -17190,7 +17199,7 @@ var u = this.map[ name ]; - if ( u !== undefined ) u.setValue( gl, value, textures ); + if ( u !== undefined ) { u.setValue( gl, value, textures ); } }; @@ -17198,7 +17207,7 @@ var v = object[ name ]; - if ( v !== undefined ) this.setValue( gl, name, v ); + if ( v !== undefined ) { this.setValue( gl, name, v ); } }; @@ -17230,7 +17239,7 @@ for ( var i = 0, n = seq.length; i !== n; ++ i ) { var u = seq[ i ]; - if ( u.id in values ) r.push( u ); + if ( u.id in values ) { r.push( u ); } } @@ -17305,7 +17314,7 @@ var status = gl.getShaderParameter( shader, 35713 ); var log = gl.getShaderInfoLog( shader ).trim(); - if ( status && log === '' ) return ''; + if ( status && log === '' ) { return ''; } // --enable-privileged-webgl-extension // console.log( '**' + type + '**', gl.getExtension( 'WEBGL_debug_shaders' ).getTranslatedShaderSource( shader ) ); @@ -17388,7 +17397,7 @@ var value = defines[ name ]; - if ( value === false ) continue; + if ( value === false ) { continue; } chunks.push( '#define ' + name + ' ' + value ); @@ -18528,8 +18537,8 @@ function sort() { - if ( opaque.length > 1 ) opaque.sort( painterSortStable ); - if ( transparent.length > 1 ) transparent.sort( reversePainterSortStable ); + if ( opaque.length > 1 ) { opaque.sort( painterSortStable ); } + if ( transparent.length > 1 ) { transparent.sort( reversePainterSortStable ); } } @@ -18746,7 +18755,7 @@ }; - for ( var i = 0; i < 9; i ++ ) state.probe.push( new Vector3() ); + for ( var i = 0; i < 9; i ++ ) { state.probe.push( new Vector3() ); } var vector3 = new Vector3(); var matrix4 = new Matrix4(); @@ -18756,7 +18765,7 @@ var r = 0, g = 0, b = 0; - for ( var i = 0; i < 9; i ++ ) state.probe[ i ].set( 0, 0, 0 ); + for ( var i = 0; i < 9; i ++ ) { state.probe[ i ].set( 0, 0, 0 ); } var directionalLength = 0; var pointLength = 0; @@ -19378,10 +19387,10 @@ this.render = function ( lights, scene, camera ) { - if ( scope.enabled === false ) return; - if ( scope.autoUpdate === false && scope.needsUpdate === false ) return; + if ( scope.enabled === false ) { return; } + if ( scope.autoUpdate === false && scope.needsUpdate === false ) { return; } - if ( lights.length === 0 ) return; + if ( lights.length === 0 ) { return; } var currentRenderTarget = _renderer.getRenderTarget(); var activeCubeFace = _renderer.getActiveCubeFace(); @@ -19573,8 +19582,8 @@ var variantIndex = 0; - if ( useMorphing ) variantIndex |= _MorphingFlag; - if ( useSkinning ) variantIndex |= _SkinningFlag; + if ( useMorphing ) { variantIndex |= _MorphingFlag; } + if ( useSkinning ) { variantIndex |= _SkinningFlag; } result = materialVariants[ variantIndex ]; @@ -19649,7 +19658,7 @@ function renderObject( object, camera, shadowCamera, light, type ) { - if ( object.visible === false ) return; + if ( object.visible === false ) { return; } var visible = object.layers.test( camera.layers ); @@ -20372,7 +20381,7 @@ : enable( 2884 ); var flipSided = ( material.side === BackSide ); - if ( frontFaceCW ) flipSided = ! flipSided; + if ( frontFaceCW ) { flipSided = ! flipSided; } setFlipSided( flipSided ); @@ -20458,7 +20467,7 @@ if ( width !== currentLineWidth ) { - if ( lineWidthAvailable ) gl.lineWidth( width ); + if ( lineWidthAvailable ) { gl.lineWidth( width ); } currentLineWidth = width; @@ -20507,7 +20516,7 @@ function activeTexture( webglSlot ) { - if ( webglSlot === undefined ) webglSlot = 33984 + maxTextures - 1; + if ( webglSlot === undefined ) { webglSlot = 33984 + maxTextures - 1; } if ( currentTextureSlot !== webglSlot ) { @@ -20741,7 +20750,7 @@ var width = floor( scale * image.width ); var height = floor( scale * image.height ); - if ( _canvas === undefined ) _canvas = createCanvas( width, height ); + if ( _canvas === undefined ) { _canvas = createCanvas( width, height ); } // cube textures can't reuse the same canvas @@ -20783,7 +20792,7 @@ function textureNeedsPowerOfTwo( texture ) { - if ( capabilities.isWebGL2 ) return false; + if ( capabilities.isWebGL2 ) { return false; } return ( texture.wrapS !== ClampToEdgeWrapping || texture.wrapT !== ClampToEdgeWrapping ) || ( texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter ); @@ -20810,31 +20819,31 @@ function getInternalFormat( glFormat, glType ) { - if ( ! capabilities.isWebGL2 ) return glFormat; + if ( ! capabilities.isWebGL2 ) { return glFormat; } var internalFormat = glFormat; if ( glFormat === 6403 ) { - if ( glType === 5126 ) internalFormat = 33326; - if ( glType === 5131 ) internalFormat = 33325; - if ( glType === 5121 ) internalFormat = 33321; + if ( glType === 5126 ) { internalFormat = 33326; } + if ( glType === 5131 ) { internalFormat = 33325; } + if ( glType === 5121 ) { internalFormat = 33321; } } if ( glFormat === 6407 ) { - if ( glType === 5126 ) internalFormat = 34837; - if ( glType === 5131 ) internalFormat = 34843; - if ( glType === 5121 ) internalFormat = 32849; + if ( glType === 5126 ) { internalFormat = 34837; } + if ( glType === 5131 ) { internalFormat = 34843; } + if ( glType === 5121 ) { internalFormat = 32849; } } if ( glFormat === 6408 ) { - if ( glType === 5126 ) internalFormat = 34836; - if ( glType === 5131 ) internalFormat = 34842; - if ( glType === 5121 ) internalFormat = 32856; + if ( glType === 5126 ) { internalFormat = 34836; } + if ( glType === 5131 ) { internalFormat = 34842; } + if ( glType === 5121 ) { internalFormat = 32856; } } @@ -20905,7 +20914,7 @@ var textureProperties = properties.get( texture ); - if ( textureProperties.__webglInit === undefined ) return; + if ( textureProperties.__webglInit === undefined ) { return; } _gl.deleteTexture( textureProperties.__webglTexture ); @@ -20918,7 +20927,7 @@ var renderTargetProperties = properties.get( renderTarget ); var textureProperties = properties.get( renderTarget.texture ); - if ( ! renderTarget ) return; + if ( ! renderTarget ) { return; } if ( textureProperties.__webglTexture !== undefined ) { @@ -20937,14 +20946,14 @@ for ( var i = 0; i < 6; i ++ ) { _gl.deleteFramebuffer( renderTargetProperties.__webglFramebuffer[ i ] ); - if ( renderTargetProperties.__webglDepthbuffer ) _gl.deleteRenderbuffer( renderTargetProperties.__webglDepthbuffer[ i ] ); + if ( renderTargetProperties.__webglDepthbuffer ) { _gl.deleteRenderbuffer( renderTargetProperties.__webglDepthbuffer[ i ] ); } } } else { _gl.deleteFramebuffer( renderTargetProperties.__webglFramebuffer ); - if ( renderTargetProperties.__webglDepthbuffer ) _gl.deleteRenderbuffer( renderTargetProperties.__webglDepthbuffer ); + if ( renderTargetProperties.__webglDepthbuffer ) { _gl.deleteRenderbuffer( renderTargetProperties.__webglDepthbuffer ); } } @@ -20985,7 +20994,7 @@ var textureProperties = properties.get( texture ); - if ( texture.isVideoTexture ) updateVideoTexture( texture ); + if ( texture.isVideoTexture ) { updateVideoTexture( texture ); } if ( texture.version > 0 && textureProperties.__version !== texture.version ) { @@ -21047,7 +21056,7 @@ function setTextureCube( texture, slot ) { - if ( texture.image.length !== 6 ) return; + if ( texture.image.length !== 6 ) { return; } var textureProperties = properties.get( texture ); @@ -21171,7 +21180,7 @@ textureProperties.__version = texture.version; - if ( texture.onUpdate ) texture.onUpdate( texture ); + if ( texture.onUpdate ) { texture.onUpdate( texture ); } } else { @@ -21239,8 +21248,8 @@ if ( extension ) { - if ( texture.type === FloatType && extensions.get( 'OES_texture_float_linear' ) === null ) return; - if ( texture.type === HalfFloatType && ( capabilities.isWebGL2 || extensions.get( 'OES_texture_half_float_linear' ) ) === null ) return; + if ( texture.type === FloatType && extensions.get( 'OES_texture_float_linear' ) === null ) { return; } + if ( texture.type === HalfFloatType && ( capabilities.isWebGL2 || extensions.get( 'OES_texture_half_float_linear' ) ) === null ) { return; } if ( texture.anisotropy > 1 || properties.get( texture ).__currentAnisotropy ) { @@ -21273,8 +21282,8 @@ var textureType = 3553; - if ( texture.isDataTexture2DArray ) textureType = 35866; - if ( texture.isDataTexture3D ) textureType = 32879; + if ( texture.isDataTexture2DArray ) { textureType = 35866; } + if ( texture.isDataTexture3D ) { textureType = 32879; } initTexture( textureProperties, texture ); @@ -21305,7 +21314,7 @@ if ( texture.type === FloatType ) { - if ( ! capabilities.isWebGL2 ) throw new Error( 'Float Depth Texture only supported in WebGL2.0' ); + if ( ! capabilities.isWebGL2 ) { throw new Error( 'Float Depth Texture only supported in WebGL2.0' ); } glInternalFormat = 36012; } else if ( capabilities.isWebGL2 ) { @@ -21453,7 +21462,7 @@ textureProperties.__version = texture.version; - if ( texture.onUpdate ) texture.onUpdate( texture ); + if ( texture.onUpdate ) { texture.onUpdate( texture ); } } @@ -21538,7 +21547,7 @@ function setupDepthTexture( framebuffer, renderTarget ) { var isCube = ( renderTarget && renderTarget.isWebGLRenderTargetCube ); - if ( isCube ) throw new Error( 'Depth Texture with cube render targets is not supported' ); + if ( isCube ) { throw new Error( 'Depth Texture with cube render targets is not supported' ); } _gl.bindFramebuffer( 36160, framebuffer ); @@ -21588,7 +21597,7 @@ if ( renderTarget.depthTexture ) { - if ( isCube ) throw new Error( 'target.depthTexture not supported in Cube render targets' ); + if ( isCube ) { throw new Error( 'target.depthTexture not supported in Cube render targets' ); } setupDepthTexture( renderTargetProperties.__webglFramebuffer, renderTarget ); @@ -21770,8 +21779,8 @@ var height = renderTarget.height; var mask = 16384; - if ( renderTarget.depthBuffer ) mask |= 256; - if ( renderTarget.stencilBuffer ) mask |= 1024; + if ( renderTarget.depthBuffer ) { mask |= 256; } + if ( renderTarget.stencilBuffer ) { mask |= 1024; } _gl.blitFramebuffer( 0, 0, width, height, 0, 0, width, height, mask, 9728 ); @@ -21894,65 +21903,65 @@ var extension; - if ( p === RepeatWrapping ) return 10497; - if ( p === ClampToEdgeWrapping ) return 33071; - if ( p === MirroredRepeatWrapping ) return 33648; + if ( p === RepeatWrapping ) { return 10497; } + if ( p === ClampToEdgeWrapping ) { return 33071; } + if ( p === MirroredRepeatWrapping ) { return 33648; } - if ( p === NearestFilter ) return 9728; - if ( p === NearestMipmapNearestFilter ) return 9984; - if ( p === NearestMipmapLinearFilter ) return 9986; + if ( p === NearestFilter ) { return 9728; } + if ( p === NearestMipmapNearestFilter ) { return 9984; } + if ( p === NearestMipmapLinearFilter ) { return 9986; } - if ( p === LinearFilter ) return 9729; - if ( p === LinearMipmapNearestFilter ) return 9985; - if ( p === LinearMipmapLinearFilter ) return 9987; + if ( p === LinearFilter ) { return 9729; } + if ( p === LinearMipmapNearestFilter ) { return 9985; } + if ( p === LinearMipmapLinearFilter ) { return 9987; } - if ( p === UnsignedByteType ) return 5121; - if ( p === UnsignedShort4444Type ) return 32819; - if ( p === UnsignedShort5551Type ) return 32820; - if ( p === UnsignedShort565Type ) return 33635; + if ( p === UnsignedByteType ) { return 5121; } + if ( p === UnsignedShort4444Type ) { return 32819; } + if ( p === UnsignedShort5551Type ) { return 32820; } + if ( p === UnsignedShort565Type ) { return 33635; } - if ( p === ByteType ) return 5120; - if ( p === ShortType ) return 5122; - if ( p === UnsignedShortType ) return 5123; - if ( p === IntType ) return 5124; - if ( p === UnsignedIntType ) return 5125; - if ( p === FloatType ) return 5126; + if ( p === ByteType ) { return 5120; } + if ( p === ShortType ) { return 5122; } + if ( p === UnsignedShortType ) { return 5123; } + if ( p === IntType ) { return 5124; } + if ( p === UnsignedIntType ) { return 5125; } + if ( p === FloatType ) { return 5126; } if ( p === HalfFloatType ) { - if ( capabilities.isWebGL2 ) return 5131; + if ( capabilities.isWebGL2 ) { return 5131; } extension = extensions.get( 'OES_texture_half_float' ); - if ( extension !== null ) return extension.HALF_FLOAT_OES; + if ( extension !== null ) { return extension.HALF_FLOAT_OES; } } - if ( p === AlphaFormat ) return 6406; - if ( p === RGBFormat ) return 6407; - if ( p === RGBAFormat ) return 6408; - if ( p === LuminanceFormat ) return 6409; - if ( p === LuminanceAlphaFormat ) return 6410; - if ( p === DepthFormat ) return 6402; - if ( p === DepthStencilFormat ) return 34041; - if ( p === RedFormat ) return 6403; + if ( p === AlphaFormat ) { return 6406; } + if ( p === RGBFormat ) { return 6407; } + if ( p === RGBAFormat ) { return 6408; } + if ( p === LuminanceFormat ) { return 6409; } + if ( p === LuminanceAlphaFormat ) { return 6410; } + if ( p === DepthFormat ) { return 6402; } + if ( p === DepthStencilFormat ) { return 34041; } + if ( p === RedFormat ) { return 6403; } - if ( p === AddEquation ) return 32774; - if ( p === SubtractEquation ) return 32778; - if ( p === ReverseSubtractEquation ) return 32779; + if ( p === AddEquation ) { return 32774; } + if ( p === SubtractEquation ) { return 32778; } + if ( p === ReverseSubtractEquation ) { return 32779; } - if ( p === ZeroFactor ) return 0; - if ( p === OneFactor ) return 1; - if ( p === SrcColorFactor ) return 768; - if ( p === OneMinusSrcColorFactor ) return 769; - if ( p === SrcAlphaFactor ) return 770; - if ( p === OneMinusSrcAlphaFactor ) return 771; - if ( p === DstAlphaFactor ) return 772; - if ( p === OneMinusDstAlphaFactor ) return 773; + if ( p === ZeroFactor ) { return 0; } + if ( p === OneFactor ) { return 1; } + if ( p === SrcColorFactor ) { return 768; } + if ( p === OneMinusSrcColorFactor ) { return 769; } + if ( p === SrcAlphaFactor ) { return 770; } + if ( p === OneMinusSrcAlphaFactor ) { return 771; } + if ( p === DstAlphaFactor ) { return 772; } + if ( p === OneMinusDstAlphaFactor ) { return 773; } - if ( p === DstColorFactor ) return 774; - if ( p === OneMinusDstColorFactor ) return 775; - if ( p === SrcAlphaSaturateFactor ) return 776; + if ( p === DstColorFactor ) { return 774; } + if ( p === OneMinusDstColorFactor ) { return 775; } + if ( p === SrcAlphaSaturateFactor ) { return 776; } if ( p === RGB_S3TC_DXT1_Format || p === RGBA_S3TC_DXT1_Format || p === RGBA_S3TC_DXT3_Format || p === RGBA_S3TC_DXT5_Format ) { @@ -21961,10 +21970,10 @@ if ( extension !== null ) { - if ( p === RGB_S3TC_DXT1_Format ) return extension.COMPRESSED_RGB_S3TC_DXT1_EXT; - if ( p === RGBA_S3TC_DXT1_Format ) return extension.COMPRESSED_RGBA_S3TC_DXT1_EXT; - if ( p === RGBA_S3TC_DXT3_Format ) return extension.COMPRESSED_RGBA_S3TC_DXT3_EXT; - if ( p === RGBA_S3TC_DXT5_Format ) return extension.COMPRESSED_RGBA_S3TC_DXT5_EXT; + if ( p === RGB_S3TC_DXT1_Format ) { return extension.COMPRESSED_RGB_S3TC_DXT1_EXT; } + if ( p === RGBA_S3TC_DXT1_Format ) { return extension.COMPRESSED_RGBA_S3TC_DXT1_EXT; } + if ( p === RGBA_S3TC_DXT3_Format ) { return extension.COMPRESSED_RGBA_S3TC_DXT3_EXT; } + if ( p === RGBA_S3TC_DXT5_Format ) { return extension.COMPRESSED_RGBA_S3TC_DXT5_EXT; } } @@ -21977,10 +21986,10 @@ if ( extension !== null ) { - if ( p === RGB_PVRTC_4BPPV1_Format ) return extension.COMPRESSED_RGB_PVRTC_4BPPV1_IMG; - if ( p === RGB_PVRTC_2BPPV1_Format ) return extension.COMPRESSED_RGB_PVRTC_2BPPV1_IMG; - if ( p === RGBA_PVRTC_4BPPV1_Format ) return extension.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG; - if ( p === RGBA_PVRTC_2BPPV1_Format ) return extension.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG; + if ( p === RGB_PVRTC_4BPPV1_Format ) { return extension.COMPRESSED_RGB_PVRTC_4BPPV1_IMG; } + if ( p === RGB_PVRTC_2BPPV1_Format ) { return extension.COMPRESSED_RGB_PVRTC_2BPPV1_IMG; } + if ( p === RGBA_PVRTC_4BPPV1_Format ) { return extension.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG; } + if ( p === RGBA_PVRTC_2BPPV1_Format ) { return extension.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG; } } @@ -21990,7 +21999,7 @@ extension = extensions.get( 'WEBGL_compressed_texture_etc1' ); - if ( extension !== null ) return extension.COMPRESSED_RGB_ETC1_WEBGL; + if ( extension !== null ) { return extension.COMPRESSED_RGB_ETC1_WEBGL; } } @@ -22014,8 +22023,8 @@ if ( capabilities.isWebGL2 ) { - if ( p === MinEquation ) return 32775; - if ( p === MaxEquation ) return 32776; + if ( p === MinEquation ) { return 32775; } + if ( p === MaxEquation ) { return 32776; } } @@ -22023,8 +22032,8 @@ if ( extension !== null ) { - if ( p === MinEquation ) return extension.MIN_EXT; - if ( p === MaxEquation ) return extension.MAX_EXT; + if ( p === MinEquation ) { return extension.MIN_EXT; } + if ( p === MaxEquation ) { return extension.MAX_EXT; } } @@ -22032,11 +22041,11 @@ if ( p === UnsignedInt248Type ) { - if ( capabilities.isWebGL2 ) return 34042; + if ( capabilities.isWebGL2 ) { return 34042; } extension = extensions.get( 'WEBGL_depth_texture' ); - if ( extension !== null ) return extension.UNSIGNED_INT_24_8_WEBGL; + if ( extension !== null ) { return extension.UNSIGNED_INT_24_8_WEBGL; } } @@ -22260,7 +22269,7 @@ gamepad.id.startsWith( 'HTC Vive Focus' ) || gamepad.id.startsWith( 'Spatial Controller' ) ) ) { - if ( j === id ) return gamepad; + if ( j === id ) { return gamepad; } j ++; @@ -22280,16 +22289,16 @@ if ( gamepad !== undefined && gamepad.pose !== undefined ) { - if ( gamepad.pose === null ) return; + if ( gamepad.pose === null ) { return; } // Pose var pose = gamepad.pose; - if ( pose.hasPosition === false ) controller.position.set( 0.2, - 0.6, - 0.05 ); + if ( pose.hasPosition === false ) { controller.position.set( 0.2, - 0.6, - 0.05 ); } - if ( pose.position !== null ) controller.position.fromArray( pose.position ); - if ( pose.orientation !== null ) controller.quaternion.fromArray( pose.orientation ); + if ( pose.position !== null ) { controller.position.fromArray( pose.position ); } + if ( pose.orientation !== null ) { controller.quaternion.fromArray( pose.orientation ); } controller.matrix.compose( controller.position, controller.quaternion, controller.scale ); controller.matrix.premultiply( standingMatrix ); controller.matrix.decompose( controller.position, controller.quaternion, controller.scale ); @@ -22300,7 +22309,7 @@ var buttonId = gamepad.id === 'Daydream Controller' ? 0 : 1; - if ( triggers[ i ] === undefined ) triggers[ i ] = false; + if ( triggers[ i ] === undefined ) { triggers[ i ] = false; } if ( triggers[ i ] !== gamepad.buttons[ buttonId ].pressed ) { @@ -22369,7 +22378,7 @@ this.setDevice = function ( value ) { - if ( value !== undefined ) device = value; + if ( value !== undefined ) { device = value; } animation.setContext( value ); @@ -22389,7 +22398,7 @@ this.setPoseTarget = function ( object ) { - if ( object !== undefined ) poseTarget = object; + if ( object !== undefined ) { poseTarget = object; } }; @@ -22533,13 +22542,13 @@ animation.setAnimationLoop( callback ); - if ( isPresenting() ) animation.start(); + if ( isPresenting() ) { animation.start(); } }; this.submitFrame = function () { - if ( isPresenting() ) device.submitFrame(); + if ( isPresenting() ) { device.submitFrame(); } }; @@ -22834,7 +22843,7 @@ } - if ( onAnimationFrameCallback ) onAnimationFrameCallback( time ); + if ( onAnimationFrameCallback ) { onAnimationFrameCallback( time ); } } @@ -23174,14 +23183,14 @@ this.forceContextLoss = function () { var extension = extensions.get( 'WEBGL_lose_context' ); - if ( extension ) extension.loseContext(); + if ( extension ) { extension.loseContext(); } }; this.forceContextRestore = function () { var extension = extensions.get( 'WEBGL_lose_context' ); - if ( extension ) extension.restoreContext(); + if ( extension ) { extension.restoreContext(); } }; @@ -23193,7 +23202,7 @@ this.setPixelRatio = function ( value ) { - if ( value === undefined ) return; + if ( value === undefined ) { return; } _pixelRatio = value; @@ -23369,9 +23378,9 @@ var bits = 0; - if ( color === undefined || color ) bits |= 16384; - if ( depth === undefined || depth ) bits |= 256; - if ( stencil === undefined || stencil ) bits |= 1024; + if ( color === undefined || color ) { bits |= 16384; } + if ( depth === undefined || depth ) { bits |= 256; } + if ( stencil === undefined || stencil ) { bits |= 1024; } _gl.clear( bits ); @@ -23488,10 +23497,10 @@ var buffers = properties.get( object ); - if ( object.hasPositions && ! buffers.position ) buffers.position = _gl.createBuffer(); - if ( object.hasNormals && ! buffers.normal ) buffers.normal = _gl.createBuffer(); - if ( object.hasUvs && ! buffers.uv ) buffers.uv = _gl.createBuffer(); - if ( object.hasColors && ! buffers.color ) buffers.color = _gl.createBuffer(); + if ( object.hasPositions && ! buffers.position ) { buffers.position = _gl.createBuffer(); } + if ( object.hasNormals && ! buffers.normal ) { buffers.normal = _gl.createBuffer(); } + if ( object.hasUvs && ! buffers.uv ) { buffers.uv = _gl.createBuffer(); } + if ( object.hasColors && ! buffers.color ) { buffers.color = _gl.createBuffer(); } var programAttributes = program.getAttributes(); @@ -23634,7 +23643,7 @@ var drawCount = Math.max( 0, drawEnd - drawStart + 1 ); - if ( drawCount === 0 ) return; + if ( drawCount === 0 ) { return; } // @@ -23670,7 +23679,7 @@ var lineWidth = material.linewidth; - if ( lineWidth === undefined ) lineWidth = 1; // Not using Line*Material + if ( lineWidth === undefined ) { lineWidth = 1; } // Not using Line*Material state.setLineWidth( lineWidth * getTargetPixelRatio() ); @@ -23752,7 +23761,7 @@ // TODO Attribute may not be available on context restore - if ( attribute === undefined ) continue; + if ( attribute === undefined ) { continue; } var buffer = attribute.buffer; var type = attribute.type; @@ -23898,15 +23907,15 @@ function onAnimationFrame( time ) { - if ( vr.isPresenting() ) return; - if ( onAnimationFrameCallback ) onAnimationFrameCallback( time ); + if ( vr.isPresenting() ) { return; } + if ( onAnimationFrameCallback ) { onAnimationFrameCallback( time ); } } var animation = new WebGLAnimation(); animation.setAnimationLoop( onAnimationFrame ); - if ( typeof window !== 'undefined' ) animation.setContext( window ); + if ( typeof window !== 'undefined' ) { animation.setContext( window ); } this.setAnimationLoop = function ( callback ) { @@ -23944,7 +23953,7 @@ } - if ( _isContextLost ) return; + if ( _isContextLost ) { return; } // reset caching for this frame @@ -23956,11 +23965,11 @@ // update scene graph - if ( scene.autoUpdate === true ) scene.updateMatrixWorld(); + if ( scene.autoUpdate === true ) { scene.updateMatrixWorld(); } // update camera matrices and frustum - if ( camera.parent === null ) camera.updateMatrixWorld(); + if ( camera.parent === null ) { camera.updateMatrixWorld(); } if ( vr.enabled ) { @@ -23994,7 +24003,7 @@ // - if ( _clippingEnabled ) _clipping.beginShadows(); + if ( _clippingEnabled ) { _clipping.beginShadows(); } var shadowsArray = currentRenderState.state.shadowsArray; @@ -24002,11 +24011,11 @@ currentRenderState.setupLights( camera ); - if ( _clippingEnabled ) _clipping.endShadows(); + if ( _clippingEnabled ) { _clipping.endShadows(); } // - if ( this.info.autoReset ) this.info.reset(); + if ( this.info.autoReset ) { this.info.reset(); } if ( renderTarget !== undefined ) { @@ -24027,18 +24036,18 @@ var overrideMaterial = scene.overrideMaterial; - if ( opaqueObjects.length ) renderObjects( opaqueObjects, scene, camera, overrideMaterial ); - if ( transparentObjects.length ) renderObjects( transparentObjects, scene, camera, overrideMaterial ); + if ( opaqueObjects.length ) { renderObjects( opaqueObjects, scene, camera, overrideMaterial ); } + if ( transparentObjects.length ) { renderObjects( transparentObjects, scene, camera, overrideMaterial ); } } else { // opaque pass (front-to-back order) - if ( opaqueObjects.length ) renderObjects( opaqueObjects, scene, camera ); + if ( opaqueObjects.length ) { renderObjects( opaqueObjects, scene, camera ); } // transparent pass (back-to-front order) - if ( transparentObjects.length ) renderObjects( transparentObjects, scene, camera ); + if ( transparentObjects.length ) { renderObjects( transparentObjects, scene, camera ); } } @@ -24083,7 +24092,7 @@ function projectObject( object, camera, groupOrder, sortObjects ) { - if ( object.visible === false ) return; + if ( object.visible === false ) { return; } var visible = object.layers.test( camera.layers ); @@ -24095,7 +24104,7 @@ } else if ( object.isLOD ) { - if ( object.autoUpdate === true ) object.update( camera ); + if ( object.autoUpdate === true ) { object.update( camera ); } } else if ( object.isLight ) { @@ -24745,8 +24754,8 @@ // RectAreaLight Texture // TODO (mrdoob): Find a nicer implementation - if ( m_uniforms.ltc_1 !== undefined ) m_uniforms.ltc_1.value = UniformsLib.LTC_1; - if ( m_uniforms.ltc_2 !== undefined ) m_uniforms.ltc_2.value = UniformsLib.LTC_2; + if ( m_uniforms.ltc_1 !== undefined ) { m_uniforms.ltc_1.value = UniformsLib.LTC_1; } + if ( m_uniforms.ltc_2 !== undefined ) { m_uniforms.ltc_2.value = UniformsLib.LTC_2; } WebGLUniforms.upload( _gl, materialProperties.uniformsList, m_uniforms, textures ); @@ -25012,7 +25021,7 @@ uniforms.bumpMap.value = material.bumpMap; uniforms.bumpScale.value = material.bumpScale; - if ( material.side === BackSide ) uniforms.bumpScale.value *= - 1; + if ( material.side === BackSide ) { uniforms.bumpScale.value *= - 1; } } @@ -25020,7 +25029,7 @@ uniforms.normalMap.value = material.normalMap; uniforms.normalScale.value.copy( material.normalScale ); - if ( material.side === BackSide ) uniforms.normalScale.value.negate(); + if ( material.side === BackSide ) { uniforms.normalScale.value.negate(); } } @@ -25073,7 +25082,7 @@ uniforms.bumpMap.value = material.bumpMap; uniforms.bumpScale.value = material.bumpScale; - if ( material.side === BackSide ) uniforms.bumpScale.value *= - 1; + if ( material.side === BackSide ) { uniforms.bumpScale.value *= - 1; } } @@ -25081,7 +25090,7 @@ uniforms.normalMap.value = material.normalMap; uniforms.normalScale.value.copy( material.normalScale ); - if ( material.side === BackSide ) uniforms.normalScale.value.negate(); + if ( material.side === BackSide ) { uniforms.normalScale.value.negate(); } } @@ -25110,7 +25119,7 @@ uniforms.clearcoat.value = material.clearcoat; uniforms.clearcoatRoughness.value = material.clearcoatRoughness; - if ( material.sheen ) uniforms.sheen.value.copy( material.sheen ); + if ( material.sheen ) { uniforms.sheen.value.copy( material.sheen ); } if ( material.clearcoatNormalMap ) { @@ -25141,7 +25150,7 @@ uniforms.bumpMap.value = material.bumpMap; uniforms.bumpScale.value = material.bumpScale; - if ( material.side === BackSide ) uniforms.bumpScale.value *= - 1; + if ( material.side === BackSide ) { uniforms.bumpScale.value *= - 1; } } @@ -25149,7 +25158,7 @@ uniforms.normalMap.value = material.normalMap; uniforms.normalScale.value.copy( material.normalScale ); - if ( material.side === BackSide ) uniforms.normalScale.value.negate(); + if ( material.side === BackSide ) { uniforms.normalScale.value.negate(); } } @@ -25197,7 +25206,7 @@ uniforms.bumpMap.value = material.bumpMap; uniforms.bumpScale.value = material.bumpScale; - if ( material.side === BackSide ) uniforms.bumpScale.value *= - 1; + if ( material.side === BackSide ) { uniforms.bumpScale.value *= - 1; } } @@ -25205,7 +25214,7 @@ uniforms.normalMap.value = material.normalMap; uniforms.normalScale.value.copy( material.normalScale ); - if ( material.side === BackSide ) uniforms.normalScale.value.negate(); + if ( material.side === BackSide ) { uniforms.normalScale.value.negate(); } } @@ -25237,7 +25246,7 @@ // this.setFramebuffer = function ( value ) { - if ( _framebuffer !== value ) _gl.bindFramebuffer( 36160, value ); + if ( _framebuffer !== value ) { _gl.bindFramebuffer( 36160, value ); } _framebuffer = value; @@ -25545,7 +25554,7 @@ set: function ( value ) { - if ( value === true ) this.version ++; + if ( value === true ) { this.version ++; } } @@ -25608,7 +25617,7 @@ set: function ( value, offset ) { - if ( offset === undefined ) offset = 0; + if ( offset === undefined ) { offset = 0; } this.array.set( value, offset ); @@ -25939,7 +25948,7 @@ var distance = raycaster.ray.origin.distanceTo( _intersectPoint ); - if ( distance < raycaster.near || distance > raycaster.far ) return; + if ( distance < raycaster.near || distance > raycaster.far ) { return; } intersects.push( { @@ -25963,7 +25972,7 @@ Object3D.prototype.copy.call( this, source ); - if ( source.center !== undefined ) this.center.copy( source.center ); + if ( source.center !== undefined ) { this.center.copy( source.center ); } return this; @@ -26051,7 +26060,7 @@ addLevel: function ( object, distance ) { - if ( distance === undefined ) distance = 0; + if ( distance === undefined ) { distance = 0; } distance = Math.abs( distance ); @@ -26616,13 +26625,13 @@ // Checking boundingSphere distance to ray - if ( geometry.boundingSphere === null ) geometry.computeBoundingSphere(); + if ( geometry.boundingSphere === null ) { geometry.computeBoundingSphere(); } _sphere$2.copy( geometry.boundingSphere ); _sphere$2.applyMatrix4( matrixWorld ); _sphere$2.radius += precision; - if ( raycaster.ray.intersectsSphere( _sphere$2 ) === false ) return; + if ( raycaster.ray.intersectsSphere( _sphere$2 ) === false ) { return; } // @@ -26658,13 +26667,13 @@ var distSq = _ray$1.distanceSqToSegment( vStart, vEnd, interRay, interSegment ); - if ( distSq > localPrecisionSq ) continue; + if ( distSq > localPrecisionSq ) { continue; } interRay.applyMatrix4( this.matrixWorld ); //Move back to world space for distance calculation var distance = raycaster.ray.origin.distanceTo( interRay ); - if ( distance < raycaster.near || distance > raycaster.far ) continue; + if ( distance < raycaster.near || distance > raycaster.far ) { continue; } intersects.push( { @@ -26690,13 +26699,13 @@ var distSq = _ray$1.distanceSqToSegment( vStart, vEnd, interRay, interSegment ); - if ( distSq > localPrecisionSq ) continue; + if ( distSq > localPrecisionSq ) { continue; } interRay.applyMatrix4( this.matrixWorld ); //Move back to world space for distance calculation var distance = raycaster.ray.origin.distanceTo( interRay ); - if ( distance < raycaster.near || distance > raycaster.far ) continue; + if ( distance < raycaster.near || distance > raycaster.far ) { continue; } intersects.push( { @@ -26724,13 +26733,13 @@ var distSq = _ray$1.distanceSqToSegment( vertices[ i ], vertices[ i + 1 ], interRay, interSegment ); - if ( distSq > localPrecisionSq ) continue; + if ( distSq > localPrecisionSq ) { continue; } interRay.applyMatrix4( this.matrixWorld ); //Move back to world space for distance calculation var distance = raycaster.ray.origin.distanceTo( interRay ); - if ( distance < raycaster.near || distance > raycaster.far ) continue; + if ( distance < raycaster.near || distance > raycaster.far ) { continue; } intersects.push( { @@ -26949,13 +26958,13 @@ // Checking boundingSphere distance to ray - if ( geometry.boundingSphere === null ) geometry.computeBoundingSphere(); + if ( geometry.boundingSphere === null ) { geometry.computeBoundingSphere(); } _sphere$3.copy( geometry.boundingSphere ); _sphere$3.applyMatrix4( matrixWorld ); _sphere$3.radius += threshold; - if ( raycaster.ray.intersectsSphere( _sphere$3 ) === false ) return; + if ( raycaster.ray.intersectsSphere( _sphere$3 ) === false ) { return; } // @@ -27078,7 +27087,7 @@ var distance = raycaster.ray.origin.distanceTo( intersectPoint ); - if ( distance < raycaster.near || distance > raycaster.far ) return; + if ( distance < raycaster.near || distance > raycaster.far ) { return; } intersects.push( { @@ -27191,8 +27200,8 @@ } - if ( type === undefined && format === DepthFormat ) type = UnsignedShortType; - if ( type === undefined && format === DepthStencilFormat ) type = UnsignedInt248Type; + if ( type === undefined && format === DepthFormat ) { type = UnsignedShortType; } + if ( type === undefined && format === DepthStencilFormat ) { type = UnsignedInt248Type; } Texture.call( this, null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy ); @@ -27774,9 +27783,9 @@ if ( max > 0.9 && min < 0.1 ) { - if ( x0 < 0.2 ) uvBuffer[ i + 0 ] += 1; - if ( x1 < 0.2 ) uvBuffer[ i + 2 ] += 1; - if ( x2 < 0.2 ) uvBuffer[ i + 4 ] += 1; + if ( x0 < 0.2 ) { uvBuffer[ i + 0 ] += 1; } + if ( x1 < 0.2 ) { uvBuffer[ i + 2 ] += 1; } + if ( x2 < 0.2 ) { uvBuffer[ i + 4 ] += 1; } } @@ -28147,7 +28156,7 @@ closed: closed }; - if ( taper !== undefined ) console.warn( 'THREE.TubeGeometry: taper has been removed.' ); + if ( taper !== undefined ) { console.warn( 'THREE.TubeGeometry: taper has been removed.' ); } var bufferGeometry = new TubeBufferGeometry( path, tubularSegments, radius, radialSegments, closed ); @@ -28370,7 +28379,7 @@ q: q }; - if ( heightScale !== undefined ) console.warn( 'THREE.TorusKnotGeometry: heightScale has been deprecated. Use .scale( x, y, z ) instead.' ); + if ( heightScale !== undefined ) { console.warn( 'THREE.TorusKnotGeometry: heightScale has been deprecated. Use .scale( x, y, z ) instead.' ); } this.fromBufferGeometry( new TorusKnotBufferGeometry( radius, tube, tubularSegments, radialSegments, p, q ) ); this.mergeVertices(); @@ -28684,11 +28693,11 @@ outerNode = linkedList( data, 0, outerLen, dim, true ), triangles = []; - if ( ! outerNode || outerNode.next === outerNode.prev ) return triangles; + if ( ! outerNode || outerNode.next === outerNode.prev ) { return triangles; } var minX, minY, maxX, maxY, x, y, invSize; - if ( hasHoles ) outerNode = eliminateHoles( data, holeIndices, outerNode, dim ); + if ( hasHoles ) { outerNode = eliminateHoles( data, holeIndices, outerNode, dim ); } // if the shape is not too simple, we'll use z-order curve hash later; calculate polygon bbox if ( data.length > 80 * dim ) { @@ -28700,10 +28709,10 @@ x = data[ i ]; y = data[ i + 1 ]; - if ( x < minX ) minX = x; - if ( y < minY ) minY = y; - if ( x > maxX ) maxX = x; - if ( y > maxY ) maxY = y; + if ( x < minX ) { minX = x; } + if ( y < minY ) { minY = y; } + if ( x > maxX ) { maxX = x; } + if ( y > maxY ) { maxY = y; } } @@ -28728,11 +28737,11 @@ if ( clockwise === ( signedArea( data, start, end, dim ) > 0 ) ) { - for ( i = start; i < end; i += dim ) last = insertNode( i, data[ i ], data[ i + 1 ], last ); + for ( i = start; i < end; i += dim ) { last = insertNode( i, data[ i ], data[ i + 1 ], last ); } } else { - for ( i = end - dim; i >= start; i -= dim ) last = insertNode( i, data[ i ], data[ i + 1 ], last ); + for ( i = end - dim; i >= start; i -= dim ) { last = insertNode( i, data[ i ], data[ i + 1 ], last ); } } @@ -28750,8 +28759,8 @@ // eliminate colinear or duplicate points function filterPoints( start, end ) { - if ( ! start ) return start; - if ( ! end ) end = start; + if ( ! start ) { return start; } + if ( ! end ) { end = start; } var p = start, again; @@ -28763,7 +28772,7 @@ removeNode( p ); p = end = p.prev; - if ( p === p.next ) break; + if ( p === p.next ) { break; } again = true; } else { @@ -28781,10 +28790,10 @@ // main ear slicing loop which triangulates a polygon (given as a linked list) function earcutLinked( ear, triangles, dim, minX, minY, invSize, pass ) { - if ( ! ear ) return; + if ( ! ear ) { return; } // interlink polygon nodes in z-order - if ( ! pass && invSize ) indexCurve( ear, minX, minY, invSize ); + if ( ! pass && invSize ) { indexCurve( ear, minX, minY, invSize ); } var stop = ear, prev, next; @@ -28852,7 +28861,7 @@ b = ear, c = ear.next; - if ( area( a, b, c ) >= 0 ) return false; // reflex, can't be an ear + if ( area( a, b, c ) >= 0 ) { return false; } // reflex, can't be an ear // now make sure we don't have other points inside the potential ear var p = ear.next.next; @@ -28860,7 +28869,7 @@ while ( p !== ear.prev ) { if ( pointInTriangle( a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y ) && - area( p.prev, p, p.next ) >= 0 ) return false; + area( p.prev, p, p.next ) >= 0 ) { return false; } p = p.next; } @@ -28875,7 +28884,7 @@ b = ear, c = ear.next; - if ( area( a, b, c ) >= 0 ) return false; // reflex, can't be an ear + if ( area( a, b, c ) >= 0 ) { return false; } // reflex, can't be an ear // triangle bbox; min & max are calculated like this for speed var minTX = a.x < b.x ? ( a.x < c.x ? a.x : c.x ) : ( b.x < c.x ? b.x : c.x ), @@ -28895,12 +28904,12 @@ if ( p !== ear.prev && p !== ear.next && pointInTriangle( a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y ) && - area( p.prev, p, p.next ) >= 0 ) return false; + area( p.prev, p, p.next ) >= 0 ) { return false; } p = p.prevZ; if ( n !== ear.prev && n !== ear.next && pointInTriangle( a.x, a.y, b.x, b.y, c.x, c.y, n.x, n.y ) && - area( n.prev, n, n.next ) >= 0 ) return false; + area( n.prev, n, n.next ) >= 0 ) { return false; } n = n.nextZ; } @@ -28910,7 +28919,7 @@ if ( p !== ear.prev && p !== ear.next && pointInTriangle( a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y ) && - area( p.prev, p, p.next ) >= 0 ) return false; + area( p.prev, p, p.next ) >= 0 ) { return false; } p = p.prevZ; } @@ -28920,7 +28929,7 @@ if ( n !== ear.prev && n !== ear.next && pointInTriangle( a.x, a.y, b.x, b.y, c.x, c.y, n.x, n.y ) && - area( n.prev, n, n.next ) >= 0 ) return false; + area( n.prev, n, n.next ) >= 0 ) { return false; } n = n.nextZ; } @@ -29007,7 +29016,7 @@ start = holeIndices[ i ] * dim; end = i < len - 1 ? holeIndices[ i + 1 ] * dim : data.length; list = linkedList( data, start, end, dim, false ); - if ( list === list.next ) list.steiner = true; + if ( list === list.next ) { list.steiner = true; } queue.push( getLeftmost( list ) ); } @@ -29066,8 +29075,8 @@ qx = x; if ( x === hx ) { - if ( hy === p.y ) return p; - if ( hy === p.next.y ) return p.next; + if ( hy === p.y ) { return p; } + if ( hy === p.next.y ) { return p.next; } } @@ -29081,9 +29090,9 @@ } while ( p !== outerNode ); - if ( ! m ) return null; + if ( ! m ) { return null; } - if ( hx === qx ) return m.prev; // hole touches outer segment; pick lower endpoint + if ( hx === qx ) { return m.prev; } // hole touches outer segment; pick lower endpoint // look for points inside the triangle of hole point, segment intersection and endpoint; // if there are no points found, we have a valid connection; @@ -29127,7 +29136,7 @@ var p = start; do { - if ( p.z === null ) p.z = zOrder( p.x, p.y, minX, minY, invSize ); + if ( p.z === null ) { p.z = zOrder( p.x, p.y, minX, minY, invSize ); } p.prevZ = p.prev; p.nextZ = p.next; p = p.next; @@ -29164,7 +29173,7 @@ pSize ++; q = q.nextZ; - if ( ! q ) break; + if ( ! q ) { break; } } @@ -29186,8 +29195,8 @@ } - if ( tail ) tail.nextZ = e; - else list = e; + if ( tail ) { tail.nextZ = e; } + else { list = e; } e.prevZ = tail; tail = e; @@ -29235,7 +29244,7 @@ leftmost = start; do { - if ( p.x < leftmost.x || ( p.x === leftmost.x && p.y < leftmost.y ) ) leftmost = p; + if ( p.x < leftmost.x || ( p.x === leftmost.x && p.y < leftmost.y ) ) { leftmost = p; } p = p.next; } while ( p !== start ); @@ -29279,7 +29288,7 @@ function intersects( p1, q1, p2, q2 ) { if ( ( equals( p1, p2 ) && equals( q1, q2 ) ) || - ( equals( p1, q2 ) && equals( p2, q1 ) ) ) return true; + ( equals( p1, q2 ) && equals( p2, q1 ) ) ) { return true; } return area( p1, q1, p2 ) > 0 !== area( p1, q1, q2 ) > 0 && area( p2, q2, p1 ) > 0 !== area( p2, q2, q1 ) > 0; @@ -29292,7 +29301,7 @@ do { if ( p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i && - intersects( p, p.next, a, b ) ) return true; + intersects( p, p.next, a, b ) ) { return true; } p = p.next; } while ( p !== a ); @@ -29321,7 +29330,7 @@ if ( ( ( p.y > py ) !== ( p.next.y > py ) ) && p.next.y !== p.y && ( px < ( p.next.x - p.x ) * ( py - p.y ) / ( p.next.y - p.y ) + p.x ) ) - inside = ! inside; + { inside = ! inside; } p = p.next; } while ( p !== a ); @@ -29383,8 +29392,8 @@ p.next.prev = p.prev; p.prev.next = p.next; - if ( p.prevZ ) p.prevZ.nextZ = p.nextZ; - if ( p.nextZ ) p.nextZ.prevZ = p.prevZ; + if ( p.prevZ ) { p.prevZ.nextZ = p.nextZ; } + if ( p.nextZ ) { p.nextZ.prevZ = p.prevZ; } } @@ -29727,7 +29736,7 @@ function scalePt2( pt, vec, size ) { - if ( ! vec ) console.error( "THREE.ExtrudeGeometry: vec does not exist" ); + if ( ! vec ) { console.error( "THREE.ExtrudeGeometry: vec does not exist" ); } return vec.clone().multiplyScalar( size ).add( pt ); @@ -29868,8 +29877,8 @@ for ( var i = 0, il = contour.length, j = il - 1, k = i + 1; i < il; i ++, j ++, k ++ ) { - if ( j === il ) j = 0; - if ( k === il ) k = 0; + if ( j === il ) { j = 0; } + if ( k === il ) { k = 0; } // (j)---(i)---(k) // console.log('i,j,k', i, j , k) @@ -29889,8 +29898,8 @@ for ( i = 0, il = ahole.length, j = il - 1, k = i + 1; i < il; i ++, j ++, k ++ ) { - if ( j === il ) j = 0; - if ( k === il ) k = 0; + if ( j === il ) { j = 0; } + if ( k === il ) { k = 0; } // (j)---(i)---(k) oneHoleMovements[ i ] = getBevelVec( ahole[ i ], ahole[ j ], ahole[ k ] ); @@ -30150,7 +30159,7 @@ j = i; k = i - 1; - if ( k < 0 ) k = contour.length - 1; + if ( k < 0 ) { k = contour.length - 1; } //console.log('b', i,j, i-1, k,vertices.length); @@ -30340,7 +30349,7 @@ // - if ( options.extrudePath !== undefined ) data.options.extrudePath = options.extrudePath.toJSON(); + if ( options.extrudePath !== undefined ) { data.options.extrudePath = options.extrudePath.toJSON(); } return data; @@ -30410,9 +30419,9 @@ // defaults - if ( parameters.bevelThickness === undefined ) parameters.bevelThickness = 10; - if ( parameters.bevelSize === undefined ) parameters.bevelSize = 8; - if ( parameters.bevelEnabled === undefined ) parameters.bevelEnabled = false; + if ( parameters.bevelThickness === undefined ) { parameters.bevelThickness = 10; } + if ( parameters.bevelSize === undefined ) { parameters.bevelSize = 8; } + if ( parameters.bevelEnabled === undefined ) { parameters.bevelEnabled = false; } ExtrudeBufferGeometry.call( this, shapes, parameters ); @@ -30563,8 +30572,8 @@ var c = grid[ iy + 1 ][ ix ]; var d = grid[ iy + 1 ][ ix + 1 ]; - if ( iy !== 0 || thetaStart > 0 ) indices.push( a, b, d ); - if ( iy !== heightSegments - 1 || thetaEnd < Math.PI ) indices.push( b, c, d ); + if ( iy !== 0 || thetaStart > 0 ) { indices.push( a, b, d ); } + if ( iy !== heightSegments - 1 || thetaEnd < Math.PI ) { indices.push( b, c, d ); } } @@ -31306,8 +31315,8 @@ if ( openEnded === false ) { - if ( radiusTop > 0 ) generateCap( true ); - if ( radiusBottom > 0 ) generateCap( false ); + if ( radiusTop > 0 ) { generateCap( true ); } + if ( radiusBottom > 0 ) { generateCap( false ); } } @@ -32031,8 +32040,8 @@ this.clearcoat = source.clearcoat; this.clearcoatRoughness = source.clearcoatRoughness; - if ( source.sheen ) this.sheen = ( this.sheen || new Color() ).copy( source.sheen ); - else this.sheen = null; + if ( source.sheen ) { this.sheen = ( this.sheen || new Color() ).copy( source.sheen ); } + else { this.sheen = null; } this.clearcoatNormalMap = source.clearcoatNormalMap; this.clearcoatNormalScale.copy( source.clearcoatNormalScale ); @@ -32659,7 +32668,7 @@ convertArray: function ( array, type, forceClone ) { if ( ! array || // let 'undefined' and 'null' pass - ! forceClone && array.constructor === type ) return array; + ! forceClone && array.constructor === type ) { return array; } if ( typeof type.BYTES_PER_ELEMENT === 'number' ) { @@ -32689,7 +32698,7 @@ var n = times.length; var result = new Array( n ); - for ( var i = 0; i !== n; ++ i ) result[ i ] = i; + for ( var i = 0; i !== n; ++ i ) { result[ i ] = i; } result.sort( compareTime ); @@ -32730,10 +32739,10 @@ } - if ( key === undefined ) return; // no data + if ( key === undefined ) { return; } // no data var value = key[ valuePropertyName ]; - if ( value === undefined ) return; // no data + if ( value === undefined ) { return; } // no data if ( Array.isArray( value ) ) { @@ -32858,7 +32867,7 @@ if ( t1 === undefined ) { - if ( t < t0 ) break forward_scan; + if ( t < t0 ) { break forward_scan; } // after end @@ -32868,7 +32877,7 @@ } - if ( i1 === giveUpAt ) break; // this loop + if ( i1 === giveUpAt ) { break; } // this loop t0 = t1; t1 = pp[ ++ i1 ]; @@ -32916,7 +32925,7 @@ } - if ( i1 === giveUpAt ) break; // this loop + if ( i1 === giveUpAt ) { break; } // this loop t1 = t0; t0 = pp[ -- i1 - 1 ]; @@ -33281,8 +33290,8 @@ function KeyframeTrack( name, times, values, interpolation ) { - if ( name === undefined ) throw new Error( 'THREE.KeyframeTrack: track name is undefined' ); - if ( times === undefined || times.length === 0 ) throw new Error( 'THREE.KeyframeTrack: no keyframes in track named ' + name ); + if ( name === undefined ) { throw new Error( 'THREE.KeyframeTrack: track name is undefined' ); } + if ( times === undefined || times.length === 0 ) { throw new Error( 'THREE.KeyframeTrack: no keyframes in track named ' + name ); } this.name = name; @@ -33515,7 +33524,7 @@ if ( from !== 0 || to !== nKeys ) { // empty tracks are forbidden, so keep at least one keyframe - if ( from >= to ) to = Math.max( to, 1 ), from = to - 1; + if ( from >= to ) { to = Math.max( to, 1 ), from = to - 1; } var stride = this.getValueSize(); this.times = AnimationUtils.arraySlice( times, from, to ); @@ -34251,7 +34260,7 @@ var animationKeys = hierarchyTracks[ h ].keys; // skip empty tracks - if ( ! animationKeys || animationKeys.length === 0 ) continue; + if ( ! animationKeys || animationKeys.length === 0 ) { continue; } // process morph targets if ( animationKeys[ 0 ].morphTargets ) { @@ -34419,7 +34428,7 @@ add: function ( key, file ) { - if ( this.enabled === false ) return; + if ( this.enabled === false ) { return; } // console.log( 'THREE.Cache', 'Adding key:', key ); @@ -34429,7 +34438,7 @@ get: function ( key ) { - if ( this.enabled === false ) return; + if ( this.enabled === false ) { return; } // console.log( 'THREE.Cache', 'Checking key:', key ); @@ -34643,9 +34652,9 @@ load: function ( url, onLoad, onProgress, onError ) { - if ( url === undefined ) url = ''; + if ( url === undefined ) { url = ''; } - if ( this.path !== undefined ) url = this.path + url; + if ( this.path !== undefined ) { url = this.path + url; } url = this.manager.resolveURL( url ); @@ -34659,7 +34668,7 @@ setTimeout( function () { - if ( onLoad ) onLoad( cached ); + if ( onLoad ) { onLoad( cached ); } scope.manager.itemEnd( url ); @@ -34698,7 +34707,7 @@ data = decodeURIComponent( data ); - if ( isBase64 ) data = atob( data ); + if ( isBase64 ) { data = atob( data ); } try { @@ -34754,7 +34763,7 @@ // Wait for next browser tick like standard XMLHttpRequest event dispatching does setTimeout( function () { - if ( onLoad ) onLoad( response ); + if ( onLoad ) { onLoad( response ); } scope.manager.itemEnd( url ); @@ -34765,7 +34774,7 @@ // Wait for next browser tick like standard XMLHttpRequest event dispatching does setTimeout( function () { - if ( onError ) onError( error ); + if ( onError ) { onError( error ); } scope.manager.itemError( url ); scope.manager.itemEnd( url ); @@ -34807,12 +34816,12 @@ // Some browsers return HTTP Status 0 when using non-http protocol // e.g. 'file://' or 'data://'. Handle as success. - if ( this.status === 0 ) console.warn( 'THREE.FileLoader: HTTP Status 0 received.' ); + if ( this.status === 0 ) { console.warn( 'THREE.FileLoader: HTTP Status 0 received.' ); } for ( var i = 0, il = callbacks.length; i < il; i ++ ) { var callback = callbacks[ i ]; - if ( callback.onLoad ) callback.onLoad( response ); + if ( callback.onLoad ) { callback.onLoad( response ); } } @@ -34823,7 +34832,7 @@ for ( var i = 0, il = callbacks.length; i < il; i ++ ) { var callback = callbacks[ i ]; - if ( callback.onError ) callback.onError( event ); + if ( callback.onError ) { callback.onError( event ); } } @@ -34841,7 +34850,7 @@ for ( var i = 0, il = callbacks.length; i < il; i ++ ) { var callback = callbacks[ i ]; - if ( callback.onProgress ) callback.onProgress( event ); + if ( callback.onProgress ) { callback.onProgress( event ); } } @@ -34856,7 +34865,7 @@ for ( var i = 0, il = callbacks.length; i < il; i ++ ) { var callback = callbacks[ i ]; - if ( callback.onError ) callback.onError( event ); + if ( callback.onError ) { callback.onError( event ); } } @@ -34874,7 +34883,7 @@ for ( var i = 0, il = callbacks.length; i < il; i ++ ) { var callback = callbacks[ i ]; - if ( callback.onError ) callback.onError( event ); + if ( callback.onError ) { callback.onError( event ); } } @@ -34883,10 +34892,10 @@ }, false ); - if ( this.responseType !== undefined ) request.responseType = this.responseType; - if ( this.withCredentials !== undefined ) request.withCredentials = this.withCredentials; + if ( this.responseType !== undefined ) { request.responseType = this.responseType; } + if ( this.withCredentials !== undefined ) { request.withCredentials = this.withCredentials; } - if ( request.overrideMimeType ) request.overrideMimeType( this.mimeType !== undefined ? this.mimeType : 'text/plain' ); + if ( request.overrideMimeType ) { request.overrideMimeType( this.mimeType !== undefined ? this.mimeType : 'text/plain' ); } for ( var header in this.requestHeader ) { @@ -35029,12 +35038,12 @@ if ( loaded === 6 ) { if ( texDatas.mipmapCount === 1 ) - texture.minFilter = LinearFilter; + { texture.minFilter = LinearFilter; } texture.format = texDatas.format; texture.needsUpdate = true; - if ( onLoad ) onLoad( texture ); + if ( onLoad ) { onLoad( texture ); } } @@ -35096,7 +35105,7 @@ texture.format = texDatas.format; texture.needsUpdate = true; - if ( onLoad ) onLoad( texture ); + if ( onLoad ) { onLoad( texture ); } }, onProgress, onError ); @@ -35139,7 +35148,7 @@ var texData = scope.parse( buffer ); - if ( ! texData ) return; + if ( ! texData ) { return; } if ( texData.image !== undefined ) { @@ -35186,7 +35195,7 @@ texture.needsUpdate = true; - if ( onLoad ) onLoad( texture, texData ); + if ( onLoad ) { onLoad( texture, texData ); } }, onProgress, onError ); @@ -35213,7 +35222,7 @@ load: function ( url, onLoad, onProgress, onError ) { - if ( this.path !== undefined ) url = this.path + url; + if ( this.path !== undefined ) { url = this.path + url; } url = this.manager.resolveURL( url ); @@ -35227,7 +35236,7 @@ setTimeout( function () { - if ( onLoad ) onLoad( cached ); + if ( onLoad ) { onLoad( cached ); } scope.manager.itemEnd( url ); @@ -35246,7 +35255,7 @@ Cache.add( url, this ); - if ( onLoad ) onLoad( this ); + if ( onLoad ) { onLoad( this ); } scope.manager.itemEnd( url ); @@ -35257,7 +35266,7 @@ image.removeEventListener( 'load', onImageLoad, false ); image.removeEventListener( 'error', onImageError, false ); - if ( onError ) onError( event ); + if ( onError ) { onError( event ); } scope.manager.itemError( url ); scope.manager.itemEnd( url ); @@ -35269,7 +35278,7 @@ if ( url.substr( 0, 5 ) !== 'data:' ) { - if ( this.crossOrigin !== undefined ) image.crossOrigin = this.crossOrigin; + if ( this.crossOrigin !== undefined ) { image.crossOrigin = this.crossOrigin; } } @@ -35320,7 +35329,7 @@ texture.needsUpdate = true; - if ( onLoad ) onLoad( texture ); + if ( onLoad ) { onLoad( texture ); } } @@ -35455,7 +35464,7 @@ getPoints: function ( divisions ) { - if ( divisions === undefined ) divisions = 5; + if ( divisions === undefined ) { divisions = 5; } var points = []; @@ -35473,7 +35482,7 @@ getSpacedPoints: function ( divisions ) { - if ( divisions === undefined ) divisions = 5; + if ( divisions === undefined ) { divisions = 5; } var points = []; @@ -35500,7 +35509,7 @@ getLengths: function ( divisions ) { - if ( divisions === undefined ) divisions = this.arcLengthDivisions; + if ( divisions === undefined ) { divisions = this.arcLengthDivisions; } if ( this.cacheArcLengths && ( this.cacheArcLengths.length === divisions + 1 ) && @@ -35629,8 +35638,8 @@ // Capping in case of danger - if ( t1 < 0 ) t1 = 0; - if ( t2 > 1 ) t2 = 1; + if ( t1 < 0 ) { t1 = 0; } + if ( t2 > 1 ) { t2 = 1; } var pt1 = this.getPoint( t1 ); var pt2 = this.getPoint( t2 ); @@ -35840,8 +35849,8 @@ var samePoints = Math.abs( deltaAngle ) < Number.EPSILON; // ensures that deltaAngle is 0 .. 2 PI - while ( deltaAngle < 0 ) deltaAngle += twoPi; - while ( deltaAngle > twoPi ) deltaAngle -= twoPi; + while ( deltaAngle < 0 ) { deltaAngle += twoPi; } + while ( deltaAngle > twoPi ) { deltaAngle -= twoPi; } if ( deltaAngle < Number.EPSILON ) { @@ -36130,9 +36139,9 @@ var dt2 = Math.pow( p2.distanceToSquared( p3 ), pow ); // safety check for repeated points - if ( dt1 < 1e-4 ) dt1 = 1.0; - if ( dt0 < 1e-4 ) dt0 = dt1; - if ( dt2 < 1e-4 ) dt2 = dt1; + if ( dt1 < 1e-4 ) { dt1 = 1.0; } + if ( dt0 < 1e-4 ) { dt0 = dt1; } + if ( dt2 < 1e-4 ) { dt2 = dt1; } px.initNonuniformCatmullRom( p0.x, p1.x, p2.x, p3.x, dt0, dt1, dt2 ); py.initNonuniformCatmullRom( p0.y, p1.y, p2.y, p3.y, dt0, dt1, dt2 ); @@ -36987,7 +36996,7 @@ getSpacedPoints: function ( divisions ) { - if ( divisions === undefined ) divisions = 40; + if ( divisions === undefined ) { divisions = 40; } var points = []; @@ -37027,7 +37036,7 @@ var point = pts[ j ]; - if ( last && last.equals( point ) ) continue; // ensures no consecutive points are duplicates + if ( last && last.equals( point ) ) { continue; } // ensures no consecutive points are duplicates points.push( point ); last = point; @@ -37429,14 +37438,14 @@ data.object.color = this.color.getHex(); data.object.intensity = this.intensity; - if ( this.groundColor !== undefined ) data.object.groundColor = this.groundColor.getHex(); + if ( this.groundColor !== undefined ) { data.object.groundColor = this.groundColor.getHex(); } - if ( this.distance !== undefined ) data.object.distance = this.distance; - if ( this.angle !== undefined ) data.object.angle = this.angle; - if ( this.decay !== undefined ) data.object.decay = this.decay; - if ( this.penumbra !== undefined ) data.object.penumbra = this.penumbra; + if ( this.distance !== undefined ) { data.object.distance = this.distance; } + if ( this.angle !== undefined ) { data.object.angle = this.angle; } + if ( this.decay !== undefined ) { data.object.decay = this.decay; } + if ( this.penumbra !== undefined ) { data.object.penumbra = this.penumbra; } - if ( this.shadow !== undefined ) data.object.shadow = this.shadow.toJSON(); + if ( this.shadow !== undefined ) { data.object.shadow = this.shadow.toJSON(); } return data; @@ -37596,9 +37605,9 @@ var object = {}; - if ( this.bias !== 0 ) object.bias = this.bias; - if ( this.radius !== 1 ) object.radius = this.radius; - if ( this.mapSize.x !== 512 || this.mapSize.y !== 512 ) object.mapSize = this.mapSize.toArray(); + if ( this.bias !== 0 ) { object.bias = this.bias; } + if ( this.radius !== 1 ) { object.radius = this.radius; } + if ( this.mapSize.x !== 512 || this.mapSize.y !== 512 ) { object.mapSize = this.mapSize.toArray(); } object.camera = this.camera.toJSON( false ).object; delete object.camera.matrix; @@ -37984,7 +37993,7 @@ data.object.near = this.near; data.object.far = this.far; - if ( this.view !== null ) data.object.view = Object.assign( {}, this.view ); + if ( this.view !== null ) { data.object.view = Object.assign( {}, this.view ); } return data; @@ -38171,54 +38180,54 @@ var material = new Materials[ json.type ](); - if ( json.uuid !== undefined ) material.uuid = json.uuid; - if ( json.name !== undefined ) material.name = json.name; - if ( json.color !== undefined ) material.color.setHex( json.color ); - if ( json.roughness !== undefined ) material.roughness = json.roughness; - if ( json.metalness !== undefined ) material.metalness = json.metalness; - if ( json.emissive !== undefined ) material.emissive.setHex( json.emissive ); - if ( json.specular !== undefined ) material.specular.setHex( json.specular ); - if ( json.shininess !== undefined ) material.shininess = json.shininess; - if ( json.clearcoat !== undefined ) material.clearcoat = json.clearcoat; - if ( json.clearcoatRoughness !== undefined ) material.clearcoatRoughness = json.clearcoatRoughness; - if ( json.vertexColors !== undefined ) material.vertexColors = json.vertexColors; - if ( json.fog !== undefined ) material.fog = json.fog; - if ( json.flatShading !== undefined ) material.flatShading = json.flatShading; - if ( json.blending !== undefined ) material.blending = json.blending; - if ( json.combine !== undefined ) material.combine = json.combine; - if ( json.side !== undefined ) material.side = json.side; - if ( json.opacity !== undefined ) material.opacity = json.opacity; - if ( json.transparent !== undefined ) material.transparent = json.transparent; - if ( json.alphaTest !== undefined ) material.alphaTest = json.alphaTest; - if ( json.depthTest !== undefined ) material.depthTest = json.depthTest; - if ( json.depthWrite !== undefined ) material.depthWrite = json.depthWrite; - if ( json.colorWrite !== undefined ) material.colorWrite = json.colorWrite; - if ( json.wireframe !== undefined ) material.wireframe = json.wireframe; - if ( json.wireframeLinewidth !== undefined ) material.wireframeLinewidth = json.wireframeLinewidth; - if ( json.wireframeLinecap !== undefined ) material.wireframeLinecap = json.wireframeLinecap; - if ( json.wireframeLinejoin !== undefined ) material.wireframeLinejoin = json.wireframeLinejoin; - - if ( json.rotation !== undefined ) material.rotation = json.rotation; - - if ( json.linewidth !== 1 ) material.linewidth = json.linewidth; - if ( json.dashSize !== undefined ) material.dashSize = json.dashSize; - if ( json.gapSize !== undefined ) material.gapSize = json.gapSize; - if ( json.scale !== undefined ) material.scale = json.scale; - - if ( json.polygonOffset !== undefined ) material.polygonOffset = json.polygonOffset; - if ( json.polygonOffsetFactor !== undefined ) material.polygonOffsetFactor = json.polygonOffsetFactor; - if ( json.polygonOffsetUnits !== undefined ) material.polygonOffsetUnits = json.polygonOffsetUnits; - - if ( json.skinning !== undefined ) material.skinning = json.skinning; - if ( json.morphTargets !== undefined ) material.morphTargets = json.morphTargets; - if ( json.morphNormals !== undefined ) material.morphNormals = json.morphNormals; - if ( json.dithering !== undefined ) material.dithering = json.dithering; - - if ( json.visible !== undefined ) material.visible = json.visible; - - if ( json.toneMapped !== undefined ) material.toneMapped = json.toneMapped; - - if ( json.userData !== undefined ) material.userData = json.userData; + if ( json.uuid !== undefined ) { material.uuid = json.uuid; } + if ( json.name !== undefined ) { material.name = json.name; } + if ( json.color !== undefined ) { material.color.setHex( json.color ); } + if ( json.roughness !== undefined ) { material.roughness = json.roughness; } + if ( json.metalness !== undefined ) { material.metalness = json.metalness; } + if ( json.emissive !== undefined ) { material.emissive.setHex( json.emissive ); } + if ( json.specular !== undefined ) { material.specular.setHex( json.specular ); } + if ( json.shininess !== undefined ) { material.shininess = json.shininess; } + if ( json.clearcoat !== undefined ) { material.clearcoat = json.clearcoat; } + if ( json.clearcoatRoughness !== undefined ) { material.clearcoatRoughness = json.clearcoatRoughness; } + if ( json.vertexColors !== undefined ) { material.vertexColors = json.vertexColors; } + if ( json.fog !== undefined ) { material.fog = json.fog; } + if ( json.flatShading !== undefined ) { material.flatShading = json.flatShading; } + if ( json.blending !== undefined ) { material.blending = json.blending; } + if ( json.combine !== undefined ) { material.combine = json.combine; } + if ( json.side !== undefined ) { material.side = json.side; } + if ( json.opacity !== undefined ) { material.opacity = json.opacity; } + if ( json.transparent !== undefined ) { material.transparent = json.transparent; } + if ( json.alphaTest !== undefined ) { material.alphaTest = json.alphaTest; } + if ( json.depthTest !== undefined ) { material.depthTest = json.depthTest; } + if ( json.depthWrite !== undefined ) { material.depthWrite = json.depthWrite; } + if ( json.colorWrite !== undefined ) { material.colorWrite = json.colorWrite; } + if ( json.wireframe !== undefined ) { material.wireframe = json.wireframe; } + if ( json.wireframeLinewidth !== undefined ) { material.wireframeLinewidth = json.wireframeLinewidth; } + if ( json.wireframeLinecap !== undefined ) { material.wireframeLinecap = json.wireframeLinecap; } + if ( json.wireframeLinejoin !== undefined ) { material.wireframeLinejoin = json.wireframeLinejoin; } + + if ( json.rotation !== undefined ) { material.rotation = json.rotation; } + + if ( json.linewidth !== 1 ) { material.linewidth = json.linewidth; } + if ( json.dashSize !== undefined ) { material.dashSize = json.dashSize; } + if ( json.gapSize !== undefined ) { material.gapSize = json.gapSize; } + if ( json.scale !== undefined ) { material.scale = json.scale; } + + if ( json.polygonOffset !== undefined ) { material.polygonOffset = json.polygonOffset; } + if ( json.polygonOffsetFactor !== undefined ) { material.polygonOffsetFactor = json.polygonOffsetFactor; } + if ( json.polygonOffsetUnits !== undefined ) { material.polygonOffsetUnits = json.polygonOffsetUnits; } + + if ( json.skinning !== undefined ) { material.skinning = json.skinning; } + if ( json.morphTargets !== undefined ) { material.morphTargets = json.morphTargets; } + if ( json.morphNormals !== undefined ) { material.morphNormals = json.morphNormals; } + if ( json.dithering !== undefined ) { material.dithering = json.dithering; } + + if ( json.visible !== undefined ) { material.visible = json.visible; } + + if ( json.toneMapped !== undefined ) { material.toneMapped = json.toneMapped; } + + if ( json.userData !== undefined ) { material.userData = json.userData; } // Shader Material @@ -38268,9 +38277,9 @@ } - if ( json.defines !== undefined ) material.defines = json.defines; - if ( json.vertexShader !== undefined ) material.vertexShader = json.vertexShader; - if ( json.fragmentShader !== undefined ) material.fragmentShader = json.fragmentShader; + if ( json.defines !== undefined ) { material.defines = json.defines; } + if ( json.vertexShader !== undefined ) { material.vertexShader = json.vertexShader; } + if ( json.fragmentShader !== undefined ) { material.fragmentShader = json.fragmentShader; } if ( json.extensions !== undefined ) { @@ -38284,17 +38293,17 @@ // Deprecated - if ( json.shading !== undefined ) material.flatShading = json.shading === 1; // THREE.FlatShading + if ( json.shading !== undefined ) { material.flatShading = json.shading === 1; } // THREE.FlatShading // for PointsMaterial - if ( json.size !== undefined ) material.size = json.size; - if ( json.sizeAttenuation !== undefined ) material.sizeAttenuation = json.sizeAttenuation; + if ( json.size !== undefined ) { material.size = json.size; } + if ( json.sizeAttenuation !== undefined ) { material.sizeAttenuation = json.sizeAttenuation; } // maps - if ( json.map !== undefined ) material.map = getTexture( json.map ); - if ( json.matcap !== undefined ) material.matcap = getTexture( json.matcap ); + if ( json.map !== undefined ) { material.map = getTexture( json.map ); } + if ( json.matcap !== undefined ) { material.matcap = getTexture( json.matcap ); } if ( json.alphaMap !== undefined ) { @@ -38303,11 +38312,11 @@ } - if ( json.bumpMap !== undefined ) material.bumpMap = getTexture( json.bumpMap ); - if ( json.bumpScale !== undefined ) material.bumpScale = json.bumpScale; + if ( json.bumpMap !== undefined ) { material.bumpMap = getTexture( json.bumpMap ); } + if ( json.bumpScale !== undefined ) { material.bumpScale = json.bumpScale; } - if ( json.normalMap !== undefined ) material.normalMap = getTexture( json.normalMap ); - if ( json.normalMapType !== undefined ) material.normalMapType = json.normalMapType; + if ( json.normalMap !== undefined ) { material.normalMap = getTexture( json.normalMap ); } + if ( json.normalMapType !== undefined ) { material.normalMapType = json.normalMapType; } if ( json.normalScale !== undefined ) { var normalScale = json.normalScale; @@ -38324,34 +38333,34 @@ } - if ( json.displacementMap !== undefined ) material.displacementMap = getTexture( json.displacementMap ); - if ( json.displacementScale !== undefined ) material.displacementScale = json.displacementScale; - if ( json.displacementBias !== undefined ) material.displacementBias = json.displacementBias; + if ( json.displacementMap !== undefined ) { material.displacementMap = getTexture( json.displacementMap ); } + if ( json.displacementScale !== undefined ) { material.displacementScale = json.displacementScale; } + if ( json.displacementBias !== undefined ) { material.displacementBias = json.displacementBias; } - if ( json.roughnessMap !== undefined ) material.roughnessMap = getTexture( json.roughnessMap ); - if ( json.metalnessMap !== undefined ) material.metalnessMap = getTexture( json.metalnessMap ); + if ( json.roughnessMap !== undefined ) { material.roughnessMap = getTexture( json.roughnessMap ); } + if ( json.metalnessMap !== undefined ) { material.metalnessMap = getTexture( json.metalnessMap ); } - if ( json.emissiveMap !== undefined ) material.emissiveMap = getTexture( json.emissiveMap ); - if ( json.emissiveIntensity !== undefined ) material.emissiveIntensity = json.emissiveIntensity; + if ( json.emissiveMap !== undefined ) { material.emissiveMap = getTexture( json.emissiveMap ); } + if ( json.emissiveIntensity !== undefined ) { material.emissiveIntensity = json.emissiveIntensity; } - if ( json.specularMap !== undefined ) material.specularMap = getTexture( json.specularMap ); + if ( json.specularMap !== undefined ) { material.specularMap = getTexture( json.specularMap ); } - if ( json.envMap !== undefined ) material.envMap = getTexture( json.envMap ); - if ( json.envMapIntensity !== undefined ) material.envMapIntensity = json.envMapIntensity; + if ( json.envMap !== undefined ) { material.envMap = getTexture( json.envMap ); } + if ( json.envMapIntensity !== undefined ) { material.envMapIntensity = json.envMapIntensity; } - if ( json.reflectivity !== undefined ) material.reflectivity = json.reflectivity; - if ( json.refractionRatio !== undefined ) material.refractionRatio = json.refractionRatio; + if ( json.reflectivity !== undefined ) { material.reflectivity = json.reflectivity; } + if ( json.refractionRatio !== undefined ) { material.refractionRatio = json.refractionRatio; } - if ( json.lightMap !== undefined ) material.lightMap = getTexture( json.lightMap ); - if ( json.lightMapIntensity !== undefined ) material.lightMapIntensity = json.lightMapIntensity; + if ( json.lightMap !== undefined ) { material.lightMap = getTexture( json.lightMap ); } + if ( json.lightMapIntensity !== undefined ) { material.lightMapIntensity = json.lightMapIntensity; } - if ( json.aoMap !== undefined ) material.aoMap = getTexture( json.aoMap ); - if ( json.aoMapIntensity !== undefined ) material.aoMapIntensity = json.aoMapIntensity; + if ( json.aoMap !== undefined ) { material.aoMap = getTexture( json.aoMap ); } + if ( json.aoMapIntensity !== undefined ) { material.aoMapIntensity = json.aoMapIntensity; } - if ( json.gradientMap !== undefined ) material.gradientMap = getTexture( json.gradientMap ); + if ( json.gradientMap !== undefined ) { material.gradientMap = getTexture( json.gradientMap ); } - if ( json.clearcoatNormalMap !== undefined ) material.clearcoatNormalMap = getTexture( json.clearcoatNormalMap ); - if ( json.clearcoatNormalScale !== undefined ) material.clearcoatNormalScale = new Vector2().fromArray( json.clearcoatNormalScale ); + if ( json.clearcoatNormalMap !== undefined ) { material.clearcoatNormalMap = getTexture( json.clearcoatNormalMap ); } + if ( json.clearcoatNormalScale !== undefined ) { material.clearcoatNormalScale = new Vector2().fromArray( json.clearcoatNormalScale ); } return material; @@ -38410,7 +38419,7 @@ var index = url.lastIndexOf( '/' ); - if ( index === - 1 ) return './'; + if ( index === - 1 ) { return './'; } return url.substr( 0, index + 1 ); @@ -38568,7 +38577,7 @@ var typedArray = new TYPED_ARRAYS[ attribute.type ]( attribute.array ); var bufferAttributeConstr = attribute.isInstancedBufferAttribute ? InstancedBufferAttribute : BufferAttribute; var bufferAttribute = new bufferAttributeConstr( typedArray, attribute.itemSize, attribute.normalized ); - if ( attribute.name !== undefined ) bufferAttribute.name = attribute.name; + if ( attribute.name !== undefined ) { bufferAttribute.name = attribute.name; } geometry.addAttribute( key, bufferAttribute ); } @@ -38589,7 +38598,7 @@ var typedArray = new TYPED_ARRAYS[ attribute.type ]( attribute.array ); var bufferAttribute = new BufferAttribute( typedArray, attribute.itemSize, attribute.normalized ); - if ( attribute.name !== undefined ) bufferAttribute.name = attribute.name; + if ( attribute.name !== undefined ) { bufferAttribute.name = attribute.name; } array.push( bufferAttribute ); } @@ -38630,8 +38639,8 @@ } - if ( json.name ) geometry.name = json.name; - if ( json.userData ) geometry.userData = json.userData; + if ( json.name ) { geometry.name = json.name; } + if ( json.userData ) { geometry.userData = json.userData; } return geometry; @@ -38685,7 +38694,7 @@ } catch ( error ) { - if ( onError !== undefined ) onError( error ); + if ( onError !== undefined ) { onError( error ); } console.error( 'THREE:ObjectLoader: Can\'t parse ' + url + '.', error.message ); @@ -38715,7 +38724,7 @@ var images = this.parseImages( json.images, function () { - if ( onLoad !== undefined ) onLoad( object ); + if ( onLoad !== undefined ) { onLoad( object ); } } ); @@ -38732,7 +38741,7 @@ if ( json.images === undefined || json.images.length === 0 ) { - if ( onLoad !== undefined ) onLoad( object ); + if ( onLoad !== undefined ) { onLoad( object ); } } @@ -39038,8 +39047,8 @@ geometry.uuid = data.uuid; - if ( data.name !== undefined ) geometry.name = data.name; - if ( geometry.isBufferGeometry === true && data.userData !== undefined ) geometry.userData = data.userData; + if ( data.name !== undefined ) { geometry.name = data.name; } + if ( geometry.isBufferGeometry === true && data.userData !== undefined ) { geometry.userData = data.userData; } geometries[ data.uuid ] = geometry; @@ -39117,7 +39126,7 @@ var clip = AnimationClip.parse( data ); - if ( data.uuid !== undefined ) clip.uuid = data.uuid; + if ( data.uuid !== undefined ) { clip.uuid = data.uuid; } animations.push( clip ); @@ -39199,7 +39208,7 @@ function parseConstant( value, type ) { - if ( typeof value === 'number' ) return value; + if ( typeof value === 'number' ) { return value; } console.warn( 'THREE.ObjectLoader.parseTexture: Constant should be in numeric form.', value ); @@ -39243,14 +39252,14 @@ texture.uuid = data.uuid; - if ( data.name !== undefined ) texture.name = data.name; + if ( data.name !== undefined ) { texture.name = data.name; } - if ( data.mapping !== undefined ) texture.mapping = parseConstant( data.mapping, TEXTURE_MAPPING ); + if ( data.mapping !== undefined ) { texture.mapping = parseConstant( data.mapping, TEXTURE_MAPPING ); } - if ( data.offset !== undefined ) texture.offset.fromArray( data.offset ); - if ( data.repeat !== undefined ) texture.repeat.fromArray( data.repeat ); - if ( data.center !== undefined ) texture.center.fromArray( data.center ); - if ( data.rotation !== undefined ) texture.rotation = data.rotation; + if ( data.offset !== undefined ) { texture.offset.fromArray( data.offset ); } + if ( data.repeat !== undefined ) { texture.repeat.fromArray( data.repeat ); } + if ( data.center !== undefined ) { texture.center.fromArray( data.center ); } + if ( data.rotation !== undefined ) { texture.rotation = data.rotation; } if ( data.wrap !== undefined ) { @@ -39259,18 +39268,18 @@ } - if ( data.format !== undefined ) texture.format = data.format; - if ( data.type !== undefined ) texture.type = data.type; - if ( data.encoding !== undefined ) texture.encoding = data.encoding; + if ( data.format !== undefined ) { texture.format = data.format; } + if ( data.type !== undefined ) { texture.type = data.type; } + if ( data.encoding !== undefined ) { texture.encoding = data.encoding; } - if ( data.minFilter !== undefined ) texture.minFilter = parseConstant( data.minFilter, TEXTURE_FILTER ); - if ( data.magFilter !== undefined ) texture.magFilter = parseConstant( data.magFilter, TEXTURE_FILTER ); - if ( data.anisotropy !== undefined ) texture.anisotropy = data.anisotropy; + if ( data.minFilter !== undefined ) { texture.minFilter = parseConstant( data.minFilter, TEXTURE_FILTER ); } + if ( data.magFilter !== undefined ) { texture.magFilter = parseConstant( data.magFilter, TEXTURE_FILTER ); } + if ( data.anisotropy !== undefined ) { texture.anisotropy = data.anisotropy; } - if ( data.flipY !== undefined ) texture.flipY = data.flipY; + if ( data.flipY !== undefined ) { texture.flipY = data.flipY; } - if ( data.premultiplyAlpha !== undefined ) texture.premultiplyAlpha = data.premultiplyAlpha; - if ( data.unpackAlignment !== undefined ) texture.unpackAlignment = data.unpackAlignment; + if ( data.premultiplyAlpha !== undefined ) { texture.premultiplyAlpha = data.premultiplyAlpha; } + if ( data.unpackAlignment !== undefined ) { texture.unpackAlignment = data.unpackAlignment; } textures[ data.uuid ] = texture; @@ -39300,7 +39309,7 @@ function getMaterial( name ) { - if ( name === undefined ) return undefined; + if ( name === undefined ) { return undefined; } if ( Array.isArray( name ) ) { @@ -39370,11 +39379,11 @@ object = new PerspectiveCamera( data.fov, data.aspect, data.near, data.far ); - if ( data.focus !== undefined ) object.focus = data.focus; - if ( data.zoom !== undefined ) object.zoom = data.zoom; - if ( data.filmGauge !== undefined ) object.filmGauge = data.filmGauge; - if ( data.filmOffset !== undefined ) object.filmOffset = data.filmOffset; - if ( data.view !== undefined ) object.view = Object.assign( {}, data.view ); + if ( data.focus !== undefined ) { object.focus = data.focus; } + if ( data.zoom !== undefined ) { object.zoom = data.zoom; } + if ( data.filmGauge !== undefined ) { object.filmGauge = data.filmGauge; } + if ( data.filmOffset !== undefined ) { object.filmOffset = data.filmOffset; } + if ( data.view !== undefined ) { object.view = Object.assign( {}, data.view ); } break; @@ -39382,8 +39391,8 @@ object = new OrthographicCamera( data.left, data.right, data.top, data.bottom, data.near, data.far ); - if ( data.zoom !== undefined ) object.zoom = data.zoom; - if ( data.view !== undefined ) object.view = Object.assign( {}, data.view ); + if ( data.zoom !== undefined ) { object.zoom = data.zoom; } + if ( data.view !== undefined ) { object.view = Object.assign( {}, data.view ); } break; @@ -39442,7 +39451,7 @@ } - if ( data.drawMode !== undefined ) object.setDrawMode( data.drawMode ); + if ( data.drawMode !== undefined ) { object.setDrawMode( data.drawMode ); } break; @@ -39497,41 +39506,41 @@ object.uuid = data.uuid; - if ( data.name !== undefined ) object.name = data.name; + if ( data.name !== undefined ) { object.name = data.name; } if ( data.matrix !== undefined ) { object.matrix.fromArray( data.matrix ); - if ( data.matrixAutoUpdate !== undefined ) object.matrixAutoUpdate = data.matrixAutoUpdate; - if ( object.matrixAutoUpdate ) object.matrix.decompose( object.position, object.quaternion, object.scale ); + if ( data.matrixAutoUpdate !== undefined ) { object.matrixAutoUpdate = data.matrixAutoUpdate; } + if ( object.matrixAutoUpdate ) { object.matrix.decompose( object.position, object.quaternion, object.scale ); } } else { - if ( data.position !== undefined ) object.position.fromArray( data.position ); - if ( data.rotation !== undefined ) object.rotation.fromArray( data.rotation ); - if ( data.quaternion !== undefined ) object.quaternion.fromArray( data.quaternion ); - if ( data.scale !== undefined ) object.scale.fromArray( data.scale ); + if ( data.position !== undefined ) { object.position.fromArray( data.position ); } + if ( data.rotation !== undefined ) { object.rotation.fromArray( data.rotation ); } + if ( data.quaternion !== undefined ) { object.quaternion.fromArray( data.quaternion ); } + if ( data.scale !== undefined ) { object.scale.fromArray( data.scale ); } } - if ( data.castShadow !== undefined ) object.castShadow = data.castShadow; - if ( data.receiveShadow !== undefined ) object.receiveShadow = data.receiveShadow; + if ( data.castShadow !== undefined ) { object.castShadow = data.castShadow; } + if ( data.receiveShadow !== undefined ) { object.receiveShadow = data.receiveShadow; } if ( data.shadow ) { - if ( data.shadow.bias !== undefined ) object.shadow.bias = data.shadow.bias; - if ( data.shadow.radius !== undefined ) object.shadow.radius = data.shadow.radius; - if ( data.shadow.mapSize !== undefined ) object.shadow.mapSize.fromArray( data.shadow.mapSize ); - if ( data.shadow.camera !== undefined ) object.shadow.camera = this.parseObject( data.shadow.camera ); + if ( data.shadow.bias !== undefined ) { object.shadow.bias = data.shadow.bias; } + if ( data.shadow.radius !== undefined ) { object.shadow.radius = data.shadow.radius; } + if ( data.shadow.mapSize !== undefined ) { object.shadow.mapSize.fromArray( data.shadow.mapSize ); } + if ( data.shadow.camera !== undefined ) { object.shadow.camera = this.parseObject( data.shadow.camera ); } } - if ( data.visible !== undefined ) object.visible = data.visible; - if ( data.frustumCulled !== undefined ) object.frustumCulled = data.frustumCulled; - if ( data.renderOrder !== undefined ) object.renderOrder = data.renderOrder; - if ( data.userData !== undefined ) object.userData = data.userData; - if ( data.layers !== undefined ) object.layers.mask = data.layers; + if ( data.visible !== undefined ) { object.visible = data.visible; } + if ( data.frustumCulled !== undefined ) { object.frustumCulled = data.frustumCulled; } + if ( data.renderOrder !== undefined ) { object.renderOrder = data.renderOrder; } + if ( data.userData !== undefined ) { object.userData = data.userData; } + if ( data.layers !== undefined ) { object.layers.mask = data.layers; } if ( data.children !== undefined ) { @@ -39635,9 +39644,9 @@ load: function ( url, onLoad, onProgress, onError ) { - if ( url === undefined ) url = ''; + if ( url === undefined ) { url = ''; } - if ( this.path !== undefined ) url = this.path + url; + if ( this.path !== undefined ) { url = this.path + url; } url = this.manager.resolveURL( url ); @@ -39651,7 +39660,7 @@ setTimeout( function () { - if ( onLoad ) onLoad( cached ); + if ( onLoad ) { onLoad( cached ); } scope.manager.itemEnd( url ); @@ -39682,13 +39691,13 @@ Cache.add( url, imageBitmap ); - if ( onLoad ) onLoad( imageBitmap ); + if ( onLoad ) { onLoad( imageBitmap ); } scope.manager.itemEnd( url ); } ).catch( function ( e ) { - if ( onError ) onError( e ); + if ( onError ) { onError( e ); } scope.manager.itemError( url ); scope.manager.itemEnd( url ); @@ -39798,18 +39807,18 @@ edgeHighPt = inPolygon[ p ]; edgeDy = - edgeDy; } - if ( ( inPt.y < edgeLowPt.y ) || ( inPt.y > edgeHighPt.y ) ) continue; + if ( ( inPt.y < edgeLowPt.y ) || ( inPt.y > edgeHighPt.y ) ) { continue; } if ( inPt.y === edgeLowPt.y ) { - if ( inPt.x === edgeLowPt.x ) return true; // inPt is on contour ? + if ( inPt.x === edgeLowPt.x ) { return true; } // inPt is on contour ? // continue; // no intersection or edgeLowPt => doesn't count !!! } else { var perpEdge = edgeDy * ( inPt.x - edgeLowPt.x ) - edgeDx * ( inPt.y - edgeLowPt.y ); - if ( perpEdge === 0 ) return true; // inPt is on contour ? - if ( perpEdge < 0 ) continue; + if ( perpEdge === 0 ) { return true; } // inPt is on contour ? + if ( perpEdge < 0 ) { continue; } inside = ! inside; // true intersection left of inPt } @@ -39817,10 +39826,10 @@ } else { // parallel or collinear - if ( inPt.y !== edgeLowPt.y ) continue; // parallel + if ( inPt.y !== edgeLowPt.y ) { continue; } // parallel // edge lies on the same horizontal line as inPt if ( ( ( edgeHighPt.x <= inPt.x ) && ( inPt.x <= edgeLowPt.x ) ) || - ( ( edgeLowPt.x <= inPt.x ) && ( inPt.x <= edgeHighPt.x ) ) ) return true; // inPt: Point on contour ! + ( ( edgeLowPt.x <= inPt.x ) && ( inPt.x <= edgeHighPt.x ) ) ) { return true; } // inPt: Point on contour ! // continue; } @@ -39834,9 +39843,9 @@ var isClockWise = ShapeUtils.isClockWise; var subPaths = this.subPaths; - if ( subPaths.length === 0 ) return []; + if ( subPaths.length === 0 ) { return []; } - if ( noHoles === true ) return toShapesNoHoles( subPaths ); + if ( noHoles === true ) { return toShapesNoHoles( subPaths ); } var solid, tmpPath, tmpShape, shapes = []; @@ -39874,12 +39883,12 @@ if ( solid ) { - if ( ( ! holesFirst ) && ( newShapes[ mainIdx ] ) ) mainIdx ++; + if ( ( ! holesFirst ) && ( newShapes[ mainIdx ] ) ) { mainIdx ++; } newShapes[ mainIdx ] = { s: new Shape(), p: tmpPoints }; newShapes[ mainIdx ].s.curves = tmpPath.curves; - if ( holesFirst ) mainIdx ++; + if ( holesFirst ) { mainIdx ++; } newShapeHoles[ mainIdx ] = []; //console.log('cw', i); @@ -39895,7 +39904,7 @@ } // only Holes? -> probably all Shapes with wrong orientation - if ( ! newShapes[ 0 ] ) return toShapesNoHoles( subPaths ); + if ( ! newShapes[ 0 ] ) { return toShapesNoHoles( subPaths ); } if ( newShapes.length > 1 ) { @@ -39922,7 +39931,7 @@ if ( isPointInsidePolygon( ho.p, newShapes[ s2Idx ].p ) ) { - if ( sIdx !== s2Idx ) toChange.push( { froms: sIdx, tos: s2Idx, hole: hIdx } ); + if ( sIdx !== s2Idx ) { toChange.push( { froms: sIdx, tos: s2Idx, hole: hIdx } ); } if ( hole_unassigned ) { hole_unassigned = false; @@ -39950,7 +39959,7 @@ if ( toChange.length > 0 ) { // console.log("to change: ", toChange); - if ( ! ambiguous ) newShapeHoles = betterShapeHoles; + if ( ! ambiguous ) { newShapeHoles = betterShapeHoles; } } @@ -40000,7 +40009,7 @@ generateShapes: function ( text, size ) { - if ( size === undefined ) size = 100; + if ( size === undefined ) { size = 100; } var shapes = []; var paths = createPaths( text, size, this.data ); @@ -40165,7 +40174,7 @@ var font = scope.parse( json ); - if ( onLoad ) onLoad( font ); + if ( onLoad ) { onLoad( font ); } }, onProgress, onError ); @@ -40424,7 +40433,7 @@ fromArray: function ( array, offset ) { - if ( offset === undefined ) offset = 0; + if ( offset === undefined ) { offset = 0; } var coefficients = this.coefficients; @@ -40440,8 +40449,8 @@ toArray: function ( array, offset ) { - if ( array === undefined ) array = []; - if ( offset === undefined ) offset = 0; + if ( array === undefined ) { array = []; } + if ( offset === undefined ) { offset = 0; } var coefficients = this.coefficients; @@ -40995,7 +41004,7 @@ this.buffer = audioBuffer; this.sourceType = 'buffer'; - if ( this.autoplay ) this.play(); + if ( this.autoplay ) { this.play(); } return this; @@ -41132,7 +41141,7 @@ setFilters: function ( value ) { - if ( ! value ) value = []; + if ( ! value ) { value = []; } if ( this.isPlaying === true ) { @@ -41154,7 +41163,7 @@ this.detune = value; - if ( this.source.detune === undefined ) return; // only set detune when available + if ( this.source.detune === undefined ) { return; } // only set detune when available if ( this.isPlaying === true ) { @@ -41366,7 +41375,7 @@ Object3D.prototype.updateMatrixWorld.call( this, force ); - if ( this.hasPlaybackControl === true && this.isPlaying === false ) return; + if ( this.hasPlaybackControl === true && this.isPlaying === false ) { return; } this.matrixWorld.decompose( _position$3, _quaternion$4, _scale$2 ); @@ -41709,7 +41718,7 @@ binding = this._bindings[ firstValidIndex ]; // and only call .getValue on the first - if ( binding !== undefined ) binding.getValue( array, offset ); + if ( binding !== undefined ) { binding.getValue( array, offset ); } }, @@ -41880,7 +41889,7 @@ var result = searchNodeSubtree( childNode.children ); - if ( result ) return result; + if ( result ) { return result; } } @@ -42671,7 +42680,7 @@ index = indicesByPath[ path ], bindings = this._bindings; - if ( index !== undefined ) return bindings[ index ]; + if ( index !== undefined ) { return bindings[ index ]; } var paths = this._paths, parsedPaths = this._parsedPaths, @@ -43209,7 +43218,7 @@ if ( deltaTime === 0 ) { - if ( loopCount === - 1 ) return time; + if ( loopCount === - 1 ) { return time; } return ( pingPong && ( loopCount & 1 ) === 1 ) ? duration - time : time; @@ -43244,8 +43253,8 @@ } - if ( this.clampWhenFinished ) this.paused = true; - else this.enabled = false; + if ( this.clampWhenFinished ) { this.paused = true; } + else { this.enabled = false; } this.time = time; @@ -43295,8 +43304,8 @@ // have to stop (switch state, clamp time, fire event) - if ( this.clampWhenFinished ) this.paused = true; - else this.enabled = false; + if ( this.clampWhenFinished ) { this.paused = true; } + else { this.enabled = false; } time = deltaTime > 0 ? duration : 0; @@ -43958,12 +43967,12 @@ // also, take the clip from the prototype action if ( clipObject === null ) - clipObject = prototypeAction._clip; + { clipObject = prototypeAction._clip; } } // clip must be known when specified via string - if ( clipObject === null ) return null; + if ( clipObject === null ) { return null; } // allocate all resources required to run it var newAction = new AnimationAction( this, clipObject, optionalRoot ); @@ -44264,7 +44273,7 @@ function intersectObject( object, raycaster, intersects, recursive ) { - if ( object.visible === false ) return; + if ( object.visible === false ) { return; } object.raycast( raycaster, intersects ); @@ -45377,7 +45386,7 @@ // prevent hue shift var c = this.material.color; var max = Math.max( c.r, c.g, c.b ); - if ( max > 1 ) c.multiplyScalar( 1 / max ); + if ( max > 1 ) { c.multiplyScalar( 1 / max ); } this.children[ 0 ].material.color.copy( this.material.color ); @@ -45420,7 +45429,7 @@ geometry.rotateY( Math.PI * 0.5 ); this.material = new MeshBasicMaterial( { wireframe: true, fog: false } ); - if ( this.color === undefined ) this.material.vertexColors = VertexColors; + if ( this.color === undefined ) { this.material.vertexColors = VertexColors; } var position = geometry.getAttribute( 'position' ); var colors = new Float32Array( position.count * 3 ); @@ -45510,9 +45519,7 @@ ' gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );', - '}', - - ].join( '\n' ), + '}' ].join( '\n' ), fragmentShader: [ @@ -45859,7 +45866,7 @@ positionAttribute.needsUpdate = true; - if ( coneInnerAngle === coneOuterAngle ) this.material[ 0 ].visible = false; + if ( coneInnerAngle === coneOuterAngle ) { this.material[ 0 ].visible = false; } }; @@ -45998,7 +46005,7 @@ this.color = color; - if ( size === undefined ) size = 1; + if ( size === undefined ) { size = 1; } var geometry = new BufferGeometry(); geometry.addAttribute( 'position', new Float32BufferAttribute( [ @@ -46167,7 +46174,7 @@ LineSegments.call( this, geometry, material ); this.camera = camera; - if ( this.camera.updateProjectionMatrix ) this.camera.updateProjectionMatrix(); + if ( this.camera.updateProjectionMatrix ) { this.camera.updateProjectionMatrix(); } this.matrix = camera.matrixWorld; this.matrixAutoUpdate = false; @@ -46265,7 +46272,7 @@ this.object = object; - if ( color === undefined ) color = 0xffff00; + if ( color === undefined ) { color = 0xffff00; } var indices = new Uint16Array( [ 0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 4, 1, 5, 2, 6, 3, 7 ] ); var positions = new Float32Array( 8 * 3 ); @@ -46299,7 +46306,7 @@ } - if ( _box$2.isEmpty() ) return; + if ( _box$2.isEmpty() ) { return; } var min = _box$2.min; var max = _box$2.max; @@ -46399,7 +46406,7 @@ var box = this.box; - if ( box.isEmpty() ) return; + if ( box.isEmpty() ) { return; } box.getCenter( this.position ); @@ -46452,7 +46459,7 @@ var scale = - this.plane.constant; - if ( Math.abs( scale ) < 1e-8 ) scale = 1e-8; // sign does not matter + if ( Math.abs( scale ) < 1e-8 ) { scale = 1e-8; } // sign does not matter this.scale.set( 0.5 * this.size, 0.5 * this.size, scale ); @@ -46489,12 +46496,12 @@ Object3D.call( this ); - if ( dir === undefined ) dir = new Vector3( 0, 0, 1 ); - if ( origin === undefined ) origin = new Vector3( 0, 0, 0 ); - if ( length === undefined ) length = 1; - if ( color === undefined ) color = 0xffff00; - if ( headLength === undefined ) headLength = 0.2 * length; - if ( headWidth === undefined ) headWidth = 0.2 * headLength; + if ( dir === undefined ) { dir = new Vector3( 0, 0, 1 ); } + if ( origin === undefined ) { origin = new Vector3( 0, 0, 0 ); } + if ( length === undefined ) { length = 1; } + if ( color === undefined ) { color = 0xffff00; } + if ( headLength === undefined ) { headLength = 0.2 * length; } + if ( headWidth === undefined ) { headWidth = 0.2 * headLength; } if ( _lineGeometry === undefined ) { @@ -46550,8 +46557,8 @@ ArrowHelper.prototype.setLength = function ( length, headLength, headWidth ) { - if ( headLength === undefined ) headLength = 0.2 * length; - if ( headWidth === undefined ) headWidth = 0.2 * headLength; + if ( headLength === undefined ) { headLength = 0.2 * length; } + if ( headWidth === undefined ) { headWidth = 0.2 * headLength; } this.line.scale.set( 1, Math.max( 0, length - headLength ), 1 ); this.line.updateMatrix(); @@ -46644,7 +46651,7 @@ function MultiMaterial( materials ) { - if ( materials === undefined ) materials = []; + if ( materials === undefined ) { materials = []; } console.warn( 'THREE.MultiMaterial has been removed. Use an Array instead.' ); materials.isMultiMaterial = true; @@ -47567,7 +47574,7 @@ console.warn( "THREE.PerspectiveCamera.setLens is deprecated. " + "Use .setFocalLength and .filmGauge for a photographic setup." ); - if ( filmGauge !== undefined ) this.filmGauge = filmGauge; + if ( filmGauge !== undefined ) { this.filmGauge = filmGauge; } this.setFocalLength( focalLength ); }; @@ -48403,7 +48410,7 @@ var texture = loader.load( url, onLoad, undefined, onError ); - if ( mapping ) texture.mapping = mapping; + if ( mapping ) { texture.mapping = mapping; } return texture; @@ -48418,7 +48425,7 @@ var texture = loader.load( urls, onLoad, undefined, onError ); - if ( mapping ) texture.mapping = mapping; + if ( mapping ) { texture.mapping = mapping; } return texture; diff --git a/build/three.min.js b/build/three.min.js index db278e4afb7100..9fcc73ca207046 100644 --- a/build/three.min.js +++ b/build/three.min.js @@ -1,339 +1,338 @@ -(function(k,xa){"object"===typeof exports&&"undefined"!==typeof module?xa(exports):"function"===typeof define&&define.amd?define(["exports"],xa):(k=k||self,xa(k.THREE={}))})(this,function(k){function xa(){}function v(a,b){this.x=a||0;this.y=b||0}function na(a,b,c,d){this._x=a||0;this._y=b||0;this._z=c||0;this._w=void 0!==d?d:1}function n(a,b,c){this.x=a||0;this.y=b||0;this.z=c||0}function ta(){this.elements=[1,0,0,0,1,0,0,0,1];0h)return!1}return!0}function nb(a,b){this.center=void 0!==a?a:new n;this.radius=void 0!==b?b:0}function Sb(a,b){this.origin=void 0!==a?a:new n;this.direction=void 0!==b?b:new n}function ia(a,b,c){this.a=void 0!==a?a:new n;this.b=void 0!==b?b:new n;this.c=void 0!==c?c:new n}function J(a,b,c){return void 0===b&&void 0=== -c?this.set(a):this.setRGB(a,b,c)}function Sf(a,b,c){0>c&&(c+=1);1c?b:c<2/3?a+6*(b-a)*(2/3-c):a}function Tf(a){return.04045>a?.0773993808*a:Math.pow(.9478672986*a+.0521327014,2.4)}function Uf(a){return.0031308>a?12.92*a:1.055*Math.pow(a,.41666)-.055}function yc(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.normal=d&&d.isVector3?d:new n;this.vertexNormals=Array.isArray(d)?d:[];this.color=e&&e.isColor?e:new J;this.vertexColors=Array.isArray(e)?e:[];this.materialIndex= -void 0!==f?f:0}function Q(){Object.defineProperty(this,"id",{value:Ni++});this.uuid=O.generateUUID();this.name="";this.type="Material";this.lights=this.fog=!0;this.blending=1;this.side=0;this.vertexTangents=this.flatShading=!1;this.vertexColors=0;this.opacity=1;this.transparent=!1;this.blendSrc=204;this.blendDst=205;this.blendEquation=100;this.blendEquationAlpha=this.blendDstAlpha=this.blendSrcAlpha=null;this.depthFunc=3;this.depthWrite=this.depthTest=!0;this.stencilFunc=519;this.stencilRef=0;this.stencilMask= -255;this.stencilZPass=this.stencilZFail=this.stencilFail=7680;this.stencilWrite=!1;this.clippingPlanes=null;this.clipShadows=this.clipIntersection=!1;this.shadowSide=null;this.colorWrite=!0;this.precision=null;this.polygonOffset=!1;this.polygonOffsetUnits=this.polygonOffsetFactor=0;this.dithering=!1;this.alphaTest=0;this.premultipliedAlpha=!1;this.toneMapped=this.visible=!0;this.userData={};this.needsUpdate=!0}function ya(a){Q.call(this);this.type="MeshBasicMaterial";this.color=new J(16777215);this.lightMap= -this.map=null;this.lightMapIntensity=1;this.aoMap=null;this.aoMapIntensity=1;this.envMap=this.alphaMap=this.specularMap=null;this.combine=0;this.reflectivity=1;this.refractionRatio=.98;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.lights=this.morphTargets=this.skinning=!1;this.setValues(a)}function N(a,b,c){if(Array.isArray(a))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.name="";this.array=a;this.itemSize= -b;this.count=void 0!==a?a.length/b:0;this.normalized=!0===c;this.dynamic=!1;this.updateRange={offset:0,count:-1};this.version=0}function xd(a,b,c){N.call(this,new Int8Array(a),b,c)}function yd(a,b,c){N.call(this,new Uint8Array(a),b,c)}function zd(a,b,c){N.call(this,new Uint8ClampedArray(a),b,c)}function Ad(a,b,c){N.call(this,new Int16Array(a),b,c)}function Tb(a,b,c){N.call(this,new Uint16Array(a),b,c)}function Bd(a,b,c){N.call(this,new Int32Array(a),b,c)}function Ub(a,b,c){N.call(this,new Uint32Array(a), -b,c)}function A(a,b,c){N.call(this,new Float32Array(a),b,c)}function Cd(a,b,c){N.call(this,new Float64Array(a),b,c)}function dh(){this.vertices=[];this.normals=[];this.colors=[];this.uvs=[];this.uvs2=[];this.groups=[];this.morphTargets={};this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.groupsNeedUpdate=this.uvsNeedUpdate=this.colorsNeedUpdate=this.normalsNeedUpdate=this.verticesNeedUpdate=!1}function eh(a){if(0===a.length)return-Infinity;for(var b=a[0],c=1,d= -a.length;cb&&(b=a[c]);return b}function D(){Object.defineProperty(this,"id",{value:Oi+=2});this.uuid=O.generateUUID();this.name="";this.type="BufferGeometry";this.index=null;this.attributes={};this.morphAttributes={};this.groups=[];this.boundingSphere=this.boundingBox=null;this.drawRange={start:0,count:Infinity};this.userData={}}function ra(a,b){B.call(this);this.type="Mesh";this.geometry=void 0!==a?a:new D;this.material=void 0!==b?b:new ya({color:16777215*Math.random()});this.drawMode= -0;this.updateMorphTargets()}function fh(a,b,c,d,e,f,g,h){if(null===(1===b.side?d.intersectTriangle(g,f,e,!0,h):d.intersectTriangle(e,f,g,2!==b.side,h)))return null;De.copy(h);De.applyMatrix4(a.matrixWorld);b=c.ray.origin.distanceTo(De);return bc.far?null:{distance:b,point:De.clone(),object:a}}function Ee(a,b,c,d,e,f,g,h,l,m,p){Vb.fromBufferAttribute(e,l);Wb.fromBufferAttribute(e,m);Xb.fromBufferAttribute(e,p);e=a.morphTargetInfluences;if(b.morphTargets&&f&&e){Vf.set(0,0,0);Wf.set(0,0,0); -Xf.set(0,0,0);for(var u=0,r=f.length;ug;g++)a.setRenderTarget(f,g),a.clear(b,c,d);a.setRenderTarget(e)}}function Cb(a,b,c){Ka.call(this,a,b,c)}function Zb(a,b,c,d,e,f,g,h,l,m,p,u){ba.call(this,null,f,g,h,l,m,d,e,p,u);this.image={data:a,width:b,height:c};this.magFilter=void 0!==l?l:1003;this.minFilter=void 0!==m?m:1003;this.flipY=this.generateMipmaps=!1;this.unpackAlignment=1}function cb(a,b){this.normal=void 0!==a?a:new n(1,0,0);this.constant=void 0!==b?b:0}function Ed(a,b,c,d,e,f){this.planes=[void 0!==a?a: -new cb,void 0!==b?b:new cb,void 0!==c?c:new cb,void 0!==d?d:new cb,void 0!==e?e:new cb,void 0!==f?f:new cb]}function Zf(){function a(e,f){!1!==c&&(d(e,f),b.requestAnimationFrame(a))}var b=null,c=!1,d=null;return{start:function(){!0!==c&&null!==d&&(b.requestAnimationFrame(a),c=!0)},stop:function(){c=!1},setAnimationLoop:function(a){d=a},setContext:function(a){b=a}}}function Qi(a){function b(b,c){var d=b.array,e=b.dynamic?35048:35044,h=a.createBuffer();a.bindBuffer(c,h);a.bufferData(c,d,e);b.onUploadCallback(); -c=5126;d instanceof Float32Array?c=5126:d instanceof Float64Array?console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array."):d instanceof Uint16Array?c=5123:d instanceof Int16Array?c=5122:d instanceof Uint32Array?c=5125:d instanceof Int32Array?c=5124:d instanceof Int8Array?c=5120:d instanceof Uint8Array&&(c=5121);return{buffer:h,type:c,bytesPerElement:d.BYTES_PER_ELEMENT,version:b.version}}var c=new WeakMap;return{get:function(a){a.isInterleavedBufferAttribute&&(a=a.data); -return c.get(a)},remove:function(b){b.isInterleavedBufferAttribute&&(b=b.data);var d=c.get(b);d&&(a.deleteBuffer(d.buffer),c.delete(b))},update:function(d,e){d.isInterleavedBufferAttribute&&(d=d.data);var f=c.get(d);if(void 0===f)c.set(d,b(d,e));else if(f.versionm;m++){if(u=d[m])if(h=u[0],l=u[1]){p&&e.addAttribute("morphTarget"+m,p[h]);f&&e.addAttribute("morphNormal"+m,f[h]);c[m]=l;continue}c[m]=0}g.getUniforms().setValue(a,"morphTargetInfluences",c)}}}function aj(a,b){var c= -{};return{update:function(d){var e=b.render.frame,f=d.geometry,g=a.get(d,f);c[g.id]!==e&&(f.isGeometry&&g.updateFromObject(d),a.update(g),c[g.id]=e);return g},dispose:function(){c={}}}}function pb(a,b,c,d,e,f,g,h,l,m){a=void 0!==a?a:[];ba.call(this,a,void 0!==b?b:301,c,d,e,f,void 0!==g?g:1022,h,l,m);this.flipY=!1}function Ec(a,b,c,d){ba.call(this,null);this.image={data:a,width:b,height:c,depth:d};this.minFilter=this.magFilter=1003;this.wrapR=1001;this.flipY=this.generateMipmaps=!1}function Fc(a,b, -c,d){ba.call(this,null);this.image={data:a,width:b,height:c,depth:d};this.minFilter=this.magFilter=1003;this.wrapR=1001;this.flipY=this.generateMipmaps=!1}function Gc(a,b,c){var d=a[0];if(0>=d||0/gm, -function(a,c){a=K[c];if(void 0===a)throw Error("Can not resolve #include <"+c+">");return ag(a)})}function zh(a){return a.replace(/#pragma unroll_loop[\s]+?for \( int i = (\d+); i < (\d+); i \+\+ \) \{([\s\S]+?)(?=\})\}/g,function(a,c,d,e){a="";for(c=parseInt(c);ch)return!1}return!0}function nb(a,b){this.center=void 0!==a?a:new n;this.radius=void 0!==b?b:0}function Rb(a,b){this.origin=void 0!==a?a:new n;this.direction=void 0!==b?b:new n}function ca(a,b,c){this.a=void 0!==a?a:new n;this.b=void 0!==b?b:new n;this.c=void 0!==c?c:new n}function I(a,b,c){return void 0===b&&void 0=== +c?this.set(a):this.setRGB(a,b,c)}function Rf(a,b,c){0>c&&(c+=1);1c?b:c<2/3?a+6*(b-a)*(2/3-c):a}function Sf(a){return.04045>a?.0773993808*a:Math.pow(.9478672986*a+.0521327014,2.4)}function Tf(a){return.0031308>a?12.92*a:1.055*Math.pow(a,.41666)-.055}function zc(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.normal=d&&d.isVector3?d:new n;this.vertexNormals=Array.isArray(d)?d:[];this.color=e&&e.isColor?e:new I;this.vertexColors=Array.isArray(e)?e:[];this.materialIndex= +void 0!==f?f:0}function O(){Object.defineProperty(this,"id",{value:Mi++});this.uuid=N.generateUUID();this.name="";this.type="Material";this.lights=this.fog=!0;this.blending=1;this.side=0;this.vertexTangents=this.flatShading=!1;this.vertexColors=0;this.opacity=1;this.transparent=!1;this.blendSrc=204;this.blendDst=205;this.blendEquation=100;this.blendEquationAlpha=this.blendDstAlpha=this.blendSrcAlpha=null;this.depthFunc=3;this.depthWrite=this.depthTest=!0;this.stencilFunc=519;this.stencilRef=0;this.stencilMask= +255;this.stencilZPass=this.stencilZFail=this.stencilFail=7680;this.stencilWrite=!1;this.clippingPlanes=null;this.clipShadows=this.clipIntersection=!1;this.shadowSide=null;this.colorWrite=!0;this.precision=null;this.polygonOffset=!1;this.polygonOffsetUnits=this.polygonOffsetFactor=0;this.dithering=!1;this.alphaTest=0;this.premultipliedAlpha=!1;this.toneMapped=this.visible=!0;this.userData={};this.needsUpdate=!0}function Fa(a){O.call(this);this.type="MeshBasicMaterial";this.color=new I(16777215);this.lightMap= +this.map=null;this.lightMapIntensity=1;this.aoMap=null;this.aoMapIntensity=1;this.envMap=this.alphaMap=this.specularMap=null;this.combine=0;this.reflectivity=1;this.refractionRatio=.98;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.lights=this.morphTargets=this.skinning=!1;this.setValues(a)}function L(a,b,c){if(Array.isArray(a))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.name="";this.array=a;this.itemSize= +b;this.count=void 0!==a?a.length/b:0;this.normalized=!0===c;this.dynamic=!1;this.updateRange={offset:0,count:-1};this.version=0}function xd(a,b,c){L.call(this,new Int8Array(a),b,c)}function yd(a,b,c){L.call(this,new Uint8Array(a),b,c)}function zd(a,b,c){L.call(this,new Uint8ClampedArray(a),b,c)}function Ad(a,b,c){L.call(this,new Int16Array(a),b,c)}function Sb(a,b,c){L.call(this,new Uint16Array(a),b,c)}function Bd(a,b,c){L.call(this,new Int32Array(a),b,c)}function Tb(a,b,c){L.call(this,new Uint32Array(a), +b,c)}function B(a,b,c){L.call(this,new Float32Array(a),b,c)}function Cd(a,b,c){L.call(this,new Float64Array(a),b,c)}function eh(){this.vertices=[];this.normals=[];this.colors=[];this.uvs=[];this.uvs2=[];this.groups=[];this.morphTargets={};this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.groupsNeedUpdate=this.uvsNeedUpdate=this.colorsNeedUpdate=this.normalsNeedUpdate=this.verticesNeedUpdate=!1}function fh(a){if(0===a.length)return-Infinity;for(var b=a[0],c=1,d= +a.length;cb&&(b=a[c]);return b}function D(){Object.defineProperty(this,"id",{value:Ni+=2});this.uuid=N.generateUUID();this.name="";this.type="BufferGeometry";this.index=null;this.attributes={};this.morphAttributes={};this.groups=[];this.boundingSphere=this.boundingBox=null;this.drawRange={start:0,count:Infinity};this.userData={}}function ia(a,b){A.call(this);this.type="Mesh";this.geometry=void 0!==a?a:new D;this.material=void 0!==b?b:new Fa({color:16777215*Math.random()});this.drawMode= +0;this.updateMorphTargets()}function gh(a,b,c,d,e,f,g,h){if(null===(1===b.side?d.intersectTriangle(g,f,e,!0,h):d.intersectTriangle(e,f,g,2!==b.side,h)))return null;Ee.copy(h);Ee.applyMatrix4(a.matrixWorld);b=c.ray.origin.distanceTo(Ee);return bc.far?null:{distance:b,point:Ee.clone(),object:a}}function Fe(a,b,c,d,e,f,g,h,l,m,p){Ub.fromBufferAttribute(e,l);Vb.fromBufferAttribute(e,m);Wb.fromBufferAttribute(e,p);e=a.morphTargetInfluences;if(b.morphTargets&&f&&e){Uf.set(0,0,0);Vf.set(0,0,0); +Wf.set(0,0,0);for(var u=0,r=f.length;ug;g++)a.setRenderTarget(f,g),a.clear(b,c,d);a.setRenderTarget(e)}}function Ab(a,b,c){Ka.call(this,a,b,c)}function Yb(a,b,c,d,e,f,g,h,l,m,p,u){V.call(this,null,f,g,h,l,m,d,e,p,u);this.image={data:a,width:b, +height:c};this.magFilter=void 0!==l?l:1003;this.minFilter=void 0!==m?m:1003;this.flipY=this.generateMipmaps=!1;this.unpackAlignment=1}function cb(a,b){this.normal=void 0!==a?a:new n(1,0,0);this.constant=void 0!==b?b:0}function Ed(a,b,c,d,e,f){this.planes=[void 0!==a?a:new cb,void 0!==b?b:new cb,void 0!==c?c:new cb,void 0!==d?d:new cb,void 0!==e?e:new cb,void 0!==f?f:new cb]}function Xf(){function a(e,f){!1!==c&&(d(e,f),b.requestAnimationFrame(a))}var b=null,c=!1,d=null;return{start:function(){!0!== +c&&null!==d&&(b.requestAnimationFrame(a),c=!0)},stop:function(){c=!1},setAnimationLoop:function(a){d=a},setContext:function(a){b=a}}}function Pi(a){function b(b,c){var d=b.array,e=b.dynamic?35048:35044,h=a.createBuffer();a.bindBuffer(c,h);a.bufferData(c,d,e);b.onUploadCallback();c=5126;d instanceof Float32Array?c=5126:d instanceof Float64Array?console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array."):d instanceof Uint16Array?c=5123:d instanceof Int16Array?c=5122:d instanceof +Uint32Array?c=5125:d instanceof Int32Array?c=5124:d instanceof Int8Array?c=5120:d instanceof Uint8Array&&(c=5121);return{buffer:h,type:c,bytesPerElement:d.BYTES_PER_ELEMENT,version:b.version}}var c=new WeakMap;return{get:function(a){a.isInterleavedBufferAttribute&&(a=a.data);return c.get(a)},remove:function(b){b.isInterleavedBufferAttribute&&(b=b.data);var d=c.get(b);d&&(a.deleteBuffer(d.buffer),c.delete(b))},update:function(d,e){d.isInterleavedBufferAttribute&&(d=d.data);var f=c.get(d);if(void 0=== +f)c.set(d,b(d,e));else if(f.versionm;m++){if(u=d[m])if(h=u[0],l=u[1]){p&&e.addAttribute("morphTarget"+m,p[h]);f&&e.addAttribute("morphNormal"+m,f[h]);c[m]=l;continue}c[m]=0}g.getUniforms().setValue(a,"morphTargetInfluences",c)}}}function $i(a,b){var c={};return{update:function(d){var e=b.render.frame,f=d.geometry,g=a.get(d,f);c[g.id]!==e&&(f.isGeometry&&g.updateFromObject(d),a.update(g),c[g.id]=e);return g},dispose:function(){c={}}}} +function ob(a,b,c,d,e,f,g,h,l,m){a=void 0!==a?a:[];V.call(this,a,void 0!==b?b:301,c,d,e,f,void 0!==g?g:1022,h,l,m);this.flipY=!1}function Ec(a,b,c,d){V.call(this,null);this.image={data:a,width:b,height:c,depth:d};this.minFilter=this.magFilter=1003;this.wrapR=1001;this.flipY=this.generateMipmaps=!1}function Fc(a,b,c,d){V.call(this,null);this.image={data:a,width:b,height:c,depth:d};this.minFilter=this.magFilter=1003;this.wrapR=1001;this.flipY=this.generateMipmaps=!1}function Gc(a,b,c){var d=a[0];if(0>= +d||0/gm,function(a,c){a=M[c];if(void 0===a)throw Error("Can not resolve #include <"+c+">");return Zf(a)})}function zh(a){return a.replace(/#pragma unroll_loop[\s]+?for \( int i = (\d+); i < (\d+); i \+\+ \) \{([\s\S]+?)(?=\})\}/g, +function(a,c,d,e){a="";for(c=parseInt(c);cc;c++)b.probe.push(new n);var d=new n,e=new P,f=new P;return{setup:function(c,h,l){for(var g=0,p=0,u=0,k=0;9>k;k++)b.probe[k].set(0,0,0);var q=h=0,t=0,y=0,n=0,z=0,x=0,C=0;l=l.matrixWorldInverse;c.sort(Uj);k=0;for(var W=c.length;kCa;Ca++)b.probe[Ca].addScaledVector(E.sh.coefficients[Ca],v);else if(E.isDirectionalLight){var I=a.get(E);I.color.copy(E.color).multiplyScalar(E.intensity);I.direction.setFromMatrixPosition(E.matrixWorld);d.setFromMatrixPosition(E.target.matrixWorld);I.direction.sub(d);I.direction.transformDirection(l);if(I.shadow=E.castShadow)v=E.shadow,I.shadowBias=v.bias,I.shadowRadius=v.radius,I.shadowMapSize=v.mapSize,b.directionalShadowMap[h]=Ca,b.directionalShadowMatrix[h]= -E.shadow.matrix,z++;b.directional[h]=I;h++}else if(E.isSpotLight){I=a.get(E);I.position.setFromMatrixPosition(E.matrixWorld);I.position.applyMatrix4(l);I.color.copy(Fa).multiplyScalar(v);I.distance=A;I.direction.setFromMatrixPosition(E.matrixWorld);d.setFromMatrixPosition(E.target.matrixWorld);I.direction.sub(d);I.direction.transformDirection(l);I.coneCos=Math.cos(E.angle);I.penumbraCos=Math.cos(E.angle*(1-E.penumbra));I.decay=E.decay;if(I.shadow=E.castShadow)v=E.shadow,I.shadowBias=v.bias,I.shadowRadius= -v.radius,I.shadowMapSize=v.mapSize,b.spotShadowMap[t]=Ca,b.spotShadowMatrix[t]=E.shadow.matrix,C++;b.spot[t]=I;t++}else if(E.isRectAreaLight)I=a.get(E),I.color.copy(Fa).multiplyScalar(v),I.position.setFromMatrixPosition(E.matrixWorld),I.position.applyMatrix4(l),f.identity(),e.copy(E.matrixWorld),e.premultiply(l),f.extractRotation(e),I.halfWidth.set(.5*E.width,0,0),I.halfHeight.set(0,.5*E.height,0),I.halfWidth.applyMatrix4(f),I.halfHeight.applyMatrix4(f),b.rectArea[y]=I,y++;else if(E.isPointLight){I= -a.get(E);I.position.setFromMatrixPosition(E.matrixWorld);I.position.applyMatrix4(l);I.color.copy(E.color).multiplyScalar(E.intensity);I.distance=E.distance;I.decay=E.decay;if(I.shadow=E.castShadow)v=E.shadow,I.shadowBias=v.bias,I.shadowRadius=v.radius,I.shadowMapSize=v.mapSize,I.shadowCameraNear=v.camera.near,I.shadowCameraFar=v.camera.far,b.pointShadowMap[q]=Ca,b.pointShadowMatrix[q]=E.shadow.matrix,x++;b.point[q]=I;q++}else E.isHemisphereLight&&(I=a.get(E),I.direction.setFromMatrixPosition(E.matrixWorld), -I.direction.transformDirection(l),I.direction.normalize(),I.skyColor.copy(E.color).multiplyScalar(v),I.groundColor.copy(E.groundColor).multiplyScalar(v),b.hemi[n]=I,n++)}b.ambient[0]=g;b.ambient[1]=p;b.ambient[2]=u;c=b.hash;if(c.directionalLength!==h||c.pointLength!==q||c.spotLength!==t||c.rectAreaLength!==y||c.hemiLength!==n||c.numDirectionalShadows!==z||c.numPointShadows!==x||c.numSpotShadows!==C)b.directional.length=h,b.spot.length=t,b.rectArea.length=y,b.point.length=q,b.hemi.length=n,b.directionalShadowMap.length= -z,b.pointShadowMap.length=x,b.spotShadowMap.length=C,b.directionalShadowMatrix.length=z,b.pointShadowMatrix.length=x,b.spotShadowMatrix.length=C,c.directionalLength=h,c.pointLength=q,c.spotLength=t,c.rectAreaLength=y,c.hemiLength=n,c.numDirectionalShadows=z,c.numPointShadows=x,c.numSpotShadows=C,b.version=Wj++},state:b}}function Bh(){var a=new Vj,b=[],c=[];return{init:function(){b.length=0;c.length=0},state:{lightsArray:b,shadowsArray:c,lights:a},setupLights:function(d){a.setup(b,c,d)},pushLight:function(a){b.push(a)}, -pushShadow:function(a){c.push(a)}}}function Xj(){function a(c){c=c.target;c.removeEventListener("dispose",a);b.delete(c)}var b=new WeakMap;return{get:function(c,d){if(!1===b.has(c)){var e=new Bh;b.set(c,new WeakMap);b.get(c).set(d,e);c.addEventListener("dispose",a)}else!1===b.get(c).has(d)?(e=new Bh,b.get(c).set(d,e)):e=b.get(c).get(d);return e},dispose:function(){b=new WeakMap}}}function Eb(a){Q.call(this);this.type="MeshDepthMaterial";this.depthPacking=3200;this.morphTargets=this.skinning=!1;this.displacementMap= -this.alphaMap=this.map=null;this.displacementScale=1;this.displacementBias=0;this.wireframe=!1;this.wireframeLinewidth=1;this.lights=this.fog=!1;this.setValues(a)}function Fb(a){Q.call(this);this.type="MeshDistanceMaterial";this.referencePosition=new n;this.nearDistance=1;this.farDistance=1E3;this.morphTargets=this.skinning=!1;this.displacementMap=this.alphaMap=this.map=null;this.displacementScale=1;this.displacementBias=0;this.lights=this.fog=!1;this.setValues(a)}function Ch(a,b,c){function d(b, +d.sort(Pj);1c;c++)b.probe.push(new n);var d=new n,e=new W,f=new W;return{setup:function(c,h,l){for(var g=0,p=0,u=0,k=0;9>k;k++)b.probe[k].set(0,0,0);var q=h=0,t=0,z=0,n=0,y=0,x=0,U=0;l=l.matrixWorldInverse;c.sort(Tj);k=0;for(var R=c.length;kCa;Ca++)b.probe[Ca].addScaledVector(E.sh.coefficients[Ca],v);else if(E.isDirectionalLight){var H=a.get(E);H.color.copy(E.color).multiplyScalar(E.intensity);H.direction.setFromMatrixPosition(E.matrixWorld);d.setFromMatrixPosition(E.target.matrixWorld);H.direction.sub(d);H.direction.transformDirection(l);if(H.shadow=E.castShadow)v=E.shadow,H.shadowBias=v.bias,H.shadowRadius=v.radius,H.shadowMapSize=v.mapSize,b.directionalShadowMap[h]=Ca,b.directionalShadowMatrix[h]= +E.shadow.matrix,y++;b.directional[h]=H;h++}else if(E.isSpotLight){H=a.get(E);H.position.setFromMatrixPosition(E.matrixWorld);H.position.applyMatrix4(l);H.color.copy(Cb).multiplyScalar(v);H.distance=B;H.direction.setFromMatrixPosition(E.matrixWorld);d.setFromMatrixPosition(E.target.matrixWorld);H.direction.sub(d);H.direction.transformDirection(l);H.coneCos=Math.cos(E.angle);H.penumbraCos=Math.cos(E.angle*(1-E.penumbra));H.decay=E.decay;if(H.shadow=E.castShadow)v=E.shadow,H.shadowBias=v.bias,H.shadowRadius= +v.radius,H.shadowMapSize=v.mapSize,b.spotShadowMap[t]=Ca,b.spotShadowMatrix[t]=E.shadow.matrix,U++;b.spot[t]=H;t++}else if(E.isRectAreaLight)H=a.get(E),H.color.copy(Cb).multiplyScalar(v),H.position.setFromMatrixPosition(E.matrixWorld),H.position.applyMatrix4(l),f.identity(),e.copy(E.matrixWorld),e.premultiply(l),f.extractRotation(e),H.halfWidth.set(.5*E.width,0,0),H.halfHeight.set(0,.5*E.height,0),H.halfWidth.applyMatrix4(f),H.halfHeight.applyMatrix4(f),b.rectArea[z]=H,z++;else if(E.isPointLight){H= +a.get(E);H.position.setFromMatrixPosition(E.matrixWorld);H.position.applyMatrix4(l);H.color.copy(E.color).multiplyScalar(E.intensity);H.distance=E.distance;H.decay=E.decay;if(H.shadow=E.castShadow)v=E.shadow,H.shadowBias=v.bias,H.shadowRadius=v.radius,H.shadowMapSize=v.mapSize,H.shadowCameraNear=v.camera.near,H.shadowCameraFar=v.camera.far,b.pointShadowMap[q]=Ca,b.pointShadowMatrix[q]=E.shadow.matrix,x++;b.point[q]=H;q++}else E.isHemisphereLight&&(H=a.get(E),H.direction.setFromMatrixPosition(E.matrixWorld), +H.direction.transformDirection(l),H.direction.normalize(),H.skyColor.copy(E.color).multiplyScalar(v),H.groundColor.copy(E.groundColor).multiplyScalar(v),b.hemi[n]=H,n++)}b.ambient[0]=g;b.ambient[1]=p;b.ambient[2]=u;c=b.hash;if(c.directionalLength!==h||c.pointLength!==q||c.spotLength!==t||c.rectAreaLength!==z||c.hemiLength!==n||c.numDirectionalShadows!==y||c.numPointShadows!==x||c.numSpotShadows!==U)b.directional.length=h,b.spot.length=t,b.rectArea.length=z,b.point.length=q,b.hemi.length=n,b.directionalShadowMap.length= +y,b.pointShadowMap.length=x,b.spotShadowMap.length=U,b.directionalShadowMatrix.length=y,b.pointShadowMatrix.length=x,b.spotShadowMatrix.length=U,c.directionalLength=h,c.pointLength=q,c.spotLength=t,c.rectAreaLength=z,c.hemiLength=n,c.numDirectionalShadows=y,c.numPointShadows=x,c.numSpotShadows=U,b.version=Vj++},state:b}}function Bh(){var a=new Uj,b=[],c=[];return{init:function(){b.length=0;c.length=0},state:{lightsArray:b,shadowsArray:c,lights:a},setupLights:function(d){a.setup(b,c,d)},pushLight:function(a){b.push(a)}, +pushShadow:function(a){c.push(a)}}}function Wj(){function a(c){c=c.target;c.removeEventListener("dispose",a);b.delete(c)}var b=new WeakMap;return{get:function(c,d){if(!1===b.has(c)){var e=new Bh;b.set(c,new WeakMap);b.get(c).set(d,e);c.addEventListener("dispose",a)}else!1===b.get(c).has(d)?(e=new Bh,b.get(c).set(d,e)):e=b.get(c).get(d);return e},dispose:function(){b=new WeakMap}}}function Db(a){O.call(this);this.type="MeshDepthMaterial";this.depthPacking=3200;this.morphTargets=this.skinning=!1;this.displacementMap= +this.alphaMap=this.map=null;this.displacementScale=1;this.displacementBias=0;this.wireframe=!1;this.wireframeLinewidth=1;this.lights=this.fog=!1;this.setValues(a)}function Eb(a){O.call(this);this.type="MeshDistanceMaterial";this.referencePosition=new n;this.nearDistance=1;this.farDistance=1E3;this.morphTargets=this.skinning=!1;this.displacementMap=this.alphaMap=this.map=null;this.displacementScale=1;this.displacementBias=0;this.lights=this.fog=!1;this.setValues(a)}function Ch(a,b,c){function d(b, c,d,e,f,g){var h=b.geometry;var l=m;var r=b.customDepthMaterial;d.isPointLight&&(l=p,r=b.customDistanceMaterial);r?l=r:(r=!1,c.morphTargets&&(h&&h.isBufferGeometry?r=h.morphAttributes&&h.morphAttributes.position&&0\nvoid main() {\n float mean = 0.0;\n float squared_mean = 0.0;\n \n\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy ) / resolution ) );\n for ( float i = -1.0; i < 1.0 ; i += SAMPLE_RATE) {\n #ifdef HORIZONAL_PASS\n vec2 distribution = decodeHalfRGBA ( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( i, 0.0 ) * radius ) / resolution ) );\n mean += distribution.x;\n squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n #else\n float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, i ) * radius ) / resolution ) );\n mean += depth;\n squared_mean += depth * depth;\n #endif\n }\n mean = mean * HALF_SAMPLE_RATE;\n squared_mean = squared_mean * HALF_SAMPLE_RATE;\n float std_dev = pow( squared_mean - mean * mean, 0.5 );\n gl_FragColor = encodeHalfRGBA( vec2( mean, std_dev ) );\n}"}), -t=q.clone();t.defines.HORIZONAL_PASS=1;var n=new D;n.addAttribute("position",new N(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));var w=new ra(n,q);for(n=0;4!==n;++n){var z=0!==(n&1),x=0!==(n&2),C=new Eb({depthPacking:3201,morphTargets:z,skinning:x});m[n]=C;z=new Fb({morphTargets:z,skinning:x});p[n]=z}var W=this;this.enabled=!1;this.autoUpdate=!0;this.needsUpdate=!1;this.type=1;this.render=function(d,m,p){if(!1!==W.enabled&&(!1!==W.autoUpdate||!1!==W.needsUpdate)&&0!==d.length){var u=a.getRenderTarget(), -k=a.getActiveCubeFace(),r=a.getActiveMipmapLevel(),n=a.state;n.setBlending(0);n.buffers.color.setClear(1,1,1,1);n.buffers.depth.setTest(!0);n.setScissorTest(!1);for(var y=0,x=d.length;yc||g.y>c)console.warn("THREE.WebGLShadowMap:",C,"has shadow exceeding max texture size, reducing"),g.x>c&&(h.x=Math.floor(c/U.x), -g.x=h.x*U.x,S.mapSize.x=h.x),g.y>c&&(h.y=Math.floor(c/U.y),g.y=h.y*U.y,S.mapSize.y=h.y);null!==S.map||S.isPointLightShadow||3!==this.type||(U={minFilter:1006,magFilter:1006,format:1023},S.map=new Ka(g.x,g.y,U),S.map.texture.name=C.name+".shadowMap",S.mapPass=new Ka(g.x,g.y,U),S.camera.updateProjectionMatrix());null===S.map&&(U={minFilter:1003,magFilter:1003,format:1023},S.map=new Ka(g.x,g.y,U),S.map.texture.name=C.name+".shadowMap",S.camera.updateProjectionMatrix());a.setRenderTarget(S.map);a.clear(); -U=S.getViewportCount();for(var z=0;zd||a.height>d)e=d/Math.max(a.width,a.height);if(1>e||!0===b){if("undefined"!==typeof HTMLImageElement&&a instanceof HTMLImageElement||"undefined"!==typeof HTMLCanvasElement&&a instanceof HTMLCanvasElement||"undefined"!==typeof ImageBitmap&&a instanceof ImageBitmap)return d=b?O.floorPowerOfTwo: -Math.floor,b=d(e*a.width),e=d(e*a.height),void 0===I&&(I=h(b,e)),c=c?h(b,e):I,c.width=b,c.height=e,c.getContext("2d").drawImage(a,0,0,b,e),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+a.width+"x"+a.height+") to ("+b+"x"+e+")."),c;"data"in a&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+a.width+"x"+a.height+").")}return a}function m(a){return O.isPowerOfTwo(a.width)&&O.isPowerOfTwo(a.height)}function p(a,b){return a.generateMipmaps&&b&&1003!==a.minFilter&& -1006!==a.minFilter}function u(b,c,e,f){a.generateMipmap(b);d.get(c).__maxMipLevel=Math.log(Math.max(e,f))*Math.LOG2E}function k(a,c){if(!e.isWebGL2)return a;var d=a;6403===a&&(5126===c&&(d=33326),5131===c&&(d=33325),5121===c&&(d=33321));6407===a&&(5126===c&&(d=34837),5131===c&&(d=34843),5121===c&&(d=32849));6408===a&&(5126===c&&(d=34836),5131===c&&(d=34842),5121===c&&(d=32856));33325===d||33326===d||34842===d||34836===d?b.get("EXT_color_buffer_float"):(34843===d||34837===d)&&console.warn("THREE.WebGLRenderer: Floating point textures with RGB format not supported. Please use RGBA instead."); +d(c,n,l,h.near,h.far,m),a.renderBufferDirect(h,null,p,n,c,q))}else u.visible&&(n=d(c,u,l,h.near,h.far,m),a.renderBufferDirect(h,null,p,n,c,null))}c=c.children;p=0;for(u=c.length;p\nvoid main() {\n float mean = 0.0;\n float squared_mean = 0.0;\n \n\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy ) / resolution ) );\n for ( float i = -1.0; i < 1.0 ; i += SAMPLE_RATE) {\n #ifdef HORIZONAL_PASS\n vec2 distribution = decodeHalfRGBA ( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( i, 0.0 ) * radius ) / resolution ) );\n mean += distribution.x;\n squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n #else\n float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, i ) * radius ) / resolution ) );\n mean += depth;\n squared_mean += depth * depth;\n #endif\n }\n mean = mean * HALF_SAMPLE_RATE;\n squared_mean = squared_mean * HALF_SAMPLE_RATE;\n float std_dev = pow( squared_mean - mean * mean, 0.5 );\n gl_FragColor = encodeHalfRGBA( vec2( mean, std_dev ) );\n}"}), +t=q.clone();t.defines.HORIZONAL_PASS=1;var n=new D;n.addAttribute("position",new L(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));var w=new ia(n,q);for(n=0;4!==n;++n){var y=0!==(n&1),x=0!==(n&2),U=new Db({depthPacking:3201,morphTargets:y,skinning:x});m[n]=U;y=new Eb({morphTargets:y,skinning:x});p[n]=y}var R=this;this.enabled=!1;this.autoUpdate=!0;this.needsUpdate=!1;this.type=1;this.render=function(d,m,p){if(!1!==R.enabled&&(!1!==R.autoUpdate||!1!==R.needsUpdate)&&0!==d.length){var u=a.getRenderTarget(), +k=a.getActiveCubeFace(),r=a.getActiveMipmapLevel(),n=a.state;n.setBlending(0);n.buffers.color.setClear(1,1,1,1);n.buffers.depth.setTest(!0);n.setScissorTest(!1);for(var z=0,x=d.length;zc||g.y>c)console.warn("THREE.WebGLShadowMap:",y,"has shadow exceeding max texture size, reducing"),g.x>c&&(h.x=Math.floor(c/X.x), +g.x=h.x*X.x,T.mapSize.x=h.x),g.y>c&&(h.y=Math.floor(c/X.y),g.y=h.y*X.y,T.mapSize.y=h.y);null!==T.map||T.isPointLightShadow||3!==this.type||(X={minFilter:1006,magFilter:1006,format:1023},T.map=new Ka(g.x,g.y,X),T.map.texture.name=y.name+".shadowMap",T.mapPass=new Ka(g.x,g.y,X),T.camera.updateProjectionMatrix());null===T.map&&(X={minFilter:1003,magFilter:1003,format:1023},T.map=new Ka(g.x,g.y,X),T.map.texture.name=y.name+".shadowMap",T.camera.updateProjectionMatrix());a.setRenderTarget(T.map);a.clear(); +X=T.getViewportCount();for(var U=0;Ud||a.height>d)e=d/Math.max(a.width,a.height);if(1>e||!0===b){if("undefined"!==typeof HTMLImageElement&&a instanceof HTMLImageElement||"undefined"!==typeof HTMLCanvasElement&&a instanceof HTMLCanvasElement||"undefined"!==typeof ImageBitmap&&a instanceof ImageBitmap)return d=b?N.floorPowerOfTwo:Math.floor,b=d(e*a.width),e=d(e*a.height),void 0=== +H&&(H=h(b,e)),c=c?h(b,e):H,c.width=b,c.height=e,c.getContext("2d").drawImage(a,0,0,b,e),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+a.width+"x"+a.height+") to ("+b+"x"+e+")."),c;"data"in a&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+a.width+"x"+a.height+").")}return a}function m(a){return N.isPowerOfTwo(a.width)&&N.isPowerOfTwo(a.height)}function p(a,b){return a.generateMipmaps&&b&&1003!==a.minFilter&&1006!==a.minFilter}function u(b,c,e,f){a.generateMipmap(b); +d.get(c).__maxMipLevel=Math.log(Math.max(e,f))*Math.LOG2E}function k(a,c){if(!e.isWebGL2)return a;var d=a;6403===a&&(5126===c&&(d=33326),5131===c&&(d=33325),5121===c&&(d=33321));6407===a&&(5126===c&&(d=34837),5131===c&&(d=34843),5121===c&&(d=32849));6408===a&&(5126===c&&(d=34836),5131===c&&(d=34842),5121===c&&(d=32856));33325===d||33326===d||34842===d||34836===d?b.get("EXT_color_buffer_float"):(34843===d||34837===d)&&console.warn("THREE.WebGLRenderer: Floating point textures with RGB format not supported. Please use RGBA instead."); return d}function q(a){return 1003===a||1004===a||1005===a?9728:9729}function t(b){b=b.target;b.removeEventListener("dispose",t);var c=d.get(b);void 0!==c.__webglInit&&(a.deleteTexture(c.__webglTexture),d.remove(b));b.isVideoTexture&&Ca.delete(b);g.memory.textures--}function n(b){b=b.target;b.removeEventListener("dispose",n);var c=d.get(b),e=d.get(b.texture);if(b){void 0!==e.__webglTexture&&a.deleteTexture(e.__webglTexture);b.depthTexture&&b.depthTexture.dispose();if(b.isWebGLRenderTargetCube)for(e= 0;6>e;e++)a.deleteFramebuffer(c.__webglFramebuffer[e]),c.__webglDepthbuffer&&a.deleteRenderbuffer(c.__webglDepthbuffer[e]);else a.deleteFramebuffer(c.__webglFramebuffer),c.__webglDepthbuffer&&a.deleteRenderbuffer(c.__webglDepthbuffer);d.remove(b.texture);d.remove(b)}g.memory.textures--}function w(a,b){var e=d.get(a);if(a.isVideoTexture){var f=g.render.frame;Ca.get(a)!==f&&(Ca.set(a,f),a.update())}if(0q;q++)t[q]=r||g?g?b.image[q].image: -b.image[q]:l(b.image[q],!1,!0,e.maxCubemapSize);var n=t[0],y=m(n)||e.isWebGL2,w=f.convert(b.format),x=f.convert(b.type),U=k(w,x);C(34067,b,y);if(r){for(q=0;6>q;q++){var S=t[q].mipmaps;for(r=0;rq;q++)if(g)for(c.texImage2D(34069+q,0,U,t[q].width,t[q].height,0,w,x,t[q].data),r=0;rq;q++)t[q]=r||g?g?b.image[q].image: +b.image[q]:l(b.image[q],!1,!0,e.maxCubemapSize);var n=t[0],z=m(n)||e.isWebGL2,w=f.convert(b.format),x=f.convert(b.type),y=k(w,x);U(34067,b,z);if(r){for(q=0;6>q;q++){var T=t[q].mipmaps;for(r=0;rq;q++)if(g)for(c.texImage2D(34069+q,0,y,t[q].width,t[q].height,0,w,x,t[q].data),r=0;r=e.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+a+" texture units while this GPU supports only "+e.maxTextures);H+=1;return a};this.resetTextureUnits=function(){H=0};this.setTexture2D=w;this.setTexture2DArray=function(a,b){var e=d.get(a);0q;q++)h.__webglFramebuffer[q]=a.createFramebuffer();else if(h.__webglFramebuffer=a.createFramebuffer(),q)if(e.isWebGL2){h.__webglMultisampledFramebuffer=a.createFramebuffer();h.__webglColorRenderbuffer=a.createRenderbuffer();a.bindRenderbuffer(36161,h.__webglColorRenderbuffer);q=f.convert(b.texture.format);var y=f.convert(b.texture.type);q=k(q,y);y=B(b);a.renderbufferStorageMultisample(36161,y,q,b.width,b.height);a.bindFramebuffer(36160,h.__webglMultisampledFramebuffer); -a.framebufferRenderbuffer(36160,36064,36161,h.__webglColorRenderbuffer);a.bindRenderbuffer(36161,null);b.depthBuffer&&(h.__webglDepthRenderbuffer=a.createRenderbuffer(),A(h.__webglDepthRenderbuffer,b,!0));a.bindFramebuffer(36160,null)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");if(r){c.bindTexture(34067,l.__webglTexture);C(34067,b.texture,t);for(q=0;6>q;q++)v(h.__webglFramebuffer[q],b,36064,34069+q);p(b.texture,t)&&u(34067,b.texture,b.width, -b.height);c.bindTexture(34067,null)}else c.bindTexture(3553,l.__webglTexture),C(3553,b.texture,t),v(h.__webglFramebuffer,b,36064,3553),p(b.texture,t)&&u(3553,b.texture,b.width,b.height),c.bindTexture(3553,null);if(b.depthBuffer){h=d.get(b);l=!0===b.isWebGLRenderTargetCube;if(b.depthTexture){if(l)throw Error("target.depthTexture not supported in Cube render targets");if(b&&b.isWebGLRenderTargetCube)throw Error("Depth Texture with cube render targets is not supported");a.bindFramebuffer(36160,h.__webglFramebuffer); +g.type&&null===b.get("OES_texture_float_linear")||1016===g.type&&null===(e.isWebGL2||b.get("OES_texture_half_float_linear"))||!(1=e.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+a+" texture units while this GPU supports only "+e.maxTextures);G+=1;return a};this.resetTextureUnits=function(){G=0};this.setTexture2D=w;this.setTexture2DArray=function(a,b){var e=d.get(a);0q;q++)h.__webglFramebuffer[q]=a.createFramebuffer();else if(h.__webglFramebuffer=a.createFramebuffer(),q)if(e.isWebGL2){h.__webglMultisampledFramebuffer=a.createFramebuffer();h.__webglColorRenderbuffer=a.createRenderbuffer();a.bindRenderbuffer(36161,h.__webglColorRenderbuffer);q=f.convert(b.texture.format);var z=f.convert(b.texture.type);q=k(q,z);z=A(b);a.renderbufferStorageMultisample(36161,z,q,b.width,b.height);a.bindFramebuffer(36160,h.__webglMultisampledFramebuffer); +a.framebufferRenderbuffer(36160,36064,36161,h.__webglColorRenderbuffer);a.bindRenderbuffer(36161,null);b.depthBuffer&&(h.__webglDepthRenderbuffer=a.createRenderbuffer(),B(h.__webglDepthRenderbuffer,b,!0));a.bindFramebuffer(36160,null)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");if(r){c.bindTexture(34067,l.__webglTexture);U(34067,b.texture,t);for(q=0;6>q;q++)v(h.__webglFramebuffer[q],b,36064,34069+q);p(b.texture,t)&&u(34067,b.texture,b.width, +b.height);c.bindTexture(34067,null)}else c.bindTexture(3553,l.__webglTexture),U(3553,b.texture,t),v(h.__webglFramebuffer,b,36064,3553),p(b.texture,t)&&u(3553,b.texture,b.width,b.height),c.bindTexture(3553,null);if(b.depthBuffer){h=d.get(b);l=!0===b.isWebGLRenderTargetCube;if(b.depthTexture){if(l)throw Error("target.depthTexture not supported in Cube render targets");if(b&&b.isWebGLRenderTargetCube)throw Error("Depth Texture with cube render targets is not supported");a.bindFramebuffer(36160,h.__webglFramebuffer); if(!b.depthTexture||!b.depthTexture.isDepthTexture)throw Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");d.get(b.depthTexture).__webglTexture&&b.depthTexture.image.width===b.width&&b.depthTexture.image.height===b.height||(b.depthTexture.image.width=b.width,b.depthTexture.image.height=b.height,b.depthTexture.needsUpdate=!0);w(b.depthTexture,0);h=d.get(b.depthTexture).__webglTexture;if(1026===b.depthTexture.format)a.framebufferTexture2D(36160,36096,3553,h,0);else if(1027=== -b.depthTexture.format)a.framebufferTexture2D(36160,33306,3553,h,0);else throw Error("Unknown depthTexture format");}else if(l)for(h.__webglDepthbuffer=[],l=0;6>l;l++)a.bindFramebuffer(36160,h.__webglFramebuffer[l]),h.__webglDepthbuffer[l]=a.createRenderbuffer(),A(h.__webglDepthbuffer[l],b);else a.bindFramebuffer(36160,h.__webglFramebuffer),h.__webglDepthbuffer=a.createRenderbuffer(),A(h.__webglDepthbuffer,b);a.bindFramebuffer(36160,null)}};this.updateRenderTargetMipmap=function(a){var b=a.texture, +b.depthTexture.format)a.framebufferTexture2D(36160,33306,3553,h,0);else throw Error("Unknown depthTexture format");}else if(l)for(h.__webglDepthbuffer=[],l=0;6>l;l++)a.bindFramebuffer(36160,h.__webglFramebuffer[l]),h.__webglDepthbuffer[l]=a.createRenderbuffer(),B(h.__webglDepthbuffer[l],b);else a.bindFramebuffer(36160,h.__webglFramebuffer),h.__webglDepthbuffer=a.createRenderbuffer(),B(h.__webglDepthbuffer,b);a.bindFramebuffer(36160,null)}};this.updateRenderTargetMipmap=function(a){var b=a.texture, f=m(a)||e.isWebGL2;if(p(b,f)){f=a.isWebGLRenderTargetCube?34067:3553;var g=d.get(b).__webglTexture;c.bindTexture(f,g);u(f,b,a.width,a.height);c.bindTexture(f,null)}};this.updateMultisampleRenderTarget=function(b){if(b.isWebGLMultisampleRenderTarget)if(e.isWebGL2){var c=d.get(b);a.bindFramebuffer(36008,c.__webglMultisampledFramebuffer);a.bindFramebuffer(36009,c.__webglFramebuffer);c=b.width;var f=b.height,g=16384;b.depthBuffer&&(g|=256);b.stencilBuffer&&(g|=1024);a.blitFramebuffer(0,0,c,f,0,0,c,f, -g,9728)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")};this.safeSetTexture2D=function(a,b){a&&a.isWebGLRenderTarget&&(!1===J&&(console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),J=!0),a=a.texture);w(a,b)};this.safeSetTextureCube=function(a,b){a&&a.isWebGLRenderTargetCube&&(!1===F&&(console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."), -F=!0),a=a.texture);a&&a.isCubeTexture||Array.isArray(a.image)&&6===a.image.length?z(a,b):x(a,b)}}function Eh(a,b,c){return{convert:function(a){if(1E3===a)return 10497;if(1001===a)return 33071;if(1002===a)return 33648;if(1003===a)return 9728;if(1004===a)return 9984;if(1005===a)return 9986;if(1006===a)return 9729;if(1007===a)return 9985;if(1008===a)return 9987;if(1009===a)return 5121;if(1017===a)return 32819;if(1018===a)return 32820;if(1019===a)return 33635;if(1010===a)return 5120;if(1011===a)return 5122; +g,9728)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")};this.safeSetTexture2D=function(a,b){a&&a.isWebGLRenderTarget&&(!1===I&&(console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),I=!0),a=a.texture);w(a,b)};this.safeSetTextureCube=function(a,b){a&&a.isWebGLRenderTargetCube&&(!1===C&&(console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."), +C=!0),a=a.texture);a&&a.isCubeTexture||Array.isArray(a.image)&&6===a.image.length?y(a,b):x(a,b)}}function Dh(a,b,c){return{convert:function(a){if(1E3===a)return 10497;if(1001===a)return 33071;if(1002===a)return 33648;if(1003===a)return 9728;if(1004===a)return 9984;if(1005===a)return 9986;if(1006===a)return 9729;if(1007===a)return 9985;if(1008===a)return 9987;if(1009===a)return 5121;if(1017===a)return 32819;if(1018===a)return 32820;if(1019===a)return 33635;if(1010===a)return 5120;if(1011===a)return 5122; if(1012===a)return 5123;if(1013===a)return 5124;if(1014===a)return 5125;if(1015===a)return 5126;if(1016===a){if(c.isWebGL2)return 5131;var d=b.get("OES_texture_half_float");if(null!==d)return d.HALF_FLOAT_OES}if(1021===a)return 6406;if(1022===a)return 6407;if(1023===a)return 6408;if(1024===a)return 6409;if(1025===a)return 6410;if(1026===a)return 6402;if(1027===a)return 34041;if(1028===a)return 6403;if(100===a)return 32774;if(101===a)return 32778;if(102===a)return 32779;if(200===a)return 0;if(201=== a)return 1;if(202===a)return 768;if(203===a)return 769;if(204===a)return 770;if(205===a)return 771;if(206===a)return 772;if(207===a)return 773;if(208===a)return 774;if(209===a)return 775;if(210===a)return 776;if(33776===a||33777===a||33778===a||33779===a)if(d=b.get("WEBGL_compressed_texture_s3tc"),null!==d){if(33776===a)return d.COMPRESSED_RGB_S3TC_DXT1_EXT;if(33777===a)return d.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(33778===a)return d.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(33779===a)return d.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(35840=== a||35841===a||35842===a||35843===a)if(d=b.get("WEBGL_compressed_texture_pvrtc"),null!==d){if(35840===a)return d.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(35841===a)return d.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(35842===a)return d.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(35843===a)return d.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(36196===a&&(d=b.get("WEBGL_compressed_texture_etc1"),null!==d))return d.COMPRESSED_RGB_ETC1_WEBGL;if(37808===a||37809===a||37810===a||37811===a||37812===a||37813===a||37814===a||37815===a||37816=== -a||37817===a||37818===a||37819===a||37820===a||37821===a)if(d=b.get("WEBGL_compressed_texture_astc"),null!==d)return a;if(103===a||104===a){if(c.isWebGL2){if(103===a)return 32775;if(104===a)return 32776}d=b.get("EXT_blend_minmax");if(null!==d){if(103===a)return d.MIN_EXT;if(104===a)return d.MAX_EXT}}if(1020===a){if(c.isWebGL2)return 34042;d=b.get("WEBGL_depth_texture");if(null!==d)return d.UNSIGNED_INT_24_8_WEBGL}return 0}}}function Hc(){B.call(this);this.type="Group"}function Id(a){la.call(this); -this.cameras=a||[]}function Fh(a,b,c){Gh.setFromMatrixPosition(b.matrixWorld);Hh.setFromMatrixPosition(c.matrixWorld);var d=Gh.distanceTo(Hh),e=b.projectionMatrix.elements,f=c.projectionMatrix.elements,g=e[14]/(e[10]-1);c=e[14]/(e[10]+1);var h=(e[9]+1)/e[5],l=(e[9]-1)/e[5],m=(e[8]-1)/e[0],p=(f[8]+1)/f[0];e=g*m;f=g*p;p=d/(-m+p);m=p*-m;b.matrixWorld.decompose(a.position,a.quaternion,a.scale);a.translateX(m);a.translateZ(p);a.matrixWorld.compose(a.position,a.quaternion,a.scale);a.matrixWorldInverse.getInverse(a.matrixWorld); -b=g+p;g=c+p;a.projectionMatrix.makePerspective(e-m,f+(d-m),h*c/g*b,l*c/g*b,b,g)}function cg(a){function b(){return null!==h&&!0===h.isPresenting}function c(){if(b()){var c=h.getEyeParameters("left");e=2*c.renderWidth*q;f=c.renderHeight*q;Fa=a.getPixelRatio();a.getSize(E);a.setDrawingBufferSize(e,f,1);x.viewport.set(0,0,e/2,f);C.viewport.set(e/2,0,e/2,f);B.start();g.dispatchEvent({type:"sessionstart"})}else g.enabled&&a.setDrawingBufferSize(E.width,E.height,Fa),B.stop(),g.dispatchEvent({type:"sessionend"})} -function d(a,b){null!==b&&4===b.length&&a.set(b[0]*e,b[1]*f,b[2]*e,b[3]*f)}var e,f,g=this,h=null,l=null,m=null,p=[],u=new P,k=new P,q=1,t="local-floor";"undefined"!==typeof window&&"VRFrameData"in window&&(l=new window.VRFrameData,window.addEventListener("vrdisplaypresentchange",c,!1));var y=new P,w=new na,z=new n,x=new la;x.viewport=new da;x.layers.enable(1);var C=new la;C.viewport=new da;C.layers.enable(2);var W=new Id([x,C]);W.layers.enable(1);W.layers.enable(2);var E=new v,Fa,A=[];this.enabled= -!1;this.getController=function(a){var b=p[a];void 0===b&&(b=new Hc,b.matrixAutoUpdate=!1,b.visible=!1,p[a]=b);return b};this.getDevice=function(){return h};this.setDevice=function(a){void 0!==a&&(h=a);B.setContext(a)};this.setFramebufferScaleFactor=function(a){q=a};this.setReferenceSpaceType=function(a){t=a};this.setPoseTarget=function(a){void 0!==a&&(m=a)};this.getCamera=function(a){var c="local-floor"===t?1.6:0;if(!1===b())return a.position.set(0,c,0),a.rotation.set(0,0,0),a;h.depthNear=a.near; -h.depthFar=a.far;h.getFrameData(l);if("local-floor"===t){var e=h.stageParameters;e?u.fromArray(e.sittingToStandingTransform):u.makeTranslation(0,c,0)}c=l.pose;e=null!==m?m:a;e.matrix.copy(u);e.matrix.decompose(e.position,e.quaternion,e.scale);null!==c.orientation&&(w.fromArray(c.orientation),e.quaternion.multiply(w));null!==c.position&&(w.setFromRotationMatrix(u),z.fromArray(c.position),z.applyQuaternion(w),e.position.add(z));e.updateMatrixWorld();x.near=a.near;C.near=a.near;x.far=a.far;C.far=a.far; -x.matrixWorldInverse.fromArray(l.leftViewMatrix);C.matrixWorldInverse.fromArray(l.rightViewMatrix);k.getInverse(u);"local-floor"===t&&(x.matrixWorldInverse.multiply(k),C.matrixWorldInverse.multiply(k));a=e.parent;null!==a&&(y.getInverse(a.matrixWorld),x.matrixWorldInverse.multiply(y),C.matrixWorldInverse.multiply(y));x.matrixWorld.getInverse(x.matrixWorldInverse);C.matrixWorld.getInverse(C.matrixWorldInverse);x.projectionMatrix.fromArray(l.leftProjectionMatrix);C.projectionMatrix.fromArray(l.rightProjectionMatrix); -Fh(W,x,C);a=h.getLayers();a.length&&(a=a[0],d(x.viewport,a.leftBounds),d(C.viewport,a.rightBounds));a:for(a=0;af.matrixWorld.determinant();ha.setMaterial(e,h);var l=r(a,c,e,f),m=!1;if(b!==d.id||Y!==l.id||ba!==(!0===e.wireframe))b=d.id,Y=l.id,ba=!0===e.wireframe,m=!0;f.morphTargetInfluences&&(xa.update(f,d,e,l), -m=!0);h=d.index;var p=d.attributes.position;c=1;!0===e.wireframe&&(h=wa.getWireframeAttribute(d),c=2);a=za;if(null!==h){var k=ua.get(h);a=Ba;a.setIndex(k)}if(m){if(d&&d.isInstancedBufferGeometry&&!Ea.isWebGL2&&null===oa.get("ANGLE_instanced_arrays"))console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");else{ha.initAttributes();m=d.attributes;l=l.getAttributes();var u=e.defaultAttributeValues; -for(v in l){var q=l[v];if(0<=q){var t=m[v];if(void 0!==t){var n=t.normalized,y=t.itemSize,w=ua.get(t);if(void 0!==w){var x=w.buffer,z=w.type;w=w.bytesPerElement;if(t.isInterleavedBufferAttribute){var C=t.data,E=C.stride;t=t.offset;C&&C.isInstancedInterleavedBuffer?(ha.enableAttributeAndDivisor(q,C.meshPerAttribute),void 0===d.maxInstancedCount&&(d.maxInstancedCount=C.meshPerAttribute*C.count)):ha.enableAttribute(q);M.bindBuffer(34962,x);M.vertexAttribPointer(q,y,z,n,E*w,t*w)}else t.isInstancedBufferAttribute? -(ha.enableAttributeAndDivisor(q,t.meshPerAttribute),void 0===d.maxInstancedCount&&(d.maxInstancedCount=t.meshPerAttribute*t.count)):ha.enableAttribute(q),M.bindBuffer(34962,x),M.vertexAttribPointer(q,y,z,n,0,0)}}else if(void 0!==u&&(n=u[v],void 0!==n))switch(n.length){case 2:M.vertexAttrib2fv(q,n);break;case 3:M.vertexAttrib3fv(q,n);break;case 4:M.vertexAttrib4fv(q,n);break;default:M.vertexAttrib1fv(q,n)}}}ha.disableUnusedAttributes()}null!==h&&M.bindBuffer(34963,k.buffer)}k=Infinity;null!==h?k=h.count: -void 0!==p&&(k=p.count);h=d.drawRange.start*c;p=null!==g?g.start*c:0;var v=Math.max(h,p);g=Math.max(0,Math.min(k,h+d.drawRange.count*c,p+(null!==g?g.count*c:Infinity))-1-v+1);if(0!==g){if(f.isMesh)if(!0===e.wireframe)ha.setLineWidth(e.wireframeLinewidth*(null===K?fa:1)),a.setMode(1);else switch(f.drawMode){case 0:a.setMode(4);break;case 1:a.setMode(5);break;case 2:a.setMode(6)}else f.isLine?(e=e.linewidth,void 0===e&&(e=1),ha.setLineWidth(e*(null===K?fa:1)),f.isLineSegments?a.setMode(1):f.isLineLoop? -a.setMode(2):a.setMode(3)):f.isPoints?a.setMode(0):f.isSprite&&a.setMode(4);d&&d.isInstancedBufferGeometry?0e.far||f.push({distance:a,distanceToRay:Math.sqrt(h), -point:c,index:b,face:null,object:g}))}function hg(a,b,c,d,e,f,g,h,l){ba.call(this,a,b,c,d,e,f,g,h,l);this.format=void 0!==g?g:1022;this.minFilter=void 0!==f?f:1006;this.magFilter=void 0!==e?e:1006;this.generateMipmaps=!1}function Lc(a,b,c,d,e,f,g,h,l,m,p,k){ba.call(this,null,f,g,h,l,m,d,e,p,k);this.image={width:b,height:c};this.mipmaps=a;this.generateMipmaps=this.flipY=!1}function Od(a,b,c,d,e,f,g,h,l){ba.call(this,a,b,c,d,e,f,g,h,l);this.needsUpdate=!0}function Pd(a,b,c,d,e,f,g,h,l,m){m=void 0!== -m?m:1026;if(1026!==m&&1027!==m)throw Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===c&&1026===m&&(c=1012);void 0===c&&1027===m&&(c=1020);ba.call(this,null,d,e,f,g,h,m,c,l);this.image={width:a,height:b};this.magFilter=void 0!==g?g:1003;this.minFilter=void 0!==h?h:1003;this.generateMipmaps=this.flipY=!1}function Mc(a){D.call(this);this.type="WireframeGeometry";var b=[],c,d,e,f=[0,0],g={},h=["a","b","c"];if(a&&a.isGeometry){var l=a.faces;var m=0;for(d= +b.displacementMap&&(a.displacementMap.value=b.displacementMap,a.displacementScale.value=b.displacementScale,a.displacementBias.value=b.displacementBias)}function z(a,b){a.roughness.value=b.roughness;a.metalness.value=b.metalness;b.roughnessMap&&(a.roughnessMap.value=b.roughnessMap);b.metalnessMap&&(a.metalnessMap.value=b.metalnessMap);b.emissiveMap&&(a.emissiveMap.value=b.emissiveMap);b.bumpMap&&(a.bumpMap.value=b.bumpMap,a.bumpScale.value=b.bumpScale,1===b.side&&(a.bumpScale.value*=-1));b.normalMap&& +(a.normalMap.value=b.normalMap,a.normalScale.value.copy(b.normalScale),1===b.side&&a.normalScale.value.negate());b.displacementMap&&(a.displacementMap.value=b.displacementMap,a.displacementScale.value=b.displacementScale,a.displacementBias.value=b.displacementBias);b.envMap&&(a.envMapIntensity.value=b.envMapIntensity)}a=a||{};var w=void 0!==a.canvas?a.canvas:document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),y=void 0!==a.context?a.context:null,x=void 0!==a.alpha?a.alpha:!1,U=void 0!== +a.depth?a.depth:!0,R=void 0!==a.stencil?a.stencil:!0,E=void 0!==a.antialias?a.antialias:!1,B=void 0!==a.premultipliedAlpha?a.premultipliedAlpha:!0,A=void 0!==a.preserveDrawingBuffer?a.preserveDrawingBuffer:!1,D=void 0!==a.powerPreference?a.powerPreference:"default",I=void 0!==a.failIfMajorPerformanceCaveat?a.failIfMajorPerformanceCaveat:!1,H=null,C=null;this.domElement=w;this.debug={checkShaderErrors:!0};this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear= +!0;this.clippingPlanes=[];this.localClippingEnabled=!1;this.gammaFactor=2;this.physicallyCorrectLights=this.gammaOutput=this.gammaInput=!1;this.toneMappingWhitePoint=this.toneMappingExposure=this.toneMapping=1;this.maxMorphTargets=8;this.maxMorphNormals=4;var F=this,O=!1,L=null,T=0,X=0,M=null,$b=null,fa=-1;var ac=b=null;var Z=!1;var P=null,Pa=null,V=new da,aa=new da,ba=null,J=w.width,Y=w.height,ea=1,Q=new da(0,0,J,Y),ja=new da(0,0,J,Y),na=!1,bg=new Ed,Oa=new Ti,He=!1,ra=!1,Id=new W,Fb=new n;try{x= +{alpha:x,depth:U,stencil:R,antialias:E,premultipliedAlpha:B,preserveDrawingBuffer:A,powerPreference:D,failIfMajorPerformanceCaveat:I,xrCompatible:!0};w.addEventListener("webglcontextlost",d,!1);w.addEventListener("webglcontextrestored",e,!1);var K=y||w.getContext("webgl",x)||w.getContext("experimental-webgl",x);if(null===K){if(null!==w.getContext("webgl"))throw Error("Error creating WebGL context with your selected attributes.");throw Error("Error creating WebGL context.");}void 0===K.getShaderPrecisionFormat&& +(K.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(Ih){throw console.error("THREE.WebGLRenderer: "+Ih.message),Ih;}var pa,Da,ha,ia,S,ca,ta,va,qa,ma,ua,sa,la,wa,ya,za,ka;c();var oa="undefined"!==typeof navigator&&"xr"in navigator&&"supportsSession"in navigator.xr?new Hh(F,K):new cg(F);this.vr=oa;var Ba=new Ch(F,qa,Da.maxTextureSize);this.shadowMap=Ba;this.getContext=function(){return K};this.getContextAttributes=function(){return K.getContextAttributes()};this.forceContextLoss= +function(){var a=pa.get("WEBGL_lose_context");a&&a.loseContext()};this.forceContextRestore=function(){var a=pa.get("WEBGL_lose_context");a&&a.restoreContext()};this.getPixelRatio=function(){return ea};this.setPixelRatio=function(a){void 0!==a&&(ea=a,this.setSize(J,Y,!1))};this.getSize=function(a){void 0===a&&(console.warn("WebGLRenderer: .getsize() now requires a Vector2 as an argument"),a=new v);return a.set(J,Y)};this.setSize=function(a,b,c){oa.isPresenting()?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."): +(J=a,Y=b,w.width=Math.floor(a*ea),w.height=Math.floor(b*ea),!1!==c&&(w.style.width=a+"px",w.style.height=b+"px"),this.setViewport(0,0,a,b))};this.getDrawingBufferSize=function(a){void 0===a&&(console.warn("WebGLRenderer: .getdrawingBufferSize() now requires a Vector2 as an argument"),a=new v);return a.set(J*ea,Y*ea).floor()};this.setDrawingBufferSize=function(a,b,c){J=a;Y=b;ea=c;w.width=Math.floor(a*c);w.height=Math.floor(b*c);this.setViewport(0,0,a,b)};this.getCurrentViewport=function(a){void 0=== +a&&(console.warn("WebGLRenderer: .getCurrentViewport() now requires a Vector4 as an argument"),a=new da);return a.copy(V)};this.getViewport=function(a){return a.copy(Q)};this.setViewport=function(a,b,c,d){a.isVector4?Q.set(a.x,a.y,a.z,a.w):Q.set(a,b,c,d);ha.viewport(V.copy(Q).multiplyScalar(ea).floor())};this.getScissor=function(a){return a.copy(ja)};this.setScissor=function(a,b,c,d){a.isVector4?ja.set(a.x,a.y,a.z,a.w):ja.set(a,b,c,d);ha.scissor(aa.copy(ja).multiplyScalar(ea).floor())};this.getScissorTest= +function(){return na};this.setScissorTest=function(a){ha.setScissorTest(na=a)};this.getClearColor=function(){return la.getClearColor()};this.setClearColor=function(){la.setClearColor.apply(la,arguments)};this.getClearAlpha=function(){return la.getClearAlpha()};this.setClearAlpha=function(){la.setClearAlpha.apply(la,arguments)};this.clear=function(a,b,c){var d=0;if(void 0===a||a)d|=16384;if(void 0===b||b)d|=256;if(void 0===c||c)d|=1024;K.clear(d)};this.clearColor=function(){this.clear(!0,!1,!1)};this.clearDepth= +function(){this.clear(!1,!0,!1)};this.clearStencil=function(){this.clear(!1,!1,!0)};this.dispose=function(){w.removeEventListener("webglcontextlost",d,!1);w.removeEventListener("webglcontextrestored",e,!1);ua.dispose();sa.dispose();S.dispose();qa.dispose();oa.dispose();xa.stop()};this.renderBufferImmediate=function(a,b){ha.initAttributes();var c=S.get(a);a.hasPositions&&!c.position&&(c.position=K.createBuffer());a.hasNormals&&!c.normal&&(c.normal=K.createBuffer());a.hasUvs&&!c.uv&&(c.uv=K.createBuffer()); +a.hasColors&&!c.color&&(c.color=K.createBuffer());b=b.getAttributes();a.hasPositions&&(K.bindBuffer(34962,c.position),K.bufferData(34962,a.positionArray,35048),ha.enableAttribute(b.position),K.vertexAttribPointer(b.position,3,5126,!1,0,0));a.hasNormals&&(K.bindBuffer(34962,c.normal),K.bufferData(34962,a.normalArray,35048),ha.enableAttribute(b.normal),K.vertexAttribPointer(b.normal,3,5126,!1,0,0));a.hasUvs&&(K.bindBuffer(34962,c.uv),K.bufferData(34962,a.uvArray,35048),ha.enableAttribute(b.uv),K.vertexAttribPointer(b.uv, +2,5126,!1,0,0));a.hasColors&&(K.bindBuffer(34962,c.color),K.bufferData(34962,a.colorArray,35048),ha.enableAttribute(b.color),K.vertexAttribPointer(b.color,3,5126,!1,0,0));ha.disableUnusedAttributes();K.drawArrays(4,0,a.count);a.count=0};this.renderBufferDirect=function(a,c,d,e,f,g){var h=f.isMesh&&0>f.matrixWorld.determinant();ha.setMaterial(e,h);var l=k(a,c,e,f),m=!1;if(b!==d.id||ac!==l.id||Z!==(!0===e.wireframe))b=d.id,ac=l.id,Z=!0===e.wireframe,m=!0;f.morphTargetInfluences&&(wa.update(f,d,e,l), +m=!0);h=d.index;var p=d.attributes.position;c=1;!0===e.wireframe&&(h=va.getWireframeAttribute(d),c=2);a=ya;if(null!==h){var u=ta.get(h);a=za;a.setIndex(u)}if(m){if(d&&d.isInstancedBufferGeometry&&!Da.isWebGL2&&null===pa.get("ANGLE_instanced_arrays"))console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");else{ha.initAttributes();m=d.attributes;l=l.getAttributes();var r=e.defaultAttributeValues; +for(v in l){var q=l[v];if(0<=q){var t=m[v];if(void 0!==t){var n=t.normalized,z=t.itemSize,w=ta.get(t);if(void 0!==w){var x=w.buffer,y=w.type;w=w.bytesPerElement;if(t.isInterleavedBufferAttribute){var E=t.data,U=E.stride;t=t.offset;E&&E.isInstancedInterleavedBuffer?(ha.enableAttributeAndDivisor(q,E.meshPerAttribute),void 0===d.maxInstancedCount&&(d.maxInstancedCount=E.meshPerAttribute*E.count)):ha.enableAttribute(q);K.bindBuffer(34962,x);K.vertexAttribPointer(q,z,y,n,U*w,t*w)}else t.isInstancedBufferAttribute? +(ha.enableAttributeAndDivisor(q,t.meshPerAttribute),void 0===d.maxInstancedCount&&(d.maxInstancedCount=t.meshPerAttribute*t.count)):ha.enableAttribute(q),K.bindBuffer(34962,x),K.vertexAttribPointer(q,z,y,n,0,0)}}else if(void 0!==r&&(n=r[v],void 0!==n))switch(n.length){case 2:K.vertexAttrib2fv(q,n);break;case 3:K.vertexAttrib3fv(q,n);break;case 4:K.vertexAttrib4fv(q,n);break;default:K.vertexAttrib1fv(q,n)}}}ha.disableUnusedAttributes()}null!==h&&K.bindBuffer(34963,u.buffer)}u=Infinity;null!==h?u=h.count: +void 0!==p&&(u=p.count);h=d.drawRange.start*c;p=null!==g?g.start*c:0;var v=Math.max(h,p);g=Math.max(0,Math.min(u,h+d.drawRange.count*c,p+(null!==g?g.count*c:Infinity))-1-v+1);if(0!==g){if(f.isMesh)if(!0===e.wireframe)ha.setLineWidth(e.wireframeLinewidth*(null===M?ea:1)),a.setMode(1);else switch(f.drawMode){case 0:a.setMode(4);break;case 1:a.setMode(5);break;case 2:a.setMode(6)}else f.isLine?(e=e.linewidth,void 0===e&&(e=1),ha.setLineWidth(e*(null===M?ea:1)),f.isLineSegments?a.setMode(1):f.isLineLoop? +a.setMode(2):a.setMode(3)):f.isPoints?a.setMode(0):f.isSprite&&a.setMode(4);d&&d.isInstancedBufferGeometry?0e.far||f.push({distance:a,distanceToRay:Math.sqrt(h), +point:c,index:b,face:null,object:g}))}function hg(a,b,c,d,e,f,g,h,l){V.call(this,a,b,c,d,e,f,g,h,l);this.format=void 0!==g?g:1022;this.minFilter=void 0!==f?f:1006;this.magFilter=void 0!==e?e:1006;this.generateMipmaps=!1}function Lc(a,b,c,d,e,f,g,h,l,m,p,k){V.call(this,null,f,g,h,l,m,d,e,p,k);this.image={width:b,height:c};this.mipmaps=a;this.generateMipmaps=this.flipY=!1}function Pd(a,b,c,d,e,f,g,h,l){V.call(this,a,b,c,d,e,f,g,h,l);this.needsUpdate=!0}function Qd(a,b,c,d,e,f,g,h,l,m){m=void 0!==m? +m:1026;if(1026!==m&&1027!==m)throw Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===c&&1026===m&&(c=1012);void 0===c&&1027===m&&(c=1020);V.call(this,null,d,e,f,g,h,m,c,l);this.image={width:a,height:b};this.magFilter=void 0!==g?g:1003;this.minFilter=void 0!==h?h:1003;this.generateMipmaps=this.flipY=!1}function Mc(a){D.call(this);this.type="WireframeGeometry";var b=[],c,d,e,f=[0,0],g={},h=["a","b","c"];if(a&&a.isGeometry){var l=a.faces;var m=0;for(d= l.length;mc;c++){var k=p[h[c]];var r=p[h[(c+1)%3]];f[0]=Math.min(k,r);f[1]=Math.max(k,r);k=f[0]+","+f[1];void 0===g[k]&&(g[k]={index1:f[0],index2:f[1]})}}for(k in g)m=g[k],h=a.vertices[m.index1],b.push(h.x,h.y,h.z),h=a.vertices[m.index2],b.push(h.x,h.y,h.z)}else if(a&&a.isBufferGeometry)if(h=new n,null!==a.index){l=a.attributes.position;p=a.index;var q=a.groups;0===q.length&&(q=[{start:0,count:p.count,materialIndex:0}]);a=0;for(e=q.length;ac;c++)k=p.getX(m+c),r=p.getX(m+(c+1)%3),f[0]=Math.min(k,r),f[1]=Math.max(k,r),k=f[0]+","+f[1],void 0===g[k]&&(g[k]={index1:f[0],index2:f[1]});for(k in g)m=g[k],h.fromBufferAttribute(l,m.index1),b.push(h.x,h.y,h.z),h.fromBufferAttribute(l,m.index2),b.push(h.x,h.y,h.z)}else for(l=a.attributes.position,m=0,d=l.count/3;mc;c++)g=3*m+c,h.fromBufferAttribute(l,g),b.push(h.x,h.y,h.z),g=3*m+(c+1)%3,h.fromBufferAttribute(l,g),b.push(h.x,h.y,h.z);this.addAttribute("position", -new A(b,3))}function Qd(a,b,c){G.call(this);this.type="ParametricGeometry";this.parameters={func:a,slices:b,stacks:c};this.fromBufferGeometry(new Nc(a,b,c));this.mergeVertices()}function Nc(a,b,c){D.call(this);this.type="ParametricBufferGeometry";this.parameters={func:a,slices:b,stacks:c};var d=[],e=[],f=[],g=[],h=new n,l=new n,m=new n,p=new n,k=new n,r,q;3>a.length&&console.error("THREE.ParametricGeometry: Function must now modify a Vector3 as third parameter.");var t=b+1;for(r=0;r<=c;r++){var y= -r/c;for(q=0;q<=b;q++){var w=q/b;a(w,y,l);e.push(l.x,l.y,l.z);0<=w-1E-5?(a(w-1E-5,y,m),p.subVectors(l,m)):(a(w+1E-5,y,m),p.subVectors(m,l));0<=y-1E-5?(a(w,y-1E-5,m),k.subVectors(l,m)):(a(w,y+1E-5,m),k.subVectors(m,l));h.crossVectors(p,k).normalize();f.push(h.x,h.y,h.z);g.push(w,y)}}for(r=0;rd&&1===a.x&&(l[b]=a.x-1);0===c.x&&0===c.z&&(l[b]=d/2/Math.PI+.5)}D.call(this);this.type="PolyhedronBufferGeometry";this.parameters={vertices:a,indices:b,radius:c,detail:d};c= -c||1;d=d||0;var h=[],l=[];(function(a){for(var c=new n,d=new n,g=new n,h=0;he&&(.2>b&&(l[a+0]+=1),.2>c&&(l[a+2]+=1),.2>d&&(l[a+4]+=1))})();this.addAttribute("position",new A(h,3));this.addAttribute("normal",new A(h.slice(),3));this.addAttribute("uv",new A(l,2));0===d?this.computeVertexNormals():this.normalizeNormals()}function Sd(a,b){G.call(this); -this.type="TetrahedronGeometry";this.parameters={radius:a,detail:b};this.fromBufferGeometry(new Oc(a,b));this.mergeVertices()}function Oc(a,b){pa.call(this,[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],a,b);this.type="TetrahedronBufferGeometry";this.parameters={radius:a,detail:b}}function Td(a,b){G.call(this);this.type="OctahedronGeometry";this.parameters={radius:a,detail:b};this.fromBufferGeometry(new bc(a,b));this.mergeVertices()}function bc(a,b){pa.call(this,[1,0,0,-1,0,0,0,1,0,0,-1, -0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],a,b);this.type="OctahedronBufferGeometry";this.parameters={radius:a,detail:b}}function Ud(a,b){G.call(this);this.type="IcosahedronGeometry";this.parameters={radius:a,detail:b};this.fromBufferGeometry(new Pc(a,b));this.mergeVertices()}function Pc(a,b){var c=(1+Math.sqrt(5))/2;pa.call(this,[-1,c,0,1,c,0,-1,-c,0,1,-c,0,0,-1,c,0,1,c,0,-1,-c,0,1,-c,c,0,-1,c,0,1,-c,0,-1,-c,0,1],[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7, -6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],a,b);this.type="IcosahedronBufferGeometry";this.parameters={radius:a,detail:b}}function Vd(a,b){G.call(this);this.type="DodecahedronGeometry";this.parameters={radius:a,detail:b};this.fromBufferGeometry(new Qc(a,b));this.mergeVertices()}function Qc(a,b){var c=(1+Math.sqrt(5))/2,d=1/c;pa.call(this,[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-d,-c,0,-d,c,0,d,-c,0,d,c,-d,-c,0,-d,c,0,d,-c,0,d,c,0,-c,0,-d,c,0,-d,-c, -0,d,c,0,d],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],a,b);this.type="DodecahedronBufferGeometry";this.parameters={radius:a,detail:b}}function Wd(a,b,c,d,e,f){G.call(this);this.type="TubeGeometry";this.parameters={path:a,tubularSegments:b,radius:c,radialSegments:d,closed:e};void 0!== -f&&console.warn("THREE.TubeGeometry: taper has been removed.");a=new cc(a,b,c,d,e);this.tangents=a.tangents;this.normals=a.normals;this.binormals=a.binormals;this.fromBufferGeometry(a);this.mergeVertices()}function cc(a,b,c,d,e){function f(e){p=a.getPointAt(e/b,p);var f=g.normals[e];e=g.binormals[e];for(r=0;r<=d;r++){var m=r/d*Math.PI*2,k=Math.sin(m);m=-Math.cos(m);l.x=m*f.x+k*e.x;l.y=m*f.y+k*e.y;l.z=m*f.z+k*e.z;l.normalize();t.push(l.x,l.y,l.z);h.x=p.x+c*l.x;h.y=p.y+c*l.y;h.z=p.z+c*l.z;q.push(h.x, -h.y,h.z)}}D.call(this);this.type="TubeBufferGeometry";this.parameters={path:a,tubularSegments:b,radius:c,radialSegments:d,closed:e};b=b||64;c=c||1;d=d||8;e=e||!1;var g=a.computeFrenetFrames(b,e);this.tangents=g.tangents;this.normals=g.normals;this.binormals=g.binormals;var h=new n,l=new n,m=new v,p=new n,k,r,q=[],t=[],y=[],w=[];for(k=0;k=b;e-=d)f=Mh(e,a[e],a[e+1],f);f&&dc(f,f.next)&&(Zd(f),f=f.next);return f}function $d(a,b){if(!a)return a;b||(b=a);do{var c=!1;if(a.steiner||!dc(a,a.next)&&0!==ua(a.prev,a,a.next))a=a.next;else{Zd(a);a=b=a.prev;if(a===a.next)break;c=!0}}while(c||a!==b);return b} -function ae(a,b,c,d,e,f,g){if(a){if(!g&&f){var h=a,l=h;do null===l.z&&(l.z=ig(l.x,l.y,d,e,f)),l.prevZ=l.prev,l=l.nextZ=l.next;while(l!==h);l.prevZ.nextZ=null;l.prevZ=null;h=l;var m,p,k,r,q=1;do{l=h;var t=h=null;for(p=0;l;){p++;var n=l;for(m=k=0;mn!==t.next.y>n&&t.next.y!==t.y&&k<(t.next.x-t.x)*(n-t.y)/(t.next.y-t.y)+t.x&&(p=!p),t=t.next;while(t!==l);t=p}l=t}if(l){a=Oh(g,h);g=$d(g,g.next);a=$d(a,a.next);ae(g,b,c,d,e,f);ae(a,b,c,d,e,f);break a}h= -h.next}g=g.next}while(g!==a)}break}}}}function ak(a,b,c,d){var e=a.prev,f=a.next;if(0<=ua(e,a,f))return!1;var g=e.x>a.x?e.x>f.x?e.x:f.x:a.x>f.x?a.x:f.x,h=e.y>a.y?e.y>f.y?e.y:f.y:a.y>f.y?a.y:f.y,l=ig(e.x=l&&d&&d.z<=b;){if(c!==a.prev&&c!==a.next&&Tc(e.x,e.y,a.x,a.y,f.x,f.y,c.x,c.y)&&0<=ua(c.prev,c,c.next))return!1;c=c.prevZ;if(d!==a.prev&&d!==a.next&&Tc(e.x,e.y,a.x,a.y, -f.x,f.y,d.x,d.y)&&0<=ua(d.prev,d,d.next))return!1;d=d.nextZ}for(;c&&c.z>=l;){if(c!==a.prev&&c!==a.next&&Tc(e.x,e.y,a.x,a.y,f.x,f.y,c.x,c.y)&&0<=ua(c.prev,c,c.next))return!1;c=c.prevZ}for(;d&&d.z<=b;){if(d!==a.prev&&d!==a.next&&Tc(e.x,e.y,a.x,a.y,f.x,f.y,d.x,d.y)&&0<=ua(d.prev,d,d.next))return!1;d=d.nextZ}return!0}function bk(a,b){return a.x-b.x}function ck(a,b){var c=b,d=a.x,e=a.y,f=-Infinity;do{if(e<=c.y&&e>=c.next.y&&c.next.y!==c.y){var g=c.x+(e-c.y)*(c.next.x-c.x)/(c.next.y-c.y);if(g<=d&&g>f){f= -g;if(g===d){if(e===c.y)return c;if(e===c.next.y)return c.next}var h=c.x=c.x&&c.x>=g&&d!==c.x&&Tc(eh.x)&&be(c,a)&&(h=c,m=p)}c=c.next}return h}function ig(a,b,c,d,e){a=32767*(a-c)*e;b=32767*(b-d)*e;a=(a|a<<8)&16711935;a=(a|a<<4)&252645135;a=(a|a<<2)&858993459;b=(b|b<<8)&16711935;b=(b| -b<<4)&252645135;b=(b|b<<2)&858993459;return(a|a<<1)&1431655765|((b|b<<1)&1431655765)<<1}function dk(a){var b=a,c=a;do{if(b.xua(a.prev,a,a.next)?0<=ua(a,b,a.next)&&0<=ua(a,a.prev,b):0>ua(a,b,a.prev)||0>ua(a,a.next,b)}function Oh(a,b){var c=new jg(a.i,a.x,a.y),d=new jg(b.i,b.x,b.y),e=a.next,f=b.prev;a.next=b;b.prev=a;c.next=e;e.prev=c;d.next=c;c.prev=d;f.next=d;d.prev=f;return d}function Mh(a,b,c,d){a=new jg(a,b,c);d?(a.next=d.next,a.prev=d,d.next.prev=a,d.next=a):(a.prev=a,a.next=a);return a}function Zd(a){a.next.prev=a.prev;a.prev.next=a.next;a.prevZ&&(a.prevZ.nextZ= -a.nextZ);a.nextZ&&(a.nextZ.prevZ=a.prevZ)}function jg(a,b,c){this.i=a;this.x=b;this.y=c;this.nextZ=this.prevZ=this.z=this.next=this.prev=null;this.steiner=!1}function Ph(a){var b=a.length;2a.length&&console.error("THREE.ParametricGeometry: Function must now modify a Vector3 as third parameter.");var t=b+1;for(r=0;r<=c;r++){var z= +r/c;for(q=0;q<=b;q++){var w=q/b;a(w,z,l);e.push(l.x,l.y,l.z);0<=w-1E-5?(a(w-1E-5,z,m),p.subVectors(l,m)):(a(w+1E-5,z,m),p.subVectors(m,l));0<=z-1E-5?(a(w,z-1E-5,m),k.subVectors(l,m)):(a(w,z+1E-5,m),k.subVectors(m,l));h.crossVectors(p,k).normalize();f.push(h.x,h.y,h.z);g.push(w,z)}}for(r=0;rd&&1===a.x&&(l[b]=a.x-1);0===c.x&&0===c.z&&(l[b]=d/2/Math.PI+.5)}D.call(this);this.type="PolyhedronBufferGeometry";this.parameters={vertices:a,indices:b,radius:c,detail:d};c= +c||1;d=d||0;var h=[],l=[];(function(a){for(var c=new n,d=new n,g=new n,h=0;he&&(.2>b&&(l[a+0]+=1),.2>c&&(l[a+2]+=1),.2>d&&(l[a+4]+=1))})();this.addAttribute("position",new B(h,3));this.addAttribute("normal",new B(h.slice(),3));this.addAttribute("uv",new B(l,2));0===d?this.computeVertexNormals():this.normalizeNormals()}function Td(a,b){F.call(this); +this.type="TetrahedronGeometry";this.parameters={radius:a,detail:b};this.fromBufferGeometry(new Oc(a,b));this.mergeVertices()}function Oc(a,b){Aa.call(this,[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],a,b);this.type="TetrahedronBufferGeometry";this.parameters={radius:a,detail:b}}function Ud(a,b){F.call(this);this.type="OctahedronGeometry";this.parameters={radius:a,detail:b};this.fromBufferGeometry(new cc(a,b));this.mergeVertices()}function cc(a,b){Aa.call(this,[1,0,0,-1,0,0,0,1,0,0,-1, +0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],a,b);this.type="OctahedronBufferGeometry";this.parameters={radius:a,detail:b}}function Vd(a,b){F.call(this);this.type="IcosahedronGeometry";this.parameters={radius:a,detail:b};this.fromBufferGeometry(new Pc(a,b));this.mergeVertices()}function Pc(a,b){var c=(1+Math.sqrt(5))/2;Aa.call(this,[-1,c,0,1,c,0,-1,-c,0,1,-c,0,0,-1,c,0,1,c,0,-1,-c,0,1,-c,c,0,-1,c,0,1,-c,0,-1,-c,0,1],[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7, +6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],a,b);this.type="IcosahedronBufferGeometry";this.parameters={radius:a,detail:b}}function Wd(a,b){F.call(this);this.type="DodecahedronGeometry";this.parameters={radius:a,detail:b};this.fromBufferGeometry(new Qc(a,b));this.mergeVertices()}function Qc(a,b){var c=(1+Math.sqrt(5))/2,d=1/c;Aa.call(this,[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-d,-c,0,-d,c,0,d,-c,0,d,c,-d,-c,0,-d,c,0,d,-c,0,d,c,0,-c,0,-d,c,0,-d,-c, +0,d,c,0,d],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],a,b);this.type="DodecahedronBufferGeometry";this.parameters={radius:a,detail:b}}function Xd(a,b,c,d,e,f){F.call(this);this.type="TubeGeometry";this.parameters={path:a,tubularSegments:b,radius:c,radialSegments:d,closed:e};void 0!== +f&&console.warn("THREE.TubeGeometry: taper has been removed.");a=new dc(a,b,c,d,e);this.tangents=a.tangents;this.normals=a.normals;this.binormals=a.binormals;this.fromBufferGeometry(a);this.mergeVertices()}function dc(a,b,c,d,e){function f(e){p=a.getPointAt(e/b,p);var f=g.normals[e];e=g.binormals[e];for(r=0;r<=d;r++){var m=r/d*Math.PI*2,k=Math.sin(m);m=-Math.cos(m);l.x=m*f.x+k*e.x;l.y=m*f.y+k*e.y;l.z=m*f.z+k*e.z;l.normalize();t.push(l.x,l.y,l.z);h.x=p.x+c*l.x;h.y=p.y+c*l.y;h.z=p.z+c*l.z;q.push(h.x, +h.y,h.z)}}D.call(this);this.type="TubeBufferGeometry";this.parameters={path:a,tubularSegments:b,radius:c,radialSegments:d,closed:e};b=b||64;c=c||1;d=d||8;e=e||!1;var g=a.computeFrenetFrames(b,e);this.tangents=g.tangents;this.normals=g.normals;this.binormals=g.binormals;var h=new n,l=new n,m=new v,p=new n,k,r,q=[],t=[],z=[],w=[];for(k=0;k=b;e-=d)f=Lh(e,a[e],a[e+1],f);f&&ec(f,f.next)&&($d(f),f=f.next);return f}function ae(a,b){if(!a)return a;b||(b=a);do{var c=!1;if(a.steiner||!ec(a,a.next)&&0!==qa(a.prev,a,a.next))a=a.next;else{$d(a);a=b=a.prev;if(a===a.next)break;c=!0}}while(c||a!==b);return b} +function be(a,b,c,d,e,f,g){if(a){if(!g&&f){var h=a,l=h;do null===l.z&&(l.z=ig(l.x,l.y,d,e,f)),l.prevZ=l.prev,l=l.nextZ=l.next;while(l!==h);l.prevZ.nextZ=null;l.prevZ=null;h=l;var m,p,k,r,q=1;do{l=h;var t=h=null;for(p=0;l;){p++;var n=l;for(m=k=0;mn!==t.next.y>n&&t.next.y!==t.y&&k<(t.next.x-t.x)*(n-t.y)/(t.next.y-t.y)+t.x&&(p=!p),t=t.next;while(t!==l);t=p}l=t}if(l){a=Nh(g,h);g=ae(g,g.next);a=ae(a,a.next);be(g,b,c,d,e,f);be(a,b,c,d,e,f);break a}h= +h.next}g=g.next}while(g!==a)}break}}}}function Zj(a,b,c,d){var e=a.prev,f=a.next;if(0<=qa(e,a,f))return!1;var g=e.x>a.x?e.x>f.x?e.x:f.x:a.x>f.x?a.x:f.x,h=e.y>a.y?e.y>f.y?e.y:f.y:a.y>f.y?a.y:f.y,l=ig(e.x=l&&d&&d.z<=b;){if(c!==a.prev&&c!==a.next&&Tc(e.x,e.y,a.x,a.y,f.x,f.y,c.x,c.y)&&0<=qa(c.prev,c,c.next))return!1;c=c.prevZ;if(d!==a.prev&&d!==a.next&&Tc(e.x,e.y,a.x,a.y, +f.x,f.y,d.x,d.y)&&0<=qa(d.prev,d,d.next))return!1;d=d.nextZ}for(;c&&c.z>=l;){if(c!==a.prev&&c!==a.next&&Tc(e.x,e.y,a.x,a.y,f.x,f.y,c.x,c.y)&&0<=qa(c.prev,c,c.next))return!1;c=c.prevZ}for(;d&&d.z<=b;){if(d!==a.prev&&d!==a.next&&Tc(e.x,e.y,a.x,a.y,f.x,f.y,d.x,d.y)&&0<=qa(d.prev,d,d.next))return!1;d=d.nextZ}return!0}function ak(a,b){return a.x-b.x}function bk(a,b){var c=b,d=a.x,e=a.y,f=-Infinity;do{if(e<=c.y&&e>=c.next.y&&c.next.y!==c.y){var g=c.x+(e-c.y)*(c.next.x-c.x)/(c.next.y-c.y);if(g<=d&&g>f){f= +g;if(g===d){if(e===c.y)return c;if(e===c.next.y)return c.next}var h=c.x=c.x&&c.x>=g&&d!==c.x&&Tc(eh.x)&&ce(c,a)&&(h=c,m=p)}c=c.next}return h}function ig(a,b,c,d,e){a=32767*(a-c)*e;b=32767*(b-d)*e;a=(a|a<<8)&16711935;a=(a|a<<4)&252645135;a=(a|a<<2)&858993459;b=(b|b<<8)&16711935;b=(b| +b<<4)&252645135;b=(b|b<<2)&858993459;return(a|a<<1)&1431655765|((b|b<<1)&1431655765)<<1}function ck(a){var b=a,c=a;do{if(b.xqa(a.prev,a,a.next)?0<=qa(a,b,a.next)&&0<=qa(a,a.prev,b):0>qa(a,b,a.prev)||0>qa(a,a.next,b)}function Nh(a,b){var c=new jg(a.i,a.x,a.y),d=new jg(b.i,b.x,b.y),e=a.next,f=b.prev;a.next=b;b.prev=a;c.next=e;e.prev=c;d.next=c;c.prev=d;f.next=d;d.prev=f;return d}function Lh(a,b,c,d){a=new jg(a,b,c);d?(a.next=d.next,a.prev=d,d.next.prev=a,d.next=a):(a.prev=a,a.next=a);return a}function $d(a){a.next.prev=a.prev;a.prev.next=a.next;a.prevZ&&(a.prevZ.nextZ= +a.nextZ);a.nextZ&&(a.nextZ.prevZ=a.prevZ)}function jg(a,b,c){this.i=a;this.x=b;this.y=c;this.nextZ=this.prevZ=this.z=this.next=this.prev=null;this.steiner=!1}function Oh(a){var b=a.length;2Number.EPSILON){var l=Math.sqrt(h),m=Math.sqrt(f*f+g*g);h=b.x-e/l;b=b.y+d/l;g=((c.x-g/m-h)*g-(c.y+f/m-b)*f)/(d*g-e*f);f=h+d*g-a.x;d=b+e*g-a.y;e=f*f+d*d;if(2>=e)return new v(f,d);e=Math.sqrt(e/2)}else a=!1,d>Number.EPSILON?f>Number.EPSILON&&(a=!0):d<-Number.EPSILON?f<-Number.EPSILON&&(a=!0):Math.sign(e)=== -Math.sign(g)&&(a=!0),a?(f=-e,e=Math.sqrt(h)):(f=d,d=e,e=Math.sqrt(h/2));return new v(f/e,d/e)}function h(a,b){for(L=a.length;0<=--L;){var c=L;var f=L-1;0>f&&(f=a.length-1);var g,h=x+2*D;for(g=0;gk;k++){var n=m[f[k]];var r=m[f[(k+1)%3]];d[0]=Math.min(n,r);d[1]=Math.max(n,r);n=d[0]+","+d[1];void 0===e[n]?e[n]={index1:d[0],index2:d[1],face1:h,face2:void 0}:e[n].face2=h}for(n in e)if(d=e[n],void 0===d.face2||g[d.face1].normal.dot(g[d.face2].normal)<=b)f=a[d.index1],c.push(f.x,f.y,f.z),f=a[d.index2],c.push(f.x,f.y,f.z);this.addAttribute("position",new A(c,3))}function hc(a,b,c,d,e,f,g,h){G.call(this);this.type="CylinderGeometry"; -this.parameters={radiusTop:a,radiusBottom:b,height:c,radialSegments:d,heightSegments:e,openEnded:f,thetaStart:g,thetaLength:h};this.fromBufferGeometry(new rb(a,b,c,d,e,f,g,h));this.mergeVertices()}function rb(a,b,c,d,e,f,g,h){function l(c){var e,f=new v,l=new n,p=0,y=!0===c?a:b,x=!0===c?1:-1;var A=t;for(e=1;e<=d;e++)u.push(0,w*x,0),r.push(0,x,0),q.push(.5,.5),t++;var B=t;for(e=0;e<=d;e++){var D=e/d*h+g,F=Math.cos(D);D=Math.sin(D);l.x=y*D;l.y=w*x;l.z=y*F;u.push(l.x,l.y,l.z);r.push(0,x,0);f.x=.5*F+ -.5;f.y=.5*D*x+.5;q.push(f.x,f.y);t++}for(e=0;ethis.duration&&this.resetDuration()}function fk(a){switch(a.toLowerCase()){case "scalar":case "double":case "float":case "number":case "integer":return $c;case "vector":case "vector2":case "vector3":case "vector4":return ad; -case "color":return Re;case "quaternion":return ke;case "bool":case "boolean":return Qe;case "string":return Te}throw Error("THREE.KeyframeTrack: Unsupported typeName: "+a);}function gk(a){if(void 0===a.type)throw Error("THREE.KeyframeTrack: track type undefined, can not parse");var b=fk(a.type);if(void 0===a.times){var c=[],d=[];Z.flattenJSON(a.keys,c,d,"value");a.times=c;a.values=d}return void 0!==b.parse?b.parse(a):new b(a.name,a.times,a.values,a.interpolation)}function kg(a,b,c){var d=this,e= -!1,f=0,g=0,h=void 0;this.onStart=void 0;this.onLoad=a;this.onProgress=b;this.onError=c;this.itemStart=function(a){g++;if(!1===e&&void 0!==d.onStart)d.onStart(a,f,g);e=!0};this.itemEnd=function(a){f++;if(void 0!==d.onProgress)d.onProgress(a,f,g);if(f===g&&(e=!1,void 0!==d.onLoad))d.onLoad()};this.itemError=function(a){if(void 0!==d.onError)d.onError(a)};this.resolveURL=function(a){return h?h(a):a};this.setURLModifier=function(a){h=a;return this}}function aa(a){this.manager=void 0!==a?a:Th;this.crossOrigin= -"anonymous";this.resourcePath=this.path=""}function Na(a){aa.call(this,a)}function lg(a){aa.call(this,a)}function mg(a){aa.call(this,a)}function Ue(a){aa.call(this,a)}function bd(a){aa.call(this,a)}function Ve(a){aa.call(this,a)}function We(a){aa.call(this,a)}function F(){this.type="Curve";this.arcLengthDivisions=200}function Ia(a,b,c,d,e,f,g,h){F.call(this);this.type="EllipseCurve";this.aX=a||0;this.aY=b||0;this.xRadius=c||1;this.yRadius=d||1;this.aStartAngle=e||0;this.aEndAngle=f||2*Math.PI;this.aClockwise= -g||!1;this.aRotation=h||0}function cd(a,b,c,d,e,f){Ia.call(this,a,b,c,c,d,e,f);this.type="ArcCurve"}function ng(){var a=0,b=0,c=0,d=0;return{initCatmullRom:function(e,f,g,h,l){e=l*(g-e);h=l*(h-f);a=f;b=e;c=-3*f+3*g-2*e-h;d=2*f-2*g+e+h},initNonuniformCatmullRom:function(e,f,g,h,l,m,k){e=((f-e)/l-(g-e)/(l+m)+(g-f)/m)*m;h=((g-f)/m-(h-f)/(m+k)+(h-g)/k)*m;a=f;b=e;c=-3*f+3*g-2*e-h;d=2*f-2*g+e+h},calc:function(e){var f=e*e;return a+b*e+c*f+d*f*e}}}function sa(a,b,c,d){F.call(this);this.type="CatmullRomCurve3"; -this.points=a||[];this.closed=b||!1;this.curveType=c||"centripetal";this.tension=d||.5}function Uh(a,b,c,d,e){b=.5*(d-b);e=.5*(e-c);var f=a*a;return(2*c-2*d+b+e)*a*f+(-3*c+3*d-2*b-e)*f+b*a+c}function le(a,b,c,d){var e=1-a;return e*e*b+2*(1-a)*a*c+a*a*d}function me(a,b,c,d,e){var f=1-a,g=1-a;return f*f*f*b+3*g*g*a*c+3*(1-a)*a*a*d+a*a*a*e}function Sa(a,b,c,d){F.call(this);this.type="CubicBezierCurve";this.v0=a||new v;this.v1=b||new v;this.v2=c||new v;this.v3=d||new v}function gb(a,b,c,d){F.call(this); -this.type="CubicBezierCurve3";this.v0=a||new n;this.v1=b||new n;this.v2=c||new n;this.v3=d||new n}function Da(a,b){F.call(this);this.type="LineCurve";this.v1=a||new v;this.v2=b||new v}function Ta(a,b){F.call(this);this.type="LineCurve3";this.v1=a||new n;this.v2=b||new n}function Ua(a,b,c){F.call(this);this.type="QuadraticBezierCurve";this.v0=a||new v;this.v1=b||new v;this.v2=c||new v}function hb(a,b,c){F.call(this);this.type="QuadraticBezierCurve3";this.v0=a||new n;this.v1=b||new n;this.v2=c||new n} -function Va(a){F.call(this);this.type="SplineCurve";this.points=a||[]}function sb(){F.call(this);this.type="CurvePath";this.curves=[];this.autoClose=!1}function Wa(a){sb.call(this);this.type="Path";this.currentPoint=new v;a&&this.setFromPoints(a)}function Jb(a){Wa.call(this,a);this.uuid=O.generateUUID();this.type="Shape";this.holes=[]}function V(a,b){B.call(this);this.type="Light";this.color=new J(a);this.intensity=void 0!==b?b:1;this.receiveShadow=void 0}function Xe(a,b,c){V.call(this,a,c);this.type= -"HemisphereLight";this.castShadow=void 0;this.position.copy(B.DefaultUp);this.updateMatrix();this.groundColor=new J(b)}function ib(a){this.camera=a;this.bias=0;this.radius=1;this.mapSize=new v(512,512);this.mapPass=this.map=null;this.matrix=new P;this._frustum=new Ed;this._frameExtents=new v(1,1);this._viewportCount=1;this._viewports=[new da(0,0,1,1)]}function Ye(){ib.call(this,new la(50,1,.5,500))}function Ze(a,b,c,d,e,f){V.call(this,a,b);this.type="SpotLight";this.position.copy(B.DefaultUp);this.updateMatrix(); -this.target=new B;Object.defineProperty(this,"power",{get:function(){return this.intensity*Math.PI},set:function(a){this.intensity=a/Math.PI}});this.distance=void 0!==c?c:0;this.angle=void 0!==d?d:Math.PI/3;this.penumbra=void 0!==e?e:0;this.decay=void 0!==f?f:1;this.shadow=new Ye}function og(){ib.call(this,new la(90,1,.5,500));this._frameExtents=new v(4,2);this._viewportCount=6;this._viewports=[new da(2,1,1,1),new da(0,1,1,1),new da(3,1,1,1),new da(1,1,1,1),new da(3,0,1,1),new da(1,0,1,1)];this._cubeDirections= -[new n(1,0,0),new n(-1,0,0),new n(0,0,1),new n(0,0,-1),new n(0,1,0),new n(0,-1,0)];this._cubeUps=[new n(0,1,0),new n(0,1,0),new n(0,1,0),new n(0,1,0),new n(0,0,1),new n(0,0,-1)]}function $e(a,b,c,d){V.call(this,a,b);this.type="PointLight";Object.defineProperty(this,"power",{get:function(){return 4*this.intensity*Math.PI},set:function(a){this.intensity=a/(4*Math.PI)}});this.distance=void 0!==c?c:0;this.decay=void 0!==d?d:1;this.shadow=new og}function ne(a,b,c,d,e,f){bb.call(this);this.type="OrthographicCamera"; -this.zoom=1;this.view=null;this.left=void 0!==a?a:-1;this.right=void 0!==b?b:1;this.top=void 0!==c?c:1;this.bottom=void 0!==d?d:-1;this.near=void 0!==e?e:.1;this.far=void 0!==f?f:2E3;this.updateProjectionMatrix()}function af(){ib.call(this,new ne(-5,5,5,-5,.5,500))}function bf(a,b){V.call(this,a,b);this.type="DirectionalLight";this.position.copy(B.DefaultUp);this.updateMatrix();this.target=new B;this.shadow=new af}function cf(a,b){V.call(this,a,b);this.type="AmbientLight";this.castShadow=void 0}function df(a, -b,c,d){V.call(this,a,b);this.type="RectAreaLight";this.width=void 0!==c?c:10;this.height=void 0!==d?d:10}function ef(a){aa.call(this,a);this.textures={}}function ff(){D.call(this);this.type="InstancedBufferGeometry";this.maxInstancedCount=void 0}function gf(a,b,c,d){"number"===typeof c&&(d=c,c=!1,console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument."));N.call(this,a,b,c);this.meshPerAttribute=d||1}function hf(a){aa.call(this,a)}function jf(a){aa.call(this, -a)}function pg(a){"undefined"===typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported.");"undefined"===typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported.");aa.call(this,a);this.options=void 0}function qg(){this.type="ShapePath";this.color=new J;this.subPaths=[];this.currentPath=null}function rg(a){this.type="Font";this.data=a}function sg(a){aa.call(this,a)}function kf(a){aa.call(this,a)}function lf(){this.coefficients=[];for(var a= -0;9>a;a++)this.coefficients.push(new n)}function Xa(a,b){V.call(this,void 0,b);this.sh=void 0!==a?a:new lf}function tg(a,b,c){Xa.call(this,void 0,c);a=(new J).set(a);c=(new J).set(b);b=new n(a.r,a.g,a.b);a=new n(c.r,c.g,c.b);c=Math.sqrt(Math.PI);var d=c*Math.sqrt(.75);this.sh.coefficients[0].copy(b).add(a).multiplyScalar(c);this.sh.coefficients[1].copy(b).sub(a).multiplyScalar(d)}function ug(a,b){Xa.call(this,void 0,b);a=(new J).set(a);this.sh.coefficients[0].set(a.r,a.g,a.b).multiplyScalar(2*Math.sqrt(Math.PI))} -function Vh(){this.type="StereoCamera";this.aspect=1;this.eyeSep=.064;this.cameraL=new la;this.cameraL.layers.enable(1);this.cameraL.matrixAutoUpdate=!1;this.cameraR=new la;this.cameraR.layers.enable(2);this.cameraR.matrixAutoUpdate=!1;this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}function vg(a){this.autoStart=void 0!==a?a:!0;this.elapsedTime=this.oldTime=this.startTime=0;this.running=!1}function wg(){B.call(this);this.type="AudioListener";this.context=xg.getContext(); -this.gain=this.context.createGain();this.gain.connect(this.context.destination);this.filter=null;this.timeDelta=0;this._clock=new vg}function dd(a){B.call(this);this.type="Audio";this.listener=a;this.context=a.context;this.gain=this.context.createGain();this.gain.connect(a.getInput());this.autoplay=!1;this.buffer=null;this.detune=0;this.loop=!1;this.offset=this.startTime=0;this.duration=void 0;this.playbackRate=1;this.isPlaying=!1;this.hasPlaybackControl=!0;this.sourceType="empty";this.filters=[]} -function yg(a){dd.call(this,a);this.panner=this.context.createPanner();this.panner.panningModel="HRTF";this.panner.connect(this.gain)}function zg(a,b){this.analyser=a.context.createAnalyser();this.analyser.fftSize=void 0!==b?b:2048;this.data=new Uint8Array(this.analyser.frequencyBinCount);a.getOutput().connect(this.analyser)}function Ag(a,b,c){this.binding=a;this.valueSize=c;a=Float64Array;switch(b){case "quaternion":b=this._slerp;break;case "string":case "bool":a=Array;b=this._select;break;default:b= -this._lerp}this.buffer=new a(4*c);this._mixBufferRegion=b;this.referenceCount=this.useCount=this.cumulativeWeight=0}function Wh(a,b,c){c=c||ma.parseTrackName(b);this._targetGroup=a;this._bindings=a.subscribe_(b,c)}function ma(a,b,c){this.path=b;this.parsedPath=c||ma.parseTrackName(b);this.node=ma.findNode(a,this.parsedPath.nodeName)||a;this.rootNode=a}function Xh(){this.uuid=O.generateUUID();this._objects=Array.prototype.slice.call(arguments);this.nCachedObjects_=0;var a={};this._indicesByUUID=a; -for(var b=0,c=arguments.length;b!==c;++b)a[arguments[b].uuid]=b;this._paths=[];this._parsedPaths=[];this._bindings=[];this._bindingsIndicesByPath={};var d=this;this.stats={objects:{get total(){return d._objects.length},get inUse(){return this.total-d.nCachedObjects_}},get bindingsPerObject(){return d._bindings.length}}}function Yh(a,b,c){this._mixer=a;this._clip=b;this._localRoot=c||null;a=b.tracks;b=a.length;c=Array(b);for(var d={endingStart:2400,endingEnd:2400},e=0;e!==b;++e){var f=a[e].createInterpolant(null); -c[e]=f;f.settings=d}this._interpolantSettings=d;this._interpolants=c;this._propertyBindings=Array(b);this._weightInterpolant=this._timeScaleInterpolant=this._byClipCacheIndex=this._cacheIndex=null;this.loop=2201;this._loopCount=-1;this._startTime=null;this.time=0;this._effectiveWeight=this.weight=this._effectiveTimeScale=this.timeScale=1;this.repetitions=Infinity;this.paused=!1;this.enabled=!0;this.clampWhenFinished=!1;this.zeroSlopeAtEnd=this.zeroSlopeAtStart=!0}function Bg(a){this._root=a;this._initMemoryManager(); -this.time=this._accuIndex=0;this.timeScale=1}function mf(a,b){"string"===typeof a&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),a=b);this.value=a}function Cg(a,b,c){ac.call(this,a,b);this.meshPerAttribute=c||1}function Zh(a,b,c,d){this.ray=new Sb(a,b);this.near=c||0;this.far=d||Infinity;this.camera=null;this.params={Mesh:{},Line:{},LOD:{},Points:{threshold:1},Sprite:{}};Object.defineProperties(this.params,{PointCloud:{get:function(){console.warn("THREE.Raycaster: params.PointCloud has been renamed to params.Points."); -return this.Points}}})}function $h(a,b){return a.distance-b.distance}function Dg(a,b,c,d){if(!1!==a.visible&&(a.raycast(b,c),!0===d)){a=a.children;d=0;for(var e=a.length;dc;c++,d++){var e=c/32*Math.PI*2,f=d/32*Math.PI*2;b.push(Math.cos(e),Math.sin(e),1,Math.cos(f),Math.sin(f),1)}a.addAttribute("position",new A(b,3));b=new Y({fog:!1});this.cone=new R(a,b);this.add(this.cone);this.update()}function ci(a){var b=[];a&&a.isBone&&b.push(a);for(var c= -0;ca?-1:0ve;ve++)qa[ve]=(16>ve?"0":"")+ -ve.toString(16);var O={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:function(){var a=4294967295*Math.random()|0,b=4294967295*Math.random()|0,c=4294967295*Math.random()|0,d=4294967295*Math.random()|0;return(qa[a&255]+qa[a>>8&255]+qa[a>>16&255]+qa[a>>24&255]+"-"+qa[b&255]+qa[b>>8&255]+"-"+qa[b>>16&15|64]+qa[b>>24&255]+"-"+qa[c&63|128]+qa[c>>8&255]+"-"+qa[c>>16&255]+qa[c>>24&255]+qa[d&255]+qa[d>>8&255]+qa[d>>16&255]+qa[d>>24&255]).toUpperCase()},clamp:function(a,b,c){return Math.max(b,Math.min(c, +Math.sign(g)&&(a=!0),a?(f=-e,e=Math.sqrt(h)):(f=d,d=e,e=Math.sqrt(h/2));return new v(f/e,d/e)}function h(a,b){for(J=a.length;0<=--J;){var c=J;var f=J-1;0>f&&(f=a.length-1);var g,h=x+2*D;for(g=0;gk;k++){var n=m[f[k]];var r=m[f[(k+1)%3]];d[0]=Math.min(n,r);d[1]=Math.max(n,r);n=d[0]+","+d[1];void 0===e[n]?e[n]={index1:d[0],index2:d[1],face1:h,face2:void 0}:e[n].face2=h}for(n in e)if(d=e[n],void 0===d.face2||g[d.face1].normal.dot(g[d.face2].normal)<=b)f=a[d.index1],c.push(f.x,f.y,f.z),f=a[d.index2],c.push(f.x,f.y,f.z);this.addAttribute("position",new B(c,3))}function ic(a,b,c,d, +e,f,g,h){F.call(this);this.type="CylinderGeometry";this.parameters={radiusTop:a,radiusBottom:b,height:c,radialSegments:d,heightSegments:e,openEnded:f,thetaStart:g,thetaLength:h};this.fromBufferGeometry(new qb(a,b,c,d,e,f,g,h));this.mergeVertices()}function qb(a,b,c,d,e,f,g,h){function l(c){var e,f=new v,l=new n,p=0,z=!0===c?a:b,x=!0===c?1:-1;var B=t;for(e=1;e<=d;e++)u.push(0,w*x,0),r.push(0,x,0),q.push(.5,.5),t++;var A=t;for(e=0;e<=d;e++){var D=e/d*h+g,C=Math.cos(D);D=Math.sin(D);l.x=z*D;l.y=w*x; +l.z=z*C;u.push(l.x,l.y,l.z);r.push(0,x,0);f.x=.5*C+.5;f.y=.5*D*x+.5;q.push(f.x,f.y);t++}for(e=0;ethis.duration&&this.resetDuration()}function ek(a){switch(a.toLowerCase()){case "scalar":case "double":case "float":case "number":case "integer":return $c; +case "vector":case "vector2":case "vector3":case "vector4":return ad;case "color":return Qe;case "quaternion":return le;case "bool":case "boolean":return Pe;case "string":return Se}throw Error("THREE.KeyframeTrack: Unsupported typeName: "+a);}function fk(a){if(void 0===a.type)throw Error("THREE.KeyframeTrack: track type undefined, can not parse");var b=ek(a.type);if(void 0===a.times){var c=[],d=[];ta.flattenJSON(a.keys,c,d,"value");a.times=c;a.values=d}return void 0!==b.parse?b.parse(a):new b(a.name, +a.times,a.values,a.interpolation)}function kg(a,b,c){var d=this,e=!1,f=0,g=0,h=void 0;this.onStart=void 0;this.onLoad=a;this.onProgress=b;this.onError=c;this.itemStart=function(a){g++;if(!1===e&&void 0!==d.onStart)d.onStart(a,f,g);e=!0};this.itemEnd=function(a){f++;if(void 0!==d.onProgress)d.onProgress(a,f,g);if(f===g&&(e=!1,void 0!==d.onLoad))d.onLoad()};this.itemError=function(a){if(void 0!==d.onError)d.onError(a)};this.resolveURL=function(a){return h?h(a):a};this.setURLModifier=function(a){h=a; +return this}}function Z(a){this.manager=void 0!==a?a:Sh;this.crossOrigin="anonymous";this.resourcePath=this.path=""}function Na(a){Z.call(this,a)}function lg(a){Z.call(this,a)}function mg(a){Z.call(this,a)}function Te(a){Z.call(this,a)}function bd(a){Z.call(this,a)}function Ue(a){Z.call(this,a)}function Ve(a){Z.call(this,a)}function C(){this.type="Curve";this.arcLengthDivisions=200}function Ia(a,b,c,d,e,f,g,h){C.call(this);this.type="EllipseCurve";this.aX=a||0;this.aY=b||0;this.xRadius=c||1;this.yRadius= +d||1;this.aStartAngle=e||0;this.aEndAngle=f||2*Math.PI;this.aClockwise=g||!1;this.aRotation=h||0}function cd(a,b,c,d,e,f){Ia.call(this,a,b,c,c,d,e,f);this.type="ArcCurve"}function ng(){var a=0,b=0,c=0,d=0;return{initCatmullRom:function(e,f,g,h,l){e=l*(g-e);h=l*(h-f);a=f;b=e;c=-3*f+3*g-2*e-h;d=2*f-2*g+e+h},initNonuniformCatmullRom:function(e,f,g,h,l,m,k){e=((f-e)/l-(g-e)/(l+m)+(g-f)/m)*m;h=((g-f)/m-(h-f)/(m+k)+(h-g)/k)*m;a=f;b=e;c=-3*f+3*g-2*e-h;d=2*f-2*g+e+h},calc:function(e){var f=e*e;return a+b* +e+c*f+d*f*e}}}function wa(a,b,c,d){C.call(this);this.type="CatmullRomCurve3";this.points=a||[];this.closed=b||!1;this.curveType=c||"centripetal";this.tension=d||.5}function Th(a,b,c,d,e){b=.5*(d-b);e=.5*(e-c);var f=a*a;return(2*c-2*d+b+e)*a*f+(-3*c+3*d-2*b-e)*f+b*a+c}function me(a,b,c,d){var e=1-a;return e*e*b+2*(1-a)*a*c+a*a*d}function ne(a,b,c,d,e){var f=1-a,g=1-a;return f*f*f*b+3*g*g*a*c+3*(1-a)*a*a*d+a*a*a*e}function Sa(a,b,c,d){C.call(this);this.type="CubicBezierCurve";this.v0=a||new v;this.v1= +b||new v;this.v2=c||new v;this.v3=d||new v}function gb(a,b,c,d){C.call(this);this.type="CubicBezierCurve3";this.v0=a||new n;this.v1=b||new n;this.v2=c||new n;this.v3=d||new n}function xa(a,b){C.call(this);this.type="LineCurve";this.v1=a||new v;this.v2=b||new v}function Ta(a,b){C.call(this);this.type="LineCurve3";this.v1=a||new n;this.v2=b||new n}function Ua(a,b,c){C.call(this);this.type="QuadraticBezierCurve";this.v0=a||new v;this.v1=b||new v;this.v2=c||new v}function hb(a,b,c){C.call(this);this.type= +"QuadraticBezierCurve3";this.v0=a||new n;this.v1=b||new n;this.v2=c||new n}function Va(a){C.call(this);this.type="SplineCurve";this.points=a||[]}function rb(){C.call(this);this.type="CurvePath";this.curves=[];this.autoClose=!1}function Wa(a){rb.call(this);this.type="Path";this.currentPoint=new v;a&&this.setFromPoints(a)}function Ib(a){Wa.call(this,a);this.uuid=N.generateUUID();this.type="Shape";this.holes=[]}function ba(a,b){A.call(this);this.type="Light";this.color=new I(a);this.intensity=void 0!== +b?b:1;this.receiveShadow=void 0}function We(a,b,c){ba.call(this,a,c);this.type="HemisphereLight";this.castShadow=void 0;this.position.copy(A.DefaultUp);this.updateMatrix();this.groundColor=new I(b)}function ib(a){this.camera=a;this.bias=0;this.radius=1;this.mapSize=new v(512,512);this.mapPass=this.map=null;this.matrix=new W;this._frustum=new Ed;this._frameExtents=new v(1,1);this._viewportCount=1;this._viewports=[new da(0,0,1,1)]}function Xe(){ib.call(this,new ja(50,1,.5,500))}function Ye(a,b,c,d, +e,f){ba.call(this,a,b);this.type="SpotLight";this.position.copy(A.DefaultUp);this.updateMatrix();this.target=new A;Object.defineProperty(this,"power",{get:function(){return this.intensity*Math.PI},set:function(a){this.intensity=a/Math.PI}});this.distance=void 0!==c?c:0;this.angle=void 0!==d?d:Math.PI/3;this.penumbra=void 0!==e?e:0;this.decay=void 0!==f?f:1;this.shadow=new Xe}function og(){ib.call(this,new ja(90,1,.5,500));this._frameExtents=new v(4,2);this._viewportCount=6;this._viewports=[new da(2, +1,1,1),new da(0,1,1,1),new da(3,1,1,1),new da(1,1,1,1),new da(3,0,1,1),new da(1,0,1,1)];this._cubeDirections=[new n(1,0,0),new n(-1,0,0),new n(0,0,1),new n(0,0,-1),new n(0,1,0),new n(0,-1,0)];this._cubeUps=[new n(0,1,0),new n(0,1,0),new n(0,1,0),new n(0,1,0),new n(0,0,1),new n(0,0,-1)]}function Ze(a,b,c,d){ba.call(this,a,b);this.type="PointLight";Object.defineProperty(this,"power",{get:function(){return 4*this.intensity*Math.PI},set:function(a){this.intensity=a/(4*Math.PI)}});this.distance=void 0!== +c?c:0;this.decay=void 0!==d?d:1;this.shadow=new og}function oe(a,b,c,d,e,f){bb.call(this);this.type="OrthographicCamera";this.zoom=1;this.view=null;this.left=void 0!==a?a:-1;this.right=void 0!==b?b:1;this.top=void 0!==c?c:1;this.bottom=void 0!==d?d:-1;this.near=void 0!==e?e:.1;this.far=void 0!==f?f:2E3;this.updateProjectionMatrix()}function $e(){ib.call(this,new oe(-5,5,5,-5,.5,500))}function af(a,b){ba.call(this,a,b);this.type="DirectionalLight";this.position.copy(A.DefaultUp);this.updateMatrix(); +this.target=new A;this.shadow=new $e}function bf(a,b){ba.call(this,a,b);this.type="AmbientLight";this.castShadow=void 0}function cf(a,b,c,d){ba.call(this,a,b);this.type="RectAreaLight";this.width=void 0!==c?c:10;this.height=void 0!==d?d:10}function df(a){Z.call(this,a);this.textures={}}function ef(){D.call(this);this.type="InstancedBufferGeometry";this.maxInstancedCount=void 0}function ff(a,b,c,d){"number"===typeof c&&(d=c,c=!1,console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.")); +L.call(this,a,b,c);this.meshPerAttribute=d||1}function gf(a){Z.call(this,a)}function hf(a){Z.call(this,a)}function pg(a){"undefined"===typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported.");"undefined"===typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported.");Z.call(this,a);this.options=void 0}function qg(){this.type="ShapePath";this.color=new I;this.subPaths=[];this.currentPath=null}function rg(a){this.type="Font";this.data=a}function sg(a){Z.call(this, +a)}function jf(a){Z.call(this,a)}function kf(){this.coefficients=[];for(var a=0;9>a;a++)this.coefficients.push(new n)}function Xa(a,b){ba.call(this,void 0,b);this.sh=void 0!==a?a:new kf}function tg(a,b,c){Xa.call(this,void 0,c);a=(new I).set(a);c=(new I).set(b);b=new n(a.r,a.g,a.b);a=new n(c.r,c.g,c.b);c=Math.sqrt(Math.PI);var d=c*Math.sqrt(.75);this.sh.coefficients[0].copy(b).add(a).multiplyScalar(c);this.sh.coefficients[1].copy(b).sub(a).multiplyScalar(d)}function ug(a,b){Xa.call(this,void 0,b); +a=(new I).set(a);this.sh.coefficients[0].set(a.r,a.g,a.b).multiplyScalar(2*Math.sqrt(Math.PI))}function Uh(){this.type="StereoCamera";this.aspect=1;this.eyeSep=.064;this.cameraL=new ja;this.cameraL.layers.enable(1);this.cameraL.matrixAutoUpdate=!1;this.cameraR=new ja;this.cameraR.layers.enable(2);this.cameraR.matrixAutoUpdate=!1;this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}function vg(a){this.autoStart=void 0!==a?a:!0;this.elapsedTime=this.oldTime=this.startTime= +0;this.running=!1}function wg(){A.call(this);this.type="AudioListener";this.context=xg.getContext();this.gain=this.context.createGain();this.gain.connect(this.context.destination);this.filter=null;this.timeDelta=0;this._clock=new vg}function dd(a){A.call(this);this.type="Audio";this.listener=a;this.context=a.context;this.gain=this.context.createGain();this.gain.connect(a.getInput());this.autoplay=!1;this.buffer=null;this.detune=0;this.loop=!1;this.offset=this.startTime=0;this.duration=void 0;this.playbackRate= +1;this.isPlaying=!1;this.hasPlaybackControl=!0;this.sourceType="empty";this.filters=[]}function yg(a){dd.call(this,a);this.panner=this.context.createPanner();this.panner.panningModel="HRTF";this.panner.connect(this.gain)}function zg(a,b){this.analyser=a.context.createAnalyser();this.analyser.fftSize=void 0!==b?b:2048;this.data=new Uint8Array(this.analyser.frequencyBinCount);a.getOutput().connect(this.analyser)}function Ag(a,b,c){this.binding=a;this.valueSize=c;a=Float64Array;switch(b){case "quaternion":b= +this._slerp;break;case "string":case "bool":a=Array;b=this._select;break;default:b=this._lerp}this.buffer=new a(4*c);this._mixBufferRegion=b;this.referenceCount=this.useCount=this.cumulativeWeight=0}function Vh(a,b,c){c=c||ya.parseTrackName(b);this._targetGroup=a;this._bindings=a.subscribe_(b,c)}function ya(a,b,c){this.path=b;this.parsedPath=c||ya.parseTrackName(b);this.node=ya.findNode(a,this.parsedPath.nodeName)||a;this.rootNode=a}function Wh(){this.uuid=N.generateUUID();this._objects=Array.prototype.slice.call(arguments); +this.nCachedObjects_=0;var a={};this._indicesByUUID=a;for(var b=0,c=arguments.length;b!==c;++b)a[arguments[b].uuid]=b;this._paths=[];this._parsedPaths=[];this._bindings=[];this._bindingsIndicesByPath={};var d=this;this.stats={objects:{get total(){return d._objects.length},get inUse(){return this.total-d.nCachedObjects_}},get bindingsPerObject(){return d._bindings.length}}}function Xh(a,b,c){this._mixer=a;this._clip=b;this._localRoot=c||null;a=b.tracks;b=a.length;c=Array(b);for(var d={endingStart:2400, +endingEnd:2400},e=0;e!==b;++e){var f=a[e].createInterpolant(null);c[e]=f;f.settings=d}this._interpolantSettings=d;this._interpolants=c;this._propertyBindings=Array(b);this._weightInterpolant=this._timeScaleInterpolant=this._byClipCacheIndex=this._cacheIndex=null;this.loop=2201;this._loopCount=-1;this._startTime=null;this.time=0;this._effectiveWeight=this.weight=this._effectiveTimeScale=this.timeScale=1;this.repetitions=Infinity;this.paused=!1;this.enabled=!0;this.clampWhenFinished=!1;this.zeroSlopeAtEnd= +this.zeroSlopeAtStart=!0}function Bg(a){this._root=a;this._initMemoryManager();this.time=this._accuIndex=0;this.timeScale=1}function lf(a,b){"string"===typeof a&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),a=b);this.value=a}function Cg(a,b,c){bc.call(this,a,b);this.meshPerAttribute=c||1}function Yh(a,b,c,d){this.ray=new Rb(a,b);this.near=c||0;this.far=d||Infinity;this.camera=null;this.params={Mesh:{},Line:{},LOD:{},Points:{threshold:1},Sprite:{}};Object.defineProperties(this.params, +{PointCloud:{get:function(){console.warn("THREE.Raycaster: params.PointCloud has been renamed to params.Points.");return this.Points}}})}function Zh(a,b){return a.distance-b.distance}function Dg(a,b,c,d){if(!1!==a.visible&&(a.raycast(b,c),!0===d)){a=a.children;d=0;for(var e=a.length;dc;c++,d++){var e=c/32*Math.PI*2,f=d/32*Math.PI*2;b.push(Math.cos(e),Math.sin(e),1,Math.cos(f),Math.sin(f),1)}a.addAttribute("position",new B(b,3)); +b=new P({fog:!1});this.cone=new aa(a,b);this.add(this.cone);this.update()}function bi(a){var b=[];a&&a.isBone&&b.push(a);for(var c=0;ca?-1:0we;we++)ua[we]=(16>we?"0":"")+ +we.toString(16);var N={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:function(){var a=4294967295*Math.random()|0,b=4294967295*Math.random()|0,c=4294967295*Math.random()|0,d=4294967295*Math.random()|0;return(ua[a&255]+ua[a>>8&255]+ua[a>>16&255]+ua[a>>24&255]+"-"+ua[b&255]+ua[b>>8&255]+"-"+ua[b>>16&15|64]+ua[b>>24&255]+"-"+ua[c&63|128]+ua[c>>8&255]+"-"+ua[c>>16&255]+ua[c>>24&255]+ua[d&255]+ua[d>>8&255]+ua[d>>16&255]+ua[d>>24&255]).toUpperCase()},clamp:function(a,b,c){return Math.max(b,Math.min(c, a))},euclideanModulo:function(a,b){return(a%b+b)%b},mapLinear:function(a,b,c,d,e){return d+(a-b)*(e-d)/(c-b)},lerp:function(a,b,c){return(1-c)*a+c*b},smoothstep:function(a,b,c){if(a<=b)return 0;if(a>=c)return 1;a=(a-b)/(c-b);return a*a*(3-2*a)},smootherstep:function(a,b,c){if(a<=b)return 0;if(a>=c)return 1;a=(a-b)/(c-b);return a*a*a*(a*(6*a-15)+10)},randInt:function(a,b){return a+Math.floor(Math.random()*(b-a+1))},randFloat:function(a,b){return a+Math.random()*(b-a)},randFloatSpread:function(a){return a* -(.5-Math.random())},degToRad:function(a){return a*O.DEG2RAD},radToDeg:function(a){return a*O.RAD2DEG},isPowerOfTwo:function(a){return 0===(a&a-1)&&0!==a},ceilPowerOfTwo:function(a){return Math.pow(2,Math.ceil(Math.log(a)/Math.LN2))},floorPowerOfTwo:function(a){return Math.pow(2,Math.floor(Math.log(a)/Math.LN2))}};Object.defineProperties(v.prototype,{width:{get:function(){return this.x},set:function(a){this.x=a}},height:{get:function(){return this.y},set:function(a){this.y=a}}});Object.assign(v.prototype, +(.5-Math.random())},degToRad:function(a){return a*N.DEG2RAD},radToDeg:function(a){return a*N.RAD2DEG},isPowerOfTwo:function(a){return 0===(a&a-1)&&0!==a},ceilPowerOfTwo:function(a){return Math.pow(2,Math.ceil(Math.log(a)/Math.LN2))},floorPowerOfTwo:function(a){return Math.pow(2,Math.floor(Math.log(a)/Math.LN2))}};Object.defineProperties(v.prototype,{width:{get:function(){return this.x},set:function(a){this.x=a}},height:{get:function(){return this.y},set:function(a){this.y=a}}});Object.assign(v.prototype, {isVector2:!0,set:function(a,b){this.x=a;this.y=b;return this},setScalar:function(a){this.y=this.x=a;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setComponent:function(a,b){switch(a){case 0:this.x=b;break;case 1:this.y=b;break;default:throw Error("index is out of range: "+a);}return this},getComponent:function(a){switch(a){case 0:return this.x;case 1:return this.y;default:throw Error("index is out of range: "+a);}},clone:function(){return new this.constructor(this.x, this.y)},copy:function(a){this.x=a.x;this.y=a.y;return this},add:function(a,b){if(void 0!==b)return console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(a,b);this.x+=a.x;this.y+=a.y;return this},addScalar:function(a){this.x+=a;this.y+=a;return this},addVectors:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},addScaledVector:function(a,b){this.x+=a.x*b;this.y+=a.y*b;return this},sub:function(a,b){if(void 0!==b)return console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."), this.subVectors(a,b);this.x-=a.x;this.y-=a.y;return this},subScalar:function(a){this.x-=a;this.y-=a;return this},subVectors:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this},multiply:function(a){this.x*=a.x;this.y*=a.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},divide:function(a){this.x/=a.x;this.y/=a.y;return this},divideScalar:function(a){return this.multiplyScalar(1/a)},applyMatrix3:function(a){var b=this.x,c=this.y;a=a.elements;this.x=a[0]*b+a[3]*c+a[6];this.y= @@ -341,45 +340,45 @@ a[1]*b+a[4]*c+a[7];return this},min:function(a){this.x=Math.min(this.x,a.x);this 1).multiplyScalar(Math.max(a,Math.min(b,c)))},floor:function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);return this},ceil:function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);return this},round:function(){this.x=Math.round(this.x);this.y=Math.round(this.y);return this},roundToZero:function(){this.x=0>this.x?Math.ceil(this.x):Math.floor(this.x);this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y);return this},negate:function(){this.x=-this.x;this.y=-this.y;return this},dot:function(a){return this.x* a.x+this.y*a.y},cross:function(a){return this.x*a.y-this.y*a.x},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length()||1)},angle:function(){var a=Math.atan2(this.y,this.x);0>a&&(a+=2*Math.PI);return a},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b= this.x-a.x;a=this.y-a.y;return b*b+a*a},manhattanDistanceTo:function(a){return Math.abs(this.x-a.x)+Math.abs(this.y-a.y)},setLength:function(a){return this.normalize().multiplyScalar(a)},lerp:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;return this},lerpVectors:function(a,b,c){return this.subVectors(b,a).multiplyScalar(c).add(a)},equals:function(a){return a.x===this.x&&a.y===this.y},fromArray:function(a,b){void 0===b&&(b=0);this.x=a[b];this.y=a[b+1];return this},toArray:function(a, -b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this.x;a[b+1]=this.y;return a},fromBufferAttribute:function(a,b,c){void 0!==c&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute().");this.x=a.getX(b);this.y=a.getY(b);return this},rotateAround:function(a,b){var c=Math.cos(b);b=Math.sin(b);var d=this.x-a.x,e=this.y-a.y;this.x=d*c-e*b+a.x;this.y=d*b+e*c+a.y;return this}});Object.assign(na,{slerp:function(a,b,c,d){return c.copy(a).slerp(b,d)},slerpFlat:function(a,b,c,d,e,f,g){var h= -c[d+0],l=c[d+1],m=c[d+2];c=c[d+3];d=e[f+0];var k=e[f+1],n=e[f+2];e=e[f+3];if(c!==e||h!==d||l!==k||m!==n){f=1-g;var r=h*d+l*k+m*n+c*e,q=0<=r?1:-1,t=1-r*r;t>Number.EPSILON&&(t=Math.sqrt(t),r=Math.atan2(t,r*q),f=Math.sin(f*r)/t,g=Math.sin(g*r)/t);q*=g;h=h*f+d*q;l=l*f+k*q;m=m*f+n*q;c=c*f+e*q;f===1-g&&(g=1/Math.sqrt(h*h+l*l+m*m+c*c),h*=g,l*=g,m*=g,c*=g)}a[b]=h;a[b+1]=l;a[b+2]=m;a[b+3]=c}});Object.defineProperties(na.prototype,{x:{get:function(){return this._x},set:function(a){this._x=a;this._onChangeCallback()}}, -y:{get:function(){return this._y},set:function(a){this._y=a;this._onChangeCallback()}},z:{get:function(){return this._z},set:function(a){this._z=a;this._onChangeCallback()}},w:{get:function(){return this._w},set:function(a){this._w=a;this._onChangeCallback()}}});Object.assign(na.prototype,{isQuaternion:!0,set:function(a,b,c,d){this._x=a;this._y=b;this._z=c;this._w=d;this._onChangeCallback();return this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(a){this._x= +b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this.x;a[b+1]=this.y;return a},fromBufferAttribute:function(a,b,c){void 0!==c&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute().");this.x=a.getX(b);this.y=a.getY(b);return this},rotateAround:function(a,b){var c=Math.cos(b);b=Math.sin(b);var d=this.x-a.x,e=this.y-a.y;this.x=d*c-e*b+a.x;this.y=d*b+e*c+a.y;return this}});Object.assign(sa,{slerp:function(a,b,c,d){return c.copy(a).slerp(b,d)},slerpFlat:function(a,b,c,d,e,f,g){var h= +c[d+0],l=c[d+1],m=c[d+2];c=c[d+3];d=e[f+0];var k=e[f+1],n=e[f+2];e=e[f+3];if(c!==e||h!==d||l!==k||m!==n){f=1-g;var r=h*d+l*k+m*n+c*e,q=0<=r?1:-1,t=1-r*r;t>Number.EPSILON&&(t=Math.sqrt(t),r=Math.atan2(t,r*q),f=Math.sin(f*r)/t,g=Math.sin(g*r)/t);q*=g;h=h*f+d*q;l=l*f+k*q;m=m*f+n*q;c=c*f+e*q;f===1-g&&(g=1/Math.sqrt(h*h+l*l+m*m+c*c),h*=g,l*=g,m*=g,c*=g)}a[b]=h;a[b+1]=l;a[b+2]=m;a[b+3]=c}});Object.defineProperties(sa.prototype,{x:{get:function(){return this._x},set:function(a){this._x=a;this._onChangeCallback()}}, +y:{get:function(){return this._y},set:function(a){this._y=a;this._onChangeCallback()}},z:{get:function(){return this._z},set:function(a){this._z=a;this._onChangeCallback()}},w:{get:function(){return this._w},set:function(a){this._w=a;this._onChangeCallback()}}});Object.assign(sa.prototype,{isQuaternion:!0,set:function(a,b,c,d){this._x=a;this._y=b;this._z=c;this._w=d;this._onChangeCallback();return this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(a){this._x= a.x;this._y=a.y;this._z=a.z;this._w=a.w;this._onChangeCallback();return this},setFromEuler:function(a,b){if(!a||!a.isEuler)throw Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var c=a._x,d=a._y,e=a._z;a=a.order;var f=Math.cos,g=Math.sin,h=f(c/2),l=f(d/2);f=f(e/2);c=g(c/2);d=g(d/2);e=g(e/2);"XYZ"===a?(this._x=c*l*f+h*d*e,this._y=h*d*f-c*l*e,this._z=h*l*e+c*d*f,this._w=h*l*f-c*d*e):"YXZ"===a?(this._x=c*l*f+h*d*e,this._y=h*d*f-c*l*e,this._z= h*l*e-c*d*f,this._w=h*l*f+c*d*e):"ZXY"===a?(this._x=c*l*f-h*d*e,this._y=h*d*f+c*l*e,this._z=h*l*e+c*d*f,this._w=h*l*f-c*d*e):"ZYX"===a?(this._x=c*l*f-h*d*e,this._y=h*d*f+c*l*e,this._z=h*l*e-c*d*f,this._w=h*l*f+c*d*e):"YZX"===a?(this._x=c*l*f+h*d*e,this._y=h*d*f+c*l*e,this._z=h*l*e-c*d*f,this._w=h*l*f-c*d*e):"XZY"===a&&(this._x=c*l*f-h*d*e,this._y=h*d*f-c*l*e,this._z=h*l*e+c*d*f,this._w=h*l*f+c*d*e);!1!==b&&this._onChangeCallback();return this},setFromAxisAngle:function(a,b){b/=2;var c=Math.sin(b); this._x=a.x*c;this._y=a.y*c;this._z=a.z*c;this._w=Math.cos(b);this._onChangeCallback();return this},setFromRotationMatrix:function(a){var b=a.elements,c=b[0];a=b[4];var d=b[8],e=b[1],f=b[5],g=b[9],h=b[2],l=b[6];b=b[10];var m=c+f+b;0f&&c>b?(c=2*Math.sqrt(1+c-f-b),this._w=(l-g)/c,this._x=.25*c,this._y=(a+e)/c,this._z=(d+h)/c):f>b?(c=2*Math.sqrt(1+f-c-b),this._w=(d-h)/c,this._x=(a+e)/c,this._y=.25*c,this._z=(g+l)/ -c):(c=2*Math.sqrt(1+b-c-f),this._w=(e-a)/c,this._x=(d+h)/c,this._y=(g+l)/c,this._z=.25*c);this._onChangeCallback();return this},setFromUnitVectors:function(a,b){var c=a.dot(b)+1;1E-6>c?(c=0,Math.abs(a.x)>Math.abs(a.z)?(this._x=-a.y,this._y=a.x,this._z=0):(this._x=0,this._y=-a.z,this._z=a.y)):(this._x=a.y*b.z-a.z*b.y,this._y=a.z*b.x-a.x*b.z,this._z=a.x*b.y-a.y*b.x);this._w=c;return this.normalize()},angleTo:function(a){return 2*Math.acos(Math.abs(O.clamp(this.dot(a),-1,1)))},rotateTowards:function(a, +c):(c=2*Math.sqrt(1+b-c-f),this._w=(e-a)/c,this._x=(d+h)/c,this._y=(g+l)/c,this._z=.25*c);this._onChangeCallback();return this},setFromUnitVectors:function(a,b){var c=a.dot(b)+1;1E-6>c?(c=0,Math.abs(a.x)>Math.abs(a.z)?(this._x=-a.y,this._y=a.x,this._z=0):(this._x=0,this._y=-a.z,this._z=a.y)):(this._x=a.y*b.z-a.z*b.y,this._y=a.z*b.x-a.x*b.z,this._z=a.x*b.y-a.y*b.x);this._w=c;return this.normalize()},angleTo:function(a){return 2*Math.acos(Math.abs(N.clamp(this.dot(a),-1,1)))},rotateTowards:function(a, b){var c=this.angleTo(a);if(0===c)return this;this.slerp(a,Math.min(1,b/c));return this},inverse:function(){return this.conjugate()},conjugate:function(){this._x*=-1;this._y*=-1;this._z*=-1;this._onChangeCallback();return this},dot:function(a){return this._x*a._x+this._y*a._y+this._z*a._z+this._w*a._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var a= this.length();0===a?(this._z=this._y=this._x=0,this._w=1):(a=1/a,this._x*=a,this._y*=a,this._z*=a,this._w*=a);this._onChangeCallback();return this},multiply:function(a,b){return void 0!==b?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(a,b)):this.multiplyQuaternions(this,a)},premultiply:function(a){return this.multiplyQuaternions(a,this)},multiplyQuaternions:function(a,b){var c=a._x,d=a._y,e=a._z;a=a._w; var f=b._x,g=b._y,h=b._z;b=b._w;this._x=c*b+a*f+d*h-e*g;this._y=d*b+a*g+e*f-c*h;this._z=e*b+a*h+c*g-d*f;this._w=a*b-c*f-d*g-e*h;this._onChangeCallback();return this},slerp:function(a,b){if(0===b)return this;if(1===b)return this.copy(a);var c=this._x,d=this._y,e=this._z,f=this._w,g=f*a._w+c*a._x+d*a._y+e*a._z;0>g?(this._w=-a._w,this._x=-a._x,this._y=-a._y,this._z=-a._z,g=-g):this.copy(a);if(1<=g)return this._w=f,this._x=c,this._y=d,this._z=e,this;a=1-g*g;if(a<=Number.EPSILON)return g=1-b,this._w=g* f+b*this._w,this._x=g*c+b*this._x,this._y=g*d+b*this._y,this._z=g*e+b*this._z,this.normalize(),this._onChangeCallback(),this;a=Math.sqrt(a);var h=Math.atan2(a,g);g=Math.sin((1-b)*h)/a;b=Math.sin(b*h)/a;this._w=f*g+this._w*b;this._x=c*g+this._x*b;this._y=d*g+this._y*b;this._z=e*g+this._z*b;this._onChangeCallback();return this},equals:function(a){return a._x===this._x&&a._y===this._y&&a._z===this._z&&a._w===this._w},fromArray:function(a,b){void 0===b&&(b=0);this._x=a[b];this._y=a[b+1];this._z=a[b+2]; -this._w=a[b+3];this._onChangeCallback();return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this._x;a[b+1]=this._y;a[b+2]=this._z;a[b+3]=this._w;return a},_onChange:function(a){this._onChangeCallback=a;return this},_onChangeCallback:function(){}});var Ig=new n,fi=new na;Object.assign(n.prototype,{isVector3:!0,set:function(a,b,c){this.x=a;this.y=b;this.z=c;return this},setScalar:function(a){this.z=this.y=this.x=a;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y= +this._w=a[b+3];this._onChangeCallback();return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this._x;a[b+1]=this._y;a[b+2]=this._z;a[b+3]=this._w;return a},_onChange:function(a){this._onChangeCallback=a;return this},_onChangeCallback:function(){}});var Ig=new n,ei=new sa;Object.assign(n.prototype,{isVector3:!0,set:function(a,b,c){this.x=a;this.y=b;this.z=c;return this},setScalar:function(a){this.z=this.y=this.x=a;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y= a;return this},setZ:function(a){this.z=a;return this},setComponent:function(a,b){switch(a){case 0:this.x=b;break;case 1:this.y=b;break;case 2:this.z=b;break;default:throw Error("index is out of range: "+a);}return this},getComponent:function(a){switch(a){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error("index is out of range: "+a);}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this}, add:function(a,b){if(void 0!==b)return console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(a,b);this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},addVectors:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;return this},addScaledVector:function(a,b){this.x+=a.x*b;this.y+=a.y*b;this.z+=a.z*b;return this},sub:function(a,b){if(void 0!==b)return console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."), this.subVectors(a,b);this.x-=a.x;this.y-=a.y;this.z-=a.z;return this},subScalar:function(a){this.x-=a;this.y-=a;this.z-=a;return this},subVectors:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},multiply:function(a,b){if(void 0!==b)return console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(a,b);this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*= -a;return this},multiplyVectors:function(a,b){this.x=a.x*b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},applyEuler:function(a){a&&a.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order.");return this.applyQuaternion(fi.setFromEuler(a))},applyAxisAngle:function(a,b){return this.applyQuaternion(fi.setFromAxisAngle(a,b))},applyMatrix3:function(a){var b=this.x,c=this.y,d=this.z;a=a.elements;this.x=a[0]*b+a[3]*c+a[6]*d;this.y=a[1]*b+a[4]*c+a[7]* +a;return this},multiplyVectors:function(a,b){this.x=a.x*b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},applyEuler:function(a){a&&a.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order.");return this.applyQuaternion(ei.setFromEuler(a))},applyAxisAngle:function(a,b){return this.applyQuaternion(ei.setFromAxisAngle(a,b))},applyMatrix3:function(a){var b=this.x,c=this.y,d=this.z;a=a.elements;this.x=a[0]*b+a[3]*c+a[6]*d;this.y=a[1]*b+a[4]*c+a[7]* d;this.z=a[2]*b+a[5]*c+a[8]*d;return this},applyMatrix4:function(a){var b=this.x,c=this.y,d=this.z;a=a.elements;var e=1/(a[3]*b+a[7]*c+a[11]*d+a[15]);this.x=(a[0]*b+a[4]*c+a[8]*d+a[12])*e;this.y=(a[1]*b+a[5]*c+a[9]*d+a[13])*e;this.z=(a[2]*b+a[6]*c+a[10]*d+a[14])*e;return this},applyQuaternion:function(a){var b=this.x,c=this.y,d=this.z,e=a.x,f=a.y,g=a.z;a=a.w;var h=a*b+f*d-g*c,l=a*c+g*b-e*d,m=a*d+e*c-f*b;b=-e*b-f*c-g*d;this.x=h*a+b*-e+l*-g-m*-f;this.y=l*a+b*-f+m*-e-h*-g;this.z=m*a+b*-g+h*-f-l*-e;return this}, project:function(a){return this.applyMatrix4(a.matrixWorldInverse).applyMatrix4(a.projectionMatrix)},unproject:function(a){return this.applyMatrix4(a.projectionMatrixInverse).applyMatrix4(a.matrixWorld)},transformDirection:function(a){var b=this.x,c=this.y,d=this.z;a=a.elements;this.x=a[0]*b+a[4]*c+a[8]*d;this.y=a[1]*b+a[5]*c+a[9]*d;this.z=a[2]*b+a[6]*c+a[10]*d;return this.normalize()},divide:function(a){this.x/=a.x;this.y/=a.y;this.z/=a.z;return this},divideScalar:function(a){return this.multiplyScalar(1/ a)},min:function(a){this.x=Math.min(this.x,a.x);this.y=Math.min(this.y,a.y);this.z=Math.min(this.z,a.z);return this},max:function(a){this.x=Math.max(this.x,a.x);this.y=Math.max(this.y,a.y);this.z=Math.max(this.z,a.z);return this},clamp:function(a,b){this.x=Math.max(a.x,Math.min(b.x,this.x));this.y=Math.max(a.y,Math.min(b.y,this.y));this.z=Math.max(a.z,Math.min(b.z,this.z));return this},clampScalar:function(a,b){this.x=Math.max(a,Math.min(b,this.x));this.y=Math.max(a,Math.min(b,this.y));this.z=Math.max(a, Math.min(b,this.z));return this},clampLength:function(a,b){var c=this.length();return this.divideScalar(c||1).multiplyScalar(Math.max(a,Math.min(b,c)))},floor:function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);this.z=Math.floor(this.z);return this},ceil:function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);this.z=Math.ceil(this.z);return this},round:function(){this.x=Math.round(this.x);this.y=Math.round(this.y);this.z=Math.round(this.z);return this},roundToZero:function(){this.x= 0>this.x?Math.ceil(this.x):Math.floor(this.x);this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y);this.z=0>this.z?Math.ceil(this.z):Math.floor(this.z);return this},negate:function(){this.x=-this.x;this.y=-this.y;this.z=-this.z;return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+ Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(a){return this.normalize().multiplyScalar(a)},lerp:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;return this},lerpVectors:function(a,b,c){return this.subVectors(b,a).multiplyScalar(c).add(a)},cross:function(a,b){return void 0!==b?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(a,b)):this.crossVectors(this, -a)},crossVectors:function(a,b){var c=a.x,d=a.y;a=a.z;var e=b.x,f=b.y;b=b.z;this.x=d*b-a*f;this.y=a*e-c*b;this.z=c*f-d*e;return this},projectOnVector:function(a){var b=a.dot(this)/a.lengthSq();return this.copy(a).multiplyScalar(b)},projectOnPlane:function(a){Ig.copy(this).projectOnVector(a);return this.sub(Ig)},reflect:function(a){return this.sub(Ig.copy(a).multiplyScalar(2*this.dot(a)))},angleTo:function(a){a=this.dot(a)/Math.sqrt(this.lengthSq()*a.lengthSq());return Math.acos(O.clamp(a,-1,1))},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))}, +a)},crossVectors:function(a,b){var c=a.x,d=a.y;a=a.z;var e=b.x,f=b.y;b=b.z;this.x=d*b-a*f;this.y=a*e-c*b;this.z=c*f-d*e;return this},projectOnVector:function(a){var b=a.dot(this)/a.lengthSq();return this.copy(a).multiplyScalar(b)},projectOnPlane:function(a){Ig.copy(this).projectOnVector(a);return this.sub(Ig)},reflect:function(a){return this.sub(Ig.copy(a).multiplyScalar(2*this.dot(a)))},angleTo:function(a){a=this.dot(a)/Math.sqrt(this.lengthSq()*a.lengthSq());return Math.acos(N.clamp(a,-1,1))},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))}, distanceToSquared:function(a){var b=this.x-a.x,c=this.y-a.y;a=this.z-a.z;return b*b+c*c+a*a},manhattanDistanceTo:function(a){return Math.abs(this.x-a.x)+Math.abs(this.y-a.y)+Math.abs(this.z-a.z)},setFromSpherical:function(a){return this.setFromSphericalCoords(a.radius,a.phi,a.theta)},setFromSphericalCoords:function(a,b,c){var d=Math.sin(b)*a;this.x=d*Math.sin(c);this.y=Math.cos(b)*a;this.z=d*Math.cos(c);return this},setFromCylindrical:function(a){return this.setFromCylindricalCoords(a.radius,a.theta, a.y)},setFromCylindricalCoords:function(a,b,c){this.x=a*Math.sin(b);this.y=c;this.z=a*Math.cos(b);return this},setFromMatrixPosition:function(a){a=a.elements;this.x=a[12];this.y=a[13];this.z=a[14];return this},setFromMatrixScale:function(a){var b=this.setFromMatrixColumn(a,0).length(),c=this.setFromMatrixColumn(a,1).length();a=this.setFromMatrixColumn(a,2).length();this.x=b;this.y=c;this.z=a;return this},setFromMatrixColumn:function(a,b){return this.fromArray(a.elements,4*b)},equals:function(a){return a.x=== -this.x&&a.y===this.y&&a.z===this.z},fromArray:function(a,b){void 0===b&&(b=0);this.x=a[b];this.y=a[b+1];this.z=a[b+2];return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this.x;a[b+1]=this.y;a[b+2]=this.z;return a},fromBufferAttribute:function(a,b,c){void 0!==c&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute().");this.x=a.getX(b);this.y=a.getY(b);this.z=a.getZ(b);return this}});var pc=new n;Object.assign(ta.prototype,{isMatrix3:!0,set:function(a, +this.x&&a.y===this.y&&a.z===this.z},fromArray:function(a,b){void 0===b&&(b=0);this.x=a[b];this.y=a[b+1];this.z=a[b+2];return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this.x;a[b+1]=this.y;a[b+2]=this.z;return a},fromBufferAttribute:function(a,b,c){void 0!==c&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute().");this.x=a.getX(b);this.y=a.getY(b);this.z=a.getZ(b);return this}});var qc=new n;Object.assign(S.prototype,{isMatrix3:!0,set:function(a, b,c,d,e,f,g,h,l){var m=this.elements;m[0]=a;m[1]=d;m[2]=g;m[3]=b;m[4]=e;m[5]=h;m[6]=c;m[7]=f;m[8]=l;return this},identity:function(){this.set(1,0,0,0,1,0,0,0,1);return this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(a){var b=this.elements;a=a.elements;b[0]=a[0];b[1]=a[1];b[2]=a[2];b[3]=a[3];b[4]=a[4];b[5]=a[5];b[6]=a[6];b[7]=a[7];b[8]=a[8];return this},setFromMatrix4:function(a){a=a.elements;this.set(a[0],a[4],a[8],a[1],a[5],a[9],a[2],a[6],a[10]);return this}, -applyToBufferAttribute:function(a){for(var b=0,c=a.count;bc;c++)if(b[c]!==a[c])return!1;return!0},fromArray:function(a,b){void 0===b&&(b=0);for(var c=0;9>c;c++)this.elements[c]=a[c+b];return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);var c=this.elements;a[b]=c[0];a[b+1]=c[1];a[b+2]=c[2];a[b+3]=c[3];a[b+4]=c[4];a[b+5]=c[5];a[b+6]=c[6];a[b+7]=c[7];a[b+8]=c[8];return a}});var md,Kb={getDataURL:function(a){if("undefined"==typeof HTMLCanvasElement)return a.src;if(!(a instanceof HTMLCanvasElement)){void 0===md&&(md=document.createElementNS("http://www.w3.org/1999/xhtml", -"canvas"));md.width=a.width;md.height=a.height;var b=md.getContext("2d");a instanceof ImageData?b.putImageData(a,0,0):b.drawImage(a,0,0,a.width,a.height);a=md}return 2048c;c++)if(b[c]!==a[c])return!1;return!0},fromArray:function(a,b){void 0===b&&(b=0);for(var c=0;9>c;c++)this.elements[c]=a[c+b];return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);var c=this.elements;a[b]=c[0];a[b+1]=c[1];a[b+2]=c[2];a[b+3]=c[3];a[b+4]=c[4];a[b+5]=c[5];a[b+6]=c[6];a[b+7]=c[7];a[b+8]=c[8];return a}});var md,Jb={getDataURL:function(a){if("undefined"==typeof HTMLCanvasElement)return a.src;if(!(a instanceof HTMLCanvasElement)){void 0===md&&(md=document.createElementNS("http://www.w3.org/1999/xhtml", +"canvas"));md.width=a.width;md.height=a.height;var b=md.getContext("2d");a instanceof ImageData?b.putImageData(a,0,0):b.drawImage(a,0,0,a.width,a.height);a=md}return 2048a.x||1a.x?0:1;break;case 1002:a.x=1===Math.abs(Math.floor(a.x)%2)?Math.ceil(a.x)-a.x:a.x-Math.floor(a.x)}if(0>a.y||1a.y?0:1;break;case 1002:a.y=1===Math.abs(Math.floor(a.y)%2)?Math.ceil(a.y)-a.y:a.y-Math.floor(a.y)}this.flipY&&(a.y=1-a.y);return a}});Object.defineProperty(ba.prototype,"needsUpdate",{set:function(a){!0===a&&this.version++}});Object.defineProperties(da.prototype,{width:{get:function(){return this.z},set:function(a){this.z=a}},height:{get:function(){return this.w},set:function(a){this.w=a}}});Object.assign(da.prototype,{isVector4:!0,set:function(a,b,c,d){this.x= +this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,type:this.type,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};if(void 0!==this.image){var d=this.image;void 0===d.uuid&&(d.uuid=N.generateUUID());if(!b&&void 0===a.images[d.uuid]){if(Array.isArray(d)){var e=[];for(var f=0,g=d.length;f< +g;f++)e.push(Jb.getDataURL(d[f]))}else e=Jb.getDataURL(d);a.images[d.uuid]={uuid:d.uuid,url:e}}c.image=d.uuid}b||(a.textures[this.uuid]=c);return c},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(a){if(300!==this.mapping)return a;a.applyMatrix3(this.matrix);if(0>a.x||1a.x?0:1;break;case 1002:a.x=1===Math.abs(Math.floor(a.x)%2)?Math.ceil(a.x)-a.x:a.x-Math.floor(a.x)}if(0>a.y||1a.y?0:1;break;case 1002:a.y=1===Math.abs(Math.floor(a.y)%2)?Math.ceil(a.y)-a.y:a.y-Math.floor(a.y)}this.flipY&&(a.y=1-a.y);return a}});Object.defineProperty(V.prototype,"needsUpdate",{set:function(a){!0===a&&this.version++}});Object.defineProperties(da.prototype,{width:{get:function(){return this.z},set:function(a){this.z=a}},height:{get:function(){return this.w},set:function(a){this.w=a}}});Object.assign(da.prototype,{isVector4:!0,set:function(a,b,c,d){this.x= a;this.y=b;this.z=c;this.w=d;return this},setScalar:function(a){this.w=this.z=this.y=this.x=a;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setZ:function(a){this.z=a;return this},setW:function(a){this.w=a;return this},setComponent:function(a,b){switch(a){case 0:this.x=b;break;case 1:this.y=b;break;case 2:this.z=b;break;case 3:this.w=b;break;default:throw Error("index is out of range: "+a);}return this},getComponent:function(a){switch(a){case 0:return this.x; case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error("index is out of range: "+a);}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=void 0!==a.w?a.w:1;return this},add:function(a,b){if(void 0!==b)return console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(a,b);this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this}, addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;this.w+=a;return this},addVectors:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},addScaledVector:function(a,b){this.x+=a.x*b;this.y+=a.y*b;this.z+=a.z*b;this.w+=a.w*b;return this},sub:function(a,b){if(void 0!==b)return console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(a,b);this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;return this},subScalar:function(a){this.x-= @@ -391,92 +390,92 @@ this.y));this.z=Math.max(a,Math.min(b,this.z));this.w=Math.max(a,Math.min(b,this Math.round(this.x);this.y=Math.round(this.y);this.z=Math.round(this.z);this.w=Math.round(this.w);return this},roundToZero:function(){this.x=0>this.x?Math.ceil(this.x):Math.floor(this.x);this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y);this.z=0>this.z?Math.ceil(this.z):Math.floor(this.z);this.w=0>this.w?Math.ceil(this.w):Math.floor(this.w);return this},negate:function(){this.x=-this.x;this.y=-this.y;this.z=-this.z;this.w=-this.w;return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z* a.z+this.w*a.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(a){return this.normalize().multiplyScalar(a)},lerp:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z- this.z)*b;this.w+=(a.w-this.w)*b;return this},lerpVectors:function(a,b,c){return this.subVectors(b,a).multiplyScalar(c).add(a)},equals:function(a){return a.x===this.x&&a.y===this.y&&a.z===this.z&&a.w===this.w},fromArray:function(a,b){void 0===b&&(b=0);this.x=a[b];this.y=a[b+1];this.z=a[b+2];this.w=a[b+3];return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this.x;a[b+1]=this.y;a[b+2]=this.z;a[b+3]=this.w;return a},fromBufferAttribute:function(a,b,c){void 0!==c&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."); -this.x=a.getX(b);this.y=a.getY(b);this.z=a.getZ(b);this.w=a.getW(b);return this}});Ka.prototype=Object.assign(Object.create(xa.prototype),{constructor:Ka,isWebGLRenderTarget:!0,setSize:function(a,b){if(this.width!==a||this.height!==b)this.width=a,this.height=b,this.texture.image.width=a,this.texture.image.height=b,this.dispose();this.viewport.set(0,0,a,b);this.scissor.set(0,0,a,b)},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.width=a.width;this.height=a.height;this.viewport.copy(a.viewport); -this.texture=a.texture.clone();this.depthBuffer=a.depthBuffer;this.stencilBuffer=a.stencilBuffer;this.depthTexture=a.depthTexture;return this},dispose:function(){this.dispatchEvent({type:"dispose"})}});Pf.prototype=Object.assign(Object.create(Ka.prototype),{constructor:Pf,isWebGLMultisampleRenderTarget:!0,copy:function(a){Ka.prototype.copy.call(this,a);this.samples=a.samples;return this}});var Ja=new n,ja=new P,hk=new n(0,0,0),ik=new n(1,1,1),Lb=new n,rf=new n,za=new n;Object.assign(P.prototype,{isMatrix4:!0, -set:function(a,b,c,d,e,f,g,h,l,m,k,n,r,q,t,y){var p=this.elements;p[0]=a;p[4]=b;p[8]=c;p[12]=d;p[1]=e;p[5]=f;p[9]=g;p[13]=h;p[2]=l;p[6]=m;p[10]=k;p[14]=n;p[3]=r;p[7]=q;p[11]=t;p[15]=y;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},clone:function(){return(new P).fromArray(this.elements)},copy:function(a){var b=this.elements;a=a.elements;b[0]=a[0];b[1]=a[1];b[2]=a[2];b[3]=a[3];b[4]=a[4];b[5]=a[5];b[6]=a[6];b[7]=a[7];b[8]=a[8];b[9]=a[9];b[10]=a[10];b[11]=a[11]; +this.x=a.getX(b);this.y=a.getY(b);this.z=a.getZ(b);this.w=a.getW(b);return this}});Ka.prototype=Object.assign(Object.create(za.prototype),{constructor:Ka,isWebGLRenderTarget:!0,setSize:function(a,b){if(this.width!==a||this.height!==b)this.width=a,this.height=b,this.texture.image.width=a,this.texture.image.height=b,this.dispose();this.viewport.set(0,0,a,b);this.scissor.set(0,0,a,b)},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.width=a.width;this.height=a.height;this.viewport.copy(a.viewport); +this.texture=a.texture.clone();this.depthBuffer=a.depthBuffer;this.stencilBuffer=a.stencilBuffer;this.depthTexture=a.depthTexture;return this},dispose:function(){this.dispatchEvent({type:"dispose"})}});Of.prototype=Object.assign(Object.create(Ka.prototype),{constructor:Of,isWebGLMultisampleRenderTarget:!0,copy:function(a){Ka.prototype.copy.call(this,a);this.samples=a.samples;return this}});var Ja=new n,ra=new W,gk=new n(0,0,0),hk=new n(1,1,1),Kb=new n,qf=new n,ka=new n;Object.assign(W.prototype,{isMatrix4:!0, +set:function(a,b,c,d,e,f,g,h,l,m,k,n,r,q,t,z){var p=this.elements;p[0]=a;p[4]=b;p[8]=c;p[12]=d;p[1]=e;p[5]=f;p[9]=g;p[13]=h;p[2]=l;p[6]=m;p[10]=k;p[14]=n;p[3]=r;p[7]=q;p[11]=t;p[15]=z;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},clone:function(){return(new W).fromArray(this.elements)},copy:function(a){var b=this.elements;a=a.elements;b[0]=a[0];b[1]=a[1];b[2]=a[2];b[3]=a[3];b[4]=a[4];b[5]=a[5];b[6]=a[6];b[7]=a[7];b[8]=a[8];b[9]=a[9];b[10]=a[10];b[11]=a[11]; b[12]=a[12];b[13]=a[13];b[14]=a[14];b[15]=a[15];return this},copyPosition:function(a){var b=this.elements;a=a.elements;b[12]=a[12];b[13]=a[13];b[14]=a[14];return this},extractBasis:function(a,b,c){a.setFromMatrixColumn(this,0);b.setFromMatrixColumn(this,1);c.setFromMatrixColumn(this,2);return this},makeBasis:function(a,b,c){this.set(a.x,b.x,c.x,0,a.y,b.y,c.y,0,a.z,b.z,c.z,0,0,0,0,1);return this},extractRotation:function(a){var b=this.elements,c=a.elements,d=1/Ja.setFromMatrixColumn(a,0).length(), e=1/Ja.setFromMatrixColumn(a,1).length();a=1/Ja.setFromMatrixColumn(a,2).length();b[0]=c[0]*d;b[1]=c[1]*d;b[2]=c[2]*d;b[3]=0;b[4]=c[4]*e;b[5]=c[5]*e;b[6]=c[6]*e;b[7]=0;b[8]=c[8]*a;b[9]=c[9]*a;b[10]=c[10]*a;b[11]=0;b[12]=0;b[13]=0;b[14]=0;b[15]=1;return this},makeRotationFromEuler:function(a){a&&a.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var b=this.elements,c=a.x,d=a.y,e=a.z,f=Math.cos(c);c=Math.sin(c);var g=Math.cos(d); d=Math.sin(d);var h=Math.cos(e);e=Math.sin(e);if("XYZ"===a.order){a=f*h;var l=f*e,m=c*h,k=c*e;b[0]=g*h;b[4]=-g*e;b[8]=d;b[1]=l+m*d;b[5]=a-k*d;b[9]=-c*g;b[2]=k-a*d;b[6]=m+l*d;b[10]=f*g}else"YXZ"===a.order?(a=g*h,l=g*e,m=d*h,k=d*e,b[0]=a+k*c,b[4]=m*c-l,b[8]=f*d,b[1]=f*e,b[5]=f*h,b[9]=-c,b[2]=l*c-m,b[6]=k+a*c,b[10]=f*g):"ZXY"===a.order?(a=g*h,l=g*e,m=d*h,k=d*e,b[0]=a-k*c,b[4]=-f*e,b[8]=m+l*c,b[1]=l+m*c,b[5]=f*h,b[9]=k-a*c,b[2]=-f*d,b[6]=c,b[10]=f*g):"ZYX"===a.order?(a=f*h,l=f*e,m=c*h,k=c*e,b[0]=g*h, -b[4]=m*d-l,b[8]=a*d+k,b[1]=g*e,b[5]=k*d+a,b[9]=l*d-m,b[2]=-d,b[6]=c*g,b[10]=f*g):"YZX"===a.order?(a=f*g,l=f*d,m=c*g,k=c*d,b[0]=g*h,b[4]=k-a*e,b[8]=m*e+l,b[1]=e,b[5]=f*h,b[9]=-c*h,b[2]=-d*h,b[6]=l*e+m,b[10]=a-k*e):"XZY"===a.order&&(a=f*g,l=f*d,m=c*g,k=c*d,b[0]=g*h,b[4]=-e,b[8]=d*h,b[1]=a*e+k,b[5]=f*h,b[9]=l*e-m,b[2]=m*e-l,b[6]=c*h,b[10]=k*e+a);b[3]=0;b[7]=0;b[11]=0;b[12]=0;b[13]=0;b[14]=0;b[15]=1;return this},makeRotationFromQuaternion:function(a){return this.compose(hk,a,ik)},lookAt:function(a,b, -c){var d=this.elements;za.subVectors(a,b);0===za.lengthSq()&&(za.z=1);za.normalize();Lb.crossVectors(c,za);0===Lb.lengthSq()&&(1===Math.abs(c.z)?za.x+=1E-4:za.z+=1E-4,za.normalize(),Lb.crossVectors(c,za));Lb.normalize();rf.crossVectors(za,Lb);d[0]=Lb.x;d[4]=rf.x;d[8]=za.x;d[1]=Lb.y;d[5]=rf.y;d[9]=za.y;d[2]=Lb.z;d[6]=rf.z;d[10]=za.z;return this},multiply:function(a,b){return void 0!==b?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."), -this.multiplyMatrices(a,b)):this.multiplyMatrices(this,a)},premultiply:function(a){return this.multiplyMatrices(a,this)},multiplyMatrices:function(a,b){var c=a.elements,d=b.elements;b=this.elements;a=c[0];var e=c[4],f=c[8],g=c[12],h=c[1],l=c[5],m=c[9],k=c[13],n=c[2],r=c[6],q=c[10],t=c[14],y=c[3],w=c[7],z=c[11];c=c[15];var x=d[0],v=d[4],A=d[8],E=d[12],B=d[1],D=d[5],F=d[9],G=d[13],I=d[2],H=d[6],J=d[10],K=d[14],N=d[3],O=d[7],P=d[11];d=d[15];b[0]=a*x+e*B+f*I+g*N;b[4]=a*v+e*D+f*H+g*O;b[8]=a*A+e*F+f*J+ -g*P;b[12]=a*E+e*G+f*K+g*d;b[1]=h*x+l*B+m*I+k*N;b[5]=h*v+l*D+m*H+k*O;b[9]=h*A+l*F+m*J+k*P;b[13]=h*E+l*G+m*K+k*d;b[2]=n*x+r*B+q*I+t*N;b[6]=n*v+r*D+q*H+t*O;b[10]=n*A+r*F+q*J+t*P;b[14]=n*E+r*G+q*K+t*d;b[3]=y*x+w*B+z*I+c*N;b[7]=y*v+w*D+z*H+c*O;b[11]=y*A+w*F+z*J+c*P;b[15]=y*E+w*G+z*K+c*d;return this},multiplyScalar:function(a){var b=this.elements;b[0]*=a;b[4]*=a;b[8]*=a;b[12]*=a;b[1]*=a;b[5]*=a;b[9]*=a;b[13]*=a;b[2]*=a;b[6]*=a;b[10]*=a;b[14]*=a;b[3]*=a;b[7]*=a;b[11]*=a;b[15]*=a;return this},applyToBufferAttribute:function(a){for(var b= +b[4]=m*d-l,b[8]=a*d+k,b[1]=g*e,b[5]=k*d+a,b[9]=l*d-m,b[2]=-d,b[6]=c*g,b[10]=f*g):"YZX"===a.order?(a=f*g,l=f*d,m=c*g,k=c*d,b[0]=g*h,b[4]=k-a*e,b[8]=m*e+l,b[1]=e,b[5]=f*h,b[9]=-c*h,b[2]=-d*h,b[6]=l*e+m,b[10]=a-k*e):"XZY"===a.order&&(a=f*g,l=f*d,m=c*g,k=c*d,b[0]=g*h,b[4]=-e,b[8]=d*h,b[1]=a*e+k,b[5]=f*h,b[9]=l*e-m,b[2]=m*e-l,b[6]=c*h,b[10]=k*e+a);b[3]=0;b[7]=0;b[11]=0;b[12]=0;b[13]=0;b[14]=0;b[15]=1;return this},makeRotationFromQuaternion:function(a){return this.compose(gk,a,hk)},lookAt:function(a,b, +c){var d=this.elements;ka.subVectors(a,b);0===ka.lengthSq()&&(ka.z=1);ka.normalize();Kb.crossVectors(c,ka);0===Kb.lengthSq()&&(1===Math.abs(c.z)?ka.x+=1E-4:ka.z+=1E-4,ka.normalize(),Kb.crossVectors(c,ka));Kb.normalize();qf.crossVectors(ka,Kb);d[0]=Kb.x;d[4]=qf.x;d[8]=ka.x;d[1]=Kb.y;d[5]=qf.y;d[9]=ka.y;d[2]=Kb.z;d[6]=qf.z;d[10]=ka.z;return this},multiply:function(a,b){return void 0!==b?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."), +this.multiplyMatrices(a,b)):this.multiplyMatrices(this,a)},premultiply:function(a){return this.multiplyMatrices(a,this)},multiplyMatrices:function(a,b){var c=a.elements,d=b.elements;b=this.elements;a=c[0];var e=c[4],f=c[8],g=c[12],h=c[1],l=c[5],m=c[9],k=c[13],n=c[2],r=c[6],q=c[10],t=c[14],z=c[3],w=c[7],y=c[11];c=c[15];var x=d[0],v=d[4],B=d[8],E=d[12],A=d[1],D=d[5],C=d[9],F=d[13],H=d[2],G=d[6],I=d[10],L=d[14],M=d[3],N=d[7],O=d[11];d=d[15];b[0]=a*x+e*A+f*H+g*M;b[4]=a*v+e*D+f*G+g*N;b[8]=a*B+e*C+f*I+ +g*O;b[12]=a*E+e*F+f*L+g*d;b[1]=h*x+l*A+m*H+k*M;b[5]=h*v+l*D+m*G+k*N;b[9]=h*B+l*C+m*I+k*O;b[13]=h*E+l*F+m*L+k*d;b[2]=n*x+r*A+q*H+t*M;b[6]=n*v+r*D+q*G+t*N;b[10]=n*B+r*C+q*I+t*O;b[14]=n*E+r*F+q*L+t*d;b[3]=z*x+w*A+y*H+c*M;b[7]=z*v+w*D+y*G+c*N;b[11]=z*B+w*C+y*I+c*O;b[15]=z*E+w*F+y*L+c*d;return this},multiplyScalar:function(a){var b=this.elements;b[0]*=a;b[4]*=a;b[8]*=a;b[12]*=a;b[1]*=a;b[5]*=a;b[9]*=a;b[13]*=a;b[2]*=a;b[6]*=a;b[10]*=a;b[14]*=a;b[3]*=a;b[7]*=a;b[11]*=a;b[15]*=a;return this},applyToBufferAttribute:function(a){for(var b= 0,c=a.count;bthis.determinant()&&(e=-e);a.x=d[12];a.y=d[13];a.z=d[14];ja.copy(this);a=1/e;d=1/f;var h=1/g;ja.elements[0]*=a;ja.elements[1]*=a;ja.elements[2]*=a;ja.elements[4]*=d;ja.elements[5]*=d;ja.elements[6]*=d;ja.elements[8]*=h;ja.elements[9]*=h;ja.elements[10]*=h;b.setFromRotationMatrix(ja);c.x=e;c.y=f;c.z=g;return this},makePerspective:function(a,b,c,d,e,f){void 0===f&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs."); +f=Ja.set(d[4],d[5],d[6]).length(),g=Ja.set(d[8],d[9],d[10]).length();0>this.determinant()&&(e=-e);a.x=d[12];a.y=d[13];a.z=d[14];ra.copy(this);a=1/e;d=1/f;var h=1/g;ra.elements[0]*=a;ra.elements[1]*=a;ra.elements[2]*=a;ra.elements[4]*=d;ra.elements[5]*=d;ra.elements[6]*=d;ra.elements[8]*=h;ra.elements[9]*=h;ra.elements[10]*=h;b.setFromRotationMatrix(ra);c.x=e;c.y=f;c.z=g;return this},makePerspective:function(a,b,c,d,e,f){void 0===f&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs."); var g=this.elements;g[0]=2*e/(b-a);g[4]=0;g[8]=(b+a)/(b-a);g[12]=0;g[1]=0;g[5]=2*e/(c-d);g[9]=(c+d)/(c-d);g[13]=0;g[2]=0;g[6]=0;g[10]=-(f+e)/(f-e);g[14]=-2*f*e/(f-e);g[3]=0;g[7]=0;g[11]=-1;g[15]=0;return this},makeOrthographic:function(a,b,c,d,e,f){var g=this.elements,h=1/(b-a),l=1/(c-d),m=1/(f-e);g[0]=2*h;g[4]=0;g[8]=0;g[12]=-((b+a)*h);g[1]=0;g[5]=2*l;g[9]=0;g[13]=-((c+d)*l);g[2]=0;g[6]=0;g[10]=-2*m;g[14]=-((f+e)*m);g[3]=0;g[7]=0;g[11]=0;g[15]=1;return this},equals:function(a){var b=this.elements; -a=a.elements;for(var c=0;16>c;c++)if(b[c]!==a[c])return!1;return!0},fromArray:function(a,b){void 0===b&&(b=0);for(var c=0;16>c;c++)this.elements[c]=a[c+b];return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);var c=this.elements;a[b]=c[0];a[b+1]=c[1];a[b+2]=c[2];a[b+3]=c[3];a[b+4]=c[4];a[b+5]=c[5];a[b+6]=c[6];a[b+7]=c[7];a[b+8]=c[8];a[b+9]=c[9];a[b+10]=c[10];a[b+11]=c[11];a[b+12]=c[12];a[b+13]=c[13];a[b+14]=c[14];a[b+15]=c[15];return a}});var gi=new P,hi=new na;Qb.RotationOrders= -"XYZ YZX ZXY XZY YXZ ZYX".split(" ");Qb.DefaultOrder="XYZ";Object.defineProperties(Qb.prototype,{x:{get:function(){return this._x},set:function(a){this._x=a;this._onChangeCallback()}},y:{get:function(){return this._y},set:function(a){this._y=a;this._onChangeCallback()}},z:{get:function(){return this._z},set:function(a){this._z=a;this._onChangeCallback()}},order:{get:function(){return this._order},set:function(a){this._order=a;this._onChangeCallback()}}});Object.assign(Qb.prototype,{isEuler:!0,set:function(a, -b,c,d){this._x=a;this._y=b;this._z=c;this._order=d||this._order;this._onChangeCallback();return this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(a){this._x=a._x;this._y=a._y;this._z=a._z;this._order=a._order;this._onChangeCallback();return this},setFromRotationMatrix:function(a,b,c){var d=O.clamp,e=a.elements;a=e[0];var f=e[4],g=e[8],h=e[1],l=e[5],m=e[9],k=e[2],n=e[6];e=e[10];b=b||this._order;"XYZ"===b?(this._y=Math.asin(d(g,-1,1)),.9999999>Math.abs(g)? +a=a.elements;for(var c=0;16>c;c++)if(b[c]!==a[c])return!1;return!0},fromArray:function(a,b){void 0===b&&(b=0);for(var c=0;16>c;c++)this.elements[c]=a[c+b];return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);var c=this.elements;a[b]=c[0];a[b+1]=c[1];a[b+2]=c[2];a[b+3]=c[3];a[b+4]=c[4];a[b+5]=c[5];a[b+6]=c[6];a[b+7]=c[7];a[b+8]=c[8];a[b+9]=c[9];a[b+10]=c[10];a[b+11]=c[11];a[b+12]=c[12];a[b+13]=c[13];a[b+14]=c[14];a[b+15]=c[15];return a}});var fi=new W,gi=new sa;Pb.RotationOrders= +"XYZ YZX ZXY XZY YXZ ZYX".split(" ");Pb.DefaultOrder="XYZ";Object.defineProperties(Pb.prototype,{x:{get:function(){return this._x},set:function(a){this._x=a;this._onChangeCallback()}},y:{get:function(){return this._y},set:function(a){this._y=a;this._onChangeCallback()}},z:{get:function(){return this._z},set:function(a){this._z=a;this._onChangeCallback()}},order:{get:function(){return this._order},set:function(a){this._order=a;this._onChangeCallback()}}});Object.assign(Pb.prototype,{isEuler:!0,set:function(a, +b,c,d){this._x=a;this._y=b;this._z=c;this._order=d||this._order;this._onChangeCallback();return this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(a){this._x=a._x;this._y=a._y;this._z=a._z;this._order=a._order;this._onChangeCallback();return this},setFromRotationMatrix:function(a,b,c){var d=N.clamp,e=a.elements;a=e[0];var f=e[4],g=e[8],h=e[1],l=e[5],m=e[9],k=e[2],n=e[6];e=e[10];b=b||this._order;"XYZ"===b?(this._y=Math.asin(d(g,-1,1)),.9999999>Math.abs(g)? (this._x=Math.atan2(-m,e),this._z=Math.atan2(-f,a)):(this._x=Math.atan2(n,l),this._z=0)):"YXZ"===b?(this._x=Math.asin(-d(m,-1,1)),.9999999>Math.abs(m)?(this._y=Math.atan2(g,e),this._z=Math.atan2(h,l)):(this._y=Math.atan2(-k,a),this._z=0)):"ZXY"===b?(this._x=Math.asin(d(n,-1,1)),.9999999>Math.abs(n)?(this._y=Math.atan2(-k,e),this._z=Math.atan2(-f,l)):(this._y=0,this._z=Math.atan2(h,a))):"ZYX"===b?(this._y=Math.asin(-d(k,-1,1)),.9999999>Math.abs(k)?(this._x=Math.atan2(n,e),this._z=Math.atan2(h,a)): (this._x=0,this._z=Math.atan2(-f,l))):"YZX"===b?(this._z=Math.asin(d(h,-1,1)),.9999999>Math.abs(h)?(this._x=Math.atan2(-m,l),this._y=Math.atan2(-k,a)):(this._x=0,this._y=Math.atan2(g,e))):"XZY"===b?(this._z=Math.asin(-d(f,-1,1)),.9999999>Math.abs(f)?(this._x=Math.atan2(n,l),this._y=Math.atan2(g,a)):(this._x=Math.atan2(-m,e),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+b);this._order=b;!1!==c&&this._onChangeCallback();return this},setFromQuaternion:function(a, -b,c){gi.makeRotationFromQuaternion(a);return this.setFromRotationMatrix(gi,b,c)},setFromVector3:function(a,b){return this.set(a.x,a.y,a.z,b||this._order)},reorder:function(a){hi.setFromEuler(this);return this.setFromQuaternion(hi,a)},equals:function(a){return a._x===this._x&&a._y===this._y&&a._z===this._z&&a._order===this._order},fromArray:function(a){this._x=a[0];this._y=a[1];this._z=a[2];void 0!==a[3]&&(this._order=a[3]);this._onChangeCallback();return this},toArray:function(a,b){void 0===a&&(a= -[]);void 0===b&&(b=0);a[b]=this._x;a[b+1]=this._y;a[b+2]=this._z;a[b+3]=this._order;return a},toVector3:function(a){return a?a.set(this._x,this._y,this._z):new n(this._x,this._y,this._z)},_onChange:function(a){this._onChangeCallback=a;return this},_onChangeCallback:function(){}});Object.assign(Qf.prototype,{set:function(a){this.mask=1<e&&(e=m);k>f&&(f=k);n>g&&(g=n)}this.min.set(b,c,d); +this.matrixAutoUpdate=a.matrixAutoUpdate;this.matrixWorldNeedsUpdate=a.matrixWorldNeedsUpdate;this.layers.mask=a.layers.mask;this.visible=a.visible;this.castShadow=a.castShadow;this.receiveShadow=a.receiveShadow;this.frustumCulled=a.frustumCulled;this.renderOrder=a.renderOrder;this.userData=JSON.parse(JSON.stringify(a.userData));if(!0===b)for(b=0;be&&(e=m);k>f&&(f=k);n>g&&(g=n)}this.min.set(b,c,d); this.max.set(e,f,g);return this},setFromBufferAttribute:function(a){for(var b=Infinity,c=Infinity,d=Infinity,e=-Infinity,f=-Infinity,g=-Infinity,h=0,l=a.count;he&&(e=m);k>f&&(f=k);n>g&&(g=n)}this.min.set(b,c,d);this.max.set(e,f,g);return this},setFromPoints:function(a){this.makeEmpty();for(var b=0,c=a.length;bthis.max.x||a.ythis.max.y||a.zthis.max.z?!1:!0},containsBox:function(a){return this.min.x<=a.min.x&&a.max.x<=this.max.x&&this.min.y<=a.min.y&&a.max.y<=this.max.y&&this.min.z<=a.min.z&&a.max.z<=this.max.z},getParameter:function(a,b){void 0===b&&(console.warn("THREE.Box3: .getParameter() target is now required"),b=new n);return b.set((a.x-this.min.x)/(this.max.x-this.min.x),(a.y-this.min.y)/(this.max.y-this.min.y), (a.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(a){return a.max.xthis.max.x||a.max.ythis.max.y||a.max.zthis.max.z?!1:!0},intersectsSphere:function(a){this.clampPoint(a.center,jb);return jb.distanceToSquared(a.center)<=a.radius*a.radius},intersectsPlane:function(a){if(0=-a.constant},intersectsTriangle:function(a){if(this.isEmpty())return!1;this.getCenter(xe);tf.subVectors(this.max,xe);od.subVectors(a.a,xe);pd.subVectors(a.b,xe);qd.subVectors(a.c,xe);Mb.subVectors(pd,od);Nb.subVectors(qd,pd);qc.subVectors(od,qd);a=[0,-Mb.z,Mb.y,0,-Nb.z,Nb.y,0,-qc.z, -qc.y,Mb.z,0,-Mb.x,Nb.z,0,-Nb.x,qc.z,0,-qc.x,-Mb.y,Mb.x,0,-Nb.y,Nb.x,0,-qc.y,qc.x,0];if(!Rf(a,od,pd,qd,tf))return!1;a=[1,0,0,0,1,0,0,0,1];if(!Rf(a,od,pd,qd,tf))return!1;uf.crossVectors(Mb,Nb);a=[uf.x,uf.y,uf.z];return Rf(a,od,pd,qd,tf)},clampPoint:function(a,b){void 0===b&&(console.warn("THREE.Box3: .clampPoint() target is now required"),b=new n);return b.copy(a).clamp(this.min,this.max)},distanceToPoint:function(a){return jb.copy(a).clamp(this.min,this.max).sub(a).length()},getBoundingSphere:function(a){void 0=== -a&&console.error("THREE.Box3: .getBoundingSphere() target is now required");this.getCenter(a.center);a.radius=.5*this.getSize(jb).length();return a},intersect:function(a){this.min.max(a.min);this.max.min(a.max);this.isEmpty()&&this.makeEmpty();return this},union:function(a){this.min.min(a.min);this.max.max(a.max);return this},applyMatrix4:function(a){if(this.isEmpty())return this;wb[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(a);wb[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(a); -wb[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(a);wb[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(a);wb[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(a);wb[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(a);wb[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(a);wb[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(a);this.setFromPoints(wb);return this},translate:function(a){this.min.add(a);this.max.add(a);return this},equals:function(a){return a.min.equals(this.min)&& -a.max.equals(this.max)}});var nk=new ab;Object.assign(nb.prototype,{set:function(a,b){this.center.copy(a);this.radius=b;return this},setFromPoints:function(a,b){var c=this.center;void 0!==b?c.copy(b):nk.setFromPoints(a).getCenter(c);for(var d=b=0,e=a.length;d= +c+=a.normal.y*this.max.y):(b+=a.normal.y*this.max.y,c+=a.normal.y*this.min.y);0=-a.constant},intersectsTriangle:function(a){if(this.isEmpty())return!1;this.getCenter(ye);sf.subVectors(this.max,ye);od.subVectors(a.a,ye);pd.subVectors(a.b,ye);qd.subVectors(a.c,ye);Lb.subVectors(pd,od);Mb.subVectors(qd,pd);rc.subVectors(od,qd);a=[0,-Lb.z,Lb.y,0,-Mb.z,Mb.y,0,-rc.z, +rc.y,Lb.z,0,-Lb.x,Mb.z,0,-Mb.x,rc.z,0,-rc.x,-Lb.y,Lb.x,0,-Mb.y,Mb.x,0,-rc.y,rc.x,0];if(!Qf(a,od,pd,qd,sf))return!1;a=[1,0,0,0,1,0,0,0,1];if(!Qf(a,od,pd,qd,sf))return!1;tf.crossVectors(Lb,Mb);a=[tf.x,tf.y,tf.z];return Qf(a,od,pd,qd,sf)},clampPoint:function(a,b){void 0===b&&(console.warn("THREE.Box3: .clampPoint() target is now required"),b=new n);return b.copy(a).clamp(this.min,this.max)},distanceToPoint:function(a){return jb.copy(a).clamp(this.min,this.max).sub(a).length()},getBoundingSphere:function(a){void 0=== +a&&console.error("THREE.Box3: .getBoundingSphere() target is now required");this.getCenter(a.center);a.radius=.5*this.getSize(jb).length();return a},intersect:function(a){this.min.max(a.min);this.max.min(a.max);this.isEmpty()&&this.makeEmpty();return this},union:function(a){this.min.min(a.min);this.max.max(a.max);return this},applyMatrix4:function(a){if(this.isEmpty())return this;vb[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(a);vb[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(a); +vb[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(a);vb[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(a);vb[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(a);vb[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(a);vb[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(a);vb[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(a);this.setFromPoints(vb);return this},translate:function(a){this.min.add(a);this.max.add(a);return this},equals:function(a){return a.min.equals(this.min)&& +a.max.equals(this.max)}});var mk=new ab;Object.assign(nb.prototype,{set:function(a,b){this.center.copy(a);this.radius=b;return this},setFromPoints:function(a,b){var c=this.center;void 0!==b?c.copy(b):mk.setFromPoints(a).getCenter(c);for(var d=b=0,e=a.length;d= this.radius},containsPoint:function(a){return a.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(a){return a.distanceTo(this.center)-this.radius},intersectsSphere:function(a){var b=this.radius+a.radius;return a.center.distanceToSquared(this.center)<=b*b},intersectsBox:function(a){return a.intersectsSphere(this)},intersectsPlane:function(a){return Math.abs(a.distanceToPoint(this.center))<=this.radius},clampPoint:function(a,b){var c=this.center.distanceToSquared(a); void 0===b&&(console.warn("THREE.Sphere: .clampPoint() target is now required"),b=new n);b.copy(a);c>this.radius*this.radius&&(b.sub(this.center).normalize(),b.multiplyScalar(this.radius).add(this.center));return b},getBoundingBox:function(a){void 0===a&&(console.warn("THREE.Sphere: .getBoundingBox() target is now required"),a=new ab);a.set(this.center,this.center);a.expandByScalar(this.radius);return a},applyMatrix4:function(a){this.center.applyMatrix4(a);this.radius*=a.getMaxScaleOnAxis();return this}, -translate:function(a){this.center.add(a);return this},equals:function(a){return a.center.equals(this.center)&&a.radius===this.radius}});var xb=new n,Jg=new n,vf=new n,Ob=new n,Kg=new n,wf=new n,Lg=new n;Object.assign(Sb.prototype,{set:function(a,b){this.origin.copy(a);this.direction.copy(b);return this},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.origin.copy(a.origin);this.direction.copy(a.direction);return this},at:function(a,b){void 0===b&&(console.warn("THREE.Ray: .at() target is now required"), -b=new n);return b.copy(this.direction).multiplyScalar(a).add(this.origin)},lookAt:function(a){this.direction.copy(a).sub(this.origin).normalize();return this},recast:function(a){this.origin.copy(this.at(a,xb));return this},closestPointToPoint:function(a,b){void 0===b&&(console.warn("THREE.Ray: .closestPointToPoint() target is now required"),b=new n);b.subVectors(a,this.origin);a=b.dot(this.direction);return 0>a?b.copy(this.origin):b.copy(this.direction).multiplyScalar(a).add(this.origin)},distanceToPoint:function(a){return Math.sqrt(this.distanceSqToPoint(a))}, -distanceSqToPoint:function(a){var b=xb.subVectors(a,this.origin).dot(this.direction);if(0>b)return this.origin.distanceToSquared(a);xb.copy(this.direction).multiplyScalar(b).add(this.origin);return xb.distanceToSquared(a)},distanceSqToSegment:function(a,b,c,d){Jg.copy(a).add(b).multiplyScalar(.5);vf.copy(b).sub(a).normalize();Ob.copy(this.origin).sub(Jg);var e=.5*a.distanceTo(b),f=-this.direction.dot(vf),g=Ob.dot(this.direction),h=-Ob.dot(vf),l=Ob.lengthSq(),m=Math.abs(1-f*f);if(0a?b.copy(this.origin):b.copy(this.direction).multiplyScalar(a).add(this.origin)},distanceToPoint:function(a){return Math.sqrt(this.distanceSqToPoint(a))}, +distanceSqToPoint:function(a){var b=wb.subVectors(a,this.origin).dot(this.direction);if(0>b)return this.origin.distanceToSquared(a);wb.copy(this.direction).multiplyScalar(b).add(this.origin);return wb.distanceToSquared(a)},distanceSqToSegment:function(a,b,c,d){Jg.copy(a).add(b).multiplyScalar(.5);uf.copy(b).sub(a).normalize();Nb.copy(this.origin).sub(Jg);var e=.5*a.distanceTo(b),f=-this.direction.dot(uf),g=Nb.dot(this.direction),h=-Nb.dot(uf),l=Nb.lengthSq(),m=Math.abs(1-f*f);if(0=-k?b<=k?(e=1/m,a*=e,b*=e,f=a*(a+f*b+2*g)+b*(f*a+b+2*h)+l):(b=e,a=Math.max(0,-(f*b+g)),f=-a*a+b*(b+2*h)+l):(b=-e,a=Math.max(0,-(f*b+g)),f=-a*a+b*(b+2*h)+l):b<=-k?(a=Math.max(0,-(-f*e+g)),b=0a)return null;a=Math.sqrt(a-d);d=c-a;c+=a;return 0>d&&0>c?null:0>d?this.at(c,b):this.at(d,b)},intersectsSphere:function(a){return this.distanceSqToPoint(a.center)<=a.radius*a.radius},distanceToPlane:function(a){var b=a.normal.dot(this.direction);if(0===b)return 0===a.distanceToPoint(this.origin)?0:null;a=-(this.origin.dot(a.normal)+ +d&&d.copy(uf).multiplyScalar(b).add(Jg);return f},intersectSphere:function(a,b){wb.subVectors(a.center,this.origin);var c=wb.dot(this.direction),d=wb.dot(wb)-c*c;a=a.radius*a.radius;if(d>a)return null;a=Math.sqrt(a-d);d=c-a;c+=a;return 0>d&&0>c?null:0>d?this.at(c,b):this.at(d,b)},intersectsSphere:function(a){return this.distanceSqToPoint(a.center)<=a.radius*a.radius},distanceToPlane:function(a){var b=a.normal.dot(this.direction);if(0===b)return 0===a.distanceToPoint(this.origin)?0:null;a=-(this.origin.dot(a.normal)+ a.constant)/b;return 0<=a?a:null},intersectPlane:function(a,b){a=this.distanceToPlane(a);return null===a?null:this.at(a,b)},intersectsPlane:function(a){var b=a.distanceToPoint(this.origin);return 0===b||0>a.normal.dot(this.direction)*b?!0:!1},intersectBox:function(a,b){var c=1/this.direction.x;var d=1/this.direction.y;var e=1/this.direction.z,f=this.origin;if(0<=c){var g=(a.min.x-f.x)*c;c*=a.max.x-f.x}else g=(a.max.x-f.x)*c,c*=a.min.x-f.x;if(0<=d){var h=(a.min.y-f.y)*d;d*=a.max.y-f.y}else h=(a.max.y- -f.y)*d,d*=a.min.y-f.y;if(g>d||h>c)return null;if(h>g||g!==g)g=h;if(da||h>c)return null;if(h>g||g!==g)g=h;if(ac?null:this.at(0<=g?g:c,b)},intersectsBox:function(a){return null!==this.intersectBox(a,xb)},intersectTriangle:function(a,b,c,d,e){Kg.subVectors(b,a);wf.subVectors(c,a);Lg.crossVectors(Kg,wf);b=this.direction.dot(Lg);if(0b)d=-1,b=-b;else return null; -Ob.subVectors(this.origin,a);a=d*this.direction.dot(wf.crossVectors(Ob,wf));if(0>a)return null;c=d*this.direction.dot(Kg.cross(Ob));if(0>c||a+c>b)return null;a=-d*Ob.dot(Lg);return 0>a?null:this.at(a/b,e)},applyMatrix4:function(a){this.origin.applyMatrix4(a);this.direction.transformDirection(a);return this},equals:function(a){return a.origin.equals(this.origin)&&a.direction.equals(this.direction)}});var Ya=new n,yb=new n,Mg=new n,zb=new n,rd=new n,sd=new n,mi=new n,Ng=new n,Og=new n,Pg=new n;Object.assign(ia, -{getNormal:function(a,b,c,d){void 0===d&&(console.warn("THREE.Triangle: .getNormal() target is now required"),d=new n);d.subVectors(c,b);Ya.subVectors(a,b);d.cross(Ya);a=d.lengthSq();return 0=zb.x+zb.y},getUV:function(a,b,c,d,e,f,g,h){this.getBarycoord(a,b,c,d,zb);h.set(0,0);h.addScaledVector(e,zb.x);h.addScaledVector(f,zb.y);h.addScaledVector(g,zb.z);return h},isFrontFacing:function(a,b,c,d){Ya.subVectors(c,b);yb.subVectors(a,b);return 0>Ya.cross(yb).dot(d)?!0:!1}});Object.assign(ia.prototype,{set:function(a, -b,c){this.a.copy(a);this.b.copy(b);this.c.copy(c);return this},setFromPointsAndIndices:function(a,b,c,d){this.a.copy(a[b]);this.b.copy(a[c]);this.c.copy(a[d]);return this},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.a.copy(a.a);this.b.copy(a.b);this.c.copy(a.c);return this},getArea:function(){Ya.subVectors(this.c,this.b);yb.subVectors(this.a,this.b);return.5*Ya.cross(yb).length()},getMidpoint:function(a){void 0===a&&(console.warn("THREE.Triangle: .getMidpoint() target is now required"), -a=new n);return a.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},getNormal:function(a){return ia.getNormal(this.a,this.b,this.c,a)},getPlane:function(a){void 0===a&&(console.warn("THREE.Triangle: .getPlane() target is now required"),a=new n);return a.setFromCoplanarPoints(this.a,this.b,this.c)},getBarycoord:function(a,b){return ia.getBarycoord(a,this.a,this.b,this.c,b)},getUV:function(a,b,c,d,e){return ia.getUV(a,this.a,this.b,this.c,b,c,d,e)},containsPoint:function(a){return ia.containsPoint(a, -this.a,this.b,this.c)},isFrontFacing:function(a){return ia.isFrontFacing(this.a,this.b,this.c,a)},intersectsBox:function(a){return a.intersectsTriangle(this)},closestPointToPoint:function(a,b){void 0===b&&(console.warn("THREE.Triangle: .closestPointToPoint() target is now required"),b=new n);var c=this.a,d=this.b,e=this.c;rd.subVectors(d,c);sd.subVectors(e,c);Ng.subVectors(a,c);var f=rd.dot(Ng),g=sd.dot(Ng);if(0>=f&&0>=g)return b.copy(c);Og.subVectors(a,d);var h=rd.dot(Og),l=sd.dot(Og);if(0<=h&&l<= -h)return b.copy(d);var m=f*l-h*g;if(0>=m&&0<=f&&0>=h)return d=f/(f-h),b.copy(c).addScaledVector(rd,d);Pg.subVectors(a,e);a=rd.dot(Pg);var k=sd.dot(Pg);if(0<=k&&a<=k)return b.copy(e);f=a*g-f*k;if(0>=f&&0<=g&&0>=k)return m=g/(g-k),b.copy(c).addScaledVector(sd,m);g=h*k-a*l;if(0>=g&&0<=l-h&&0<=a-k)return mi.subVectors(e,d),m=(l-h)/(l-h+(a-k)),b.copy(d).addScaledVector(mi,m);e=1/(g+f+m);d=f*e;m*=e;return b.copy(c).addScaledVector(rd,d).addScaledVector(sd,m)},equals:function(a){return a.a.equals(this.a)&& -a.b.equals(this.b)&&a.c.equals(this.c)}});var ok={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017, +f.y)*d,d*=a.min.y-f.y;if(g>d||h>c)return null;if(h>g||g!==g)g=h;if(da||h>c)return null;if(h>g||g!==g)g=h;if(ac?null:this.at(0<=g?g:c,b)},intersectsBox:function(a){return null!==this.intersectBox(a,wb)},intersectTriangle:function(a,b,c,d,e){Kg.subVectors(b,a);vf.subVectors(c,a);Lg.crossVectors(Kg,vf);b=this.direction.dot(Lg);if(0b)d=-1,b=-b;else return null; +Nb.subVectors(this.origin,a);a=d*this.direction.dot(vf.crossVectors(Nb,vf));if(0>a)return null;c=d*this.direction.dot(Kg.cross(Nb));if(0>c||a+c>b)return null;a=-d*Nb.dot(Lg);return 0>a?null:this.at(a/b,e)},applyMatrix4:function(a){this.origin.applyMatrix4(a);this.direction.transformDirection(a);return this},equals:function(a){return a.origin.equals(this.origin)&&a.direction.equals(this.direction)}});var Ya=new n,xb=new n,Mg=new n,yb=new n,rd=new n,sd=new n,li=new n,Ng=new n,Og=new n,Pg=new n;Object.assign(ca, +{getNormal:function(a,b,c,d){void 0===d&&(console.warn("THREE.Triangle: .getNormal() target is now required"),d=new n);d.subVectors(c,b);Ya.subVectors(a,b);d.cross(Ya);a=d.lengthSq();return 0=yb.x+yb.y},getUV:function(a,b,c,d,e,f,g,h){this.getBarycoord(a,b,c,d,yb);h.set(0,0);h.addScaledVector(e,yb.x);h.addScaledVector(f,yb.y);h.addScaledVector(g,yb.z);return h},isFrontFacing:function(a,b,c,d){Ya.subVectors(c,b);xb.subVectors(a,b);return 0>Ya.cross(xb).dot(d)?!0:!1}});Object.assign(ca.prototype,{set:function(a, +b,c){this.a.copy(a);this.b.copy(b);this.c.copy(c);return this},setFromPointsAndIndices:function(a,b,c,d){this.a.copy(a[b]);this.b.copy(a[c]);this.c.copy(a[d]);return this},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.a.copy(a.a);this.b.copy(a.b);this.c.copy(a.c);return this},getArea:function(){Ya.subVectors(this.c,this.b);xb.subVectors(this.a,this.b);return.5*Ya.cross(xb).length()},getMidpoint:function(a){void 0===a&&(console.warn("THREE.Triangle: .getMidpoint() target is now required"), +a=new n);return a.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},getNormal:function(a){return ca.getNormal(this.a,this.b,this.c,a)},getPlane:function(a){void 0===a&&(console.warn("THREE.Triangle: .getPlane() target is now required"),a=new n);return a.setFromCoplanarPoints(this.a,this.b,this.c)},getBarycoord:function(a,b){return ca.getBarycoord(a,this.a,this.b,this.c,b)},getUV:function(a,b,c,d,e){return ca.getUV(a,this.a,this.b,this.c,b,c,d,e)},containsPoint:function(a){return ca.containsPoint(a, +this.a,this.b,this.c)},isFrontFacing:function(a){return ca.isFrontFacing(this.a,this.b,this.c,a)},intersectsBox:function(a){return a.intersectsTriangle(this)},closestPointToPoint:function(a,b){void 0===b&&(console.warn("THREE.Triangle: .closestPointToPoint() target is now required"),b=new n);var c=this.a,d=this.b,e=this.c;rd.subVectors(d,c);sd.subVectors(e,c);Ng.subVectors(a,c);var f=rd.dot(Ng),g=sd.dot(Ng);if(0>=f&&0>=g)return b.copy(c);Og.subVectors(a,d);var h=rd.dot(Og),l=sd.dot(Og);if(0<=h&&l<= +h)return b.copy(d);var m=f*l-h*g;if(0>=m&&0<=f&&0>=h)return d=f/(f-h),b.copy(c).addScaledVector(rd,d);Pg.subVectors(a,e);a=rd.dot(Pg);var k=sd.dot(Pg);if(0<=k&&a<=k)return b.copy(e);f=a*g-f*k;if(0>=f&&0<=g&&0>=k)return m=g/(g-k),b.copy(c).addScaledVector(sd,m);g=h*k-a*l;if(0>=g&&0<=l-h&&0<=a-k)return li.subVectors(e,d),m=(l-h)/(l-h+(a-k)),b.copy(d).addScaledVector(li,m);e=1/(g+f+m);d=f*e;m*=e;return b.copy(c).addScaledVector(rd,d).addScaledVector(sd,m)},equals:function(a){return a.a.equals(this.a)&& +a.b.equals(this.b)&&a.c.equals(this.c)}});var nk={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017, darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504, green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734, lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734, palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407, -steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},Aa={h:0,s:0,l:0},xf={h:0,s:0,l:0};Object.assign(J.prototype,{isColor:!0,r:1,g:1,b:1,set:function(a){a&&a.isColor?this.copy(a):"number"===typeof a?this.setHex(a):"string"===typeof a&&this.setStyle(a);return this},setScalar:function(a){this.b=this.g=this.r=a;return this},setHex:function(a){a=Math.floor(a); -this.r=(a>>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255;return this},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;return this},setHSL:function(a,b,c){a=O.euclideanModulo(a,1);b=O.clamp(b,0,1);c=O.clamp(c,0,1);0===b?this.r=this.g=this.b=c:(b=.5>=c?c*(1+b):c+b-c*b,c=2*c-b,this.r=Sf(c,b,a+1/3),this.g=Sf(c,b,a),this.b=Sf(c,b,a-1/3));return this},setStyle:function(a){function b(b){void 0!==b&&1>parseFloat(b)&&console.warn("THREE.Color: Alpha component of "+a+" will be ignored.")}var c;if(c= +steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},Ea={h:0,s:0,l:0},wf={h:0,s:0,l:0};Object.assign(I.prototype,{isColor:!0,r:1,g:1,b:1,set:function(a){a&&a.isColor?this.copy(a):"number"===typeof a?this.setHex(a):"string"===typeof a&&this.setStyle(a);return this},setScalar:function(a){this.b=this.g=this.r=a;return this},setHex:function(a){a=Math.floor(a); +this.r=(a>>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255;return this},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;return this},setHSL:function(a,b,c){a=N.euclideanModulo(a,1);b=N.clamp(b,0,1);c=N.clamp(c,0,1);0===b?this.r=this.g=this.b=c:(b=.5>=c?c*(1+b):c+b-c*b,c=2*c-b,this.r=Rf(c,b,a+1/3),this.g=Rf(c,b,a),this.b=Rf(c,b,a-1/3));return this},setStyle:function(a){function b(b){void 0!==b&&1>parseFloat(b)&&console.warn("THREE.Color: Alpha component of "+a+" will be ignored.")}var c;if(c= /^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(a)){var d=c[2];switch(c[1]){case "rgb":case "rgba":if(c=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(d))return this.r=Math.min(255,parseInt(c[1],10))/255,this.g=Math.min(255,parseInt(c[2],10))/255,this.b=Math.min(255,parseInt(c[3],10))/255,b(c[5]),this;if(c=/^(\d+)%\s*,\s*(\d+)%\s*,\s*(\d+)%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(d))return this.r=Math.min(100,parseInt(c[1],10))/100,this.g=Math.min(100,parseInt(c[2],10))/100,this.b=Math.min(100, parseInt(c[3],10))/100,b(c[5]),this;break;case "hsl":case "hsla":if(c=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)%\s*,\s*(\d+)%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(d)){d=parseFloat(c[1])/360;var e=parseInt(c[2],10)/100,f=parseInt(c[3],10)/100;b(c[5]);return this.setHSL(d,e,f)}}}else if(c=/^#([A-Fa-f0-9]+)$/.exec(a)){c=c[1];d=c.length;if(3===d)return this.r=parseInt(c.charAt(0)+c.charAt(0),16)/255,this.g=parseInt(c.charAt(1)+c.charAt(1),16)/255,this.b=parseInt(c.charAt(2)+c.charAt(2),16)/255,this;if(6===d)return this.r= -parseInt(c.charAt(0)+c.charAt(1),16)/255,this.g=parseInt(c.charAt(2)+c.charAt(3),16)/255,this.b=parseInt(c.charAt(4)+c.charAt(5),16)/255,this}a&&0=h?l/(e+f):l/(2-e-f);switch(e){case b:g=(c- -d)/l+(cg;g++)if(d[g]===d[(g+1)%3]){a.push(f);break}for(f=a.length-1;0<=f;f--)for(d=a[f],this.faces.splice(d,1),c=0,e=this.faceVertexUvs.length;c\n\t#include \n}", -fragmentShader:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV;\n\tsampleUV.y = asin( clamp( direction.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\tsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n}",side:1,blending:0});d.uniforms.tEquirect.value=b;b=new ra(new Bb(5, -5,5),d);c.add(b);d=new Dc(1,10,1);d.renderTarget=this;d.renderTarget.texture.name="CubeCameraTexture";d.update(a,c);b.geometry.dispose();b.material.dispose();return this};Zb.prototype=Object.create(ba.prototype);Zb.prototype.constructor=Zb;Zb.prototype.isDataTexture=!0;var Ug=new n,qk=new n,rk=new ta;Object.assign(cb.prototype,{isPlane:!0,set:function(a,b){this.normal.copy(a);this.constant=b;return this},setComponents:function(a,b,c,d){this.normal.set(a,b,c);this.constant=d;return this},setFromNormalAndCoplanarPoint:function(a, -b){this.normal.copy(a);this.constant=-b.dot(this.normal);return this},setFromCoplanarPoints:function(a,b,c){b=Ug.subVectors(c,b).cross(qk.subVectors(a,b)).normalize();this.setFromNormalAndCoplanarPoint(b,a);return this},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.normal.copy(a.normal);this.constant=a.constant;return this},normalize:function(){var a=1/this.normal.length();this.normal.multiplyScalar(a);this.constant*=a;return this},negate:function(){this.constant*= +null!==f&&(this.boundingBox=f.clone());f=a.boundingSphere;null!==f&&(this.boundingSphere=f.clone());this.elementsNeedUpdate=a.elementsNeedUpdate;this.verticesNeedUpdate=a.verticesNeedUpdate;this.uvsNeedUpdate=a.uvsNeedUpdate;this.normalsNeedUpdate=a.normalsNeedUpdate;this.colorsNeedUpdate=a.colorsNeedUpdate;this.lineDistancesNeedUpdate=a.lineDistancesNeedUpdate;this.groupsNeedUpdate=a.groupsNeedUpdate;return this},dispose:function(){this.dispatchEvent({type:"dispose"})}});var Ug=function(a){function b(b, +d,e,f,g,h){a.call(this);this.type="BoxGeometry";this.parameters={width:b,height:d,depth:e,widthSegments:f,heightSegments:g,depthSegments:h};this.fromBufferGeometry(new Gd(b,d,e,f,g,h));this.mergeVertices()}a&&(b.__proto__=a);b.prototype=Object.create(a&&a.prototype);return b.prototype.constructor=b}(F),Gd=function(a){function b(b,d,e,f,g,h){function c(a,b,c,d,e,f,g,h,l,m,v){var w=f/l,x=g/m,y=f/2,A=g/2,B=h/2;g=l+1;var E=m+1,D=f=0,C,F,G=new n;for(F=0;F\n\t#include \n}", +fragmentShader:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV;\n\tsampleUV.y = asin( clamp( direction.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\tsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n}",side:1,blending:0});d.uniforms.tEquirect.value=b;b=new ia(new Gd(5, +5,5),d);c.add(b);d=new Dc(1,10,1);d.renderTarget=this;d.renderTarget.texture.name="CubeCameraTexture";d.update(a,c);b.geometry.dispose();b.material.dispose();return this};Yb.prototype=Object.create(V.prototype);Yb.prototype.constructor=Yb;Yb.prototype.isDataTexture=!0;var Vg=new n,pk=new n,qk=new S;Object.assign(cb.prototype,{isPlane:!0,set:function(a,b){this.normal.copy(a);this.constant=b;return this},setComponents:function(a,b,c,d){this.normal.set(a,b,c);this.constant=d;return this},setFromNormalAndCoplanarPoint:function(a, +b){this.normal.copy(a);this.constant=-b.dot(this.normal);return this},setFromCoplanarPoints:function(a,b,c){b=Vg.subVectors(c,b).cross(pk.subVectors(a,b)).normalize();this.setFromNormalAndCoplanarPoint(b,a);return this},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.normal.copy(a.normal);this.constant=a.constant;return this},normalize:function(){var a=1/this.normal.length();this.normal.multiplyScalar(a);this.constant*=a;return this},negate:function(){this.constant*= -1;this.normal.negate();return this},distanceToPoint:function(a){return this.normal.dot(a)+this.constant},distanceToSphere:function(a){return this.distanceToPoint(a.center)-a.radius},projectPoint:function(a,b){void 0===b&&(console.warn("THREE.Plane: .projectPoint() target is now required"),b=new n);return b.copy(this.normal).multiplyScalar(-this.distanceToPoint(a)).add(a)},intersectLine:function(a,b){void 0===b&&(console.warn("THREE.Plane: .intersectLine() target is now required"),b=new n);var c= -a.delta(Ug),d=this.normal.dot(c);if(0===d){if(0===this.distanceToPoint(a.start))return b.copy(a.start)}else if(d=-(a.start.dot(this.normal)+this.constant)/d,!(0>d||1b&&0a&&0c;c++)b[c].copy(a.planes[c]);return this},setFromMatrix:function(a){var b=this.planes,c=a.elements;a=c[0];var d=c[1],e=c[2],f=c[3],g=c[4],h=c[5],l=c[6],k=c[7],n=c[8],u=c[9],r=c[10],q=c[11],t=c[12],y=c[13],w=c[14];c=c[15];b[0].setComponents(f-a,k-g,q-n,c-t).normalize();b[1].setComponents(f+a,k+g,q+n,c+t).normalize();b[2].setComponents(f+ -d,k+h,q+u,c+y).normalize();b[3].setComponents(f-d,k-h,q-u,c-y).normalize();b[4].setComponents(f-e,k-l,q-r,c-w).normalize();b[5].setComponents(f+e,k+l,q+r,c+w).normalize();return this},intersectsObject:function(a){var b=a.geometry;null===b.boundingSphere&&b.computeBoundingSphere();td.copy(b.boundingSphere).applyMatrix4(a.matrixWorld);return this.intersectsSphere(td)},intersectsSprite:function(a){td.center.set(0,0,0);td.radius=.7071067811865476;td.applyMatrix4(a.matrixWorld);return this.intersectsSphere(td)}, -intersectsSphere:function(a){var b=this.planes,c=a.center;a=-a.radius;for(var d=0;6>d;d++)if(b[d].distanceToPoint(c)c;c++){var d=b[c];Af.x=0d.distanceToPoint(Af))return!1}return!0},containsPoint:function(a){for(var b=this.planes,c=0;6>c;c++)if(0>b[c].distanceToPoint(a))return!1;return!0}});var K={alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif", +a.delta(Vg),d=this.normal.dot(c);if(0===d){if(0===this.distanceToPoint(a.start))return b.copy(a.start)}else if(d=-(a.start.dot(this.normal)+this.constant)/d,!(0>d||1b&&0a&&0c;c++)b[c].copy(a.planes[c]);return this},setFromMatrix:function(a){var b=this.planes,c=a.elements;a=c[0];var d=c[1],e=c[2],f=c[3],g=c[4],h=c[5],l=c[6],k=c[7],n=c[8],u=c[9],r=c[10],q=c[11],t=c[12],z=c[13],w=c[14];c=c[15];b[0].setComponents(f-a,k-g,q-n,c-t).normalize();b[1].setComponents(f+a,k+g,q+n,c+t).normalize();b[2].setComponents(f+ +d,k+h,q+u,c+z).normalize();b[3].setComponents(f-d,k-h,q-u,c-z).normalize();b[4].setComponents(f-e,k-l,q-r,c-w).normalize();b[5].setComponents(f+e,k+l,q+r,c+w).normalize();return this},intersectsObject:function(a){var b=a.geometry;null===b.boundingSphere&&b.computeBoundingSphere();td.copy(b.boundingSphere).applyMatrix4(a.matrixWorld);return this.intersectsSphere(td)},intersectsSprite:function(a){td.center.set(0,0,0);td.radius=.7071067811865476;td.applyMatrix4(a.matrixWorld);return this.intersectsSphere(td)}, +intersectsSphere:function(a){var b=this.planes,c=a.center;a=-a.radius;for(var d=0;6>d;d++)if(b[d].distanceToPoint(c)c;c++){var d=b[c];zf.x=0d.distanceToPoint(zf))return!1}return!0},containsPoint:function(a){for(var b=this.planes,c=0;6>c;c++)if(0>b[c].distanceToPoint(a))return!1;return!0}});var M={alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif", alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef ALPHATEST\n\tif ( diffuseColor.a < ALPHATEST ) discard;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\n\t#endif\n#endif", aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",begin_vertex:"vec3 transformed = vec3( position );",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"vec2 integrateSpecularBRDF( const in float dotNV, const in float roughness ) {\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\treturn vec2( -1.04, 1.04 ) * a004 + r.zw;\n}\nfloat punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif( cutoffDistance > 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n#else\n\tif( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t}\n\treturn 1.0;\n#endif\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nvec3 F_Schlick_RoughnessDependent( const in vec3 F0, const in float dotNV, const in float roughness ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotNV - 6.98316 ) * dotNV );\n\tvec3 Fr = max( vec3( 1.0 - roughness ), F0 ) - F0;\n\treturn Fr * fresnel + F0;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + viewDir );\n\tfloat dotNL = saturate( dot( normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\nvec3 BRDF_Specular_GGX_Environment( const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\treturn specularColor * brdf.x + brdf.y;\n}\nvoid BRDF_Specular_Multiscattering_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tvec3 F = F_Schlick_RoughnessDependent( specularColor, dotNV, roughness );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\tvec3 FssEss = F * brdf.x + brdf.y;\n\tfloat Ess = brdf.x + brdf.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie(float roughness, float NoH) {\n\tfloat invAlpha = 1.0 / roughness;\n\tfloat cos2h = NoH * NoH;\n\tfloat sin2h = max(1.0 - cos2h, 0.0078125);\treturn (2.0 + invAlpha) * pow(sin2h, invAlpha * 0.5) / (2.0 * PI);\n}\nfloat V_Neubelt(float NoV, float NoL) {\n\treturn saturate(1.0 / (4.0 * (NoL + NoV - NoL * NoV)));\n}\nvec3 BRDF_Specular_Sheen( const in float roughness, const in vec3 L, const in GeometricContext geometry, vec3 specularColor ) {\n\tvec3 N = geometry.normal;\n\tvec3 V = geometry.viewDir;\n\tvec3 H = normalize( V + L );\n\tfloat dotNH = saturate( dot( N, H ) );\n\treturn specularColor * D_Charlie( roughness, dotNH ) * V_Neubelt( dot(N, V), dot(N, L) );\n}\n#endif", bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\t\tfDet *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif", @@ -638,230 +640,230 @@ points_vert:"uniform float size;\nuniform float scale;\n#include \n#incl shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include \n}",shadow_vert:"#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}", sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n}", sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include \n\t#include \n\t#include \n}"}, -H={common:{diffuse:{value:new J(15658734)},opacity:{value:1},map:{value:null},uvTransform:{value:new ta},alphaMap:{value:null}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},refractionRatio:{value:.98},maxMipLevel:{value:0}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null}, -normalScale:{value:new v(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:2.5E-4},fogNear:{value:1},fogFar:{value:2E3},fogColor:{value:new J(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{},shadow:{},shadowBias:{}, +G={common:{diffuse:{value:new I(15658734)},opacity:{value:1},map:{value:null},uvTransform:{value:new S},alphaMap:{value:null}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},refractionRatio:{value:.98},maxMipLevel:{value:0}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null}, +normalScale:{value:new v(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:2.5E-4},fogNear:{value:1},fogFar:{value:2E3},fogColor:{value:new I(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{},shadow:{},shadowBias:{}, shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}}, -pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}}},points:{diffuse:{value:new J(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},uvTransform:{value:new ta}},sprite:{diffuse:{value:new J(15658734)},opacity:{value:1},center:{value:new v(.5,.5)},rotation:{value:0},map:{value:null},uvTransform:{value:new ta}}}, -db={basic:{uniforms:ka([H.common,H.specularmap,H.envmap,H.aomap,H.lightmap,H.fog]),vertexShader:K.meshbasic_vert,fragmentShader:K.meshbasic_frag},lambert:{uniforms:ka([H.common,H.specularmap,H.envmap,H.aomap,H.lightmap,H.emissivemap,H.fog,H.lights,{emissive:{value:new J(0)}}]),vertexShader:K.meshlambert_vert,fragmentShader:K.meshlambert_frag},phong:{uniforms:ka([H.common,H.specularmap,H.envmap,H.aomap,H.lightmap,H.emissivemap,H.bumpmap,H.normalmap,H.displacementmap,H.gradientmap,H.fog,H.lights,{emissive:{value:new J(0)}, -specular:{value:new J(1118481)},shininess:{value:30}}]),vertexShader:K.meshphong_vert,fragmentShader:K.meshphong_frag},standard:{uniforms:ka([H.common,H.envmap,H.aomap,H.lightmap,H.emissivemap,H.bumpmap,H.normalmap,H.displacementmap,H.roughnessmap,H.metalnessmap,H.fog,H.lights,{emissive:{value:new J(0)},roughness:{value:.5},metalness:{value:.5},envMapIntensity:{value:1}}]),vertexShader:K.meshphysical_vert,fragmentShader:K.meshphysical_frag},matcap:{uniforms:ka([H.common,H.bumpmap,H.normalmap,H.displacementmap, -H.fog,{matcap:{value:null}}]),vertexShader:K.meshmatcap_vert,fragmentShader:K.meshmatcap_frag},points:{uniforms:ka([H.points,H.fog]),vertexShader:K.points_vert,fragmentShader:K.points_frag},dashed:{uniforms:ka([H.common,H.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:K.linedashed_vert,fragmentShader:K.linedashed_frag},depth:{uniforms:ka([H.common,H.displacementmap]),vertexShader:K.depth_vert,fragmentShader:K.depth_frag},normal:{uniforms:ka([H.common,H.bumpmap,H.normalmap, -H.displacementmap,{opacity:{value:1}}]),vertexShader:K.normal_vert,fragmentShader:K.normal_frag},sprite:{uniforms:ka([H.sprite,H.fog]),vertexShader:K.sprite_vert,fragmentShader:K.sprite_frag},background:{uniforms:{uvTransform:{value:new ta},t2D:{value:null}},vertexShader:K.background_vert,fragmentShader:K.background_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:K.cube_vert,fragmentShader:K.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:K.equirect_vert, -fragmentShader:K.equirect_frag},distanceRGBA:{uniforms:ka([H.common,H.displacementmap,{referencePosition:{value:new n},nearDistance:{value:1},farDistance:{value:1E3}}]),vertexShader:K.distanceRGBA_vert,fragmentShader:K.distanceRGBA_frag},shadow:{uniforms:ka([H.lights,H.fog,{color:{value:new J(0)},opacity:{value:1}}]),vertexShader:K.shadow_vert,fragmentShader:K.shadow_frag}};db.physical={uniforms:ka([db.standard.uniforms,{transparency:{value:0},clearcoat:{value:0},clearcoatRoughness:{value:0},sheen:{value:new J(0)}, -clearcoatNormalScale:{value:new v(1,1)},clearcoatNormalMap:{value:null}}]),vertexShader:K.meshphysical_vert,fragmentShader:K.meshphysical_frag};Fd.prototype=Object.create(G.prototype);Fd.prototype.constructor=Fd;$b.prototype=Object.create(D.prototype);$b.prototype.constructor=$b;pb.prototype=Object.create(ba.prototype);pb.prototype.constructor=pb;pb.prototype.isCubeTexture=!0;Object.defineProperty(pb.prototype,"images",{get:function(){return this.image},set:function(a){this.image=a}});Ec.prototype= -Object.create(ba.prototype);Ec.prototype.constructor=Ec;Ec.prototype.isDataTexture2DArray=!0;Fc.prototype=Object.create(ba.prototype);Fc.prototype.constructor=Fc;Fc.prototype.isDataTexture3D=!0;var qh=new ba,kj=new Ec,mj=new Fc,rh=new pb,kh=[],mh=[],ph=new Float32Array(16),oh=new Float32Array(9),nh=new Float32Array(4);sh.prototype.updateCache=function(a){var b=this.cache;a instanceof Float32Array&&b.length!==a.length&&(this.cache=new Float32Array(a.length));Ga(b,a)};th.prototype.setValue=function(a, -b,c){for(var d=this.seq,e=0,f=d.length;e!==f;++e){var g=d[e];g.setValue(a,b[g.id],c)}};var $f=/([\w\d_]+)(\])?(\[|\.)?/g;Db.prototype.setValue=function(a,b,c,d){b=this.map[b];void 0!==b&&b.setValue(a,c,d)};Db.prototype.setOptional=function(a,b,c){b=b[c];void 0!==b&&this.setValue(a,c,b)};Db.upload=function(a,b,c,d){for(var e=0,f=b.length;e!==f;++e){var g=b[e],h=c[g.id];!1!==h.needsUpdate&&g.setValue(a,h.value,d)}};Db.seqWithValue=function(a,b){for(var c=[],d=0,e=a.length;d!==e;++d){var f=a[d];f.id in -b&&c.push(f)}return c};var Nj=0,Wj=0;Eb.prototype=Object.create(Q.prototype);Eb.prototype.constructor=Eb;Eb.prototype.isMeshDepthMaterial=!0;Eb.prototype.copy=function(a){Q.prototype.copy.call(this,a);this.depthPacking=a.depthPacking;this.skinning=a.skinning;this.morphTargets=a.morphTargets;this.map=a.map;this.alphaMap=a.alphaMap;this.displacementMap=a.displacementMap;this.displacementScale=a.displacementScale;this.displacementBias=a.displacementBias;this.wireframe=a.wireframe;this.wireframeLinewidth= -a.wireframeLinewidth;return this};Fb.prototype=Object.create(Q.prototype);Fb.prototype.constructor=Fb;Fb.prototype.isMeshDistanceMaterial=!0;Fb.prototype.copy=function(a){Q.prototype.copy.call(this,a);this.referencePosition.copy(a.referencePosition);this.nearDistance=a.nearDistance;this.farDistance=a.farDistance;this.skinning=a.skinning;this.morphTargets=a.morphTargets;this.map=a.map;this.alphaMap=a.alphaMap;this.displacementMap=a.displacementMap;this.displacementScale=a.displacementScale;this.displacementBias= -a.displacementBias;return this};Hc.prototype=Object.assign(Object.create(B.prototype),{constructor:Hc,isGroup:!0});Id.prototype=Object.assign(Object.create(la.prototype),{constructor:Id,isArrayCamera:!0});var Gh=new n,Hh=new n;Object.assign(cg.prototype,xa.prototype);Object.assign(Ih.prototype,xa.prototype);Object.assign(Je.prototype,{isFogExp2:!0,clone:function(){return new Je(this.color,this.density)},toJSON:function(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}});Object.assign(Ke.prototype, -{isFog:!0,clone:function(){return new Ke(this.color,this.near,this.far)},toJSON:function(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}});Object.defineProperty(ac.prototype,"needsUpdate",{set:function(a){!0===a&&this.version++}});Object.assign(ac.prototype,{isInterleavedBuffer:!0,onUploadCallback:function(){},setArray:function(a){if(Array.isArray(a))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.count=void 0!==a?a.length/this.stride: +pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}}},points:{diffuse:{value:new I(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},uvTransform:{value:new S}},sprite:{diffuse:{value:new I(15658734)},opacity:{value:1},center:{value:new v(.5,.5)},rotation:{value:0},map:{value:null},uvTransform:{value:new S}}},db= +{basic:{uniforms:Ba([G.common,G.specularmap,G.envmap,G.aomap,G.lightmap,G.fog]),vertexShader:M.meshbasic_vert,fragmentShader:M.meshbasic_frag},lambert:{uniforms:Ba([G.common,G.specularmap,G.envmap,G.aomap,G.lightmap,G.emissivemap,G.fog,G.lights,{emissive:{value:new I(0)}}]),vertexShader:M.meshlambert_vert,fragmentShader:M.meshlambert_frag},phong:{uniforms:Ba([G.common,G.specularmap,G.envmap,G.aomap,G.lightmap,G.emissivemap,G.bumpmap,G.normalmap,G.displacementmap,G.gradientmap,G.fog,G.lights,{emissive:{value:new I(0)}, +specular:{value:new I(1118481)},shininess:{value:30}}]),vertexShader:M.meshphong_vert,fragmentShader:M.meshphong_frag},standard:{uniforms:Ba([G.common,G.envmap,G.aomap,G.lightmap,G.emissivemap,G.bumpmap,G.normalmap,G.displacementmap,G.roughnessmap,G.metalnessmap,G.fog,G.lights,{emissive:{value:new I(0)},roughness:{value:.5},metalness:{value:.5},envMapIntensity:{value:1}}]),vertexShader:M.meshphysical_vert,fragmentShader:M.meshphysical_frag},matcap:{uniforms:Ba([G.common,G.bumpmap,G.normalmap,G.displacementmap, +G.fog,{matcap:{value:null}}]),vertexShader:M.meshmatcap_vert,fragmentShader:M.meshmatcap_frag},points:{uniforms:Ba([G.points,G.fog]),vertexShader:M.points_vert,fragmentShader:M.points_frag},dashed:{uniforms:Ba([G.common,G.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:M.linedashed_vert,fragmentShader:M.linedashed_frag},depth:{uniforms:Ba([G.common,G.displacementmap]),vertexShader:M.depth_vert,fragmentShader:M.depth_frag},normal:{uniforms:Ba([G.common,G.bumpmap,G.normalmap, +G.displacementmap,{opacity:{value:1}}]),vertexShader:M.normal_vert,fragmentShader:M.normal_frag},sprite:{uniforms:Ba([G.sprite,G.fog]),vertexShader:M.sprite_vert,fragmentShader:M.sprite_frag},background:{uniforms:{uvTransform:{value:new S},t2D:{value:null}},vertexShader:M.background_vert,fragmentShader:M.background_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:M.cube_vert,fragmentShader:M.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:M.equirect_vert, +fragmentShader:M.equirect_frag},distanceRGBA:{uniforms:Ba([G.common,G.displacementmap,{referencePosition:{value:new n},nearDistance:{value:1},farDistance:{value:1E3}}]),vertexShader:M.distanceRGBA_vert,fragmentShader:M.distanceRGBA_frag},shadow:{uniforms:Ba([G.lights,G.fog,{color:{value:new I(0)},opacity:{value:1}}]),vertexShader:M.shadow_vert,fragmentShader:M.shadow_frag}};db.physical={uniforms:Ba([db.standard.uniforms,{transparency:{value:0},clearcoat:{value:0},clearcoatRoughness:{value:0},sheen:{value:new I(0)}, +clearcoatNormalScale:{value:new v(1,1)},clearcoatNormalMap:{value:null}}]),vertexShader:M.meshphysical_vert,fragmentShader:M.meshphysical_frag};Fd.prototype=Object.create(F.prototype);Fd.prototype.constructor=Fd;Zb.prototype=Object.create(D.prototype);Zb.prototype.constructor=Zb;ob.prototype=Object.create(V.prototype);ob.prototype.constructor=ob;ob.prototype.isCubeTexture=!0;Object.defineProperty(ob.prototype,"images",{get:function(){return this.image},set:function(a){this.image=a}});Ec.prototype= +Object.create(V.prototype);Ec.prototype.constructor=Ec;Ec.prototype.isDataTexture2DArray=!0;Fc.prototype=Object.create(V.prototype);Fc.prototype.constructor=Fc;Fc.prototype.isDataTexture3D=!0;var qh=new V,jj=new Ec,lj=new Fc,rh=new ob,kh=[],mh=[],ph=new Float32Array(16),oh=new Float32Array(9),nh=new Float32Array(4);sh.prototype.updateCache=function(a){var b=this.cache;a instanceof Float32Array&&b.length!==a.length&&(this.cache=new Float32Array(a.length));Ga(b,a)};th.prototype.setValue=function(a, +b,c){for(var d=this.seq,e=0,f=d.length;e!==f;++e){var g=d[e];g.setValue(a,b[g.id],c)}};var Yf=/([\w\d_]+)(\])?(\[|\.)?/g;Bb.prototype.setValue=function(a,b,c,d){b=this.map[b];void 0!==b&&b.setValue(a,c,d)};Bb.prototype.setOptional=function(a,b,c){b=b[c];void 0!==b&&this.setValue(a,c,b)};Bb.upload=function(a,b,c,d){for(var e=0,f=b.length;e!==f;++e){var g=b[e],h=c[g.id];!1!==h.needsUpdate&&g.setValue(a,h.value,d)}};Bb.seqWithValue=function(a,b){for(var c=[],d=0,e=a.length;d!==e;++d){var f=a[d];f.id in +b&&c.push(f)}return c};var Mj=0,Vj=0;Db.prototype=Object.create(O.prototype);Db.prototype.constructor=Db;Db.prototype.isMeshDepthMaterial=!0;Db.prototype.copy=function(a){O.prototype.copy.call(this,a);this.depthPacking=a.depthPacking;this.skinning=a.skinning;this.morphTargets=a.morphTargets;this.map=a.map;this.alphaMap=a.alphaMap;this.displacementMap=a.displacementMap;this.displacementScale=a.displacementScale;this.displacementBias=a.displacementBias;this.wireframe=a.wireframe;this.wireframeLinewidth= +a.wireframeLinewidth;return this};Eb.prototype=Object.create(O.prototype);Eb.prototype.constructor=Eb;Eb.prototype.isMeshDistanceMaterial=!0;Eb.prototype.copy=function(a){O.prototype.copy.call(this,a);this.referencePosition.copy(a.referencePosition);this.nearDistance=a.nearDistance;this.farDistance=a.farDistance;this.skinning=a.skinning;this.morphTargets=a.morphTargets;this.map=a.map;this.alphaMap=a.alphaMap;this.displacementMap=a.displacementMap;this.displacementScale=a.displacementScale;this.displacementBias= +a.displacementBias;return this};Hc.prototype=Object.assign(Object.create(A.prototype),{constructor:Hc,isGroup:!0});Jd.prototype=Object.assign(Object.create(ja.prototype),{constructor:Jd,isArrayCamera:!0});var Fh=new n,Gh=new n;Object.assign(cg.prototype,za.prototype);Object.assign(Hh.prototype,za.prototype);Object.assign(Ie.prototype,{isFogExp2:!0,clone:function(){return new Ie(this.color,this.density)},toJSON:function(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}});Object.assign(Je.prototype, +{isFog:!0,clone:function(){return new Je(this.color,this.near,this.far)},toJSON:function(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}});Object.defineProperty(bc.prototype,"needsUpdate",{set:function(a){!0===a&&this.version++}});Object.assign(bc.prototype,{isInterleavedBuffer:!0,onUploadCallback:function(){},setArray:function(a){if(Array.isArray(a))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.count=void 0!==a?a.length/this.stride: 0;this.array=a;return this},setDynamic:function(a){this.dynamic=a;return this},copy:function(a){this.array=new a.array.constructor(a.array);this.count=a.count;this.stride=a.stride;this.dynamic=a.dynamic;return this},copyAt:function(a,b,c){a*=this.stride;c*=b.stride;for(var d=0,e=this.stride;da.far||b.push({distance:e,point:ye.clone(),uv:ia.getUV(ye,Bf,ze,Cf,oi,Vg,pi,new v),face:null,object:this})},clone:function(){return(new this.constructor(this.material)).copy(this)},copy:function(a){B.prototype.copy.call(this,a);void 0!==a.center&&this.center.copy(a.center);return this}});var Df=new n,qi=new n;Md.prototype=Object.assign(Object.create(B.prototype),{constructor:Md,isLOD:!0,copy:function(a){B.prototype.copy.call(this,a,!1);a=a.levels;for(var b=0,c=a.length;b=b[c].distance)b[c-1].object.visible=!1,b[c].object.visible=!0;else break;for(;cc||(h.applyMatrix4(this.matrixWorld),r=a.ray.origin.distanceTo(h),ra.far||b.push({distance:r,point:e.clone().applyMatrix4(this.matrixWorld),index:d,face:null,faceIndex:null,object:this}))}}else for(d=0,u=p.length/3-1;dc||(h.applyMatrix4(this.matrixWorld),r=a.ray.origin.distanceTo(h),ra.far||b.push({distance:r,point:e.clone().applyMatrix4(this.matrixWorld), -index:d,face:null,faceIndex:null,object:this}))}else if(d.isGeometry)for(f=d.vertices,g=f.length,d=0;dc||(h.applyMatrix4(this.matrixWorld),r=a.ray.origin.distanceTo(h),ra.far||b.push({distance:r,point:e.clone().applyMatrix4(this.matrixWorld),index:d,face:null,faceIndex:null,object:this}))}},clone:function(){return(new this.constructor(this.geometry,this.material)).copy(this)}});var Ff=new n,Gf=new n;R.prototype=Object.assign(Object.create(ca.prototype), -{constructor:R,isLineSegments:!0,computeLineDistances:function(){var a=this.geometry;if(a.isBufferGeometry)if(null===a.index){for(var b=a.attributes.position,c=[],d=0,e=b.count;d=a.HAVE_CURRENT_DATA&& -(this.needsUpdate=!0)}});Lc.prototype=Object.create(ba.prototype);Lc.prototype.constructor=Lc;Lc.prototype.isCompressedTexture=!0;Od.prototype=Object.create(ba.prototype);Od.prototype.constructor=Od;Od.prototype.isCanvasTexture=!0;Pd.prototype=Object.create(ba.prototype);Pd.prototype.constructor=Pd;Pd.prototype.isDepthTexture=!0;Mc.prototype=Object.create(D.prototype);Mc.prototype.constructor=Mc;Qd.prototype=Object.create(G.prototype);Qd.prototype.constructor=Qd;Nc.prototype=Object.create(D.prototype); -Nc.prototype.constructor=Nc;Rd.prototype=Object.create(G.prototype);Rd.prototype.constructor=Rd;pa.prototype=Object.create(D.prototype);pa.prototype.constructor=pa;Sd.prototype=Object.create(G.prototype);Sd.prototype.constructor=Sd;Oc.prototype=Object.create(pa.prototype);Oc.prototype.constructor=Oc;Td.prototype=Object.create(G.prototype);Td.prototype.constructor=Td;bc.prototype=Object.create(pa.prototype);bc.prototype.constructor=bc;Ud.prototype=Object.create(G.prototype);Ud.prototype.constructor= -Ud;Pc.prototype=Object.create(pa.prototype);Pc.prototype.constructor=Pc;Vd.prototype=Object.create(G.prototype);Vd.prototype.constructor=Vd;Qc.prototype=Object.create(pa.prototype);Qc.prototype.constructor=Qc;Wd.prototype=Object.create(G.prototype);Wd.prototype.constructor=Wd;cc.prototype=Object.create(D.prototype);cc.prototype.constructor=cc;cc.prototype.toJSON=function(){var a=D.prototype.toJSON.call(this);a.path=this.parameters.path.toJSON();return a};Xd.prototype=Object.create(G.prototype);Xd.prototype.constructor= -Xd;Rc.prototype=Object.create(D.prototype);Rc.prototype.constructor=Rc;Yd.prototype=Object.create(G.prototype);Yd.prototype.constructor=Yd;Sc.prototype=Object.create(D.prototype);Sc.prototype.constructor=Sc;var tk={triangulate:function(a,b,c){c=c||2;var d=b&&b.length,e=d?b[0]*c:a.length,f=Lh(a,0,e,c,!0),g=[];if(!f||f.next===f.prev)return g;var h;if(d){var l=c;d=[];var k;var n=0;for(k=b.length;n80*c){var q=h=a[0];var t=d=a[1];for(l=c;lh&&(h=n),b>d&&(d=b);h=Math.max(h-q,d-t);h=0!==h?1/h:0}ae(f,g,c,q,t,h);return g}},qb={area:function(a){for(var b=a.length,c=0,d=b-1,e=0;eqb.area(a)},triangulateShape:function(a,b){var c=[],d=[],e=[];Ph(a);Qh(c,a);var f=a.length;b.forEach(Ph); -for(a=0;aMath.abs(g-l)?[new v(a,1-c),new v(h,1-d),new v(k,1-e),new v(u,1-b)]:[new v(g,1-c),new v(l,1-d),new v(n,1-e),new v(r,1-b)]}};ce.prototype=Object.create(G.prototype); -ce.prototype.constructor=ce;Uc.prototype=Object.create(eb.prototype);Uc.prototype.constructor=Uc;de.prototype=Object.create(G.prototype);de.prototype.constructor=de;Ib.prototype=Object.create(D.prototype);Ib.prototype.constructor=Ib;ee.prototype=Object.create(G.prototype);ee.prototype.constructor=ee;Vc.prototype=Object.create(D.prototype);Vc.prototype.constructor=Vc;fe.prototype=Object.create(G.prototype);fe.prototype.constructor=fe;Wc.prototype=Object.create(D.prototype);Wc.prototype.constructor= -Wc;fc.prototype=Object.create(G.prototype);fc.prototype.constructor=fc;fc.prototype.toJSON=function(){var a=G.prototype.toJSON.call(this);return Sh(this.parameters.shapes,a)};gc.prototype=Object.create(D.prototype);gc.prototype.constructor=gc;gc.prototype.toJSON=function(){var a=D.prototype.toJSON.call(this);return Sh(this.parameters.shapes,a)};Xc.prototype=Object.create(D.prototype);Xc.prototype.constructor=Xc;hc.prototype=Object.create(G.prototype);hc.prototype.constructor=hc;rb.prototype=Object.create(D.prototype); -rb.prototype.constructor=rb;ge.prototype=Object.create(hc.prototype);ge.prototype.constructor=ge;he.prototype=Object.create(rb.prototype);he.prototype.constructor=he;ie.prototype=Object.create(G.prototype);ie.prototype.constructor=ie;Yc.prototype=Object.create(D.prototype);Yc.prototype.constructor=Yc;var Ba=Object.freeze({WireframeGeometry:Mc,ParametricGeometry:Qd,ParametricBufferGeometry:Nc,TetrahedronGeometry:Sd,TetrahedronBufferGeometry:Oc,OctahedronGeometry:Td,OctahedronBufferGeometry:bc,IcosahedronGeometry:Ud, -IcosahedronBufferGeometry:Pc,DodecahedronGeometry:Vd,DodecahedronBufferGeometry:Qc,PolyhedronGeometry:Rd,PolyhedronBufferGeometry:pa,TubeGeometry:Wd,TubeBufferGeometry:cc,TorusKnotGeometry:Xd,TorusKnotBufferGeometry:Rc,TorusGeometry:Yd,TorusBufferGeometry:Sc,TextGeometry:ce,TextBufferGeometry:Uc,SphereGeometry:de,SphereBufferGeometry:Ib,RingGeometry:ee,RingBufferGeometry:Vc,PlaneGeometry:Fd,PlaneBufferGeometry:$b,LatheGeometry:fe,LatheBufferGeometry:Wc,ShapeGeometry:fc,ShapeBufferGeometry:gc,ExtrudeGeometry:ec, -ExtrudeBufferGeometry:eb,EdgesGeometry:Xc,ConeGeometry:ge,ConeBufferGeometry:he,CylinderGeometry:hc,CylinderBufferGeometry:rb,CircleGeometry:ie,CircleBufferGeometry:Yc,BoxGeometry:Cc,BoxBufferGeometry:Bb});ic.prototype=Object.create(Q.prototype);ic.prototype.constructor=ic;ic.prototype.isShadowMaterial=!0;ic.prototype.copy=function(a){Q.prototype.copy.call(this,a);this.color.copy(a.color);return this};Zc.prototype=Object.create(va.prototype);Zc.prototype.constructor=Zc;Zc.prototype.isRawShaderMaterial= -!0;fb.prototype=Object.create(Q.prototype);fb.prototype.constructor=fb;fb.prototype.isMeshStandardMaterial=!0;fb.prototype.copy=function(a){Q.prototype.copy.call(this,a);this.defines={STANDARD:""};this.color.copy(a.color);this.roughness=a.roughness;this.metalness=a.metalness;this.map=a.map;this.lightMap=a.lightMap;this.lightMapIntensity=a.lightMapIntensity;this.aoMap=a.aoMap;this.aoMapIntensity=a.aoMapIntensity;this.emissive.copy(a.emissive);this.emissiveMap=a.emissiveMap;this.emissiveIntensity=a.emissiveIntensity; +0]=b;this.data.array[a+1]=c;this.data.array[a+2]=d;return this},setXYZW:function(a,b,c,d,e){a=a*this.data.stride+this.offset;this.data.array[a+0]=b;this.data.array[a+1]=c;this.data.array[a+2]=d;this.data.array[a+3]=e;return this}});Gb.prototype=Object.create(O.prototype);Gb.prototype.constructor=Gb;Gb.prototype.isSpriteMaterial=!0;Gb.prototype.copy=function(a){O.prototype.copy.call(this,a);this.color.copy(a.color);this.map=a.map;this.rotation=a.rotation;this.sizeAttenuation=a.sizeAttenuation;return this}; +var Ic,ze=new n,ud=new n,vd=new n,Jc=new v,Md=new v,Jh=new W,Af=new n,Ae=new n,Bf=new n,ni=new v,Wg=new v,oi=new v;Ld.prototype=Object.assign(Object.create(A.prototype),{constructor:Ld,isSprite:!0,raycast:function(a,b){null===a.camera&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.');ud.setFromMatrixScale(this.matrixWorld);Jh.copy(a.camera.matrixWorld);this.modelViewMatrix.multiplyMatrices(a.camera.matrixWorldInverse,this.matrixWorld);vd.setFromMatrixPosition(this.modelViewMatrix); +a.camera.isPerspectiveCamera&&!1===this.material.sizeAttenuation&&ud.multiplyScalar(-vd.z);var c=this.material.rotation;if(0!==c){var d=Math.cos(c);var e=Math.sin(c)}c=this.center;Ke(Af.set(-.5,-.5,0),vd,c,ud,e,d);Ke(Ae.set(.5,-.5,0),vd,c,ud,e,d);Ke(Bf.set(.5,.5,0),vd,c,ud,e,d);ni.set(0,0);Wg.set(1,0);oi.set(1,1);var f=a.ray.intersectTriangle(Af,Ae,Bf,!1,ze);if(null===f&&(Ke(Ae.set(-.5,.5,0),vd,c,ud,e,d),Wg.set(0,1),f=a.ray.intersectTriangle(Af,Bf,Ae,!1,ze),null===f))return;e=a.ray.origin.distanceTo(ze); +ea.far||b.push({distance:e,point:ze.clone(),uv:ca.getUV(ze,Af,Ae,Bf,ni,Wg,oi,new v),face:null,object:this})},clone:function(){return(new this.constructor(this.material)).copy(this)},copy:function(a){A.prototype.copy.call(this,a);void 0!==a.center&&this.center.copy(a.center);return this}});var Cf=new n,pi=new n;Nd.prototype=Object.assign(Object.create(A.prototype),{constructor:Nd,isLOD:!0,copy:function(a){A.prototype.copy.call(this,a,!1);a=a.levels;for(var b=0,c=a.length;b=b[c].distance)b[c-1].object.visible=!1,b[c].object.visible=!0;else break;for(;cc||(h.applyMatrix4(this.matrixWorld),r=a.ray.origin.distanceTo(h),ra.far||b.push({distance:r,point:e.clone().applyMatrix4(this.matrixWorld),index:d,face:null,faceIndex:null,object:this}))}}else for(d=0,u=p.length/3-1;dc||(h.applyMatrix4(this.matrixWorld),r=a.ray.origin.distanceTo(h),ra.far||b.push({distance:r,point:e.clone().applyMatrix4(this.matrixWorld), +index:d,face:null,faceIndex:null,object:this}))}else if(d.isGeometry)for(f=d.vertices,g=f.length,d=0;dc||(h.applyMatrix4(this.matrixWorld),r=a.ray.origin.distanceTo(h),ra.far||b.push({distance:r,point:e.clone().applyMatrix4(this.matrixWorld),index:d,face:null,faceIndex:null,object:this}))}},clone:function(){return(new this.constructor(this.geometry,this.material)).copy(this)}});var Ef=new n,Ff=new n;aa.prototype=Object.assign(Object.create(va.prototype), +{constructor:aa,isLineSegments:!0,computeLineDistances:function(){var a=this.geometry;if(a.isBufferGeometry)if(null===a.index){for(var b=a.attributes.position,c=[],d=0,e=b.count;d=a.HAVE_CURRENT_DATA&& +(this.needsUpdate=!0)}});Lc.prototype=Object.create(V.prototype);Lc.prototype.constructor=Lc;Lc.prototype.isCompressedTexture=!0;Pd.prototype=Object.create(V.prototype);Pd.prototype.constructor=Pd;Pd.prototype.isCanvasTexture=!0;Qd.prototype=Object.create(V.prototype);Qd.prototype.constructor=Qd;Qd.prototype.isDepthTexture=!0;Mc.prototype=Object.create(D.prototype);Mc.prototype.constructor=Mc;Rd.prototype=Object.create(F.prototype);Rd.prototype.constructor=Rd;Nc.prototype=Object.create(D.prototype); +Nc.prototype.constructor=Nc;Sd.prototype=Object.create(F.prototype);Sd.prototype.constructor=Sd;Aa.prototype=Object.create(D.prototype);Aa.prototype.constructor=Aa;Td.prototype=Object.create(F.prototype);Td.prototype.constructor=Td;Oc.prototype=Object.create(Aa.prototype);Oc.prototype.constructor=Oc;Ud.prototype=Object.create(F.prototype);Ud.prototype.constructor=Ud;cc.prototype=Object.create(Aa.prototype);cc.prototype.constructor=cc;Vd.prototype=Object.create(F.prototype);Vd.prototype.constructor= +Vd;Pc.prototype=Object.create(Aa.prototype);Pc.prototype.constructor=Pc;Wd.prototype=Object.create(F.prototype);Wd.prototype.constructor=Wd;Qc.prototype=Object.create(Aa.prototype);Qc.prototype.constructor=Qc;Xd.prototype=Object.create(F.prototype);Xd.prototype.constructor=Xd;dc.prototype=Object.create(D.prototype);dc.prototype.constructor=dc;dc.prototype.toJSON=function(){var a=D.prototype.toJSON.call(this);a.path=this.parameters.path.toJSON();return a};Yd.prototype=Object.create(F.prototype);Yd.prototype.constructor= +Yd;Rc.prototype=Object.create(D.prototype);Rc.prototype.constructor=Rc;Zd.prototype=Object.create(F.prototype);Zd.prototype.constructor=Zd;Sc.prototype=Object.create(D.prototype);Sc.prototype.constructor=Sc;var sk={triangulate:function(a,b,c){c=c||2;var d=b&&b.length,e=d?b[0]*c:a.length,f=Kh(a,0,e,c,!0),g=[];if(!f||f.next===f.prev)return g;var h;if(d){var l=c;d=[];var k;var n=0;for(k=b.length;n80*c){var q=h=a[0];var t=d=a[1];for(l=c;lh&&(h=n),b>d&&(d=b);h=Math.max(h-q,d-t);h=0!==h?1/h:0}be(f,g,c,q,t,h);return g}},pb={area:function(a){for(var b=a.length,c=0,d=b-1,e=0;epb.area(a)},triangulateShape:function(a,b){var c=[],d=[],e=[];Oh(a);Ph(c,a);var f=a.length;b.forEach(Oh); +for(a=0;aMath.abs(g-l)?[new v(a,1-c),new v(h,1-d),new v(k,1-e),new v(u,1-b)]:[new v(g,1-c),new v(l,1-d),new v(n,1-e),new v(r,1-b)]}};de.prototype=Object.create(F.prototype); +de.prototype.constructor=de;Uc.prototype=Object.create(eb.prototype);Uc.prototype.constructor=Uc;ee.prototype=Object.create(F.prototype);ee.prototype.constructor=ee;Hb.prototype=Object.create(D.prototype);Hb.prototype.constructor=Hb;fe.prototype=Object.create(F.prototype);fe.prototype.constructor=fe;Vc.prototype=Object.create(D.prototype);Vc.prototype.constructor=Vc;ge.prototype=Object.create(F.prototype);ge.prototype.constructor=ge;Wc.prototype=Object.create(D.prototype);Wc.prototype.constructor= +Wc;gc.prototype=Object.create(F.prototype);gc.prototype.constructor=gc;gc.prototype.toJSON=function(){var a=F.prototype.toJSON.call(this);return Rh(this.parameters.shapes,a)};hc.prototype=Object.create(D.prototype);hc.prototype.constructor=hc;hc.prototype.toJSON=function(){var a=D.prototype.toJSON.call(this);return Rh(this.parameters.shapes,a)};Xc.prototype=Object.create(D.prototype);Xc.prototype.constructor=Xc;ic.prototype=Object.create(F.prototype);ic.prototype.constructor=ic;qb.prototype=Object.create(D.prototype); +qb.prototype.constructor=qb;he.prototype=Object.create(ic.prototype);he.prototype.constructor=he;ie.prototype=Object.create(qb.prototype);ie.prototype.constructor=ie;je.prototype=Object.create(F.prototype);je.prototype.constructor=je;Yc.prototype=Object.create(D.prototype);Yc.prototype.constructor=Yc;var oa=Object.freeze({WireframeGeometry:Mc,ParametricGeometry:Rd,ParametricBufferGeometry:Nc,TetrahedronGeometry:Td,TetrahedronBufferGeometry:Oc,OctahedronGeometry:Ud,OctahedronBufferGeometry:cc,IcosahedronGeometry:Vd, +IcosahedronBufferGeometry:Pc,DodecahedronGeometry:Wd,DodecahedronBufferGeometry:Qc,PolyhedronGeometry:Sd,PolyhedronBufferGeometry:Aa,TubeGeometry:Xd,TubeBufferGeometry:dc,TorusKnotGeometry:Yd,TorusKnotBufferGeometry:Rc,TorusGeometry:Zd,TorusBufferGeometry:Sc,TextGeometry:de,TextBufferGeometry:Uc,SphereGeometry:ee,SphereBufferGeometry:Hb,RingGeometry:fe,RingBufferGeometry:Vc,PlaneGeometry:Fd,PlaneBufferGeometry:Zb,LatheGeometry:ge,LatheBufferGeometry:Wc,ShapeGeometry:gc,ShapeBufferGeometry:hc,ExtrudeGeometry:fc, +ExtrudeBufferGeometry:eb,EdgesGeometry:Xc,ConeGeometry:he,ConeBufferGeometry:ie,CylinderGeometry:ic,CylinderBufferGeometry:qb,CircleGeometry:je,CircleBufferGeometry:Yc,BoxGeometry:Ug,BoxBufferGeometry:Gd});jc.prototype=Object.create(O.prototype);jc.prototype.constructor=jc;jc.prototype.isShadowMaterial=!0;jc.prototype.copy=function(a){O.prototype.copy.call(this,a);this.color.copy(a.color);return this};Zc.prototype=Object.create(la.prototype);Zc.prototype.constructor=Zc;Zc.prototype.isRawShaderMaterial= +!0;fb.prototype=Object.create(O.prototype);fb.prototype.constructor=fb;fb.prototype.isMeshStandardMaterial=!0;fb.prototype.copy=function(a){O.prototype.copy.call(this,a);this.defines={STANDARD:""};this.color.copy(a.color);this.roughness=a.roughness;this.metalness=a.metalness;this.map=a.map;this.lightMap=a.lightMap;this.lightMapIntensity=a.lightMapIntensity;this.aoMap=a.aoMap;this.aoMapIntensity=a.aoMapIntensity;this.emissive.copy(a.emissive);this.emissiveMap=a.emissiveMap;this.emissiveIntensity=a.emissiveIntensity; this.bumpMap=a.bumpMap;this.bumpScale=a.bumpScale;this.normalMap=a.normalMap;this.normalMapType=a.normalMapType;this.normalScale.copy(a.normalScale);this.displacementMap=a.displacementMap;this.displacementScale=a.displacementScale;this.displacementBias=a.displacementBias;this.roughnessMap=a.roughnessMap;this.metalnessMap=a.metalnessMap;this.alphaMap=a.alphaMap;this.envMap=a.envMap;this.envMapIntensity=a.envMapIntensity;this.refractionRatio=a.refractionRatio;this.wireframe=a.wireframe;this.wireframeLinewidth= -a.wireframeLinewidth;this.wireframeLinecap=a.wireframeLinecap;this.wireframeLinejoin=a.wireframeLinejoin;this.skinning=a.skinning;this.morphTargets=a.morphTargets;this.morphNormals=a.morphNormals;return this};jc.prototype=Object.create(fb.prototype);jc.prototype.constructor=jc;jc.prototype.isMeshPhysicalMaterial=!0;jc.prototype.copy=function(a){fb.prototype.copy.call(this,a);this.defines={STANDARD:"",PHYSICAL:""};this.reflectivity=a.reflectivity;this.clearcoat=a.clearcoat;this.clearcoatRoughness= -a.clearcoatRoughness;this.sheen=a.sheen?(this.sheen||new J).copy(a.sheen):null;this.clearcoatNormalMap=a.clearcoatNormalMap;this.clearcoatNormalScale.copy(a.clearcoatNormalScale);this.transparency=a.transparency;return this};Ra.prototype=Object.create(Q.prototype);Ra.prototype.constructor=Ra;Ra.prototype.isMeshPhongMaterial=!0;Ra.prototype.copy=function(a){Q.prototype.copy.call(this,a);this.color.copy(a.color);this.specular.copy(a.specular);this.shininess=a.shininess;this.map=a.map;this.lightMap= +a.wireframeLinewidth;this.wireframeLinecap=a.wireframeLinecap;this.wireframeLinejoin=a.wireframeLinejoin;this.skinning=a.skinning;this.morphTargets=a.morphTargets;this.morphNormals=a.morphNormals;return this};kc.prototype=Object.create(fb.prototype);kc.prototype.constructor=kc;kc.prototype.isMeshPhysicalMaterial=!0;kc.prototype.copy=function(a){fb.prototype.copy.call(this,a);this.defines={STANDARD:"",PHYSICAL:""};this.reflectivity=a.reflectivity;this.clearcoat=a.clearcoat;this.clearcoatRoughness= +a.clearcoatRoughness;this.sheen=a.sheen?(this.sheen||new I).copy(a.sheen):null;this.clearcoatNormalMap=a.clearcoatNormalMap;this.clearcoatNormalScale.copy(a.clearcoatNormalScale);this.transparency=a.transparency;return this};Ra.prototype=Object.create(O.prototype);Ra.prototype.constructor=Ra;Ra.prototype.isMeshPhongMaterial=!0;Ra.prototype.copy=function(a){O.prototype.copy.call(this,a);this.color.copy(a.color);this.specular.copy(a.specular);this.shininess=a.shininess;this.map=a.map;this.lightMap= a.lightMap;this.lightMapIntensity=a.lightMapIntensity;this.aoMap=a.aoMap;this.aoMapIntensity=a.aoMapIntensity;this.emissive.copy(a.emissive);this.emissiveMap=a.emissiveMap;this.emissiveIntensity=a.emissiveIntensity;this.bumpMap=a.bumpMap;this.bumpScale=a.bumpScale;this.normalMap=a.normalMap;this.normalMapType=a.normalMapType;this.normalScale.copy(a.normalScale);this.displacementMap=a.displacementMap;this.displacementScale=a.displacementScale;this.displacementBias=a.displacementBias;this.specularMap= -a.specularMap;this.alphaMap=a.alphaMap;this.envMap=a.envMap;this.combine=a.combine;this.reflectivity=a.reflectivity;this.refractionRatio=a.refractionRatio;this.wireframe=a.wireframe;this.wireframeLinewidth=a.wireframeLinewidth;this.wireframeLinecap=a.wireframeLinecap;this.wireframeLinejoin=a.wireframeLinejoin;this.skinning=a.skinning;this.morphTargets=a.morphTargets;this.morphNormals=a.morphNormals;return this};kc.prototype=Object.create(Ra.prototype);kc.prototype.constructor=kc;kc.prototype.isMeshToonMaterial= -!0;kc.prototype.copy=function(a){Ra.prototype.copy.call(this,a);this.gradientMap=a.gradientMap;return this};lc.prototype=Object.create(Q.prototype);lc.prototype.constructor=lc;lc.prototype.isMeshNormalMaterial=!0;lc.prototype.copy=function(a){Q.prototype.copy.call(this,a);this.bumpMap=a.bumpMap;this.bumpScale=a.bumpScale;this.normalMap=a.normalMap;this.normalMapType=a.normalMapType;this.normalScale.copy(a.normalScale);this.displacementMap=a.displacementMap;this.displacementScale=a.displacementScale; -this.displacementBias=a.displacementBias;this.wireframe=a.wireframe;this.wireframeLinewidth=a.wireframeLinewidth;this.skinning=a.skinning;this.morphTargets=a.morphTargets;this.morphNormals=a.morphNormals;return this};mc.prototype=Object.create(Q.prototype);mc.prototype.constructor=mc;mc.prototype.isMeshLambertMaterial=!0;mc.prototype.copy=function(a){Q.prototype.copy.call(this,a);this.color.copy(a.color);this.map=a.map;this.lightMap=a.lightMap;this.lightMapIntensity=a.lightMapIntensity;this.aoMap= +a.specularMap;this.alphaMap=a.alphaMap;this.envMap=a.envMap;this.combine=a.combine;this.reflectivity=a.reflectivity;this.refractionRatio=a.refractionRatio;this.wireframe=a.wireframe;this.wireframeLinewidth=a.wireframeLinewidth;this.wireframeLinecap=a.wireframeLinecap;this.wireframeLinejoin=a.wireframeLinejoin;this.skinning=a.skinning;this.morphTargets=a.morphTargets;this.morphNormals=a.morphNormals;return this};lc.prototype=Object.create(Ra.prototype);lc.prototype.constructor=lc;lc.prototype.isMeshToonMaterial= +!0;lc.prototype.copy=function(a){Ra.prototype.copy.call(this,a);this.gradientMap=a.gradientMap;return this};mc.prototype=Object.create(O.prototype);mc.prototype.constructor=mc;mc.prototype.isMeshNormalMaterial=!0;mc.prototype.copy=function(a){O.prototype.copy.call(this,a);this.bumpMap=a.bumpMap;this.bumpScale=a.bumpScale;this.normalMap=a.normalMap;this.normalMapType=a.normalMapType;this.normalScale.copy(a.normalScale);this.displacementMap=a.displacementMap;this.displacementScale=a.displacementScale; +this.displacementBias=a.displacementBias;this.wireframe=a.wireframe;this.wireframeLinewidth=a.wireframeLinewidth;this.skinning=a.skinning;this.morphTargets=a.morphTargets;this.morphNormals=a.morphNormals;return this};nc.prototype=Object.create(O.prototype);nc.prototype.constructor=nc;nc.prototype.isMeshLambertMaterial=!0;nc.prototype.copy=function(a){O.prototype.copy.call(this,a);this.color.copy(a.color);this.map=a.map;this.lightMap=a.lightMap;this.lightMapIntensity=a.lightMapIntensity;this.aoMap= a.aoMap;this.aoMapIntensity=a.aoMapIntensity;this.emissive.copy(a.emissive);this.emissiveMap=a.emissiveMap;this.emissiveIntensity=a.emissiveIntensity;this.specularMap=a.specularMap;this.alphaMap=a.alphaMap;this.envMap=a.envMap;this.combine=a.combine;this.reflectivity=a.reflectivity;this.refractionRatio=a.refractionRatio;this.wireframe=a.wireframe;this.wireframeLinewidth=a.wireframeLinewidth;this.wireframeLinecap=a.wireframeLinecap;this.wireframeLinejoin=a.wireframeLinejoin;this.skinning=a.skinning; -this.morphTargets=a.morphTargets;this.morphNormals=a.morphNormals;return this};nc.prototype=Object.create(Q.prototype);nc.prototype.constructor=nc;nc.prototype.isMeshMatcapMaterial=!0;nc.prototype.copy=function(a){Q.prototype.copy.call(this,a);this.defines={MATCAP:""};this.color.copy(a.color);this.matcap=a.matcap;this.map=a.map;this.bumpMap=a.bumpMap;this.bumpScale=a.bumpScale;this.normalMap=a.normalMap;this.normalMapType=a.normalMapType;this.normalScale.copy(a.normalScale);this.displacementMap=a.displacementMap; -this.displacementScale=a.displacementScale;this.displacementBias=a.displacementBias;this.alphaMap=a.alphaMap;this.skinning=a.skinning;this.morphTargets=a.morphTargets;this.morphNormals=a.morphNormals;return this};oc.prototype=Object.create(Y.prototype);oc.prototype.constructor=oc;oc.prototype.isLineDashedMaterial=!0;oc.prototype.copy=function(a){Y.prototype.copy.call(this,a);this.scale=a.scale;this.dashSize=a.dashSize;this.gapSize=a.gapSize;return this};var uk=Object.freeze({ShadowMaterial:ic,SpriteMaterial:Hb, -RawShaderMaterial:Zc,ShaderMaterial:va,PointsMaterial:Qa,MeshPhysicalMaterial:jc,MeshStandardMaterial:fb,MeshPhongMaterial:Ra,MeshToonMaterial:kc,MeshNormalMaterial:lc,MeshLambertMaterial:mc,MeshDepthMaterial:Eb,MeshDistanceMaterial:Fb,MeshBasicMaterial:ya,MeshMatcapMaterial:nc,LineDashedMaterial:oc,LineBasicMaterial:Y,Material:Q}),Z={arraySlice:function(a,b,c){return Z.isTypedArray(a)?new a.constructor(a.subarray(b,void 0!==c?c:a.length)):a.slice(b,c)},convertArray:function(a,b,c){return!a||!c&& +this.morphTargets=a.morphTargets;this.morphNormals=a.morphNormals;return this};oc.prototype=Object.create(O.prototype);oc.prototype.constructor=oc;oc.prototype.isMeshMatcapMaterial=!0;oc.prototype.copy=function(a){O.prototype.copy.call(this,a);this.defines={MATCAP:""};this.color.copy(a.color);this.matcap=a.matcap;this.map=a.map;this.bumpMap=a.bumpMap;this.bumpScale=a.bumpScale;this.normalMap=a.normalMap;this.normalMapType=a.normalMapType;this.normalScale.copy(a.normalScale);this.displacementMap=a.displacementMap; +this.displacementScale=a.displacementScale;this.displacementBias=a.displacementBias;this.alphaMap=a.alphaMap;this.skinning=a.skinning;this.morphTargets=a.morphTargets;this.morphNormals=a.morphNormals;return this};pc.prototype=Object.create(P.prototype);pc.prototype.constructor=pc;pc.prototype.isLineDashedMaterial=!0;pc.prototype.copy=function(a){P.prototype.copy.call(this,a);this.scale=a.scale;this.dashSize=a.dashSize;this.gapSize=a.gapSize;return this};var tk=Object.freeze({ShadowMaterial:jc,SpriteMaterial:Gb, +RawShaderMaterial:Zc,ShaderMaterial:la,PointsMaterial:Qa,MeshPhysicalMaterial:kc,MeshStandardMaterial:fb,MeshPhongMaterial:Ra,MeshToonMaterial:lc,MeshNormalMaterial:mc,MeshLambertMaterial:nc,MeshDepthMaterial:Db,MeshDistanceMaterial:Eb,MeshBasicMaterial:Fa,MeshMatcapMaterial:oc,LineDashedMaterial:pc,LineBasicMaterial:P,Material:O}),ta={arraySlice:function(a,b,c){return ta.isTypedArray(a)?new a.constructor(a.subarray(b,void 0!==c?c:a.length)):a.slice(b,c)},convertArray:function(a,b,c){return!a||!c&& a.constructor===b?a:"number"===typeof b.BYTES_PER_ELEMENT?new b(a):Array.prototype.slice.call(a)},isTypedArray:function(a){return ArrayBuffer.isView(a)&&!(a instanceof DataView)},getKeyframeOrder:function(a){for(var b=a.length,c=Array(b),d=0;d!==b;++d)c[d]=d;c.sort(function(b,c){return a[b]-a[c]});return c},sortedArray:function(a,b,c){for(var d=a.length,e=new a.constructor(d),f=0,g=0;g!==d;++f)for(var h=c[f]*b,l=0;l!==b;++l)e[g++]=a[h+l];return e},flattenJSON:function(a,b,c,d){for(var e=1,f=a[0];void 0!== f&&void 0===f[d];)f=a[e++];if(void 0!==f){var g=f[d];if(void 0!==g)if(Array.isArray(g)){do g=f[d],void 0!==g&&(b.push(f.time),c.push.apply(c,g)),f=a[e++];while(void 0!==f)}else if(void 0!==g.toArray){do g=f[d],void 0!==g&&(b.push(f.time),g.toArray(c,c.length)),f=a[e++];while(void 0!==f)}else{do g=f[d],void 0!==g&&(b.push(f.time),c.push(g)),f=a[e++];while(void 0!==f)}}}};Object.assign(Ha.prototype,{evaluate:function(a){var b=this.parameterPositions,c=this._cachedIndex,d=b[c],e=b[c-1];a:{b:{c:{d:if(!(a< d)){for(var f=c+2;;){if(void 0===d){if(a=e)break a;else{f=b[1];a=e)break b}d=c;c=0}}for(;c>>1,ab;)--f;++f;if(0!==e||f!==d)e>=f&&(f=Math.max(f,1),e=f-1),a=this.getValueSize(),this.times=Z.arraySlice(c,e,f),this.values=Z.arraySlice(this.values,e*a,f*a);return this},validate:function(){var a=!0,b=this.getValueSize();0!==b-Math.floor(b)&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),a=!1);var c=this.times; -b=this.values;var d=c.length;0===d&&(console.error("THREE.KeyframeTrack: Track is empty.",this),a=!1);for(var e=null,f=0;f!==d;f++){var g=c[f];if("number"===typeof g&&isNaN(g)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,f,g);a=!1;break}if(null!==e&&e>g){console.error("THREE.KeyframeTrack: Out of order keys.",this,f,g,e);a=!1;break}e=g}if(void 0!==b&&Z.isTypedArray(b))for(f=0,c=b.length;f!==c;++f)if(d=b[f],isNaN(d)){console.error("THREE.KeyframeTrack: Value is not a valid number.", -this,f,d);a=!1;break}return a},optimize:function(){for(var a=this.times,b=this.values,c=this.getValueSize(),d=2302===this.getInterpolation(),e=1,f=a.length-1,g=1;gg)e=a+1;else if(0b&&(b=0);1Number.EPSILON&&(g.normalize(),c=Math.acos(O.clamp(d[l-1].dot(d[l]),-1,1)),e[l].applyMatrix4(h.makeRotationAxis(g,c))),f[l].crossVectors(d[l], -e[l]);if(!0===b)for(c=Math.acos(O.clamp(e[0].dot(e[a]),-1,1)),c/=a,0d;)d+=c;for(;d>c;)d-=c;de&&(e=1);1E-4>d&&(d=e);1E-4>l&&(l=e);Wg.initNonuniformCatmullRom(f.x,g.x,h.x,c.x,d,e,l);Xg.initNonuniformCatmullRom(f.y,g.y,h.y,c.y,d,e,l);Yg.initNonuniformCatmullRom(f.z,g.z,h.z,c.z,d, -e,l)}else"catmullrom"===this.curveType&&(Wg.initCatmullRom(f.x,g.x,h.x,c.x,this.tension),Xg.initCatmullRom(f.y,g.y,h.y,c.y,this.tension),Yg.initCatmullRom(f.z,g.z,h.z,c.z,this.tension));b.set(Wg.calc(a),Xg.calc(a),Yg.calc(a));return b};sa.prototype.copy=function(a){F.prototype.copy.call(this,a);this.points=[];for(var b=0,c=a.points.length;bc.length-2?c.length-1:a+1];c=c[a>c.length-3?c.length-1:a+2];b.set(Uh(d,e.x,f.x,g.x, -c.x),Uh(d,e.y,f.y,g.y,c.y));return b};Va.prototype.copy=function(a){F.prototype.copy.call(this,a);this.points=[];for(var b=0,c=a.points.length;bb;)--f;++f;if(0!==e||f!==d)e>=f&&(f=Math.max(f,1),e=f-1),a=this.getValueSize(),this.times=ta.arraySlice(c,e,f),this.values=ta.arraySlice(this.values,e*a,f*a);return this},validate:function(){var a=!0,b=this.getValueSize();0!==b-Math.floor(b)&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),a=!1);var c=this.times; +b=this.values;var d=c.length;0===d&&(console.error("THREE.KeyframeTrack: Track is empty.",this),a=!1);for(var e=null,f=0;f!==d;f++){var g=c[f];if("number"===typeof g&&isNaN(g)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,f,g);a=!1;break}if(null!==e&&e>g){console.error("THREE.KeyframeTrack: Out of order keys.",this,f,g,e);a=!1;break}e=g}if(void 0!==b&&ta.isTypedArray(b))for(f=0,c=b.length;f!==c;++f)if(d=b[f],isNaN(d)){console.error("THREE.KeyframeTrack: Value is not a valid number.", +this,f,d);a=!1;break}return a},optimize:function(){for(var a=this.times,b=this.values,c=this.getValueSize(),d=2302===this.getInterpolation(),e=1,f=a.length-1,g=1;gg)e=a+1;else if(0b&&(b=0);1Number.EPSILON&&(g.normalize(),c=Math.acos(N.clamp(d[l-1].dot(d[l]),-1,1)),e[l].applyMatrix4(h.makeRotationAxis(g, +c))),f[l].crossVectors(d[l],e[l]);if(!0===b)for(c=Math.acos(N.clamp(e[0].dot(e[a]),-1,1)),c/=a,0d;)d+=c;for(;d>c;)d-=c;de&&(e=1);1E-4>d&&(d=e);1E-4>l&&(l=e);Xg.initNonuniformCatmullRom(f.x,g.x,h.x,c.x,d,e,l);Yg.initNonuniformCatmullRom(f.y,g.y,h.y,c.y,d,e,l);Zg.initNonuniformCatmullRom(f.z, +g.z,h.z,c.z,d,e,l)}else"catmullrom"===this.curveType&&(Xg.initCatmullRom(f.x,g.x,h.x,c.x,this.tension),Yg.initCatmullRom(f.y,g.y,h.y,c.y,this.tension),Zg.initCatmullRom(f.z,g.z,h.z,c.z,this.tension));b.set(Xg.calc(a),Yg.calc(a),Zg.calc(a));return b};wa.prototype.copy=function(a){C.prototype.copy.call(this,a);this.points=[];for(var b=0,c=a.points.length;bc.length-2?c.length-1:a+1];c=c[a>c.length-3?c.length-1:a+2];b.set(Th(d,e.x,f.x,g.x, +c.x),Th(d,e.y,f.y,g.y,c.y));return b};Va.prototype.copy=function(a){C.prototype.copy.call(this,a);this.points=[];for(var b=0,c=a.points.length;b=b)return b=c[a]-b,a=this.curves[a],c=a.getLength(),a.getPointAt(0===c?0:1-b/c);a++}return null},getLength:function(){var a=this.getCurveLengths();return a[a.length-1]},updateArcLengths:function(){this.needsUpdate=!0;this.cacheLengths=null;this.getCurveLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var a=[], b=0,c=0,d=this.curves.length;cNumber.EPSILON){if(0>k&&(g=b[f],l=-l,h=b[e],k=-k),!(a.yh.y))if(a.y===g.y){if(a.x===g.x)return!0}else{e=k*(a.x-g.x)-l*(a.y-g.y);if(0===e)return!0; -0>e||(d=!d)}}else if(a.y===g.y&&(h.x<=a.x&&a.x<=g.x||g.x<=a.x&&a.x<=h.x))return!0}return d}var e=qb.isClockWise,f=this.subPaths;if(0===f.length)return[];if(!0===b)return c(f);b=[];if(1===f.length){var g=f[0];var h=new Jb;h.curves=g.curves;b.push(h);return b}var l=!e(f[0].getPoints());l=a?!l:l;h=[];var k=[],n=[],u=0;k[u]=void 0;n[u]=[];for(var r=0,q=f.length;rb;b++)this.coefficients[b].copy(a[b]);return this},zero:function(){for(var a=0;9>a;a++)this.coefficients[a].set(0, +0;gNumber.EPSILON){if(0>k&&(g=b[f],l=-l,h=b[e],k=-k),!(a.yh.y))if(a.y===g.y){if(a.x===g.x)return!0}else{e=k*(a.x-g.x)-l*(a.y-g.y);if(0===e)return!0; +0>e||(d=!d)}}else if(a.y===g.y&&(h.x<=a.x&&a.x<=g.x||g.x<=a.x&&a.x<=h.x))return!0}return d}var e=pb.isClockWise,f=this.subPaths;if(0===f.length)return[];if(!0===b)return c(f);b=[];if(1===f.length){var g=f[0];var h=new Ib;h.curves=g.curves;b.push(h);return b}var l=!e(f[0].getPoints());l=a?!l:l;h=[];var k=[],n=[],u=0;k[u]=void 0;n[u]=[];for(var r=0,q=f.length;rb;b++)this.coefficients[b].copy(a[b]);return this},zero:function(){for(var a=0;9>a;a++)this.coefficients[a].set(0, 0,0);return this},getAt:function(a,b){var c=a.x,d=a.y;a=a.z;var e=this.coefficients;b.copy(e[0]).multiplyScalar(.282095);b.addScale(e[1],.488603*d);b.addScale(e[2],.488603*a);b.addScale(e[3],.488603*c);b.addScale(e[4],1.092548*c*d);b.addScale(e[5],1.092548*d*a);b.addScale(e[6],.315392*(3*a*a-1));b.addScale(e[7],1.092548*c*a);b.addScale(e[8],.546274*(c*c-d*d));return b},getIrradianceAt:function(a,b){var c=a.x,d=a.y;a=a.z;var e=this.coefficients;b.copy(e[0]).multiplyScalar(.886227);b.addScale(e[1], 1.023328*d);b.addScale(e[2],1.023328*a);b.addScale(e[3],1.023328*c);b.addScale(e[4],.858086*c*d);b.addScale(e[5],.858086*d*a);b.addScale(e[6],.743125*a*a-.247708);b.addScale(e[7],.858086*c*a);b.addScale(e[8],.429043*(c*c-d*d));return b},add:function(a){for(var b=0;9>b;b++)this.coefficients[b].add(a.coefficients[b]);return this},scale:function(a){for(var b=0;9>b;b++)this.coefficients[b].multiplyScalar(a);return this},lerp:function(a,b){for(var c=0;9>c;c++)this.coefficients[c].lerp(a.coefficients[c], -b);return this},equals:function(a){for(var b=0;9>b;b++)if(!this.coefficients[b].equals(a.coefficients[b]))return!1;return!0},copy:function(a){return this.set(a.coefficients)},clone:function(){return(new this.constructor).copy(this)},fromArray:function(a,b){void 0===b&&(b=0);for(var c=this.coefficients,d=0;9>d;d++)c[d].fromArray(a,b+3*d);return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);for(var c=this.coefficients,d=0;9>d;d++)c[d].toArray(a,b+3*d);return a}});Object.assign(lf, -{getBasisAt:function(a,b){var c=a.x,d=a.y;a=a.z;b[0]=.282095;b[1]=.488603*d;b[2]=.488603*a;b[3]=.488603*c;b[4]=1.092548*c*d;b[5]=1.092548*d*a;b[6]=.315392*(3*a*a-1);b[7]=1.092548*c*a;b[8]=.546274*(c*c-d*d)}});Xa.prototype=Object.assign(Object.create(V.prototype),{constructor:Xa,isLightProbe:!0,copy:function(a){V.prototype.copy.call(this,a);this.sh.copy(a.sh);this.intensity=a.intensity;return this},toJSON:function(a){return V.prototype.toJSON.call(this,a)}});tg.prototype=Object.assign(Object.create(Xa.prototype), -{constructor:tg,isHemisphereLightProbe:!0,copy:function(a){Xa.prototype.copy.call(this,a);return this},toJSON:function(a){return Xa.prototype.toJSON.call(this,a)}});ug.prototype=Object.assign(Object.create(Xa.prototype),{constructor:ug,isAmbientLightProbe:!0,copy:function(a){Xa.prototype.copy.call(this,a);return this},toJSON:function(a){return Xa.prototype.toJSON.call(this,a)}});var yi=new P,zi=new P;Object.assign(Vh.prototype,{update:function(a){var b=this._cache;if(b.focus!==a.focus||b.fov!==a.fov|| -b.aspect!==a.aspect*this.aspect||b.near!==a.near||b.far!==a.far||b.zoom!==a.zoom||b.eyeSep!==this.eyeSep){b.focus=a.focus;b.fov=a.fov;b.aspect=a.aspect*this.aspect;b.near=a.near;b.far=a.far;b.zoom=a.zoom;b.eyeSep=this.eyeSep;var c=a.projectionMatrix.clone(),d=b.eyeSep/2,e=d*b.near/b.focus,f=b.near*Math.tan(O.DEG2RAD*b.fov*.5)/b.zoom;zi.elements[12]=-d;yi.elements[12]=d;d=-f*b.aspect+e;var g=f*b.aspect+e;c.elements[0]=2*b.near/(g-d);c.elements[8]=(g+d)/(g-d);this.cameraL.projectionMatrix.copy(c);d= --f*b.aspect-e;g=f*b.aspect-e;c.elements[0]=2*b.near/(g-d);c.elements[8]=(g+d)/(g-d);this.cameraR.projectionMatrix.copy(c)}this.cameraL.matrixWorld.copy(a.matrixWorld).multiply(zi);this.cameraR.matrixWorld.copy(a.matrixWorld).multiply(yi)}});Object.assign(vg.prototype,{start:function(){this.oldTime=this.startTime=("undefined"===typeof performance?Date:performance).now();this.elapsedTime=0;this.running=!0},stop:function(){this.getElapsedTime();this.autoStart=this.running=!1},getElapsedTime:function(){this.getDelta(); -return this.elapsedTime},getDelta:function(){var a=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){var b=("undefined"===typeof performance?Date:performance).now();a=(b-this.oldTime)/1E3;this.oldTime=b;this.elapsedTime+=a}return a}});var uc=new n,Ai=new na,wk=new n,vc=new n;wg.prototype=Object.assign(Object.create(B.prototype),{constructor:wg,getInput:function(){return this.gain},removeFilter:function(){null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination), +b);return this},equals:function(a){for(var b=0;9>b;b++)if(!this.coefficients[b].equals(a.coefficients[b]))return!1;return!0},copy:function(a){return this.set(a.coefficients)},clone:function(){return(new this.constructor).copy(this)},fromArray:function(a,b){void 0===b&&(b=0);for(var c=this.coefficients,d=0;9>d;d++)c[d].fromArray(a,b+3*d);return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);for(var c=this.coefficients,d=0;9>d;d++)c[d].toArray(a,b+3*d);return a}});Object.assign(kf, +{getBasisAt:function(a,b){var c=a.x,d=a.y;a=a.z;b[0]=.282095;b[1]=.488603*d;b[2]=.488603*a;b[3]=.488603*c;b[4]=1.092548*c*d;b[5]=1.092548*d*a;b[6]=.315392*(3*a*a-1);b[7]=1.092548*c*a;b[8]=.546274*(c*c-d*d)}});Xa.prototype=Object.assign(Object.create(ba.prototype),{constructor:Xa,isLightProbe:!0,copy:function(a){ba.prototype.copy.call(this,a);this.sh.copy(a.sh);this.intensity=a.intensity;return this},toJSON:function(a){return ba.prototype.toJSON.call(this,a)}});tg.prototype=Object.assign(Object.create(Xa.prototype), +{constructor:tg,isHemisphereLightProbe:!0,copy:function(a){Xa.prototype.copy.call(this,a);return this},toJSON:function(a){return Xa.prototype.toJSON.call(this,a)}});ug.prototype=Object.assign(Object.create(Xa.prototype),{constructor:ug,isAmbientLightProbe:!0,copy:function(a){Xa.prototype.copy.call(this,a);return this},toJSON:function(a){return Xa.prototype.toJSON.call(this,a)}});var xi=new W,yi=new W;Object.assign(Uh.prototype,{update:function(a){var b=this._cache;if(b.focus!==a.focus||b.fov!==a.fov|| +b.aspect!==a.aspect*this.aspect||b.near!==a.near||b.far!==a.far||b.zoom!==a.zoom||b.eyeSep!==this.eyeSep){b.focus=a.focus;b.fov=a.fov;b.aspect=a.aspect*this.aspect;b.near=a.near;b.far=a.far;b.zoom=a.zoom;b.eyeSep=this.eyeSep;var c=a.projectionMatrix.clone(),d=b.eyeSep/2,e=d*b.near/b.focus,f=b.near*Math.tan(N.DEG2RAD*b.fov*.5)/b.zoom;yi.elements[12]=-d;xi.elements[12]=d;d=-f*b.aspect+e;var g=f*b.aspect+e;c.elements[0]=2*b.near/(g-d);c.elements[8]=(g+d)/(g-d);this.cameraL.projectionMatrix.copy(c);d= +-f*b.aspect-e;g=f*b.aspect-e;c.elements[0]=2*b.near/(g-d);c.elements[8]=(g+d)/(g-d);this.cameraR.projectionMatrix.copy(c)}this.cameraL.matrixWorld.copy(a.matrixWorld).multiply(yi);this.cameraR.matrixWorld.copy(a.matrixWorld).multiply(xi)}});Object.assign(vg.prototype,{start:function(){this.oldTime=this.startTime=("undefined"===typeof performance?Date:performance).now();this.elapsedTime=0;this.running=!0},stop:function(){this.getElapsedTime();this.autoStart=this.running=!1},getElapsedTime:function(){this.getDelta(); +return this.elapsedTime},getDelta:function(){var a=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){var b=("undefined"===typeof performance?Date:performance).now();a=(b-this.oldTime)/1E3;this.oldTime=b;this.elapsedTime+=a}return a}});var vc=new n,zi=new sa,vk=new n,wc=new n;wg.prototype=Object.assign(Object.create(A.prototype),{constructor:wg,getInput:function(){return this.gain},removeFilter:function(){null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination), this.gain.connect(this.context.destination),this.filter=null);return this},getFilter:function(){return this.filter},setFilter:function(a){null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination);this.filter=a;this.gain.connect(this.filter);this.filter.connect(this.context.destination);return this},getMasterVolume:function(){return this.gain.gain.value},setMasterVolume:function(a){this.gain.gain.setTargetAtTime(a, -this.context.currentTime,.01);return this},updateMatrixWorld:function(a){B.prototype.updateMatrixWorld.call(this,a);a=this.context.listener;var b=this.up;this.timeDelta=this._clock.getDelta();this.matrixWorld.decompose(uc,Ai,wk);vc.set(0,0,-1).applyQuaternion(Ai);if(a.positionX){var c=this.context.currentTime+this.timeDelta;a.positionX.linearRampToValueAtTime(uc.x,c);a.positionY.linearRampToValueAtTime(uc.y,c);a.positionZ.linearRampToValueAtTime(uc.z,c);a.forwardX.linearRampToValueAtTime(vc.x,c); -a.forwardY.linearRampToValueAtTime(vc.y,c);a.forwardZ.linearRampToValueAtTime(vc.z,c);a.upX.linearRampToValueAtTime(b.x,c);a.upY.linearRampToValueAtTime(b.y,c);a.upZ.linearRampToValueAtTime(b.z,c)}else a.setPosition(uc.x,uc.y,uc.z),a.setOrientation(vc.x,vc.y,vc.z,b.x,b.y,b.z)}});dd.prototype=Object.assign(Object.create(B.prototype),{constructor:dd,getOutput:function(){return this.gain},setNodeSource:function(a){this.hasPlaybackControl=!1;this.sourceType="audioNode";this.source=a;this.connect();return this}, +this.context.currentTime,.01);return this},updateMatrixWorld:function(a){A.prototype.updateMatrixWorld.call(this,a);a=this.context.listener;var b=this.up;this.timeDelta=this._clock.getDelta();this.matrixWorld.decompose(vc,zi,vk);wc.set(0,0,-1).applyQuaternion(zi);if(a.positionX){var c=this.context.currentTime+this.timeDelta;a.positionX.linearRampToValueAtTime(vc.x,c);a.positionY.linearRampToValueAtTime(vc.y,c);a.positionZ.linearRampToValueAtTime(vc.z,c);a.forwardX.linearRampToValueAtTime(wc.x,c); +a.forwardY.linearRampToValueAtTime(wc.y,c);a.forwardZ.linearRampToValueAtTime(wc.z,c);a.upX.linearRampToValueAtTime(b.x,c);a.upY.linearRampToValueAtTime(b.y,c);a.upZ.linearRampToValueAtTime(b.z,c)}else a.setPosition(vc.x,vc.y,vc.z),a.setOrientation(wc.x,wc.y,wc.z,b.x,b.y,b.z)}});dd.prototype=Object.assign(Object.create(A.prototype),{constructor:dd,getOutput:function(){return this.gain},setNodeSource:function(a){this.hasPlaybackControl=!1;this.sourceType="audioNode";this.source=a;this.connect();return this}, setMediaElementSource:function(a){this.hasPlaybackControl=!1;this.sourceType="mediaNode";this.source=this.context.createMediaElementSource(a);this.connect();return this},setBuffer:function(a){this.buffer=a;this.sourceType="buffer";this.autoplay&&this.play();return this},play:function(){if(!0===this.isPlaying)console.warn("THREE.Audio: Audio is already playing.");else if(!1===this.hasPlaybackControl)console.warn("THREE.Audio: this Audio has no playback control.");else{var a=this.context.createBufferSource(); a.buffer=this.buffer;a.loop=this.loop;a.onended=this.onEnded.bind(this);this.startTime=this.context.currentTime;a.start(this.startTime,this.offset,this.duration);this.isPlaying=!0;this.source=a;this.setDetune(this.detune);this.setPlaybackRate(this.playbackRate);return this.connect()}},pause:function(){if(!1===this.hasPlaybackControl)console.warn("THREE.Audio: this Audio has no playback control.");else return!0===this.isPlaying&&(this.source.stop(),this.source.onended=null,this.offset+=(this.context.currentTime- this.startTime)*this.playbackRate,this.isPlaying=!1),this},stop:function(){if(!1===this.hasPlaybackControl)console.warn("THREE.Audio: this Audio has no playback control.");else return this.source.stop(),this.source.onended=null,this.offset=0,this.isPlaying=!1,this},connect:function(){if(0d&&this._mixBufferRegion(c,a,3*b,1-d,b);d=b;for(var f=b+b;d!==f;++d)if(c[d]!==c[d+b]){e.setValue(c,a);break}},saveOriginalState:function(){var a=this.buffer,b=this.valueSize,c=3*b;this.binding.getValue(a,c);for(var d=b;d!==c;++d)a[d]=a[c+d%b];this.cumulativeWeight=0},restoreOriginalState:function(){this.binding.setValue(this.buffer,3*this.valueSize)},_select:function(a,b,c,d,e){if(.5<=d)for(d= -0;d!==e;++d)a[b+d]=a[c+d]},_slerp:function(a,b,c,d){na.slerpFlat(a,b,a,b,a,c,d)},_lerp:function(a,b,c,d,e){for(var f=1-d,g=0;g!==e;++g){var h=b+g;a[h]=a[h]*f+a[c+g]*d}}});var yk=/[\[\]\.:\/]/g,zk="[^"+"\\[\\]\\.:\\/".replace("\\.","")+"]",Ak=/((?:WC+[\/:])*)/.source.replace("WC","[^\\[\\]\\.:\\/]"),Bk=/(WCOD+)?/.source.replace("WCOD",zk),Ck=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC","[^\\[\\]\\.:\\/]"),Dk=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC","[^\\[\\]\\.:\\/]"),Ek=new RegExp("^"+Ak+Bk+ -Ck+Dk+"$"),Fk=["material","materials","bones"];Object.assign(Wh.prototype,{getValue:function(a,b){this.bind();var c=this._bindings[this._targetGroup.nCachedObjects_];void 0!==c&&c.getValue(a,b)},setValue:function(a,b){for(var c=this._bindings,d=this._targetGroup.nCachedObjects_,e=c.length;d!==e;++d)c[d].setValue(a,b)},bind:function(){for(var a=this._bindings,b=this._targetGroup.nCachedObjects_,c=a.length;b!==c;++b)a[b].bind()},unbind:function(){for(var a=this._bindings,b=this._targetGroup.nCachedObjects_, -c=a.length;b!==c;++b)a[b].unbind()}});Object.assign(ma,{Composite:Wh,create:function(a,b,c){return a&&a.isAnimationObjectGroup?new ma.Composite(a,b,c):new ma(a,b,c)},sanitizeNodeName:function(a){return a.replace(/\s/g,"_").replace(yk,"")},parseTrackName:function(a){var b=Ek.exec(a);if(!b)throw Error("PropertyBinding: Cannot parse trackName: "+a);b={nodeName:b[2],objectName:b[3],objectIndex:b[4],propertyName:b[5],propertyIndex:b[6]};var c=b.nodeName&&b.nodeName.lastIndexOf(".");if(void 0!==c&&-1!== -c){var d=b.nodeName.substring(c+1);-1!==Fk.indexOf(d)&&(b.nodeName=b.nodeName.substring(0,c),b.objectName=d)}if(null===b.propertyName||0===b.propertyName.length)throw Error("PropertyBinding: can not parse propertyName from trackName: "+a);return b},findNode:function(a,b){if(!b||""===b||"root"===b||"."===b||-1===b||b===a.name||b===a.uuid)return a;if(a.skeleton){var c=a.skeleton.getBoneByName(b);if(void 0!==c)return c}if(a.children){var d=function(a){for(var c=0;c=b){var n=b++,u=a[n];c[u.uuid]=m;a[m]=u;c[k]=n;a[n]=h;h=0;for(k=e;h!==k;++h){u=d[h];var r=u[m];u[m]=u[n];u[n]=r}}}this.nCachedObjects_=b},uncache:function(){for(var a=this._objects,b=a.length,c=this.nCachedObjects_,d=this._indicesByUUID,e=this._bindings,f=e.length,g=0,h=arguments.length;g!==h;++g){var k=arguments[g].uuid,m=d[k];if(void 0!==m)if(delete d[k],mc.parameterPositions[1]&&(this.stopWarping(),0===b?this.paused=!0:this.timeScale=b)}}return this._effectiveTimeScale=b},_updateTime:function(a){var b=this.time+a,c=this._clip.duration,d=this.loop,e=this._loopCount,f=2202===d;if(0===a)return-1===e?b:f&&1===(e&1)?c-b:b;if(2200===d)a:{if(-1===e&&(this._loopCount=0,this._setEndings(!0,!0,!1)),b>=c)b=c;else if(0>b)b=0;else{this.time=b;break a}this.clampWhenFinished?this.paused=!0:this.enabled=!1;this.time=b;this._mixer.dispatchEvent({type:"finished", action:this,direction:0>a?-1:1})}else{-1===e&&(0<=a?(e=0,this._setEndings(!0,0===this.repetitions,f)):this._setEndings(0===this.repetitions,!0,f));if(b>=c||0>b){d=Math.floor(b/c);b-=c*d;e+=Math.abs(d);var g=this.repetitions-e;0>=g?(this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=b=0a,this._setEndings(a,!a,f)):this._setEndings(!1,!1,f),this._loopCount=e,this.time=b,this._mixer.dispatchEvent({type:"loop", action:this,loopDelta:d}))}else this.time=b;if(f&&1===(e&1))return c-b}return b},_setEndings:function(a,b,c){var d=this._interpolantSettings;c?(d.endingStart=2401,d.endingEnd=2401):(d.endingStart=a?this.zeroSlopeAtStart?2401:2400:2402,d.endingEnd=b?this.zeroSlopeAtEnd?2401:2400:2402)},_scheduleFading:function(a,b,c){var d=this._mixer,e=d.time,f=this._weightInterpolant;null===f&&(this._weightInterpolant=f=d._lendControlInterpolant());d=f.parameterPositions;f=f.sampleValues;d[0]=e;f[0]=b;d[1]=e+a;f[1]= -c;return this}});Bg.prototype=Object.assign(Object.create(xa.prototype),{constructor:Bg,_bindAction:function(a,b){var c=a._localRoot||this._root,d=a._clip.tracks,e=d.length,f=a._propertyBindings;a=a._interpolants;var g=c.uuid,h=this._bindingsByRootAndName,k=h[g];void 0===k&&(k={},h[g]=k);for(h=0;h!==e;++h){var m=d[h],n=m.name,u=k[n];if(void 0===u){u=f[h];if(void 0!==u){null===u._cacheIndex&&(++u.referenceCount,this._addInactiveBinding(u,g,n));continue}u=new Ag(ma.create(c,n,b&&b._propertyBindings[h].binding.parsedPath), +c;return this}});Bg.prototype=Object.assign(Object.create(za.prototype),{constructor:Bg,_bindAction:function(a,b){var c=a._localRoot||this._root,d=a._clip.tracks,e=d.length,f=a._propertyBindings;a=a._interpolants;var g=c.uuid,h=this._bindingsByRootAndName,k=h[g];void 0===k&&(k={},h[g]=k);for(h=0;h!==e;++h){var m=d[h],n=m.name,u=k[n];if(void 0===u){u=f[h];if(void 0!==u){null===u._cacheIndex&&(++u.referenceCount,this._addInactiveBinding(u,g,n));continue}u=new Ag(ya.create(c,n,b&&b._propertyBindings[h].binding.parsedPath), m.ValueTypeName,m.getValueSize());++u.referenceCount;this._addInactiveBinding(u,g,n)}f[h]=u;a[h].resultBuffer=u.buffer}},_activateAction:function(a){if(!this._isActiveAction(a)){if(null===a._cacheIndex){var b=(a._localRoot||this._root).uuid,c=a._clip.uuid,d=this._actionsByClip[c];this._bindAction(a,d&&d.knownActions[0]);this._addInactiveAction(a,c,b)}b=a._propertyBindings;c=0;for(d=b.length;c!==d;++c){var e=b[c];0===e.useCount++&&(this._lendBinding(e),e.saveOriginalState())}this._lendAction(a)}}, _deactivateAction:function(a){if(this._isActiveAction(a)){for(var b=a._propertyBindings,c=0,d=b.length;c!==d;++c){var e=b[c];0===--e.useCount&&(e.restoreOriginalState(),this._takeBackBinding(e))}this._takeBackAction(a)}},_initMemoryManager:function(){this._actions=[];this._nActiveActions=0;this._actionsByClip={};this._bindings=[];this._nActiveBindings=0;this._bindingsByRootAndName={};this._controlInterpolants=[];this._nActiveControlInterpolants=0;var a=this;this.stats={actions:{get total(){return a._actions.length}, get inUse(){return a._nActiveActions}},bindings:{get total(){return a._bindings.length},get inUse(){return a._nActiveBindings}},controlInterpolants:{get total(){return a._controlInterpolants.length},get inUse(){return a._nActiveControlInterpolants}}}},_isActiveAction:function(a){a=a._cacheIndex;return null!==a&&athis.max.x||a.ythis.max.y?!1:!0},containsBox:function(a){return this.min.x<=a.min.x&&a.max.x<=this.max.x&&this.min.y<=a.min.y&&a.max.y<=this.max.y},getParameter:function(a,b){void 0===b&&(console.warn("THREE.Box2: .getParameter() target is now required"), -b=new v);return b.set((a.x-this.min.x)/(this.max.x-this.min.x),(a.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(a){return a.max.xthis.max.x||a.max.ythis.max.y?!1:!0},clampPoint:function(a,b){void 0===b&&(console.warn("THREE.Box2: .clampPoint() target is now required"),b=new v);return b.copy(a).clamp(this.min,this.max)},distanceToPoint:function(a){return Ci.copy(a).clamp(this.min,this.max).sub(a).length()},intersect:function(a){this.min.max(a.min); -this.max.min(a.max);return this},union:function(a){this.min.min(a.min);this.max.max(a.max);return this},translate:function(a){this.min.add(a);this.max.add(a);return this},equals:function(a){return a.min.equals(this.min)&&a.max.equals(this.max)}});var Di=new n,Kf=new n;Object.assign(Fg.prototype,{set:function(a,b){this.start.copy(a);this.end.copy(b);return this},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.start.copy(a.start);this.end.copy(a.end);return this},getCenter:function(a){void 0=== +b=new v);return b.set((a.x-this.min.x)/(this.max.x-this.min.x),(a.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(a){return a.max.xthis.max.x||a.max.ythis.max.y?!1:!0},clampPoint:function(a,b){void 0===b&&(console.warn("THREE.Box2: .clampPoint() target is now required"),b=new v);return b.copy(a).clamp(this.min,this.max)},distanceToPoint:function(a){return Bi.copy(a).clamp(this.min,this.max).sub(a).length()},intersect:function(a){this.min.max(a.min); +this.max.min(a.max);return this},union:function(a){this.min.min(a.min);this.max.max(a.max);return this},translate:function(a){this.min.add(a);this.max.add(a);return this},equals:function(a){return a.min.equals(this.min)&&a.max.equals(this.max)}});var Ci=new n,Jf=new n;Object.assign(Fg.prototype,{set:function(a,b){this.start.copy(a);this.end.copy(b);return this},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.start.copy(a.start);this.end.copy(a.end);return this},getCenter:function(a){void 0=== a&&(console.warn("THREE.Line3: .getCenter() target is now required"),a=new n);return a.addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(a){void 0===a&&(console.warn("THREE.Line3: .delta() target is now required"),a=new n);return a.subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(a,b){void 0===b&&(console.warn("THREE.Line3: .at() target is now required"),b= -new n);return this.delta(b).multiplyScalar(a).add(this.start)},closestPointToPointParameter:function(a,b){Di.subVectors(a,this.start);Kf.subVectors(this.end,this.start);a=Kf.dot(Kf);a=Kf.dot(Di)/a;b&&(a=O.clamp(a,0,1));return a},closestPointToPoint:function(a,b,c){a=this.closestPointToPointParameter(a,b);void 0===c&&(console.warn("THREE.Line3: .closestPointToPoint() target is now required"),c=new n);return this.delta(c).multiplyScalar(a).add(this.start)},applyMatrix4:function(a){this.start.applyMatrix4(a); -this.end.applyMatrix4(a);return this},equals:function(a){return a.start.equals(this.start)&&a.end.equals(this.end)}});oe.prototype=Object.create(B.prototype);oe.prototype.constructor=oe;oe.prototype.isImmediateRenderObject=!0;var mb=new n,Ab=new n,bh=new ta,Gk=["a","b","c"];pe.prototype=Object.create(R.prototype);pe.prototype.constructor=pe;pe.prototype.update=function(){this.object.updateMatrixWorld(!0);bh.getNormalMatrix(this.object.matrixWorld);var a=this.object.matrixWorld,b=this.geometry.attributes.position, -c=this.object.geometry;if(c&&c.isGeometry)for(var d=c.vertices,e=c.faces,f=c=0,g=e.length;f -Math.abs(b)&&(b=1E-8);this.scale.set(.5*this.size,.5*this.size,b);this.children[0].material.side=0>b?1:0;this.lookAt(this.plane.normal);B.prototype.updateMatrixWorld.call(this,a)};var Ki=new n,qf,Gg;ub.prototype=Object.create(B.prototype);ub.prototype.constructor=ub;ub.prototype.setDirection=function(a){.99999a.y?this.quaternion.set(1,0,0,0):(Ki.set(a.z,0,-a.x).normalize(),this.quaternion.setFromAxisAngle(Ki,Math.acos(a.y)))};ub.prototype.setLength=function(a, -b,c){void 0===b&&(b=.2*a);void 0===c&&(c=.2*b);this.line.scale.set(1,Math.max(0,a-b),1);this.line.updateMatrix();this.cone.scale.set(c,b,c);this.cone.position.y=a;this.cone.updateMatrix()};ub.prototype.setColor=function(a){this.line.material.color.set(a);this.cone.material.color.set(a)};ub.prototype.copy=function(a){B.prototype.copy.call(this,a,!1);this.line.copy(a.line);this.cone.copy(a.cone);return this};ub.prototype.clone=function(){return(new this.constructor).copy(this)};ue.prototype=Object.create(R.prototype); -ue.prototype.constructor=ue;F.create=function(a,b){console.log("THREE.Curve.create() has been deprecated");a.prototype=Object.create(F.prototype);a.prototype.constructor=a;a.prototype.getPoint=b;return a};Object.assign(sb.prototype,{createPointsGeometry:function(a){console.warn("THREE.CurvePath: .createPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");a=this.getPoints(a);return this.createGeometry(a)},createSpacedPointsGeometry:function(a){console.warn("THREE.CurvePath: .createSpacedPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead."); -a=this.getSpacedPoints(a);return this.createGeometry(a)},createGeometry:function(a){console.warn("THREE.CurvePath: .createGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");for(var b=new G,c=0,d=a.length;c +Math.abs(b)&&(b=1E-8);this.scale.set(.5*this.size,.5*this.size,b);this.children[0].material.side=0>b?1:0;this.lookAt(this.plane.normal);A.prototype.updateMatrixWorld.call(this,a)};var Ji=new n,pf,Gg;tb.prototype=Object.create(A.prototype);tb.prototype.constructor=tb;tb.prototype.setDirection=function(a){.99999a.y?this.quaternion.set(1,0,0,0):(Ji.set(a.z,0,-a.x).normalize(),this.quaternion.setFromAxisAngle(Ji,Math.acos(a.y)))};tb.prototype.setLength=function(a, +b,c){void 0===b&&(b=.2*a);void 0===c&&(c=.2*b);this.line.scale.set(1,Math.max(0,a-b),1);this.line.updateMatrix();this.cone.scale.set(c,b,c);this.cone.position.y=a;this.cone.updateMatrix()};tb.prototype.setColor=function(a){this.line.material.color.set(a);this.cone.material.color.set(a)};tb.prototype.copy=function(a){A.prototype.copy.call(this,a,!1);this.line.copy(a.line);this.cone.copy(a.cone);return this};tb.prototype.clone=function(){return(new this.constructor).copy(this)};ve.prototype=Object.create(aa.prototype); +ve.prototype.constructor=ve;C.create=function(a,b){console.log("THREE.Curve.create() has been deprecated");a.prototype=Object.create(C.prototype);a.prototype.constructor=a;a.prototype.getPoint=b;return a};Object.assign(rb.prototype,{createPointsGeometry:function(a){console.warn("THREE.CurvePath: .createPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");a=this.getPoints(a);return this.createGeometry(a)},createSpacedPointsGeometry:function(a){console.warn("THREE.CurvePath: .createSpacedPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead."); +a=this.getSpacedPoints(a);return this.createGeometry(a)},createGeometry:function(a){console.warn("THREE.CurvePath: .createGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");for(var b=new F,c=0,d=a.length;c 0 ? 1 : - 1; - vector[ u ] = 0; - vector[ v ] = 0; - vector[ w ] = depth > 0 ? 1 : - 1; + // now apply vector to normal buffer - // now apply vector to normal buffer + normals.push( vector.x, vector.y, vector.z ); - normals.push( vector.x, vector.y, vector.z ); + // uvs - // uvs + uvs.push( ix / gridX ); + uvs.push( 1 - ( iy / gridY ) ); - uvs.push( ix / gridX ); - uvs.push( 1 - ( iy / gridY ) ); + // counters - // counters + vertexCounter += 1; - vertexCounter += 1; + } } - } + // indices - // indices + // 1. you need three indices to draw a single face + // 2. a single segment consists of two faces + // 3. so we need to generate six (2*3) indices per segment - // 1. you need three indices to draw a single face - // 2. a single segment consists of two faces - // 3. so we need to generate six (2*3) indices per segment + for ( iy = 0; iy < gridY; iy ++ ) { - for ( iy = 0; iy < gridY; iy ++ ) { + for ( ix = 0; ix < gridX; ix ++ ) { - for ( ix = 0; ix < gridX; ix ++ ) { + var a = numberOfVertices + ix + gridX1 * iy; + var b = numberOfVertices + ix + gridX1 * ( iy + 1 ); + var c = numberOfVertices + ( ix + 1 ) + gridX1 * ( iy + 1 ); + var d = numberOfVertices + ( ix + 1 ) + gridX1 * iy; - var a = numberOfVertices + ix + gridX1 * iy; - var b = numberOfVertices + ix + gridX1 * ( iy + 1 ); - var c = numberOfVertices + ( ix + 1 ) + gridX1 * ( iy + 1 ); - var d = numberOfVertices + ( ix + 1 ) + gridX1 * iy; + // faces - // faces + indices.push( a, b, d ); + indices.push( b, c, d ); - indices.push( a, b, d ); - indices.push( b, c, d ); + // increase counter - // increase counter + groupCount += 6; - groupCount += 6; + } } - } + // add a group to the geometry. this will ensure multi material support - // add a group to the geometry. this will ensure multi material support + scope.addGroup( groupStart, groupCount, materialIndex ); - scope.addGroup( groupStart, groupCount, materialIndex ); + // calculate new start value for groups - // calculate new start value for groups + groupStart += groupCount; - groupStart += groupCount; + // update total number of vertices - // update total number of vertices + numberOfVertices += vertexCounter; - numberOfVertices += vertexCounter; + } } } -BoxBufferGeometry.prototype = Object.create( BufferGeometry.prototype ); -BoxBufferGeometry.prototype.constructor = BoxBufferGeometry; - /** * Uniform Utilities */ From b78d665d1d62dea1ea7a940ffe8289052a005d1e Mon Sep 17 00:00:00 2001 From: "Mr.doob" Date: Tue, 3 Sep 2019 15:53:08 -0700 Subject: [PATCH 43/75] Removed unneeded example. --- examples/webgl_shadowmap_receiveshadow.html | 88 --------------------- 1 file changed, 88 deletions(-) delete mode 100644 examples/webgl_shadowmap_receiveshadow.html diff --git a/examples/webgl_shadowmap_receiveshadow.html b/examples/webgl_shadowmap_receiveshadow.html deleted file mode 100644 index f00bf405aa9ed1..00000000000000 --- a/examples/webgl_shadowmap_receiveshadow.html +++ /dev/null @@ -1,88 +0,0 @@ - - - - three.js webgl - shadow map - per-object receive shadow - - - - - - - - - - From b2a8c146996f993c1dcbc4a67bf1170839b634d3 Mon Sep 17 00:00:00 2001 From: "Mr.doob" Date: Tue, 3 Sep 2019 15:53:33 -0700 Subject: [PATCH 44/75] Updated builds. --- build/three.js | 13 +- build/three.min.js | 330 +++++++++++++++++++++--------------------- build/three.module.js | 13 +- 3 files changed, 185 insertions(+), 171 deletions(-) diff --git a/build/three.js b/build/three.js index 48e648fc828925..ca8962bf185204 100644 --- a/build/three.js +++ b/build/three.js @@ -14086,7 +14086,7 @@ var lights_lambert_vertex = "vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\nvIndirectFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n\tvIndirectBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\n#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n#endif"; - var lights_pars_begin = "uniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in GeometricContext geometry ) {\n\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t\tfloat shadowCameraNear;\n\t\tfloat shadowCameraFar;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tdirectLight.color = pointLight.color;\n\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\tdirectLight.visible = ( directLight.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( angleCos > spotLight.coneCos ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif"; + var lights_pars_begin = "uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in GeometricContext geometry ) {\n\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t\tfloat shadowCameraNear;\n\t\tfloat shadowCameraFar;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tdirectLight.color = pointLight.color;\n\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\tdirectLight.visible = ( directLight.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( angleCos > spotLight.coneCos ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif"; var envmap_physical_pars_fragment = "#if defined( USE_ENVMAP )\n\t#ifdef ENVMAP_MODE_REFRACTION\n\t\tuniform float refractionRatio;\n\t#endif\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, queryVec, 1.0 );\n\t\t#else\n\t\t\tvec4 envMapColor = vec4( 0.0 );\n\t\t#endif\n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t}\n\tfloat getSpecularMIPLevel( const in float roughness, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat sigma = PI * roughness * roughness / ( 1.0 + roughness );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar + log2( sigma );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t vec3 reflectVec = reflect( -viewDir, normal );\n\t\t reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t#else\n\t\t vec3 reflectVec = refract( -viewDir, normal, refractionRatio );\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( roughness, maxMIPLevel );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, queryReflectVec, roughness );\n\t\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\t\tvec2 sampleUV;\n\t\t\tsampleUV.y = asin( clamp( reflectVec.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\t\t\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0,0.0,1.0 ) );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif"; @@ -14098,7 +14098,7 @@ var lights_physical_pars_fragment = "struct PhysicalMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n#ifdef CLEARCOAT\n\tfloat clearcoat;\n\tfloat clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tvec3 sheenColor;\n#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearcoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.specularRoughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNL = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = ccDotNL * directLight.color;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tccIrradiance *= PI;\n\t\t#endif\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t\treflectedLight.directSpecular += ccIrradiance * material.clearcoat * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_Sheen(\n\t\t\tmaterial.specularRoughness,\n\t\t\tdirectLight.direction,\n\t\t\tgeometry,\n\t\t\tmaterial.sheenColor\n\t\t);\n\t#else\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.normal, material.specularColor, material.specularRoughness);\n\t#endif\n\treflectedLight.directDiffuse += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNV = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular += clearcoatRadiance * material.clearcoat * BRDF_Specular_GGX_Environment( geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t\tfloat ccDotNL = ccDotNV;\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\tfloat clearcoatInv = 1.0 - clearcoatDHR;\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\tBRDF_Specular_Multiscattering_Environment( geometry, material.specularColor, material.specularRoughness, singleScattering, multiScattering );\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\n\treflectedLight.indirectSpecular += clearcoatInv * radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}"; - var lights_fragment_begin = "\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = normalize( vViewPosition );\n#ifdef CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tdirectLight.color *= all( bvec2( pointLight.shadow, directLight.visible ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tdirectLight.color *= all( bvec2( spotLight.shadow, directLight.visible ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectLight.color *= all( bvec2( directionalLight.shadow, directLight.visible ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif"; + var lights_fragment_begin = "\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = normalize( vViewPosition );\n#ifdef CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tdirectLight.color *= all( bvec3( pointLight.shadow, directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tdirectLight.color *= all( bvec3( spotLight.shadow, directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectLight.color *= all( bvec3( directionalLight.shadow, directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif"; var lights_fragment_maps = "#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec3 lightMapIrradiance = texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getLightProbeIndirectIrradiance( geometry, maxMipLevel );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.normal, material.specularRoughness, maxMipLevel );\n\t#ifdef CLEARCOAT\n\t\tclearcoatRadiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness, maxMipLevel );\n\t#endif\n#endif"; @@ -18239,7 +18239,7 @@ dithering: material.dithering, - shadowMapEnabled: renderer.shadowMap.enabled && object.receiveShadow && shadows.length > 0, + shadowMapEnabled: renderer.shadowMap.enabled && shadows.length > 0, shadowMapType: renderer.shadowMap.type, toneMapping: material.toneMapped ? renderer.toneMapping : NoToneMapping, @@ -24640,6 +24640,13 @@ } + if ( refreshMaterial || materialProperties.receiveShadow !== object.receiveShadow ) { + + materialProperties.receiveShadow = object.receiveShadow; + p_uniforms.setValue( _gl, 'receiveShadow', object.receiveShadow ); + + } + if ( refreshMaterial ) { p_uniforms.setValue( _gl, 'toneMappingExposure', _this.toneMappingExposure ); diff --git a/build/three.min.js b/build/three.min.js index 9fcc73ca207046..514056ee294017 100644 --- a/build/three.min.js +++ b/build/three.min.js @@ -15,7 +15,7 @@ b;this.count=void 0!==a?a.length/b:0;this.normalized=!0===c;this.dynamic=!1;this b,c)}function B(a,b,c){L.call(this,new Float32Array(a),b,c)}function Cd(a,b,c){L.call(this,new Float64Array(a),b,c)}function eh(){this.vertices=[];this.normals=[];this.colors=[];this.uvs=[];this.uvs2=[];this.groups=[];this.morphTargets={};this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.groupsNeedUpdate=this.uvsNeedUpdate=this.colorsNeedUpdate=this.normalsNeedUpdate=this.verticesNeedUpdate=!1}function fh(a){if(0===a.length)return-Infinity;for(var b=a[0],c=1,d= a.length;cb&&(b=a[c]);return b}function D(){Object.defineProperty(this,"id",{value:Ni+=2});this.uuid=N.generateUUID();this.name="";this.type="BufferGeometry";this.index=null;this.attributes={};this.morphAttributes={};this.groups=[];this.boundingSphere=this.boundingBox=null;this.drawRange={start:0,count:Infinity};this.userData={}}function ia(a,b){A.call(this);this.type="Mesh";this.geometry=void 0!==a?a:new D;this.material=void 0!==b?b:new Fa({color:16777215*Math.random()});this.drawMode= 0;this.updateMorphTargets()}function gh(a,b,c,d,e,f,g,h){if(null===(1===b.side?d.intersectTriangle(g,f,e,!0,h):d.intersectTriangle(e,f,g,2!==b.side,h)))return null;Ee.copy(h);Ee.applyMatrix4(a.matrixWorld);b=c.ray.origin.distanceTo(Ee);return bc.far?null:{distance:b,point:Ee.clone(),object:a}}function Fe(a,b,c,d,e,f,g,h,l,m,p){Ub.fromBufferAttribute(e,l);Vb.fromBufferAttribute(e,m);Wb.fromBufferAttribute(e,p);e=a.morphTargetInfluences;if(b.morphTargets&&f&&e){Uf.set(0,0,0);Vf.set(0,0,0); -Wf.set(0,0,0);for(var u=0,r=f.length;u/gm,function(a,c){a=M[c];if(void 0===a)throw Error("Can not resolve #include <"+c+">");return Zf(a)})}function zh(a){return a.replace(/#pragma unroll_loop[\s]+?for \( int i = (\d+); i < (\d+); i \+\+ \) \{([\s\S]+?)(?=\})\}/g, -function(a,c,d,e){a="";for(c=parseInt(c);cc;c++)b.probe.push(new n);var d=new n,e=new W,f=new W;return{setup:function(c,h,l){for(var g=0,p=0,u=0,k=0;9>k;k++)b.probe[k].set(0,0,0);var q=h=0,t=0,z=0,n=0,y=0,x=0,U=0;l=l.matrixWorldInverse;c.sort(Tj);k=0;for(var R=c.length;kc;c++)b.probe.push(new n);var d=new n,e=new W,f=new W;return{setup:function(c,h,l){for(var g=0,p=0,u=0,k=0;9>k;k++)b.probe[k].set(0,0,0);var r=h=0,t=0,z=0,n=0,y=0,x=0,U=0;l=l.matrixWorldInverse;c.sort(Tj);k=0;for(var R=c.length;kCa;Ca++)b.probe[Ca].addScaledVector(E.sh.coefficients[Ca],v);else if(E.isDirectionalLight){var H=a.get(E);H.color.copy(E.color).multiplyScalar(E.intensity);H.direction.setFromMatrixPosition(E.matrixWorld);d.setFromMatrixPosition(E.target.matrixWorld);H.direction.sub(d);H.direction.transformDirection(l);if(H.shadow=E.castShadow)v=E.shadow,H.shadowBias=v.bias,H.shadowRadius=v.radius,H.shadowMapSize=v.mapSize,b.directionalShadowMap[h]=Ca,b.directionalShadowMatrix[h]= E.shadow.matrix,y++;b.directional[h]=H;h++}else if(E.isSpotLight){H=a.get(E);H.position.setFromMatrixPosition(E.matrixWorld);H.position.applyMatrix4(l);H.color.copy(Cb).multiplyScalar(v);H.distance=B;H.direction.setFromMatrixPosition(E.matrixWorld);d.setFromMatrixPosition(E.target.matrixWorld);H.direction.sub(d);H.direction.transformDirection(l);H.coneCos=Math.cos(E.angle);H.penumbraCos=Math.cos(E.angle*(1-E.penumbra));H.decay=E.decay;if(H.shadow=E.castShadow)v=E.shadow,H.shadowBias=v.bias,H.shadowRadius= v.radius,H.shadowMapSize=v.mapSize,b.spotShadowMap[t]=Ca,b.spotShadowMatrix[t]=E.shadow.matrix,U++;b.spot[t]=H;t++}else if(E.isRectAreaLight)H=a.get(E),H.color.copy(Cb).multiplyScalar(v),H.position.setFromMatrixPosition(E.matrixWorld),H.position.applyMatrix4(l),f.identity(),e.copy(E.matrixWorld),e.premultiply(l),f.extractRotation(e),H.halfWidth.set(.5*E.width,0,0),H.halfHeight.set(0,.5*E.height,0),H.halfWidth.applyMatrix4(f),H.halfHeight.applyMatrix4(f),b.rectArea[z]=H,z++;else if(E.isPointLight){H= -a.get(E);H.position.setFromMatrixPosition(E.matrixWorld);H.position.applyMatrix4(l);H.color.copy(E.color).multiplyScalar(E.intensity);H.distance=E.distance;H.decay=E.decay;if(H.shadow=E.castShadow)v=E.shadow,H.shadowBias=v.bias,H.shadowRadius=v.radius,H.shadowMapSize=v.mapSize,H.shadowCameraNear=v.camera.near,H.shadowCameraFar=v.camera.far,b.pointShadowMap[q]=Ca,b.pointShadowMatrix[q]=E.shadow.matrix,x++;b.point[q]=H;q++}else E.isHemisphereLight&&(H=a.get(E),H.direction.setFromMatrixPosition(E.matrixWorld), -H.direction.transformDirection(l),H.direction.normalize(),H.skyColor.copy(E.color).multiplyScalar(v),H.groundColor.copy(E.groundColor).multiplyScalar(v),b.hemi[n]=H,n++)}b.ambient[0]=g;b.ambient[1]=p;b.ambient[2]=u;c=b.hash;if(c.directionalLength!==h||c.pointLength!==q||c.spotLength!==t||c.rectAreaLength!==z||c.hemiLength!==n||c.numDirectionalShadows!==y||c.numPointShadows!==x||c.numSpotShadows!==U)b.directional.length=h,b.spot.length=t,b.rectArea.length=z,b.point.length=q,b.hemi.length=n,b.directionalShadowMap.length= -y,b.pointShadowMap.length=x,b.spotShadowMap.length=U,b.directionalShadowMatrix.length=y,b.pointShadowMatrix.length=x,b.spotShadowMatrix.length=U,c.directionalLength=h,c.pointLength=q,c.spotLength=t,c.rectAreaLength=z,c.hemiLength=n,c.numDirectionalShadows=y,c.numPointShadows=x,c.numSpotShadows=U,b.version=Vj++},state:b}}function Bh(){var a=new Uj,b=[],c=[];return{init:function(){b.length=0;c.length=0},state:{lightsArray:b,shadowsArray:c,lights:a},setupLights:function(d){a.setup(b,c,d)},pushLight:function(a){b.push(a)}, +a.get(E);H.position.setFromMatrixPosition(E.matrixWorld);H.position.applyMatrix4(l);H.color.copy(E.color).multiplyScalar(E.intensity);H.distance=E.distance;H.decay=E.decay;if(H.shadow=E.castShadow)v=E.shadow,H.shadowBias=v.bias,H.shadowRadius=v.radius,H.shadowMapSize=v.mapSize,H.shadowCameraNear=v.camera.near,H.shadowCameraFar=v.camera.far,b.pointShadowMap[r]=Ca,b.pointShadowMatrix[r]=E.shadow.matrix,x++;b.point[r]=H;r++}else E.isHemisphereLight&&(H=a.get(E),H.direction.setFromMatrixPosition(E.matrixWorld), +H.direction.transformDirection(l),H.direction.normalize(),H.skyColor.copy(E.color).multiplyScalar(v),H.groundColor.copy(E.groundColor).multiplyScalar(v),b.hemi[n]=H,n++)}b.ambient[0]=g;b.ambient[1]=p;b.ambient[2]=u;c=b.hash;if(c.directionalLength!==h||c.pointLength!==r||c.spotLength!==t||c.rectAreaLength!==z||c.hemiLength!==n||c.numDirectionalShadows!==y||c.numPointShadows!==x||c.numSpotShadows!==U)b.directional.length=h,b.spot.length=t,b.rectArea.length=z,b.point.length=r,b.hemi.length=n,b.directionalShadowMap.length= +y,b.pointShadowMap.length=x,b.spotShadowMap.length=U,b.directionalShadowMatrix.length=y,b.pointShadowMatrix.length=x,b.spotShadowMatrix.length=U,c.directionalLength=h,c.pointLength=r,c.spotLength=t,c.rectAreaLength=z,c.hemiLength=n,c.numDirectionalShadows=y,c.numPointShadows=x,c.numSpotShadows=U,b.version=Vj++},state:b}}function Bh(){var a=new Uj,b=[],c=[];return{init:function(){b.length=0;c.length=0},state:{lightsArray:b,shadowsArray:c,lights:a},setupLights:function(d){a.setup(b,c,d)},pushLight:function(a){b.push(a)}, pushShadow:function(a){c.push(a)}}}function Wj(){function a(c){c=c.target;c.removeEventListener("dispose",a);b.delete(c)}var b=new WeakMap;return{get:function(c,d){if(!1===b.has(c)){var e=new Bh;b.set(c,new WeakMap);b.get(c).set(d,e);c.addEventListener("dispose",a)}else!1===b.get(c).has(d)?(e=new Bh,b.get(c).set(d,e)):e=b.get(c).get(d);return e},dispose:function(){b=new WeakMap}}}function Db(a){O.call(this);this.type="MeshDepthMaterial";this.depthPacking=3200;this.morphTargets=this.skinning=!1;this.displacementMap= this.alphaMap=this.map=null;this.displacementScale=1;this.displacementBias=0;this.wireframe=!1;this.wireframeLinewidth=1;this.lights=this.fog=!1;this.setValues(a)}function Eb(a){O.call(this);this.type="MeshDistanceMaterial";this.referencePosition=new n;this.nearDistance=1;this.farDistance=1E3;this.morphTargets=this.skinning=!1;this.displacementMap=this.alphaMap=this.map=null;this.displacementScale=1;this.displacementBias=0;this.lights=this.fog=!1;this.setValues(a)}function Ch(a,b,c){function d(b, -c,d,e,f,g){var h=b.geometry;var l=m;var r=b.customDepthMaterial;d.isPointLight&&(l=p,r=b.customDistanceMaterial);r?l=r:(r=!1,c.morphTargets&&(h&&h.isBufferGeometry?r=h.morphAttributes&&h.morphAttributes.position&&0\nvoid main() {\n float mean = 0.0;\n float squared_mean = 0.0;\n \n\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy ) / resolution ) );\n for ( float i = -1.0; i < 1.0 ; i += SAMPLE_RATE) {\n #ifdef HORIZONAL_PASS\n vec2 distribution = decodeHalfRGBA ( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( i, 0.0 ) * radius ) / resolution ) );\n mean += distribution.x;\n squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n #else\n float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, i ) * radius ) / resolution ) );\n mean += depth;\n squared_mean += depth * depth;\n #endif\n }\n mean = mean * HALF_SAMPLE_RATE;\n squared_mean = squared_mean * HALF_SAMPLE_RATE;\n float std_dev = pow( squared_mean - mean * mean, 0.5 );\n gl_FragColor = encodeHalfRGBA( vec2( mean, std_dev ) );\n}"}), -t=q.clone();t.defines.HORIZONAL_PASS=1;var n=new D;n.addAttribute("position",new L(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));var w=new ia(n,q);for(n=0;4!==n;++n){var y=0!==(n&1),x=0!==(n&2),U=new Db({depthPacking:3201,morphTargets:y,skinning:x});m[n]=U;y=new Eb({morphTargets:y,skinning:x});p[n]=y}var R=this;this.enabled=!1;this.autoUpdate=!0;this.needsUpdate=!1;this.type=1;this.render=function(d,m,p){if(!1!==R.enabled&&(!1!==R.autoUpdate||!1!==R.needsUpdate)&&0!==d.length){var u=a.getRenderTarget(), -k=a.getActiveCubeFace(),r=a.getActiveMipmapLevel(),n=a.state;n.setBlending(0);n.buffers.color.setClear(1,1,1,1);n.buffers.depth.setTest(!0);n.setScissorTest(!1);for(var z=0,x=d.length;zc||g.y>c)console.warn("THREE.WebGLShadowMap:",y,"has shadow exceeding max texture size, reducing"),g.x>c&&(h.x=Math.floor(c/X.x), +c,d,e,f,g){var h=b.geometry;var l=m;var q=b.customDepthMaterial;d.isPointLight&&(l=p,q=b.customDistanceMaterial);q?l=q:(q=!1,c.morphTargets&&(h&&h.isBufferGeometry?q=h.morphAttributes&&h.morphAttributes.position&&0\nvoid main() {\n float mean = 0.0;\n float squared_mean = 0.0;\n \n\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy ) / resolution ) );\n for ( float i = -1.0; i < 1.0 ; i += SAMPLE_RATE) {\n #ifdef HORIZONAL_PASS\n vec2 distribution = decodeHalfRGBA ( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( i, 0.0 ) * radius ) / resolution ) );\n mean += distribution.x;\n squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n #else\n float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, i ) * radius ) / resolution ) );\n mean += depth;\n squared_mean += depth * depth;\n #endif\n }\n mean = mean * HALF_SAMPLE_RATE;\n squared_mean = squared_mean * HALF_SAMPLE_RATE;\n float std_dev = pow( squared_mean - mean * mean, 0.5 );\n gl_FragColor = encodeHalfRGBA( vec2( mean, std_dev ) );\n}"}), +t=r.clone();t.defines.HORIZONAL_PASS=1;var n=new D;n.addAttribute("position",new L(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));var w=new ia(n,r);for(n=0;4!==n;++n){var y=0!==(n&1),x=0!==(n&2),U=new Db({depthPacking:3201,morphTargets:y,skinning:x});m[n]=U;y=new Eb({morphTargets:y,skinning:x});p[n]=y}var R=this;this.enabled=!1;this.autoUpdate=!0;this.needsUpdate=!1;this.type=1;this.render=function(d,m,p){if(!1!==R.enabled&&(!1!==R.autoUpdate||!1!==R.needsUpdate)&&0!==d.length){var u=a.getRenderTarget(), +k=a.getActiveCubeFace(),q=a.getActiveMipmapLevel(),n=a.state;n.setBlending(0);n.buffers.color.setClear(1,1,1,1);n.buffers.depth.setTest(!0);n.setScissorTest(!1);for(var z=0,x=d.length;zc||g.y>c)console.warn("THREE.WebGLShadowMap:",y,"has shadow exceeding max texture size, reducing"),g.x>c&&(h.x=Math.floor(c/X.x), g.x=h.x*X.x,T.mapSize.x=h.x),g.y>c&&(h.y=Math.floor(c/X.y),g.y=h.y*X.y,T.mapSize.y=h.y);null!==T.map||T.isPointLightShadow||3!==this.type||(X={minFilter:1006,magFilter:1006,format:1023},T.map=new Ka(g.x,g.y,X),T.map.texture.name=y.name+".shadowMap",T.mapPass=new Ka(g.x,g.y,X),T.camera.updateProjectionMatrix());null===T.map&&(X={minFilter:1003,magFilter:1003,format:1023},T.map=new Ka(g.x,g.y,X),T.map.texture.name=y.name+".shadowMap",T.camera.updateProjectionMatrix());a.setRenderTarget(T.map);a.clear(); -X=T.getViewportCount();for(var U=0;Ud||a.height>d)e=d/Math.max(a.width,a.height);if(1>e||!0===b){if("undefined"!==typeof HTMLImageElement&&a instanceof HTMLImageElement||"undefined"!==typeof HTMLCanvasElement&&a instanceof HTMLCanvasElement||"undefined"!==typeof ImageBitmap&&a instanceof ImageBitmap)return d=b?N.floorPowerOfTwo:Math.floor,b=d(e*a.width),e=d(e*a.height),void 0=== H&&(H=h(b,e)),c=c?h(b,e):H,c.width=b,c.height=e,c.getContext("2d").drawImage(a,0,0,b,e),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+a.width+"x"+a.height+") to ("+b+"x"+e+")."),c;"data"in a&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+a.width+"x"+a.height+").")}return a}function m(a){return N.isPowerOfTwo(a.width)&&N.isPowerOfTwo(a.height)}function p(a,b){return a.generateMipmaps&&b&&1003!==a.minFilter&&1006!==a.minFilter}function u(b,c,e,f){a.generateMipmap(b); d.get(c).__maxMipLevel=Math.log(Math.max(e,f))*Math.LOG2E}function k(a,c){if(!e.isWebGL2)return a;var d=a;6403===a&&(5126===c&&(d=33326),5131===c&&(d=33325),5121===c&&(d=33321));6407===a&&(5126===c&&(d=34837),5131===c&&(d=34843),5121===c&&(d=32849));6408===a&&(5126===c&&(d=34836),5131===c&&(d=34842),5121===c&&(d=32856));33325===d||33326===d||34842===d||34836===d?b.get("EXT_color_buffer_float"):(34843===d||34837===d)&&console.warn("THREE.WebGLRenderer: Floating point textures with RGB format not supported. Please use RGBA instead."); -return d}function q(a){return 1003===a||1004===a||1005===a?9728:9729}function t(b){b=b.target;b.removeEventListener("dispose",t);var c=d.get(b);void 0!==c.__webglInit&&(a.deleteTexture(c.__webglTexture),d.remove(b));b.isVideoTexture&&Ca.delete(b);g.memory.textures--}function n(b){b=b.target;b.removeEventListener("dispose",n);var c=d.get(b),e=d.get(b.texture);if(b){void 0!==e.__webglTexture&&a.deleteTexture(e.__webglTexture);b.depthTexture&&b.depthTexture.dispose();if(b.isWebGLRenderTargetCube)for(e= +return d}function r(a){return 1003===a||1004===a||1005===a?9728:9729}function t(b){b=b.target;b.removeEventListener("dispose",t);var c=d.get(b);void 0!==c.__webglInit&&(a.deleteTexture(c.__webglTexture),d.remove(b));b.isVideoTexture&&Ca.delete(b);g.memory.textures--}function n(b){b=b.target;b.removeEventListener("dispose",n);var c=d.get(b),e=d.get(b.texture);if(b){void 0!==e.__webglTexture&&a.deleteTexture(e.__webglTexture);b.depthTexture&&b.depthTexture.dispose();if(b.isWebGLRenderTargetCube)for(e= 0;6>e;e++)a.deleteFramebuffer(c.__webglFramebuffer[e]),c.__webglDepthbuffer&&a.deleteRenderbuffer(c.__webglDepthbuffer[e]);else a.deleteFramebuffer(c.__webglFramebuffer),c.__webglDepthbuffer&&a.deleteRenderbuffer(c.__webglDepthbuffer);d.remove(b.texture);d.remove(b)}g.memory.textures--}function w(a,b){var e=d.get(a);if(a.isVideoTexture){var f=g.render.frame;Ca.get(a)!==f&&(Ca.set(a,f),a.update())}if(0q;q++)t[q]=r||g?g?b.image[q].image: -b.image[q]:l(b.image[q],!1,!0,e.maxCubemapSize);var n=t[0],z=m(n)||e.isWebGL2,w=f.convert(b.format),x=f.convert(b.type),y=k(w,x);U(34067,b,z);if(r){for(q=0;6>q;q++){var T=t[q].mipmaps;for(r=0;rq;q++)if(g)for(c.texImage2D(34069+q,0,y,t[q].width,t[q].height,0,w,x,t[q].data),r=0;rr;r++)t[r]=q||g?g?b.image[r].image: +b.image[r]:l(b.image[r],!1,!0,e.maxCubemapSize);var n=t[0],z=m(n)||e.isWebGL2,w=f.convert(b.format),x=f.convert(b.type),y=k(w,x);U(34067,b,z);if(q){for(r=0;6>r;r++){var T=t[r].mipmaps;for(q=0;qr;r++)if(g)for(c.texImage2D(34069+r,0,y,t[r].width,t[r].height,0,w,x,t[r].data),q=0;q=e.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+a+" texture units while this GPU supports only "+e.maxTextures);G+=1;return a};this.resetTextureUnits=function(){G=0};this.setTexture2D=w;this.setTexture2DArray=function(a,b){var e=d.get(a);0q;q++)h.__webglFramebuffer[q]=a.createFramebuffer();else if(h.__webglFramebuffer=a.createFramebuffer(),q)if(e.isWebGL2){h.__webglMultisampledFramebuffer=a.createFramebuffer();h.__webglColorRenderbuffer=a.createRenderbuffer();a.bindRenderbuffer(36161,h.__webglColorRenderbuffer);q=f.convert(b.texture.format);var z=f.convert(b.texture.type);q=k(q,z);z=A(b);a.renderbufferStorageMultisample(36161,z,q,b.width,b.height);a.bindFramebuffer(36160,h.__webglMultisampledFramebuffer); -a.framebufferRenderbuffer(36160,36064,36161,h.__webglColorRenderbuffer);a.bindRenderbuffer(36161,null);b.depthBuffer&&(h.__webglDepthRenderbuffer=a.createRenderbuffer(),B(h.__webglDepthRenderbuffer,b,!0));a.bindFramebuffer(36160,null)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");if(r){c.bindTexture(34067,l.__webglTexture);U(34067,b.texture,t);for(q=0;6>q;q++)v(h.__webglFramebuffer[q],b,36064,34069+q);p(b.texture,t)&&u(34067,b.texture,b.width, +a.version?E(e,a,b):(c.activeTexture(33984+b),c.bindTexture(35866,e.__webglTexture))};this.setTexture3D=function(a,b){var e=d.get(a);0r;r++)h.__webglFramebuffer[r]=a.createFramebuffer();else if(h.__webglFramebuffer=a.createFramebuffer(),r)if(e.isWebGL2){h.__webglMultisampledFramebuffer=a.createFramebuffer();h.__webglColorRenderbuffer=a.createRenderbuffer();a.bindRenderbuffer(36161,h.__webglColorRenderbuffer);r=f.convert(b.texture.format);var z=f.convert(b.texture.type);r=k(r,z);z=A(b);a.renderbufferStorageMultisample(36161,z,r,b.width,b.height);a.bindFramebuffer(36160,h.__webglMultisampledFramebuffer); +a.framebufferRenderbuffer(36160,36064,36161,h.__webglColorRenderbuffer);a.bindRenderbuffer(36161,null);b.depthBuffer&&(h.__webglDepthRenderbuffer=a.createRenderbuffer(),B(h.__webglDepthRenderbuffer,b,!0));a.bindFramebuffer(36160,null)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");if(q){c.bindTexture(34067,l.__webglTexture);U(34067,b.texture,t);for(r=0;6>r;r++)v(h.__webglFramebuffer[r],b,36064,34069+r);p(b.texture,t)&&u(34067,b.texture,b.width, b.height);c.bindTexture(34067,null)}else c.bindTexture(3553,l.__webglTexture),U(3553,b.texture,t),v(h.__webglFramebuffer,b,36064,3553),p(b.texture,t)&&u(3553,b.texture,b.width,b.height),c.bindTexture(3553,null);if(b.depthBuffer){h=d.get(b);l=!0===b.isWebGLRenderTargetCube;if(b.depthTexture){if(l)throw Error("target.depthTexture not supported in Cube render targets");if(b&&b.isWebGLRenderTargetCube)throw Error("Depth Texture with cube render targets is not supported");a.bindFramebuffer(36160,h.__webglFramebuffer); if(!b.depthTexture||!b.depthTexture.isDepthTexture)throw Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");d.get(b.depthTexture).__webglTexture&&b.depthTexture.image.width===b.width&&b.depthTexture.image.height===b.height||(b.depthTexture.image.width=b.width,b.depthTexture.image.height=b.height,b.depthTexture.needsUpdate=!0);w(b.depthTexture,0);h=d.get(b.depthTexture).__webglTexture;if(1026===b.depthTexture.format)a.framebufferTexture2D(36160,36096,3553,h,0);else if(1027=== b.depthTexture.format)a.framebufferTexture2D(36160,33306,3553,h,0);else throw Error("Unknown depthTexture format");}else if(l)for(h.__webglDepthbuffer=[],l=0;6>l;l++)a.bindFramebuffer(36160,h.__webglFramebuffer[l]),h.__webglDepthbuffer[l]=a.createRenderbuffer(),B(h.__webglDepthbuffer[l],b);else a.bindFramebuffer(36160,h.__webglFramebuffer),h.__webglDepthbuffer=a.createRenderbuffer(),B(h.__webglDepthbuffer,b);a.bindFramebuffer(36160,null)}};this.updateRenderTargetMipmap=function(a){var b=a.texture, @@ -153,68 +153,68 @@ a)return 1;if(202===a)return 768;if(203===a)return 769;if(204===a)return 770;if( a||35841===a||35842===a||35843===a)if(d=b.get("WEBGL_compressed_texture_pvrtc"),null!==d){if(35840===a)return d.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(35841===a)return d.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(35842===a)return d.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(35843===a)return d.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(36196===a&&(d=b.get("WEBGL_compressed_texture_etc1"),null!==d))return d.COMPRESSED_RGB_ETC1_WEBGL;if(37808===a||37809===a||37810===a||37811===a||37812===a||37813===a||37814===a||37815===a||37816=== a||37817===a||37818===a||37819===a||37820===a||37821===a)if(d=b.get("WEBGL_compressed_texture_astc"),null!==d)return a;if(103===a||104===a){if(c.isWebGL2){if(103===a)return 32775;if(104===a)return 32776}d=b.get("EXT_blend_minmax");if(null!==d){if(103===a)return d.MIN_EXT;if(104===a)return d.MAX_EXT}}if(1020===a){if(c.isWebGL2)return 34042;d=b.get("WEBGL_depth_texture");if(null!==d)return d.UNSIGNED_INT_24_8_WEBGL}return 0}}}function Hc(){A.call(this);this.type="Group"}function Jd(a){ja.call(this); this.cameras=a||[]}function Eh(a,b,c){Fh.setFromMatrixPosition(b.matrixWorld);Gh.setFromMatrixPosition(c.matrixWorld);var d=Fh.distanceTo(Gh),e=b.projectionMatrix.elements,f=c.projectionMatrix.elements,g=e[14]/(e[10]-1);c=e[14]/(e[10]+1);var h=(e[9]+1)/e[5],l=(e[9]-1)/e[5],m=(e[8]-1)/e[0],p=(f[8]+1)/f[0];e=g*m;f=g*p;p=d/(-m+p);m=p*-m;b.matrixWorld.decompose(a.position,a.quaternion,a.scale);a.translateX(m);a.translateZ(p);a.matrixWorld.compose(a.position,a.quaternion,a.scale);a.matrixWorldInverse.getInverse(a.matrixWorld); -b=g+p;g=c+p;a.projectionMatrix.makePerspective(e-m,f+(d-m),h*c/g*b,l*c/g*b,b,g)}function cg(a){function b(){return null!==h&&!0===h.isPresenting}function c(){if(b()){var c=h.getEyeParameters("left");e=2*c.renderWidth*q;f=c.renderHeight*q;Cb=a.getPixelRatio();a.getSize(E);a.setDrawingBufferSize(e,f,1);x.viewport.set(0,0,e/2,f);U.viewport.set(e/2,0,e/2,f);A.start();g.dispatchEvent({type:"sessionstart"})}else g.enabled&&a.setDrawingBufferSize(E.width,E.height,Cb),A.stop(),g.dispatchEvent({type:"sessionend"})} -function d(a,b){null!==b&&4===b.length&&a.set(b[0]*e,b[1]*f,b[2]*e,b[3]*f)}var e,f,g=this,h=null,l=null,m=null,p=[],u=new W,k=new W,q=1,t="local-floor";"undefined"!==typeof window&&"VRFrameData"in window&&(l=new window.VRFrameData,window.addEventListener("vrdisplaypresentchange",c,!1));var z=new W,w=new sa,y=new n,x=new ja;x.viewport=new da;x.layers.enable(1);var U=new ja;U.viewport=new da;U.layers.enable(2);var R=new Jd([x,U]);R.layers.enable(1);R.layers.enable(2);var E=new v,Cb,B=[];this.enabled= -!1;this.getController=function(a){var b=p[a];void 0===b&&(b=new Hc,b.matrixAutoUpdate=!1,b.visible=!1,p[a]=b);return b};this.getDevice=function(){return h};this.setDevice=function(a){void 0!==a&&(h=a);A.setContext(a)};this.setFramebufferScaleFactor=function(a){q=a};this.setReferenceSpaceType=function(a){t=a};this.setPoseTarget=function(a){void 0!==a&&(m=a)};this.getCamera=function(a){var c="local-floor"===t?1.6:0;if(!1===b())return a.position.set(0,c,0),a.rotation.set(0,0,0),a;h.depthNear=a.near; +b=g+p;g=c+p;a.projectionMatrix.makePerspective(e-m,f+(d-m),h*c/g*b,l*c/g*b,b,g)}function cg(a){function b(){return null!==h&&!0===h.isPresenting}function c(){if(b()){var c=h.getEyeParameters("left");e=2*c.renderWidth*r;f=c.renderHeight*r;Cb=a.getPixelRatio();a.getSize(E);a.setDrawingBufferSize(e,f,1);x.viewport.set(0,0,e/2,f);U.viewport.set(e/2,0,e/2,f);A.start();g.dispatchEvent({type:"sessionstart"})}else g.enabled&&a.setDrawingBufferSize(E.width,E.height,Cb),A.stop(),g.dispatchEvent({type:"sessionend"})} +function d(a,b){null!==b&&4===b.length&&a.set(b[0]*e,b[1]*f,b[2]*e,b[3]*f)}var e,f,g=this,h=null,l=null,m=null,p=[],u=new W,k=new W,r=1,t="local-floor";"undefined"!==typeof window&&"VRFrameData"in window&&(l=new window.VRFrameData,window.addEventListener("vrdisplaypresentchange",c,!1));var z=new W,w=new sa,y=new n,x=new ja;x.viewport=new da;x.layers.enable(1);var U=new ja;U.viewport=new da;U.layers.enable(2);var R=new Jd([x,U]);R.layers.enable(1);R.layers.enable(2);var E=new v,Cb,B=[];this.enabled= +!1;this.getController=function(a){var b=p[a];void 0===b&&(b=new Hc,b.matrixAutoUpdate=!1,b.visible=!1,p[a]=b);return b};this.getDevice=function(){return h};this.setDevice=function(a){void 0!==a&&(h=a);A.setContext(a)};this.setFramebufferScaleFactor=function(a){r=a};this.setReferenceSpaceType=function(a){t=a};this.setPoseTarget=function(a){void 0!==a&&(m=a)};this.getCamera=function(a){var c="local-floor"===t?1.6:0;if(!1===b())return a.position.set(0,c,0),a.rotation.set(0,0,0),a;h.depthNear=a.near; h.depthFar=a.far;h.getFrameData(l);if("local-floor"===t){var e=h.stageParameters;e?u.fromArray(e.sittingToStandingTransform):u.makeTranslation(0,c,0)}c=l.pose;e=null!==m?m:a;e.matrix.copy(u);e.matrix.decompose(e.position,e.quaternion,e.scale);null!==c.orientation&&(w.fromArray(c.orientation),e.quaternion.multiply(w));null!==c.position&&(w.setFromRotationMatrix(u),y.fromArray(c.position),y.applyQuaternion(w),e.position.add(y));e.updateMatrixWorld();x.near=a.near;U.near=a.near;x.far=a.far;U.far=a.far; x.matrixWorldInverse.fromArray(l.leftViewMatrix);U.matrixWorldInverse.fromArray(l.rightViewMatrix);k.getInverse(u);"local-floor"===t&&(x.matrixWorldInverse.multiply(k),U.matrixWorldInverse.multiply(k));a=e.parent;null!==a&&(z.getInverse(a.matrixWorld),x.matrixWorldInverse.multiply(z),U.matrixWorldInverse.multiply(z));x.matrixWorld.getInverse(x.matrixWorldInverse);U.matrixWorld.getInverse(U.matrixWorldInverse);x.projectionMatrix.fromArray(l.leftProjectionMatrix);U.projectionMatrix.fromArray(l.rightProjectionMatrix); Eh(R,x,U);a=h.getLayers();a.length&&(a=a[0],d(x.viewport,a.leftBounds),d(U.viewport,a.rightBounds));a:for(a=0;af.matrixWorld.determinant();ha.setMaterial(e,h);var l=k(a,c,e,f),m=!1;if(b!==d.id||ac!==l.id||Z!==(!0===e.wireframe))b=d.id,ac=l.id,Z=!0===e.wireframe,m=!0;f.morphTargetInfluences&&(wa.update(f,d,e,l), -m=!0);h=d.index;var p=d.attributes.position;c=1;!0===e.wireframe&&(h=va.getWireframeAttribute(d),c=2);a=ya;if(null!==h){var u=ta.get(h);a=za;a.setIndex(u)}if(m){if(d&&d.isInstancedBufferGeometry&&!Da.isWebGL2&&null===pa.get("ANGLE_instanced_arrays"))console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");else{ha.initAttributes();m=d.attributes;l=l.getAttributes();var r=e.defaultAttributeValues; -for(v in l){var q=l[v];if(0<=q){var t=m[v];if(void 0!==t){var n=t.normalized,z=t.itemSize,w=ta.get(t);if(void 0!==w){var x=w.buffer,y=w.type;w=w.bytesPerElement;if(t.isInterleavedBufferAttribute){var E=t.data,U=E.stride;t=t.offset;E&&E.isInstancedInterleavedBuffer?(ha.enableAttributeAndDivisor(q,E.meshPerAttribute),void 0===d.maxInstancedCount&&(d.maxInstancedCount=E.meshPerAttribute*E.count)):ha.enableAttribute(q);K.bindBuffer(34962,x);K.vertexAttribPointer(q,z,y,n,U*w,t*w)}else t.isInstancedBufferAttribute? -(ha.enableAttributeAndDivisor(q,t.meshPerAttribute),void 0===d.maxInstancedCount&&(d.maxInstancedCount=t.meshPerAttribute*t.count)):ha.enableAttribute(q),K.bindBuffer(34962,x),K.vertexAttribPointer(q,z,y,n,0,0)}}else if(void 0!==r&&(n=r[v],void 0!==n))switch(n.length){case 2:K.vertexAttrib2fv(q,n);break;case 3:K.vertexAttrib3fv(q,n);break;case 4:K.vertexAttrib4fv(q,n);break;default:K.vertexAttrib1fv(q,n)}}}ha.disableUnusedAttributes()}null!==h&&K.bindBuffer(34963,u.buffer)}u=Infinity;null!==h?u=h.count: -void 0!==p&&(u=p.count);h=d.drawRange.start*c;p=null!==g?g.start*c:0;var v=Math.max(h,p);g=Math.max(0,Math.min(u,h+d.drawRange.count*c,p+(null!==g?g.count*c:Infinity))-1-v+1);if(0!==g){if(f.isMesh)if(!0===e.wireframe)ha.setLineWidth(e.wireframeLinewidth*(null===M?ea:1)),a.setMode(1);else switch(f.drawMode){case 0:a.setMode(4);break;case 1:a.setMode(5);break;case 2:a.setMode(6)}else f.isLine?(e=e.linewidth,void 0===e&&(e=1),ha.setLineWidth(e*(null===M?ea:1)),f.isLineSegments?a.setMode(1):f.isLineLoop? -a.setMode(2):a.setMode(3)):f.isPoints?a.setMode(0):f.isSprite&&a.setMode(4);d&&d.isInstancedBufferGeometry?0f.matrixWorld.determinant();ha.setMaterial(e, +h);var l=k(a,c,e,f),m=!1;if(b!==d.id||ac!==l.id||Z!==(!0===e.wireframe))b=d.id,ac=l.id,Z=!0===e.wireframe,m=!0;f.morphTargetInfluences&&(wa.update(f,d,e,l),m=!0);h=d.index;var p=d.attributes.position;c=1;!0===e.wireframe&&(h=va.getWireframeAttribute(d),c=2);a=ya;if(null!==h){var u=ta.get(h);a=za;a.setIndex(u)}if(m){if(d&&d.isInstancedBufferGeometry&&!Da.isWebGL2&&null===pa.get("ANGLE_instanced_arrays"))console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays."); +else{ha.initAttributes();m=d.attributes;l=l.getAttributes();var r=e.defaultAttributeValues;for(v in l){var q=l[v];if(0<=q){var t=m[v];if(void 0!==t){var n=t.normalized,z=t.itemSize,w=ta.get(t);if(void 0!==w){var x=w.buffer,y=w.type;w=w.bytesPerElement;if(t.isInterleavedBufferAttribute){var E=t.data,U=E.stride;t=t.offset;E&&E.isInstancedInterleavedBuffer?(ha.enableAttributeAndDivisor(q,E.meshPerAttribute),void 0===d.maxInstancedCount&&(d.maxInstancedCount=E.meshPerAttribute*E.count)):ha.enableAttribute(q); +K.bindBuffer(34962,x);K.vertexAttribPointer(q,z,y,n,U*w,t*w)}else t.isInstancedBufferAttribute?(ha.enableAttributeAndDivisor(q,t.meshPerAttribute),void 0===d.maxInstancedCount&&(d.maxInstancedCount=t.meshPerAttribute*t.count)):ha.enableAttribute(q),K.bindBuffer(34962,x),K.vertexAttribPointer(q,z,y,n,0,0)}}else if(void 0!==r&&(n=r[v],void 0!==n))switch(n.length){case 2:K.vertexAttrib2fv(q,n);break;case 3:K.vertexAttrib3fv(q,n);break;case 4:K.vertexAttrib4fv(q,n);break;default:K.vertexAttrib1fv(q,n)}}}ha.disableUnusedAttributes()}null!== +h&&K.bindBuffer(34963,u.buffer)}u=Infinity;null!==h?u=h.count:void 0!==p&&(u=p.count);h=d.drawRange.start*c;p=null!==g?g.start*c:0;var v=Math.max(h,p);g=Math.max(0,Math.min(u,h+d.drawRange.count*c,p+(null!==g?g.count*c:Infinity))-1-v+1);if(0!==g){if(f.isMesh)if(!0===e.wireframe)ha.setLineWidth(e.wireframeLinewidth*(null===M?ea:1)),a.setMode(1);else switch(f.drawMode){case 0:a.setMode(4);break;case 1:a.setMode(5);break;case 2:a.setMode(6)}else f.isLine?(e=e.linewidth,void 0===e&&(e=1),ha.setLineWidth(e* +(null===M?ea:1)),f.isLineSegments?a.setMode(1):f.isLineLoop?a.setMode(2):a.setMode(3)):f.isPoints?a.setMode(0):f.isSprite&&a.setMode(4);d&&d.isInstancedBufferGeometry?0e.far||f.push({distance:a,distanceToRay:Math.sqrt(h), point:c,index:b,face:null,object:g}))}function hg(a,b,c,d,e,f,g,h,l){V.call(this,a,b,c,d,e,f,g,h,l);this.format=void 0!==g?g:1022;this.minFilter=void 0!==f?f:1006;this.magFilter=void 0!==e?e:1006;this.generateMipmaps=!1}function Lc(a,b,c,d,e,f,g,h,l,m,p,k){V.call(this,null,f,g,h,l,m,d,e,p,k);this.image={width:b,height:c};this.mipmaps=a;this.generateMipmaps=this.flipY=!1}function Pd(a,b,c,d,e,f,g,h,l){V.call(this,a,b,c,d,e,f,g,h,l);this.needsUpdate=!0}function Qd(a,b,c,d,e,f,g,h,l,m){m=void 0!==m? m:1026;if(1026!==m&&1027!==m)throw Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===c&&1026===m&&(c=1012);void 0===c&&1027===m&&(c=1020);V.call(this,null,d,e,f,g,h,m,c,l);this.image={width:a,height:b};this.magFilter=void 0!==g?g:1003;this.minFilter=void 0!==h?h:1003;this.generateMipmaps=this.flipY=!1}function Mc(a){D.call(this);this.type="WireframeGeometry";var b=[],c,d,e,f=[0,0],g={},h=["a","b","c"];if(a&&a.isGeometry){var l=a.faces;var m=0;for(d= -l.length;mc;c++){var k=p[h[c]];var r=p[h[(c+1)%3]];f[0]=Math.min(k,r);f[1]=Math.max(k,r);k=f[0]+","+f[1];void 0===g[k]&&(g[k]={index1:f[0],index2:f[1]})}}for(k in g)m=g[k],h=a.vertices[m.index1],b.push(h.x,h.y,h.z),h=a.vertices[m.index2],b.push(h.x,h.y,h.z)}else if(a&&a.isBufferGeometry)if(h=new n,null!==a.index){l=a.attributes.position;p=a.index;var q=a.groups;0===q.length&&(q=[{start:0,count:p.count,materialIndex:0}]);a=0;for(e=q.length;ac;c++)k=p.getX(m+c),r=p.getX(m+(c+1)%3),f[0]=Math.min(k,r),f[1]=Math.max(k,r),k=f[0]+","+f[1],void 0===g[k]&&(g[k]={index1:f[0],index2:f[1]});for(k in g)m=g[k],h.fromBufferAttribute(l,m.index1),b.push(h.x,h.y,h.z),h.fromBufferAttribute(l,m.index2),b.push(h.x,h.y,h.z)}else for(l=a.attributes.position,m=0,d=l.count/3;mc;c++)g=3*m+c,h.fromBufferAttribute(l,g),b.push(h.x,h.y,h.z),g=3*m+(c+1)%3,h.fromBufferAttribute(l,g),b.push(h.x,h.y,h.z);this.addAttribute("position", -new B(b,3))}function Rd(a,b,c){F.call(this);this.type="ParametricGeometry";this.parameters={func:a,slices:b,stacks:c};this.fromBufferGeometry(new Nc(a,b,c));this.mergeVertices()}function Nc(a,b,c){D.call(this);this.type="ParametricBufferGeometry";this.parameters={func:a,slices:b,stacks:c};var d=[],e=[],f=[],g=[],h=new n,l=new n,m=new n,p=new n,k=new n,r,q;3>a.length&&console.error("THREE.ParametricGeometry: Function must now modify a Vector3 as third parameter.");var t=b+1;for(r=0;r<=c;r++){var z= -r/c;for(q=0;q<=b;q++){var w=q/b;a(w,z,l);e.push(l.x,l.y,l.z);0<=w-1E-5?(a(w-1E-5,z,m),p.subVectors(l,m)):(a(w+1E-5,z,m),p.subVectors(m,l));0<=z-1E-5?(a(w,z-1E-5,m),k.subVectors(l,m)):(a(w,z+1E-5,m),k.subVectors(m,l));h.crossVectors(p,k).normalize();f.push(h.x,h.y,h.z);g.push(w,z)}}for(r=0;rc;c++){var k=p[h[c]];var q=p[h[(c+1)%3]];f[0]=Math.min(k,q);f[1]=Math.max(k,q);k=f[0]+","+f[1];void 0===g[k]&&(g[k]={index1:f[0],index2:f[1]})}}for(k in g)m=g[k],h=a.vertices[m.index1],b.push(h.x,h.y,h.z),h=a.vertices[m.index2],b.push(h.x,h.y,h.z)}else if(a&&a.isBufferGeometry)if(h=new n,null!==a.index){l=a.attributes.position;p=a.index;var r=a.groups;0===r.length&&(r=[{start:0,count:p.count,materialIndex:0}]);a=0;for(e=r.length;ac;c++)k=p.getX(m+c),q=p.getX(m+(c+1)%3),f[0]=Math.min(k,q),f[1]=Math.max(k,q),k=f[0]+","+f[1],void 0===g[k]&&(g[k]={index1:f[0],index2:f[1]});for(k in g)m=g[k],h.fromBufferAttribute(l,m.index1),b.push(h.x,h.y,h.z),h.fromBufferAttribute(l,m.index2),b.push(h.x,h.y,h.z)}else for(l=a.attributes.position,m=0,d=l.count/3;mc;c++)g=3*m+c,h.fromBufferAttribute(l,g),b.push(h.x,h.y,h.z),g=3*m+(c+1)%3,h.fromBufferAttribute(l,g),b.push(h.x,h.y,h.z);this.addAttribute("position", +new B(b,3))}function Rd(a,b,c){F.call(this);this.type="ParametricGeometry";this.parameters={func:a,slices:b,stacks:c};this.fromBufferGeometry(new Nc(a,b,c));this.mergeVertices()}function Nc(a,b,c){D.call(this);this.type="ParametricBufferGeometry";this.parameters={func:a,slices:b,stacks:c};var d=[],e=[],f=[],g=[],h=new n,l=new n,m=new n,p=new n,k=new n,q,r;3>a.length&&console.error("THREE.ParametricGeometry: Function must now modify a Vector3 as third parameter.");var t=b+1;for(q=0;q<=c;q++){var z= +q/c;for(r=0;r<=b;r++){var w=r/b;a(w,z,l);e.push(l.x,l.y,l.z);0<=w-1E-5?(a(w-1E-5,z,m),p.subVectors(l,m)):(a(w+1E-5,z,m),p.subVectors(m,l));0<=z-1E-5?(a(w,z-1E-5,m),k.subVectors(l,m)):(a(w,z+1E-5,m),k.subVectors(m,l));h.crossVectors(p,k).normalize();f.push(h.x,h.y,h.z);g.push(w,z)}}for(q=0;qd&&1===a.x&&(l[b]=a.x-1);0===c.x&&0===c.z&&(l[b]=d/2/Math.PI+.5)}D.call(this);this.type="PolyhedronBufferGeometry";this.parameters={vertices:a,indices:b,radius:c,detail:d};c= c||1;d=d||0;var h=[],l=[];(function(a){for(var c=new n,d=new n,g=new n,h=0;h=b;e-=d)f=Lh(e,a[e],a[e+1],f);f&&ec(f,f.next)&&($d(f),f=f.next);return f}function ae(a,b){if(!a)return a;b||(b=a);do{var c=!1;if(a.steiner||!ec(a,a.next)&&0!==qa(a.prev,a,a.next))a=a.next;else{$d(a);a=b=a.prev;if(a===a.next)break;c=!0}}while(c||a!==b);return b} -function be(a,b,c,d,e,f,g){if(a){if(!g&&f){var h=a,l=h;do null===l.z&&(l.z=ig(l.x,l.y,d,e,f)),l.prevZ=l.prev,l=l.nextZ=l.next;while(l!==h);l.prevZ.nextZ=null;l.prevZ=null;h=l;var m,p,k,r,q=1;do{l=h;var t=h=null;for(p=0;l;){p++;var n=l;for(m=k=0;mn!==t.next.y>n&&t.next.y!==t.y&&k<(t.next.x-t.x)*(n-t.y)/(t.next.y-t.y)+t.x&&(p=!p),t=t.next;while(t!==l);t=p}l=t}if(l){a=Nh(g,h);g=ae(g,g.next);a=ae(a,a.next);be(g,b,c,d,e,f);be(a,b,c,d,e,f);break a}h= h.next}g=g.next}while(g!==a)}break}}}}function Zj(a,b,c,d){var e=a.prev,f=a.next;if(0<=qa(e,a,f))return!1;var g=e.x>a.x?e.x>f.x?e.x:f.x:a.x>f.x?a.x:f.x,h=e.y>a.y?e.y>f.y?e.y:f.y:a.y>f.y?a.y:f.y,l=ig(e.x=l&&d&&d.z<=b;){if(c!==a.prev&&c!==a.next&&Tc(e.x,e.y,a.x,a.y,f.x,f.y,c.x,c.y)&&0<=qa(c.prev,c,c.next))return!1;c=c.prevZ;if(d!==a.prev&&d!==a.next&&Tc(e.x,e.y,a.x,a.y, f.x,f.y,d.x,d.y)&&0<=qa(d.prev,d,d.next))return!1;d=d.nextZ}for(;c&&c.z>=l;){if(c!==a.prev&&c!==a.next&&Tc(e.x,e.y,a.x,a.y,f.x,f.y,c.x,c.y)&&0<=qa(c.prev,c,c.next))return!1;c=c.prevZ}for(;d&&d.z<=b;){if(d!==a.prev&&d!==a.next&&Tc(e.x,e.y,a.x,a.y,f.x,f.y,d.x,d.y)&&0<=qa(d.prev,d,d.next))return!1;d=d.nextZ}return!0}function ak(a,b){return a.x-b.x}function bk(a,b){var c=b,d=a.x,e=a.y,f=-Infinity;do{if(e<=c.y&&e>=c.next.y&&c.next.y!==c.y){var g=c.x+(e-c.y)*(c.next.x-c.x)/(c.next.y-c.y);if(g<=d&&g>f){f= @@ -262,22 +262,22 @@ l(Q.x,Q.y,U/x*Y);for(ea=D-1;0<=ea;ea--){Y=ea/D;ca=E*Math.cos(Y*Math.PI/2);P=B*Ma for(J=0;Jk;k++){var n=m[f[k]];var r=m[f[(k+1)%3]];d[0]=Math.min(n,r);d[1]=Math.max(n,r);n=d[0]+","+d[1];void 0===e[n]?e[n]={index1:d[0],index2:d[1],face1:h,face2:void 0}:e[n].face2=h}for(n in e)if(d=e[n],void 0===d.face2||g[d.face1].normal.dot(g[d.face2].normal)<=b)f=a[d.index1],c.push(f.x,f.y,f.z),f=a[d.index2],c.push(f.x,f.y,f.z);this.addAttribute("position",new B(c,3))}function ic(a,b,c,d, -e,f,g,h){F.call(this);this.type="CylinderGeometry";this.parameters={radiusTop:a,radiusBottom:b,height:c,radialSegments:d,heightSegments:e,openEnded:f,thetaStart:g,thetaLength:h};this.fromBufferGeometry(new qb(a,b,c,d,e,f,g,h));this.mergeVertices()}function qb(a,b,c,d,e,f,g,h){function l(c){var e,f=new v,l=new n,p=0,z=!0===c?a:b,x=!0===c?1:-1;var B=t;for(e=1;e<=d;e++)u.push(0,w*x,0),r.push(0,x,0),q.push(.5,.5),t++;var A=t;for(e=0;e<=d;e++){var D=e/d*h+g,C=Math.cos(D);D=Math.sin(D);l.x=z*D;l.y=w*x; -l.z=z*C;u.push(l.x,l.y,l.z);r.push(0,x,0);f.x=.5*C+.5;f.y=.5*D*x+.5;q.push(f.x,f.y);t++}for(e=0;ek;k++){var n=m[f[k]];var q=m[f[(k+1)%3]];d[0]=Math.min(n,q);d[1]=Math.max(n,q);n=d[0]+","+d[1];void 0===e[n]?e[n]={index1:d[0],index2:d[1],face1:h,face2:void 0}:e[n].face2=h}for(n in e)if(d=e[n],void 0===d.face2||g[d.face1].normal.dot(g[d.face2].normal)<=b)f=a[d.index1],c.push(f.x,f.y,f.z),f=a[d.index2],c.push(f.x,f.y,f.z);this.addAttribute("position",new B(c,3))}function ic(a,b,c,d, +e,f,g,h){F.call(this);this.type="CylinderGeometry";this.parameters={radiusTop:a,radiusBottom:b,height:c,radialSegments:d,heightSegments:e,openEnded:f,thetaStart:g,thetaLength:h};this.fromBufferGeometry(new qb(a,b,c,d,e,f,g,h));this.mergeVertices()}function qb(a,b,c,d,e,f,g,h){function l(c){var e,f=new v,l=new n,p=0,z=!0===c?a:b,x=!0===c?1:-1;var B=t;for(e=1;e<=d;e++)u.push(0,w*x,0),q.push(0,x,0),r.push(.5,.5),t++;var A=t;for(e=0;e<=d;e++){var D=e/d*h+g,C=Math.cos(D);D=Math.sin(D);l.x=z*D;l.y=w*x; +l.z=z*C;u.push(l.x,l.y,l.z);q.push(0,x,0);f.x=.5*C+.5;f.y=.5*D*x+.5;r.push(f.x,f.y);t++}for(e=0;ea&&(a+=2*Math.PI);return a},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b= this.x-a.x;a=this.y-a.y;return b*b+a*a},manhattanDistanceTo:function(a){return Math.abs(this.x-a.x)+Math.abs(this.y-a.y)},setLength:function(a){return this.normalize().multiplyScalar(a)},lerp:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;return this},lerpVectors:function(a,b,c){return this.subVectors(b,a).multiplyScalar(c).add(a)},equals:function(a){return a.x===this.x&&a.y===this.y},fromArray:function(a,b){void 0===b&&(b=0);this.x=a[b];this.y=a[b+1];return this},toArray:function(a, b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this.x;a[b+1]=this.y;return a},fromBufferAttribute:function(a,b,c){void 0!==c&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute().");this.x=a.getX(b);this.y=a.getY(b);return this},rotateAround:function(a,b){var c=Math.cos(b);b=Math.sin(b);var d=this.x-a.x,e=this.y-a.y;this.x=d*c-e*b+a.x;this.y=d*b+e*c+a.y;return this}});Object.assign(sa,{slerp:function(a,b,c,d){return c.copy(a).slerp(b,d)},slerpFlat:function(a,b,c,d,e,f,g){var h= -c[d+0],l=c[d+1],m=c[d+2];c=c[d+3];d=e[f+0];var k=e[f+1],n=e[f+2];e=e[f+3];if(c!==e||h!==d||l!==k||m!==n){f=1-g;var r=h*d+l*k+m*n+c*e,q=0<=r?1:-1,t=1-r*r;t>Number.EPSILON&&(t=Math.sqrt(t),r=Math.atan2(t,r*q),f=Math.sin(f*r)/t,g=Math.sin(g*r)/t);q*=g;h=h*f+d*q;l=l*f+k*q;m=m*f+n*q;c=c*f+e*q;f===1-g&&(g=1/Math.sqrt(h*h+l*l+m*m+c*c),h*=g,l*=g,m*=g,c*=g)}a[b]=h;a[b+1]=l;a[b+2]=m;a[b+3]=c}});Object.defineProperties(sa.prototype,{x:{get:function(){return this._x},set:function(a){this._x=a;this._onChangeCallback()}}, +c[d+0],l=c[d+1],m=c[d+2];c=c[d+3];d=e[f+0];var k=e[f+1],n=e[f+2];e=e[f+3];if(c!==e||h!==d||l!==k||m!==n){f=1-g;var q=h*d+l*k+m*n+c*e,r=0<=q?1:-1,t=1-q*q;t>Number.EPSILON&&(t=Math.sqrt(t),q=Math.atan2(t,q*r),f=Math.sin(f*q)/t,g=Math.sin(g*q)/t);r*=g;h=h*f+d*r;l=l*f+k*r;m=m*f+n*r;c=c*f+e*r;f===1-g&&(g=1/Math.sqrt(h*h+l*l+m*m+c*c),h*=g,l*=g,m*=g,c*=g)}a[b]=h;a[b+1]=l;a[b+2]=m;a[b+3]=c}});Object.defineProperties(sa.prototype,{x:{get:function(){return this._x},set:function(a){this._x=a;this._onChangeCallback()}}, y:{get:function(){return this._y},set:function(a){this._y=a;this._onChangeCallback()}},z:{get:function(){return this._z},set:function(a){this._z=a;this._onChangeCallback()}},w:{get:function(){return this._w},set:function(a){this._w=a;this._onChangeCallback()}}});Object.assign(sa.prototype,{isQuaternion:!0,set:function(a,b,c,d){this._x=a;this._y=b;this._z=c;this._w=d;this._onChangeCallback();return this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(a){this._x= a.x;this._y=a.y;this._z=a.z;this._w=a.w;this._onChangeCallback();return this},setFromEuler:function(a,b){if(!a||!a.isEuler)throw Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var c=a._x,d=a._y,e=a._z;a=a.order;var f=Math.cos,g=Math.sin,h=f(c/2),l=f(d/2);f=f(e/2);c=g(c/2);d=g(d/2);e=g(e/2);"XYZ"===a?(this._x=c*l*f+h*d*e,this._y=h*d*f-c*l*e,this._z=h*l*e+c*d*f,this._w=h*l*f-c*d*e):"YXZ"===a?(this._x=c*l*f+h*d*e,this._y=h*d*f-c*l*e,this._z= h*l*e-c*d*f,this._w=h*l*f+c*d*e):"ZXY"===a?(this._x=c*l*f-h*d*e,this._y=h*d*f+c*l*e,this._z=h*l*e+c*d*f,this._w=h*l*f-c*d*e):"ZYX"===a?(this._x=c*l*f-h*d*e,this._y=h*d*f+c*l*e,this._z=h*l*e-c*d*f,this._w=h*l*f+c*d*e):"YZX"===a?(this._x=c*l*f+h*d*e,this._y=h*d*f+c*l*e,this._z=h*l*e-c*d*f,this._w=h*l*f-c*d*e):"XZY"===a&&(this._x=c*l*f-h*d*e,this._y=h*d*f-c*l*e,this._z=h*l*e+c*d*f,this._w=h*l*f+c*d*e);!1!==b&&this._onChangeCallback();return this},setFromAxisAngle:function(a,b){b/=2;var c=Math.sin(b); @@ -367,9 +367,9 @@ distanceToSquared:function(a){var b=this.x-a.x,c=this.y-a.y;a=this.z-a.z;return a.y)},setFromCylindricalCoords:function(a,b,c){this.x=a*Math.sin(b);this.y=c;this.z=a*Math.cos(b);return this},setFromMatrixPosition:function(a){a=a.elements;this.x=a[12];this.y=a[13];this.z=a[14];return this},setFromMatrixScale:function(a){var b=this.setFromMatrixColumn(a,0).length(),c=this.setFromMatrixColumn(a,1).length();a=this.setFromMatrixColumn(a,2).length();this.x=b;this.y=c;this.z=a;return this},setFromMatrixColumn:function(a,b){return this.fromArray(a.elements,4*b)},equals:function(a){return a.x=== this.x&&a.y===this.y&&a.z===this.z},fromArray:function(a,b){void 0===b&&(b=0);this.x=a[b];this.y=a[b+1];this.z=a[b+2];return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this.x;a[b+1]=this.y;a[b+2]=this.z;return a},fromBufferAttribute:function(a,b,c){void 0!==c&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute().");this.x=a.getX(b);this.y=a.getY(b);this.z=a.getZ(b);return this}});var qc=new n;Object.assign(S.prototype,{isMatrix3:!0,set:function(a, b,c,d,e,f,g,h,l){var m=this.elements;m[0]=a;m[1]=d;m[2]=g;m[3]=b;m[4]=e;m[5]=h;m[6]=c;m[7]=f;m[8]=l;return this},identity:function(){this.set(1,0,0,0,1,0,0,0,1);return this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(a){var b=this.elements;a=a.elements;b[0]=a[0];b[1]=a[1];b[2]=a[2];b[3]=a[3];b[4]=a[4];b[5]=a[5];b[6]=a[6];b[7]=a[7];b[8]=a[8];return this},setFromMatrix4:function(a){a=a.elements;this.set(a[0],a[4],a[8],a[1],a[5],a[9],a[2],a[6],a[10]);return this}, -applyToBufferAttribute:function(a){for(var b=0,c=a.count;bc;c++)if(b[c]!==a[c])return!1;return!0},fromArray:function(a,b){void 0===b&&(b=0);for(var c=0;9>c;c++)this.elements[c]=a[c+b];return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);var c=this.elements;a[b]=c[0];a[b+1]=c[1];a[b+2]=c[2];a[b+3]=c[3];a[b+4]=c[4];a[b+5]=c[5];a[b+6]=c[6];a[b+7]=c[7];a[b+8]=c[8];return a}});var md,Jb={getDataURL:function(a){if("undefined"==typeof HTMLCanvasElement)return a.src;if(!(a instanceof HTMLCanvasElement)){void 0===md&&(md=document.createElementNS("http://www.w3.org/1999/xhtml", @@ -392,21 +392,21 @@ a.z+this.w*a.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*th this.z)*b;this.w+=(a.w-this.w)*b;return this},lerpVectors:function(a,b,c){return this.subVectors(b,a).multiplyScalar(c).add(a)},equals:function(a){return a.x===this.x&&a.y===this.y&&a.z===this.z&&a.w===this.w},fromArray:function(a,b){void 0===b&&(b=0);this.x=a[b];this.y=a[b+1];this.z=a[b+2];this.w=a[b+3];return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this.x;a[b+1]=this.y;a[b+2]=this.z;a[b+3]=this.w;return a},fromBufferAttribute:function(a,b,c){void 0!==c&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."); this.x=a.getX(b);this.y=a.getY(b);this.z=a.getZ(b);this.w=a.getW(b);return this}});Ka.prototype=Object.assign(Object.create(za.prototype),{constructor:Ka,isWebGLRenderTarget:!0,setSize:function(a,b){if(this.width!==a||this.height!==b)this.width=a,this.height=b,this.texture.image.width=a,this.texture.image.height=b,this.dispose();this.viewport.set(0,0,a,b);this.scissor.set(0,0,a,b)},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.width=a.width;this.height=a.height;this.viewport.copy(a.viewport); this.texture=a.texture.clone();this.depthBuffer=a.depthBuffer;this.stencilBuffer=a.stencilBuffer;this.depthTexture=a.depthTexture;return this},dispose:function(){this.dispatchEvent({type:"dispose"})}});Of.prototype=Object.assign(Object.create(Ka.prototype),{constructor:Of,isWebGLMultisampleRenderTarget:!0,copy:function(a){Ka.prototype.copy.call(this,a);this.samples=a.samples;return this}});var Ja=new n,ra=new W,gk=new n(0,0,0),hk=new n(1,1,1),Kb=new n,qf=new n,ka=new n;Object.assign(W.prototype,{isMatrix4:!0, -set:function(a,b,c,d,e,f,g,h,l,m,k,n,r,q,t,z){var p=this.elements;p[0]=a;p[4]=b;p[8]=c;p[12]=d;p[1]=e;p[5]=f;p[9]=g;p[13]=h;p[2]=l;p[6]=m;p[10]=k;p[14]=n;p[3]=r;p[7]=q;p[11]=t;p[15]=z;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},clone:function(){return(new W).fromArray(this.elements)},copy:function(a){var b=this.elements;a=a.elements;b[0]=a[0];b[1]=a[1];b[2]=a[2];b[3]=a[3];b[4]=a[4];b[5]=a[5];b[6]=a[6];b[7]=a[7];b[8]=a[8];b[9]=a[9];b[10]=a[10];b[11]=a[11]; +set:function(a,b,c,d,e,f,g,h,l,m,k,n,q,r,t,z){var p=this.elements;p[0]=a;p[4]=b;p[8]=c;p[12]=d;p[1]=e;p[5]=f;p[9]=g;p[13]=h;p[2]=l;p[6]=m;p[10]=k;p[14]=n;p[3]=q;p[7]=r;p[11]=t;p[15]=z;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},clone:function(){return(new W).fromArray(this.elements)},copy:function(a){var b=this.elements;a=a.elements;b[0]=a[0];b[1]=a[1];b[2]=a[2];b[3]=a[3];b[4]=a[4];b[5]=a[5];b[6]=a[6];b[7]=a[7];b[8]=a[8];b[9]=a[9];b[10]=a[10];b[11]=a[11]; b[12]=a[12];b[13]=a[13];b[14]=a[14];b[15]=a[15];return this},copyPosition:function(a){var b=this.elements;a=a.elements;b[12]=a[12];b[13]=a[13];b[14]=a[14];return this},extractBasis:function(a,b,c){a.setFromMatrixColumn(this,0);b.setFromMatrixColumn(this,1);c.setFromMatrixColumn(this,2);return this},makeBasis:function(a,b,c){this.set(a.x,b.x,c.x,0,a.y,b.y,c.y,0,a.z,b.z,c.z,0,0,0,0,1);return this},extractRotation:function(a){var b=this.elements,c=a.elements,d=1/Ja.setFromMatrixColumn(a,0).length(), e=1/Ja.setFromMatrixColumn(a,1).length();a=1/Ja.setFromMatrixColumn(a,2).length();b[0]=c[0]*d;b[1]=c[1]*d;b[2]=c[2]*d;b[3]=0;b[4]=c[4]*e;b[5]=c[5]*e;b[6]=c[6]*e;b[7]=0;b[8]=c[8]*a;b[9]=c[9]*a;b[10]=c[10]*a;b[11]=0;b[12]=0;b[13]=0;b[14]=0;b[15]=1;return this},makeRotationFromEuler:function(a){a&&a.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var b=this.elements,c=a.x,d=a.y,e=a.z,f=Math.cos(c);c=Math.sin(c);var g=Math.cos(d); d=Math.sin(d);var h=Math.cos(e);e=Math.sin(e);if("XYZ"===a.order){a=f*h;var l=f*e,m=c*h,k=c*e;b[0]=g*h;b[4]=-g*e;b[8]=d;b[1]=l+m*d;b[5]=a-k*d;b[9]=-c*g;b[2]=k-a*d;b[6]=m+l*d;b[10]=f*g}else"YXZ"===a.order?(a=g*h,l=g*e,m=d*h,k=d*e,b[0]=a+k*c,b[4]=m*c-l,b[8]=f*d,b[1]=f*e,b[5]=f*h,b[9]=-c,b[2]=l*c-m,b[6]=k+a*c,b[10]=f*g):"ZXY"===a.order?(a=g*h,l=g*e,m=d*h,k=d*e,b[0]=a-k*c,b[4]=-f*e,b[8]=m+l*c,b[1]=l+m*c,b[5]=f*h,b[9]=k-a*c,b[2]=-f*d,b[6]=c,b[10]=f*g):"ZYX"===a.order?(a=f*h,l=f*e,m=c*h,k=c*e,b[0]=g*h, b[4]=m*d-l,b[8]=a*d+k,b[1]=g*e,b[5]=k*d+a,b[9]=l*d-m,b[2]=-d,b[6]=c*g,b[10]=f*g):"YZX"===a.order?(a=f*g,l=f*d,m=c*g,k=c*d,b[0]=g*h,b[4]=k-a*e,b[8]=m*e+l,b[1]=e,b[5]=f*h,b[9]=-c*h,b[2]=-d*h,b[6]=l*e+m,b[10]=a-k*e):"XZY"===a.order&&(a=f*g,l=f*d,m=c*g,k=c*d,b[0]=g*h,b[4]=-e,b[8]=d*h,b[1]=a*e+k,b[5]=f*h,b[9]=l*e-m,b[2]=m*e-l,b[6]=c*h,b[10]=k*e+a);b[3]=0;b[7]=0;b[11]=0;b[12]=0;b[13]=0;b[14]=0;b[15]=1;return this},makeRotationFromQuaternion:function(a){return this.compose(gk,a,hk)},lookAt:function(a,b, c){var d=this.elements;ka.subVectors(a,b);0===ka.lengthSq()&&(ka.z=1);ka.normalize();Kb.crossVectors(c,ka);0===Kb.lengthSq()&&(1===Math.abs(c.z)?ka.x+=1E-4:ka.z+=1E-4,ka.normalize(),Kb.crossVectors(c,ka));Kb.normalize();qf.crossVectors(ka,Kb);d[0]=Kb.x;d[4]=qf.x;d[8]=ka.x;d[1]=Kb.y;d[5]=qf.y;d[9]=ka.y;d[2]=Kb.z;d[6]=qf.z;d[10]=ka.z;return this},multiply:function(a,b){return void 0!==b?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."), -this.multiplyMatrices(a,b)):this.multiplyMatrices(this,a)},premultiply:function(a){return this.multiplyMatrices(a,this)},multiplyMatrices:function(a,b){var c=a.elements,d=b.elements;b=this.elements;a=c[0];var e=c[4],f=c[8],g=c[12],h=c[1],l=c[5],m=c[9],k=c[13],n=c[2],r=c[6],q=c[10],t=c[14],z=c[3],w=c[7],y=c[11];c=c[15];var x=d[0],v=d[4],B=d[8],E=d[12],A=d[1],D=d[5],C=d[9],F=d[13],H=d[2],G=d[6],I=d[10],L=d[14],M=d[3],N=d[7],O=d[11];d=d[15];b[0]=a*x+e*A+f*H+g*M;b[4]=a*v+e*D+f*G+g*N;b[8]=a*B+e*C+f*I+ -g*O;b[12]=a*E+e*F+f*L+g*d;b[1]=h*x+l*A+m*H+k*M;b[5]=h*v+l*D+m*G+k*N;b[9]=h*B+l*C+m*I+k*O;b[13]=h*E+l*F+m*L+k*d;b[2]=n*x+r*A+q*H+t*M;b[6]=n*v+r*D+q*G+t*N;b[10]=n*B+r*C+q*I+t*O;b[14]=n*E+r*F+q*L+t*d;b[3]=z*x+w*A+y*H+c*M;b[7]=z*v+w*D+y*G+c*N;b[11]=z*B+w*C+y*I+c*O;b[15]=z*E+w*F+y*L+c*d;return this},multiplyScalar:function(a){var b=this.elements;b[0]*=a;b[4]*=a;b[8]*=a;b[12]*=a;b[1]*=a;b[5]*=a;b[9]*=a;b[13]*=a;b[2]*=a;b[6]*=a;b[10]*=a;b[14]*=a;b[3]*=a;b[7]*=a;b[11]*=a;b[15]*=a;return this},applyToBufferAttribute:function(a){for(var b= -0,c=a.count;bthis.determinant()&&(e=-e);a.x=d[12];a.y=d[13];a.z=d[14];ra.copy(this);a=1/e;d=1/f;var h=1/g;ra.elements[0]*=a;ra.elements[1]*=a;ra.elements[2]*=a;ra.elements[4]*=d;ra.elements[5]*=d;ra.elements[6]*=d;ra.elements[8]*=h;ra.elements[9]*=h;ra.elements[10]*=h;b.setFromRotationMatrix(ra);c.x=e;c.y=f;c.z=g;return this},makePerspective:function(a,b,c,d,e,f){void 0===f&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs."); var g=this.elements;g[0]=2*e/(b-a);g[4]=0;g[8]=(b+a)/(b-a);g[12]=0;g[1]=0;g[5]=2*e/(c-d);g[9]=(c+d)/(c-d);g[13]=0;g[2]=0;g[6]=0;g[10]=-(f+e)/(f-e);g[14]=-2*f*e/(f-e);g[3]=0;g[7]=0;g[11]=-1;g[15]=0;return this},makeOrthographic:function(a,b,c,d,e,f){var g=this.elements,h=1/(b-a),l=1/(c-d),m=1/(f-e);g[0]=2*h;g[4]=0;g[8]=0;g[12]=-((b+a)*h);g[1]=0;g[5]=2*l;g[9]=0;g[13]=-((c+d)*l);g[2]=0;g[6]=0;g[10]=-2*m;g[14]=-((f+e)*m);g[3]=0;g[7]=0;g[11]=0;g[15]=1;return this},equals:function(a){var b=this.elements; a=a.elements;for(var c=0;16>c;c++)if(b[c]!==a[c])return!1;return!0},fromArray:function(a,b){void 0===b&&(b=0);for(var c=0;16>c;c++)this.elements[c]=a[c+b];return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);var c=this.elements;a[b]=c[0];a[b+1]=c[1];a[b+2]=c[2];a[b+3]=c[3];a[b+4]=c[4];a[b+5]=c[5];a[b+6]=c[6];a[b+7]=c[7];a[b+8]=c[8];a[b+9]=c[9];a[b+10]=c[10];a[b+11]=c[11];a[b+12]=c[12];a[b+13]=c[13];a[b+14]=c[14];a[b+15]=c[15];return a}});var fi=new W,gi=new sa;Pb.RotationOrders= @@ -498,9 +498,9 @@ b[c++]=f.z}return this},copyVector4sArray:function(a){for(var b=this.array,c=0,d setXYZW:function(a,b,c,d,e){a*=this.itemSize;this.array[a+0]=b;this.array[a+1]=c;this.array[a+2]=d;this.array[a+3]=e;return this},onUpload:function(a){this.onUploadCallback=a;return this},clone:function(){return(new this.constructor(this.array,this.itemSize)).copy(this)},toJSON:function(){return{itemSize:this.itemSize,type:this.array.constructor.name,array:Array.prototype.slice.call(this.array),normalized:this.normalized}}});xd.prototype=Object.create(L.prototype);xd.prototype.constructor=xd;yd.prototype= Object.create(L.prototype);yd.prototype.constructor=yd;zd.prototype=Object.create(L.prototype);zd.prototype.constructor=zd;Ad.prototype=Object.create(L.prototype);Ad.prototype.constructor=Ad;Sb.prototype=Object.create(L.prototype);Sb.prototype.constructor=Sb;Bd.prototype=Object.create(L.prototype);Bd.prototype.constructor=Bd;Tb.prototype=Object.create(L.prototype);Tb.prototype.constructor=Tb;B.prototype=Object.create(L.prototype);B.prototype.constructor=B;Cd.prototype=Object.create(L.prototype);Cd.prototype.constructor= Cd;Object.assign(eh.prototype,{computeGroups:function(a){var b=[],c=void 0;a=a.faces;for(var d=0;dg;g++)if(d[g]===d[(g+1)%3]){a.push(f);break}for(f=a.length-1;0<=f;f--)for(d=a[f],this.faces.splice(d,1),c=0,e=this.faceVertexUvs.length;cd||1b&&0a&&0c;c++)b[c].copy(a.planes[c]);return this},setFromMatrix:function(a){var b=this.planes,c=a.elements;a=c[0];var d=c[1],e=c[2],f=c[3],g=c[4],h=c[5],l=c[6],k=c[7],n=c[8],u=c[9],r=c[10],q=c[11],t=c[12],z=c[13],w=c[14];c=c[15];b[0].setComponents(f-a,k-g,q-n,c-t).normalize();b[1].setComponents(f+a,k+g,q+n,c+t).normalize();b[2].setComponents(f+ -d,k+h,q+u,c+z).normalize();b[3].setComponents(f-d,k-h,q-u,c-z).normalize();b[4].setComponents(f-e,k-l,q-r,c-w).normalize();b[5].setComponents(f+e,k+l,q+r,c+w).normalize();return this},intersectsObject:function(a){var b=a.geometry;null===b.boundingSphere&&b.computeBoundingSphere();td.copy(b.boundingSphere).applyMatrix4(a.matrixWorld);return this.intersectsSphere(td)},intersectsSprite:function(a){td.center.set(0,0,0);td.radius=.7071067811865476;td.applyMatrix4(a.matrixWorld);return this.intersectsSphere(td)}, +g[1].copy(b);g[2].copy(c);g[3].copy(d);g[4].copy(e);g[5].copy(f);return this},clone:function(){return(new this.constructor).copy(this)},copy:function(a){for(var b=this.planes,c=0;6>c;c++)b[c].copy(a.planes[c]);return this},setFromMatrix:function(a){var b=this.planes,c=a.elements;a=c[0];var d=c[1],e=c[2],f=c[3],g=c[4],h=c[5],l=c[6],k=c[7],n=c[8],u=c[9],q=c[10],r=c[11],t=c[12],z=c[13],w=c[14];c=c[15];b[0].setComponents(f-a,k-g,r-n,c-t).normalize();b[1].setComponents(f+a,k+g,r+n,c+t).normalize();b[2].setComponents(f+ +d,k+h,r+u,c+z).normalize();b[3].setComponents(f-d,k-h,r-u,c-z).normalize();b[4].setComponents(f-e,k-l,r-q,c-w).normalize();b[5].setComponents(f+e,k+l,r+q,c+w).normalize();return this},intersectsObject:function(a){var b=a.geometry;null===b.boundingSphere&&b.computeBoundingSphere();td.copy(b.boundingSphere).applyMatrix4(a.matrixWorld);return this.intersectsSphere(td)},intersectsSprite:function(a){td.center.set(0,0,0);td.radius=.7071067811865476;td.applyMatrix4(a.matrixWorld);return this.intersectsSphere(td)}, intersectsSphere:function(a){var b=this.planes,c=a.center;a=-a.radius;for(var d=0;6>d;d++)if(b[d].distanceToPoint(c)c;c++){var d=b[c];zf.x=0d.distanceToPoint(zf))return!1}return!0},containsPoint:function(a){for(var b=this.planes,c=0;6>c;c++)if(0>b[c].distanceToPoint(a))return!1;return!0}});var M={alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif", alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef ALPHATEST\n\tif ( diffuseColor.a < ALPHATEST ) discard;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\n\t#endif\n#endif", aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",begin_vertex:"vec3 transformed = vec3( position );",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"vec2 integrateSpecularBRDF( const in float dotNV, const in float roughness ) {\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\treturn vec2( -1.04, 1.04 ) * a004 + r.zw;\n}\nfloat punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif( cutoffDistance > 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n#else\n\tif( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t}\n\treturn 1.0;\n#endif\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nvec3 F_Schlick_RoughnessDependent( const in vec3 F0, const in float dotNV, const in float roughness ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotNV - 6.98316 ) * dotNV );\n\tvec3 Fr = max( vec3( 1.0 - roughness ), F0 ) - F0;\n\treturn Fr * fresnel + F0;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + viewDir );\n\tfloat dotNL = saturate( dot( normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\nvec3 BRDF_Specular_GGX_Environment( const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\treturn specularColor * brdf.x + brdf.y;\n}\nvoid BRDF_Specular_Multiscattering_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tvec3 F = F_Schlick_RoughnessDependent( specularColor, dotNV, roughness );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\tvec3 FssEss = F * brdf.x + brdf.y;\n\tfloat Ess = brdf.x + brdf.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie(float roughness, float NoH) {\n\tfloat invAlpha = 1.0 / roughness;\n\tfloat cos2h = NoH * NoH;\n\tfloat sin2h = max(1.0 - cos2h, 0.0078125);\treturn (2.0 + invAlpha) * pow(sin2h, invAlpha * 0.5) / (2.0 * PI);\n}\nfloat V_Neubelt(float NoV, float NoL) {\n\treturn saturate(1.0 / (4.0 * (NoL + NoV - NoL * NoV)));\n}\nvec3 BRDF_Specular_Sheen( const in float roughness, const in vec3 L, const in GeometricContext geometry, vec3 specularColor ) {\n\tvec3 N = geometry.normal;\n\tvec3 V = geometry.viewDir;\n\tvec3 H = normalize( V + L );\n\tfloat dotNH = saturate( dot( N, H ) );\n\treturn specularColor * D_Charlie( roughness, dotNH ) * V_Neubelt( dot(N, V), dot(N, L) );\n}\n#endif", @@ -589,11 +589,11 @@ envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = wo fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float fogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * fogDepth * fogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, fogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float fogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif", gradientmap_pars_fragment:"#ifdef TOON\n\tuniform sampler2D gradientMap;\n\tvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\t\tfloat dotNL = dot( normal, lightDirection );\n\t\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t\t#ifdef USE_GRADIENTMAP\n\t\t\treturn texture2D( gradientMap, coord ).rgb;\n\t\t#else\n\t\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t\t#endif\n\t}\n#endif",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\treflectedLight.indirectDiffuse += PI * texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n#endif", lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_vertex:"vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\nvIndirectFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n\tvIndirectBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\n#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n#endif", -lights_pars_begin:"uniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in GeometricContext geometry ) {\n\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t\tfloat shadowCameraNear;\n\t\tfloat shadowCameraFar;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tdirectLight.color = pointLight.color;\n\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\tdirectLight.visible = ( directLight.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( angleCos > spotLight.coneCos ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif", +lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in GeometricContext geometry ) {\n\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t\tfloat shadowCameraNear;\n\t\tfloat shadowCameraFar;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tdirectLight.color = pointLight.color;\n\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\tdirectLight.visible = ( directLight.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( angleCos > spotLight.coneCos ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif", lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifdef TOON\n\t\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\t#else\n\t\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\t\tvec3 irradiance = dotNL * directLight.color;\n\t#endif\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)", lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 );\n#ifdef REFLECTIVITY\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#endif\n#ifdef CLEARCOAT\n\tmaterial.clearcoat = saturate( clearcoat );\tmaterial.clearcoatRoughness = clamp( clearcoatRoughness, 0.04, 1.0 );\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheen;\n#endif", lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n#ifdef CLEARCOAT\n\tfloat clearcoat;\n\tfloat clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tvec3 sheenColor;\n#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearcoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.specularRoughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNL = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = ccDotNL * directLight.color;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tccIrradiance *= PI;\n\t\t#endif\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t\treflectedLight.directSpecular += ccIrradiance * material.clearcoat * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_Sheen(\n\t\t\tmaterial.specularRoughness,\n\t\t\tdirectLight.direction,\n\t\t\tgeometry,\n\t\t\tmaterial.sheenColor\n\t\t);\n\t#else\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.normal, material.specularColor, material.specularRoughness);\n\t#endif\n\treflectedLight.directDiffuse += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNV = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular += clearcoatRadiance * material.clearcoat * BRDF_Specular_GGX_Environment( geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t\tfloat ccDotNL = ccDotNV;\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\tfloat clearcoatInv = 1.0 - clearcoatDHR;\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\tBRDF_Specular_Multiscattering_Environment( geometry, material.specularColor, material.specularRoughness, singleScattering, multiScattering );\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\n\treflectedLight.indirectSpecular += clearcoatInv * radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}", -lights_fragment_begin:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = normalize( vViewPosition );\n#ifdef CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tdirectLight.color *= all( bvec2( pointLight.shadow, directLight.visible ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tdirectLight.color *= all( bvec2( spotLight.shadow, directLight.visible ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectLight.color *= all( bvec2( directionalLight.shadow, directLight.visible ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif", +lights_fragment_begin:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = normalize( vViewPosition );\n#ifdef CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tdirectLight.color *= all( bvec3( pointLight.shadow, directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tdirectLight.color *= all( bvec3( spotLight.shadow, directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectLight.color *= all( bvec3( directionalLight.shadow, directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif", lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec3 lightMapIrradiance = texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getLightProbeIndirectIrradiance( geometry, maxMipLevel );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.normal, material.specularRoughness, maxMipLevel );\n\t#ifdef CLEARCOAT\n\t\tclearcoatRadiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness, maxMipLevel );\n\t#endif\n#endif", lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n#endif", logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#else\n\t\tuniform float logDepthBufFC;\n\t#endif\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t#else\n\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\tgl_Position.z *= gl_Position.w;\n\t#endif\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif", @@ -671,9 +671,9 @@ Infinity!==e?a.multiplyScalar(e):a.set(1,0,0,0);b.setXYZW(c,a.x,a.y,a.z,a.w)}},u a.matrix.decompose(a.position,a.quaternion,a.scale)},update:function(){for(var a=this.bones,b=this.boneInverses,c=this.boneMatrices,d=this.boneTexture,e=0,f=a.length;ec||(h.applyMatrix4(this.matrixWorld),r=a.ray.origin.distanceTo(h),ra.far||b.push({distance:r,point:e.clone().applyMatrix4(this.matrixWorld),index:d,face:null,faceIndex:null,object:this}))}}else for(d=0,u=p.length/3-1;dc||(h.applyMatrix4(this.matrixWorld),r=a.ray.origin.distanceTo(h),ra.far||b.push({distance:r,point:e.clone().applyMatrix4(this.matrixWorld), -index:d,face:null,faceIndex:null,object:this}))}else if(d.isGeometry)for(f=d.vertices,g=f.length,d=0;dc||(h.applyMatrix4(this.matrixWorld),r=a.ray.origin.distanceTo(h),ra.far||b.push({distance:r,point:e.clone().applyMatrix4(this.matrixWorld),index:d,face:null,faceIndex:null,object:this}))}},clone:function(){return(new this.constructor(this.geometry,this.material)).copy(this)}});var Ef=new n,Ff=new n;aa.prototype=Object.assign(Object.create(va.prototype), +d=this.geometry,e=this.matrixWorld;null===d.boundingSphere&&d.computeBoundingSphere();Be.copy(d.boundingSphere);Be.applyMatrix4(e);Be.radius+=c;if(!1!==a.ray.intersectsSphere(Be)){ti.getInverse(e);Df.copy(a.ray).applyMatrix4(ti);c/=(this.scale.x+this.scale.y+this.scale.z)/3;c*=c;var f=new n,g=new n;e=new n;var h=new n,l=this&&this.isLineSegments?2:1;if(d.isBufferGeometry){var k=d.index,p=d.attributes.position.array;if(null!==k){k=k.array;d=0;for(var u=k.length-1;dc||(h.applyMatrix4(this.matrixWorld),q=a.ray.origin.distanceTo(h),qa.far||b.push({distance:q,point:e.clone().applyMatrix4(this.matrixWorld),index:d,face:null,faceIndex:null,object:this}))}}else for(d=0,u=p.length/3-1;dc||(h.applyMatrix4(this.matrixWorld),q=a.ray.origin.distanceTo(h),qa.far||b.push({distance:q,point:e.clone().applyMatrix4(this.matrixWorld), +index:d,face:null,faceIndex:null,object:this}))}else if(d.isGeometry)for(f=d.vertices,g=f.length,d=0;dc||(h.applyMatrix4(this.matrixWorld),q=a.ray.origin.distanceTo(h),qa.far||b.push({distance:q,point:e.clone().applyMatrix4(this.matrixWorld),index:d,face:null,faceIndex:null,object:this}))}},clone:function(){return(new this.constructor(this.geometry,this.material)).copy(this)}});var Ef=new n,Ff=new n;aa.prototype=Object.assign(Object.create(va.prototype), {constructor:aa,isLineSegments:!0,computeLineDistances:function(){var a=this.geometry;if(a.isBufferGeometry)if(null===a.index){for(var b=a.attributes.position,c=[],d=0,e=b.count;d80*c){var q=h=a[0];var t=d=a[1];for(l=c;lh&&(h=n),b>d&&(d=b);h=Math.max(h-q,d-t);h=0!==h?1/h:0}be(f,g,c,q,t,h);return g}},pb={area:function(a){for(var b=a.length,c=0,d=b-1,e=0;epb.area(a)},triangulateShape:function(a,b){var c=[],d=[],e=[];Oh(a);Ph(c,a);var f=a.length;b.forEach(Oh); +Yd;Rc.prototype=Object.create(D.prototype);Rc.prototype.constructor=Rc;Zd.prototype=Object.create(F.prototype);Zd.prototype.constructor=Zd;Sc.prototype=Object.create(D.prototype);Sc.prototype.constructor=Sc;var sk={triangulate:function(a,b,c){c=c||2;var d=b&&b.length,e=d?b[0]*c:a.length,f=Kh(a,0,e,c,!0),g=[];if(!f||f.next===f.prev)return g;var h;if(d){var l=c;d=[];var k;var n=0;for(k=b.length;n80*c){var r=h=a[0];var t=d=a[1];for(l=c;lh&&(h=n),b>d&&(d=b);h=Math.max(h-r,d-t);h=0!==h?1/h:0}be(f,g,c,r,t,h);return g}},pb={area:function(a){for(var b=a.length,c=0,d=b-1,e=0;epb.area(a)},triangulateShape:function(a,b){var c=[],d=[],e=[];Oh(a);Ph(c,a);var f=a.length;b.forEach(Oh); for(a=0;aMath.abs(g-l)?[new v(a,1-c),new v(h,1-d),new v(k,1-e),new v(u,1-b)]:[new v(g,1-c),new v(l,1-d),new v(n,1-e),new v(r,1-b)]}};de.prototype=Object.create(F.prototype); +this.parameters.options,a)};var dk={generateTopUV:function(a,b,c,d,e){a=b[3*d];d=b[3*d+1];var f=b[3*e];e=b[3*e+1];return[new v(b[3*c],b[3*c+1]),new v(a,d),new v(f,e)]},generateSideWallUV:function(a,b,c,d,e,f){a=b[3*c];var g=b[3*c+1];c=b[3*c+2];var h=b[3*d],l=b[3*d+1];d=b[3*d+2];var k=b[3*e],n=b[3*e+1];e=b[3*e+2];var u=b[3*f],q=b[3*f+1];b=b[3*f+2];return.01>Math.abs(g-l)?[new v(a,1-c),new v(h,1-d),new v(k,1-e),new v(u,1-b)]:[new v(g,1-c),new v(l,1-d),new v(n,1-e),new v(q,1-b)]}};de.prototype=Object.create(F.prototype); de.prototype.constructor=de;Uc.prototype=Object.create(eb.prototype);Uc.prototype.constructor=Uc;ee.prototype=Object.create(F.prototype);ee.prototype.constructor=ee;Hb.prototype=Object.create(D.prototype);Hb.prototype.constructor=Hb;fe.prototype=Object.create(F.prototype);fe.prototype.constructor=fe;Vc.prototype=Object.create(D.prototype);Vc.prototype.constructor=Vc;ge.prototype=Object.create(F.prototype);ge.prototype.constructor=ge;Wc.prototype=Object.create(D.prototype);Wc.prototype.constructor= Wc;gc.prototype=Object.create(F.prototype);gc.prototype.constructor=gc;gc.prototype.toJSON=function(){var a=F.prototype.toJSON.call(this);return Rh(this.parameters.shapes,a)};hc.prototype=Object.create(D.prototype);hc.prototype.constructor=hc;hc.prototype.toJSON=function(){var a=D.prototype.toJSON.call(this);return Rh(this.parameters.shapes,a)};Xc.prototype=Object.create(D.prototype);Xc.prototype.constructor=Xc;ic.prototype=Object.create(F.prototype);ic.prototype.constructor=ic;qb.prototype=Object.create(D.prototype); qb.prototype.constructor=qb;he.prototype=Object.create(ic.prototype);he.prototype.constructor=he;ie.prototype=Object.create(qb.prototype);ie.prototype.constructor=ie;je.prototype=Object.create(F.prototype);je.prototype.constructor=je;Yc.prototype=Object.create(D.prototype);Yc.prototype.constructor=Yc;var oa=Object.freeze({WireframeGeometry:Mc,ParametricGeometry:Rd,ParametricBufferGeometry:Nc,TetrahedronGeometry:Td,TetrahedronBufferGeometry:Oc,OctahedronGeometry:Ud,OctahedronBufferGeometry:cc,IcosahedronGeometry:Vd, @@ -708,26 +708,26 @@ f&&void 0===f[d];)f=a[e++];if(void 0!==f){var g=f[d];if(void 0!==g)if(Array.isAr d)){for(var f=c+2;;){if(void 0===d){if(a=e)break a;else{f=b[1];a=e)break b}d=c;c=0}}for(;c>>1,ab;)--f;++f;if(0!==e||f!==d)e>=f&&(f=Math.max(f,1),e=f-1),a=this.getValueSize(),this.times=ta.arraySlice(c,e,f),this.values=ta.arraySlice(this.values,e*a,f*a);return this},validate:function(){var a=!0,b=this.getValueSize();0!==b-Math.floor(b)&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),a=!1);var c=this.times; b=this.values;var d=c.length;0===d&&(console.error("THREE.KeyframeTrack: Track is empty.",this),a=!1);for(var e=null,f=0;f!==d;f++){var g=c[f];if("number"===typeof g&&isNaN(g)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,f,g);a=!1;break}if(null!==e&&e>g){console.error("THREE.KeyframeTrack: Out of order keys.",this,f,g,e);a=!1;break}e=g}if(void 0!==b&&ta.isTypedArray(b))for(f=0,c=b.length;f!==c;++f)if(d=b[f],isNaN(d)){console.error("THREE.KeyframeTrack: Value is not a valid number.", -this,f,d);a=!1;break}return a},optimize:function(){for(var a=this.times,b=this.values,c=this.getValueSize(),d=2302===this.getInterpolation(),e=1,f=a.length-1,g=1;gNumber.EPSILON){if(0>k&&(g=b[f],l=-l,h=b[e],k=-k),!(a.yh.y))if(a.y===g.y){if(a.x===g.x)return!0}else{e=k*(a.x-g.x)-l*(a.y-g.y);if(0===e)return!0; -0>e||(d=!d)}}else if(a.y===g.y&&(h.x<=a.x&&a.x<=g.x||g.x<=a.x&&a.x<=h.x))return!0}return d}var e=pb.isClockWise,f=this.subPaths;if(0===f.length)return[];if(!0===b)return c(f);b=[];if(1===f.length){var g=f[0];var h=new Ib;h.curves=g.curves;b.push(h);return b}var l=!e(f[0].getPoints());l=a?!l:l;h=[];var k=[],n=[],u=0;k[u]=void 0;n[u]=[];for(var r=0,q=f.length;re||(d=!d)}}else if(a.y===g.y&&(h.x<=a.x&&a.x<=g.x||g.x<=a.x&&a.x<=h.x))return!0}return d}var e=pb.isClockWise,f=this.subPaths;if(0===f.length)return[];if(!0===b)return c(f);b=[];if(1===f.length){var g=f[0];var h=new Ib;h.curves=g.curves;b.push(h);return b}var l=!e(f[0].getPoints());l=a?!l:l;h=[];var k=[],n=[],u=0;k[u]=void 0;n[u]=[];for(var q=0,r=f.length;qb;b++)this.coefficients[b].copy(a[b]);return this},zero:function(){for(var a=0;9>a;a++)this.coefficients[a].set(0, 0,0);return this},getAt:function(a,b){var c=a.x,d=a.y;a=a.z;var e=this.coefficients;b.copy(e[0]).multiplyScalar(.282095);b.addScale(e[1],.488603*d);b.addScale(e[2],.488603*a);b.addScale(e[3],.488603*c);b.addScale(e[4],1.092548*c*d);b.addScale(e[5],1.092548*d*a);b.addScale(e[6],.315392*(3*a*a-1));b.addScale(e[7],1.092548*c*a);b.addScale(e[8],.546274*(c*c-d*d));return b},getIrradianceAt:function(a,b){var c=a.x,d=a.y;a=a.z;var e=this.coefficients;b.copy(e[0]).multiplyScalar(.886227);b.addScale(e[1], @@ -859,10 +859,10 @@ for(c=0;c=b){var n=b++,u=a[n];c[u.uuid]=m;a[m]=u;c[k]=n;a[n]=h;h=0;for(k=e;h!==k;++h){u=d[h];var r=u[m];u[m]=u[n];u[n]=r}}}this.nCachedObjects_=b},uncache:function(){for(var a=this._objects,b=a.length,c=this.nCachedObjects_,d=this._indicesByUUID,e=this._bindings,f=e.length,g=0,h=arguments.length;g!==h;++g){var k=arguments[g].uuid,m=d[k];if(void 0!==m)if(delete d[k],m=b){var n=b++,u=a[n];c[u.uuid]=m;a[m]=u;c[k]=n;a[n]=h;h=0;for(k=e;h!==k;++h){u=d[h];var q=u[m];u[m]=u[n];u[n]=q}}}this.nCachedObjects_=b},uncache:function(){for(var a=this._objects,b=a.length,c=this.nCachedObjects_,d=this._indicesByUUID,e=this._bindings,f=e.length,g=0,h=arguments.length;g!==h;++g){var k=arguments[g].uuid,m=d[k];if(void 0!==m)if(delete d[k],m 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n#endif"; -var lights_pars_begin = "uniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in GeometricContext geometry ) {\n\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t\tfloat shadowCameraNear;\n\t\tfloat shadowCameraFar;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tdirectLight.color = pointLight.color;\n\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\tdirectLight.visible = ( directLight.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( angleCos > spotLight.coneCos ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif"; +var lights_pars_begin = "uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in GeometricContext geometry ) {\n\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t\tfloat shadowCameraNear;\n\t\tfloat shadowCameraFar;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tdirectLight.color = pointLight.color;\n\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\tdirectLight.visible = ( directLight.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( angleCos > spotLight.coneCos ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif"; var envmap_physical_pars_fragment = "#if defined( USE_ENVMAP )\n\t#ifdef ENVMAP_MODE_REFRACTION\n\t\tuniform float refractionRatio;\n\t#endif\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, queryVec, 1.0 );\n\t\t#else\n\t\t\tvec4 envMapColor = vec4( 0.0 );\n\t\t#endif\n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t}\n\tfloat getSpecularMIPLevel( const in float roughness, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat sigma = PI * roughness * roughness / ( 1.0 + roughness );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar + log2( sigma );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t vec3 reflectVec = reflect( -viewDir, normal );\n\t\t reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t#else\n\t\t vec3 reflectVec = refract( -viewDir, normal, refractionRatio );\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( roughness, maxMIPLevel );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, queryReflectVec, roughness );\n\t\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\t\tvec2 sampleUV;\n\t\t\tsampleUV.y = asin( clamp( reflectVec.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\t\t\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0,0.0,1.0 ) );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif"; @@ -14084,7 +14084,7 @@ var lights_physical_fragment = "PhysicalMaterial material;\nmaterial.diffuseColo var lights_physical_pars_fragment = "struct PhysicalMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n#ifdef CLEARCOAT\n\tfloat clearcoat;\n\tfloat clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tvec3 sheenColor;\n#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearcoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.specularRoughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNL = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = ccDotNL * directLight.color;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tccIrradiance *= PI;\n\t\t#endif\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t\treflectedLight.directSpecular += ccIrradiance * material.clearcoat * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_Sheen(\n\t\t\tmaterial.specularRoughness,\n\t\t\tdirectLight.direction,\n\t\t\tgeometry,\n\t\t\tmaterial.sheenColor\n\t\t);\n\t#else\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.normal, material.specularColor, material.specularRoughness);\n\t#endif\n\treflectedLight.directDiffuse += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNV = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular += clearcoatRadiance * material.clearcoat * BRDF_Specular_GGX_Environment( geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t\tfloat ccDotNL = ccDotNV;\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\tfloat clearcoatInv = 1.0 - clearcoatDHR;\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\tBRDF_Specular_Multiscattering_Environment( geometry, material.specularColor, material.specularRoughness, singleScattering, multiScattering );\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\n\treflectedLight.indirectSpecular += clearcoatInv * radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}"; -var lights_fragment_begin = "\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = normalize( vViewPosition );\n#ifdef CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tdirectLight.color *= all( bvec2( pointLight.shadow, directLight.visible ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tdirectLight.color *= all( bvec2( spotLight.shadow, directLight.visible ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectLight.color *= all( bvec2( directionalLight.shadow, directLight.visible ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif"; +var lights_fragment_begin = "\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = normalize( vViewPosition );\n#ifdef CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tdirectLight.color *= all( bvec3( pointLight.shadow, directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tdirectLight.color *= all( bvec3( spotLight.shadow, directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectLight.color *= all( bvec3( directionalLight.shadow, directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif"; var lights_fragment_maps = "#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec3 lightMapIrradiance = texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getLightProbeIndirectIrradiance( geometry, maxMipLevel );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.normal, material.specularRoughness, maxMipLevel );\n\t#ifdef CLEARCOAT\n\t\tclearcoatRadiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness, maxMipLevel );\n\t#endif\n#endif"; @@ -18226,7 +18226,7 @@ function WebGLPrograms( renderer, extensions, capabilities ) { dithering: material.dithering, - shadowMapEnabled: renderer.shadowMap.enabled && object.receiveShadow && shadows.length > 0, + shadowMapEnabled: renderer.shadowMap.enabled && shadows.length > 0, shadowMapType: renderer.shadowMap.type, toneMapping: material.toneMapped ? renderer.toneMapping : NoToneMapping, @@ -24627,6 +24627,13 @@ function WebGLRenderer( parameters ) { } + if ( refreshMaterial || materialProperties.receiveShadow !== object.receiveShadow ) { + + materialProperties.receiveShadow = object.receiveShadow; + p_uniforms.setValue( _gl, 'receiveShadow', object.receiveShadow ); + + } + if ( refreshMaterial ) { p_uniforms.setValue( _gl, 'toneMappingExposure', _this.toneMappingExposure ); From 656cc03955f2bde798acb682e37ef00b2afdf890 Mon Sep 17 00:00:00 2001 From: "Mr.doob" Date: Tue, 3 Sep 2019 17:21:14 -0700 Subject: [PATCH 45/75] Updated builds. --- build/three.js | 6 ++++-- build/three.min.js | 18 +++++++++--------- build/three.module.js | 6 ++++-- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/build/three.js b/build/three.js index ca8962bf185204..cc6ff7c8040aa0 100644 --- a/build/three.js +++ b/build/three.js @@ -20709,9 +20709,11 @@ var _videoTextures = new WeakMap(); var _canvas; - // + // cordova iOS (as of 5.0) still uses UIWebView, which provides OffscreenCanvas, + // also OffscreenCanvas.getContext("webgl"), but not OffscreenCanvas.getContext("2d")! - var useOffscreenCanvas = typeof OffscreenCanvas !== 'undefined'; + var useOffscreenCanvas = typeof OffscreenCanvas !== 'undefined' + && ( new OffscreenCanvas( 1, 1 ).getContext( "2d" ) ) !== null; function createCanvas( width, height ) { diff --git a/build/three.min.js b/build/three.min.js index 514056ee294017..f845925823d0af 100644 --- a/build/three.min.js +++ b/build/three.min.js @@ -138,15 +138,15 @@ n=36012}else e.isWebGL2&&(n=33189);1026===d.format&&6402===n&&1012!==d.type&&101 c.texImage2D(3553,w,n,h.width,h.height,0,r,t,h.data);b.__maxMipLevel=z.length-1}else if(d.isDataTexture2DArray)c.texImage3D(35866,0,n,g.width,g.height,g.depth,0,r,t,g.data),b.__maxMipLevel=0;else if(d.isDataTexture3D)c.texImage3D(32879,0,n,g.width,g.height,g.depth,0,r,t,g.data),b.__maxMipLevel=0;else if(0=e.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+a+" texture units while this GPU supports only "+e.maxTextures);G+=1;return a};this.resetTextureUnits=function(){G=0};this.setTexture2D=w;this.setTexture2DArray=function(a,b){var e=d.get(a);0r;r++)h.__webglFramebuffer[r]=a.createFramebuffer();else if(h.__webglFramebuffer=a.createFramebuffer(),r)if(e.isWebGL2){h.__webglMultisampledFramebuffer=a.createFramebuffer();h.__webglColorRenderbuffer=a.createRenderbuffer();a.bindRenderbuffer(36161,h.__webglColorRenderbuffer);r=f.convert(b.texture.format);var z=f.convert(b.texture.type);r=k(r,z);z=A(b);a.renderbufferStorageMultisample(36161,z,r,b.width,b.height);a.bindFramebuffer(36160,h.__webglMultisampledFramebuffer); -a.framebufferRenderbuffer(36160,36064,36161,h.__webglColorRenderbuffer);a.bindRenderbuffer(36161,null);b.depthBuffer&&(h.__webglDepthRenderbuffer=a.createRenderbuffer(),B(h.__webglDepthRenderbuffer,b,!0));a.bindFramebuffer(36160,null)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");if(q){c.bindTexture(34067,l.__webglTexture);U(34067,b.texture,t);for(r=0;6>r;r++)v(h.__webglFramebuffer[r],b,36064,34069+r);p(b.texture,t)&&u(34067,b.texture,b.width, -b.height);c.bindTexture(34067,null)}else c.bindTexture(3553,l.__webglTexture),U(3553,b.texture,t),v(h.__webglFramebuffer,b,36064,3553),p(b.texture,t)&&u(3553,b.texture,b.width,b.height),c.bindTexture(3553,null);if(b.depthBuffer){h=d.get(b);l=!0===b.isWebGLRenderTargetCube;if(b.depthTexture){if(l)throw Error("target.depthTexture not supported in Cube render targets");if(b&&b.isWebGLRenderTargetCube)throw Error("Depth Texture with cube render targets is not supported");a.bindFramebuffer(36160,h.__webglFramebuffer); -if(!b.depthTexture||!b.depthTexture.isDepthTexture)throw Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");d.get(b.depthTexture).__webglTexture&&b.depthTexture.image.width===b.width&&b.depthTexture.image.height===b.height||(b.depthTexture.image.width=b.width,b.depthTexture.image.height=b.height,b.depthTexture.needsUpdate=!0);w(b.depthTexture,0);h=d.get(b.depthTexture).__webglTexture;if(1026===b.depthTexture.format)a.framebufferTexture2D(36160,36096,3553,h,0);else if(1027=== -b.depthTexture.format)a.framebufferTexture2D(36160,33306,3553,h,0);else throw Error("Unknown depthTexture format");}else if(l)for(h.__webglDepthbuffer=[],l=0;6>l;l++)a.bindFramebuffer(36160,h.__webglFramebuffer[l]),h.__webglDepthbuffer[l]=a.createRenderbuffer(),B(h.__webglDepthbuffer[l],b);else a.bindFramebuffer(36160,h.__webglFramebuffer),h.__webglDepthbuffer=a.createRenderbuffer(),B(h.__webglDepthbuffer,b);a.bindFramebuffer(36160,null)}};this.updateRenderTargetMipmap=function(a){var b=a.texture, -f=m(a)||e.isWebGL2;if(p(b,f)){f=a.isWebGLRenderTargetCube?34067:3553;var g=d.get(b).__webglTexture;c.bindTexture(f,g);u(f,b,a.width,a.height);c.bindTexture(f,null)}};this.updateMultisampleRenderTarget=function(b){if(b.isWebGLMultisampleRenderTarget)if(e.isWebGL2){var c=d.get(b);a.bindFramebuffer(36008,c.__webglMultisampledFramebuffer);a.bindFramebuffer(36009,c.__webglFramebuffer);c=b.width;var f=b.height,g=16384;b.depthBuffer&&(g|=256);b.stencilBuffer&&(g|=1024);a.blitFramebuffer(0,0,c,f,0,0,c,f, -g,9728)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")};this.safeSetTexture2D=function(a,b){a&&a.isWebGLRenderTarget&&(!1===I&&(console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),I=!0),a=a.texture);w(a,b)};this.safeSetTextureCube=function(a,b){a&&a.isWebGLRenderTargetCube&&(!1===C&&(console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."), +null)}function A(a){return e.isWebGL2&&a.isWebGLMultisampleRenderTarget?Math.min(e.maxSamples,a.samples):0}var Ca=new WeakMap,H,D="undefined"!==typeof OffscreenCanvas&&null!==(new OffscreenCanvas(1,1)).getContext("2d"),G=0,I=!1,C=!1;this.allocateTextureUnit=function(){var a=G;a>=e.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+a+" texture units while this GPU supports only "+e.maxTextures);G+=1;return a};this.resetTextureUnits=function(){G=0};this.setTexture2D=w;this.setTexture2DArray= +function(a,b){var e=d.get(a);0r;r++)h.__webglFramebuffer[r]=a.createFramebuffer();else if(h.__webglFramebuffer=a.createFramebuffer(),r)if(e.isWebGL2){h.__webglMultisampledFramebuffer=a.createFramebuffer();h.__webglColorRenderbuffer=a.createRenderbuffer();a.bindRenderbuffer(36161,h.__webglColorRenderbuffer);r=f.convert(b.texture.format);var z=f.convert(b.texture.type);r=k(r,z);z=A(b);a.renderbufferStorageMultisample(36161, +z,r,b.width,b.height);a.bindFramebuffer(36160,h.__webglMultisampledFramebuffer);a.framebufferRenderbuffer(36160,36064,36161,h.__webglColorRenderbuffer);a.bindRenderbuffer(36161,null);b.depthBuffer&&(h.__webglDepthRenderbuffer=a.createRenderbuffer(),B(h.__webglDepthRenderbuffer,b,!0));a.bindFramebuffer(36160,null)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");if(q){c.bindTexture(34067,l.__webglTexture);U(34067,b.texture,t);for(r=0;6>r;r++)v(h.__webglFramebuffer[r], +b,36064,34069+r);p(b.texture,t)&&u(34067,b.texture,b.width,b.height);c.bindTexture(34067,null)}else c.bindTexture(3553,l.__webglTexture),U(3553,b.texture,t),v(h.__webglFramebuffer,b,36064,3553),p(b.texture,t)&&u(3553,b.texture,b.width,b.height),c.bindTexture(3553,null);if(b.depthBuffer){h=d.get(b);l=!0===b.isWebGLRenderTargetCube;if(b.depthTexture){if(l)throw Error("target.depthTexture not supported in Cube render targets");if(b&&b.isWebGLRenderTargetCube)throw Error("Depth Texture with cube render targets is not supported"); +a.bindFramebuffer(36160,h.__webglFramebuffer);if(!b.depthTexture||!b.depthTexture.isDepthTexture)throw Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");d.get(b.depthTexture).__webglTexture&&b.depthTexture.image.width===b.width&&b.depthTexture.image.height===b.height||(b.depthTexture.image.width=b.width,b.depthTexture.image.height=b.height,b.depthTexture.needsUpdate=!0);w(b.depthTexture,0);h=d.get(b.depthTexture).__webglTexture;if(1026===b.depthTexture.format)a.framebufferTexture2D(36160, +36096,3553,h,0);else if(1027===b.depthTexture.format)a.framebufferTexture2D(36160,33306,3553,h,0);else throw Error("Unknown depthTexture format");}else if(l)for(h.__webglDepthbuffer=[],l=0;6>l;l++)a.bindFramebuffer(36160,h.__webglFramebuffer[l]),h.__webglDepthbuffer[l]=a.createRenderbuffer(),B(h.__webglDepthbuffer[l],b);else a.bindFramebuffer(36160,h.__webglFramebuffer),h.__webglDepthbuffer=a.createRenderbuffer(),B(h.__webglDepthbuffer,b);a.bindFramebuffer(36160,null)}};this.updateRenderTargetMipmap= +function(a){var b=a.texture,f=m(a)||e.isWebGL2;if(p(b,f)){f=a.isWebGLRenderTargetCube?34067:3553;var g=d.get(b).__webglTexture;c.bindTexture(f,g);u(f,b,a.width,a.height);c.bindTexture(f,null)}};this.updateMultisampleRenderTarget=function(b){if(b.isWebGLMultisampleRenderTarget)if(e.isWebGL2){var c=d.get(b);a.bindFramebuffer(36008,c.__webglMultisampledFramebuffer);a.bindFramebuffer(36009,c.__webglFramebuffer);c=b.width;var f=b.height,g=16384;b.depthBuffer&&(g|=256);b.stencilBuffer&&(g|=1024);a.blitFramebuffer(0, +0,c,f,0,0,c,f,g,9728)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")};this.safeSetTexture2D=function(a,b){a&&a.isWebGLRenderTarget&&(!1===I&&(console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),I=!0),a=a.texture);w(a,b)};this.safeSetTextureCube=function(a,b){a&&a.isWebGLRenderTargetCube&&(!1===C&&(console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."), C=!0),a=a.texture);a&&a.isCubeTexture||Array.isArray(a.image)&&6===a.image.length?y(a,b):x(a,b)}}function Dh(a,b,c){return{convert:function(a){if(1E3===a)return 10497;if(1001===a)return 33071;if(1002===a)return 33648;if(1003===a)return 9728;if(1004===a)return 9984;if(1005===a)return 9986;if(1006===a)return 9729;if(1007===a)return 9985;if(1008===a)return 9987;if(1009===a)return 5121;if(1017===a)return 32819;if(1018===a)return 32820;if(1019===a)return 33635;if(1010===a)return 5120;if(1011===a)return 5122; if(1012===a)return 5123;if(1013===a)return 5124;if(1014===a)return 5125;if(1015===a)return 5126;if(1016===a){if(c.isWebGL2)return 5131;var d=b.get("OES_texture_half_float");if(null!==d)return d.HALF_FLOAT_OES}if(1021===a)return 6406;if(1022===a)return 6407;if(1023===a)return 6408;if(1024===a)return 6409;if(1025===a)return 6410;if(1026===a)return 6402;if(1027===a)return 34041;if(1028===a)return 6403;if(100===a)return 32774;if(101===a)return 32778;if(102===a)return 32779;if(200===a)return 0;if(201=== a)return 1;if(202===a)return 768;if(203===a)return 769;if(204===a)return 770;if(205===a)return 771;if(206===a)return 772;if(207===a)return 773;if(208===a)return 774;if(209===a)return 775;if(210===a)return 776;if(33776===a||33777===a||33778===a||33779===a)if(d=b.get("WEBGL_compressed_texture_s3tc"),null!==d){if(33776===a)return d.COMPRESSED_RGB_S3TC_DXT1_EXT;if(33777===a)return d.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(33778===a)return d.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(33779===a)return d.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(35840=== diff --git a/build/three.module.js b/build/three.module.js index 2cc1f8fcad017e..48e25082c88b47 100644 --- a/build/three.module.js +++ b/build/three.module.js @@ -20696,9 +20696,11 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils, var _videoTextures = new WeakMap(); var _canvas; - // + // cordova iOS (as of 5.0) still uses UIWebView, which provides OffscreenCanvas, + // also OffscreenCanvas.getContext("webgl"), but not OffscreenCanvas.getContext("2d")! - var useOffscreenCanvas = typeof OffscreenCanvas !== 'undefined'; + var useOffscreenCanvas = typeof OffscreenCanvas !== 'undefined' + && ( new OffscreenCanvas( 1, 1 ).getContext( "2d" ) ) !== null; function createCanvas( width, height ) { From caca0a2e2e1aeb4ea9a928cdcbb9aacc1b81a8a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Fernandes=20Gon=C3=A7alves=20de=20Oliveira?= Date: Tue, 3 Sep 2019 22:06:22 -0300 Subject: [PATCH 46/75] Update OBJLoader2.html In the code in the documentation is "event.detail.loaderRootNode", but it returns a object3d as in the live example. --- docs/examples/en/loaders/OBJLoader2.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/examples/en/loaders/OBJLoader2.html b/docs/examples/en/loaders/OBJLoader2.html index 4f8f43ebc3d005..74b264efc680b0 100644 --- a/docs/examples/en/loaders/OBJLoader2.html +++ b/docs/examples/en/loaders/OBJLoader2.html @@ -25,8 +25,8 @@

Examples

var loader = new THREE.OBJLoader2(); // function called on successful load - var callbackOnLoad = function ( event ) { - scene.add( event.detail.loaderRootNode ); + var callbackOnLoad = function ( object3d ) { + scene.add( object3d ); }; // load a resource from provided URL synchronously From b19f6562cbc8b89c7ae7d0c6e476991c25b14caf Mon Sep 17 00:00:00 2001 From: Olli Etuaho Date: Wed, 4 Sep 2019 09:31:28 +0300 Subject: [PATCH 47/75] Take receiveShadow flag into account for shadowMask This fixes objects with MeshLambertMaterial that used to erroneously receive shadows. --- .../shaders/ShaderChunk/shadowmask_pars_fragment.glsl.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/renderers/shaders/ShaderChunk/shadowmask_pars_fragment.glsl.js b/src/renderers/shaders/ShaderChunk/shadowmask_pars_fragment.glsl.js index 1c4f27e1cbdfbf..4847d52845e8c9 100644 --- a/src/renderers/shaders/ShaderChunk/shadowmask_pars_fragment.glsl.js +++ b/src/renderers/shaders/ShaderChunk/shadowmask_pars_fragment.glsl.js @@ -13,7 +13,7 @@ float getShadowMask() { for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { directionalLight = directionalLights[ i ]; - shadow *= bool( directionalLight.shadow ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; + shadow *= all( bvec2( directionalLight.shadow, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; } @@ -27,7 +27,7 @@ float getShadowMask() { for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { spotLight = spotLights[ i ]; - shadow *= bool( spotLight.shadow ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0; + shadow *= all( bvec2( spotLight.shadow, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0; } @@ -41,7 +41,7 @@ float getShadowMask() { for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { pointLight = pointLights[ i ]; - shadow *= bool( pointLight.shadow ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; + shadow *= all( bvec2( pointLight.shadow, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; } From 8e15fb24e1746699c90b73e4b69aea92fbce63fe Mon Sep 17 00:00:00 2001 From: r00ster Date: Wed, 4 Sep 2019 19:24:46 +0200 Subject: [PATCH 48/75] Fix a spelling error --- docs/api/en/materials/Material.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/api/en/materials/Material.html b/docs/api/en/materials/Material.html index 4f4fba6df0f10c..fc56072ce3cf60 100644 --- a/docs/api/en/materials/Material.html +++ b/docs/api/en/materials/Material.html @@ -278,7 +278,7 @@

[property:Boolean transparent]

as transparent objects need special treatment and are rendered after non-transparent objects.
When set to true, the extent to which the material is transparent is - controlled by setting it's [page:Float opacity] property.
+ controlled by setting its [page:Float opacity] property.
Default is *false*.

From 80b6bb119dddc3f7745036fbc360434bdf94f9df Mon Sep 17 00:00:00 2001 From: Klaus Weidner Date: Thu, 8 Aug 2019 18:02:34 -0700 Subject: [PATCH 49/75] WebXR: request common reference spaces as features WebXR's requestReferenceSpace only works if the corresponding feature was requested at session creation time. For simplicity, just ask for the interesting ones as optional features, but be aware that the requestReferenceSpace call will fail if it turns out to be unavailable. ('local' is always available for immersive sessions and doesn't need to be requested separately.) --- examples/js/vr/WebVR.js | 10 +++++++++- examples/jsm/vr/WebVR.js | 11 +++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/examples/js/vr/WebVR.js b/examples/js/vr/WebVR.js index 076228143e0cf0..301e35f9b209be 100644 --- a/examples/js/vr/WebVR.js +++ b/examples/js/vr/WebVR.js @@ -99,7 +99,15 @@ THREE.WEBVR = { if ( currentSession === null ) { - navigator.xr.requestSession( 'immersive-vr' ).then( onSessionStarted ); + // WebXR's requestReferenceSpace only works if the corresponding feature + // was requested at session creation time. For simplicity, just ask for + // the interesting ones as optional features, but be aware that the + // requestReferenceSpace call will fail if it turns out to be unavailable. + // ('local' is always available for immersive sessions and doesn't need to + // be requested separately.) + + var sessionInit = { optionalFeatures: [ 'local-floor', 'bounded-floor' ] }; + navigator.xr.requestSession( 'immersive-vr', sessionInit ).then( onSessionStarted ); } else { diff --git a/examples/jsm/vr/WebVR.js b/examples/jsm/vr/WebVR.js index 1b93855157bb5a..db8ef0bcad6ad8 100644 --- a/examples/jsm/vr/WebVR.js +++ b/examples/jsm/vr/WebVR.js @@ -14,7 +14,6 @@ var WEBVR = { if ( options && options.referenceSpaceType ) { renderer.vr.setReferenceSpaceType( options.referenceSpaceType ); - } function showEnterVR( device ) { @@ -101,7 +100,15 @@ var WEBVR = { if ( currentSession === null ) { - navigator.xr.requestSession( 'immersive-vr' ).then( onSessionStarted ); + // WebXR's requestReferenceSpace only works if the corresponding feature + // was requested at session creation time. For simplicity, just ask for + // the interesting ones as optional features, but be aware that the + // requestReferenceSpace call will fail if it turns out to be unavailable. + // ('local' is always available for immersive sessions and doesn't need to + // be requested separately.) + + var sessionInit = { optionalFeatures: [ 'local-floor', 'bounded-floor' ] }; + navigator.xr.requestSession( 'immersive-vr', sessionInit ).then( onSessionStarted ); } else { From 8b898d4d3d3135d10d39a7037fc1b102a42667ed Mon Sep 17 00:00:00 2001 From: "Mr.doob" Date: Wed, 4 Sep 2019 16:30:19 -0700 Subject: [PATCH 50/75] Updated builds. --- build/three.js | 2 +- build/three.min.js | 2 +- build/three.module.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build/three.js b/build/three.js index cc6ff7c8040aa0..6ad8a582745f94 100644 --- a/build/three.js +++ b/build/three.js @@ -14162,7 +14162,7 @@ var shadowmap_vertex = "#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n#endif"; - var shadowmask_pars_fragment = "float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLight directionalLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tshadow *= bool( directionalLight.shadow ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLight spotLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tshadow *= bool( spotLight.shadow ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLight pointLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tshadow *= bool( pointLight.shadow ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#endif\n\t#endif\n\treturn shadow;\n}"; + var shadowmask_pars_fragment = "float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLight directionalLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tshadow *= all( bvec2( directionalLight.shadow, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLight spotLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tshadow *= all( bvec2( spotLight.shadow, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLight pointLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tshadow *= all( bvec2( pointLight.shadow, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#endif\n\t#endif\n\treturn shadow;\n}"; var skinbase_vertex = "#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif"; diff --git a/build/three.min.js b/build/three.min.js index f845925823d0af..75c3229d545660 100644 --- a/build/three.min.js +++ b/build/three.min.js @@ -609,7 +609,7 @@ premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn decodeHalfRGBA( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat texture2DShadowLerp( sampler2D depths, vec2 size, vec2 uv, float compare ) {\n\t\tconst vec2 offset = vec2( 0.0, 1.0 );\n\t\tvec2 texelSize = vec2( 1.0 ) / size;\n\t\tvec2 centroidUV = ( floor( uv * size - 0.5 ) + 0.5 ) * texelSize;\n\t\tfloat lb = texture2DCompare( depths, centroidUV + texelSize * offset.xx, compare );\n\t\tfloat lt = texture2DCompare( depths, centroidUV + texelSize * offset.xy, compare );\n\t\tfloat rb = texture2DCompare( depths, centroidUV + texelSize * offset.yx, compare );\n\t\tfloat rt = texture2DCompare( depths, centroidUV + texelSize * offset.yy, compare );\n\t\tvec2 f = fract( uv * size + 0.5 );\n\t\tfloat a = mix( lb, lt, f.y );\n\t\tfloat b = mix( rb, rt, f.y );\n\t\tfloat c = mix( a, b, f.x );\n\t\treturn c;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tshadow = (\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif", shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif", shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n#endif", -shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLight directionalLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tshadow *= bool( directionalLight.shadow ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLight spotLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tshadow *= bool( spotLight.shadow ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLight pointLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tshadow *= bool( pointLight.shadow ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#endif\n\t#endif\n\treturn shadow;\n}", +shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLight directionalLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tshadow *= all( bvec2( directionalLight.shadow, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLight spotLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tshadow *= all( bvec2( spotLight.shadow, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLight pointLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tshadow *= all( bvec2( pointLight.shadow, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#endif\n\t#endif\n\treturn shadow;\n}", skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform highp sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif", skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif", specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n\t#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nuniform float toneMappingWhitePoint;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\n#define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )\nvec3 Uncharted2ToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( ( color * ( 2.51 * color + 0.03 ) ) / ( color * ( 2.43 * color + 0.59 ) + 0.14 ) );\n}", diff --git a/build/three.module.js b/build/three.module.js index 48e25082c88b47..9267876c175740 100644 --- a/build/three.module.js +++ b/build/three.module.js @@ -14148,7 +14148,7 @@ var shadowmap_pars_vertex = "#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > var shadowmap_vertex = "#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n#endif"; -var shadowmask_pars_fragment = "float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLight directionalLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tshadow *= bool( directionalLight.shadow ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLight spotLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tshadow *= bool( spotLight.shadow ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLight pointLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tshadow *= bool( pointLight.shadow ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#endif\n\t#endif\n\treturn shadow;\n}"; +var shadowmask_pars_fragment = "float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLight directionalLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tshadow *= all( bvec2( directionalLight.shadow, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLight spotLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tshadow *= all( bvec2( spotLight.shadow, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLight pointLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tshadow *= all( bvec2( pointLight.shadow, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#endif\n\t#endif\n\treturn shadow;\n}"; var skinbase_vertex = "#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif"; From 4ac659753ea2069ae35195f247a664adf653772a Mon Sep 17 00:00:00 2001 From: Fabrizio Cacicia Date: Thu, 5 Sep 2019 04:01:12 +0200 Subject: [PATCH 51/75] Update Loading-3D-models.html To add another troubleshooting step that could be useful. The problem I had in order to make the model visible was that it was hidden in the dark. Once I added and positioned a light source, the model appeared. Maybe someone else could have the same problem and could solve it more quickly than me. --- docs/manual/en/introduction/Loading-3D-models.html | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/manual/en/introduction/Loading-3D-models.html b/docs/manual/en/introduction/Loading-3D-models.html index 723d90df12a0f5..e965d80a67cda4 100644 --- a/docs/manual/en/introduction/Loading-3D-models.html +++ b/docs/manual/en/introduction/Loading-3D-models.html @@ -149,6 +149,9 @@

Troubleshooting

scaled differently, and large models may not appear if the camera is inside the model. +
  • + Try to add and position a light source. The model may be hidden in the dark. +
  • Look for failed texture requests in the network tab, like C:\\Path\To\Model\texture.jpg. Use paths relative to your From f0a4e02cb7f2003229c9d1b7af2723935b0643a7 Mon Sep 17 00:00:00 2001 From: "Mr.doob" Date: Wed, 4 Sep 2019 21:29:05 -0700 Subject: [PATCH 52/75] GLTFExporter: Clean up. --- examples/js/exporters/GLTFExporter.js | 8 ++++---- examples/jsm/exporters/GLTFExporter.js | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/examples/js/exporters/GLTFExporter.js b/examples/js/exporters/GLTFExporter.js index 1f85c2456b7c4a..a2f37404f21770 100644 --- a/examples/js/exporters/GLTFExporter.js +++ b/examples/js/exporters/GLTFExporter.js @@ -961,11 +961,11 @@ THREE.GLTFExporter.prototype = { // pbrSpecularGlossiness diffuse, specular and glossiness factor if ( material.isGLTFSpecularGlossinessMaterial ) { - + if ( gltfMaterial.pbrMetallicRoughness.baseColorFactor ) { gltfMaterial.extensions.KHR_materials_pbrSpecularGlossiness.diffuseFactor = gltfMaterial.pbrMetallicRoughness.baseColorFactor; - + } var specularFactor = [ 1, 1, 1 ]; @@ -973,7 +973,7 @@ THREE.GLTFExporter.prototype = { gltfMaterial.extensions.KHR_materials_pbrSpecularGlossiness.specularFactor = specularFactor; gltfMaterial.extensions.KHR_materials_pbrSpecularGlossiness.glossinessFactor = material.glossiness; - + } // pbrMetallicRoughness.metallicRoughnessTexture @@ -1006,7 +1006,7 @@ THREE.GLTFExporter.prototype = { } gltfMaterial.pbrMetallicRoughness.baseColorTexture = baseColorMapDef; - + } // pbrSpecularGlossiness specular map diff --git a/examples/jsm/exporters/GLTFExporter.js b/examples/jsm/exporters/GLTFExporter.js index 46d0e18a578ae0..7fa3dc28cbfd60 100644 --- a/examples/jsm/exporters/GLTFExporter.js +++ b/examples/jsm/exporters/GLTFExporter.js @@ -985,11 +985,11 @@ GLTFExporter.prototype = { // pbrSpecularGlossiness diffuse, specular and glossiness factor if ( material.isGLTFSpecularGlossinessMaterial ) { - + if ( gltfMaterial.pbrMetallicRoughness.baseColorFactor ) { gltfMaterial.extensions.KHR_materials_pbrSpecularGlossiness.diffuseFactor = gltfMaterial.pbrMetallicRoughness.baseColorFactor; - + } var specularFactor = [ 1, 1, 1 ]; @@ -997,7 +997,7 @@ GLTFExporter.prototype = { gltfMaterial.extensions.KHR_materials_pbrSpecularGlossiness.specularFactor = specularFactor; gltfMaterial.extensions.KHR_materials_pbrSpecularGlossiness.glossinessFactor = material.glossiness; - + } // pbrMetallicRoughness.metallicRoughnessTexture @@ -1030,7 +1030,7 @@ GLTFExporter.prototype = { } gltfMaterial.pbrMetallicRoughness.baseColorTexture = baseColorMapDef; - + } // pbrSpecularGlossiness specular map From 71ec3b2ea2409a00c946f5d6aa22fe9babace96d Mon Sep 17 00:00:00 2001 From: "Mr.doob" Date: Wed, 4 Sep 2019 21:38:08 -0700 Subject: [PATCH 53/75] GLTFExporter: Fixed alphaMode handling --- examples/js/exporters/GLTFExporter.js | 10 ++++++---- examples/jsm/exporters/GLTFExporter.js | 10 ++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/examples/js/exporters/GLTFExporter.js b/examples/js/exporters/GLTFExporter.js index a2f37404f21770..5cbb3eaf1a1e0d 100644 --- a/examples/js/exporters/GLTFExporter.js +++ b/examples/js/exporters/GLTFExporter.js @@ -1088,13 +1088,15 @@ THREE.GLTFExporter.prototype = { } // alphaMode - if ( material.transparent || material.alphaTest > 0.0 ) { + if ( material.transparent ) { - gltfMaterial.alphaMode = material.opacity < 1.0 ? 'BLEND' : 'MASK'; + gltfMaterial.alphaMode = 'BLEND'; - // Write alphaCutoff if it's non-zero and different from the default (0.5). - if ( material.alphaTest > 0.0 && material.alphaTest !== 0.5 ) { + } else { + + if ( material.alphaTest > 0.0 ) { + gltfMaterial.alphaMode = 'MASK'; gltfMaterial.alphaCutoff = material.alphaTest; } diff --git a/examples/jsm/exporters/GLTFExporter.js b/examples/jsm/exporters/GLTFExporter.js index 7fa3dc28cbfd60..7aa28926820a6b 100644 --- a/examples/jsm/exporters/GLTFExporter.js +++ b/examples/jsm/exporters/GLTFExporter.js @@ -1112,13 +1112,15 @@ GLTFExporter.prototype = { } // alphaMode - if ( material.transparent || material.alphaTest > 0.0 ) { + if ( material.transparent ) { - gltfMaterial.alphaMode = material.opacity < 1.0 ? 'BLEND' : 'MASK'; + gltfMaterial.alphaMode = 'BLEND'; - // Write alphaCutoff if it's non-zero and different from the default (0.5). - if ( material.alphaTest > 0.0 && material.alphaTest !== 0.5 ) { + } else { + + if ( material.alphaTest > 0.0 ) { + gltfMaterial.alphaMode = 'MASK'; gltfMaterial.alphaCutoff = material.alphaTest; } From 8ff9b416a3f3c884d2c9e519bf8e3b7908fbed32 Mon Sep 17 00:00:00 2001 From: Mugen87 Date: Thu, 5 Sep 2019 12:55:41 +0200 Subject: [PATCH 54/75] Loader: Remove Handlers. --- docs/api/en/loaders/Loader.html | 25 ----------- .../en/loaders/managers/LoadingManager.html | 24 ++++++++++- docs/api/zh/loaders/Loader.html | 25 ----------- .../zh/loaders/managers/LoadingManager.html | 23 ++++++++++ examples/js/loaders/FBXLoader.js | 9 ++-- examples/js/loaders/GLTFLoader.js | 2 +- examples/js/loaders/MMDLoader.js | 2 +- examples/js/loaders/MTLLoader.js | 2 +- .../js/loaders/deprecated/LegacyGLTFLoader.js | 2 +- .../js/loaders/deprecated/LegacyJSONLoader.js | 32 +++++++------- examples/jsm/loaders/FBXLoader.js | 9 ++-- examples/jsm/loaders/GLTFLoader.js | 2 +- examples/jsm/loaders/MMDLoader.js | 2 +- examples/jsm/loaders/MTLLoader.js | 2 +- .../loaders/deprecated/LegacyGLTFLoader.js | 2 +- .../loaders/deprecated/LegacyJSONLoader.js | 32 +++++++------- examples/webgl_loader_obj_mtl.html | 7 +-- src/Three.Legacy.js | 16 +++++++ src/loaders/Loader.d.ts | 9 ---- src/loaders/Loader.js | 36 ---------------- src/loaders/LoadingManager.d.ts | 8 +++- src/loaders/LoadingManager.js | 43 +++++++++++++++++++ 22 files changed, 166 insertions(+), 148 deletions(-) diff --git a/docs/api/en/loaders/Loader.html b/docs/api/en/loaders/Loader.html index b03e490fce1417..c070231c5bfd93 100644 --- a/docs/api/en/loaders/Loader.html +++ b/docs/api/en/loaders/Loader.html @@ -77,31 +77,6 @@

    [method:Loader setResourcePath]( [param:String resourcePath] )

    [page:String resourcePath] — Set the base path for dependent resources like textures.

    -

    Handlers

    - -

    - *[name].Handlers* is a special object normally used by other loaders like [page:GLTFLoader] or [page:MTLLoader]. It provides an - API that allows the definition of special mappings: What loaders should be used in order to load specific files. A typical use case - is to overwrite the default loader for textures.

    - - Note: It's only possible to use *[name].Handlers* if the respective loader support the usage. -

    - -

    [method:null add]( [param:Object regex], [param:Loader loader] )

    -

    - [page:Object regex] — A regular expression.
    - [page:Loader loader] — The loader. -

    - Registers a loader with the given regular expression. -

    - -

    [method:null get]( [param:String file] )

    -

    - [page:String file] — The file path. -

    - Can be used to retrieve the registered loader for the given file path. -

    -

    Source

    diff --git a/docs/api/en/loaders/managers/LoadingManager.html b/docs/api/en/loaders/managers/LoadingManager.html index 034baa13a21c34..609da98e74a7af 100644 --- a/docs/api/en/loaders/managers/LoadingManager.html +++ b/docs/api/en/loaders/managers/LoadingManager.html @@ -198,7 +198,6 @@

    [method:null itemEnd]( [param:String url] )

    This should be called by any loader using the manager when the loader ended loading an url.

    -

    [method:null itemError]( [param:String url] )

    [page:String url] — the loaded url

    @@ -206,6 +205,29 @@

    [method:null itemError]( [param:String url] )

    This should be called by any loader using the manager when the loader errors loading an url.

    +

    [method:LoadingManager addHandler]( [param:Object regex], [param:Loader loader] )

    +

    + [page:Object regex] — A regular expression.
    + [page:Loader loader] — The loader. +

    + Registers a loader with the given regular expression. Can be used to define what loader should be used in + order to load specific files. A typical use case is to overwrite the default loader for textures. +

    + +

    [method:LoadingManager removeHandler]( [param:Object regex] )

    +

    + [page:Object regex] — A regular expression. +

    + Removes the loader for the given regular expression. +

    + +

    [method:null getHandler]( [param:String file] )

    +

    + [page:String file] — The file path. +

    + Can be used to retrieve the registered loader for the given file path. +

    +

    Source

    [link:https://github.com/mrdoob/three.js/blob/master/src/loaders/LoadingManager.js src/loaders/LoadingManager.js] diff --git a/docs/api/zh/loaders/Loader.html b/docs/api/zh/loaders/Loader.html index 3aa0eb57c35888..1ebb3fe4825a77 100644 --- a/docs/api/zh/loaders/Loader.html +++ b/docs/api/zh/loaders/Loader.html @@ -77,31 +77,6 @@

    [method:Loader setResourcePath]( [param:String resourcePath] )

    [page:String resourcePath] — Set the base path for dependent resources like textures.

    -

    Handlers

    - -

    - *[name].Handlers* is a special object normally used by other loaders like [page:GLTFLoader] or [page:MTLLoader]. It provides an - API that allows the definition of special mappings: What loaders should be used in order to load specific files. A typical use case - is to overwrite the default loader for textures.

    - - Note: It's only possible to use *[name].Handlers* if the respective loader support the usage. -

    - -

    [method:null add]( [param:Object regex], [param:Loader loader] )

    -

    - [page:Object regex] — A regular expression.
    - [page:Loader loader] — The loader. -

    - Registers a loader with the given regular expression. -

    - -

    [method:null get]( [param:String file] )

    -

    - [page:String file] — The file path. -

    - Can be used to retrieve the registered loader for the given file path. -

    -

    Source

    diff --git a/docs/api/zh/loaders/managers/LoadingManager.html b/docs/api/zh/loaders/managers/LoadingManager.html index eaee4ce746a409..a93a614e3e4df7 100644 --- a/docs/api/zh/loaders/managers/LoadingManager.html +++ b/docs/api/zh/loaders/managers/LoadingManager.html @@ -202,6 +202,29 @@

    [method:null itemError]( [param:String url] )

    任何使用管理器的加载器都会调用此方法, 当加载器出现加载错误时。

    +

    [method:LoadingManager addHandler]( [param:Object regex], [param:Loader loader] )

    +

    + [page:Object regex] — A regular expression.
    + [page:Loader loader] — The loader. +

    + Registers a loader with the given regular expression. Can be used to define what loader should be used in + order to load specific files. A typical use case is to overwrite the default loader for textures. +

    + +

    [method:LoadingManager removeHandler]( [param:Object regex] )

    +

    + [page:Object regex] — A regular expression. +

    + Removes the loader for the given regular expression. +

    + +

    [method:null getHandler]( [param:String file] )

    +

    + [page:String file] — The file path. +

    + Can be used to retrieve the registered loader for the given file path. +

    +

    [link:https://github.com/mrdoob/three.js/blob/master/src/loaders/LoadingManager.js src/loaders/LoadingManager.js] diff --git a/examples/js/loaders/FBXLoader.js b/examples/js/loaders/FBXLoader.js index 4257592b2704f9..5ad6e4a62094de 100644 --- a/examples/js/loaders/FBXLoader.js +++ b/examples/js/loaders/FBXLoader.js @@ -97,16 +97,17 @@ THREE.FBXLoader = ( function () { var textureLoader = new THREE.TextureLoader( this.manager ).setPath( this.resourcePath || path ).setCrossOrigin( this.crossOrigin ); - return new FBXTreeParser( textureLoader ).parse( fbxTree ); + return new FBXTreeParser( textureLoader, this.manager ).parse( fbxTree ); } } ); // Parse the FBXTree object returned by the BinaryParser or TextParser and return a THREE.Group - function FBXTreeParser( textureLoader ) { + function FBXTreeParser( textureLoader, manager ) { this.textureLoader = textureLoader; + this.manager = manager; } @@ -265,7 +266,7 @@ THREE.FBXLoader = ( function () { case 'tga': - if ( THREE.Loader.Handlers.get( '.tga' ) === null ) { + if ( this.manager.getHandler( '.tga' ) === null ) { console.warn( 'FBXLoader: TGA loader not found, skipping ', fileName ); @@ -378,7 +379,7 @@ THREE.FBXLoader = ( function () { if ( extension === 'tga' ) { - var loader = THREE.Loader.Handlers.get( '.tga' ); + var loader = this.manager.getHandler( '.tga' ); if ( loader === null ) { diff --git a/examples/js/loaders/GLTFLoader.js b/examples/js/loaders/GLTFLoader.js index bd8c0c86fb95a1..31f36a87c70173 100644 --- a/examples/js/loaders/GLTFLoader.js +++ b/examples/js/loaders/GLTFLoader.js @@ -1986,7 +1986,7 @@ THREE.GLTFLoader = ( function () { // Load Texture resource. - var loader = THREE.Loader.Handlers.get( sourceURI ); + var loader = options.manager.getHandler( sourceURI ); if ( ! loader ) { diff --git a/examples/js/loaders/MMDLoader.js b/examples/js/loaders/MMDLoader.js index 6ade921f8659e2..fc32114206d58f 100644 --- a/examples/js/loaders/MMDLoader.js +++ b/examples/js/loaders/MMDLoader.js @@ -1305,7 +1305,7 @@ THREE.MMDLoader = ( function () { if ( textures[ fullPath ] !== undefined ) return textures[ fullPath ]; - var loader = THREE.Loader.Handlers.get( fullPath ); + var loader = this.manager.getHandler( fullPath ); if ( loader === null ) { diff --git a/examples/js/loaders/MTLLoader.js b/examples/js/loaders/MTLLoader.js index 4620dfa95d0c7f..24a7726065138f 100644 --- a/examples/js/loaders/MTLLoader.js +++ b/examples/js/loaders/MTLLoader.js @@ -510,8 +510,8 @@ THREE.MTLLoader.MaterialCreator.prototype = { loadTexture: function ( url, mapping, onLoad, onProgress, onError ) { var texture; - var loader = THREE.Loader.Handlers.get( url ); var manager = ( this.manager !== undefined ) ? this.manager : THREE.DefaultLoadingManager; + var loader = manager.getHandler( url ); if ( loader === null ) { diff --git a/examples/js/loaders/deprecated/LegacyGLTFLoader.js b/examples/js/loaders/deprecated/LegacyGLTFLoader.js index ee9bbe8793beec..f0e397bbaa4da3 100644 --- a/examples/js/loaders/deprecated/LegacyGLTFLoader.js +++ b/examples/js/loaders/deprecated/LegacyGLTFLoader.js @@ -1079,7 +1079,7 @@ THREE.LegacyGLTFLoader = ( function () { } - var textureLoader = THREE.Loader.Handlers.get( sourceUri ); + var textureLoader = options.manager.getHanlder( sourceUri ); if ( textureLoader === null ) { diff --git a/examples/js/loaders/deprecated/LegacyJSONLoader.js b/examples/js/loaders/deprecated/LegacyJSONLoader.js index 713cf4658d5f2a..a7e268e80665b3 100644 --- a/examples/js/loaders/deprecated/LegacyJSONLoader.js +++ b/examples/js/loaders/deprecated/LegacyJSONLoader.js @@ -77,13 +77,13 @@ THREE.LegacyJSONLoader = ( function () { var _textureLoader = new THREE.TextureLoader(); var _materialLoader = new THREE.MaterialLoader(); - function initMaterials( materials, texturePath, crossOrigin ) { + function initMaterials( materials, texturePath, crossOrigin, manager ) { var array = []; for ( var i = 0; i < materials.length; ++ i ) { - array[ i ] = createMaterial( materials[ i ], texturePath, crossOrigin ); + array[ i ] = createMaterial( materials[ i ], texturePath, crossOrigin, manager ); } @@ -91,7 +91,7 @@ THREE.LegacyJSONLoader = ( function () { } - function createMaterial( m, texturePath, crossOrigin ) { + function createMaterial( m, texturePath, crossOrigin, manager ) { // convert from old material format @@ -143,7 +143,7 @@ THREE.LegacyJSONLoader = ( function () { if ( value.toLowerCase() === 'standard' ) json.type = 'MeshStandardMaterial'; break; case 'mapDiffuse': - json.map = loadTexture( value, m.mapDiffuseRepeat, m.mapDiffuseOffset, m.mapDiffuseWrap, m.mapDiffuseAnisotropy, textures, texturePath, crossOrigin ); + json.map = loadTexture( value, m.mapDiffuseRepeat, m.mapDiffuseOffset, m.mapDiffuseWrap, m.mapDiffuseAnisotropy, textures, texturePath, crossOrigin, manager ); break; case 'mapDiffuseRepeat': case 'mapDiffuseOffset': @@ -151,7 +151,7 @@ THREE.LegacyJSONLoader = ( function () { case 'mapDiffuseAnisotropy': break; case 'mapEmissive': - json.emissiveMap = loadTexture( value, m.mapEmissiveRepeat, m.mapEmissiveOffset, m.mapEmissiveWrap, m.mapEmissiveAnisotropy, textures, texturePath, crossOrigin ); + json.emissiveMap = loadTexture( value, m.mapEmissiveRepeat, m.mapEmissiveOffset, m.mapEmissiveWrap, m.mapEmissiveAnisotropy, textures, texturePath, crossOrigin, manager ); break; case 'mapEmissiveRepeat': case 'mapEmissiveOffset': @@ -159,7 +159,7 @@ THREE.LegacyJSONLoader = ( function () { case 'mapEmissiveAnisotropy': break; case 'mapLight': - json.lightMap = loadTexture( value, m.mapLightRepeat, m.mapLightOffset, m.mapLightWrap, m.mapLightAnisotropy, textures, texturePath, crossOrigin ); + json.lightMap = loadTexture( value, m.mapLightRepeat, m.mapLightOffset, m.mapLightWrap, m.mapLightAnisotropy, textures, texturePath, crossOrigin, manager ); break; case 'mapLightRepeat': case 'mapLightOffset': @@ -167,7 +167,7 @@ THREE.LegacyJSONLoader = ( function () { case 'mapLightAnisotropy': break; case 'mapAO': - json.aoMap = loadTexture( value, m.mapAORepeat, m.mapAOOffset, m.mapAOWrap, m.mapAOAnisotropy, textures, texturePath, crossOrigin ); + json.aoMap = loadTexture( value, m.mapAORepeat, m.mapAOOffset, m.mapAOWrap, m.mapAOAnisotropy, textures, texturePath, crossOrigin, manager ); break; case 'mapAORepeat': case 'mapAOOffset': @@ -175,7 +175,7 @@ THREE.LegacyJSONLoader = ( function () { case 'mapAOAnisotropy': break; case 'mapBump': - json.bumpMap = loadTexture( value, m.mapBumpRepeat, m.mapBumpOffset, m.mapBumpWrap, m.mapBumpAnisotropy, textures, texturePath, crossOrigin ); + json.bumpMap = loadTexture( value, m.mapBumpRepeat, m.mapBumpOffset, m.mapBumpWrap, m.mapBumpAnisotropy, textures, texturePath, crossOrigin, manager ); break; case 'mapBumpScale': json.bumpScale = value; @@ -186,7 +186,7 @@ THREE.LegacyJSONLoader = ( function () { case 'mapBumpAnisotropy': break; case 'mapNormal': - json.normalMap = loadTexture( value, m.mapNormalRepeat, m.mapNormalOffset, m.mapNormalWrap, m.mapNormalAnisotropy, textures, texturePath, crossOrigin ); + json.normalMap = loadTexture( value, m.mapNormalRepeat, m.mapNormalOffset, m.mapNormalWrap, m.mapNormalAnisotropy, textures, texturePath, crossOrigin, manager ); break; case 'mapNormalFactor': json.normalScale = value; @@ -197,7 +197,7 @@ THREE.LegacyJSONLoader = ( function () { case 'mapNormalAnisotropy': break; case 'mapSpecular': - json.specularMap = loadTexture( value, m.mapSpecularRepeat, m.mapSpecularOffset, m.mapSpecularWrap, m.mapSpecularAnisotropy, textures, texturePath, crossOrigin ); + json.specularMap = loadTexture( value, m.mapSpecularRepeat, m.mapSpecularOffset, m.mapSpecularWrap, m.mapSpecularAnisotropy, textures, texturePath, crossOrigin, manager ); break; case 'mapSpecularRepeat': case 'mapSpecularOffset': @@ -205,7 +205,7 @@ THREE.LegacyJSONLoader = ( function () { case 'mapSpecularAnisotropy': break; case 'mapMetalness': - json.metalnessMap = loadTexture( value, m.mapMetalnessRepeat, m.mapMetalnessOffset, m.mapMetalnessWrap, m.mapMetalnessAnisotropy, textures, texturePath, crossOrigin ); + json.metalnessMap = loadTexture( value, m.mapMetalnessRepeat, m.mapMetalnessOffset, m.mapMetalnessWrap, m.mapMetalnessAnisotropy, textures, texturePath, crossOrigin, manager ); break; case 'mapMetalnessRepeat': case 'mapMetalnessOffset': @@ -213,7 +213,7 @@ THREE.LegacyJSONLoader = ( function () { case 'mapMetalnessAnisotropy': break; case 'mapRoughness': - json.roughnessMap = loadTexture( value, m.mapRoughnessRepeat, m.mapRoughnessOffset, m.mapRoughnessWrap, m.mapRoughnessAnisotropy, textures, texturePath, crossOrigin ); + json.roughnessMap = loadTexture( value, m.mapRoughnessRepeat, m.mapRoughnessOffset, m.mapRoughnessWrap, m.mapRoughnessAnisotropy, textures, texturePath, crossOrigin, manager ); break; case 'mapRoughnessRepeat': case 'mapRoughnessOffset': @@ -221,7 +221,7 @@ THREE.LegacyJSONLoader = ( function () { case 'mapRoughnessAnisotropy': break; case 'mapAlpha': - json.alphaMap = loadTexture( value, m.mapAlphaRepeat, m.mapAlphaOffset, m.mapAlphaWrap, m.mapAlphaAnisotropy, textures, texturePath, crossOrigin ); + json.alphaMap = loadTexture( value, m.mapAlphaRepeat, m.mapAlphaOffset, m.mapAlphaWrap, m.mapAlphaAnisotropy, textures, texturePath, crossOrigin, manager ); break; case 'mapAlphaRepeat': case 'mapAlphaOffset': @@ -271,10 +271,10 @@ THREE.LegacyJSONLoader = ( function () { } - function loadTexture( path, repeat, offset, wrap, anisotropy, textures, texturePath, crossOrigin ) { + function loadTexture( path, repeat, offset, wrap, anisotropy, textures, texturePath, crossOrigin, manager ) { var fullPath = texturePath + path; - var loader = THREE.Loader.Handlers.get( fullPath ); + var loader = manager.getHandler( fullPath ); var texture; @@ -804,7 +804,7 @@ THREE.LegacyJSONLoader = ( function () { } else { - var materials = initMaterials( json.materials, this.resourcePath || path, this.crossOrigin ); + var materials = initMaterials( json.materials, this.resourcePath || path, this.crossOrigin, this.manager ); return { geometry: geometry, materials: materials }; diff --git a/examples/jsm/loaders/FBXLoader.js b/examples/jsm/loaders/FBXLoader.js index 8e5d8d779aff51..424fc16f289ad0 100644 --- a/examples/jsm/loaders/FBXLoader.js +++ b/examples/jsm/loaders/FBXLoader.js @@ -145,16 +145,17 @@ var FBXLoader = ( function () { var textureLoader = new TextureLoader( this.manager ).setPath( this.resourcePath || path ).setCrossOrigin( this.crossOrigin ); - return new FBXTreeParser( textureLoader ).parse( fbxTree ); + return new FBXTreeParser( textureLoader, this.manager ).parse( fbxTree ); } } ); // Parse the FBXTree object returned by the BinaryParser or TextParser and return a Group - function FBXTreeParser( textureLoader ) { + function FBXTreeParser( textureLoader, manager ) { this.textureLoader = textureLoader; + this.manager = manager; } @@ -313,7 +314,7 @@ var FBXLoader = ( function () { case 'tga': - if ( Loader.Handlers.get( '.tga' ) === null ) { + if ( this.manager.getHandler( '.tga' ) === null ) { console.warn( 'FBXLoader: TGA loader not found, skipping ', fileName ); @@ -426,7 +427,7 @@ var FBXLoader = ( function () { if ( extension === 'tga' ) { - var loader = Loader.Handlers.get( '.tga' ); + var loader = this.manager.getHandler( '.tga' ); if ( loader === null ) { diff --git a/examples/jsm/loaders/GLTFLoader.js b/examples/jsm/loaders/GLTFLoader.js index adf5cddce42126..5189804a9d0348 100644 --- a/examples/jsm/loaders/GLTFLoader.js +++ b/examples/jsm/loaders/GLTFLoader.js @@ -2050,7 +2050,7 @@ var GLTFLoader = ( function () { // Load Texture resource. - var loader = Loader.Handlers.get( sourceURI ); + var loader = options.manager.getHandler( sourceURI ); if ( ! loader ) { diff --git a/examples/jsm/loaders/MMDLoader.js b/examples/jsm/loaders/MMDLoader.js index 629196c7696649..d81196fd7780a6 100644 --- a/examples/jsm/loaders/MMDLoader.js +++ b/examples/jsm/loaders/MMDLoader.js @@ -1341,7 +1341,7 @@ var MMDLoader = ( function () { if ( textures[ fullPath ] !== undefined ) return textures[ fullPath ]; - var loader = Loader.Handlers.get( fullPath ); + var loader = this.manager.getHandler( fullPath ); if ( loader === null ) { diff --git a/examples/jsm/loaders/MTLLoader.js b/examples/jsm/loaders/MTLLoader.js index 6d79a0e363060a..6041d426bc5e85 100644 --- a/examples/jsm/loaders/MTLLoader.js +++ b/examples/jsm/loaders/MTLLoader.js @@ -523,8 +523,8 @@ MTLLoader.MaterialCreator.prototype = { loadTexture: function ( url, mapping, onLoad, onProgress, onError ) { var texture; - var loader = Loader.Handlers.get( url ); var manager = ( this.manager !== undefined ) ? this.manager : DefaultLoadingManager; + var loader = manager.getHandler( url ); if ( loader === null ) { diff --git a/examples/jsm/loaders/deprecated/LegacyGLTFLoader.js b/examples/jsm/loaders/deprecated/LegacyGLTFLoader.js index 5c59cae59c5255..9814986a36bf75 100644 --- a/examples/jsm/loaders/deprecated/LegacyGLTFLoader.js +++ b/examples/jsm/loaders/deprecated/LegacyGLTFLoader.js @@ -1169,7 +1169,7 @@ var LegacyGLTFLoader = ( function () { } - var textureLoader = Loader.Handlers.get( sourceUri ); + var textureLoader = options.manager.getHanlder( sourceUri ); if ( textureLoader === null ) { diff --git a/examples/jsm/loaders/deprecated/LegacyJSONLoader.js b/examples/jsm/loaders/deprecated/LegacyJSONLoader.js index def0ab0ff4c3ee..06fe2ecb8cd0ef 100644 --- a/examples/jsm/loaders/deprecated/LegacyJSONLoader.js +++ b/examples/jsm/loaders/deprecated/LegacyJSONLoader.js @@ -105,13 +105,13 @@ var LegacyJSONLoader = ( function () { var _textureLoader = new TextureLoader(); var _materialLoader = new MaterialLoader(); - function initMaterials( materials, texturePath, crossOrigin ) { + function initMaterials( materials, texturePath, crossOrigin, manager ) { var array = []; for ( var i = 0; i < materials.length; ++ i ) { - array[ i ] = createMaterial( materials[ i ], texturePath, crossOrigin ); + array[ i ] = createMaterial( materials[ i ], texturePath, crossOrigin, manager ); } @@ -119,7 +119,7 @@ var LegacyJSONLoader = ( function () { } - function createMaterial( m, texturePath, crossOrigin ) { + function createMaterial( m, texturePath, crossOrigin, manager ) { // convert from old material format @@ -171,7 +171,7 @@ var LegacyJSONLoader = ( function () { if ( value.toLowerCase() === 'standard' ) json.type = 'MeshStandardMaterial'; break; case 'mapDiffuse': - json.map = loadTexture( value, m.mapDiffuseRepeat, m.mapDiffuseOffset, m.mapDiffuseWrap, m.mapDiffuseAnisotropy, textures, texturePath, crossOrigin ); + json.map = loadTexture( value, m.mapDiffuseRepeat, m.mapDiffuseOffset, m.mapDiffuseWrap, m.mapDiffuseAnisotropy, textures, texturePath, crossOrigin, manager ); break; case 'mapDiffuseRepeat': case 'mapDiffuseOffset': @@ -179,7 +179,7 @@ var LegacyJSONLoader = ( function () { case 'mapDiffuseAnisotropy': break; case 'mapEmissive': - json.emissiveMap = loadTexture( value, m.mapEmissiveRepeat, m.mapEmissiveOffset, m.mapEmissiveWrap, m.mapEmissiveAnisotropy, textures, texturePath, crossOrigin ); + json.emissiveMap = loadTexture( value, m.mapEmissiveRepeat, m.mapEmissiveOffset, m.mapEmissiveWrap, m.mapEmissiveAnisotropy, textures, texturePath, crossOrigin, manager ); break; case 'mapEmissiveRepeat': case 'mapEmissiveOffset': @@ -187,7 +187,7 @@ var LegacyJSONLoader = ( function () { case 'mapEmissiveAnisotropy': break; case 'mapLight': - json.lightMap = loadTexture( value, m.mapLightRepeat, m.mapLightOffset, m.mapLightWrap, m.mapLightAnisotropy, textures, texturePath, crossOrigin ); + json.lightMap = loadTexture( value, m.mapLightRepeat, m.mapLightOffset, m.mapLightWrap, m.mapLightAnisotropy, textures, texturePath, crossOrigin, manager ); break; case 'mapLightRepeat': case 'mapLightOffset': @@ -195,7 +195,7 @@ var LegacyJSONLoader = ( function () { case 'mapLightAnisotropy': break; case 'mapAO': - json.aoMap = loadTexture( value, m.mapAORepeat, m.mapAOOffset, m.mapAOWrap, m.mapAOAnisotropy, textures, texturePath, crossOrigin ); + json.aoMap = loadTexture( value, m.mapAORepeat, m.mapAOOffset, m.mapAOWrap, m.mapAOAnisotropy, textures, texturePath, crossOrigin, manager ); break; case 'mapAORepeat': case 'mapAOOffset': @@ -203,7 +203,7 @@ var LegacyJSONLoader = ( function () { case 'mapAOAnisotropy': break; case 'mapBump': - json.bumpMap = loadTexture( value, m.mapBumpRepeat, m.mapBumpOffset, m.mapBumpWrap, m.mapBumpAnisotropy, textures, texturePath, crossOrigin ); + json.bumpMap = loadTexture( value, m.mapBumpRepeat, m.mapBumpOffset, m.mapBumpWrap, m.mapBumpAnisotropy, textures, texturePath, crossOrigin, manager ); break; case 'mapBumpScale': json.bumpScale = value; @@ -214,7 +214,7 @@ var LegacyJSONLoader = ( function () { case 'mapBumpAnisotropy': break; case 'mapNormal': - json.normalMap = loadTexture( value, m.mapNormalRepeat, m.mapNormalOffset, m.mapNormalWrap, m.mapNormalAnisotropy, textures, texturePath, crossOrigin ); + json.normalMap = loadTexture( value, m.mapNormalRepeat, m.mapNormalOffset, m.mapNormalWrap, m.mapNormalAnisotropy, textures, texturePath, crossOrigin, manager ); break; case 'mapNormalFactor': json.normalScale = value; @@ -225,7 +225,7 @@ var LegacyJSONLoader = ( function () { case 'mapNormalAnisotropy': break; case 'mapSpecular': - json.specularMap = loadTexture( value, m.mapSpecularRepeat, m.mapSpecularOffset, m.mapSpecularWrap, m.mapSpecularAnisotropy, textures, texturePath, crossOrigin ); + json.specularMap = loadTexture( value, m.mapSpecularRepeat, m.mapSpecularOffset, m.mapSpecularWrap, m.mapSpecularAnisotropy, textures, texturePath, crossOrigin, manager ); break; case 'mapSpecularRepeat': case 'mapSpecularOffset': @@ -233,7 +233,7 @@ var LegacyJSONLoader = ( function () { case 'mapSpecularAnisotropy': break; case 'mapMetalness': - json.metalnessMap = loadTexture( value, m.mapMetalnessRepeat, m.mapMetalnessOffset, m.mapMetalnessWrap, m.mapMetalnessAnisotropy, textures, texturePath, crossOrigin ); + json.metalnessMap = loadTexture( value, m.mapMetalnessRepeat, m.mapMetalnessOffset, m.mapMetalnessWrap, m.mapMetalnessAnisotropy, textures, texturePath, crossOrigin, manager ); break; case 'mapMetalnessRepeat': case 'mapMetalnessOffset': @@ -241,7 +241,7 @@ var LegacyJSONLoader = ( function () { case 'mapMetalnessAnisotropy': break; case 'mapRoughness': - json.roughnessMap = loadTexture( value, m.mapRoughnessRepeat, m.mapRoughnessOffset, m.mapRoughnessWrap, m.mapRoughnessAnisotropy, textures, texturePath, crossOrigin ); + json.roughnessMap = loadTexture( value, m.mapRoughnessRepeat, m.mapRoughnessOffset, m.mapRoughnessWrap, m.mapRoughnessAnisotropy, textures, texturePath, crossOrigin, manager ); break; case 'mapRoughnessRepeat': case 'mapRoughnessOffset': @@ -249,7 +249,7 @@ var LegacyJSONLoader = ( function () { case 'mapRoughnessAnisotropy': break; case 'mapAlpha': - json.alphaMap = loadTexture( value, m.mapAlphaRepeat, m.mapAlphaOffset, m.mapAlphaWrap, m.mapAlphaAnisotropy, textures, texturePath, crossOrigin ); + json.alphaMap = loadTexture( value, m.mapAlphaRepeat, m.mapAlphaOffset, m.mapAlphaWrap, m.mapAlphaAnisotropy, textures, texturePath, crossOrigin, manager ); break; case 'mapAlphaRepeat': case 'mapAlphaOffset': @@ -299,10 +299,10 @@ var LegacyJSONLoader = ( function () { } - function loadTexture( path, repeat, offset, wrap, anisotropy, textures, texturePath, crossOrigin ) { + function loadTexture( path, repeat, offset, wrap, anisotropy, textures, texturePath, crossOrigin, manager ) { var fullPath = texturePath + path; - var loader = Loader.Handlers.get( fullPath ); + var loader = manager.getHandler( fullPath ); var texture; @@ -832,7 +832,7 @@ var LegacyJSONLoader = ( function () { } else { - var materials = initMaterials( json.materials, this.resourcePath || path, this.crossOrigin ); + var materials = initMaterials( json.materials, this.resourcePath || path, this.crossOrigin, this.manager ); return { geometry: geometry, materials: materials }; diff --git a/examples/webgl_loader_obj_mtl.html b/examples/webgl_loader_obj_mtl.html index c250927c358d35..c2ea9ad8ce3dad 100644 --- a/examples/webgl_loader_obj_mtl.html +++ b/examples/webgl_loader_obj_mtl.html @@ -68,15 +68,16 @@ var onError = function () { }; - THREE.Loader.Handlers.add( /\.dds$/i, new DDSLoader() ); + var manager = new THREE.LoadingManager(); + manager.addHandler( /\.dds$/i, new DDSLoader() ); - new MTLLoader() + new MTLLoader( manager ) .setPath( 'models/obj/male02/' ) .load( 'male02_dds.mtl', function ( materials ) { materials.preload(); - new OBJLoader() + new OBJLoader( manager ) .setMaterials( materials ) .setPath( 'models/obj/male02/' ) .load( 'male02.obj', function ( object ) { diff --git a/src/Three.Legacy.js b/src/Three.Legacy.js index b461b7c14aff2a..419cbbceb9b06b 100644 --- a/src/Three.Legacy.js +++ b/src/Three.Legacy.js @@ -424,6 +424,22 @@ Object.assign( Loader.prototype, { } ); +Loader.Handlers = { + + add: function ( /* regex, loader */ ) { + + console.error( 'THREE.Loader: Handlers.add() has been removed. Use LoadingManager.addHandler() instead.' ); + + }, + + get: function ( /* file */ ) { + + console.error( 'THREE.Loader: Handlers.get() has been removed. Use LoadingManager.getHandler() instead.' ); + + } + +}; + export function XHRLoader( manager ) { console.warn( 'THREE.XHRLoader has been renamed to THREE.FileLoader.' ); diff --git a/src/loaders/Loader.d.ts b/src/loaders/Loader.d.ts index 41e100cd50c786..ca62204a3c7c43 100644 --- a/src/loaders/Loader.d.ts +++ b/src/loaders/Loader.d.ts @@ -24,12 +24,3 @@ export class Loader { static Handlers: LoaderHandler; } - -// LoaderHandler - -export interface LoaderHandler { - handlers: ( RegExp | Loader )[]; - - add( regex: RegExp, loader: Loader ): void; - get( file: string ): Loader | null; -} diff --git a/src/loaders/Loader.js b/src/loaders/Loader.js index fad23314a2868b..863569a0af2e58 100644 --- a/src/loaders/Loader.js +++ b/src/loaders/Loader.js @@ -43,40 +43,4 @@ Object.assign( Loader.prototype, { } ); -// - -Loader.Handlers = { - - handlers: [], - - add: function ( regex, loader ) { - - this.handlers.push( regex, loader ); - - }, - - get: function ( file ) { - - var handlers = this.handlers; - - for ( var i = 0, l = handlers.length; i < l; i += 2 ) { - - var regex = handlers[ i ]; - var loader = handlers[ i + 1 ]; - - if ( regex.test( file ) ) { - - return loader; - - } - - } - - return null; - - } - -}; - - export { Loader }; diff --git a/src/loaders/LoadingManager.d.ts b/src/loaders/LoadingManager.d.ts index 38bd8d877a01fa..bd376f29855d69 100644 --- a/src/loaders/LoadingManager.d.ts +++ b/src/loaders/LoadingManager.d.ts @@ -37,7 +37,7 @@ export class LoadingManager { * This behavior can be used to load assets from .ZIP files, drag-and-drop APIs, and Data URIs. * @param callback URL modifier callback. Called with url argument, and must return resolvedURL. */ - setURLModifier( callback?: ( url: string ) => string ): void; + setURLModifier( callback?: ( url: string ) => string ): this; /** * Given a URL, uses the URL modifier callback (if any) and returns a resolved URL. @@ -50,4 +50,10 @@ export class LoadingManager { itemEnd( url: string ): void; itemError( url: string ): void; + // handlers + + addHandler( regex: RegExp, loader: Loader ): this; + removeHandler( regex: RegExp ): this; + getHandler( file: string ): Loader | null; + } diff --git a/src/loaders/LoadingManager.js b/src/loaders/LoadingManager.js index 07a0cd619f6d95..ec66b7a80c6d00 100644 --- a/src/loaders/LoadingManager.js +++ b/src/loaders/LoadingManager.js @@ -10,6 +10,7 @@ function LoadingManager( onLoad, onProgress, onError ) { var itemsLoaded = 0; var itemsTotal = 0; var urlModifier = undefined; + var handlers = []; // Refer to #5689 for the reason why we don't set .onStart // in the constructor @@ -86,10 +87,52 @@ function LoadingManager( onLoad, onProgress, onError ) { this.setURLModifier = function ( transform ) { urlModifier = transform; + + return this; + + }; + + this.addHandler = function ( regex, loader ) { + + handlers.push( regex, loader ); + return this; }; + this.removeHandler = function ( regex ) { + + var index = handlers.indexOf( regex ); + + if ( index !== - 1 ) { + + handlers.splice( index, 2 ); + + } + + return this; + + }; + + this.getHandler = function ( file ) { + + for ( var i = 0, l = handlers.length; i < l; i += 2 ) { + + var regex = handlers[ i ]; + var loader = handlers[ i + 1 ]; + + if ( regex.test( file ) ) { + + return loader; + + } + + } + + return null; + + }; + } var DefaultLoadingManager = new LoadingManager(); From 4de9262099eddef928f0a824383791d65f627f89 Mon Sep 17 00:00:00 2001 From: Mugen87 Date: Thu, 5 Sep 2019 12:56:26 +0200 Subject: [PATCH 55/75] Tests: Clean up --- test/unit/src/loaders/Loader.tests.js | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/test/unit/src/loaders/Loader.tests.js b/test/unit/src/loaders/Loader.tests.js index a25b1c5a263328..65c8c2e975d69a 100644 --- a/test/unit/src/loaders/Loader.tests.js +++ b/test/unit/src/loaders/Loader.tests.js @@ -3,8 +3,6 @@ */ /* global QUnit */ -import { Loader } from '../../../../src/loaders/Loader'; - export default QUnit.module( 'Loaders', () => { QUnit.module( 'Loader', () => { @@ -16,19 +14,6 @@ export default QUnit.module( 'Loaders', () => { } ); - // STATIC STUFF - QUnit.todo( "Handlers.add", ( assert ) => { - - assert.ok( false, "everything's gonna be alright" ); - - } ); - - QUnit.todo( "Handlers.get", ( assert ) => { - - assert.ok( false, "everything's gonna be alright" ); - - } ); - } ); } ); From 3e3a25aa23f1f4467c93296f50f6fc50d371f94c Mon Sep 17 00:00:00 2001 From: Mugen87 Date: Thu, 5 Sep 2019 15:29:00 +0200 Subject: [PATCH 56/75] TS: Clean up --- src/loaders/Loader.d.ts | 2 -- src/loaders/LoadingManager.d.ts | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/loaders/Loader.d.ts b/src/loaders/Loader.d.ts index ca62204a3c7c43..9bba509bb32aa3 100644 --- a/src/loaders/Loader.d.ts +++ b/src/loaders/Loader.d.ts @@ -21,6 +21,4 @@ export class Loader { setPath( path: string ): this; setResourcePath( resourcePath: string ): this; - static Handlers: LoaderHandler; - } diff --git a/src/loaders/LoadingManager.d.ts b/src/loaders/LoadingManager.d.ts index bd376f29855d69..7301a1b7fce35d 100644 --- a/src/loaders/LoadingManager.d.ts +++ b/src/loaders/LoadingManager.d.ts @@ -1,3 +1,5 @@ +import { Loader } from './Loader'; + export const DefaultLoadingManager: LoadingManager; /** From 25ee8a1f779ac3710cd4dfd96388397f4f04d43b Mon Sep 17 00:00:00 2001 From: Mugen87 Date: Thu, 5 Sep 2019 17:07:13 +0200 Subject: [PATCH 57/75] DracoLoader: Clean up. --- examples/js/loaders/DRACOLoader.js | 19 ++++++++----------- examples/jsm/loaders/DRACOLoader.js | 18 ++++++++++-------- 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/examples/js/loaders/DRACOLoader.js b/examples/js/loaders/DRACOLoader.js index d3009bbf695ac4..85d73ea05fec8c 100644 --- a/examples/js/loaders/DRACOLoader.js +++ b/examples/js/loaders/DRACOLoader.js @@ -189,7 +189,7 @@ THREE.DRACOLoader.prototype = Object.assign( Object.create( THREE.Loader.prototy } - for ( var i = 0; i < geometryData.attributes.length; i++ ) { + for ( var i = 0; i < geometryData.attributes.length; i ++ ) { var attribute = geometryData.attributes[ i ]; var name = attribute.name; @@ -366,7 +366,7 @@ THREE.DRACOLoader.DRACOWorker = function () { case 'init': decoderConfig = message.decoderConfig; - decoderPending = new Promise( function ( resolve, reject ) { + decoderPending = new Promise( function ( resolve/*, reject*/ ) { decoderConfig.onModuleLoaded = function ( draco ) { @@ -454,11 +454,8 @@ THREE.DRACOLoader.DRACOWorker = function () { var geometry = { index: null, attributes: [] }; - var numPoints = dracoGeometry.num_points(); - var numAttributes = dracoGeometry.num_attributes(); - // Add attributes of user specified unique id. - for (var attributeName in attributeIDs) { + for ( var attributeName in attributeIDs ) { var attributeType = self[ attributeTypes[ attributeName ] ]; var attributeId = attributeIDs[ attributeName ]; @@ -499,9 +496,9 @@ THREE.DRACOLoader.DRACOWorker = function () { return geometry; - }; + } - function decodeAttribute ( draco, decoder, dracoGeometry, attributeName, attributeType, attribute ) { + function decodeAttribute( draco, decoder, dracoGeometry, attributeName, attributeType, attribute ) { var numComponents = attribute.num_components(); var numPoints = dracoGeometry.num_points(); @@ -520,7 +517,7 @@ THREE.DRACOLoader.DRACOWorker = function () { case Int8Array: dracoArray = new draco.DracoInt8Array(); - decoder.GetAttributeInt8ForAllPoints( dracoGeometry, attribute, dracoArray ); + decoder.GetAttributeInt8ForAllPoints( dracoGeometry, attribute, dracoArray ); array = new Int8Array( numValues ); break; @@ -559,7 +556,7 @@ THREE.DRACOLoader.DRACOWorker = function () { } - for ( var i = 0; i < numValues; i++ ) { + for ( var i = 0; i < numValues; i ++ ) { array[ i ] = dracoArray.GetValue( i ); @@ -573,7 +570,7 @@ THREE.DRACOLoader.DRACOWorker = function () { itemSize: numComponents }; - }; + } }; diff --git a/examples/jsm/loaders/DRACOLoader.js b/examples/jsm/loaders/DRACOLoader.js index 39e411fd33e22f..15b7ba4d441d25 100644 --- a/examples/jsm/loaders/DRACOLoader.js +++ b/examples/jsm/loaders/DRACOLoader.js @@ -196,7 +196,7 @@ DRACOLoader.prototype = Object.assign( Object.create( Loader.prototype ), { } - for ( var i = 0; i < geometryData.attributes.length; i++ ) { + for ( var i = 0; i < geometryData.attributes.length; i ++ ) { var attribute = geometryData.attributes[ i ]; var name = attribute.name; @@ -373,7 +373,7 @@ DRACOLoader.DRACOWorker = function () { case 'init': decoderConfig = message.decoderConfig; - decoderPending = new Promise( function ( resolve, reject ) { + decoderPending = new Promise( function ( resolve/*, reject*/ ) { decoderConfig.onModuleLoaded = function ( draco ) { @@ -464,8 +464,10 @@ DRACOLoader.DRACOWorker = function () { var numPoints = dracoGeometry.num_points(); var numAttributes = dracoGeometry.num_attributes(); + console.log( numPoints, numAttributes ); + // Add attributes of user specified unique id. - for (var attributeName in attributeIDs) { + for ( var attributeName in attributeIDs ) { var attributeType = self[ attributeTypes[ attributeName ] ]; var attributeId = attributeIDs[ attributeName ]; @@ -506,9 +508,9 @@ DRACOLoader.DRACOWorker = function () { return geometry; - }; + } - function decodeAttribute ( draco, decoder, dracoGeometry, attributeName, attributeType, attribute ) { + function decodeAttribute( draco, decoder, dracoGeometry, attributeName, attributeType, attribute ) { var numComponents = attribute.num_components(); var numPoints = dracoGeometry.num_points(); @@ -527,7 +529,7 @@ DRACOLoader.DRACOWorker = function () { case Int8Array: dracoArray = new draco.DracoInt8Array(); - decoder.GetAttributeInt8ForAllPoints( dracoGeometry, attribute, dracoArray ); + decoder.GetAttributeInt8ForAllPoints( dracoGeometry, attribute, dracoArray ); array = new Int8Array( numValues ); break; @@ -566,7 +568,7 @@ DRACOLoader.DRACOWorker = function () { } - for ( var i = 0; i < numValues; i++ ) { + for ( var i = 0; i < numValues; i ++ ) { array[ i ] = dracoArray.GetValue( i ); @@ -580,7 +582,7 @@ DRACOLoader.DRACOWorker = function () { itemSize: numComponents }; - }; + } }; From 2aeee4d59d764cf5ade89b3d53bc4a219e41d248 Mon Sep 17 00:00:00 2001 From: Mugen87 Date: Fri, 6 Sep 2019 11:01:28 +0200 Subject: [PATCH 58/75] LegacyGLTFLoader: Fix typo. --- examples/js/loaders/deprecated/LegacyGLTFLoader.js | 2 +- examples/jsm/loaders/deprecated/LegacyGLTFLoader.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/js/loaders/deprecated/LegacyGLTFLoader.js b/examples/js/loaders/deprecated/LegacyGLTFLoader.js index f0e397bbaa4da3..4adf2ee310f993 100644 --- a/examples/js/loaders/deprecated/LegacyGLTFLoader.js +++ b/examples/js/loaders/deprecated/LegacyGLTFLoader.js @@ -1079,7 +1079,7 @@ THREE.LegacyGLTFLoader = ( function () { } - var textureLoader = options.manager.getHanlder( sourceUri ); + var textureLoader = options.manager.getHandler( sourceUri ); if ( textureLoader === null ) { diff --git a/examples/jsm/loaders/deprecated/LegacyGLTFLoader.js b/examples/jsm/loaders/deprecated/LegacyGLTFLoader.js index 9814986a36bf75..f911f433194b65 100644 --- a/examples/jsm/loaders/deprecated/LegacyGLTFLoader.js +++ b/examples/jsm/loaders/deprecated/LegacyGLTFLoader.js @@ -1169,7 +1169,7 @@ var LegacyGLTFLoader = ( function () { } - var textureLoader = options.manager.getHanlder( sourceUri ); + var textureLoader = options.manager.getHandler( sourceUri ); if ( textureLoader === null ) { From c574d51e3a8f64ae48b9dc9734dfd859e25a2176 Mon Sep 17 00:00:00 2001 From: Mugen87 Date: Fri, 6 Sep 2019 15:24:10 +0200 Subject: [PATCH 59/75] JSM: Update modules. --- examples/jsm/loaders/DRACOLoader.js | 5 ----- examples/jsm/vr/WebVR.js | 1 + 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/examples/jsm/loaders/DRACOLoader.js b/examples/jsm/loaders/DRACOLoader.js index 15b7ba4d441d25..6885b3df032118 100644 --- a/examples/jsm/loaders/DRACOLoader.js +++ b/examples/jsm/loaders/DRACOLoader.js @@ -461,11 +461,6 @@ DRACOLoader.DRACOWorker = function () { var geometry = { index: null, attributes: [] }; - var numPoints = dracoGeometry.num_points(); - var numAttributes = dracoGeometry.num_attributes(); - - console.log( numPoints, numAttributes ); - // Add attributes of user specified unique id. for ( var attributeName in attributeIDs ) { diff --git a/examples/jsm/vr/WebVR.js b/examples/jsm/vr/WebVR.js index db8ef0bcad6ad8..7524677837fc0d 100644 --- a/examples/jsm/vr/WebVR.js +++ b/examples/jsm/vr/WebVR.js @@ -14,6 +14,7 @@ var WEBVR = { if ( options && options.referenceSpaceType ) { renderer.vr.setReferenceSpaceType( options.referenceSpaceType ); + } function showEnterVR( device ) { From 9cb0c15c502c320a2dfff9d9c9c344382a1a8a64 Mon Sep 17 00:00:00 2001 From: "Mr.doob" Date: Fri, 6 Sep 2019 10:46:55 -0700 Subject: [PATCH 60/75] package.json: removed deprecated jsnext:main. --- package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/package.json b/package.json index c7e6fb199ab1bc..4f36fc8f3e09bc 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,6 @@ "description": "JavaScript 3D library", "main": "build/three.js", "repository": "mrdoob/three.js", - "jsnext:main": "build/three.module.js", "module": "build/three.module.js", "types": "src/Three.d.ts", "files": [ From b94b717830e9c5ff4ee712a4ee7d968858834fd6 Mon Sep 17 00:00:00 2001 From: "Mr.doob" Date: Fri, 6 Sep 2019 10:47:32 -0700 Subject: [PATCH 61/75] package.json: changed repository format. --- package.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 4f36fc8f3e09bc..f8422291a50806 100644 --- a/package.json +++ b/package.json @@ -3,9 +3,12 @@ "version": "0.108.0", "description": "JavaScript 3D library", "main": "build/three.js", - "repository": "mrdoob/three.js", "module": "build/three.module.js", "types": "src/Three.d.ts", + "repository": { + "type": "git", + "url": "https://github.com/mrdoob/three.js" + }, "files": [ "build/three.js", "build/three.min.js", From 9e18ea92efb94a702ffac2533686f841a85d6797 Mon Sep 17 00:00:00 2001 From: "Mr.doob" Date: Fri, 6 Sep 2019 10:47:54 -0700 Subject: [PATCH 62/75] package.json: added more keywords. --- package.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/package.json b/package.json index f8422291a50806..6fbf8d596441c4 100644 --- a/package.json +++ b/package.json @@ -60,6 +60,8 @@ "three", "three.js", "3d", + "canvas", + "svg", "webgl" ], "author": "mrdoob", From e7df45389370858bb728fd605b8cb6736b71be56 Mon Sep 17 00:00:00 2001 From: Takahiro Date: Fri, 6 Sep 2019 11:25:20 -0700 Subject: [PATCH 63/75] Remove unnecessary EventDispatcher methods definitions from Geometry.d.ts --- src/core/Geometry.d.ts | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/core/Geometry.d.ts b/src/core/Geometry.d.ts index 4a7bb35ffd2c5f..422a18d9d9d963 100644 --- a/src/core/Geometry.d.ts +++ b/src/core/Geometry.d.ts @@ -1,6 +1,6 @@ import { Vector3 } from './../math/Vector3'; import { Color } from './../math/Color'; -import { Face3, Event } from './Face3'; +import { Face3 } from './Face3'; import { Vector2 } from './../math/Vector2'; import { Vector4 } from './../math/Vector4'; import { Box3 } from './../math/Box3'; @@ -252,10 +252,4 @@ export class Geometry extends EventDispatcher { animation: AnimationClip; animations: AnimationClip[]; - // EventDispatcher mixins - addEventListener( type: string, listener: ( event: Event ) => void ): void; - hasEventListener( type: string, listener: ( event: Event ) => void ): boolean; - removeEventListener( type: string, listener: ( event: Event ) => void ): void; - dispatchEvent( event: { type: string; [attachment: string]: any } ): void; - } From b9a157bda3de1f734e2c140e035e4175231b439f Mon Sep 17 00:00:00 2001 From: Takahiro Date: Fri, 6 Sep 2019 11:25:52 -0700 Subject: [PATCH 64/75] Remove EventDispatcher inheritance from DirectGeometry.d.ts --- src/core/DirectGeometry.d.ts | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/core/DirectGeometry.d.ts b/src/core/DirectGeometry.d.ts index 3fdaf4335daa1c..047407e1c8fb7e 100644 --- a/src/core/DirectGeometry.d.ts +++ b/src/core/DirectGeometry.d.ts @@ -5,13 +5,11 @@ import { Vector4 } from './../math/Vector4'; import { Box3 } from './../math/Box3'; import { Sphere } from './../math/Sphere'; import { Geometry } from './Geometry'; -import { Event } from './Face3'; -import { EventDispatcher } from './EventDispatcher'; import { MorphTarget } from './Geometry'; /** * @see src/core/DirectGeometry.js */ -export class DirectGeometry extends EventDispatcher { +export class DirectGeometry { constructor(); @@ -43,10 +41,4 @@ export class DirectGeometry extends EventDispatcher { fromGeometry( geometry: Geometry ): DirectGeometry; dispose(): void; - // EventDispatcher mixins - addEventListener( type: string, listener: ( event: Event ) => void ): void; - hasEventListener( type: string, listener: ( event: Event ) => void ): boolean; - removeEventListener( type: string, listener: ( event: Event ) => void ): void; - dispatchEvent( event: { type: string; [attachment: string]: any } ): void; - } From 26ffbd29c1ae250bc516bf41591d457d17b3be86 Mon Sep 17 00:00:00 2001 From: Mugen87 Date: Fri, 6 Sep 2019 21:47:45 +0200 Subject: [PATCH 65/75] Examples: Remove usage of BufferAttribute.setArray(). --- examples/js/loaders/GLTFLoader.js | 2 +- examples/js/utils/BufferGeometryUtils.js | 36 ++++------------------- examples/jsm/loaders/GLTFLoader.js | 2 +- examples/jsm/utils/BufferGeometryUtils.js | 36 ++++------------------- 4 files changed, 14 insertions(+), 62 deletions(-) diff --git a/examples/js/loaders/GLTFLoader.js b/examples/js/loaders/GLTFLoader.js index bd8c0c86fb95a1..b1449b751728ee 100644 --- a/examples/js/loaders/GLTFLoader.js +++ b/examples/js/loaders/GLTFLoader.js @@ -1910,7 +1910,7 @@ THREE.GLTFLoader = ( function () { if ( bufferView !== null ) { // Avoid modifying the original ArrayBuffer, if the bufferView wasn't initialized with zeroes. - bufferAttribute.setArray( bufferAttribute.array.slice() ); + bufferAttribute = new THREE.BufferAttribute( bufferAttribute.array.slice(), bufferAttribute.itemSize, bufferAttribute.normalized ); } diff --git a/examples/js/utils/BufferGeometryUtils.js b/examples/js/utils/BufferGeometryUtils.js index 473d48661d36fb..5225b84ef4c151 100644 --- a/examples/js/utils/BufferGeometryUtils.js +++ b/examples/js/utils/BufferGeometryUtils.js @@ -589,19 +589,9 @@ THREE.BufferGeometryUtils = { var name = attributeNames[ i ]; var oldAttribute = geometry.getAttribute( name ); - var attribute; var buffer = new oldAttribute.array.constructor( attrArrays[ name ] ); - if ( oldAttribute.isInterleavedBufferAttribute ) { - - attribute = new THREE.BufferAttribute( buffer, oldAttribute.itemSize, oldAttribute.itemSize ); - - } else { - - attribute = geometry.getAttribute( name ).clone(); - attribute.setArray( buffer ); - - } + var attribute = new THREE.BufferAttribute( buffer, oldAttribute.itemSize, oldAttribute.normalized ); result.addAttribute( name, attribute ); @@ -610,8 +600,10 @@ THREE.BufferGeometryUtils = { for ( var j = 0; j < morphAttrsArrays[ name ].length; j ++ ) { - var morphAttribute = geometry.morphAttributes[ name ][ j ].clone(); - morphAttribute.setArray( new morphAttribute.array.constructor( morphAttrsArrays[ name ][ j ] ) ); + var oldMorphAttribute = geometry.morphAttributes[ name ][ j ]; + + var buffer = new oldMorphAttribute.array.constructor( morphAttrsArrays[ name ][ j ] ); + var morphAttribute = new THREE.BufferAttribute( buffer, oldMorphAttribute.itemSize, oldMorphAttribute.normalized ); result.morphAttributes[ name ][ j ] = morphAttribute; } @@ -620,23 +612,7 @@ THREE.BufferGeometryUtils = { } - // Generate an index buffer typed array - var cons = Uint8Array; - if ( newIndices.length >= Math.pow( 2, 8 ) ) cons = Uint16Array; - if ( newIndices.length >= Math.pow( 2, 16 ) ) cons = Uint32Array; - - var newIndexBuffer = new cons( newIndices ); - var newIndices = null; - if ( indices === null ) { - - newIndices = new THREE.BufferAttribute( newIndexBuffer, 1 ); - - } else { - - newIndices = geometry.getIndex().clone(); - newIndices.setArray( newIndexBuffer ); - - } + // indices result.setIndex( newIndices ); diff --git a/examples/jsm/loaders/GLTFLoader.js b/examples/jsm/loaders/GLTFLoader.js index adf5cddce42126..c1ea344e49a5db 100644 --- a/examples/jsm/loaders/GLTFLoader.js +++ b/examples/jsm/loaders/GLTFLoader.js @@ -1974,7 +1974,7 @@ var GLTFLoader = ( function () { if ( bufferView !== null ) { // Avoid modifying the original ArrayBuffer, if the bufferView wasn't initialized with zeroes. - bufferAttribute.setArray( bufferAttribute.array.slice() ); + bufferAttribute = new BufferAttribute( bufferAttribute.array.slice(), bufferAttribute.itemSize, bufferAttribute.normalized ); } diff --git a/examples/jsm/utils/BufferGeometryUtils.js b/examples/jsm/utils/BufferGeometryUtils.js index 3b3d8f954f8da6..9e86d9b2c43853 100644 --- a/examples/jsm/utils/BufferGeometryUtils.js +++ b/examples/jsm/utils/BufferGeometryUtils.js @@ -598,19 +598,9 @@ var BufferGeometryUtils = { var name = attributeNames[ i ]; var oldAttribute = geometry.getAttribute( name ); - var attribute; var buffer = new oldAttribute.array.constructor( attrArrays[ name ] ); - if ( oldAttribute.isInterleavedBufferAttribute ) { - - attribute = new BufferAttribute( buffer, oldAttribute.itemSize, oldAttribute.itemSize ); - - } else { - - attribute = geometry.getAttribute( name ).clone(); - attribute.setArray( buffer ); - - } + var attribute = new BufferAttribute( buffer, oldAttribute.itemSize, oldAttribute.normalized ); result.addAttribute( name, attribute ); @@ -619,8 +609,10 @@ var BufferGeometryUtils = { for ( var j = 0; j < morphAttrsArrays[ name ].length; j ++ ) { - var morphAttribute = geometry.morphAttributes[ name ][ j ].clone(); - morphAttribute.setArray( new morphAttribute.array.constructor( morphAttrsArrays[ name ][ j ] ) ); + var oldMorphAttribute = geometry.morphAttributes[ name ][ j ]; + + var buffer = new oldMorphAttribute.array.constructor( morphAttrsArrays[ name ][ j ] ); + var morphAttribute = new BufferAttribute( buffer, oldMorphAttribute.itemSize, oldMorphAttribute.normalized ); result.morphAttributes[ name ][ j ] = morphAttribute; } @@ -629,23 +621,7 @@ var BufferGeometryUtils = { } - // Generate an index buffer typed array - var cons = Uint8Array; - if ( newIndices.length >= Math.pow( 2, 8 ) ) cons = Uint16Array; - if ( newIndices.length >= Math.pow( 2, 16 ) ) cons = Uint32Array; - - var newIndexBuffer = new cons( newIndices ); - var newIndices = null; - if ( indices === null ) { - - newIndices = new BufferAttribute( newIndexBuffer, 1 ); - - } else { - - newIndices = geometry.getIndex().clone(); - newIndices.setArray( newIndexBuffer ); - - } + // indices result.setIndex( newIndices ); From d842a59c71a820ecd5e19d80c416a4341c4c1ce8 Mon Sep 17 00:00:00 2001 From: Mugen87 Date: Sat, 7 Sep 2019 10:54:56 +0200 Subject: [PATCH 66/75] PointerLockControls: Clean up. --- examples/js/controls/PointerLockControls.js | 2 +- examples/jsm/controls/PointerLockControls.d.ts | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/js/controls/PointerLockControls.js b/examples/js/controls/PointerLockControls.js index 38d9e02d6c68ae..6ba64529788d8e 100644 --- a/examples/js/controls/PointerLockControls.js +++ b/examples/js/controls/PointerLockControls.js @@ -22,7 +22,7 @@ THREE.PointerLockControls = function ( camera, domElement ) { var PI_2 = Math.PI / 2; - var vec = new Vector3(); + var vec = new THREE.Vector3(); function onMouseMove( event ) { diff --git a/examples/jsm/controls/PointerLockControls.d.ts b/examples/jsm/controls/PointerLockControls.d.ts index 64b419220f15fc..bf57c1840c518c 100644 --- a/examples/jsm/controls/PointerLockControls.d.ts +++ b/examples/jsm/controls/PointerLockControls.d.ts @@ -8,7 +8,6 @@ export class PointerLockControls extends EventDispatcher { constructor(camera: Camera, domElement?: HTMLElement); domElement: HTMLElement; - object: Camera; // API @@ -19,6 +18,8 @@ export class PointerLockControls extends EventDispatcher { dispose(): void; getObject(): Camera; getDirection(v: Vector3): Vector3; + moveForward(distance: number): void; + moveRight(distance: number): void; lock(): void; unlock(): void; From fda056fa11113c7254bfb732fb9fb7a5d38266da Mon Sep 17 00:00:00 2001 From: Mugen87 Date: Sat, 7 Sep 2019 14:42:50 +0200 Subject: [PATCH 67/75] Update builds. --- build/three.js | 94 +++++++----- build/three.min.js | 326 +++++++++++++++++++++--------------------- build/three.module.js | 94 +++++++----- 3 files changed, 280 insertions(+), 234 deletions(-) diff --git a/build/three.js b/build/three.js index 6ad8a582745f94..615e10399d8094 100644 --- a/build/three.js +++ b/build/three.js @@ -34481,6 +34481,7 @@ var itemsLoaded = 0; var itemsTotal = 0; var urlModifier = undefined; + var handlers = []; // Refer to #5689 for the reason why we don't set .onStart // in the constructor @@ -34557,10 +34558,52 @@ this.setURLModifier = function ( transform ) { urlModifier = transform; + + return this; + + }; + + this.addHandler = function ( regex, loader ) { + + handlers.push( regex, loader ); + + return this; + + }; + + this.removeHandler = function ( regex ) { + + var index = handlers.indexOf( regex ); + + if ( index !== - 1 ) { + + handlers.splice( index, 2 ); + + } + return this; }; + this.getHandler = function ( file ) { + + for ( var i = 0, l = handlers.length; i < l; i += 2 ) { + + var regex = handlers[ i ]; + var loader = handlers[ i + 1 ]; + + if ( regex.test( file ) ) { + + return loader; + + } + + } + + return null; + + }; + } var DefaultLoadingManager = new LoadingManager(); @@ -34608,41 +34651,6 @@ } ); - // - - Loader.Handlers = { - - handlers: [], - - add: function ( regex, loader ) { - - this.handlers.push( regex, loader ); - - }, - - get: function ( file ) { - - var handlers = this.handlers; - - for ( var i = 0, l = handlers.length; i < l; i += 2 ) { - - var regex = handlers[ i ]; - var loader = handlers[ i + 1 ]; - - if ( regex.test( file ) ) { - - return loader; - - } - - } - - return null; - - } - - }; - /** * @author mrdoob / http://mrdoob.com/ */ @@ -46982,6 +46990,22 @@ } ); + Loader.Handlers = { + + add: function ( /* regex, loader */ ) { + + console.error( 'THREE.Loader: Handlers.add() has been removed. Use LoadingManager.addHandler() instead.' ); + + }, + + get: function ( /* file */ ) { + + console.error( 'THREE.Loader: Handlers.get() has been removed. Use LoadingManager.getHandler() instead.' ); + + } + + }; + function XHRLoader( manager ) { console.warn( 'THREE.XHRLoader has been renamed to THREE.FileLoader.' ); diff --git a/build/three.min.js b/build/three.min.js index 75c3229d545660..8670045697d446 100644 --- a/build/three.min.js +++ b/build/three.min.js @@ -1,4 +1,3 @@ -// threejs.org/license (function(k,za){"object"===typeof exports&&"undefined"!==typeof module?za(exports):"function"===typeof define&&define.amd?define(["exports"],za):(k=k||self,za(k.THREE={}))})(this,function(k){function za(){}function v(a,b){this.x=a||0;this.y=b||0}function sa(a,b,c,d){this._x=a||0;this._y=b||0;this._z=c||0;this._w=void 0!==d?d:1}function n(a,b,c){this.x=a||0;this.y=b||0;this.z=c||0}function S(){this.elements=[1,0,0,0,1,0,0,0,1];0\nvoid main() {\n float mean = 0.0;\n float squared_mean = 0.0;\n \n\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy ) / resolution ) );\n for ( float i = -1.0; i < 1.0 ; i += SAMPLE_RATE) {\n #ifdef HORIZONAL_PASS\n vec2 distribution = decodeHalfRGBA ( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( i, 0.0 ) * radius ) / resolution ) );\n mean += distribution.x;\n squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n #else\n float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, i ) * radius ) / resolution ) );\n mean += depth;\n squared_mean += depth * depth;\n #endif\n }\n mean = mean * HALF_SAMPLE_RATE;\n squared_mean = squared_mean * HALF_SAMPLE_RATE;\n float std_dev = pow( squared_mean - mean * mean, 0.5 );\n gl_FragColor = encodeHalfRGBA( vec2( mean, std_dev ) );\n}"}), +(l.referencePosition.setFromMatrixPosition(d.matrixWorld),l.nearDistance=e,l.farDistance=f);return l}function e(c,g,h,l,m){if(!1!==c.visible){if(c.layers.test(g.layers)&&(c.isMesh||c.isLine||c.isPoints)&&(c.castShadow||c.receiveShadow&&3===m)&&(!c.frustumCulled||f.intersectsObject(c))){c.modelViewMatrix.multiplyMatrices(h.matrixWorldInverse,c.matrixWorld);var p=b.update(c),u=c.material;if(Array.isArray(u))for(var k=p.groups,q=0,t=k.length;q\nvoid main() {\n float mean = 0.0;\n float squared_mean = 0.0;\n \n\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy ) / resolution ) );\n for ( float i = -1.0; i < 1.0 ; i += SAMPLE_RATE) {\n #ifdef HORIZONAL_PASS\n vec2 distribution = decodeHalfRGBA ( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( i, 0.0 ) * radius ) / resolution ) );\n mean += distribution.x;\n squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n #else\n float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, i ) * radius ) / resolution ) );\n mean += depth;\n squared_mean += depth * depth;\n #endif\n }\n mean = mean * HALF_SAMPLE_RATE;\n squared_mean = squared_mean * HALF_SAMPLE_RATE;\n float std_dev = pow( squared_mean - mean * mean, 0.5 );\n gl_FragColor = encodeHalfRGBA( vec2( mean, std_dev ) );\n}"}), t=r.clone();t.defines.HORIZONAL_PASS=1;var n=new D;n.addAttribute("position",new L(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));var w=new ia(n,r);for(n=0;4!==n;++n){var y=0!==(n&1),x=0!==(n&2),U=new Db({depthPacking:3201,morphTargets:y,skinning:x});m[n]=U;y=new Eb({morphTargets:y,skinning:x});p[n]=y}var R=this;this.enabled=!1;this.autoUpdate=!0;this.needsUpdate=!1;this.type=1;this.render=function(d,m,p){if(!1!==R.enabled&&(!1!==R.autoUpdate||!1!==R.needsUpdate)&&0!==d.length){var u=a.getRenderTarget(), k=a.getActiveCubeFace(),q=a.getActiveMipmapLevel(),n=a.state;n.setBlending(0);n.buffers.color.setClear(1,1,1,1);n.buffers.depth.setTest(!0);n.setScissorTest(!1);for(var z=0,x=d.length;zc||g.y>c)console.warn("THREE.WebGLShadowMap:",y,"has shadow exceeding max texture size, reducing"),g.x>c&&(h.x=Math.floor(c/X.x), g.x=h.x*X.x,T.mapSize.x=h.x),g.y>c&&(h.y=Math.floor(c/X.y),g.y=h.y*X.y,T.mapSize.y=h.y);null!==T.map||T.isPointLightShadow||3!==this.type||(X={minFilter:1006,magFilter:1006,format:1023},T.map=new Ka(g.x,g.y,X),T.map.texture.name=y.name+".shadowMap",T.mapPass=new Ka(g.x,g.y,X),T.camera.updateProjectionMatrix());null===T.map&&(X={minFilter:1003,magFilter:1003,format:1023},T.map=new Ka(g.x,g.y,X),T.map.texture.name=y.name+".shadowMap",T.camera.updateProjectionMatrix());a.setRenderTarget(T.map);a.clear(); @@ -158,7 +157,7 @@ function d(a,b){null!==b&&4===b.length&&a.set(b[0]*e,b[1]*f,b[2]*e,b[3]*f)}var e !1;this.getController=function(a){var b=p[a];void 0===b&&(b=new Hc,b.matrixAutoUpdate=!1,b.visible=!1,p[a]=b);return b};this.getDevice=function(){return h};this.setDevice=function(a){void 0!==a&&(h=a);A.setContext(a)};this.setFramebufferScaleFactor=function(a){r=a};this.setReferenceSpaceType=function(a){t=a};this.setPoseTarget=function(a){void 0!==a&&(m=a)};this.getCamera=function(a){var c="local-floor"===t?1.6:0;if(!1===b())return a.position.set(0,c,0),a.rotation.set(0,0,0),a;h.depthNear=a.near; h.depthFar=a.far;h.getFrameData(l);if("local-floor"===t){var e=h.stageParameters;e?u.fromArray(e.sittingToStandingTransform):u.makeTranslation(0,c,0)}c=l.pose;e=null!==m?m:a;e.matrix.copy(u);e.matrix.decompose(e.position,e.quaternion,e.scale);null!==c.orientation&&(w.fromArray(c.orientation),e.quaternion.multiply(w));null!==c.position&&(w.setFromRotationMatrix(u),y.fromArray(c.position),y.applyQuaternion(w),e.position.add(y));e.updateMatrixWorld();x.near=a.near;U.near=a.near;x.far=a.far;U.far=a.far; x.matrixWorldInverse.fromArray(l.leftViewMatrix);U.matrixWorldInverse.fromArray(l.rightViewMatrix);k.getInverse(u);"local-floor"===t&&(x.matrixWorldInverse.multiply(k),U.matrixWorldInverse.multiply(k));a=e.parent;null!==a&&(z.getInverse(a.matrixWorld),x.matrixWorldInverse.multiply(z),U.matrixWorldInverse.multiply(z));x.matrixWorld.getInverse(x.matrixWorldInverse);U.matrixWorld.getInverse(U.matrixWorldInverse);x.projectionMatrix.fromArray(l.leftProjectionMatrix);U.projectionMatrix.fromArray(l.rightProjectionMatrix); -Eh(R,x,U);a=h.getLayers();a.length&&(a=a[0],d(x.viewport,a.leftBounds),d(U.viewport,a.rightBounds));a:for(a=0;athis.duration&&this.resetDuration()}function ek(a){switch(a.toLowerCase()){case "scalar":case "double":case "float":case "number":case "integer":return $c; case "vector":case "vector2":case "vector3":case "vector4":return ad;case "color":return Qe;case "quaternion":return le;case "bool":case "boolean":return Pe;case "string":return Se}throw Error("THREE.KeyframeTrack: Unsupported typeName: "+a);}function fk(a){if(void 0===a.type)throw Error("THREE.KeyframeTrack: track type undefined, can not parse");var b=ek(a.type);if(void 0===a.times){var c=[],d=[];ta.flattenJSON(a.keys,c,d,"value");a.times=c;a.values=d}return void 0!==b.parse?b.parse(a):new b(a.name, -a.times,a.values,a.interpolation)}function kg(a,b,c){var d=this,e=!1,f=0,g=0,h=void 0;this.onStart=void 0;this.onLoad=a;this.onProgress=b;this.onError=c;this.itemStart=function(a){g++;if(!1===e&&void 0!==d.onStart)d.onStart(a,f,g);e=!0};this.itemEnd=function(a){f++;if(void 0!==d.onProgress)d.onProgress(a,f,g);if(f===g&&(e=!1,void 0!==d.onLoad))d.onLoad()};this.itemError=function(a){if(void 0!==d.onError)d.onError(a)};this.resolveURL=function(a){return h?h(a):a};this.setURLModifier=function(a){h=a; -return this}}function Z(a){this.manager=void 0!==a?a:Sh;this.crossOrigin="anonymous";this.resourcePath=this.path=""}function Na(a){Z.call(this,a)}function lg(a){Z.call(this,a)}function mg(a){Z.call(this,a)}function Te(a){Z.call(this,a)}function bd(a){Z.call(this,a)}function Ue(a){Z.call(this,a)}function Ve(a){Z.call(this,a)}function C(){this.type="Curve";this.arcLengthDivisions=200}function Ia(a,b,c,d,e,f,g,h){C.call(this);this.type="EllipseCurve";this.aX=a||0;this.aY=b||0;this.xRadius=c||1;this.yRadius= -d||1;this.aStartAngle=e||0;this.aEndAngle=f||2*Math.PI;this.aClockwise=g||!1;this.aRotation=h||0}function cd(a,b,c,d,e,f){Ia.call(this,a,b,c,c,d,e,f);this.type="ArcCurve"}function ng(){var a=0,b=0,c=0,d=0;return{initCatmullRom:function(e,f,g,h,l){e=l*(g-e);h=l*(h-f);a=f;b=e;c=-3*f+3*g-2*e-h;d=2*f-2*g+e+h},initNonuniformCatmullRom:function(e,f,g,h,l,m,k){e=((f-e)/l-(g-e)/(l+m)+(g-f)/m)*m;h=((g-f)/m-(h-f)/(m+k)+(h-g)/k)*m;a=f;b=e;c=-3*f+3*g-2*e-h;d=2*f-2*g+e+h},calc:function(e){var f=e*e;return a+b* -e+c*f+d*f*e}}}function wa(a,b,c,d){C.call(this);this.type="CatmullRomCurve3";this.points=a||[];this.closed=b||!1;this.curveType=c||"centripetal";this.tension=d||.5}function Th(a,b,c,d,e){b=.5*(d-b);e=.5*(e-c);var f=a*a;return(2*c-2*d+b+e)*a*f+(-3*c+3*d-2*b-e)*f+b*a+c}function me(a,b,c,d){var e=1-a;return e*e*b+2*(1-a)*a*c+a*a*d}function ne(a,b,c,d,e){var f=1-a,g=1-a;return f*f*f*b+3*g*g*a*c+3*(1-a)*a*a*d+a*a*a*e}function Sa(a,b,c,d){C.call(this);this.type="CubicBezierCurve";this.v0=a||new v;this.v1= -b||new v;this.v2=c||new v;this.v3=d||new v}function gb(a,b,c,d){C.call(this);this.type="CubicBezierCurve3";this.v0=a||new n;this.v1=b||new n;this.v2=c||new n;this.v3=d||new n}function xa(a,b){C.call(this);this.type="LineCurve";this.v1=a||new v;this.v2=b||new v}function Ta(a,b){C.call(this);this.type="LineCurve3";this.v1=a||new n;this.v2=b||new n}function Ua(a,b,c){C.call(this);this.type="QuadraticBezierCurve";this.v0=a||new v;this.v1=b||new v;this.v2=c||new v}function hb(a,b,c){C.call(this);this.type= -"QuadraticBezierCurve3";this.v0=a||new n;this.v1=b||new n;this.v2=c||new n}function Va(a){C.call(this);this.type="SplineCurve";this.points=a||[]}function rb(){C.call(this);this.type="CurvePath";this.curves=[];this.autoClose=!1}function Wa(a){rb.call(this);this.type="Path";this.currentPoint=new v;a&&this.setFromPoints(a)}function Ib(a){Wa.call(this,a);this.uuid=N.generateUUID();this.type="Shape";this.holes=[]}function ba(a,b){A.call(this);this.type="Light";this.color=new I(a);this.intensity=void 0!== -b?b:1;this.receiveShadow=void 0}function We(a,b,c){ba.call(this,a,c);this.type="HemisphereLight";this.castShadow=void 0;this.position.copy(A.DefaultUp);this.updateMatrix();this.groundColor=new I(b)}function ib(a){this.camera=a;this.bias=0;this.radius=1;this.mapSize=new v(512,512);this.mapPass=this.map=null;this.matrix=new W;this._frustum=new Ed;this._frameExtents=new v(1,1);this._viewportCount=1;this._viewports=[new da(0,0,1,1)]}function Xe(){ib.call(this,new ja(50,1,.5,500))}function Ye(a,b,c,d, -e,f){ba.call(this,a,b);this.type="SpotLight";this.position.copy(A.DefaultUp);this.updateMatrix();this.target=new A;Object.defineProperty(this,"power",{get:function(){return this.intensity*Math.PI},set:function(a){this.intensity=a/Math.PI}});this.distance=void 0!==c?c:0;this.angle=void 0!==d?d:Math.PI/3;this.penumbra=void 0!==e?e:0;this.decay=void 0!==f?f:1;this.shadow=new Xe}function og(){ib.call(this,new ja(90,1,.5,500));this._frameExtents=new v(4,2);this._viewportCount=6;this._viewports=[new da(2, -1,1,1),new da(0,1,1,1),new da(3,1,1,1),new da(1,1,1,1),new da(3,0,1,1),new da(1,0,1,1)];this._cubeDirections=[new n(1,0,0),new n(-1,0,0),new n(0,0,1),new n(0,0,-1),new n(0,1,0),new n(0,-1,0)];this._cubeUps=[new n(0,1,0),new n(0,1,0),new n(0,1,0),new n(0,1,0),new n(0,0,1),new n(0,0,-1)]}function Ze(a,b,c,d){ba.call(this,a,b);this.type="PointLight";Object.defineProperty(this,"power",{get:function(){return 4*this.intensity*Math.PI},set:function(a){this.intensity=a/(4*Math.PI)}});this.distance=void 0!== -c?c:0;this.decay=void 0!==d?d:1;this.shadow=new og}function oe(a,b,c,d,e,f){bb.call(this);this.type="OrthographicCamera";this.zoom=1;this.view=null;this.left=void 0!==a?a:-1;this.right=void 0!==b?b:1;this.top=void 0!==c?c:1;this.bottom=void 0!==d?d:-1;this.near=void 0!==e?e:.1;this.far=void 0!==f?f:2E3;this.updateProjectionMatrix()}function $e(){ib.call(this,new oe(-5,5,5,-5,.5,500))}function af(a,b){ba.call(this,a,b);this.type="DirectionalLight";this.position.copy(A.DefaultUp);this.updateMatrix(); -this.target=new A;this.shadow=new $e}function bf(a,b){ba.call(this,a,b);this.type="AmbientLight";this.castShadow=void 0}function cf(a,b,c,d){ba.call(this,a,b);this.type="RectAreaLight";this.width=void 0!==c?c:10;this.height=void 0!==d?d:10}function df(a){Z.call(this,a);this.textures={}}function ef(){D.call(this);this.type="InstancedBufferGeometry";this.maxInstancedCount=void 0}function ff(a,b,c,d){"number"===typeof c&&(d=c,c=!1,console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.")); -L.call(this,a,b,c);this.meshPerAttribute=d||1}function gf(a){Z.call(this,a)}function hf(a){Z.call(this,a)}function pg(a){"undefined"===typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported.");"undefined"===typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported.");Z.call(this,a);this.options=void 0}function qg(){this.type="ShapePath";this.color=new I;this.subPaths=[];this.currentPath=null}function rg(a){this.type="Font";this.data=a}function sg(a){Z.call(this, -a)}function jf(a){Z.call(this,a)}function kf(){this.coefficients=[];for(var a=0;9>a;a++)this.coefficients.push(new n)}function Xa(a,b){ba.call(this,void 0,b);this.sh=void 0!==a?a:new kf}function tg(a,b,c){Xa.call(this,void 0,c);a=(new I).set(a);c=(new I).set(b);b=new n(a.r,a.g,a.b);a=new n(c.r,c.g,c.b);c=Math.sqrt(Math.PI);var d=c*Math.sqrt(.75);this.sh.coefficients[0].copy(b).add(a).multiplyScalar(c);this.sh.coefficients[1].copy(b).sub(a).multiplyScalar(d)}function ug(a,b){Xa.call(this,void 0,b); -a=(new I).set(a);this.sh.coefficients[0].set(a.r,a.g,a.b).multiplyScalar(2*Math.sqrt(Math.PI))}function Uh(){this.type="StereoCamera";this.aspect=1;this.eyeSep=.064;this.cameraL=new ja;this.cameraL.layers.enable(1);this.cameraL.matrixAutoUpdate=!1;this.cameraR=new ja;this.cameraR.layers.enable(2);this.cameraR.matrixAutoUpdate=!1;this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}function vg(a){this.autoStart=void 0!==a?a:!0;this.elapsedTime=this.oldTime=this.startTime= -0;this.running=!1}function wg(){A.call(this);this.type="AudioListener";this.context=xg.getContext();this.gain=this.context.createGain();this.gain.connect(this.context.destination);this.filter=null;this.timeDelta=0;this._clock=new vg}function dd(a){A.call(this);this.type="Audio";this.listener=a;this.context=a.context;this.gain=this.context.createGain();this.gain.connect(a.getInput());this.autoplay=!1;this.buffer=null;this.detune=0;this.loop=!1;this.offset=this.startTime=0;this.duration=void 0;this.playbackRate= -1;this.isPlaying=!1;this.hasPlaybackControl=!0;this.sourceType="empty";this.filters=[]}function yg(a){dd.call(this,a);this.panner=this.context.createPanner();this.panner.panningModel="HRTF";this.panner.connect(this.gain)}function zg(a,b){this.analyser=a.context.createAnalyser();this.analyser.fftSize=void 0!==b?b:2048;this.data=new Uint8Array(this.analyser.frequencyBinCount);a.getOutput().connect(this.analyser)}function Ag(a,b,c){this.binding=a;this.valueSize=c;a=Float64Array;switch(b){case "quaternion":b= -this._slerp;break;case "string":case "bool":a=Array;b=this._select;break;default:b=this._lerp}this.buffer=new a(4*c);this._mixBufferRegion=b;this.referenceCount=this.useCount=this.cumulativeWeight=0}function Vh(a,b,c){c=c||ya.parseTrackName(b);this._targetGroup=a;this._bindings=a.subscribe_(b,c)}function ya(a,b,c){this.path=b;this.parsedPath=c||ya.parseTrackName(b);this.node=ya.findNode(a,this.parsedPath.nodeName)||a;this.rootNode=a}function Wh(){this.uuid=N.generateUUID();this._objects=Array.prototype.slice.call(arguments); -this.nCachedObjects_=0;var a={};this._indicesByUUID=a;for(var b=0,c=arguments.length;b!==c;++b)a[arguments[b].uuid]=b;this._paths=[];this._parsedPaths=[];this._bindings=[];this._bindingsIndicesByPath={};var d=this;this.stats={objects:{get total(){return d._objects.length},get inUse(){return this.total-d.nCachedObjects_}},get bindingsPerObject(){return d._bindings.length}}}function Xh(a,b,c){this._mixer=a;this._clip=b;this._localRoot=c||null;a=b.tracks;b=a.length;c=Array(b);for(var d={endingStart:2400, -endingEnd:2400},e=0;e!==b;++e){var f=a[e].createInterpolant(null);c[e]=f;f.settings=d}this._interpolantSettings=d;this._interpolants=c;this._propertyBindings=Array(b);this._weightInterpolant=this._timeScaleInterpolant=this._byClipCacheIndex=this._cacheIndex=null;this.loop=2201;this._loopCount=-1;this._startTime=null;this.time=0;this._effectiveWeight=this.weight=this._effectiveTimeScale=this.timeScale=1;this.repetitions=Infinity;this.paused=!1;this.enabled=!0;this.clampWhenFinished=!1;this.zeroSlopeAtEnd= -this.zeroSlopeAtStart=!0}function Bg(a){this._root=a;this._initMemoryManager();this.time=this._accuIndex=0;this.timeScale=1}function lf(a,b){"string"===typeof a&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),a=b);this.value=a}function Cg(a,b,c){bc.call(this,a,b);this.meshPerAttribute=c||1}function Yh(a,b,c,d){this.ray=new Rb(a,b);this.near=c||0;this.far=d||Infinity;this.camera=null;this.params={Mesh:{},Line:{},LOD:{},Points:{threshold:1},Sprite:{}};Object.defineProperties(this.params, -{PointCloud:{get:function(){console.warn("THREE.Raycaster: params.PointCloud has been renamed to params.Points.");return this.Points}}})}function Zh(a,b){return a.distance-b.distance}function Dg(a,b,c,d){if(!1!==a.visible&&(a.raycast(b,c),!0===d)){a=a.children;d=0;for(var e=a.length;dc;c++,d++){var e=c/32*Math.PI*2,f=d/32*Math.PI*2;b.push(Math.cos(e),Math.sin(e),1,Math.cos(f),Math.sin(f),1)}a.addAttribute("position",new B(b,3)); -b=new P({fog:!1});this.cone=new aa(a,b);this.add(this.cone);this.update()}function bi(a){var b=[];a&&a.isBone&&b.push(a);for(var c=0;ca;a++)this.coefficients.push(new n)}function Xa(a,b){ba.call(this,void 0,b);this.sh=void 0!==a?a:new kf}function tg(a,b,c){Xa.call(this, +void 0,c);a=(new I).set(a);c=(new I).set(b);b=new n(a.r,a.g,a.b);a=new n(c.r,c.g,c.b);c=Math.sqrt(Math.PI);var d=c*Math.sqrt(.75);this.sh.coefficients[0].copy(b).add(a).multiplyScalar(c);this.sh.coefficients[1].copy(b).sub(a).multiplyScalar(d)}function ug(a,b){Xa.call(this,void 0,b);a=(new I).set(a);this.sh.coefficients[0].set(a.r,a.g,a.b).multiplyScalar(2*Math.sqrt(Math.PI))}function Uh(){this.type="StereoCamera";this.aspect=1;this.eyeSep=.064;this.cameraL=new ja;this.cameraL.layers.enable(1);this.cameraL.matrixAutoUpdate= +!1;this.cameraR=new ja;this.cameraR.layers.enable(2);this.cameraR.matrixAutoUpdate=!1;this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}function vg(a){this.autoStart=void 0!==a?a:!0;this.elapsedTime=this.oldTime=this.startTime=0;this.running=!1}function wg(){A.call(this);this.type="AudioListener";this.context=xg.getContext();this.gain=this.context.createGain();this.gain.connect(this.context.destination);this.filter=null;this.timeDelta=0;this._clock=new vg}function dd(a){A.call(this); +this.type="Audio";this.listener=a;this.context=a.context;this.gain=this.context.createGain();this.gain.connect(a.getInput());this.autoplay=!1;this.buffer=null;this.detune=0;this.loop=!1;this.offset=this.startTime=0;this.duration=void 0;this.playbackRate=1;this.isPlaying=!1;this.hasPlaybackControl=!0;this.sourceType="empty";this.filters=[]}function yg(a){dd.call(this,a);this.panner=this.context.createPanner();this.panner.panningModel="HRTF";this.panner.connect(this.gain)}function zg(a,b){this.analyser= +a.context.createAnalyser();this.analyser.fftSize=void 0!==b?b:2048;this.data=new Uint8Array(this.analyser.frequencyBinCount);a.getOutput().connect(this.analyser)}function Ag(a,b,c){this.binding=a;this.valueSize=c;a=Float64Array;switch(b){case "quaternion":b=this._slerp;break;case "string":case "bool":a=Array;b=this._select;break;default:b=this._lerp}this.buffer=new a(4*c);this._mixBufferRegion=b;this.referenceCount=this.useCount=this.cumulativeWeight=0}function Vh(a,b,c){c=c||ya.parseTrackName(b); +this._targetGroup=a;this._bindings=a.subscribe_(b,c)}function ya(a,b,c){this.path=b;this.parsedPath=c||ya.parseTrackName(b);this.node=ya.findNode(a,this.parsedPath.nodeName)||a;this.rootNode=a}function Wh(){this.uuid=N.generateUUID();this._objects=Array.prototype.slice.call(arguments);this.nCachedObjects_=0;var a={};this._indicesByUUID=a;for(var b=0,c=arguments.length;b!==c;++b)a[arguments[b].uuid]=b;this._paths=[];this._parsedPaths=[];this._bindings=[];this._bindingsIndicesByPath={};var d=this;this.stats= +{objects:{get total(){return d._objects.length},get inUse(){return this.total-d.nCachedObjects_}},get bindingsPerObject(){return d._bindings.length}}}function Xh(a,b,c){this._mixer=a;this._clip=b;this._localRoot=c||null;a=b.tracks;b=a.length;c=Array(b);for(var d={endingStart:2400,endingEnd:2400},e=0;e!==b;++e){var f=a[e].createInterpolant(null);c[e]=f;f.settings=d}this._interpolantSettings=d;this._interpolants=c;this._propertyBindings=Array(b);this._weightInterpolant=this._timeScaleInterpolant=this._byClipCacheIndex= +this._cacheIndex=null;this.loop=2201;this._loopCount=-1;this._startTime=null;this.time=0;this._effectiveWeight=this.weight=this._effectiveTimeScale=this.timeScale=1;this.repetitions=Infinity;this.paused=!1;this.enabled=!0;this.clampWhenFinished=!1;this.zeroSlopeAtEnd=this.zeroSlopeAtStart=!0}function Bg(a){this._root=a;this._initMemoryManager();this.time=this._accuIndex=0;this.timeScale=1}function lf(a,b){"string"===typeof a&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),a=b); +this.value=a}function Cg(a,b,c){bc.call(this,a,b);this.meshPerAttribute=c||1}function Yh(a,b,c,d){this.ray=new Rb(a,b);this.near=c||0;this.far=d||Infinity;this.camera=null;this.params={Mesh:{},Line:{},LOD:{},Points:{threshold:1},Sprite:{}};Object.defineProperties(this.params,{PointCloud:{get:function(){console.warn("THREE.Raycaster: params.PointCloud has been renamed to params.Points.");return this.Points}}})}function Zh(a,b){return a.distance-b.distance}function Dg(a,b,c,d){if(!1!==a.visible&&(a.raycast(b, +c),!0===d)){a=a.children;d=0;for(var e=a.length;dc;c++,d++){var e=c/32*Math.PI*2,f=d/32*Math.PI*2;b.push(Math.cos(e),Math.sin(e),1,Math.cos(f),Math.sin(f),1)}a.addAttribute("position",new B(b,3));b=new P({fog:!1});this.cone=new aa(a,b);this.add(this.cone);this.update()}function bi(a){var b=[];a&&a.isBone&&b.push(a);for(var c=0;cg)e=a+1;else if(0b&&(b=0);1Number.EPSILON&&(g.normalize(),c=Math.acos(N.clamp(d[l-1].dot(d[l]),-1,1)),e[l].applyMatrix4(h.makeRotationAxis(g, -c))),f[l].crossVectors(d[l],e[l]);if(!0===b)for(c=Math.acos(N.clamp(e[0].dot(e[a]),-1,1)),c/=a,0d;)d+=c;for(;d>c;)d-=c;de&&(e=1);1E-4>d&&(d=e);1E-4>l&&(l=e);Xg.initNonuniformCatmullRom(f.x,g.x,h.x,c.x,d,e,l);Yg.initNonuniformCatmullRom(f.y,g.y,h.y,c.y,d,e,l);Zg.initNonuniformCatmullRom(f.z, -g.z,h.z,c.z,d,e,l)}else"catmullrom"===this.curveType&&(Xg.initCatmullRom(f.x,g.x,h.x,c.x,this.tension),Yg.initCatmullRom(f.y,g.y,h.y,c.y,this.tension),Zg.initCatmullRom(f.z,g.z,h.z,c.z,this.tension));b.set(Xg.calc(a),Yg.calc(a),Zg.calc(a));return b};wa.prototype.copy=function(a){C.prototype.copy.call(this,a);this.points=[];for(var b=0,c=a.points.length;bc.length-2?c.length-1:a+1];c=c[a>c.length-3?c.length-1:a+2];b.set(Th(d,e.x,f.x,g.x, -c.x),Th(d,e.y,f.y,g.y,c.y));return b};Va.prototype.copy=function(a){C.prototype.copy.call(this,a);this.points=[];for(var b=0,c=a.points.length;b=b)return b=c[a]-b,a=this.curves[a],c=a.getLength(),a.getPointAt(0===c?0:1-b/c);a++}return null},getLength:function(){var a=this.getCurveLengths();return a[a.length-1]},updateArcLengths:function(){this.needsUpdate=!0;this.cacheLengths=null;this.getCurveLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var a=[], -b=0,c=0,d=this.curves.length;cNumber.EPSILON){if(0>k&&(g=b[f],l=-l,h=b[e],k=-k),!(a.yh.y))if(a.y===g.y){if(a.x===g.x)return!0}else{e=k*(a.x-g.x)-l*(a.y-g.y);if(0===e)return!0; -0>e||(d=!d)}}else if(a.y===g.y&&(h.x<=a.x&&a.x<=g.x||g.x<=a.x&&a.x<=h.x))return!0}return d}var e=pb.isClockWise,f=this.subPaths;if(0===f.length)return[];if(!0===b)return c(f);b=[];if(1===f.length){var g=f[0];var h=new Ib;h.curves=g.curves;b.push(h);return b}var l=!e(f[0].getPoints());l=a?!l:l;h=[];var k=[],n=[],u=0;k[u]=void 0;n[u]=[];for(var q=0,r=f.length;qb;b++)this.coefficients[b].copy(a[b]);return this},zero:function(){for(var a=0;9>a;a++)this.coefficients[a].set(0, -0,0);return this},getAt:function(a,b){var c=a.x,d=a.y;a=a.z;var e=this.coefficients;b.copy(e[0]).multiplyScalar(.282095);b.addScale(e[1],.488603*d);b.addScale(e[2],.488603*a);b.addScale(e[3],.488603*c);b.addScale(e[4],1.092548*c*d);b.addScale(e[5],1.092548*d*a);b.addScale(e[6],.315392*(3*a*a-1));b.addScale(e[7],1.092548*c*a);b.addScale(e[8],.546274*(c*c-d*d));return b},getIrradianceAt:function(a,b){var c=a.x,d=a.y;a=a.z;var e=this.coefficients;b.copy(e[0]).multiplyScalar(.886227);b.addScale(e[1], -1.023328*d);b.addScale(e[2],1.023328*a);b.addScale(e[3],1.023328*c);b.addScale(e[4],.858086*c*d);b.addScale(e[5],.858086*d*a);b.addScale(e[6],.743125*a*a-.247708);b.addScale(e[7],.858086*c*a);b.addScale(e[8],.429043*(c*c-d*d));return b},add:function(a){for(var b=0;9>b;b++)this.coefficients[b].add(a.coefficients[b]);return this},scale:function(a){for(var b=0;9>b;b++)this.coefficients[b].multiplyScalar(a);return this},lerp:function(a,b){for(var c=0;9>c;c++)this.coefficients[c].lerp(a.coefficients[c], -b);return this},equals:function(a){for(var b=0;9>b;b++)if(!this.coefficients[b].equals(a.coefficients[b]))return!1;return!0},copy:function(a){return this.set(a.coefficients)},clone:function(){return(new this.constructor).copy(this)},fromArray:function(a,b){void 0===b&&(b=0);for(var c=this.coefficients,d=0;9>d;d++)c[d].fromArray(a,b+3*d);return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);for(var c=this.coefficients,d=0;9>d;d++)c[d].toArray(a,b+3*d);return a}});Object.assign(kf, -{getBasisAt:function(a,b){var c=a.x,d=a.y;a=a.z;b[0]=.282095;b[1]=.488603*d;b[2]=.488603*a;b[3]=.488603*c;b[4]=1.092548*c*d;b[5]=1.092548*d*a;b[6]=.315392*(3*a*a-1);b[7]=1.092548*c*a;b[8]=.546274*(c*c-d*d)}});Xa.prototype=Object.assign(Object.create(ba.prototype),{constructor:Xa,isLightProbe:!0,copy:function(a){ba.prototype.copy.call(this,a);this.sh.copy(a.sh);this.intensity=a.intensity;return this},toJSON:function(a){return ba.prototype.toJSON.call(this,a)}});tg.prototype=Object.assign(Object.create(Xa.prototype), -{constructor:tg,isHemisphereLightProbe:!0,copy:function(a){Xa.prototype.copy.call(this,a);return this},toJSON:function(a){return Xa.prototype.toJSON.call(this,a)}});ug.prototype=Object.assign(Object.create(Xa.prototype),{constructor:ug,isAmbientLightProbe:!0,copy:function(a){Xa.prototype.copy.call(this,a);return this},toJSON:function(a){return Xa.prototype.toJSON.call(this,a)}});var xi=new W,yi=new W;Object.assign(Uh.prototype,{update:function(a){var b=this._cache;if(b.focus!==a.focus||b.fov!==a.fov|| -b.aspect!==a.aspect*this.aspect||b.near!==a.near||b.far!==a.far||b.zoom!==a.zoom||b.eyeSep!==this.eyeSep){b.focus=a.focus;b.fov=a.fov;b.aspect=a.aspect*this.aspect;b.near=a.near;b.far=a.far;b.zoom=a.zoom;b.eyeSep=this.eyeSep;var c=a.projectionMatrix.clone(),d=b.eyeSep/2,e=d*b.near/b.focus,f=b.near*Math.tan(N.DEG2RAD*b.fov*.5)/b.zoom;yi.elements[12]=-d;xi.elements[12]=d;d=-f*b.aspect+e;var g=f*b.aspect+e;c.elements[0]=2*b.near/(g-d);c.elements[8]=(g+d)/(g-d);this.cameraL.projectionMatrix.copy(c);d= --f*b.aspect-e;g=f*b.aspect-e;c.elements[0]=2*b.near/(g-d);c.elements[8]=(g+d)/(g-d);this.cameraR.projectionMatrix.copy(c)}this.cameraL.matrixWorld.copy(a.matrixWorld).multiply(yi);this.cameraR.matrixWorld.copy(a.matrixWorld).multiply(xi)}});Object.assign(vg.prototype,{start:function(){this.oldTime=this.startTime=("undefined"===typeof performance?Date:performance).now();this.elapsedTime=0;this.running=!0},stop:function(){this.getElapsedTime();this.autoStart=this.running=!1},getElapsedTime:function(){this.getDelta(); -return this.elapsedTime},getDelta:function(){var a=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){var b=("undefined"===typeof performance?Date:performance).now();a=(b-this.oldTime)/1E3;this.oldTime=b;this.elapsedTime+=a}return a}});var vc=new n,zi=new sa,vk=new n,wc=new n;wg.prototype=Object.assign(Object.create(A.prototype),{constructor:wg,getInput:function(){return this.gain},removeFilter:function(){null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination), -this.gain.connect(this.context.destination),this.filter=null);return this},getFilter:function(){return this.filter},setFilter:function(a){null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination);this.filter=a;this.gain.connect(this.filter);this.filter.connect(this.context.destination);return this},getMasterVolume:function(){return this.gain.gain.value},setMasterVolume:function(a){this.gain.gain.setTargetAtTime(a, -this.context.currentTime,.01);return this},updateMatrixWorld:function(a){A.prototype.updateMatrixWorld.call(this,a);a=this.context.listener;var b=this.up;this.timeDelta=this._clock.getDelta();this.matrixWorld.decompose(vc,zi,vk);wc.set(0,0,-1).applyQuaternion(zi);if(a.positionX){var c=this.context.currentTime+this.timeDelta;a.positionX.linearRampToValueAtTime(vc.x,c);a.positionY.linearRampToValueAtTime(vc.y,c);a.positionZ.linearRampToValueAtTime(vc.z,c);a.forwardX.linearRampToValueAtTime(wc.x,c); -a.forwardY.linearRampToValueAtTime(wc.y,c);a.forwardZ.linearRampToValueAtTime(wc.z,c);a.upX.linearRampToValueAtTime(b.x,c);a.upY.linearRampToValueAtTime(b.y,c);a.upZ.linearRampToValueAtTime(b.z,c)}else a.setPosition(vc.x,vc.y,vc.z),a.setOrientation(wc.x,wc.y,wc.z,b.x,b.y,b.z)}});dd.prototype=Object.assign(Object.create(A.prototype),{constructor:dd,getOutput:function(){return this.gain},setNodeSource:function(a){this.hasPlaybackControl=!1;this.sourceType="audioNode";this.source=a;this.connect();return this}, -setMediaElementSource:function(a){this.hasPlaybackControl=!1;this.sourceType="mediaNode";this.source=this.context.createMediaElementSource(a);this.connect();return this},setBuffer:function(a){this.buffer=a;this.sourceType="buffer";this.autoplay&&this.play();return this},play:function(){if(!0===this.isPlaying)console.warn("THREE.Audio: Audio is already playing.");else if(!1===this.hasPlaybackControl)console.warn("THREE.Audio: this Audio has no playback control.");else{var a=this.context.createBufferSource(); -a.buffer=this.buffer;a.loop=this.loop;a.onended=this.onEnded.bind(this);this.startTime=this.context.currentTime;a.start(this.startTime,this.offset,this.duration);this.isPlaying=!0;this.source=a;this.setDetune(this.detune);this.setPlaybackRate(this.playbackRate);return this.connect()}},pause:function(){if(!1===this.hasPlaybackControl)console.warn("THREE.Audio: this Audio has no playback control.");else return!0===this.isPlaying&&(this.source.stop(),this.source.onended=null,this.offset+=(this.context.currentTime- -this.startTime)*this.playbackRate,this.isPlaying=!1),this},stop:function(){if(!1===this.hasPlaybackControl)console.warn("THREE.Audio: this Audio has no playback control.");else return this.source.stop(),this.source.onended=null,this.offset=0,this.isPlaying=!1,this},connect:function(){if(0d&&this._mixBufferRegion(c,a,3*b,1-d,b);d=b;for(var f=b+b;d!==f;++d)if(c[d]!==c[d+b]){e.setValue(c,a);break}},saveOriginalState:function(){var a=this.buffer,b=this.valueSize,c=3*b;this.binding.getValue(a,c);for(var d=b;d!==c;++d)a[d]=a[c+d%b];this.cumulativeWeight=0},restoreOriginalState:function(){this.binding.setValue(this.buffer,3*this.valueSize)},_select:function(a,b,c,d,e){if(.5<=d)for(d= -0;d!==e;++d)a[b+d]=a[c+d]},_slerp:function(a,b,c,d){sa.slerpFlat(a,b,a,b,a,c,d)},_lerp:function(a,b,c,d,e){for(var f=1-d,g=0;g!==e;++g){var h=b+g;a[h]=a[h]*f+a[c+g]*d}}});var xk=/[\[\]\.:\/]/g,yk="[^"+"\\[\\]\\.:\\/".replace("\\.","")+"]",zk=/((?:WC+[\/:])*)/.source.replace("WC","[^\\[\\]\\.:\\/]"),Ak=/(WCOD+)?/.source.replace("WCOD",yk),Bk=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC","[^\\[\\]\\.:\\/]"),Ck=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC","[^\\[\\]\\.:\\/]"),Dk=new RegExp("^"+zk+Ak+ -Bk+Ck+"$"),Ek=["material","materials","bones"];Object.assign(Vh.prototype,{getValue:function(a,b){this.bind();var c=this._bindings[this._targetGroup.nCachedObjects_];void 0!==c&&c.getValue(a,b)},setValue:function(a,b){for(var c=this._bindings,d=this._targetGroup.nCachedObjects_,e=c.length;d!==e;++d)c[d].setValue(a,b)},bind:function(){for(var a=this._bindings,b=this._targetGroup.nCachedObjects_,c=a.length;b!==c;++b)a[b].bind()},unbind:function(){for(var a=this._bindings,b=this._targetGroup.nCachedObjects_, +this.duration,a)}});var uc={enabled:!1,files:{},add:function(a,b){!1!==this.enabled&&(this.files[a]=b)},get:function(a){if(!1!==this.enabled)return this.files[a]},remove:function(a){delete this.files[a]},clear:function(){this.files={}}},Sh=new kg;Object.assign(Z.prototype,{load:function(){},parse:function(){},setCrossOrigin:function(a){this.crossOrigin=a;return this},setPath:function(a){this.path=a;return this},setResourcePath:function(a){this.resourcePath=a;return this}});var $a={};Na.prototype= +Object.assign(Object.create(Z.prototype),{constructor:Na,load:function(a,b,c,d){void 0===a&&(a="");void 0!==this.path&&(a=this.path+a);a=this.manager.resolveURL(a);var e=this,f=uc.get(a);if(void 0!==f)return e.manager.itemStart(a),setTimeout(function(){b&&b(f);e.manager.itemEnd(a)},0),f;if(void 0!==$a[a])$a[a].push({onLoad:b,onProgress:c,onError:d});else{var g=a.match(/^data:(.*?)(;base64)?,(.*)$/);if(g){c=g[1];var h=!!g[2];g=g[3];g=decodeURIComponent(g);h&&(g=atob(g));try{var l=(this.responseType|| +"").toLowerCase();switch(l){case "arraybuffer":case "blob":var k=new Uint8Array(g.length);for(h=0;hg)e=a+1;else if(0b&&(b=0);1Number.EPSILON&&(g.normalize(),c=Math.acos(N.clamp(d[l-1].dot(d[l]),-1,1)),e[l].applyMatrix4(h.makeRotationAxis(g,c))),f[l].crossVectors(d[l],e[l]);if(!0===b)for(c=Math.acos(N.clamp(e[0].dot(e[a]),-1,1)),c/=a,0d;)d+=c;for(;d>c;)d-=c;de&&(e=1);1E-4>d&&(d=e);1E-4>l&&(l=e);Xg.initNonuniformCatmullRom(f.x,g.x,h.x,c.x,d,e,l);Yg.initNonuniformCatmullRom(f.y,g.y,h.y,c.y,d,e,l);Zg.initNonuniformCatmullRom(f.z,g.z,h.z,c.z,d,e,l)}else"catmullrom"===this.curveType&&(Xg.initCatmullRom(f.x,g.x,h.x,c.x,this.tension),Yg.initCatmullRom(f.y,g.y,h.y,c.y,this.tension),Zg.initCatmullRom(f.z,g.z,h.z,c.z,this.tension));b.set(Xg.calc(a), +Yg.calc(a),Zg.calc(a));return b};wa.prototype.copy=function(a){C.prototype.copy.call(this,a);this.points=[];for(var b=0,c=a.points.length;bc.length-2?c.length-1:a+1];c=c[a>c.length-3?c.length-1:a+2];b.set(Th(d,e.x,f.x,g.x,c.x),Th(d,e.y,f.y,g.y,c.y));return b};Va.prototype.copy=function(a){C.prototype.copy.call(this,a);this.points=[];for(var b=0,c=a.points.length;b=b)return b=c[a]-b,a=this.curves[a],c=a.getLength(),a.getPointAt(0===c?0:1-b/c);a++}return null},getLength:function(){var a=this.getCurveLengths(); +return a[a.length-1]},updateArcLengths:function(){this.needsUpdate=!0;this.cacheLengths=null;this.getCurveLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var a=[],b=0,c=0,d=this.curves.length;cNumber.EPSILON){if(0>k&&(g=b[f],l=-l,h=b[e],k=-k),!(a.yh.y))if(a.y===g.y){if(a.x===g.x)return!0}else{e=k*(a.x-g.x)-l*(a.y-g.y);if(0===e)return!0;0>e||(d=!d)}}else if(a.y===g.y&&(h.x<=a.x&&a.x<=g.x||g.x<=a.x&&a.x<=h.x))return!0}return d}var e=pb.isClockWise,f=this.subPaths;if(0===f.length)return[];if(!0===b)return c(f);b=[];if(1===f.length){var g=f[0];var h=new Ib;h.curves=g.curves; +b.push(h);return b}var l=!e(f[0].getPoints());l=a?!l:l;h=[];var k=[],n=[],u=0;k[u]=void 0;n[u]=[];for(var q=0,r=f.length;qb;b++)this.coefficients[b].copy(a[b]);return this},zero:function(){for(var a=0;9>a;a++)this.coefficients[a].set(0,0,0);return this},getAt:function(a,b){var c=a.x,d=a.y;a=a.z;var e=this.coefficients;b.copy(e[0]).multiplyScalar(.282095);b.addScale(e[1],.488603*d);b.addScale(e[2],.488603*a);b.addScale(e[3],.488603*c);b.addScale(e[4],1.092548*c*d);b.addScale(e[5],1.092548*d*a);b.addScale(e[6],.315392*(3*a*a-1)); +b.addScale(e[7],1.092548*c*a);b.addScale(e[8],.546274*(c*c-d*d));return b},getIrradianceAt:function(a,b){var c=a.x,d=a.y;a=a.z;var e=this.coefficients;b.copy(e[0]).multiplyScalar(.886227);b.addScale(e[1],1.023328*d);b.addScale(e[2],1.023328*a);b.addScale(e[3],1.023328*c);b.addScale(e[4],.858086*c*d);b.addScale(e[5],.858086*d*a);b.addScale(e[6],.743125*a*a-.247708);b.addScale(e[7],.858086*c*a);b.addScale(e[8],.429043*(c*c-d*d));return b},add:function(a){for(var b=0;9>b;b++)this.coefficients[b].add(a.coefficients[b]); +return this},scale:function(a){for(var b=0;9>b;b++)this.coefficients[b].multiplyScalar(a);return this},lerp:function(a,b){for(var c=0;9>c;c++)this.coefficients[c].lerp(a.coefficients[c],b);return this},equals:function(a){for(var b=0;9>b;b++)if(!this.coefficients[b].equals(a.coefficients[b]))return!1;return!0},copy:function(a){return this.set(a.coefficients)},clone:function(){return(new this.constructor).copy(this)},fromArray:function(a,b){void 0===b&&(b=0);for(var c=this.coefficients,d=0;9>d;d++)c[d].fromArray(a, +b+3*d);return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);for(var c=this.coefficients,d=0;9>d;d++)c[d].toArray(a,b+3*d);return a}});Object.assign(kf,{getBasisAt:function(a,b){var c=a.x,d=a.y;a=a.z;b[0]=.282095;b[1]=.488603*d;b[2]=.488603*a;b[3]=.488603*c;b[4]=1.092548*c*d;b[5]=1.092548*d*a;b[6]=.315392*(3*a*a-1);b[7]=1.092548*c*a;b[8]=.546274*(c*c-d*d)}});Xa.prototype=Object.assign(Object.create(ba.prototype),{constructor:Xa,isLightProbe:!0,copy:function(a){ba.prototype.copy.call(this, +a);this.sh.copy(a.sh);this.intensity=a.intensity;return this},toJSON:function(a){return ba.prototype.toJSON.call(this,a)}});tg.prototype=Object.assign(Object.create(Xa.prototype),{constructor:tg,isHemisphereLightProbe:!0,copy:function(a){Xa.prototype.copy.call(this,a);return this},toJSON:function(a){return Xa.prototype.toJSON.call(this,a)}});ug.prototype=Object.assign(Object.create(Xa.prototype),{constructor:ug,isAmbientLightProbe:!0,copy:function(a){Xa.prototype.copy.call(this,a);return this},toJSON:function(a){return Xa.prototype.toJSON.call(this, +a)}});var xi=new W,yi=new W;Object.assign(Uh.prototype,{update:function(a){var b=this._cache;if(b.focus!==a.focus||b.fov!==a.fov||b.aspect!==a.aspect*this.aspect||b.near!==a.near||b.far!==a.far||b.zoom!==a.zoom||b.eyeSep!==this.eyeSep){b.focus=a.focus;b.fov=a.fov;b.aspect=a.aspect*this.aspect;b.near=a.near;b.far=a.far;b.zoom=a.zoom;b.eyeSep=this.eyeSep;var c=a.projectionMatrix.clone(),d=b.eyeSep/2,e=d*b.near/b.focus,f=b.near*Math.tan(N.DEG2RAD*b.fov*.5)/b.zoom;yi.elements[12]=-d;xi.elements[12]=d; +d=-f*b.aspect+e;var g=f*b.aspect+e;c.elements[0]=2*b.near/(g-d);c.elements[8]=(g+d)/(g-d);this.cameraL.projectionMatrix.copy(c);d=-f*b.aspect-e;g=f*b.aspect-e;c.elements[0]=2*b.near/(g-d);c.elements[8]=(g+d)/(g-d);this.cameraR.projectionMatrix.copy(c)}this.cameraL.matrixWorld.copy(a.matrixWorld).multiply(yi);this.cameraR.matrixWorld.copy(a.matrixWorld).multiply(xi)}});Object.assign(vg.prototype,{start:function(){this.oldTime=this.startTime=("undefined"===typeof performance?Date:performance).now(); +this.elapsedTime=0;this.running=!0},stop:function(){this.getElapsedTime();this.autoStart=this.running=!1},getElapsedTime:function(){this.getDelta();return this.elapsedTime},getDelta:function(){var a=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){var b=("undefined"===typeof performance?Date:performance).now();a=(b-this.oldTime)/1E3;this.oldTime=b;this.elapsedTime+=a}return a}});var vc=new n,zi=new sa,vk=new n,wc=new n;wg.prototype=Object.assign(Object.create(A.prototype), +{constructor:wg,getInput:function(){return this.gain},removeFilter:function(){null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null);return this},getFilter:function(){return this.filter},setFilter:function(a){null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination);this.filter=a;this.gain.connect(this.filter); +this.filter.connect(this.context.destination);return this},getMasterVolume:function(){return this.gain.gain.value},setMasterVolume:function(a){this.gain.gain.setTargetAtTime(a,this.context.currentTime,.01);return this},updateMatrixWorld:function(a){A.prototype.updateMatrixWorld.call(this,a);a=this.context.listener;var b=this.up;this.timeDelta=this._clock.getDelta();this.matrixWorld.decompose(vc,zi,vk);wc.set(0,0,-1).applyQuaternion(zi);if(a.positionX){var c=this.context.currentTime+this.timeDelta; +a.positionX.linearRampToValueAtTime(vc.x,c);a.positionY.linearRampToValueAtTime(vc.y,c);a.positionZ.linearRampToValueAtTime(vc.z,c);a.forwardX.linearRampToValueAtTime(wc.x,c);a.forwardY.linearRampToValueAtTime(wc.y,c);a.forwardZ.linearRampToValueAtTime(wc.z,c);a.upX.linearRampToValueAtTime(b.x,c);a.upY.linearRampToValueAtTime(b.y,c);a.upZ.linearRampToValueAtTime(b.z,c)}else a.setPosition(vc.x,vc.y,vc.z),a.setOrientation(wc.x,wc.y,wc.z,b.x,b.y,b.z)}});dd.prototype=Object.assign(Object.create(A.prototype), +{constructor:dd,getOutput:function(){return this.gain},setNodeSource:function(a){this.hasPlaybackControl=!1;this.sourceType="audioNode";this.source=a;this.connect();return this},setMediaElementSource:function(a){this.hasPlaybackControl=!1;this.sourceType="mediaNode";this.source=this.context.createMediaElementSource(a);this.connect();return this},setBuffer:function(a){this.buffer=a;this.sourceType="buffer";this.autoplay&&this.play();return this},play:function(){if(!0===this.isPlaying)console.warn("THREE.Audio: Audio is already playing."); +else if(!1===this.hasPlaybackControl)console.warn("THREE.Audio: this Audio has no playback control.");else{var a=this.context.createBufferSource();a.buffer=this.buffer;a.loop=this.loop;a.onended=this.onEnded.bind(this);this.startTime=this.context.currentTime;a.start(this.startTime,this.offset,this.duration);this.isPlaying=!0;this.source=a;this.setDetune(this.detune);this.setPlaybackRate(this.playbackRate);return this.connect()}},pause:function(){if(!1===this.hasPlaybackControl)console.warn("THREE.Audio: this Audio has no playback control."); +else return!0===this.isPlaying&&(this.source.stop(),this.source.onended=null,this.offset+=(this.context.currentTime-this.startTime)*this.playbackRate,this.isPlaying=!1),this},stop:function(){if(!1===this.hasPlaybackControl)console.warn("THREE.Audio: this Audio has no playback control.");else return this.source.stop(),this.source.onended=null,this.offset=0,this.isPlaying=!1,this},connect:function(){if(0d&&this._mixBufferRegion(c,a,3*b,1-d,b);d=b;for(var f=b+b;d!==f;++d)if(c[d]!==c[d+b]){e.setValue(c,a);break}},saveOriginalState:function(){var a=this.buffer,b=this.valueSize,c=3*b;this.binding.getValue(a,c);for(var d=b;d!==c;++d)a[d]=a[c+d%b];this.cumulativeWeight=0},restoreOriginalState:function(){this.binding.setValue(this.buffer,3*this.valueSize)},_select:function(a, +b,c,d,e){if(.5<=d)for(d=0;d!==e;++d)a[b+d]=a[c+d]},_slerp:function(a,b,c,d){sa.slerpFlat(a,b,a,b,a,c,d)},_lerp:function(a,b,c,d,e){for(var f=1-d,g=0;g!==e;++g){var h=b+g;a[h]=a[h]*f+a[c+g]*d}}});var xk=/[\[\]\.:\/]/g,yk="[^"+"\\[\\]\\.:\\/".replace("\\.","")+"]",zk=/((?:WC+[\/:])*)/.source.replace("WC","[^\\[\\]\\.:\\/]"),Ak=/(WCOD+)?/.source.replace("WCOD",yk),Bk=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC","[^\\[\\]\\.:\\/]"),Ck=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC","[^\\[\\]\\.:\\/]"), +Dk=new RegExp("^"+zk+Ak+Bk+Ck+"$"),Ek=["material","materials","bones"];Object.assign(Vh.prototype,{getValue:function(a,b){this.bind();var c=this._bindings[this._targetGroup.nCachedObjects_];void 0!==c&&c.getValue(a,b)},setValue:function(a,b){for(var c=this._bindings,d=this._targetGroup.nCachedObjects_,e=c.length;d!==e;++d)c[d].setValue(a,b)},bind:function(){for(var a=this._bindings,b=this._targetGroup.nCachedObjects_,c=a.length;b!==c;++b)a[b].bind()},unbind:function(){for(var a=this._bindings,b=this._targetGroup.nCachedObjects_, c=a.length;b!==c;++b)a[b].unbind()}});Object.assign(ya,{Composite:Vh,create:function(a,b,c){return a&&a.isAnimationObjectGroup?new ya.Composite(a,b,c):new ya(a,b,c)},sanitizeNodeName:function(a){return a.replace(/\s/g,"_").replace(xk,"")},parseTrackName:function(a){var b=Dk.exec(a);if(!b)throw Error("PropertyBinding: Cannot parse trackName: "+a);b={nodeName:b[2],objectName:b[3],objectIndex:b[4],propertyName:b[5],propertyIndex:b[6]};var c=b.nodeName&&b.nodeName.lastIndexOf(".");if(void 0!==c&&-1!== c){var d=b.nodeName.substring(c+1);-1!==Ek.indexOf(d)&&(b.nodeName=b.nodeName.substring(0,c),b.objectName=d)}if(null===b.propertyName||0===b.propertyName.length)throw Error("PropertyBinding: can not parse propertyName from trackName: "+a);return b},findNode:function(a,b){if(!b||""===b||"root"===b||"."===b||-1===b||b===a.name||b===a.uuid)return a;if(a.skeleton){var c=a.skeleton.getBoneByName(b);if(void 0!==c)return c}if(a.children){var d=function(a){for(var c=0;c Date: Mon, 19 Aug 2019 12:43:58 +0200 Subject: [PATCH 68/75] Generate lightProbe from CubeCamera --- examples/js/lights/LightProbeGenerator.js | 99 ++++++++++++++++++++ examples/jsm/lights/LightProbeGenerator.d.ts | 4 +- examples/jsm/lights/LightProbeGenerator.js | 99 ++++++++++++++++++++ 3 files changed, 201 insertions(+), 1 deletion(-) diff --git a/examples/js/lights/LightProbeGenerator.js b/examples/js/lights/LightProbeGenerator.js index b958cde7d107c8..5a87f0757057c1 100644 --- a/examples/js/lights/LightProbeGenerator.js +++ b/examples/js/lights/LightProbeGenerator.js @@ -116,6 +116,105 @@ THREE.LightProbeGenerator = { return new THREE.LightProbe( sh ); + }, + + fromCubeCamera: function ( renderer, cubeCamera ) { + + // The cubeCamera renderTarget must be set to RGBA in order to make readRenderTargetPixels works + var norm, lengthSq, weight, totalWeight = 0; + + var coord = new THREE.Vector3(); + + var dir = new THREE.Vector3(); + + var color = new THREE.Color(); + + var shBasis = [ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]; + + var sh = new THREE.SphericalHarmonics3(); + var shCoefficients = sh.coefficients; + + for ( var faceIndex = 0; faceIndex < 6; faceIndex ++ ) { + + var imageWidth = cubeCamera.renderTarget.width; // assumed to be square + var data = new Uint8Array(imageWidth * imageWidth * 4); + renderer.readRenderTargetPixels(cubeCamera.renderTarget, 0, 0, imageWidth, imageWidth, data, faceIndex); + + var pixelSize = 2 / imageWidth; + + for ( var i = 0, il = data.length; i < il; i += 4 ) { // RGBA assumed + + // pixel color + color.setRGB( data[ i ] / 255, data[ i + 1 ] / 255, data[ i + 2 ] / 255 ); + // pixel coordinate on unit cube + + if (renderer.gammaOutput) { + // convert to linear color space + color.copySRGBToLinear( color ); + } + + var pixelIndex = i / 4; + + var col = - 1 + ( pixelIndex % imageWidth + 0.5 ) * pixelSize; + + var row = 1 - ( Math.floor( pixelIndex / imageWidth ) + 0.5 ) * pixelSize; + + switch ( faceIndex ) { + + case 0: coord.set( 1, row, col ); break; + + case 1: coord.set( - 1, row, - col ); break; + + case 2: coord.set( - col, 1, - row ); break; + + case 3: coord.set( - col, - 1, row ); break; + + case 4: coord.set( - col, row, 1 ); break; + + case 5: coord.set( col, row, - 1 ); break; + + } + + // weight assigned to this pixel + + lengthSq = coord.lengthSq(); + + weight = 4 / ( Math.sqrt( lengthSq ) * lengthSq ); + + totalWeight += weight; + + // direction vector to this pixel + dir.copy( coord ).normalize(); + + // evaluate SH basis functions in direction dir + THREE.SphericalHarmonics3.getBasisAt( dir, shBasis ); + + // accummuulate + for ( var j = 0; j < 9; j ++ ) { + + shCoefficients[ j ].x += shBasis[ j ] * color.r * weight; + shCoefficients[ j ].y += shBasis[ j ] * color.g * weight; + shCoefficients[ j ].z += shBasis[ j ] * color.b * weight; + + } + + } + + } + + // normalize + norm = ( 4 * Math.PI ) / totalWeight; + + for ( var j = 0; j < 9; j ++ ) { + + shCoefficients[ j ].x *= norm; + shCoefficients[ j ].y *= norm; + shCoefficients[ j ].z *= norm; + + } + + return new THREE.LightProbe( sh ); + } }; diff --git a/examples/jsm/lights/LightProbeGenerator.d.ts b/examples/jsm/lights/LightProbeGenerator.d.ts index ec4aad96e080c4..0fa4ea33a01720 100644 --- a/examples/jsm/lights/LightProbeGenerator.d.ts +++ b/examples/jsm/lights/LightProbeGenerator.d.ts @@ -1,10 +1,12 @@ import { CubeTexture, - LightProbe + LightProbe, + WebGLRenderer } from '../../../src/Three'; export namespace LightProbeGenerator { export function fromCubeTexture(cubeTexture: CubeTexture): LightProbe; + export function fromCubeCamera(renderer: WebGLRenderer, cubeCamera: CubeCamera): LightProbe; } diff --git a/examples/jsm/lights/LightProbeGenerator.js b/examples/jsm/lights/LightProbeGenerator.js index 69626fb3cde48b..45680506d0ada0 100644 --- a/examples/jsm/lights/LightProbeGenerator.js +++ b/examples/jsm/lights/LightProbeGenerator.js @@ -123,6 +123,105 @@ var LightProbeGenerator = { return new LightProbe( sh ); + }, + + fromCubeCamera: function ( renderer, cubeCamera ) { + + // The cubeCamera renderTarget must be set to RGBA in order to make readRenderTargetPixels works + var norm, lengthSq, weight, totalWeight = 0; + + var coord = new Vector3(); + + var dir = new Vector3(); + + var color = new Color(); + + var shBasis = [ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]; + + var sh = new SphericalHarmonics3(); + var shCoefficients = sh.coefficients; + + for ( var faceIndex = 0; faceIndex < 6; faceIndex ++ ) { + + var imageWidth = cubeCamera.renderTarget.width; // assumed to be square + var data = new Uint8Array(imageWidth * imageWidth * 4); + renderer.readRenderTargetPixels(cubeCamera.renderTarget, 0, 0, imageWidth, imageWidth, data, faceIndex); + + var pixelSize = 2 / imageWidth; + + for ( var i = 0, il = data.length; i < il; i += 4 ) { // RGBA assumed + + // pixel color + color.setRGB( data[ i ] / 255, data[ i + 1 ] / 255, data[ i + 2 ] / 255 ); + // pixel coordinate on unit cube + + if (renderer.gammaOutput) { + // convert to linear color space + color.copySRGBToLinear( color ); + } + + var pixelIndex = i / 4; + + var col = - 1 + ( pixelIndex % imageWidth + 0.5 ) * pixelSize; + + var row = 1 - ( Math.floor( pixelIndex / imageWidth ) + 0.5 ) * pixelSize; + + switch ( faceIndex ) { + + case 0: coord.set( 1, row, col ); break; + + case 1: coord.set( - 1, row, - col ); break; + + case 2: coord.set( - col, 1, - row ); break; + + case 3: coord.set( - col, - 1, row ); break; + + case 4: coord.set( - col, row, 1 ); break; + + case 5: coord.set( col, row, - 1 ); break; + + } + + // weight assigned to this pixel + + lengthSq = coord.lengthSq(); + + weight = 4 / ( Math.sqrt( lengthSq ) * lengthSq ); + + totalWeight += weight; + + // direction vector to this pixel + dir.copy( coord ).normalize(); + + // evaluate SH basis functions in direction dir + THREE.SphericalHarmonics3.getBasisAt( dir, shBasis ); + + // accummuulate + for ( var j = 0; j < 9; j ++ ) { + + shCoefficients[ j ].x += shBasis[ j ] * color.r * weight; + shCoefficients[ j ].y += shBasis[ j ] * color.g * weight; + shCoefficients[ j ].z += shBasis[ j ] * color.b * weight; + + } + + } + + } + + // normalize + norm = ( 4 * Math.PI ) / totalWeight; + + for ( var j = 0; j < 9; j ++ ) { + + shCoefficients[ j ].x *= norm; + shCoefficients[ j ].y *= norm; + shCoefficients[ j ].z *= norm; + + } + + return new LightProbe( sh ); + } }; From 3ae144aea297b2450c642315b685185e62bccc76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20Mar=C3=A9chal?= Date: Tue, 20 Aug 2019 11:42:47 +0200 Subject: [PATCH 69/75] Fix THREE.SphericalHarmonics3 to SphericalHarmonics3 in jsm --- examples/jsm/lights/LightProbeGenerator.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/jsm/lights/LightProbeGenerator.js b/examples/jsm/lights/LightProbeGenerator.js index 45680506d0ada0..ad432b3cd1fb6a 100644 --- a/examples/jsm/lights/LightProbeGenerator.js +++ b/examples/jsm/lights/LightProbeGenerator.js @@ -194,7 +194,7 @@ var LightProbeGenerator = { dir.copy( coord ).normalize(); // evaluate SH basis functions in direction dir - THREE.SphericalHarmonics3.getBasisAt( dir, shBasis ); + SphericalHarmonics3.getBasisAt( dir, shBasis ); // accummuulate for ( var j = 0; j < 9; j ++ ) { From e9efdaa6b2f29075aac75a523138223bb9529db7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20Mar=C3=A9chal?= Date: Tue, 20 Aug 2019 11:42:59 +0200 Subject: [PATCH 70/75] Add example --- examples/textures/cube/cornell/nx.png | Bin 0 -> 1369 bytes examples/textures/cube/cornell/ny.png | Bin 0 -> 1072 bytes examples/textures/cube/cornell/nz.png | Bin 0 -> 1370 bytes examples/textures/cube/cornell/px.png | Bin 0 -> 1369 bytes examples/textures/cube/cornell/py.png | Bin 0 -> 1365 bytes examples/textures/cube/cornell/pz.png | Bin 0 -> 1371 bytes examples/webgl_lightprobe_cubecamera.html | 117 ++++++++++++++++++++++ 7 files changed, 117 insertions(+) create mode 100644 examples/textures/cube/cornell/nx.png create mode 100644 examples/textures/cube/cornell/ny.png create mode 100644 examples/textures/cube/cornell/nz.png create mode 100644 examples/textures/cube/cornell/px.png create mode 100644 examples/textures/cube/cornell/py.png create mode 100644 examples/textures/cube/cornell/pz.png create mode 100644 examples/webgl_lightprobe_cubecamera.html diff --git a/examples/textures/cube/cornell/nx.png b/examples/textures/cube/cornell/nx.png new file mode 100644 index 0000000000000000000000000000000000000000..acfb768062b6257972e768a4541188599dd5345d GIT binary patch literal 1369 zcmeAS@N?(olHy`uVBq!ia0y~yU<5K58911L)MWvCLk0$>`&A(kB|(Yh3I#>^X_+~x z3MG{VsS2qTnQ06R6}R3__w7^Bd=^Fp4iCBlBoJ$YCzd#-8DE8{P+FXEo{ zuS2@tUC*cFKkH6|i@8Pfch)+tz5caZiTi?0tMRfxHa#<8)BCnkPf^LpkfV2Wo;@^*J&_z!{$_AZ|c z6yYrJh%9Dc&{GCs#)_r(Wk5mp5>H=O_QxC|oGh#>Za6gpbIfl~7sn7_Zn*5o%fP^K z#NfdG=Z|~YqBy;;Y5vGoIlz#>V89^3z{9}Cz}&z{buMj8MRG3^lNLUqdVpZKmlmN8 dwxl7OF;brCzr3D80x)GTc)I$ztaD0e0st8?%%=bV literal 0 HcmV?d00001 diff --git a/examples/textures/cube/cornell/ny.png b/examples/textures/cube/cornell/ny.png new file mode 100644 index 0000000000000000000000000000000000000000..98e284476012a92698667acd810f74e95e800d42 GIT binary patch literal 1072 zcmeAS@N?(olHy`uVBq!ia0y~yU<5K58911L)MWvCLk0$>J5?bOB|(Yh3I#>^X_+~x z3MG{VsS2qTnQ06R6}R3_kDer>$>aJzvUU1|NdiKr6)RoN@TL9SH=!gf++HTJ+V0un zNg4{F1*}$0ulWAnuXp>=*uF_daaH9hP1%a1zM0%sbus6!UJ?xd`|ZNI`EMS+Gm3K5 zzAnD{m^PBe{|0yQ4@6DF`&i6ih)oh>p_hD83 z<4gZO$nhS`;Ie&qAl8HLirrq0Foj62DEHp-d16swu4|LxkL%Tl?|Gk8J|%bh^MDrR zw~Q~Hd$!H}(j1#-{%4C)RYl#eLr=;+YL+FN$S;oHt!=0nr1{2oZ*J;WgAXnmslMJC zZT*Y#SEq;^7t`)AyHRi)MCSPG2&A!xOvSU zWHOdSXszHpQ?tHx+WkF$LW?T$S|<7kD4+Qeawz;`bTBv1Pku`HvKXEcGIn{fJL3$#K#ktGo&m`7vTvIc%a4SQLmk_g* zjKYDgz=`%^vX&tsCTyX;S+8boRq-^;^g4NI&*H95*I@6oXVcd1s3`gRmUgllm-;C-f|J%V^ul+%& zigRyEoRj{-=@-0T{8u*laGd$yRUUgrWtoYJnycEXfXSUL$=lt9;Xep2*t>i(P=vF< zBeIx*K~EWk87r3BmjMOYOFVsD*&lO=aI#v?Tf^@T6uRo^;ur$V3I`2Ax#!S=ul{dS fxfcMLLl`tjGwL!h&O3eREyxp|u6{1-oD!M2UQ^vB|(Yh3I#>^X_+~x z3MG{VsS2qTnQ06R6}R3__nq`ufv5HRoTR=6m6jug1~XReJSbByH^a~BZ}`>N%`;qm zjwVQ|RLocKwD|u=?xDDz)*;1}m3o%$F)NoG66Ni`UV2sJ@~-_cTi)}3E66s=a@4)v zUGpwbv}`Z`hAnT8FSd=?E%oO1MeiqX1JY95lD~g`>+xgLHB|)5=gYDfPf!xw`nWHBo>-Jvtk~~}-5+LF%+C~mz3ud35yfYB z7587vxb10wEl=}Hm0L;wpAUz=h&`HHmRutLcu!b(a9fb&8`r%$sar36Y?!jCEmh>O z`^9acTwTeXyhp4u!Fi@;Huu^csYkP)bll;zo%x{0;8856ykvb)Uf;19E4@YjE)#ur)cC7GuV>!9 zi`)(wIliSYcY9S#HUB6Y!RQ!kWGxo)xNxV%ly^H-yEiYGe@x`jR?`!|${0EYq75Ze zN*2xVoMPmfY^L<$#e-nO;%P_NIVNb8b1~<*7(K8!e?ua9%dbtJQjc9^63~j|$=J}y zpsniqFQVv4K{sMDs|nf8Zc8O1q%N=1=x5bDMojWm=g1?%?K| zZ;rB_ee9xcEb!PxA#XB+&@A=MFQy3j7fp`T>G562leI+HZ@DKA%Vp0s&3SL$J=ym} z%%rwky53FCr{sTA%#0UiJHOwtTX605FSm)T8Sf6Q%$(BLoExzE&D8!xm9%y{W;-5;PJdx@v7EBj*(5l&WV?=yajfm!Car;B3`&A(kB|(Yh3I#>^X_+~x z3MG{VsS2qTnQ06R6}R3_kDl~cfyecK z41du5&0KG)<|h>1KJQ+=p{n%8_Qlgr++KL*M9(?7=eH+*NL^kl|7l+Mqt$QU^gkCZ z_S+@5cV|DF;jBaQCXe(~*t6y{vuIDyVO_iUn5{pzuD8qDB>8M{JK^`nZ~HdA{iNY) zaY=5%y^Jkym&j*t7pdB-w9CD&BB6@=qu*}BS^XE+-<>*RK?qlMuzqx;Esu@j(lwc! zM?VC9$(`Es=tdIjMz&e%Uc6H}7k*pd(aXjAYW3QXjYm$*<<%`tjWiQ~e5TZ~bMu7+ z=6PZc?Ms_x9XPXn>xHh_;d{LLPV^c~;ylM;d~fQ9i67OUKFjEtxyz;f{+2_#DwfGj zGdy`#YB590v1=jI_pNRTuPolfq^+>RJMB2z>B2ZYzopfACm-oZEO+NQUTSjURvAO5 zK=ek5l#(UN6E#$=dTw?sSlsM?@KmJIdtjOQ;^s?Ayx6}GexHJP&`& zUm2NkuSk2YRnW@g>ugJ3-z(N<-f5O{WT7&zwB08S^Q_sglufIg-(_cQS?QZp*t^-< zbjI1Zm@O;oKj|S^u**lDP<|g76!1HUgBJSQH8B(qwwnm(z~s9 z>hEOjz5nRg{E6JcclRrZtL^fAXSZGV0L#C1AGtAS~sfi20~-G$*l2rk&Wd@@jkv%n*= zn1O*?2!t6g-L3lr6l5>)^mS!_%ptQ1_K5O1|9}#b7^BLl6#SuH1P?w0|djpv+f^YEB|(Yh3I#>^X_+~x z3MG{VsS2qTnQ06R6}R3__bpP<2E)%58k?(c;6|1-p{O*s(F8H&uyRZA$9p*xl{APFYkW)hJSmt z^z?7--%~i;!e4N*+qJ4J`u5Uw1CwUZMXRhmpSN7t^dxoR`egBa-1o{ic9-6MYAK@l z%vPbkHiS@x#- z6m34H!LV>+@+$3pt6Rz|h3_|t3S1FQJI=*TR8TK zc00PMcg=Ls3^qwqc9M~;(F!{^=?4R2&{My}hF%XgnddL1i+ip`gzY=CBZ|SP(1j zV9qx+$In(5Px2hG5bU_E($Mnkq>k0nBa`o>h;cs-&}f!=*>X8ki1}cN(CY=W?>67j z-^uE`|7h=iWpTA#|C?fFyfE8&{?5Jy*IxhXRpP#2(`vjdkWJ5wXVse@2W$U4&;1eI zIQ@e63)L?|Rh)ZU;++0VD@y)&%=ka6ZT{w;6P};AucHG@?QBWj?k+$Y2!1;6t_M<_ z1s;*b3=De8Ak0{?)V>TT$X?><>&pI^Lxht}v^~-w9hh5wd%8G=0CU1+M_vX7jw1#K z_CJ5z%NE7yea(|=pA@G7g9HN)0~-T#1LFaP1O{qzX=5s~duir$h$Ykx5M-x=L!K6) c4zc7x)an;3f4N-NbbykLr>mdKI;Vst0LpF8-2eap literal 0 HcmV?d00001 diff --git a/examples/textures/cube/cornell/pz.png b/examples/textures/cube/cornell/pz.png new file mode 100644 index 0000000000000000000000000000000000000000..65b273a43ac931a24e4f7273bcf4856debfdc8ec GIT binary patch literal 1371 zcmeAS@N?(olHy`uVBq!ia0y~yU<5K58911L)MWvCLk0$>hgBgFB|(Yh3I#>^X_+~x z3MG{VsS2qTnQ06R6}R3__bpOZnFC6Ln96t4mPTIp| zJX?5#_V_%Zqi>&UpGu zX?}HBYwUYro!s9aGx)Eq@BBWqY-8ST8!y46 zd(5Atd$-N~lKgg>)B13i?XtnQMIeqOKIX1ZoLD#nQ zB>m9%wav@1FlS?91p8U$rL0;<0;&TR`Aub;yE^yEh9gJRrK6r5+mxesto3%&q_l+x z*=%eZ_`I1-8)xQcFBILrrlMD7qIIH*@EpOkJ=zbIAN!v=dr`u;v~$t@Er)hhER&mN zc=D{&VuqGu*FvW6Tip^~DIDJ@DsV-0b8@q(-1Khem-C`GS#TfA^ihm+Z(ftnK7nJS zXt$%Ade=-B&0v!><)%J9J5lX)&zc5?l|{=94!Ef>_kHf^wRFqY(T-1x(Pda@p~Pll z;m|O3l2W~nWzmXN8C9~G+0l+De!C|g?Q%ai9PTf=()J~DW#;L#v$kK#dafsXeE;*j zh1L3d=anc;Jy-H-roZ)Hopjj~TNRagWh-xd2z1*UcsoRXVFIBI4T{_WK9jsm^Hy$|I6 z#7RHmSGSY3MS_3l_p#JFJh*@MgSf)>i4RKDl^y`oJX?~ty9wy$!fk$L9 z0|U1Z2s2)~TlWVj$X?><>&pI^Lxhvf;7sfj1z?`}?djqe0?ZGW9eEiTIF1+`*#G=- zFIyC+_chOh(aMZ$49pFT2N)6<3>YLBco?Y7rH!db?nPqK#3$4a5DfRyBGe(4#Bet= XGyn5H@GJ+IG8jBv{an^LB{Ts5ER@a> literal 0 HcmV?d00001 diff --git a/examples/webgl_lightprobe_cubecamera.html b/examples/webgl_lightprobe_cubecamera.html new file mode 100644 index 00000000000000..cbe995b16e6729 --- /dev/null +++ b/examples/webgl_lightprobe_cubecamera.html @@ -0,0 +1,117 @@ + + + + three.js webgl - light probe + + + + + + +
    + three.js webgl - light probe +
    + + + + + From 10a9c666bd5ba0446026aecf18f5f901e0fc2dab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20Mar=C3=A9chal?= Date: Tue, 20 Aug 2019 12:29:24 +0200 Subject: [PATCH 71/75] add example to files.js --- examples/files.js | 1 + examples/webgl_lightprobe_cubecamera.html | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/files.js b/examples/files.js index 5af31eb9b3b73d..848942e1735992 100644 --- a/examples/files.js +++ b/examples/files.js @@ -61,6 +61,7 @@ var files = { "webgl_layers", "webgl_lensflares", "webgl_lightprobe", + "webgl_lightprobe_cubecamera", "webgl_lights_hemisphere", "webgl_lights_physical", "webgl_lights_pointlights", diff --git a/examples/webgl_lightprobe_cubecamera.html b/examples/webgl_lightprobe_cubecamera.html index cbe995b16e6729..eb6bb1a052745c 100644 --- a/examples/webgl_lightprobe_cubecamera.html +++ b/examples/webgl_lightprobe_cubecamera.html @@ -1,7 +1,7 @@ - three.js webgl - light probe + three.js webgl - light probe from cubeCamera @@ -9,7 +9,7 @@
    - three.js webgl - light probe + three.js webgl - light probe from cubeCamera