tuxedo-css-rails 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 34e3e8de2e1b21959b4e465e06f7ec56ff6f7f5e
4
+ data.tar.gz: 2dc379f43da82737c00f4a22a973c9a37cc05ac7
5
+ SHA512:
6
+ metadata.gz: 8c477eb893a60feabb44c25999b73452620f18ada67d18a5c71dff3bfe81626fff7c60ef12fde909b0ac6668f399955ae8eb0555317f24464c8da478e851fef4
7
+ data.tar.gz: a7157ee4b56f7b41cf4eb5612fbe7398fca45ce5128f2c2c6dcc6ad1d960450f883eaab611547843a5770c12d0fe3106fa016d03d226ac0ffbc7c30fa5b90c7b
@@ -0,0 +1,12 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+
11
+ # rspec failure tracking
12
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.3.1
5
+ before_install: gem install bundler -v 1.14.4
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at diego.spb@gmail.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in tuxedo-css-rails.gemspec
4
+ gemspec
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 Diego Suarez
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,63 @@
1
+ # Tuxedo::Css::Rails
2
+
3
+
4
+ ## Installation
5
+
6
+ `tuxedo-css-rails` is easy to drop into Rails with the asset pipeline.
7
+
8
+ ```ruby
9
+ gem 'tuxedo-css-rails'
10
+ ```
11
+
12
+ And then execute:
13
+
14
+ ```
15
+ $ bundle install
16
+ ```
17
+ Or install it yourself as:
18
+ ```
19
+ $ gem install tuxedo-css-rails
20
+ ```
21
+
22
+ ## Usage
23
+
24
+ Import Tuxedo styles in `app/assets/stylesheets/application.scss`:
25
+
26
+ ```scss
27
+ @import "tuxedo-css";
28
+ ```
29
+
30
+ Make sure the file has `.scss` extension. If you have just generated a new Rails app,
31
+ it may come with a `.css` file instead, you can rename it with:
32
+
33
+ ```console
34
+ $ mv app/assets/stylesheets/application.css app/assets/stylesheets/application.scss
35
+ ```
36
+
37
+ Then, remove all the `*= require_self` and `*= require_tree .` statements from the sass file. Instead, use `@import` to import files.
38
+
39
+ Do not use `*= require` in Sass or your other stylesheets will not be able to access the Tuxedo mixins or variables.
40
+
41
+ Require Tuxedos Javascripts in `app/assets/javascripts/application.js`:
42
+
43
+ ```js
44
+ //= require jquery
45
+ //= require tuxedo-css
46
+ ```
47
+
48
+
49
+
50
+ ## Development
51
+
52
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
53
+
54
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
55
+
56
+ ## Contributing
57
+
58
+ Bug reports and pull requests are welcome on GitHub at https://github.com/Diego Suarez/tuxedo-css-rails. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
59
+
60
+
61
+ ## License
62
+
63
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "tuxedo/css/rails"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,8 @@
1
+
2
+ module Tuxedo
3
+ module Css
4
+ module Rails
5
+ class Engine < ::Rails::Engine; end
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,27 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "tuxedo-css-rails"
7
+ spec.version = "0.0.1"
8
+ spec.authors = ["Diego Suarez"]
9
+ spec.email = ["diego.spb@gmail.com"]
10
+
11
+ spec.summary = %q{Tuxedo CSS toolkit for Rails 5, 4.x Asset Pipeline}
12
+ spec.description = %q{tuxedo-css-rails project integrates Tuxedo CSS toolkit for Rails 5, 4.x Asset Pipeline}
13
+ spec.homepage = "https://github.com/DiegoSPB/tuxedo-css-rails"
14
+ spec.license = "MIT"
15
+
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
18
+ f.match(%r{^(test|spec|features)/})
19
+ end
20
+ spec.bindir = "exe"
21
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
+ spec.require_paths = ["lib"]
23
+
24
+ spec.add_development_dependency "bundler", "~> 1.14"
25
+ spec.add_development_dependency "rake", "~> 10.0"
26
+ spec.add_development_dependency "rspec", "~> 3.0"
27
+ end
@@ -0,0 +1,14 @@
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.THREE=e.THREE||{})}(this,function(e){"use strict";function t(){}function i(e,t){this.x=e||0,this.y=t||0}function n(e,t,r,a,o,s,c,h,l,u){Object.defineProperty(this,"id",{value:ps++}),this.uuid=us.generateUUID(),this.name="",this.image=void 0!==e?e:n.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=void 0!==t?t:n.DEFAULT_MAPPING,this.wrapS=void 0!==r?r:ao,this.wrapT=void 0!==a?a:ao,this.magFilter=void 0!==o?o:lo,this.minFilter=void 0!==s?s:po,this.anisotropy=void 0!==l?l:1,this.format=void 0!==c?c:Lo,this.type=void 0!==h?h:fo,this.offset=new i(0,0),this.repeat=new i(1,1),this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=void 0!==u?u:ts,this.version=0,this.onUpdate=null}function r(e,t,i,n){this.x=e||0,this.y=t||0,this.z=i||0,this.w=void 0!==n?n:1}function a(e,t,i){this.uuid=us.generateUUID(),this.width=e,this.height=t,this.scissor=new r(0,0,e,t),this.scissorTest=!1,this.viewport=new r(0,0,e,t),i=i||{},void 0===i.minFilter&&(i.minFilter=lo),this.texture=new n(void 0,void 0,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.encoding),this.depthBuffer=void 0!==i.depthBuffer?i.depthBuffer:!0,this.stencilBuffer=void 0!==i.stencilBuffer?i.stencilBuffer:!0,this.depthTexture=void 0!==i.depthTexture?i.depthTexture:null}function o(e,t,i){a.call(this,e,t,i),this.activeCubeFace=0,this.activeMipMapLevel=0}function s(e,t,i,n){this._x=e||0,this._y=t||0,this._z=i||0,this._w=void 0!==n?n:1}function c(e,t,i){this.x=e||0,this.y=t||0,this.z=i||0}function h(){this.elements=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}function l(e,t,i,r,a,o,s,c,h,l){e=void 0!==e?e:[],t=void 0!==t?t:Qa,n.call(this,e,t,i,r,a,o,s,c,h,l),this.flipY=!1}function u(){this.seq=[],this.map={}}function p(e,t,i){var n=e[0];if(0>=n||n>0)return e;var r=t*i,a=ms[r];if(void 0===a&&(a=new Float32Array(r),ms[r]=a),0!==t){n.toArray(a,0);for(var o=1,s=0;o!==t;++o)s+=i,e[o].toArray(a,s)}return a}function d(e,t){var i=gs[t];void 0===i&&(i=new Int32Array(t),gs[t]=i);for(var n=0;n!==t;++n)i[n]=e.allocTextureUnit();return i}function f(e,t){e.uniform1f(this.addr,t)}function m(e,t){e.uniform1i(this.addr,t)}function g(e,t){void 0===t.x?e.uniform2fv(this.addr,t):e.uniform2f(this.addr,t.x,t.y)}function v(e,t){void 0!==t.x?e.uniform3f(this.addr,t.x,t.y,t.z):void 0!==t.r?e.uniform3f(this.addr,t.r,t.g,t.b):e.uniform3fv(this.addr,t)}function y(e,t){void 0===t.x?e.uniform4fv(this.addr,t):e.uniform4f(this.addr,t.x,t.y,t.z,t.w)}function x(e,t){e.uniformMatrix2fv(this.addr,!1,t.elements||t)}function _(e,t){e.uniformMatrix3fv(this.addr,!1,t.elements||t)}function b(e,t){e.uniformMatrix4fv(this.addr,!1,t.elements||t)}function w(e,t,i){var n=i.allocTextureUnit();e.uniform1i(this.addr,n),i.setTexture2D(t||ds,n)}function M(e,t,i){var n=i.allocTextureUnit();e.uniform1i(this.addr,n),i.setTextureCube(t||fs,n)}function E(e,t){e.uniform2iv(this.addr,t)}function T(e,t){e.uniform3iv(this.addr,t)}function S(e,t){e.uniform4iv(this.addr,t)}function A(e){switch(e){case 5126:return f;case 35664:return g;case 35665:return v;case 35666:return y;case 35674:return x;case 35675:return _;case 35676:return b;case 35678:return w;case 35680:return M;case 5124:case 35670:return m;case 35667:case 35671:return E;case 35668:case 35672:return T;case 35669:case 35673:return S}}function L(e,t){e.uniform1fv(this.addr,t)}function R(e,t){e.uniform1iv(this.addr,t)}function P(e,t){e.uniform2fv(this.addr,p(t,this.size,2))}function C(e,t){e.uniform3fv(this.addr,p(t,this.size,3))}function I(e,t){e.uniform4fv(this.addr,p(t,this.size,4))}function U(e,t){e.uniformMatrix2fv(this.addr,!1,p(t,this.size,4))}function N(e,t){e.uniformMatrix3fv(this.addr,!1,p(t,this.size,9))}function D(e,t){e.uniformMatrix4fv(this.addr,!1,p(t,this.size,16))}function O(e,t,i){var n=t.length,r=d(i,n);e.uniform1iv(this.addr,r);for(var a=0;a!==n;++a)i.setTexture2D(t[a]||ds,r[a])}function B(e,t,i){var n=t.length,r=d(i,n);e.uniform1iv(this.addr,r);for(var a=0;a!==n;++a)i.setTextureCube(t[a]||fs,r[a])}function F(e){switch(e){case 5126:return L;case 35664:return P;case 35665:return C;case 35666:return I;case 35674:return U;case 35675:return N;case 35676:return D;case 35678:return O;case 35680:return B;case 5124:case 35670:return R;case 35667:case 35671:return E;case 35668:case 35672:return T;case 35669:case 35673:return S}}function z(e,t,i){this.id=e,this.addr=i,this.setValue=A(t.type)}function G(e,t,i){this.id=e,this.addr=i,this.size=t.size,this.setValue=F(t.type)}function H(e){this.id=e,u.call(this)}function V(e,t){e.seq.push(t),e.map[t.id]=t}function k(e,t,i){var n=e.name,r=n.length;for(vs.lastIndex=0;;){var a=vs.exec(n),o=vs.lastIndex,s=a[1],c="]"===a[2],h=a[3];if(c&&(s=0|s),void 0===h||"["===h&&o+2===r){V(i,void 0===h?new z(s,e,t):new G(s,e,t));break}var l=i.map,u=l[s];void 0===u&&(u=new H(s),V(i,u)),i=u}}function j(e,t,i){u.call(this),this.renderer=i;for(var n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS),r=0;n>r;++r){var a=e.getActiveUniform(t,r),o=a.name,s=e.getUniformLocation(t,o);k(a,s,this)}}function W(e,t,i){return void 0===t&&void 0===i?this.set(e):this.setRGB(e,t,i)}function X(e,t,i,r,a,o,s,c,h,l,u,p){n.call(this,null,o,s,c,h,l,r,a,u,p),this.image={data:e,width:t,height:i},this.magFilter=void 0!==h?h:so,this.minFilter=void 0!==l?l:so,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}function q(e,t){this.min=void 0!==e?e:new i(+(1/0),+(1/0)),this.max=void 0!==t?t:new i(-(1/0),-(1/0))}function Y(e,t){function n(){var e=new Float32Array([-1,-1,0,0,1,-1,1,0,1,1,1,1,-1,1,0,1]),t=new Uint16Array([0,1,2,0,2,3]);a=f.createBuffer(),o=f.createBuffer(),f.bindBuffer(f.ARRAY_BUFFER,a),f.bufferData(f.ARRAY_BUFFER,e,f.STATIC_DRAW),f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,o),f.bufferData(f.ELEMENT_ARRAY_BUFFER,t,f.STATIC_DRAW),p=f.createTexture(),d=f.createTexture(),m.bindTexture(f.TEXTURE_2D,p),f.texImage2D(f.TEXTURE_2D,0,f.RGB,16,16,0,f.RGB,f.UNSIGNED_BYTE,null),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_S,f.CLAMP_TO_EDGE),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_T,f.CLAMP_TO_EDGE),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MAG_FILTER,f.NEAREST),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MIN_FILTER,f.NEAREST),m.bindTexture(f.TEXTURE_2D,d),f.texImage2D(f.TEXTURE_2D,0,f.RGBA,16,16,0,f.RGBA,f.UNSIGNED_BYTE,null),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_S,f.CLAMP_TO_EDGE),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_T,f.CLAMP_TO_EDGE),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MAG_FILTER,f.NEAREST),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MIN_FILTER,f.NEAREST),s={vertexShader:["uniform lowp int renderType;","uniform vec3 screenPosition;","uniform vec2 scale;","uniform float rotation;","uniform sampler2D occlusionMap;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","varying float vVisibility;","void main() {","vUV = uv;","vec2 pos = position;","if ( renderType == 2 ) {","vec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.1, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.5 ) );","vVisibility = visibility.r / 9.0;","vVisibility *= 1.0 - visibility.g / 9.0;","vVisibility *= visibility.b / 9.0;","vVisibility *= 1.0 - visibility.a / 9.0;","pos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;","pos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;","}","gl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );","}"].join("\n"),fragmentShader:["uniform lowp int renderType;","uniform sampler2D map;","uniform float opacity;","uniform vec3 color;","varying vec2 vUV;","varying float vVisibility;","void main() {","if ( renderType == 0 ) {","gl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );","} else if ( renderType == 1 ) {","gl_FragColor = texture2D( map, vUV );","} else {","vec4 texture = texture2D( map, vUV );","texture.a *= opacity * vVisibility;","gl_FragColor = texture;","gl_FragColor.rgb *= color;","}","}"].join("\n")},h=r(s),l={vertex:f.getAttribLocation(h,"position"),uv:f.getAttribLocation(h,"uv")},u={renderType:f.getUniformLocation(h,"renderType"),map:f.getUniformLocation(h,"map"),occlusionMap:f.getUniformLocation(h,"occlusionMap"),opacity:f.getUniformLocation(h,"opacity"),color:f.getUniformLocation(h,"color"),scale:f.getUniformLocation(h,"scale"),rotation:f.getUniformLocation(h,"rotation"),screenPosition:f.getUniformLocation(h,"screenPosition")}}function r(t){var i=f.createProgram(),n=f.createShader(f.FRAGMENT_SHADER),r=f.createShader(f.VERTEX_SHADER),a="precision "+e.getPrecision()+" float;\n";return f.shaderSource(n,a+t.fragmentShader),f.shaderSource(r,a+t.vertexShader),f.compileShader(n),f.compileShader(r),f.attachShader(i,n),f.attachShader(i,r),f.linkProgram(i),i}var a,o,s,h,l,u,p,d,f=e.context,m=e.state;this.render=function(r,s,g){if(0!==t.length){var v=new c,y=g.w/g.z,x=.5*g.z,_=.5*g.w,b=16/g.w,w=new i(b*y,b),M=new c(1,1,0),E=new i(1,1),T=new q;T.min.set(g.x,g.y),T.max.set(g.x+(g.z-16),g.y+(g.w-16)),void 0===h&&n(),f.useProgram(h),m.initAttributes(),m.enableAttribute(l.vertex),m.enableAttribute(l.uv),m.disableUnusedAttributes(),f.uniform1i(u.occlusionMap,0),f.uniform1i(u.map,1),f.bindBuffer(f.ARRAY_BUFFER,a),f.vertexAttribPointer(l.vertex,2,f.FLOAT,!1,16,0),f.vertexAttribPointer(l.uv,2,f.FLOAT,!1,16,8),f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,o),m.disable(f.CULL_FACE),m.setDepthWrite(!1);for(var S=0,A=t.length;A>S;S++){b=16/g.w,w.set(b*y,b);var L=t[S];if(v.set(L.matrixWorld.elements[12],L.matrixWorld.elements[13],L.matrixWorld.elements[14]),v.applyMatrix4(s.matrixWorldInverse),v.applyMatrix4(s.projectionMatrix),M.copy(v),E.x=g.x+M.x*x+x-8,E.y=g.y+M.y*_+_-8,T.containsPoint(E)===!0){m.activeTexture(f.TEXTURE0),m.bindTexture(f.TEXTURE_2D,null),m.activeTexture(f.TEXTURE1),m.bindTexture(f.TEXTURE_2D,p),f.copyTexImage2D(f.TEXTURE_2D,0,f.RGB,E.x,E.y,16,16,0),f.uniform1i(u.renderType,0),f.uniform2f(u.scale,w.x,w.y),f.uniform3f(u.screenPosition,M.x,M.y,M.z),m.disable(f.BLEND),m.enable(f.DEPTH_TEST),f.drawElements(f.TRIANGLES,6,f.UNSIGNED_SHORT,0),m.activeTexture(f.TEXTURE0),m.bindTexture(f.TEXTURE_2D,d),f.copyTexImage2D(f.TEXTURE_2D,0,f.RGBA,E.x,E.y,16,16,0),f.uniform1i(u.renderType,1),m.disable(f.DEPTH_TEST),m.activeTexture(f.TEXTURE1),m.bindTexture(f.TEXTURE_2D,p),f.drawElements(f.TRIANGLES,6,f.UNSIGNED_SHORT,0),L.positionScreen.copy(M),L.customUpdateCallback?L.customUpdateCallback(L):L.updateLensFlares(),f.uniform1i(u.renderType,2),m.enable(f.BLEND);for(var R=0,P=L.lensFlares.length;P>R;R++){var C=L.lensFlares[R];C.opacity>.001&&C.scale>.001&&(M.x=C.x,M.y=C.y,M.z=C.z,b=C.size*C.scale/g.w,w.x=b*y,w.y=b,f.uniform3f(u.screenPosition,M.x,M.y,M.z),f.uniform2f(u.scale,w.x,w.y),f.uniform1f(u.rotation,C.rotation),f.uniform1f(u.opacity,C.opacity),f.uniform3f(u.color,C.color.r,C.color.g,C.color.b),m.setBlending(C.blending,C.blendEquation,C.blendSrc,C.blendDst),e.setTexture2D(C.texture,1),f.drawElements(f.TRIANGLES,6,f.UNSIGNED_SHORT,0))}}}m.enable(f.CULL_FACE),m.enable(f.DEPTH_TEST),m.setDepthWrite(!0),e.resetGLState()}}}function Z(e,t){function i(){var e=new Float32Array([-.5,-.5,0,0,.5,-.5,1,0,.5,.5,1,1,-.5,.5,0,1]),t=new Uint16Array([0,1,2,0,2,3]);o=f.createBuffer(),h=f.createBuffer(),f.bindBuffer(f.ARRAY_BUFFER,o),f.bufferData(f.ARRAY_BUFFER,e,f.STATIC_DRAW),f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,h),f.bufferData(f.ELEMENT_ARRAY_BUFFER,t,f.STATIC_DRAW),l=r(),u={position:f.getAttribLocation(l,"position"),uv:f.getAttribLocation(l,"uv")},p={uvOffset:f.getUniformLocation(l,"uvOffset"),uvScale:f.getUniformLocation(l,"uvScale"),rotation:f.getUniformLocation(l,"rotation"),scale:f.getUniformLocation(l,"scale"),color:f.getUniformLocation(l,"color"),map:f.getUniformLocation(l,"map"),opacity:f.getUniformLocation(l,"opacity"),modelViewMatrix:f.getUniformLocation(l,"modelViewMatrix"),projectionMatrix:f.getUniformLocation(l,"projectionMatrix"),fogType:f.getUniformLocation(l,"fogType"),fogDensity:f.getUniformLocation(l,"fogDensity"),fogNear:f.getUniformLocation(l,"fogNear"),fogFar:f.getUniformLocation(l,"fogFar"),fogColor:f.getUniformLocation(l,"fogColor"),alphaTest:f.getUniformLocation(l,"alphaTest")};var i=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");i.width=8,i.height=8;var a=i.getContext("2d");a.fillStyle="white",a.fillRect(0,0,8,8),d=new n(i),d.needsUpdate=!0}function r(){var t=f.createProgram(),i=f.createShader(f.VERTEX_SHADER),n=f.createShader(f.FRAGMENT_SHADER);return f.shaderSource(i,["precision "+e.getPrecision()+" float;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform float rotation;","uniform vec2 scale;","uniform vec2 uvOffset;","uniform vec2 uvScale;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","void main() {","vUV = uvOffset + uv * uvScale;","vec2 alignedPosition = position * scale;","vec2 rotatedPosition;","rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;","rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;","vec4 finalPosition;","finalPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );","finalPosition.xy += rotatedPosition;","finalPosition = projectionMatrix * finalPosition;","gl_Position = finalPosition;","}"].join("\n")),f.shaderSource(n,["precision "+e.getPrecision()+" float;","uniform vec3 color;","uniform sampler2D map;","uniform float opacity;","uniform int fogType;","uniform vec3 fogColor;","uniform float fogDensity;","uniform float fogNear;","uniform float fogFar;","uniform float alphaTest;","varying vec2 vUV;","void main() {","vec4 texture = texture2D( map, vUV );","if ( texture.a < alphaTest ) discard;","gl_FragColor = vec4( color * texture.xyz, texture.a * opacity );","if ( fogType > 0 ) {","float depth = gl_FragCoord.z / gl_FragCoord.w;","float fogFactor = 0.0;","if ( fogType == 1 ) {","fogFactor = smoothstep( fogNear, fogFar, depth );","} else {","const float LOG2 = 1.442695;","fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );","fogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );","}","gl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );","}","}"].join("\n")),f.compileShader(i),f.compileShader(n),f.attachShader(t,i),f.attachShader(t,n),f.linkProgram(t),t}function a(e,t){return e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?t.z-e.z:t.id-e.id}var o,h,l,u,p,d,f=e.context,m=e.state,g=new c,v=new s,y=new c;this.render=function(n,r){if(0!==t.length){void 0===l&&i(),f.useProgram(l),m.initAttributes(),m.enableAttribute(u.position),m.enableAttribute(u.uv),m.disableUnusedAttributes(),m.disable(f.CULL_FACE),m.enable(f.BLEND),f.bindBuffer(f.ARRAY_BUFFER,o),f.vertexAttribPointer(u.position,2,f.FLOAT,!1,16,0),f.vertexAttribPointer(u.uv,2,f.FLOAT,!1,16,8),f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,h),f.uniformMatrix4fv(p.projectionMatrix,!1,r.projectionMatrix.elements),m.activeTexture(f.TEXTURE0),f.uniform1i(p.map,0);var s=0,c=0,x=n.fog;x?(f.uniform3f(p.fogColor,x.color.r,x.color.g,x.color.b),x.isFog?(f.uniform1f(p.fogNear,x.near),f.uniform1f(p.fogFar,x.far),f.uniform1i(p.fogType,1),s=1,c=1):x.isFogExp2&&(f.uniform1f(p.fogDensity,x.density),f.uniform1i(p.fogType,2),s=2,c=2)):(f.uniform1i(p.fogType,0),s=0,c=0);for(var _=0,b=t.length;b>_;_++){var w=t[_];w.modelViewMatrix.multiplyMatrices(r.matrixWorldInverse,w.matrixWorld),w.z=-w.modelViewMatrix.elements[14]}t.sort(a);for(var M=[],_=0,b=t.length;b>_;_++){var w=t[_],E=w.material;if(E.visible!==!1){f.uniform1f(p.alphaTest,E.alphaTest),f.uniformMatrix4fv(p.modelViewMatrix,!1,w.modelViewMatrix.elements),w.matrixWorld.decompose(g,v,y),M[0]=y.x,M[1]=y.y;var T=0;n.fog&&E.fog&&(T=c),s!==T&&(f.uniform1i(p.fogType,T),s=T),null!==E.map?(f.uniform2f(p.uvOffset,E.map.offset.x,E.map.offset.y),f.uniform2f(p.uvScale,E.map.repeat.x,E.map.repeat.y)):(f.uniform2f(p.uvOffset,0,0),f.uniform2f(p.uvScale,1,1)),f.uniform1f(p.opacity,E.opacity),f.uniform3f(p.color,E.color.r,E.color.g,E.color.b),f.uniform1f(p.rotation,E.rotation),f.uniform2fv(p.scale,M),m.setBlending(E.blending,E.blendEquation,E.blendSrc,E.blendDst),m.setDepthTest(E.depthTest),m.setDepthWrite(E.depthWrite),E.map?e.setTexture2D(E.map,0):e.setTexture2D(d,0),f.drawElements(f.TRIANGLES,6,f.UNSIGNED_SHORT,0)}}m.enable(f.CULL_FACE),e.resetGLState()}}}function J(){Object.defineProperty(this,"id",{value:Mh++}),this.uuid=us.generateUUID(),this.name="",this.type="Material",this.fog=!0,this.lights=!0,this.blending=da,this.side=ra,this.shading=ca,this.vertexColors=ha,this.opacity=1,this.transparent=!1,this.blendSrc=Aa,this.blendDst=La,this.blendEquation=ya,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=Ba,this.depthTest=!0,this.depthWrite=!0,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.alphaTest=0,this.premultipliedAlpha=!1,this.overdraw=0,this.visible=!0,this._needsUpdate=!0}function Q(e){J.call(this),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader="void main() {\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,void 0!==e&&(void 0!==e.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(e))}function K(e){J.call(this),this.type="MeshDepthMaterial",this.depthPacking=hs,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.setValues(e)}function $(e,t){this.min=void 0!==e?e:new c(+(1/0),+(1/0),+(1/0)),this.max=void 0!==t?t:new c(-(1/0),-(1/0),-(1/0))}function ee(e,t){this.center=void 0!==e?e:new c,this.radius=void 0!==t?t:0}function te(){this.elements=new Float32Array([1,0,0,0,1,0,0,0,1]),arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}function ie(e,t){this.normal=void 0!==e?e:new c(1,0,0),this.constant=void 0!==t?t:0}function ne(e,t,i,n,r,a){this.planes=[void 0!==e?e:new ie,void 0!==t?t:new ie,void 0!==i?i:new ie,void 0!==n?n:new ie,void 0!==r?r:new ie,void 0!==a?a:new ie]}function re(e,t,n,o){function s(t,i,n,r){var a=t.geometry,o=null,s=E,c=t.customDepthMaterial;if(n&&(s=T,c=t.customDistanceMaterial),c)o=c;else{var h=!1;i.morphTargets&&(a&&a.isBufferGeometry?h=a.morphAttributes&&a.morphAttributes.position&&a.morphAttributes.position.length>0:a&&a.isGeometry&&(h=a.morphTargets&&a.morphTargets.length>0));var l=t.isSkinnedMesh&&i.skinning,u=0;h&&(u|=b),l&&(u|=w),o=s[u]}if(e.localClippingEnabled&&i.clipShadows===!0&&0!==i.clippingPlanes.length){var p=o.uuid,d=i.uuid,f=S[p];void 0===f&&(f={},S[p]=f);var m=f[d];void 0===m&&(m=o.clone(),f[d]=m),o=m}o.visible=i.visible,o.wireframe=i.wireframe;var g=i.side;return F.renderSingleSided&&g==oa&&(g=ra),F.renderReverseSided&&(g===ra?g=aa:g===aa&&(g=ra)),o.side=g,o.clipShadows=i.clipShadows,o.clippingPlanes=i.clippingPlanes,o.wireframeLinewidth=i.wireframeLinewidth,o.linewidth=i.linewidth,n&&void 0!==o.uniforms.lightPos&&o.uniforms.lightPos.value.copy(r),o}function l(e,t,i){if(e.visible!==!1){var n=0!==(e.layers.mask&t.layers.mask);if(n&&(e.isMesh||e.isLine||e.isPoints)&&e.castShadow&&(e.frustumCulled===!1||d.intersectsObject(e)===!0)){var r=e.material;r.visible===!0&&(e.modelViewMatrix.multiplyMatrices(i.matrixWorldInverse,e.matrixWorld),_.push(e))}for(var a=e.children,o=0,s=a.length;s>o;o++)l(a[o],t,i)}}var u=e.context,p=e.state,d=new ne,f=new h,m=t.shadows,g=new i,v=new i(o.maxTextureSize,o.maxTextureSize),y=new c,x=new c,_=[],b=1,w=2,M=(b|w)+1,E=new Array(M),T=new Array(M),S={},A=[new c(1,0,0),new c(-1,0,0),new c(0,0,1),new c(0,0,-1),new c(0,1,0),new c(0,-1,0)],L=[new c(0,1,0),new c(0,1,0),new c(0,1,0),new c(0,1,0),new c(0,0,1),new c(0,0,-1)],R=[new r,new r,new r,new r,new r,new r],P=new K;P.depthPacking=ls,P.clipping=!0;for(var C=wh.distanceRGBA,I=ys.clone(C.uniforms),U=0;U!==M;++U){var N=0!==(U&b),D=0!==(U&w),O=P.clone();O.morphTargets=N,O.skinning=D,E[U]=O;var B=new Q({defines:{USE_SHADOWMAP:""},uniforms:I,vertexShader:C.vertexShader,fragmentShader:C.fragmentShader,morphTargets:N,skinning:D,clipping:!0});T[U]=B}var F=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=ia,this.renderReverseSided=!0,this.renderSingleSided=!0,this.render=function(t,i){if(F.enabled!==!1&&(F.autoUpdate!==!1||F.needsUpdate!==!1)&&0!==m.length){p.buffers.color.setClear(1,1,1,1),p.disable(u.BLEND),p.setDepthTest(!0),p.setScissorTest(!1);for(var r,o,c=0,h=m.length;h>c;c++){var b=m[c],w=b.shadow;if(void 0!==w){var M=w.camera;if(g.copy(w.mapSize),g.min(v),b&&b.isPointLight){r=6,o=!0;var E=g.x,T=g.y;R[0].set(2*E,T,E,T),R[1].set(0,T,E,T),R[2].set(3*E,T,E,T),R[3].set(E,T,E,T),R[4].set(3*E,0,E,T),R[5].set(E,0,E,T),g.x*=4,g.y*=2}else r=1,o=!1;if(null===w.map){var S={minFilter:so,magFilter:so,format:Lo};w.map=new a(g.x,g.y,S),M.updateProjectionMatrix()}w.isSpotLightShadow&&w.update(b),w&&w.isRectAreaLightShadow&&w.update(b);var P=w.map,C=w.matrix;x.setFromMatrixPosition(b.matrixWorld),M.position.copy(x),e.setRenderTarget(P),e.clear();for(var I=0;r>I;I++){if(o){y.copy(M.position),y.add(A[I]),M.up.copy(L[I]),M.lookAt(y);var U=R[I];p.viewport(U)}else y.setFromMatrixPosition(b.target.matrixWorld),M.lookAt(y);M.updateMatrixWorld(),M.matrixWorldInverse.getInverse(M.matrixWorld),C.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),C.multiply(M.projectionMatrix),C.multiply(M.matrixWorldInverse),f.multiplyMatrices(M.projectionMatrix,M.matrixWorldInverse),d.setFromMatrix(f),_.length=0,l(t,i,M);for(var N=0,D=_.length;D>N;N++){var O=_[N],B=n.update(O),z=O.material;if(z&&z.isMultiMaterial)for(var G=B.groups,H=z.materials,V=0,k=G.length;k>V;V++){var j=G[V],W=H[j.materialIndex];if(W.visible===!0){var X=s(O,W,o,x);e.renderBufferDirect(M,null,B,X,O,j)}}else{var X=s(O,z,o,x);e.renderBufferDirect(M,null,B,X,O,null)}}}}else console.warn("THREE.WebGLShadowMap:",b,"has no shadow.")}var q=e.getClearColor(),Y=e.getClearAlpha();e.setClearColor(q,Y),F.needsUpdate=!1}}}function ae(e,t){this.origin=void 0!==e?e:new c,this.direction=void 0!==t?t:new c}function oe(e,t,i,n){this._x=e||0,this._y=t||0,this._z=i||0,this._order=n||oe.DefaultOrder}function se(){this.mask=1}function ce(){function e(){r.setFromEuler(n,!1)}function t(){n.setFromQuaternion(r,void 0,!1)}Object.defineProperty(this,"id",{value:Eh++}),this.uuid=us.generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=ce.DefaultUp.clone();var i=new c,n=new oe,r=new s,a=new c(1,1,1);n.onChange(e),r.onChange(t),Object.defineProperties(this,{position:{enumerable:!0,value:i},rotation:{enumerable:!0,value:n},quaternion:{enumerable:!0,value:r},scale:{enumerable:!0,value:a},modelViewMatrix:{value:new h},normalMatrix:{value:new te}}),this.matrix=new h,this.matrixWorld=new h,this.matrixAutoUpdate=ce.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new se,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.userData={},this.onBeforeRender=function(){},this.onAfterRender=function(){}}function he(e,t){this.start=void 0!==e?e:new c,this.end=void 0!==t?t:new c}function le(e,t,i){this.a=void 0!==e?e:new c,this.b=void 0!==t?t:new c,this.c=void 0!==i?i:new c}function ue(e,t,i,n,r,a){this.a=e,this.b=t,this.c=i,this.normal=n&&n.isVector3?n:new c,this.vertexNormals=Array.isArray(n)?n:[],this.color=r&&r.isColor?r:new W,this.vertexColors=Array.isArray(r)?r:[],this.materialIndex=void 0!==a?a:0}function pe(e){J.call(this),this.type="MeshBasicMaterial",this.color=new W(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Va,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.lights=!1,this.setValues(e)}function de(e,t,i){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.uuid=us.generateUUID(),this.array=e,this.itemSize=t,this.count=void 0!==e?e.length/t:0,this.normalized=i===!0,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.onUploadCallback=function(){},this.version=0}function fe(e,t){de.call(this,new Int8Array(e),t)}function me(e,t){de.call(this,new Uint8Array(e),t)}function ge(e,t){de.call(this,new Uint8ClampedArray(e),t)}function ve(e,t){de.call(this,new Int16Array(e),t)}function ye(e,t){de.call(this,new Uint16Array(e),t)}function xe(e,t){de.call(this,new Int32Array(e),t)}function _e(e,t){de.call(this,new Uint32Array(e),t)}function be(e,t){de.call(this,new Float32Array(e),t)}function we(e,t){de.call(this,new Float64Array(e),t)}function Me(){this.indices=[],this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.uvs2=[],this.groups=[],this.morphTargets={},this.skinWeights=[],this.skinIndices=[],this.boundingBox=null,this.boundingSphere=null,this.verticesNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.uvsNeedUpdate=!1,this.groupsNeedUpdate=!1}function Ee(e){for(var t=e.length,i=-(1/0);t--;)e[t]>i&&(i=e[t]);return i}function Te(){return Th++}function Se(){Object.defineProperty(this,"id",{value:Te()}),this.uuid=us.generateUUID(),this.name="",this.type="Geometry",this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.elementsNeedUpdate=!1,this.verticesNeedUpdate=!1,this.uvsNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.lineDistancesNeedUpdate=!1,this.groupsNeedUpdate=!1}function Ae(){Object.defineProperty(this,"id",{value:Te()}),this.uuid=us.generateUUID(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0}}function Le(e,t){ce.call(this),this.type="Mesh",this.geometry=void 0!==e?e:new Ae,this.material=void 0!==t?t:new pe({color:16777215*Math.random()}),this.drawMode=Ko,this.updateMorphTargets()}function Re(e,t,i,n,r,a){Se.call(this),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:n,heightSegments:r,depthSegments:a},this.fromBufferGeometry(new Pe(e,t,i,n,r,a)),this.mergeVertices()}function Pe(e,t,i,n,r,a){function o(e,t,i,n,r,a,o,m,g,v,y){var x,_,b=a/g,w=o/v,M=a/2,E=o/2,T=m/2,S=g+1,A=v+1,L=0,R=0,P=new c;for(_=0;A>_;_++){var C=_*w-E;for(x=0;S>x;x++){var I=x*b-M;P[e]=I*n,P[t]=C*r,P[i]=T,l.push(P.x,P.y,P.z),P[e]=0,P[t]=0,P[i]=m>0?1:-1,u.push(P.x,P.y,P.z),p.push(x/g),p.push(1-_/v),L+=1}}for(_=0;v>_;_++)for(x=0;g>x;x++){var U=d+x+S*_,N=d+x+S*(_+1),D=d+(x+1)+S*(_+1),O=d+(x+1)+S*_;h.push(U,N,O),h.push(N,D,O),R+=6}s.addGroup(f,R,y),f+=R,d+=L}Ae.call(this),this.type="BoxBufferGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:n,heightSegments:r,depthSegments:a};var s=this;n=Math.floor(n)||1,r=Math.floor(r)||1,a=Math.floor(a)||1;var h=[],l=[],u=[],p=[],d=0,f=0;o("z","y","x",-1,-1,i,t,e,a,r,0),o("z","y","x",1,-1,i,t,-e,a,r,1),o("x","z","y",1,1,e,i,t,n,a,2),o("x","z","y",1,-1,e,i,-t,n,a,3),o("x","y","z",1,-1,e,t,i,n,r,4),o("x","y","z",-1,-1,e,t,-i,n,r,5),this.setIndex(h),this.addAttribute("position",new be(l,3)),this.addAttribute("normal",new be(u,3)),this.addAttribute("uv",new be(p,2))}function Ce(e,t,i,n){Se.call(this),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:i,heightSegments:n},this.fromBufferGeometry(new Ie(e,t,i,n))}function Ie(e,t,i,n){Ae.call(this),this.type="PlaneBufferGeometry",this.parameters={width:e,height:t,widthSegments:i,heightSegments:n};var r,a,o=e/2,s=t/2,c=Math.floor(i)||1,h=Math.floor(n)||1,l=c+1,u=h+1,p=e/c,d=t/h,f=[],m=[],g=[],v=[];for(a=0;u>a;a++){var y=a*d-s;for(r=0;l>r;r++){var x=r*p-o;m.push(x,-y,0),g.push(0,0,1),v.push(r/c),v.push(1-a/h)}}for(a=0;h>a;a++)for(r=0;c>r;r++){var _=r+l*a,b=r+l*(a+1),w=r+1+l*(a+1),M=r+1+l*a;f.push(_,b,M),f.push(b,w,M)}this.setIndex(f),this.addAttribute("position",new be(m,3)),this.addAttribute("normal",new be(g,3)),this.addAttribute("uv",new be(v,2))}function Ue(){ce.call(this),this.type="Camera",this.matrixWorldInverse=new h,this.projectionMatrix=new h}function Ne(e,t,i,n){Ue.call(this),this.type="PerspectiveCamera",this.fov=void 0!==e?e:50,this.zoom=1,this.near=void 0!==i?i:.1,this.far=void 0!==n?n:2e3,this.focus=10,this.aspect=void 0!==t?t:1,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}function De(e,t,i,n,r,a){Ue.call(this),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=i,this.bottom=n,this.near=void 0!==r?r:.1,this.far=void 0!==a?a:2e3,this.updateProjectionMatrix()}function Oe(e,t,i){function n(e){s=e}function r(i){i.array instanceof Uint32Array&&t.get("OES_element_index_uint")?(c=e.UNSIGNED_INT,h=4):i.array instanceof Uint16Array?(c=e.UNSIGNED_SHORT,h=2):(c=e.UNSIGNED_BYTE,h=1)}function a(t,n){e.drawElements(s,n,c,t*h),i.calls++,i.vertices+=n,s===e.TRIANGLES&&(i.faces+=n/3)}function o(n,r,a){var o=t.get("ANGLE_instanced_arrays");return null===o?void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays."):(o.drawElementsInstancedANGLE(s,a,c,r*h,n.maxInstancedCount),i.calls++,i.vertices+=a*n.maxInstancedCount,void(s===e.TRIANGLES&&(i.faces+=n.maxInstancedCount*a/3)))}var s,c,h;return{setMode:n,setIndex:r,render:a,renderInstances:o}}function Be(e,t,i){function n(e){o=e}function r(t,n){e.drawArrays(o,t,n),i.calls++,i.vertices+=n,o===e.TRIANGLES&&(i.faces+=n/3)}function a(n){var r=t.get("ANGLE_instanced_arrays");if(null===r)return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");var a=n.attributes.position,s=0;a.isInterleavedBufferAttribute?(s=a.data.count,r.drawArraysInstancedANGLE(o,0,s,n.maxInstancedCount)):(s=a.count,r.drawArraysInstancedANGLE(o,0,s,n.maxInstancedCount)),i.calls++,i.vertices+=s*n.maxInstancedCount,o===e.TRIANGLES&&(i.faces+=n.maxInstancedCount*s/3)}var o;return{setMode:n,render:r,renderInstances:a}}function Fe(){var e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];var n;switch(t.type){case"DirectionalLight":n={direction:new c,color:new W,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new i};break;case"SpotLight":n={position:new c,direction:new c,color:new W,distance:0,coneCos:0,penumbraCos:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new i};break;case"PointLight":n={position:new c,color:new W,distance:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new i};break;case"HemisphereLight":n={direction:new c,
2
+ skyColor:new W,groundColor:new W};break;case"RectAreaLight":n={color:new W,position:new c,halfWidth:new c,halfHeight:new c}}return e[t.id]=n,n}}}function ze(e){for(var t=e.split("\n"),i=0;i<t.length;i++)t[i]=i+1+": "+t[i];return t.join("\n")}function Ge(e,t,i){var n=e.createShader(t);return e.shaderSource(n,i),e.compileShader(n),e.getShaderParameter(n,e.COMPILE_STATUS)===!1&&console.error("THREE.WebGLShader: Shader couldn't compile."),""!==e.getShaderInfoLog(n)&&console.warn("THREE.WebGLShader: gl.getShaderInfoLog()",t===e.VERTEX_SHADER?"vertex":"fragment",e.getShaderInfoLog(n),ze(i)),n}function He(e){switch(e){case ts:return["Linear","( value )"];case is:return["sRGB","( value )"];case rs:return["RGBE","( value )"];case os:return["RGBM","( value, 7.0 )"];case ss:return["RGBM","( value, 16.0 )"];case cs:return["RGBD","( value, 256.0 )"];case ns:return["Gamma","( value, float( GAMMA_FACTOR ) )"];default:throw new Error("unsupported encoding: "+e)}}function Ve(e,t){var i=He(t);return"vec4 "+e+"( vec4 value ) { return "+i[0]+"ToLinear"+i[1]+"; }"}function ke(e,t){var i=He(t);return"vec4 "+e+"( vec4 value ) { return LinearTo"+i[0]+i[1]+"; }"}function je(e,t){var i;switch(t){case Xa:i="Linear";break;case qa:i="Reinhard";break;case Ya:i="Uncharted2";break;case Za:i="OptimizedCineon";break;default:throw new Error("unsupported toneMapping: "+t)}return"vec3 "+e+"( vec3 color ) { return "+i+"ToneMapping( color ); }"}function We(e,t,i){e=e||{};var n=[e.derivatives||t.envMapCubeUV||t.bumpMap||t.normalMap||t.flatShading?"#extension GL_OES_standard_derivatives : enable":"",(e.fragDepth||t.logarithmicDepthBuffer)&&i.get("EXT_frag_depth")?"#extension GL_EXT_frag_depth : enable":"",e.drawBuffers&&i.get("WEBGL_draw_buffers")?"#extension GL_EXT_draw_buffers : require":"",(e.shaderTextureLOD||t.envMap)&&i.get("EXT_shader_texture_lod")?"#extension GL_EXT_shader_texture_lod : enable":""];return n.filter(Ye).join("\n")}function Xe(e){var t=[];for(var i in e){var n=e[i];n!==!1&&t.push("#define "+i+" "+n)}return t.join("\n")}function qe(e,t,i){for(var n={},r=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES),a=0;r>a;a++){var o=e.getActiveAttrib(t,a),s=o.name;n[s]=e.getAttribLocation(t,s)}return n}function Ye(e){return""!==e}function Ze(e,t){return e.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g,t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights)}function Je(e){function t(e,t){var i=xh[t];if(void 0===i)throw new Error("Can not resolve #include <"+t+">");return Je(i)}var i=/#include +<([\w\d.]+)>/g;return e.replace(i,t)}function Qe(e){function t(e,t,i,n){for(var r="",a=parseInt(t);a<parseInt(i);a++)r+=n.replace(/\[ i \]/g,"[ "+a+" ]");return r}var i=/for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g;return e.replace(i,t)}function Ke(e,t,i,n){var r=e.context,a=i.extensions,o=i.defines,s=i.__webglShader.vertexShader,c=i.__webglShader.fragmentShader,h="SHADOWMAP_TYPE_BASIC";n.shadowMapType===ia?h="SHADOWMAP_TYPE_PCF":n.shadowMapType===na&&(h="SHADOWMAP_TYPE_PCF_SOFT");var l="ENVMAP_TYPE_CUBE",u="ENVMAP_MODE_REFLECTION",p="ENVMAP_BLENDING_MULTIPLY";if(n.envMap){switch(i.envMap.mapping){case Qa:case Ka:l="ENVMAP_TYPE_CUBE";break;case io:case no:l="ENVMAP_TYPE_CUBE_UV";break;case $a:case eo:l="ENVMAP_TYPE_EQUIREC";break;case to:l="ENVMAP_TYPE_SPHERE"}switch(i.envMap.mapping){case Ka:case eo:u="ENVMAP_MODE_REFRACTION"}switch(i.combine){case Va:p="ENVMAP_BLENDING_MULTIPLY";break;case ka:p="ENVMAP_BLENDING_MIX";break;case ja:p="ENVMAP_BLENDING_ADD"}}var d,f,m=e.gammaFactor>0?e.gammaFactor:1,g=We(a,n,e.extensions),v=Xe(o),y=r.createProgram();i.isRawShaderMaterial?(d=[v,"\n"].filter(Ye).join("\n"),f=[g,v,"\n"].filter(Ye).join("\n")):(d=["precision "+n.precision+" float;","precision "+n.precision+" int;","#define SHADER_NAME "+i.__webglShader.name,v,n.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+m,"#define MAX_BONES "+n.maxBones,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+u:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.displacementMap&&n.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.vertexColors?"#define USE_COLOR":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.useVertexTexture?"#define BONE_TEXTURE":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&n.flatShading===!1?"#define USE_MORPHNORMALS":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"","#define NUM_CLIPPING_PLANES "+n.numClippingPlanes,n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+h:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&e.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_COLOR"," attribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS"," attribute vec3 morphTarget0;"," attribute vec3 morphTarget1;"," attribute vec3 morphTarget2;"," attribute vec3 morphTarget3;"," #ifdef USE_MORPHNORMALS"," attribute vec3 morphNormal0;"," attribute vec3 morphNormal1;"," attribute vec3 morphNormal2;"," attribute vec3 morphNormal3;"," #else"," attribute vec3 morphTarget4;"," attribute vec3 morphTarget5;"," attribute vec3 morphTarget6;"," attribute vec3 morphTarget7;"," #endif","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif","\n"].filter(Ye).join("\n"),f=[g,"precision "+n.precision+" float;","precision "+n.precision+" int;","#define SHADER_NAME "+i.__webglShader.name,v,n.alphaTest?"#define ALPHATEST "+n.alphaTest:"","#define GAMMA_FACTOR "+m,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+l:"",n.envMap?"#define "+u:"",n.envMap?"#define "+p:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.vertexColors?"#define USE_COLOR":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"","#define NUM_CLIPPING_PLANES "+n.numClippingPlanes,"#define UNION_CLIPPING_PLANES "+(n.numClippingPlanes-n.numClipIntersection),n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+h:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&e.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"",n.envMap&&e.extensions.get("EXT_shader_texture_lod")?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;",n.toneMapping!==Wa?"#define TONE_MAPPING":"",n.toneMapping!==Wa?xh.tonemapping_pars_fragment:"",n.toneMapping!==Wa?je("toneMapping",n.toneMapping):"",n.outputEncoding||n.mapEncoding||n.envMapEncoding||n.emissiveMapEncoding?xh.encodings_pars_fragment:"",n.mapEncoding?Ve("mapTexelToLinear",n.mapEncoding):"",n.envMapEncoding?Ve("envMapTexelToLinear",n.envMapEncoding):"",n.emissiveMapEncoding?Ve("emissiveMapTexelToLinear",n.emissiveMapEncoding):"",n.outputEncoding?ke("linearToOutputTexel",n.outputEncoding):"",n.depthPacking?"#define DEPTH_PACKING "+i.depthPacking:"","\n"].filter(Ye).join("\n")),s=Je(s,n),s=Ze(s,n),c=Je(c,n),c=Ze(c,n),i.isShaderMaterial||(s=Qe(s),c=Qe(c));var x=d+s,_=f+c,b=Ge(r,r.VERTEX_SHADER,x),w=Ge(r,r.FRAGMENT_SHADER,_);r.attachShader(y,b),r.attachShader(y,w),void 0!==i.index0AttributeName?r.bindAttribLocation(y,0,i.index0AttributeName):n.morphTargets===!0&&r.bindAttribLocation(y,0,"position"),r.linkProgram(y);var M=r.getProgramInfoLog(y),E=r.getShaderInfoLog(b),T=r.getShaderInfoLog(w),S=!0,A=!0;r.getProgramParameter(y,r.LINK_STATUS)===!1?(S=!1,console.error("THREE.WebGLProgram: shader error: ",r.getError(),"gl.VALIDATE_STATUS",r.getProgramParameter(y,r.VALIDATE_STATUS),"gl.getProgramInfoLog",M,E,T)):""!==M?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",M):(""===E||""===T)&&(A=!1),A&&(this.diagnostics={runnable:S,material:i,programLog:M,vertexShader:{log:E,prefix:d},fragmentShader:{log:T,prefix:f}}),r.deleteShader(b),r.deleteShader(w);var L;this.getUniforms=function(){return void 0===L&&(L=new j(r,y,e)),L};var R;return this.getAttributes=function(){return void 0===R&&(R=qe(r,y)),R},this.destroy=function(){r.deleteProgram(y),this.program=void 0},Object.defineProperties(this,{uniforms:{get:function(){return console.warn("THREE.WebGLProgram: .uniforms is now .getUniforms()."),this.getUniforms()}},attributes:{get:function(){return console.warn("THREE.WebGLProgram: .attributes is now .getAttributes()."),this.getAttributes()}}}),this.id=Sh++,this.code=t,this.usedTimes=1,this.program=y,this.vertexShader=b,this.fragmentShader=w,this}function $e(e,t){function i(e){if(t.floatVertexTextures&&e&&e.skeleton&&e.skeleton.useVertexTexture)return 1024;var i=t.maxVertexUniforms,n=Math.floor((i-20)/4),r=n;return void 0!==e&&e&&e.isSkinnedMesh&&(r=Math.min(e.skeleton.bones.length,r),r<e.skeleton.bones.length&&console.warn("WebGLRenderer: too many bones - "+e.skeleton.bones.length+", this GPU supports just "+r+" (try OpenGL instead of ANGLE)")),r}function n(e,t){var i;return e?e.isTexture?i=e.encoding:e.isWebGLRenderTarget&&(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),i=e.texture.encoding):i=ts,i===ts&&t&&(i=ns),i}var r=[],a={MeshDepthMaterial:"depth",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"phong",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points"},o=["precision","supportsVertexTextures","map","mapEncoding","envMap","envMapMode","envMapEncoding","lightMap","aoMap","emissiveMap","emissiveMapEncoding","bumpMap","normalMap","displacementMap","specularMap","roughnessMap","metalnessMap","gradientMap","alphaMap","combine","vertexColors","fog","useFog","fogExp","flatShading","sizeAttenuation","logarithmicDepthBuffer","skinning","maxBones","useVertexTexture","morphTargets","morphNormals","maxMorphTargets","maxMorphNormals","premultipliedAlpha","numDirLights","numPointLights","numSpotLights","numHemiLights","numRectAreaLights","shadowMapEnabled","shadowMapType","toneMapping","physicallyCorrectLights","alphaTest","doubleSided","flipSided","numClippingPlanes","numClipIntersection","depthPacking"];this.getParameters=function(r,o,s,c,h,l){var u=a[r.type],p=i(l),d=e.getPrecision();null!==r.precision&&(d=t.getMaxPrecision(r.precision),d!==r.precision&&console.warn("THREE.WebGLProgram.getParameters:",r.precision,"not supported, using",d,"instead."));var f=e.getCurrentRenderTarget(),m={shaderID:u,precision:d,supportsVertexTextures:t.vertexTextures,outputEncoding:n(f?f.texture:null,e.gammaOutput),map:!!r.map,mapEncoding:n(r.map,e.gammaInput),envMap:!!r.envMap,envMapMode:r.envMap&&r.envMap.mapping,envMapEncoding:n(r.envMap,e.gammaInput),envMapCubeUV:!!r.envMap&&(r.envMap.mapping===io||r.envMap.mapping===no),lightMap:!!r.lightMap,aoMap:!!r.aoMap,emissiveMap:!!r.emissiveMap,emissiveMapEncoding:n(r.emissiveMap,e.gammaInput),bumpMap:!!r.bumpMap,normalMap:!!r.normalMap,displacementMap:!!r.displacementMap,roughnessMap:!!r.roughnessMap,metalnessMap:!!r.metalnessMap,specularMap:!!r.specularMap,alphaMap:!!r.alphaMap,gradientMap:!!r.gradientMap,combine:r.combine,vertexColors:r.vertexColors,fog:!!s,useFog:r.fog,fogExp:s&&s.isFogExp2,flatShading:r.shading===sa,sizeAttenuation:r.sizeAttenuation,logarithmicDepthBuffer:t.logarithmicDepthBuffer,skinning:r.skinning,maxBones:p,useVertexTexture:t.floatVertexTextures&&l&&l.skeleton&&l.skeleton.useVertexTexture,morphTargets:r.morphTargets,morphNormals:r.morphNormals,maxMorphTargets:e.maxMorphTargets,maxMorphNormals:e.maxMorphNormals,numDirLights:o.directional.length,numPointLights:o.point.length,numSpotLights:o.spot.length,numRectAreaLights:o.rectArea.length,numHemiLights:o.hemi.length,numClippingPlanes:c,numClipIntersection:h,shadowMapEnabled:e.shadowMap.enabled&&l.receiveShadow&&o.shadows.length>0,shadowMapType:e.shadowMap.type,toneMapping:e.toneMapping,physicallyCorrectLights:e.physicallyCorrectLights,premultipliedAlpha:r.premultipliedAlpha,alphaTest:r.alphaTest,doubleSided:r.side===oa,flipSided:r.side===aa,depthPacking:void 0!==r.depthPacking?r.depthPacking:!1};return m},this.getProgramCode=function(e,t){var i=[];if(t.shaderID?i.push(t.shaderID):(i.push(e.fragmentShader),i.push(e.vertexShader)),void 0!==e.defines)for(var n in e.defines)i.push(n),i.push(e.defines[n]);for(var r=0;r<o.length;r++)i.push(t[o[r]]);return i.join()},this.acquireProgram=function(t,i,n){for(var a,o=0,s=r.length;s>o;o++){var c=r[o];if(c.code===n){a=c,++a.usedTimes;break}}return void 0===a&&(a=new Ke(e,n,t,i),r.push(a)),a},this.releaseProgram=function(e){if(0===--e.usedTimes){var t=r.indexOf(e);r[t]=r[r.length-1],r.pop(),e.destroy()}},this.programs=r}function et(e,t,i){function n(e){var r=e.target,s=c[r.id];null!==s.index&&a(s.index),o(s.attributes),r.removeEventListener("dispose",n),delete c[r.id];var h=t.get(r);h.wireframe&&a(h.wireframe),t["delete"](r);var l=t.get(s);l.wireframe&&a(l.wireframe),t["delete"](s),i.memory.geometries--}function r(e){return e.isInterleavedBufferAttribute?t.get(e.data).__webglBuffer:t.get(e).__webglBuffer}function a(t){var i=r(t);void 0!==i&&(e.deleteBuffer(i),s(t))}function o(e){for(var t in e)a(e[t])}function s(e){e.isInterleavedBufferAttribute?t["delete"](e.data):t["delete"](e)}var c={};return{get:function(e){var t=e.geometry;if(void 0!==c[t.id])return c[t.id];t.addEventListener("dispose",n);var r;return t.isBufferGeometry?r=t:t.isGeometry&&(void 0===t._bufferGeometry&&(t._bufferGeometry=(new Ae).setFromObject(e)),r=t._bufferGeometry),c[t.id]=r,i.memory.geometries++,r}}}function tt(e,t,i){function n(t){var i=l.get(t);t.geometry.isGeometry&&i.updateFromObject(t);var n=i.index,a=i.attributes;null!==n&&r(n,e.ELEMENT_ARRAY_BUFFER);for(var o in a)r(a[o],e.ARRAY_BUFFER);var s=i.morphAttributes;for(var o in s)for(var c=s[o],h=0,u=c.length;u>h;h++)r(c[h],e.ARRAY_BUFFER);return i}function r(e,i){var n=e.isInterleavedBufferAttribute?e.data:e,r=t.get(n);void 0===r.__webglBuffer?a(r,n,i):r.version!==n.version&&o(r,n,i)}function a(t,i,n){t.__webglBuffer=e.createBuffer(),e.bindBuffer(n,t.__webglBuffer);var r=i.dynamic?e.DYNAMIC_DRAW:e.STATIC_DRAW;e.bufferData(n,i.array,r);var a=e.FLOAT,o=i.array;o instanceof Float32Array?a=e.FLOAT:o instanceof Float64Array?console.warn("Unsupported data buffer format: Float64Array"):o instanceof Uint16Array?a=e.UNSIGNED_SHORT:o instanceof Int16Array?a=e.SHORT:o instanceof Uint32Array?a=e.UNSIGNED_INT:o instanceof Int32Array?a=e.INT:o instanceof Int8Array?a=e.BYTE:o instanceof Uint8Array&&(a=e.UNSIGNED_BYTE),t.bytesPerElement=o.BYTES_PER_ELEMENT,t.type=a,t.version=i.version,i.onUploadCallback()}function o(t,i,n){e.bindBuffer(n,t.__webglBuffer),i.dynamic===!1?e.bufferData(n,i.array,e.STATIC_DRAW):-1===i.updateRange.count?e.bufferSubData(n,0,i.array):0===i.updateRange.count?console.error("THREE.WebGLObjects.updateBuffer: dynamic THREE.BufferAttribute marked as needsUpdate but updateRange.count is 0, ensure you are using set methods or updating manually."):(e.bufferSubData(n,i.updateRange.offset*i.array.BYTES_PER_ELEMENT,i.array.subarray(i.updateRange.offset,i.updateRange.offset+i.updateRange.count)),i.updateRange.count=0),t.version=i.version}function s(e){return e.isInterleavedBufferAttribute?t.get(e.data).__webglBuffer:t.get(e).__webglBuffer}function c(e){return e.isInterleavedBufferAttribute?t.get(e.data):t.get(e)}function h(i){var n=t.get(i);if(void 0!==n.wireframe)return n.wireframe;var a=[],o=i.index,s=i.attributes;if(null!==o)for(var c=o.array,h=0,l=c.length;l>h;h+=3){var u=c[h+0],p=c[h+1],d=c[h+2];a.push(u,p,p,d,d,u)}else for(var c=s.position.array,h=0,l=c.length/3-1;l>h;h+=3){var u=h+0,p=h+1,d=h+2;a.push(u,p,p,d,d,u)}var f=new(Ee(a)>65535?_e:ye)(a,1);return r(f,e.ELEMENT_ARRAY_BUFFER),n.wireframe=f,f}var l=new et(e,t,i);return{getAttributeBuffer:s,getAttributeProperties:c,getWireframeAttribute:h,update:n}}function it(e,t,i,n,r,a,o){function s(e,t){if(e.width>t||e.height>t){var i=t/Math.max(e.width,e.height),n=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");n.width=Math.floor(e.width*i),n.height=Math.floor(e.height*i);var r=n.getContext("2d");return r.drawImage(e,0,0,e.width,e.height,0,0,n.width,n.height),console.warn("THREE.WebGLRenderer: image is too big ("+e.width+"x"+e.height+"). Resized to "+n.width+"x"+n.height,e),n}return e}function c(e){return us.isPowerOfTwo(e.width)&&us.isPowerOfTwo(e.height)}function h(e){if(e instanceof HTMLImageElement||e instanceof HTMLCanvasElement){var t=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");t.width=us.nearestPowerOfTwo(e.width),t.height=us.nearestPowerOfTwo(e.height);var i=t.getContext("2d");return i.drawImage(e,0,0,t.width,t.height),console.warn("THREE.WebGLRenderer: image is not power of two ("+e.width+"x"+e.height+"). Resized to "+t.width+"x"+t.height,e),t}return e}function l(e){return e.wrapS!==ao||e.wrapT!==ao||e.minFilter!==so&&e.minFilter!==lo}function u(t){return t===so||t===co||t===ho?e.NEAREST:e.LINEAR}function p(e){var t=e.target;t.removeEventListener("dispose",p),f(t),A.textures--}function d(e){var t=e.target;t.removeEventListener("dispose",d),m(t),A.textures--}function f(t){var i=n.get(t);if(t.image&&i.__image__webglTextureCube)e.deleteTexture(i.__image__webglTextureCube);else{if(void 0===i.__webglInit)return;e.deleteTexture(i.__webglTexture)}n["delete"](t)}function m(t){var i=n.get(t),r=n.get(t.texture);if(t){if(void 0!==r.__webglTexture&&e.deleteTexture(r.__webglTexture),t.depthTexture&&t.depthTexture.dispose(),t.isWebGLRenderTargetCube)for(var a=0;6>a;a++)e.deleteFramebuffer(i.__webglFramebuffer[a]),i.__webglDepthbuffer&&e.deleteRenderbuffer(i.__webglDepthbuffer[a]);else e.deleteFramebuffer(i.__webglFramebuffer),i.__webglDepthbuffer&&e.deleteRenderbuffer(i.__webglDepthbuffer);n["delete"](t.texture),n["delete"](t)}}function g(t,r){var a=n.get(t);if(t.version>0&&a.__version!==t.version){var o=t.image;if(void 0===o)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined",t);else{if(o.complete!==!1)return void _(a,t,r);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete",t)}}i.activeTexture(e.TEXTURE0+r),i.bindTexture(e.TEXTURE_2D,a.__webglTexture)}function v(t,o){var h=n.get(t);if(6===t.image.length)if(t.version>0&&h.__version!==t.version){h.__image__webglTextureCube||(t.addEventListener("dispose",p),h.__image__webglTextureCube=e.createTexture(),A.textures++),i.activeTexture(e.TEXTURE0+o),i.bindTexture(e.TEXTURE_CUBE_MAP,h.__image__webglTextureCube),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,t.flipY);for(var l=t&&t.isCompressedTexture,u=t.image[0]&&t.image[0].isDataTexture,d=[],f=0;6>f;f++)l||u?d[f]=u?t.image[f].image:t.image[f]:d[f]=s(t.image[f],r.maxCubemapSize);var m=d[0],g=c(m),v=a(t.format),y=a(t.type);x(e.TEXTURE_CUBE_MAP,t,g);for(var f=0;6>f;f++)if(l)for(var _,b=d[f].mipmaps,w=0,M=b.length;M>w;w++)_=b[w],t.format!==Lo&&t.format!==Ao?i.getCompressedTextureFormats().indexOf(v)>-1?i.compressedTexImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+f,w,v,_.width,_.height,0,_.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):i.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+f,w,v,_.width,_.height,0,v,y,_.data);else u?i.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+f,0,v,d[f].width,d[f].height,0,v,y,d[f].data):i.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+f,0,v,v,y,d[f]);t.generateMipmaps&&g&&e.generateMipmap(e.TEXTURE_CUBE_MAP),h.__version=t.version,t.onUpdate&&t.onUpdate(t)}else i.activeTexture(e.TEXTURE0+o),i.bindTexture(e.TEXTURE_CUBE_MAP,h.__image__webglTextureCube)}function y(t,r){i.activeTexture(e.TEXTURE0+r),i.bindTexture(e.TEXTURE_CUBE_MAP,n.get(t).__webglTexture)}function x(i,o,s){var c;if(s?(e.texParameteri(i,e.TEXTURE_WRAP_S,a(o.wrapS)),e.texParameteri(i,e.TEXTURE_WRAP_T,a(o.wrapT)),e.texParameteri(i,e.TEXTURE_MAG_FILTER,a(o.magFilter)),e.texParameteri(i,e.TEXTURE_MIN_FILTER,a(o.minFilter))):(e.texParameteri(i,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(i,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),(o.wrapS!==ao||o.wrapT!==ao)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping.",o),e.texParameteri(i,e.TEXTURE_MAG_FILTER,u(o.magFilter)),e.texParameteri(i,e.TEXTURE_MIN_FILTER,u(o.minFilter)),o.minFilter!==so&&o.minFilter!==lo&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.",o)),c=t.get("EXT_texture_filter_anisotropic")){if(o.type===_o&&null===t.get("OES_texture_float_linear"))return;if(o.type===bo&&null===t.get("OES_texture_half_float_linear"))return;(o.anisotropy>1||n.get(o).__currentAnisotropy)&&(e.texParameterf(i,c.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(o.anisotropy,r.getMaxAnisotropy())),n.get(o).__currentAnisotropy=o.anisotropy)}}function _(t,n,o){void 0===t.__webglInit&&(t.__webglInit=!0,n.addEventListener("dispose",p),t.__webglTexture=e.createTexture(),A.textures++),i.activeTexture(e.TEXTURE0+o),i.bindTexture(e.TEXTURE_2D,t.__webglTexture),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,n.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,n.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,n.unpackAlignment);var u=s(n.image,r.maxTextureSize);l(n)&&c(u)===!1&&(u=h(u));var d=c(u),f=a(n.format),m=a(n.type);x(e.TEXTURE_2D,n,d);var g,v=n.mipmaps;if(n.isDepthTexture){var y=e.DEPTH_COMPONENT;if(n.type===_o){if(!L)throw new Error("Float Depth Texture only supported in WebGL2.0");y=e.DEPTH_COMPONENT32F}else L&&(y=e.DEPTH_COMPONENT16);n.format===Io&&y===e.DEPTH_COMPONENT&&n.type!==vo&&n.type!==xo&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),n.type=vo,m=a(n.type)),n.format===Uo&&(y=e.DEPTH_STENCIL,n.type!==To&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),n.type=To,m=a(n.type))),i.texImage2D(e.TEXTURE_2D,0,y,u.width,u.height,0,f,m,null)}else if(n.isDataTexture)if(v.length>0&&d){for(var _=0,b=v.length;b>_;_++)g=v[_],i.texImage2D(e.TEXTURE_2D,_,f,g.width,g.height,0,f,m,g.data);n.generateMipmaps=!1}else i.texImage2D(e.TEXTURE_2D,0,f,u.width,u.height,0,f,m,u.data);else if(n.isCompressedTexture)for(var _=0,b=v.length;b>_;_++)g=v[_],n.format!==Lo&&n.format!==Ao?i.getCompressedTextureFormats().indexOf(f)>-1?i.compressedTexImage2D(e.TEXTURE_2D,_,f,g.width,g.height,0,g.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):i.texImage2D(e.TEXTURE_2D,_,f,g.width,g.height,0,f,m,g.data);else if(v.length>0&&d){for(var _=0,b=v.length;b>_;_++)g=v[_],i.texImage2D(e.TEXTURE_2D,_,f,f,m,g);n.generateMipmaps=!1}else i.texImage2D(e.TEXTURE_2D,0,f,f,m,u);n.generateMipmaps&&d&&e.generateMipmap(e.TEXTURE_2D),t.__version=n.version,n.onUpdate&&n.onUpdate(n)}function b(t,r,o,s){var c=a(r.texture.format),h=a(r.texture.type);i.texImage2D(s,0,c,r.width,r.height,0,c,h,null),e.bindFramebuffer(e.FRAMEBUFFER,t),e.framebufferTexture2D(e.FRAMEBUFFER,o,s,n.get(r.texture).__webglTexture,0),e.bindFramebuffer(e.FRAMEBUFFER,null)}function w(t,i){e.bindRenderbuffer(e.RENDERBUFFER,t),i.depthBuffer&&!i.stencilBuffer?(e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_COMPONENT16,i.width,i.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,t)):i.depthBuffer&&i.stencilBuffer?(e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,i.width,i.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,t)):e.renderbufferStorage(e.RENDERBUFFER,e.RGBA4,i.width,i.height),e.bindRenderbuffer(e.RENDERBUFFER,null)}function M(t,i){var r=i&&i.isWebGLRenderTargetCube;if(r)throw new Error("Depth Texture with cube render targets is not supported!");if(e.bindFramebuffer(e.FRAMEBUFFER,t),!i.depthTexture||!i.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");n.get(i.depthTexture).__webglTexture&&i.depthTexture.image.width===i.width&&i.depthTexture.image.height===i.height||(i.depthTexture.image.width=i.width,i.depthTexture.image.height=i.height,i.depthTexture.needsUpdate=!0),g(i.depthTexture,0);var a=n.get(i.depthTexture).__webglTexture;if(i.depthTexture.format===Io)e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,a,0);else{if(i.depthTexture.format!==Uo)throw new Error("Unknown depthTexture format");e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.TEXTURE_2D,a,0)}}function E(t){var i=n.get(t),r=t.isWebGLRenderTargetCube===!0;if(t.depthTexture){if(r)throw new Error("target.depthTexture not supported in Cube render targets");M(i.__webglFramebuffer,t)}else if(r){i.__webglDepthbuffer=[];for(var a=0;6>a;a++)e.bindFramebuffer(e.FRAMEBUFFER,i.__webglFramebuffer[a]),i.__webglDepthbuffer[a]=e.createRenderbuffer(),w(i.__webglDepthbuffer[a],t)}else e.bindFramebuffer(e.FRAMEBUFFER,i.__webglFramebuffer),i.__webglDepthbuffer=e.createRenderbuffer(),w(i.__webglDepthbuffer,t);e.bindFramebuffer(e.FRAMEBUFFER,null)}function T(t){var r=n.get(t),a=n.get(t.texture);t.addEventListener("dispose",d),a.__webglTexture=e.createTexture(),A.textures++;var o=t.isWebGLRenderTargetCube===!0,s=c(t);if(o){r.__webglFramebuffer=[];for(var h=0;6>h;h++)r.__webglFramebuffer[h]=e.createFramebuffer()}else r.__webglFramebuffer=e.createFramebuffer();if(o){i.bindTexture(e.TEXTURE_CUBE_MAP,a.__webglTexture),x(e.TEXTURE_CUBE_MAP,t.texture,s);for(var h=0;6>h;h++)b(r.__webglFramebuffer[h],t,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+h);t.texture.generateMipmaps&&s&&e.generateMipmap(e.TEXTURE_CUBE_MAP),i.bindTexture(e.TEXTURE_CUBE_MAP,null)}else i.bindTexture(e.TEXTURE_2D,a.__webglTexture),x(e.TEXTURE_2D,t.texture,s),b(r.__webglFramebuffer,t,e.COLOR_ATTACHMENT0,e.TEXTURE_2D),t.texture.generateMipmaps&&s&&e.generateMipmap(e.TEXTURE_2D),i.bindTexture(e.TEXTURE_2D,null);t.depthBuffer&&E(t)}function S(t){var r=t.texture;if(r.generateMipmaps&&c(t)&&r.minFilter!==so&&r.minFilter!==lo){var a=t&&t.isWebGLRenderTargetCube?e.TEXTURE_CUBE_MAP:e.TEXTURE_2D,o=n.get(r).__webglTexture;i.bindTexture(a,o),e.generateMipmap(a),i.bindTexture(a,null)}}var A=o.memory,L="undefined"!=typeof WebGL2RenderingContext&&e instanceof WebGL2RenderingContext;this.setTexture2D=g,this.setTextureCube=v,this.setTextureCubeDynamic=y,this.setupRenderTarget=T,this.updateRenderTargetMipmap=S}function nt(){var e={};return{get:function(t){var i=t.uuid,n=e[i];return void 0===n&&(n={},e[i]=n),n},"delete":function(t){delete e[t.uuid]},clear:function(){e={}}}}function rt(e,t,i){function n(){var t=!1,i=new r,n=null,a=new r;return{setMask:function(i){n===i||t||(e.colorMask(i,i,i,i),n=i)},setLocked:function(e){t=e},setClear:function(t,n,r,o,s){s===!0&&(t*=o,n*=o,r*=o),i.set(t,n,r,o),a.equals(i)===!1&&(e.clearColor(t,n,r,o),a.copy(i))},reset:function(){t=!1,n=null,a.set(0,0,0,1)}}}function a(){var t=!1,i=null,n=null,r=null;return{setTest:function(t){t?d(e.DEPTH_TEST):f(e.DEPTH_TEST)},setMask:function(n){i===n||t||(e.depthMask(n),i=n)},setFunc:function(t){if(n!==t){if(t)switch(t){case Na:e.depthFunc(e.NEVER);break;case Da:e.depthFunc(e.ALWAYS);break;case Oa:e.depthFunc(e.LESS);break;case Ba:e.depthFunc(e.LEQUAL);break;case Fa:e.depthFunc(e.EQUAL);break;case za:e.depthFunc(e.GEQUAL);break;case Ga:e.depthFunc(e.GREATER);break;case Ha:e.depthFunc(e.NOTEQUAL);break;default:e.depthFunc(e.LEQUAL)}else e.depthFunc(e.LEQUAL);n=t}},setLocked:function(e){t=e},setClear:function(t){r!==t&&(e.clearDepth(t),r=t)},reset:function(){t=!1,i=null,n=null,r=null}}}function o(){var t=!1,i=null,n=null,r=null,a=null,o=null,s=null,c=null,h=null;return{setTest:function(t){t?d(e.STENCIL_TEST):f(e.STENCIL_TEST)},setMask:function(n){i===n||t||(e.stencilMask(n),i=n)},setFunc:function(t,i,o){(n!==t||r!==i||a!==o)&&(e.stencilFunc(t,i,o),n=t,r=i,a=o)},setOp:function(t,i,n){(o!==t||s!==i||c!==n)&&(e.stencilOp(t,i,n),o=t,s=i,c=n)},setLocked:function(e){t=e},setClear:function(t){h!==t&&(e.clearStencil(t),h=t)},reset:function(){t=!1,i=null,n=null,r=null,a=null,o=null,s=null,c=null,h=null}}}function s(t,i,n){var r=new Uint8Array(4),a=e.createTexture();e.bindTexture(t,a),e.texParameteri(t,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(t,e.TEXTURE_MAG_FILTER,e.NEAREST);for(var o=0;n>o;o++)e.texImage2D(i+o,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,r);return a}function c(){F.setClear(0,0,0,1),z.setClear(1),G.setClear(0),d(e.DEPTH_TEST),_(Ba),T(!1),S(Jr),d(e.CULL_FACE),d(e.BLEND),g(da)}function h(){for(var e=0,t=V.length;t>e;e++)V[e]=0}function l(i){if(V[i]=1,0===k[i]&&(e.enableVertexAttribArray(i),k[i]=1),0!==j[i]){var n=t.get("ANGLE_instanced_arrays");n.vertexAttribDivisorANGLE(i,0),j[i]=0}}function u(t,i,n){V[t]=1,0===k[t]&&(e.enableVertexAttribArray(t),k[t]=1),j[t]!==i&&(n.vertexAttribDivisorANGLE(t,i),j[t]=i)}function p(){for(var t=0,i=k.length;t!==i;++t)k[t]!==V[t]&&(e.disableVertexAttribArray(t),k[t]=0)}function d(t){W[t]!==!0&&(e.enable(t),W[t]=!0)}function f(t){W[t]!==!1&&(e.disable(t),W[t]=!1)}function m(){if(null===X&&(X=[],t.get("WEBGL_compressed_texture_pvrtc")||t.get("WEBGL_compressed_texture_s3tc")||t.get("WEBGL_compressed_texture_etc1")))for(var i=e.getParameter(e.COMPRESSED_TEXTURE_FORMATS),n=0;n<i.length;n++)X.push(i[n]);return X}function g(t,n,r,a,o,s,c,h){t!==pa?d(e.BLEND):f(e.BLEND),(t!==q||h!==ee)&&(t===fa?h?(e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD),e.blendFuncSeparate(e.ONE,e.ONE,e.ONE,e.ONE)):(e.blendEquation(e.FUNC_ADD),e.blendFunc(e.SRC_ALPHA,e.ONE)):t===ma?h?(e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD),e.blendFuncSeparate(e.ZERO,e.ZERO,e.ONE_MINUS_SRC_COLOR,e.ONE_MINUS_SRC_ALPHA)):(e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ZERO,e.ONE_MINUS_SRC_COLOR)):t===ga?h?(e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD),e.blendFuncSeparate(e.ZERO,e.SRC_COLOR,e.ZERO,e.SRC_ALPHA)):(e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ZERO,e.SRC_COLOR)):h?(e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD),e.blendFuncSeparate(e.ONE,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA)):(e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD),e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA)),q=t,ee=h),t===va?(o=o||n,s=s||r,c=c||a,(n!==Y||o!==Q)&&(e.blendEquationSeparate(i(n),i(o)),Y=n,Q=o),(r!==Z||a!==J||s!==K||c!==$)&&(e.blendFuncSeparate(i(r),i(a),i(s),i(c)),Z=r,J=a,K=s,$=c)):(Y=null,Z=null,J=null,Q=null,K=null,$=null)}function v(e){F.setMask(e)}function y(e){z.setTest(e)}function x(e){z.setMask(e)}function _(e){z.setFunc(e)}function b(e){G.setTest(e)}function w(e){G.setMask(e)}function M(e,t,i){G.setFunc(e,t,i)}function E(e,t,i){G.setOp(e,t,i);
3
+ }function T(t){te!==t&&(t?e.frontFace(e.CW):e.frontFace(e.CCW),te=t)}function S(t){t!==Zr?(d(e.CULL_FACE),t!==ie&&(t===Jr?e.cullFace(e.BACK):t===Qr?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK))):f(e.CULL_FACE),ie=t}function A(t){t!==ne&&(he&&e.lineWidth(t),ne=t)}function L(t,i,n){t?(d(e.POLYGON_OFFSET_FILL),(re!==i||ae!==n)&&(e.polygonOffset(i,n),re=i,ae=n)):f(e.POLYGON_OFFSET_FILL)}function R(){return oe}function P(t){oe=t,t?d(e.SCISSOR_TEST):f(e.SCISSOR_TEST)}function C(t){void 0===t&&(t=e.TEXTURE0+se-1),le!==t&&(e.activeTexture(t),le=t)}function I(t,i){null===le&&C();var n=ue[le];void 0===n&&(n={type:void 0,texture:void 0},ue[le]=n),(n.type!==t||n.texture!==i)&&(e.bindTexture(t,i||fe[t]),n.type=t,n.texture=i)}function U(){try{e.compressedTexImage2D.apply(e,arguments)}catch(t){console.error(t)}}function N(){try{e.texImage2D.apply(e,arguments)}catch(t){console.error(t)}}function D(t){pe.equals(t)===!1&&(e.scissor(t.x,t.y,t.z,t.w),pe.copy(t))}function O(t){de.equals(t)===!1&&(e.viewport(t.x,t.y,t.z,t.w),de.copy(t))}function B(){for(var t=0;t<k.length;t++)1===k[t]&&(e.disableVertexAttribArray(t),k[t]=0);W={},X=null,le=null,ue={},q=null,te=null,ie=null,F.reset(),z.reset(),G.reset()}var F=new n,z=new a,G=new o,H=e.getParameter(e.MAX_VERTEX_ATTRIBS),V=new Uint8Array(H),k=new Uint8Array(H),j=new Uint8Array(H),W={},X=null,q=null,Y=null,Z=null,J=null,Q=null,K=null,$=null,ee=!1,te=null,ie=null,ne=null,re=null,ae=null,oe=null,se=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),ce=parseFloat(/^WebGL\ ([0-9])/.exec(e.getParameter(e.VERSION))[1]),he=parseFloat(ce)>=1,le=null,ue={},pe=new r,de=new r,fe={};return fe[e.TEXTURE_2D]=s(e.TEXTURE_2D,e.TEXTURE_2D,1),fe[e.TEXTURE_CUBE_MAP]=s(e.TEXTURE_CUBE_MAP,e.TEXTURE_CUBE_MAP_POSITIVE_X,6),{buffers:{color:F,depth:z,stencil:G},init:c,initAttributes:h,enableAttribute:l,enableAttributeAndDivisor:u,disableUnusedAttributes:p,enable:d,disable:f,getCompressedTextureFormats:m,setBlending:g,setColorWrite:v,setDepthTest:y,setDepthWrite:x,setDepthFunc:_,setStencilTest:b,setStencilWrite:w,setStencilFunc:M,setStencilOp:E,setFlipSided:T,setCullFace:S,setLineWidth:A,setPolygonOffset:L,getScissorTest:R,setScissorTest:P,activeTexture:C,bindTexture:I,compressedTexImage2D:U,texImage2D:N,scissor:D,viewport:O,reset:B}}function at(e,t,i){function n(){if(void 0!==a)return a;var i=t.get("EXT_texture_filter_anisotropic");return a=null!==i?e.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0}function r(t){if("highp"===t){if(e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.HIGH_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}var a,o=void 0!==i.precision?i.precision:"highp",s=r(o);s!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",s,"instead."),o=s);var c=i.logarithmicDepthBuffer===!0&&!!t.get("EXT_frag_depth"),h=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),l=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS),u=e.getParameter(e.MAX_TEXTURE_SIZE),p=e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),d=e.getParameter(e.MAX_VERTEX_ATTRIBS),f=e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),m=e.getParameter(e.MAX_VARYING_VECTORS),g=e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),v=l>0,y=!!t.get("OES_texture_float"),x=v&&y;return{getMaxAnisotropy:n,getMaxPrecision:r,precision:o,logarithmicDepthBuffer:c,maxTextures:h,maxVertexTextures:l,maxTextureSize:u,maxCubemapSize:p,maxAttributes:d,maxVertexUniforms:f,maxVaryings:m,maxFragmentUniforms:g,vertexTextures:v,floatFragmentTextures:y,floatVertexTextures:x}}function ot(e){var t={};return{get:function(i){if(void 0!==t[i])return t[i];var n;switch(i){case"WEBGL_depth_texture":n=e.getExtension("WEBGL_depth_texture")||e.getExtension("MOZ_WEBGL_depth_texture")||e.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":n=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":n=e.getExtension("WEBGL_compressed_texture_s3tc")||e.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":n=e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;case"WEBGL_compressed_texture_etc1":n=e.getExtension("WEBGL_compressed_texture_etc1");break;default:n=e.getExtension(i)}return null===n&&console.warn("THREE.WebGLRenderer: "+i+" extension not supported."),t[i]=n,n}}}function st(){function e(){h.value!==n&&(h.value=n,h.needsUpdate=r>0),i.numPlanes=r,i.numIntersection=0}function t(e,t,n,r){var a=null!==e?e.length:0,o=null;if(0!==a){if(o=h.value,r!==!0||null===o){var l=n+4*a,u=t.matrixWorldInverse;c.getNormalMatrix(u),(null===o||o.length<l)&&(o=new Float32Array(l));for(var p=0,d=n;p!==a;++p,d+=4)s.copy(e[p]).applyMatrix4(u,c),s.normal.toArray(o,d),o[d+3]=s.constant}h.value=o,h.needsUpdate=!0}return i.numPlanes=a,o}var i=this,n=null,r=0,a=!1,o=!1,s=new ie,c=new te,h={value:null,needsUpdate:!1};this.uniform=h,this.numPlanes=0,this.numIntersection=0,this.init=function(e,i,o){var s=0!==e.length||i||0!==r||a;return a=i,n=t(e,o,0),r=e.length,s},this.beginShadows=function(){o=!0,t(null)},this.endShadows=function(){o=!1,e()},this.setState=function(i,s,c,l,u,p){if(!a||null===i||0===i.length||o&&!c)o?t(null):e();else{var d=o?0:r,f=4*d,m=u.clippingState||null;h.value=m,m=t(i,l,f,p);for(var g=0;g!==f;++g)m[g]=n[g];u.clippingState=m,this.numIntersection=s?this.numPlanes:0,this.numPlanes+=d}}}function ct(e){function t(){return null===de?Se:1}function i(){ht.init(),ht.scissor(ye.copy(Re).multiplyScalar(Se)),ht.viewport(_e.copy(Ue).multiplyScalar(Se)),ht.buffers.color.setClear(we.r,we.g,we.b,Me,J)}function n(){ue=null,ve=null,ge="",me=-1,ht.reset()}function a(e){e.preventDefault(),n(),i(),lt.clear()}function o(e){var t=e.target;t.removeEventListener("dispose",o),s(t)}function s(e){l(e),lt["delete"](e)}function l(e){var t=lt.get(e).program;e.program=void 0,void 0!==t&&dt.releaseProgram(t)}function u(e,t,i,n){var r;if(i&&i.isInstancedBufferGeometry&&(r=et.get("ANGLE_instanced_arrays"),null===r))return void console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");void 0===n&&(n=0),ht.initAttributes();var a=i.attributes,o=t.getAttributes(),s=e.defaultAttributeValues;for(var c in o){var h=o[c];if(h>=0){var l=a[c];if(void 0!==l){var u=l.normalized,p=l.itemSize,d=pt.getAttributeProperties(l),f=d.__webglBuffer,m=d.type,g=d.bytesPerElement;if(l.isInterleavedBufferAttribute){var v=l.data,y=v.stride,x=l.offset;v&&v.isInstancedInterleavedBuffer?(ht.enableAttributeAndDivisor(h,v.meshPerAttribute,r),void 0===i.maxInstancedCount&&(i.maxInstancedCount=v.meshPerAttribute*v.count)):ht.enableAttribute(h),Je.bindBuffer(Je.ARRAY_BUFFER,f),Je.vertexAttribPointer(h,p,m,u,y*g,(n*y+x)*g)}else l.isInstancedBufferAttribute?(ht.enableAttributeAndDivisor(h,l.meshPerAttribute,r),void 0===i.maxInstancedCount&&(i.maxInstancedCount=l.meshPerAttribute*l.count)):ht.enableAttribute(h),Je.bindBuffer(Je.ARRAY_BUFFER,f),Je.vertexAttribPointer(h,p,m,u,0,n*p*g)}else if(void 0!==s){var _=s[c];if(void 0!==_)switch(_.length){case 2:Je.vertexAttrib2fv(h,_);break;case 3:Je.vertexAttrib3fv(h,_);break;case 4:Je.vertexAttrib4fv(h,_);break;default:Je.vertexAttrib1fv(h,_)}}}}ht.disableUnusedAttributes()}function p(e,t){return Math.abs(t[0])-Math.abs(e[0])}function d(e,t){return e.object.renderOrder!==t.object.renderOrder?e.object.renderOrder-t.object.renderOrder:e.material.program&&t.material.program&&e.material.program!==t.material.program?e.material.program.id-t.material.program.id:e.material.id!==t.material.id?e.material.id-t.material.id:e.z!==t.z?e.z-t.z:e.id-t.id}function f(e,t){return e.object.renderOrder!==t.object.renderOrder?e.object.renderOrder-t.object.renderOrder:e.z!==t.z?t.z-e.z:e.id-t.id}function m(e,t,i,n,r){var a,o;i.transparent?(a=ae,o=++oe):(a=te,o=++ie);var s=a[o];void 0!==s?(s.id=e.id,s.object=e,s.geometry=t,s.material=i,s.z=We.z,s.group=r):(s={id:e.id,object:e,geometry:t,material:i,z:We.z,group:r},a.push(s))}function g(e){var t=e.geometry;return null===t.boundingSphere&&t.computeBoundingSphere(),ke.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),y(ke)}function v(e){return ke.center.set(0,0,0),ke.radius=.7071067811865476,ke.applyMatrix4(e.matrixWorld),y(ke)}function y(e){if(!ze.intersectsSphere(e))return!1;var t=Ge.numPlanes;if(0===t)return!0;var i=le.clippingPlanes,n=e.center,r=-e.radius,a=0;do if(i[a].distanceToPoint(n)<r)return!1;while(++a!==t);return!0}function x(e,t){if(e.visible!==!1){var i=0!==(e.layers.mask&t.layers.mask);if(i)if(e.isLight)$.push(e);else if(e.isSprite)(e.frustumCulled===!1||v(e)===!0)&&ce.push(e);else if(e.isLensFlare)he.push(e);else if(e.isImmediateRenderObject)le.sortObjects===!0&&(We.setFromMatrixPosition(e.matrixWorld),We.applyMatrix4(je)),m(e,null,e.material,We.z,null);else if((e.isMesh||e.isLine||e.isPoints)&&(e.isSkinnedMesh&&e.skeleton.update(),e.frustumCulled===!1||g(e)===!0)){var n=e.material;if(n.visible===!0){le.sortObjects===!0&&(We.setFromMatrixPosition(e.matrixWorld),We.applyMatrix4(je));var r=pt.update(e);if(n.isMultiMaterial)for(var a=r.groups,o=n.materials,s=0,c=a.length;c>s;s++){var h=a[s],l=o[h.materialIndex];l.visible===!0&&m(e,r,l,We.z,h)}else m(e,r,n,We.z,null)}}for(var u=e.children,s=0,c=u.length;c>s;s++)x(u[s],t)}}function _(e,t,i,n){for(var r=0,a=e.length;a>r;r++){var o=e[r],s=o.object,c=o.geometry,h=void 0===n?o.material:n,l=o.group;if(s.modelViewMatrix.multiplyMatrices(i.matrixWorldInverse,s.matrixWorld),s.normalMatrix.getNormalMatrix(s.modelViewMatrix),s.onBeforeRender(le,t,i,c,h,l),s.isImmediateRenderObject){w(h);var u=M(i,t.fog,h,s);ge="",s.render(function(e){le.renderBufferImmediate(e,u,h)})}else le.renderBufferDirect(i,t.fog,c,h,s,l);s.onAfterRender(le,t,i,c,h,l)}}function b(e,t,i){var n=lt.get(e),r=dt.getParameters(e,Ye,t,Ge.numPlanes,Ge.numIntersection,i),a=dt.getProgramCode(e,r),s=n.program,c=!0;if(void 0===s)e.addEventListener("dispose",o);else if(s.code!==a)l(e);else{if(void 0!==r.shaderID)return;c=!1}if(c){if(r.shaderID){var h=wh[r.shaderID];n.__webglShader={name:e.type,uniforms:ys.clone(h.uniforms),vertexShader:h.vertexShader,fragmentShader:h.fragmentShader}}else n.__webglShader={name:e.type,uniforms:e.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader};e.__webglShader=n.__webglShader,s=dt.acquireProgram(e,r,a),n.program=s,e.program=s}var u=s.getAttributes();if(e.morphTargets){e.numSupportedMorphTargets=0;for(var p=0;p<le.maxMorphTargets;p++)u["morphTarget"+p]>=0&&e.numSupportedMorphTargets++}if(e.morphNormals){e.numSupportedMorphNormals=0;for(var p=0;p<le.maxMorphNormals;p++)u["morphNormal"+p]>=0&&e.numSupportedMorphNormals++}var d=n.__webglShader.uniforms;(!e.isShaderMaterial&&!e.isRawShaderMaterial||e.clipping===!0)&&(n.numClippingPlanes=Ge.numPlanes,n.numIntersection=Ge.numIntersection,d.clippingPlanes=Ge.uniform),n.fog=t,n.lightsHash=Ye.hash,e.lights&&(d.ambientLightColor.value=Ye.ambient,d.directionalLights.value=Ye.directional,d.spotLights.value=Ye.spot,d.rectAreaLights.value=Ye.rectArea,d.pointLights.value=Ye.point,d.hemisphereLights.value=Ye.hemi,d.directionalShadowMap.value=Ye.directionalShadowMap,d.directionalShadowMatrix.value=Ye.directionalShadowMatrix,d.spotShadowMap.value=Ye.spotShadowMap,d.spotShadowMatrix.value=Ye.spotShadowMatrix,d.pointShadowMap.value=Ye.pointShadowMap,d.pointShadowMatrix.value=Ye.pointShadowMatrix);var f=n.program.getUniforms(),m=j.seqWithValue(f.seq,d);n.uniformsList=m}function w(e){e.side===oa?ht.disable(Je.CULL_FACE):ht.enable(Je.CULL_FACE),ht.setFlipSided(e.side===aa),e.transparent===!0?ht.setBlending(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha,e.premultipliedAlpha):ht.setBlending(pa),ht.setDepthFunc(e.depthFunc),ht.setDepthTest(e.depthTest),ht.setDepthWrite(e.depthWrite),ht.setColorWrite(e.colorWrite),ht.setPolygonOffset(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits)}function M(e,t,i,n){be=0;var r=lt.get(i);if(He&&(Ve||e!==ve)){var a=e===ve&&i.id===me;Ge.setState(i.clippingPlanes,i.clipIntersection,i.clipShadows,e,r,a)}i.needsUpdate===!1&&(void 0===r.program?i.needsUpdate=!0:i.fog&&r.fog!==t?i.needsUpdate=!0:i.lights&&r.lightsHash!==Ye.hash?i.needsUpdate=!0:void 0===r.numClippingPlanes||r.numClippingPlanes===Ge.numPlanes&&r.numIntersection===Ge.numIntersection||(i.needsUpdate=!0)),i.needsUpdate&&(b(i,t,n),i.needsUpdate=!1);var o=!1,s=!1,c=!1,h=r.program,l=h.getUniforms(),u=r.__webglShader.uniforms;if(h.id!==ue&&(Je.useProgram(h.program),ue=h.id,o=!0,s=!0,c=!0),i.id!==me&&(me=i.id,s=!0),o||e!==ve){if(l.set(Je,e,"projectionMatrix"),ct.logarithmicDepthBuffer&&l.setValue(Je,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),e!==ve&&(ve=e,s=!0,c=!0),i.isShaderMaterial||i.isMeshPhongMaterial||i.isMeshStandardMaterial||i.envMap){var p=l.map.cameraPosition;void 0!==p&&p.setValue(Je,We.setFromMatrixPosition(e.matrixWorld))}(i.isMeshPhongMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial||i.skinning)&&l.setValue(Je,"viewMatrix",e.matrixWorldInverse),l.set(Je,le,"toneMappingExposure"),l.set(Je,le,"toneMappingWhitePoint")}if(i.skinning){l.setOptional(Je,n,"bindMatrix"),l.setOptional(Je,n,"bindMatrixInverse");var d=n.skeleton;d&&(ct.floatVertexTextures&&d.useVertexTexture?(l.set(Je,d,"boneTexture"),l.set(Je,d,"boneTextureWidth"),l.set(Je,d,"boneTextureHeight")):l.setOptional(Je,d,"boneMatrices"))}return s&&(i.lights&&D(u,c),t&&i.fog&&L(u,t),(i.isMeshBasicMaterial||i.isMeshLambertMaterial||i.isMeshPhongMaterial||i.isMeshStandardMaterial||i.isMeshNormalMaterial||i.isMeshDepthMaterial)&&E(u,i),i.isLineBasicMaterial?T(u,i):i.isLineDashedMaterial?(T(u,i),S(u,i)):i.isPointsMaterial?A(u,i):i.isMeshLambertMaterial?R(u,i):i.isMeshToonMaterial?C(u,i):i.isMeshPhongMaterial?P(u,i):i.isMeshPhysicalMaterial?U(u,i):i.isMeshStandardMaterial?I(u,i):i.isMeshDepthMaterial?i.displacementMap&&(u.displacementMap.value=i.displacementMap,u.displacementScale.value=i.displacementScale,u.displacementBias.value=i.displacementBias):i.isMeshNormalMaterial&&N(u,i),void 0!==u.ltcMat&&(u.ltcMat.value=THREE.UniformsLib.LTC_MAT_TEXTURE),void 0!==u.ltcMag&&(u.ltcMag.value=THREE.UniformsLib.LTC_MAG_TEXTURE),j.upload(Je,r.uniformsList,u,le)),l.set(Je,n,"modelViewMatrix"),l.set(Je,n,"normalMatrix"),l.setValue(Je,"modelMatrix",n.matrixWorld),h}function E(e,t){e.opacity.value=t.opacity,e.diffuse.value=t.color,t.emissive&&e.emissive.value.copy(t.emissive).multiplyScalar(t.emissiveIntensity),e.map.value=t.map,e.specularMap.value=t.specularMap,e.alphaMap.value=t.alphaMap,t.lightMap&&(e.lightMap.value=t.lightMap,e.lightMapIntensity.value=t.lightMapIntensity),t.aoMap&&(e.aoMap.value=t.aoMap,e.aoMapIntensity.value=t.aoMapIntensity);var i;if(t.map?i=t.map:t.specularMap?i=t.specularMap:t.displacementMap?i=t.displacementMap:t.normalMap?i=t.normalMap:t.bumpMap?i=t.bumpMap:t.roughnessMap?i=t.roughnessMap:t.metalnessMap?i=t.metalnessMap:t.alphaMap?i=t.alphaMap:t.emissiveMap&&(i=t.emissiveMap),void 0!==i){i.isWebGLRenderTarget&&(i=i.texture);var n=i.offset,r=i.repeat;e.offsetRepeat.value.set(n.x,n.y,r.x,r.y)}e.envMap.value=t.envMap,e.flipEnvMap.value=t.envMap&&t.envMap.isCubeTexture?-1:1,e.reflectivity.value=t.reflectivity,e.refractionRatio.value=t.refractionRatio}function T(e,t){e.diffuse.value=t.color,e.opacity.value=t.opacity}function S(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}function A(e,t){if(e.diffuse.value=t.color,e.opacity.value=t.opacity,e.size.value=t.size*Se,e.scale.value=.5*Te,e.map.value=t.map,null!==t.map){var i=t.map.offset,n=t.map.repeat;e.offsetRepeat.value.set(i.x,i.y,n.x,n.y)}}function L(e,t){e.fogColor.value=t.color,t.isFog?(e.fogNear.value=t.near,e.fogFar.value=t.far):t.isFogExp2&&(e.fogDensity.value=t.density)}function R(e,t){t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap)}function P(e,t){e.specular.value=t.specular,e.shininess.value=Math.max(t.shininess,1e-4),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale)),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}function C(e,t){P(e,t),t.gradientMap&&(e.gradientMap.value=t.gradientMap)}function I(e,t){e.roughness.value=t.roughness,e.metalness.value=t.metalness,t.roughnessMap&&(e.roughnessMap.value=t.roughnessMap),t.metalnessMap&&(e.metalnessMap.value=t.metalnessMap),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale)),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias),t.envMap&&(e.envMapIntensity.value=t.envMapIntensity)}function U(e,t){e.clearCoat.value=t.clearCoat,e.clearCoatRoughness.value=t.clearCoatRoughness,I(e,t)}function N(e,t){t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale)),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}function D(e,t){e.ambientLightColor.needsUpdate=t,e.directionalLights.needsUpdate=t,e.pointLights.needsUpdate=t,e.spotLights.needsUpdate=t,e.rectAreaLights.needsUpdate=t,e.hemisphereLights.needsUpdate=t}function O(e){for(var t=0,i=0,n=e.length;n>i;i++){var r=e[i];r.castShadow&&(Ye.shadows[t++]=r)}Ye.shadows.length=t}function B(e,t){var i,n,r,a,o,s,c,l=0,u=0,p=0,d=t.matrixWorldInverse,f=0,m=0,g=0,v=0,y=0;for(i=0,n=e.length;n>i;i++)if(r=e[i],a=r.color,o=r.intensity,s=r.distance,c=r.shadow&&r.shadow.map?r.shadow.map.texture:null,r.isAmbientLight)l+=a.r*o,u+=a.g*o,p+=a.b*o;else if(r.isDirectionalLight){var x=ft.get(r);x.color.copy(r.color).multiplyScalar(r.intensity),x.direction.setFromMatrixPosition(r.matrixWorld),We.setFromMatrixPosition(r.target.matrixWorld),x.direction.sub(We),x.direction.transformDirection(d),x.shadow=r.castShadow,r.castShadow&&(x.shadowBias=r.shadow.bias,x.shadowRadius=r.shadow.radius,x.shadowMapSize=r.shadow.mapSize),Ye.directionalShadowMap[f]=c,Ye.directionalShadowMatrix[f]=r.shadow.matrix,Ye.directional[f++]=x}else if(r.isSpotLight){var x=ft.get(r);x.position.setFromMatrixPosition(r.matrixWorld),x.position.applyMatrix4(d),x.color.copy(a).multiplyScalar(o),x.distance=s,x.direction.setFromMatrixPosition(r.matrixWorld),We.setFromMatrixPosition(r.target.matrixWorld),x.direction.sub(We),x.direction.transformDirection(d),x.coneCos=Math.cos(r.angle),x.penumbraCos=Math.cos(r.angle*(1-r.penumbra)),x.decay=0===r.distance?0:r.decay,x.shadow=r.castShadow,r.castShadow&&(x.shadowBias=r.shadow.bias,x.shadowRadius=r.shadow.radius,x.shadowMapSize=r.shadow.mapSize),Ye.spotShadowMap[g]=c,Ye.spotShadowMatrix[g]=r.shadow.matrix,Ye.spot[g++]=x}else if(r.isRectAreaLight){var x=ft.get(r);x.color.copy(a).multiplyScalar(o/(r.width*r.height)),x.position.setFromMatrixPosition(r.matrixWorld),x.position.applyMatrix4(d),qe.identity(),Xe.copy(r.matrixWorld),Xe.premultiply(d),qe.extractRotation(Xe),x.halfWidth.set(.5*r.width,0,0),x.halfHeight.set(0,.5*r.height,0),x.halfWidth.applyMatrix4(qe),x.halfHeight.applyMatrix4(qe),Ye.rectArea[v++]=x}else if(r.isPointLight){var x=ft.get(r);x.position.setFromMatrixPosition(r.matrixWorld),x.position.applyMatrix4(d),x.color.copy(r.color).multiplyScalar(r.intensity),x.distance=r.distance,x.decay=0===r.distance?0:r.decay,x.shadow=r.castShadow,r.castShadow&&(x.shadowBias=r.shadow.bias,x.shadowRadius=r.shadow.radius,x.shadowMapSize=r.shadow.mapSize),Ye.pointShadowMap[m]=c,void 0===Ye.pointShadowMatrix[m]&&(Ye.pointShadowMatrix[m]=new h),We.setFromMatrixPosition(r.matrixWorld).negate(),Ye.pointShadowMatrix[m].identity().setPosition(We),Ye.point[m++]=x}else if(r.isHemisphereLight){var x=ft.get(r);x.direction.setFromMatrixPosition(r.matrixWorld),x.direction.transformDirection(d),x.direction.normalize(),x.skyColor.copy(r.color).multiplyScalar(o),x.groundColor.copy(r.groundColor).multiplyScalar(o),Ye.hemi[y++]=x}Ye.ambient[0]=l,Ye.ambient[1]=u,Ye.ambient[2]=p,Ye.directional.length=f,Ye.spot.length=g,Ye.rectArea.length=v,Ye.point.length=m,Ye.hemi.length=y,Ye.hash=f+","+m+","+g+","+v+","+y+","+Ye.shadows.length}function F(){var e=be;return e>=ct.maxTextures&&console.warn("WebGLRenderer: trying to use "+e+" texture units while this GPU supports only "+ct.maxTextures),be+=1,e}function z(e){var t;if(e===ro)return Je.REPEAT;if(e===ao)return Je.CLAMP_TO_EDGE;if(e===oo)return Je.MIRRORED_REPEAT;if(e===so)return Je.NEAREST;if(e===co)return Je.NEAREST_MIPMAP_NEAREST;if(e===ho)return Je.NEAREST_MIPMAP_LINEAR;if(e===lo)return Je.LINEAR;if(e===uo)return Je.LINEAR_MIPMAP_NEAREST;if(e===po)return Je.LINEAR_MIPMAP_LINEAR;if(e===fo)return Je.UNSIGNED_BYTE;if(e===wo)return Je.UNSIGNED_SHORT_4_4_4_4;if(e===Mo)return Je.UNSIGNED_SHORT_5_5_5_1;if(e===Eo)return Je.UNSIGNED_SHORT_5_6_5;if(e===mo)return Je.BYTE;if(e===go)return Je.SHORT;if(e===vo)return Je.UNSIGNED_SHORT;if(e===yo)return Je.INT;if(e===xo)return Je.UNSIGNED_INT;if(e===_o)return Je.FLOAT;if(e===bo&&(t=et.get("OES_texture_half_float"),null!==t))return t.HALF_FLOAT_OES;if(e===So)return Je.ALPHA;if(e===Ao)return Je.RGB;if(e===Lo)return Je.RGBA;if(e===Ro)return Je.LUMINANCE;if(e===Po)return Je.LUMINANCE_ALPHA;if(e===Io)return Je.DEPTH_COMPONENT;if(e===Uo)return Je.DEPTH_STENCIL;if(e===ya)return Je.FUNC_ADD;if(e===xa)return Je.FUNC_SUBTRACT;if(e===_a)return Je.FUNC_REVERSE_SUBTRACT;if(e===Ma)return Je.ZERO;if(e===Ea)return Je.ONE;if(e===Ta)return Je.SRC_COLOR;if(e===Sa)return Je.ONE_MINUS_SRC_COLOR;if(e===Aa)return Je.SRC_ALPHA;if(e===La)return Je.ONE_MINUS_SRC_ALPHA;if(e===Ra)return Je.DST_ALPHA;if(e===Pa)return Je.ONE_MINUS_DST_ALPHA;if(e===Ca)return Je.DST_COLOR;if(e===Ia)return Je.ONE_MINUS_DST_COLOR;if(e===Ua)return Je.SRC_ALPHA_SATURATE;if((e===No||e===Do||e===Oo||e===Bo)&&(t=et.get("WEBGL_compressed_texture_s3tc"),null!==t)){if(e===No)return t.COMPRESSED_RGB_S3TC_DXT1_EXT;if(e===Do)return t.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(e===Oo)return t.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(e===Bo)return t.COMPRESSED_RGBA_S3TC_DXT5_EXT}if((e===Fo||e===zo||e===Go||e===Ho)&&(t=et.get("WEBGL_compressed_texture_pvrtc"),null!==t)){if(e===Fo)return t.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(e===zo)return t.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(e===Go)return t.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(e===Ho)return t.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(e===Vo&&(t=et.get("WEBGL_compressed_texture_etc1"),null!==t))return t.COMPRESSED_RGB_ETC1_WEBGL;if((e===ba||e===wa)&&(t=et.get("EXT_blend_minmax"),null!==t)){if(e===ba)return t.MIN_EXT;if(e===wa)return t.MAX_EXT}return e===To&&(t=et.get("WEBGL_depth_texture"),null!==t)?t.UNSIGNED_INT_24_8_WEBGL:0}console.log("THREE.WebGLRenderer",qr),e=e||{};var G=void 0!==e.canvas?e.canvas:document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),H=void 0!==e.context?e.context:null,V=void 0!==e.alpha?e.alpha:!1,k=void 0!==e.depth?e.depth:!0,X=void 0!==e.stencil?e.stencil:!0,q=void 0!==e.antialias?e.antialias:!1,J=void 0!==e.premultipliedAlpha?e.premultipliedAlpha:!0,K=void 0!==e.preserveDrawingBuffer?e.preserveDrawingBuffer:!1,$=[],te=[],ie=-1,ae=[],oe=-1,se=new Float32Array(8),ce=[],he=[];this.domElement=G,this.context=null,this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.gammaFactor=2,this.gammaInput=!1,this.gammaOutput=!1,this.physicallyCorrectLights=!1,this.toneMapping=Xa,this.toneMappingExposure=1,this.toneMappingWhitePoint=1,this.maxMorphTargets=8,this.maxMorphNormals=4;var le=this,ue=null,de=null,fe=null,me=-1,ge="",ve=null,ye=new r,xe=null,_e=new r,be=0,we=new W(0),Me=0,Ee=G.width,Te=G.height,Se=1,Re=new r(0,0,Ee,Te),Ce=!1,Ue=new r(0,0,Ee,Te),ze=new ne,Ge=new st,He=!1,Ve=!1,ke=new ee,je=new h,We=new c,Xe=new h,qe=new h,Ye={hash:"",ambient:[0,0,0],directional:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],point:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],shadows:[]},Ze={calls:0,vertices:0,faces:0,points:0};this.info={render:Ze,memory:{geometries:0,textures:0},programs:null};var Je;try{var Qe={alpha:V,depth:k,stencil:X,antialias:q,premultipliedAlpha:J,preserveDrawingBuffer:K};if(Je=H||G.getContext("webgl",Qe)||G.getContext("experimental-webgl",Qe),null===Je)throw null!==G.getContext("webgl")?"Error creating WebGL context with your selected attributes.":"Error creating WebGL context.";void 0===Je.getShaderPrecisionFormat&&(Je.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}}),G.addEventListener("webglcontextlost",a,!1)}catch(Ke){console.error("THREE.WebGLRenderer: "+Ke)}var et=new ot(Je);et.get("WEBGL_depth_texture"),et.get("OES_texture_float"),et.get("OES_texture_float_linear"),et.get("OES_texture_half_float"),et.get("OES_texture_half_float_linear"),et.get("OES_standard_derivatives"),et.get("ANGLE_instanced_arrays"),et.get("OES_element_index_uint")&&(Ae.MaxIndex=4294967296);var ct=new at(Je,et,e),ht=new rt(Je,et,z),lt=new nt,ut=new it(Je,et,ht,lt,ct,z,this.info),pt=new tt(Je,lt,this.info),dt=new $e(this,ct),ft=new Fe;this.info.programs=dt.programs;var mt,gt,vt,yt,xt=new Be(Je,et,Ze),_t=new Oe(Je,et,Ze);i(),this.context=Je,this.capabilities=ct,this.extensions=et,this.properties=lt,this.state=ht;var bt=new re(this,Ye,pt,ct);this.shadowMap=bt;var wt=new Z(this,ce),Mt=new Y(this,he);this.getContext=function(){return Je},this.getContextAttributes=function(){return Je.getContextAttributes()},this.forceContextLoss=function(){et.get("WEBGL_lose_context").loseContext()},this.getMaxAnisotropy=function(){return ct.getMaxAnisotropy()},this.getPrecision=function(){return ct.precision},this.getPixelRatio=function(){return Se},this.setPixelRatio=function(e){void 0!==e&&(Se=e,this.setSize(Ue.z,Ue.w,!1))},this.getSize=function(){return{width:Ee,height:Te}},this.setSize=function(e,t,i){Ee=e,Te=t,G.width=e*Se,G.height=t*Se,i!==!1&&(G.style.width=e+"px",G.style.height=t+"px"),this.setViewport(0,0,e,t)},this.setViewport=function(e,t,i,n){ht.viewport(Ue.set(e,t,i,n))},this.setScissor=function(e,t,i,n){ht.scissor(Re.set(e,t,i,n))},this.setScissorTest=function(e){ht.setScissorTest(Ce=e)},this.getClearColor=function(){return we},this.setClearColor=function(e,t){we.set(e),Me=void 0!==t?t:1,ht.buffers.color.setClear(we.r,we.g,we.b,Me,J)},this.getClearAlpha=function(){return Me},this.setClearAlpha=function(e){Me=e,ht.buffers.color.setClear(we.r,we.g,we.b,Me,J)},this.clear=function(e,t,i){var n=0;(void 0===e||e)&&(n|=Je.COLOR_BUFFER_BIT),(void 0===t||t)&&(n|=Je.DEPTH_BUFFER_BIT),(void 0===i||i)&&(n|=Je.STENCIL_BUFFER_BIT),Je.clear(n)},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.clearTarget=function(e,t,i,n){this.setRenderTarget(e),this.clear(t,i,n)},this.resetGLState=n,this.dispose=function(){ae=[],oe=-1,te=[],ie=-1,G.removeEventListener("webglcontextlost",a,!1)},this.renderBufferImmediate=function(e,t,i){ht.initAttributes();var n=lt.get(e);e.hasPositions&&!n.position&&(n.position=Je.createBuffer()),e.hasNormals&&!n.normal&&(n.normal=Je.createBuffer()),e.hasUvs&&!n.uv&&(n.uv=Je.createBuffer()),e.hasColors&&!n.color&&(n.color=Je.createBuffer());var r=t.getAttributes();if(e.hasPositions&&(Je.bindBuffer(Je.ARRAY_BUFFER,n.position),Je.bufferData(Je.ARRAY_BUFFER,e.positionArray,Je.DYNAMIC_DRAW),ht.enableAttribute(r.position),Je.vertexAttribPointer(r.position,3,Je.FLOAT,!1,0,0)),e.hasNormals){if(Je.bindBuffer(Je.ARRAY_BUFFER,n.normal),!i.isMeshPhongMaterial&&!i.isMeshStandardMaterial&&!i.isMeshNormalMaterial&&i.shading===sa)for(var a=0,o=3*e.count;o>a;a+=9){var s=e.normalArray,c=(s[a+0]+s[a+3]+s[a+6])/3,h=(s[a+1]+s[a+4]+s[a+7])/3,l=(s[a+2]+s[a+5]+s[a+8])/3;s[a+0]=c,s[a+1]=h,s[a+2]=l,s[a+3]=c,s[a+4]=h,s[a+5]=l,s[a+6]=c,s[a+7]=h,s[a+8]=l}Je.bufferData(Je.ARRAY_BUFFER,e.normalArray,Je.DYNAMIC_DRAW),ht.enableAttribute(r.normal),Je.vertexAttribPointer(r.normal,3,Je.FLOAT,!1,0,0)}e.hasUvs&&i.map&&(Je.bindBuffer(Je.ARRAY_BUFFER,n.uv),Je.bufferData(Je.ARRAY_BUFFER,e.uvArray,Je.DYNAMIC_DRAW),ht.enableAttribute(r.uv),Je.vertexAttribPointer(r.uv,2,Je.FLOAT,!1,0,0)),e.hasColors&&i.vertexColors!==ha&&(Je.bindBuffer(Je.ARRAY_BUFFER,n.color),Je.bufferData(Je.ARRAY_BUFFER,e.colorArray,Je.DYNAMIC_DRAW),ht.enableAttribute(r.color),Je.vertexAttribPointer(r.color,3,Je.FLOAT,!1,0,0)),ht.disableUnusedAttributes(),Je.drawArrays(Je.TRIANGLES,0,e.count),e.count=0},this.renderBufferDirect=function(e,i,n,r,a,o){w(r);var s=M(e,i,r,a),c=!1,h=n.id+"_"+s.id+"_"+r.wireframe;h!==ge&&(ge=h,c=!0);var l=a.morphTargetInfluences;if(void 0!==l){for(var d=[],f=0,m=l.length;m>f;f++){var g=l[f];d.push([g,f])}d.sort(p),d.length>8&&(d.length=8);for(var v=n.morphAttributes,f=0,m=d.length;m>f;f++){var g=d[f];if(se[f]=g[0],0!==g[0]){var y=g[1];r.morphTargets===!0&&v.position&&n.addAttribute("morphTarget"+f,v.position[y]),r.morphNormals===!0&&v.normal&&n.addAttribute("morphNormal"+f,v.normal[y])}else r.morphTargets===!0&&n.removeAttribute("morphTarget"+f),r.morphNormals===!0&&n.removeAttribute("morphNormal"+f)}for(var f=d.length,x=se.length;x>f;f++)se[f]=0;s.getUniforms().setValue(Je,"morphTargetInfluences",se),c=!0}var y=n.index,_=n.attributes.position,b=1;r.wireframe===!0&&(y=pt.getWireframeAttribute(n),b=2);var E;null!==y?(E=_t,E.setIndex(y)):E=xt,c&&(u(r,s,n),null!==y&&Je.bindBuffer(Je.ELEMENT_ARRAY_BUFFER,pt.getAttributeBuffer(y)));var T=0;null!==y?T=y.count:void 0!==_&&(T=_.count);var S=n.drawRange.start*b,A=n.drawRange.count*b,L=null!==o?o.start*b:0,R=null!==o?o.count*b:1/0,P=Math.max(S,L),C=Math.min(T,S+A,L+R)-1,I=Math.max(0,C-P+1);if(0!==I){if(a.isMesh)if(r.wireframe===!0)ht.setLineWidth(r.wireframeLinewidth*t()),E.setMode(Je.LINES);else switch(a.drawMode){case Ko:E.setMode(Je.TRIANGLES);break;case $o:E.setMode(Je.TRIANGLE_STRIP);break;case es:E.setMode(Je.TRIANGLE_FAN)}else if(a.isLine){var U=r.linewidth;void 0===U&&(U=1),ht.setLineWidth(U*t()),a.isLineSegments?E.setMode(Je.LINES):E.setMode(Je.LINE_STRIP)}else a.isPoints&&E.setMode(Je.POINTS);n&&n.isInstancedBufferGeometry?n.maxInstancedCount>0&&E.renderInstances(n,P,I):E.render(P,I)}},this.render=function(e,t,i,n){if(void 0!==t&&t.isCamera!==!0)return void console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");ge="",me=-1,ve=null,e.autoUpdate===!0&&e.updateMatrixWorld(),null===t.parent&&t.updateMatrixWorld(),t.matrixWorldInverse.getInverse(t.matrixWorld),je.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),ze.setFromMatrix(je),$.length=0,ie=-1,oe=-1,ce.length=0,he.length=0,Ve=this.localClippingEnabled,He=Ge.init(this.clippingPlanes,Ve,t),x(e,t),te.length=ie+1,ae.length=oe+1,le.sortObjects===!0&&(te.sort(d),ae.sort(f)),He&&Ge.beginShadows(),O($),bt.render(e,t),B($,t),He&&Ge.endShadows(),Ze.calls=0,Ze.vertices=0,Ze.faces=0,Ze.points=0,void 0===i&&(i=null),this.setRenderTarget(i);var r=e.background;if(null===r?ht.buffers.color.setClear(we.r,we.g,we.b,Me,J):r&&r.isColor&&(ht.buffers.color.setClear(r.r,r.g,r.b,1,J),n=!0),(this.autoClear||n)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil),r&&r.isCubeTexture?(void 0===vt&&(vt=new Ne,yt=new Le(new Pe(5,5,5),new Q({uniforms:wh.cube.uniforms,
4
+ vertexShader:wh.cube.vertexShader,fragmentShader:wh.cube.fragmentShader,side:aa,depthTest:!1,depthWrite:!1,fog:!1}))),vt.projectionMatrix.copy(t.projectionMatrix),vt.matrixWorld.extractRotation(t.matrixWorld),vt.matrixWorldInverse.getInverse(vt.matrixWorld),yt.material.uniforms.tCube.value=r,yt.modelViewMatrix.multiplyMatrices(vt.matrixWorldInverse,yt.matrixWorld),pt.update(yt),le.renderBufferDirect(vt,null,yt.geometry,yt.material,yt,null)):r&&r.isTexture&&(void 0===mt&&(mt=new De(-1,1,1,-1,0,1),gt=new Le(new Ie(2,2),new pe({depthTest:!1,depthWrite:!1,fog:!1}))),gt.material.map=r,pt.update(gt),le.renderBufferDirect(mt,null,gt.geometry,gt.material,gt,null)),e.overrideMaterial){var a=e.overrideMaterial;_(te,e,t,a),_(ae,e,t,a)}else ht.setBlending(pa),_(te,e,t),_(ae,e,t);wt.render(e,t),Mt.render(e,t,_e),i&&ut.updateRenderTargetMipmap(i),ht.setDepthTest(!0),ht.setDepthWrite(!0),ht.setColorWrite(!0)},this.setFaceCulling=function(e,t){ht.setCullFace(e),ht.setFlipSided(t===$r)},this.allocTextureUnit=F,this.setTexture2D=function(){var e=!1;return function(t,i){t&&t.isWebGLRenderTarget&&(e||(console.warn("THREE.WebGLRenderer.setTexture2D: don't use render targets as textures. Use their .texture property instead."),e=!0),t=t.texture),ut.setTexture2D(t,i)}}(),this.setTexture=function(){var e=!1;return function(t,i){e||(console.warn("THREE.WebGLRenderer: .setTexture is deprecated, use setTexture2D instead."),e=!0),ut.setTexture2D(t,i)}}(),this.setTextureCube=function(){var e=!1;return function(t,i){t&&t.isWebGLRenderTargetCube&&(e||(console.warn("THREE.WebGLRenderer.setTextureCube: don't use cube render targets as textures. Use their .texture property instead."),e=!0),t=t.texture),t&&t.isCubeTexture||Array.isArray(t.image)&&6===t.image.length?ut.setTextureCube(t,i):ut.setTextureCubeDynamic(t,i)}}(),this.getCurrentRenderTarget=function(){return de},this.setRenderTarget=function(e){de=e,e&&void 0===lt.get(e).__webglFramebuffer&&ut.setupRenderTarget(e);var t,i=e&&e.isWebGLRenderTargetCube;if(e){var n=lt.get(e);t=i?n.__webglFramebuffer[e.activeCubeFace]:n.__webglFramebuffer,ye.copy(e.scissor),xe=e.scissorTest,_e.copy(e.viewport)}else t=null,ye.copy(Re).multiplyScalar(Se),xe=Ce,_e.copy(Ue).multiplyScalar(Se);if(fe!==t&&(Je.bindFramebuffer(Je.FRAMEBUFFER,t),fe=t),ht.scissor(ye),ht.setScissorTest(xe),ht.viewport(_e),i){var r=lt.get(e.texture);Je.framebufferTexture2D(Je.FRAMEBUFFER,Je.COLOR_ATTACHMENT0,Je.TEXTURE_CUBE_MAP_POSITIVE_X+e.activeCubeFace,r.__webglTexture,e.activeMipMapLevel)}},this.readRenderTargetPixels=function(e,t,i,n,r,a){if((e&&e.isWebGLRenderTarget)===!1)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");var o=lt.get(e).__webglFramebuffer;if(o){var s=!1;o!==fe&&(Je.bindFramebuffer(Je.FRAMEBUFFER,o),s=!0);try{var c=e.texture,h=c.format,l=c.type;if(h!==Lo&&z(h)!==Je.getParameter(Je.IMPLEMENTATION_COLOR_READ_FORMAT))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!(l===fo||z(l)===Je.getParameter(Je.IMPLEMENTATION_COLOR_READ_TYPE)||l===_o&&(et.get("OES_texture_float")||et.get("WEBGL_color_buffer_float"))||l===bo&&et.get("EXT_color_buffer_half_float")))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");Je.checkFramebufferStatus(Je.FRAMEBUFFER)===Je.FRAMEBUFFER_COMPLETE?t>=0&&t<=e.width-n&&i>=0&&i<=e.height-r&&Je.readPixels(t,i,n,r,z(h),z(l),a):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{s&&Je.bindFramebuffer(Je.FRAMEBUFFER,fe)}}}}function ht(e,t){this.name="",this.color=new W(e),this.density=void 0!==t?t:25e-5}function lt(e,t,i){this.name="",this.color=new W(e),this.near=void 0!==t?t:1,this.far=void 0!==i?i:1e3}function ut(){ce.call(this),this.type="Scene",this.background=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0}function pt(e,t,i,n,r){ce.call(this),this.lensFlares=[],this.positionScreen=new c,this.customUpdateCallback=void 0,void 0!==e&&this.add(e,t,i,n,r)}function dt(e){J.call(this),this.type="SpriteMaterial",this.color=new W(16777215),this.map=null,this.rotation=0,this.fog=!1,this.lights=!1,this.setValues(e)}function ft(e){ce.call(this),this.type="Sprite",this.material=void 0!==e?e:new dt}function mt(){ce.call(this),this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}})}function gt(e,t,i){if(this.useVertexTexture=void 0!==i?i:!0,this.identityMatrix=new h,e=e||[],this.bones=e.slice(0),this.useVertexTexture){var n=Math.sqrt(4*this.bones.length);n=us.nextPowerOfTwo(Math.ceil(n)),n=Math.max(n,4),this.boneTextureWidth=n,this.boneTextureHeight=n,this.boneMatrices=new Float32Array(this.boneTextureWidth*this.boneTextureHeight*4),this.boneTexture=new X(this.boneMatrices,this.boneTextureWidth,this.boneTextureHeight,Lo,_o)}else this.boneMatrices=new Float32Array(16*this.bones.length);if(void 0===t)this.calculateInverses();else if(this.bones.length===t.length)this.boneInverses=t.slice(0);else{console.warn("THREE.Skeleton bonInverses is the wrong length."),this.boneInverses=[];for(var r=0,a=this.bones.length;a>r;r++)this.boneInverses.push(new h)}}function vt(){ce.call(this),this.type="Bone"}function yt(e,t,i){Le.call(this,e,t),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new h,this.bindMatrixInverse=new h;var n=[];if(this.geometry&&void 0!==this.geometry.bones){for(var r,a,o=0,s=this.geometry.bones.length;s>o;++o)a=this.geometry.bones[o],r=new vt,n.push(r),r.name=a.name,r.position.fromArray(a.pos),r.quaternion.fromArray(a.rotq),void 0!==a.scl&&r.scale.fromArray(a.scl);for(var o=0,s=this.geometry.bones.length;s>o;++o)a=this.geometry.bones[o],-1!==a.parent&&null!==a.parent&&void 0!==n[a.parent]?n[a.parent].add(n[o]):this.add(n[o])}this.normalizeSkinWeights(),this.updateMatrixWorld(!0),this.bind(new gt(n,void 0,i),this.matrixWorld)}function xt(e){J.call(this),this.type="LineBasicMaterial",this.color=new W(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.lights=!1,this.setValues(e)}function _t(e,t,i){return 1===i?(console.warn("THREE.Line: parameter THREE.LinePieces no longer supported. Created THREE.LineSegments instead."),new bt(e,t)):(ce.call(this),this.type="Line",this.geometry=void 0!==e?e:new Ae,void(this.material=void 0!==t?t:new xt({color:16777215*Math.random()})))}function bt(e,t){_t.call(this,e,t),this.type="LineSegments"}function wt(e){J.call(this),this.type="PointsMaterial",this.color=new W(16777215),this.map=null,this.size=1,this.sizeAttenuation=!0,this.lights=!1,this.setValues(e)}function Mt(e,t){ce.call(this),this.type="Points",this.geometry=void 0!==e?e:new Ae,this.material=void 0!==t?t:new wt({color:16777215*Math.random()})}function Et(){ce.call(this),this.type="Group"}function Tt(e,t,i,r,a,o,s,c,h){function l(){requestAnimationFrame(l),e.readyState>=e.HAVE_CURRENT_DATA&&(u.needsUpdate=!0)}n.call(this,e,t,i,r,a,o,s,c,h),this.generateMipmaps=!1;var u=this;l()}function St(e,t,i,r,a,o,s,c,h,l,u,p){n.call(this,null,o,s,c,h,l,r,a,u,p),this.image={width:t,height:i},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}function At(e,t,i,r,a,o,s,c,h){n.call(this,e,t,i,r,a,o,s,c,h),this.needsUpdate=!0}function Lt(e,t,i,r,a,o,s,c,h,l){if(l=void 0!==l?l:Io,l!==Io&&l!==Uo)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===i&&l===Io&&(i=vo),void 0===i&&l===Uo&&(i=To),n.call(this,null,r,a,o,s,c,l,i,h),this.image={width:e,height:t},this.magFilter=void 0!==s?s:so,this.minFilter=void 0!==c?c:so,this.flipY=!1,this.generateMipmaps=!1}function Rt(e){function t(e,t){return e-t}Ae.call(this),this.type="WireframeGeometry";var i,n,r,a,o,s,h,l,u=[],p=[0,0],d={},f=["a","b","c"];if(e&&e.isGeometry){var m=e.faces;for(i=0,r=m.length;r>i;i++){var g=m[i];for(n=0;3>n;n++)p[0]=g[f[n]],p[1]=g[f[(n+1)%3]],p.sort(t),h=p.toString(),void 0===d[h]&&(d[h]={index1:p[0],index2:p[1]})}for(h in d)s=d[h],l=e.vertices[s.index1],u.push(l.x,l.y,l.z),l=e.vertices[s.index2],u.push(l.x,l.y,l.z)}else if(e&&e.isBufferGeometry){var v,y,x,_,b,w,M,E;if(l=new c,null!==e.index){for(v=e.attributes.position,y=e.index,x=e.groups,0===x.length&&e.addGroup(0,y.count),a=0,o=x.length;o>a;++a)for(_=x[a],b=_.start,w=_.count,i=b,r=b+w;r>i;i+=3)for(n=0;3>n;n++)p[0]=y.getX(i+n),p[1]=y.getX(i+(n+1)%3),p.sort(t),h=p.toString(),void 0===d[h]&&(d[h]={index1:p[0],index2:p[1]});for(h in d)s=d[h],l.fromBufferAttribute(v,s.index1),u.push(l.x,l.y,l.z),l.fromBufferAttribute(v,s.index2),u.push(l.x,l.y,l.z)}else for(v=e.attributes.position,i=0,r=v.count/3;r>i;i++)for(n=0;3>n;n++)M=3*i+n,l.fromBufferAttribute(v,M),u.push(l.x,l.y,l.z),E=3*i+(n+1)%3,l.fromBufferAttribute(v,E),u.push(l.x,l.y,l.z)}this.addAttribute("position",new be(u,3))}function Pt(e,t,i){Se.call(this),this.type="ParametricGeometry",this.parameters={func:e,slices:t,stacks:i},this.fromBufferGeometry(new Ct(e,t,i)),this.mergeVertices()}function Ct(e,t,i){Ae.call(this),this.type="ParametricBufferGeometry",this.parameters={func:e,slices:t,stacks:i};var n,r,a=[],o=[],s=[],c=t+1;for(n=0;i>=n;n++){var h=n/i;for(r=0;t>=r;r++){var l=r/t,u=e(l,h);o.push(u.x,u.y,u.z),s.push(l,h)}}for(n=0;i>n;n++)for(r=0;t>r;r++){var p=n*c+r,d=n*c+r+1,f=(n+1)*c+r+1,m=(n+1)*c+r;a.push(p,d,m),a.push(d,f,m)}this.setIndex(a),this.addAttribute("position",new be(o,3)),this.addAttribute("uv",new be(s,2)),this.computeVertexNormals()}function It(e,t,i,n){Se.call(this),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:i,detail:n},this.fromBufferGeometry(new Ut(e,t,i,n)),this.mergeVertices()}function Ut(e,t,n,r){function a(e){for(var i=new c,n=new c,r=new c,a=0;a<t.length;a+=3)p(t[a+0],i),p(t[a+1],n),p(t[a+2],r),o(i,n,r,e)}function o(e,t,i,n){var r,a,o=Math.pow(2,n),s=[];for(r=0;o>=r;r++){s[r]=[];var c=e.clone().lerp(i,r/o),h=t.clone().lerp(i,r/o),l=o-r;for(a=0;l>=a;a++)0===a&&r===o?s[r][a]=c:s[r][a]=c.clone().lerp(h,a/l)}for(r=0;o>r;r++)for(a=0;2*(o-r)-1>a;a++){var p=Math.floor(a/2);a%2===0?(u(s[r][p+1]),u(s[r+1][p]),u(s[r][p])):(u(s[r][p+1]),u(s[r+1][p+1]),u(s[r+1][p]))}}function s(e){for(var t=new c,i=0;i<v.length;i+=3)t.x=v[i+0],t.y=v[i+1],t.z=v[i+2],t.normalize().multiplyScalar(e),v[i+0]=t.x,v[i+1]=t.y,v[i+2]=t.z}function h(){for(var e=new c,t=0;t<v.length;t+=3){e.x=v[t+0],e.y=v[t+1],e.z=v[t+2];var i=m(e)/2/Math.PI+.5,n=g(e)/Math.PI+.5;y.push(i,1-n)}d(),l()}function l(){for(var e=0;e<y.length;e+=6){var t=y[e+0],i=y[e+2],n=y[e+4],r=Math.max(t,i,n),a=Math.min(t,i,n);r>.9&&.1>a&&(.2>t&&(y[e+0]+=1),.2>i&&(y[e+2]+=1),.2>n&&(y[e+4]+=1))}}function u(e){v.push(e.x,e.y,e.z)}function p(t,i){var n=3*t;i.x=e[n+0],i.y=e[n+1],i.z=e[n+2]}function d(){for(var e=new c,t=new c,n=new c,r=new c,a=new i,o=new i,s=new i,h=0,l=0;h<v.length;h+=9,l+=6){e.set(v[h+0],v[h+1],v[h+2]),t.set(v[h+3],v[h+4],v[h+5]),n.set(v[h+6],v[h+7],v[h+8]),a.set(y[l+0],y[l+1]),o.set(y[l+2],y[l+3]),s.set(y[l+4],y[l+5]),r.copy(e).add(t).add(n).divideScalar(3);var u=m(r);f(a,l+0,e,u),f(o,l+2,t,u),f(s,l+4,n,u)}}function f(e,t,i,n){0>n&&1===e.x&&(y[t]=e.x-1),0===i.x&&0===i.z&&(y[t]=n/2/Math.PI+.5)}function m(e){return Math.atan2(e.z,-e.x)}function g(e){return Math.atan2(-e.y,Math.sqrt(e.x*e.x+e.z*e.z))}Ae.call(this),this.type="PolyhedronBufferGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:r},n=n||1,r=r||0;var v=[],y=[];a(r),s(n),h(),this.addAttribute("position",new be(v,3)),this.addAttribute("normal",new be(v.slice(),3)),this.addAttribute("uv",new be(y,2)),this.normalizeNormals()}function Nt(e,t){Se.call(this),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new Dt(e,t)),this.mergeVertices()}function Dt(e,t){var i=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],n=[2,1,0,0,3,2,1,3,0,2,3,1];Ut.call(this,i,n,e,t),this.type="TetrahedronBufferGeometry",this.parameters={radius:e,detail:t}}function Ot(e,t){Se.call(this),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new Bt(e,t)),this.mergeVertices()}function Bt(e,t){var i=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],n=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];Ut.call(this,i,n,e,t),this.type="OctahedronBufferGeometry",this.parameters={radius:e,detail:t}}function Ft(e,t){Se.call(this),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new zt(e,t)),this.mergeVertices()}function zt(e,t){var i=(1+Math.sqrt(5))/2,n=[-1,i,0,1,i,0,-1,-i,0,1,-i,0,0,-1,i,0,1,i,0,-1,-i,0,1,-i,i,0,-1,i,0,1,-i,0,-1,-i,0,1],r=[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];Ut.call(this,n,r,e,t),this.type="IcosahedronBufferGeometry",this.parameters={radius:e,detail:t}}function Gt(e,t){Se.call(this),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new Ht(e,t)),this.mergeVertices()}function Ht(e,t){var i=(1+Math.sqrt(5))/2,n=1/i,r=[-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,-n,-i,0,-n,i,0,n,-i,0,n,i,-n,-i,0,-n,i,0,n,-i,0,n,i,0,-i,0,-n,i,0,-n,-i,0,n,i,0,n],a=[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];Ut.call(this,r,a,e,t),this.type="DodecahedronBufferGeometry",this.parameters={radius:e,detail:t}}function Vt(e,t,i,n,r,a){Se.call(this),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:i,radialSegments:n,closed:r},void 0!==a&&console.warn("THREE.TubeGeometry: taper has been removed.");var o=new kt(e,t,i,n,r);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals,this.fromBufferGeometry(o),this.mergeVertices()}function kt(e,t,n,r,a){function o(){for(p=0;t>p;p++)s(p);s(a===!1?t:0),l(),h()}function s(i){var a=e.getPointAt(i/t),o=u.normals[i],s=u.binormals[i];for(d=0;r>=d;d++){var c=d/r*Math.PI*2,h=Math.sin(c),l=-Math.cos(c);m.x=l*o.x+h*s.x,m.y=l*o.y+h*s.y,m.z=l*o.z+h*s.z,m.normalize(),y.push(m.x,m.y,m.z),f.x=a.x+n*m.x,f.y=a.y+n*m.y,f.z=a.z+n*m.z,v.push(f.x,f.y,f.z)}}function h(){for(d=1;t>=d;d++)for(p=1;r>=p;p++){var e=(r+1)*(d-1)+(p-1),i=(r+1)*d+(p-1),n=(r+1)*d+p,a=(r+1)*(d-1)+p;_.push(e,i,a),_.push(i,n,a)}}function l(){for(p=0;t>=p;p++)for(d=0;r>=d;d++)g.x=p/t,g.y=d/r,x.push(g.x,g.y)}Ae.call(this),this.type="TubeBufferGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:r,closed:a},t=t||64,n=n||1,r=r||8,a=a||!1;var u=e.computeFrenetFrames(t,a);this.tangents=u.tangents,this.normals=u.normals,this.binormals=u.binormals;var p,d,f=new c,m=new c,g=new i,v=[],y=[],x=[],_=[];o(),this.setIndex(_),this.addAttribute("position",new be(v,3)),this.addAttribute("normal",new be(y,3)),this.addAttribute("uv",new be(x,2))}function jt(e,t,i,n,r,a,o){Se.call(this),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:i,radialSegments:n,p:r,q:a},void 0!==o&&console.warn("THREE.TorusKnotGeometry: heightScale has been deprecated. Use .scale( x, y, z ) instead."),this.fromBufferGeometry(new Wt(e,t,i,n,r,a)),this.mergeVertices()}function Wt(e,t,n,r,a,o){function s(e,t,i,n,r){var a=Math.cos(e),o=Math.sin(e),s=i/t*e,c=Math.cos(s);r.x=n*(2+c)*.5*a,r.y=n*(2+c)*o*.5,r.z=n*Math.sin(s)*.5}Ae.call(this),this.type="TorusKnotBufferGeometry",this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:r,p:a,q:o},e=e||100,t=t||40,n=Math.floor(n)||64,r=Math.floor(r)||8,a=a||2,o=o||3;var h,l,u=[],p=[],d=[],f=[],m=new c,g=new c,v=(new i,new c),y=new c,x=new c,_=new c,b=new c;for(h=0;n>=h;++h){var w=h/n*a*Math.PI*2;for(s(w,a,o,e,v),s(w+.01,a,o,e,y),_.subVectors(y,v),b.addVectors(y,v),x.crossVectors(_,b),b.crossVectors(x,_),x.normalize(),b.normalize(),l=0;r>=l;++l){var M=l/r*Math.PI*2,E=-t*Math.cos(M),T=t*Math.sin(M);m.x=v.x+(E*b.x+T*x.x),m.y=v.y+(E*b.y+T*x.y),m.z=v.z+(E*b.z+T*x.z),p.push(m.x,m.y,m.z),g.subVectors(m,v).normalize(),d.push(g.x,g.y,g.z),f.push(h/n),f.push(l/r)}}for(l=1;n>=l;l++)for(h=1;r>=h;h++){var S=(r+1)*(l-1)+(h-1),A=(r+1)*l+(h-1),L=(r+1)*l+h,R=(r+1)*(l-1)+h;u.push(S,A,R),u.push(A,L,R)}this.setIndex(u),this.addAttribute("position",new be(p,3)),this.addAttribute("normal",new be(d,3)),this.addAttribute("uv",new be(f,2))}function Xt(e,t,i,n,r){Se.call(this),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:i,tubularSegments:n,arc:r},this.fromBufferGeometry(new qt(e,t,i,n,r))}function qt(e,t,i,n,r){Ae.call(this),this.type="TorusBufferGeometry",this.parameters={radius:e,tube:t,radialSegments:i,tubularSegments:n,arc:r},e=e||100,t=t||40,i=Math.floor(i)||8,n=Math.floor(n)||6,r=r||2*Math.PI;var a,o,s=[],h=[],l=[],u=[],p=new c,d=new c,f=new c;for(a=0;i>=a;a++)for(o=0;n>=o;o++){var m=o/n*r,g=a/i*Math.PI*2;d.x=(e+t*Math.cos(g))*Math.cos(m),d.y=(e+t*Math.cos(g))*Math.sin(m),d.z=t*Math.sin(g),h.push(d.x,d.y,d.z),p.x=e*Math.cos(m),p.y=e*Math.sin(m),f.subVectors(d,p).normalize(),l.push(f.x,f.y,f.z),u.push(o/n),u.push(a/i)}for(a=1;i>=a;a++)for(o=1;n>=o;o++){var v=(n+1)*a+o-1,y=(n+1)*(a-1)+o-1,x=(n+1)*(a-1)+o,_=(n+1)*a+o;s.push(v,y,_),s.push(y,x,_)}this.setIndex(s),this.addAttribute("position",new be(h,3)),this.addAttribute("normal",new be(l,3)),this.addAttribute("uv",new be(u,2))}function Yt(e,t){return"undefined"==typeof e?void(e=[]):(Se.call(this),this.type="ExtrudeGeometry",e=Array.isArray(e)?e:[e],this.addShapeList(e,t),void this.computeFaceNormals())}function Zt(e,t){t=t||{};var i=t.font;if((i&&i.isFont)===!1)return console.error("THREE.TextGeometry: font parameter is not an instance of THREE.Font."),new Se;var n=i.generateShapes(e,t.size,t.curveSegments);t.amount=void 0!==t.height?t.height:50,void 0===t.bevelThickness&&(t.bevelThickness=10),void 0===t.bevelSize&&(t.bevelSize=8),void 0===t.bevelEnabled&&(t.bevelEnabled=!1),Yt.call(this,n,t),this.type="TextGeometry"}function Jt(e,t,i,n,r,a,o){Se.call(this),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:i,phiStart:n,phiLength:r,thetaStart:a,thetaLength:o},this.fromBufferGeometry(new Qt(e,t,i,n,r,a,o))}function Qt(e,t,i,n,r,a,o){Ae.call(this),this.type="SphereBufferGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:i,phiStart:n,phiLength:r,thetaStart:a,thetaLength:o},e=e||50,t=Math.max(3,Math.floor(t)||8),i=Math.max(2,Math.floor(i)||6),n=void 0!==n?n:0,r=void 0!==r?r:2*Math.PI,a=void 0!==a?a:0,o=void 0!==o?o:Math.PI;var s,h,l=a+o,u=0,p=[],d=new c,f=new c,m=[],g=[],v=[],y=[];for(h=0;i>=h;h++){var x=[],_=h/i;for(s=0;t>=s;s++){var b=s/t;d.x=-e*Math.cos(n+b*r)*Math.sin(a+_*o),d.y=e*Math.cos(a+_*o),d.z=e*Math.sin(n+b*r)*Math.sin(a+_*o),g.push(d.x,d.y,d.z),f.set(d.x,d.y,d.z).normalize(),v.push(f.x,f.y,f.z),y.push(b,1-_),x.push(u++)}p.push(x)}for(h=0;i>h;h++)for(s=0;t>s;s++){var w=p[h][s+1],M=p[h][s],E=p[h+1][s],T=p[h+1][s+1];(0!==h||a>0)&&m.push(w,M,T),(h!==i-1||l<Math.PI)&&m.push(M,E,T)}this.setIndex(m),this.addAttribute("position",new be(g,3)),this.addAttribute("normal",new be(v,3)),this.addAttribute("uv",new be(y,2))}function Kt(e,t,i,n,r,a){Se.call(this),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:i,phiSegments:n,thetaStart:r,thetaLength:a},this.fromBufferGeometry(new $t(e,t,i,n,r,a))}function $t(e,t,n,r,a,o){Ae.call(this),this.type="RingBufferGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:r,thetaStart:a,thetaLength:o},e=e||20,t=t||50,a=void 0!==a?a:0,o=void 0!==o?o:2*Math.PI,n=void 0!==n?Math.max(3,n):8,r=void 0!==r?Math.max(1,r):1;var s,h,l,u=[],p=[],d=[],f=[],m=e,g=(t-e)/r,v=new c,y=new i;for(h=0;r>=h;h++){for(l=0;n>=l;l++)s=a+l/n*o,v.x=m*Math.cos(s),v.y=m*Math.sin(s),p.push(v.x,v.y,v.z),d.push(0,0,1),y.x=(v.x/t+1)/2,y.y=(v.y/t+1)/2,f.push(y.x,y.y);m+=g}for(h=0;r>h;h++){var x=h*(n+1);for(l=0;n>l;l++){s=l+x;var _=s,b=s+n+1,w=s+n+2,M=s+1;u.push(_,b,M),u.push(b,w,M)}}this.setIndex(u),this.addAttribute("position",new be(p,3)),this.addAttribute("normal",new be(d,3)),this.addAttribute("uv",new be(f,2))}function ei(e,t,i,n){Se.call(this),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:i,phiLength:n},this.fromBufferGeometry(new ti(e,t,i,n)),this.mergeVertices()}function ti(e,t,n,r){Ae.call(this),this.type="LatheBufferGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:r},t=Math.floor(t)||12,n=n||0,r=r||2*Math.PI,r=us.clamp(r,0,2*Math.PI);var a,o,s,h=[],l=[],u=[],p=1/t,d=new c,f=new i;for(o=0;t>=o;o++){var m=n+o*p*r,g=Math.sin(m),v=Math.cos(m);for(s=0;s<=e.length-1;s++)d.x=e[s].x*g,d.y=e[s].y,d.z=e[s].x*v,l.push(d.x,d.y,d.z),f.x=o/t,f.y=s/(e.length-1),u.push(f.x,f.y)}for(o=0;t>o;o++)for(s=0;s<e.length-1;s++){a=s+o*e.length;var y=a,x=a+e.length,_=a+e.length+1,b=a+1;h.push(y,x,b),h.push(x,_,b)}if(this.setIndex(h),this.addAttribute("position",new be(l,3)),this.addAttribute("uv",new be(u,2)),this.computeVertexNormals(),r===2*Math.PI){var w=this.attributes.normal.array,M=new c,E=new c,T=new c;for(a=t*e.length*3,o=0,s=0;o<e.length;o++,s+=3)M.x=w[s+0],M.y=w[s+1],M.z=w[s+2],E.x=w[a+s+0],E.y=w[a+s+1],E.z=w[a+s+2],T.addVectors(M,E).normalize(),w[s+0]=w[a+s+0]=T.x,w[s+1]=w[a+s+1]=T.y,w[s+2]=w[a+s+2]=T.z}}function ii(e,t){Se.call(this),this.type="ShapeGeometry","object"==typeof t&&(console.warn("THREE.ShapeGeometry: Options parameter has been removed."),t=t.curveSegments),this.parameters={shapes:e,curveSegments:t},this.fromBufferGeometry(new ni(e,t)),this.mergeVertices()}function ni(e,t){function i(e){var i,s,h,l=r.length/3,u=e.extractPoints(t),p=u.shape,d=u.holes;if(Ah.isClockWise(p)===!1)for(p=p.reverse(),i=0,s=d.length;s>i;i++)h=d[i],Ah.isClockWise(h)===!0&&(d[i]=h.reverse());var f=Ah.triangulateShape(p,d);for(i=0,s=d.length;s>i;i++)h=d[i],p=p.concat(h);for(i=0,s=p.length;s>i;i++){var m=p[i];r.push(m.x,m.y,0),a.push(0,0,1),o.push(m.x,m.y)}for(i=0,s=f.length;s>i;i++){var g=f[i],v=g[0]+l,y=g[1]+l,x=g[2]+l;n.push(v,y,x),c+=3}}Ae.call(this),this.type="ShapeBufferGeometry",this.parameters={shapes:e,curveSegments:t},t=t||12;var n=[],r=[],a=[],o=[],s=0,c=0;if(Array.isArray(e)===!1)i(e);else for(var h=0;h<e.length;h++)i(e[h]),this.addGroup(s,c,h),s+=c,c=0;this.setIndex(n),this.addAttribute("position",new be(r,3)),this.addAttribute("normal",new be(a,3)),this.addAttribute("uv",new be(o,2))}function ri(e,t){function i(e,t){return e-t}Ae.call(this),this.type="EdgesGeometry",this.parameters={thresholdAngle:t},t=void 0!==t?t:1;var n,r,a=[],o=Math.cos(us.DEG2RAD*t),s=[0,0],c={},h=["a","b","c"];e.isBufferGeometry?(r=new Se,r.fromBufferGeometry(e)):r=e.clone(),r.mergeVertices(),r.computeFaceNormals();for(var l=r.vertices,u=r.faces,p=0,d=u.length;d>p;p++)for(var f=u[p],m=0;3>m;m++)s[0]=f[h[m]],s[1]=f[h[(m+1)%3]],s.sort(i),n=s.toString(),void 0===c[n]?c[n]={index1:s[0],index2:s[1],face1:p,face2:void 0}:c[n].face2=p;for(n in c){var g=c[n];if(void 0===g.face2||u[g.face1].normal.dot(u[g.face2].normal)<=o){var v=l[g.index1];a.push(v.x,v.y,v.z),v=l[g.index2],a.push(v.x,v.y,v.z)}}this.addAttribute("position",new be(a,3))}function ai(e,t,i,n,r,a,o,s){Se.call(this),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:i,radialSegments:n,heightSegments:r,openEnded:a,thetaStart:o,thetaLength:s},this.fromBufferGeometry(new oi(e,t,i,n,r,a,o,s)),this.mergeVertices()}function oi(e,t,n,r,a,o,s,h){function l(){var i,o,l=new c,u=new c,b=0,w=(t-e)/n;for(o=0;a>=o;o++){var M=[],E=o/a,T=E*(t-e)+e;for(i=0;r>=i;i++){var S=i/r,A=S*h+s,L=Math.sin(A),R=Math.cos(A);u.x=T*L,u.y=-E*n+x,u.z=T*R,f.push(u.x,u.y,u.z),l.set(L,w,R).normalize(),m.push(l.x,l.y,l.z),g.push(S,1-E),M.push(v++)}y.push(M)}for(i=0;r>i;i++)for(o=0;a>o;o++){var P=y[o][i],C=y[o+1][i],I=y[o+1][i+1],U=y[o][i+1];d.push(P,C,U),d.push(C,I,U),b+=6}p.addGroup(_,b,0),_+=b}function u(n){var a,o,l,u=new i,y=new c,b=0,w=n===!0?e:t,M=n===!0?1:-1;for(o=v,a=1;r>=a;a++)f.push(0,x*M,0),m.push(0,M,0),g.push(.5,.5),v++;for(l=v,a=0;r>=a;a++){var E=a/r,T=E*h+s,S=Math.cos(T),A=Math.sin(T);y.x=w*A,y.y=x*M,y.z=w*S,f.push(y.x,y.y,y.z),m.push(0,M,0),u.x=.5*S+.5,u.y=.5*A*M+.5,g.push(u.x,u.y),v++}for(a=0;r>a;a++){var L=o+a,R=l+a;n===!0?d.push(R,R+1,L):d.push(R+1,R,L),b+=3}p.addGroup(_,b,n===!0?1:2),_+=b}Ae.call(this),this.type="CylinderBufferGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:r,heightSegments:a,openEnded:o,thetaStart:s,thetaLength:h};var p=this;e=void 0!==e?e:20,t=void 0!==t?t:20,n=void 0!==n?n:100,r=Math.floor(r)||8,a=Math.floor(a)||1,o=void 0!==o?o:!1,s=void 0!==s?s:0,h=void 0!==h?h:2*Math.PI;var d=[],f=[],m=[],g=[],v=0,y=[],x=n/2,_=0;l(),o===!1&&(e>0&&u(!0),t>0&&u(!1)),this.setIndex(d),this.addAttribute("position",new be(f,3)),this.addAttribute("normal",new be(m,3)),this.addAttribute("uv",new be(g,2))}function si(e,t,i,n,r,a,o){ai.call(this,0,e,t,i,n,r,a,o),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:i,heightSegments:n,openEnded:r,thetaStart:a,thetaLength:o}}function ci(e,t,i,n,r,a,o){oi.call(this,0,e,t,i,n,r,a,o),this.type="ConeBufferGeometry",this.parameters={radius:e,height:t,radialSegments:i,heightSegments:n,openEnded:r,thetaStart:a,thetaLength:o}}function hi(e,t,i,n){Se.call(this),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:i,thetaLength:n},this.fromBufferGeometry(new li(e,t,i,n))}function li(e,t,n,r){Ae.call(this),this.type="CircleBufferGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:r},e=e||50,t=void 0!==t?Math.max(3,t):8,n=void 0!==n?n:0,r=void 0!==r?r:2*Math.PI;var a,o,s=[],h=[],l=[],u=[],p=new c,d=new i;for(h.push(0,0,0),l.push(0,0,1),u.push(.5,.5),o=0,a=3;t>=o;o++,a+=3){var f=n+o/t*r;p.x=e*Math.cos(f),p.y=e*Math.sin(f),h.push(p.x,p.y,p.z),l.push(0,0,1),d.x=(h[a]/e+1)/2,d.y=(h[a+1]/e+1)/2,u.push(d.x,d.y)}for(a=1;t>=a;a++)s.push(a,a+1,0);this.setIndex(s),this.addAttribute("position",new be(h,3)),this.addAttribute("normal",new be(l,3)),this.addAttribute("uv",new be(u,2))}function ui(){Q.call(this,{uniforms:ys.merge([bh.lights,{opacity:{value:1}}]),vertexShader:xh.shadow_vert,fragmentShader:xh.shadow_frag}),this.lights=!0,this.transparent=!0,Object.defineProperties(this,{opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(e){this.uniforms.opacity.value=e}}})}function pi(e){Q.call(this,e),this.type="RawShaderMaterial"}function di(e){this.uuid=us.generateUUID(),this.type="MultiMaterial",this.materials=Array.isArray(e)?e:[],this.visible=!0}function fi(e){J.call(this),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new W(16777215),this.roughness=.5,this.metalness=.5,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new W(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new i(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function mi(e){fi.call(this),this.defines={PHYSICAL:""},this.type="MeshPhysicalMaterial",this.reflectivity=.5,this.clearCoat=0,this.clearCoatRoughness=0,this.setValues(e)}function gi(e){J.call(this),this.type="MeshPhongMaterial",this.color=new W(16777215),this.specular=new W(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new W(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new i(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Va,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function vi(e){gi.call(this),this.defines={TOON:""},this.type="MeshToonMaterial",this.gradientMap=null,this.setValues(e)}function yi(e){J.call(this,e),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new i(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function xi(e){J.call(this),this.type="MeshLambertMaterial",this.color=new W(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new W(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Va,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function _i(e){J.call(this),this.type="LineDashedMaterial",this.color=new W(16777215),this.linewidth=1,this.scale=1,this.dashSize=3,this.gapSize=1,this.lights=!1,this.setValues(e)}function bi(e,t,i){var n=this,r=!1,a=0,o=0;this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=i,this.itemStart=function(e){o++,r===!1&&void 0!==n.onStart&&n.onStart(e,a,o),r=!0},this.itemEnd=function(e){a++,void 0!==n.onProgress&&n.onProgress(e,a,o),a===o&&(r=!1,void 0!==n.onLoad&&n.onLoad())},this.itemError=function(e){void 0!==n.onError&&n.onError(e)}}function wi(e){this.manager=void 0!==e?e:Ch}function Mi(e){this.manager=void 0!==e?e:Ch,this._parser=null}function Ei(e){this.manager=void 0!==e?e:Ch,this._parser=null}function Ti(e){this.manager=void 0!==e?e:Ch}function Si(e){this.manager=void 0!==e?e:Ch}function Ai(e){this.manager=void 0!==e?e:Ch}function Li(e,t){ce.call(this),this.type="Light",this.color=new W(e),this.intensity=void 0!==t?t:1,this.receiveShadow=void 0}function Ri(e,t,i){Li.call(this,e,i),this.type="HemisphereLight",this.castShadow=void 0,this.position.copy(ce.DefaultUp),this.updateMatrix(),this.groundColor=new W(t)}function Pi(e){this.camera=e,this.bias=0,this.radius=1,this.mapSize=new i(512,512),this.map=null,this.matrix=new h}function Ci(){Pi.call(this,new Ne(50,1,.5,500))}function Ii(e,t,i,n,r,a){Li.call(this,e,t),this.type="SpotLight",this.position.copy(ce.DefaultUp),this.updateMatrix(),this.target=new ce,Object.defineProperty(this,"power",{get:function(){return this.intensity*Math.PI},set:function(e){this.intensity=e/Math.PI}}),this.distance=void 0!==i?i:0,this.angle=void 0!==n?n:Math.PI/3,this.penumbra=void 0!==r?r:0,this.decay=void 0!==a?a:1,this.shadow=new Ci}function Ui(e,t,i,n){Li.call(this,e,t),this.type="PointLight",Object.defineProperty(this,"power",{get:function(){return 4*this.intensity*Math.PI},set:function(e){this.intensity=e/(4*Math.PI)}}),this.distance=void 0!==i?i:0,this.decay=void 0!==n?n:1,this.shadow=new Pi(new Ne(90,1,.5,500))}function Ni(){Pi.call(this,new De(-5,5,5,-5,.5,500))}function Di(e,t){Li.call(this,e,t),this.type="DirectionalLight",this.position.copy(ce.DefaultUp),this.updateMatrix(),this.target=new ce,this.shadow=new Ni}function Oi(e,t){Li.call(this,e,t),this.type="AmbientLight",this.castShadow=void 0}function Bi(e,t,i,n){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=void 0!==n?n:new t.constructor(i),this.sampleValues=t,this.valueSize=i}function Fi(e,t,i,n){Bi.call(this,e,t,i,n),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0}function zi(e,t,i,n){Bi.call(this,e,t,i,n)}function Gi(e,t,i,n){Bi.call(this,e,t,i,n)}function Hi(e,t,i,n){if(void 0===e)throw new Error("track name is undefined");
5
+ if(void 0===t||0===t.length)throw new Error("no keyframes in track named "+e);this.name=e,this.times=Ih.convertArray(t,this.TimeBufferType),this.values=Ih.convertArray(i,this.ValueBufferType),this.setInterpolation(n||this.DefaultInterpolation),this.validate(),this.optimize()}function Vi(e,t,i,n){Hi.call(this,e,t,i,n)}function ki(e,t,i,n){Bi.call(this,e,t,i,n)}function ji(e,t,i,n){Hi.call(this,e,t,i,n)}function Wi(e,t,i,n){Hi.call(this,e,t,i,n)}function Xi(e,t,i,n){Hi.call(this,e,t,i,n)}function qi(e,t,i){Hi.call(this,e,t,i)}function Yi(e,t,i,n){Hi.call(this,e,t,i,n)}function Zi(e,t,i,n){Hi.apply(this,arguments)}function Ji(e,t,i){this.name=e,this.tracks=i,this.duration=void 0!==t?t:-1,this.uuid=us.generateUUID(),this.duration<0&&this.resetDuration(),this.optimize()}function Qi(e){this.manager=void 0!==e?e:Ch,this.textures={}}function Ki(e){this.manager=void 0!==e?e:Ch}function $i(){this.onLoadStart=function(){},this.onLoadProgress=function(){},this.onLoadComplete=function(){}}function en(e){"boolean"==typeof e&&(console.warn("THREE.JSONLoader: showStatus parameter has been removed from constructor."),e=void 0),this.manager=void 0!==e?e:Ch,this.withCredentials=!1}function tn(e){this.manager=void 0!==e?e:Ch,this.texturePath=""}function nn(e,t,i,n,r){var a=.5*(n-t),o=.5*(r-i),s=e*e,c=e*s;return(2*i-2*n+a+o)*c+(-3*i+3*n-2*a-o)*s+a*e+i}function rn(e,t){var i=1-e;return i*i*t}function an(e,t){return 2*(1-e)*e*t}function on(e,t){return e*e*t}function sn(e,t,i,n){return rn(e,t)+an(e,i)+on(e,n)}function cn(e,t){var i=1-e;return i*i*i*t}function hn(e,t){var i=1-e;return 3*i*i*e*t}function ln(e,t){return 3*(1-e)*e*e*t}function un(e,t){return e*e*e*t}function pn(e,t,i,n,r){return cn(e,t)+hn(e,i)+ln(e,n)+un(e,r)}function dn(){}function fn(e,t){this.v1=e,this.v2=t}function mn(){this.curves=[],this.autoClose=!1}function gn(e,t,i,n,r,a,o,s){this.aX=e,this.aY=t,this.xRadius=i,this.yRadius=n,this.aStartAngle=r,this.aEndAngle=a,this.aClockwise=o,this.aRotation=s||0}function vn(e){this.points=void 0===e?[]:e}function yn(e,t,i,n){this.v0=e,this.v1=t,this.v2=i,this.v3=n}function xn(e,t,i){this.v0=e,this.v1=t,this.v2=i}function _n(e){mn.call(this),this.currentPoint=new i,e&&this.fromPoints(e)}function bn(){_n.apply(this,arguments),this.holes=[]}function wn(){this.subPaths=[],this.currentPath=null}function Mn(e){this.data=e}function En(e){this.manager=void 0!==e?e:Ch}function Tn(e){this.manager=void 0!==e?e:Ch}function Sn(e,t,i,n){Li.call(this,e,t),this.type="RectAreaLight",this.position.set(0,1,0),this.updateMatrix(),this.width=void 0!==i?i:10,this.height=void 0!==n?n:10}function An(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Ne,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Ne,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1}function Ln(e,t,i){ce.call(this),this.type="CubeCamera";var n=90,r=1,a=new Ne(n,r,e,t);a.up.set(0,-1,0),a.lookAt(new c(1,0,0)),this.add(a);var s=new Ne(n,r,e,t);s.up.set(0,-1,0),s.lookAt(new c(-1,0,0)),this.add(s);var h=new Ne(n,r,e,t);h.up.set(0,0,1),h.lookAt(new c(0,1,0)),this.add(h);var l=new Ne(n,r,e,t);l.up.set(0,0,-1),l.lookAt(new c(0,-1,0)),this.add(l);var u=new Ne(n,r,e,t);u.up.set(0,-1,0),u.lookAt(new c(0,0,1)),this.add(u);var p=new Ne(n,r,e,t);p.up.set(0,-1,0),p.lookAt(new c(0,0,-1)),this.add(p);var d={format:Ao,magFilter:lo,minFilter:lo};this.renderTarget=new o(i,i,d),this.updateCubeMap=function(e,t){null===this.parent&&this.updateMatrixWorld();var i=this.renderTarget,n=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,i.activeCubeFace=0,e.render(t,a,i),i.activeCubeFace=1,e.render(t,s,i),i.activeCubeFace=2,e.render(t,h,i),i.activeCubeFace=3,e.render(t,l,i),i.activeCubeFace=4,e.render(t,u,i),i.texture.generateMipmaps=n,i.activeCubeFace=5,e.render(t,p,i),e.setRenderTarget(null)}}function Rn(){ce.call(this),this.type="AudioListener",this.context=Oh.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null}function Pn(e){ce.call(this),this.type="Audio",this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.loop=!1,this.startTime=0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.sourceType="empty",this.filters=[]}function Cn(e){Pn.call(this,e),this.panner=this.context.createPanner(),this.panner.connect(this.gain)}function In(e,t){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=void 0!==t?t:2048,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}function Un(e,t,i){this.binding=e,this.valueSize=i;var n,r=Float64Array;switch(t){case"quaternion":n=this._slerp;break;case"string":case"bool":r=Array,n=this._select;break;default:n=this._lerp}this.buffer=new r(4*i),this._mixBufferRegion=n,this.cumulativeWeight=0,this.useCount=0,this.referenceCount=0}function Nn(e,t,i){this.path=t,this.parsedPath=i||Nn.parseTrackName(t),this.node=Nn.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e}function Dn(e){this.uuid=us.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var t={};this._indicesByUUID=t;for(var i=0,n=arguments.length;i!==n;++i)t[arguments[i].uuid]=i;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};var r=this;this.stats={objects:{get total(){return r._objects.length},get inUse(){return this.total-r.nCachedObjects_}},get bindingsPerObject(){return r._bindings.length}}}function On(e,t,i){this._mixer=e,this._clip=t,this._localRoot=i||null;for(var n=t.tracks,r=n.length,a=new Array(r),o={endingStart:Zo,endingEnd:Zo},s=0;s!==r;++s){var c=n[s].createInterpolant(null);a[s]=c,c.settings=o}this._interpolantSettings=o,this._interpolants=a,this._propertyBindings=new Array(r),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=jo,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}function Bn(e){this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}function Fn(e){"string"==typeof e&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),e=arguments[1]),this.value=e}function zn(){Ae.call(this),this.type="InstancedBufferGeometry",this.maxInstancedCount=void 0}function Gn(e,t,i,n){this.uuid=us.generateUUID(),this.data=e,this.itemSize=t,this.offset=i,this.normalized=n===!0}function Hn(e,t){this.uuid=us.generateUUID(),this.array=e,this.stride=t,this.count=void 0!==e?e.length/t:0,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.onUploadCallback=function(){},this.version=0}function Vn(e,t,i){Hn.call(this,e,t),this.meshPerAttribute=i||1}function kn(e,t,i){de.call(this,e,t),this.meshPerAttribute=i||1}function jn(e,t,i,n){this.ray=new ae(e,t),this.near=i||0,this.far=n||1/0,this.params={Mesh:{},Line:{},LOD:{},Points:{threshold:1},Sprite:{}},Object.defineProperties(this.params,{PointCloud:{get:function(){return console.warn("THREE.Raycaster: params.PointCloud has been renamed to params.Points."),this.Points}}})}function Wn(e,t){return e.distance-t.distance}function Xn(e,t,i,n){if(e.visible!==!1&&(e.raycast(t,i),n===!0))for(var r=e.children,a=0,o=r.length;o>a;a++)Xn(r[a],t,i,!0)}function qn(e){this.autoStart=void 0!==e?e:!0,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}function Yn(e,t,i){return this.radius=void 0!==e?e:1,this.phi=void 0!==t?t:0,this.theta=void 0!==i?i:0,this}function Zn(e,t,i){return this.radius=void 0!==e?e:1,this.theta=void 0!==t?t:0,this.y=void 0!==i?i:0,this}function Jn(e,t){Le.call(this,e,t),this.animationsMap={},this.animationsList=[];var i=this.geometry.morphTargets.length,n="__default",r=0,a=i-1,o=i/1;this.createAnimation(n,r,a,o),this.setAnimationWeight(n,1)}function Qn(e){ce.call(this),this.material=e,this.render=function(e){}}function Kn(e,t,i,n){this.object=e,this.size=void 0!==t?t:1;var r=void 0!==i?i:16711680,a=void 0!==n?n:1,o=0,s=this.object.geometry;s&&s.isGeometry?o=3*s.faces.length:s&&s.isBufferGeometry&&(o=s.attributes.normal.count);var c=new Ae,h=new be(2*o*3,3);c.addAttribute("position",h),bt.call(this,c,new xt({color:r,linewidth:a})),this.matrixAutoUpdate=!1,this.update()}function $n(e){ce.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1;for(var t=new Ae,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1],n=0,r=1,a=32;a>n;n++,r++){var o=n/a*Math.PI*2,s=r/a*Math.PI*2;i.push(Math.cos(o),Math.sin(o),1,Math.cos(s),Math.sin(s),1)}t.addAttribute("position",new be(i,3));var c=new xt({fog:!1});this.cone=new bt(t,c),this.add(this.cone),this.update()}function er(e){this.bones=this.getBoneList(e);for(var t=new Ae,i=[],n=[],r=new W(0,0,1),a=new W(0,1,0),o=0;o<this.bones.length;o++){var s=this.bones[o];s.parent&&s.parent.isBone&&(i.push(0,0,0),i.push(0,0,0),n.push(r.r,r.g,r.b),n.push(a.r,a.g,a.b))}t.addAttribute("position",new be(i,3)),t.addAttribute("color",new be(n,3));var c=new xt({vertexColors:ua,depthTest:!1,depthWrite:!1,transparent:!0});bt.call(this,t,c),this.root=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.update()}function tr(e,t){this.light=e,this.light.updateMatrixWorld();var i=new Qt(t,4,2),n=new pe({wireframe:!0,fog:!1});n.color.copy(this.light.color).multiplyScalar(this.light.intensity),Le.call(this,i,n),this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1}function ir(e){ce.call(this),this.light=e,this.light.updateMatrixWorld();var t=new pe({color:e.color,fog:!1}),i=new pe({color:e.color,fog:!1,wireframe:!0}),n=new Ae;n.addAttribute("position",new de(new Float32Array(18),3)),this.add(new Le(n,t)),this.add(new Le(n,i)),this.update()}function nr(e,t){ce.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1;var i=new Bt(t);i.rotateY(.5*Math.PI);var n=new pe({vertexColors:ua,wireframe:!0}),r=i.getAttribute("position"),a=new Float32Array(3*r.count);i.addAttribute("color",new de(a,3)),this.add(new Le(i,n)),this.update()}function rr(e,t,i,n){e=e||10,t=t||10,i=new W(void 0!==i?i:4473924),n=new W(void 0!==n?n:8947848);for(var r=t/2,a=e/t,o=e/2,s=[],c=[],h=0,l=0,u=-o;t>=h;h++,u+=a){s.push(-o,0,u,o,0,u),s.push(u,0,-o,u,0,o);var p=h===r?i:n;p.toArray(c,l),l+=3,p.toArray(c,l),l+=3,p.toArray(c,l),l+=3,p.toArray(c,l),l+=3}var d=new Ae;d.addAttribute("position",new be(s,3)),d.addAttribute("color",new be(c,3));var f=new xt({vertexColors:ua});bt.call(this,d,f)}function ar(e,t,i,n,r,a){e=e||10,t=t||16,i=i||8,n=n||64,r=new W(void 0!==r?r:4473924),a=new W(void 0!==a?a:8947848);var o,s,c,h,l,u,p,d=[],f=[];for(h=0;t>=h;h++)c=h/t*(2*Math.PI),o=Math.sin(c)*e,s=Math.cos(c)*e,d.push(0,0,0),d.push(o,0,s),p=1&h?r:a,f.push(p.r,p.g,p.b),f.push(p.r,p.g,p.b);for(h=0;i>=h;h++)for(p=1&h?r:a,u=e-e/i*h,l=0;n>l;l++)c=l/n*(2*Math.PI),o=Math.sin(c)*u,s=Math.cos(c)*u,d.push(o,0,s),f.push(p.r,p.g,p.b),c=(l+1)/n*(2*Math.PI),o=Math.sin(c)*u,s=Math.cos(c)*u,d.push(o,0,s),f.push(p.r,p.g,p.b);var m=new Ae;m.addAttribute("position",new be(d,3)),m.addAttribute("color",new be(f,3));var g=new xt({vertexColors:ua});bt.call(this,m,g)}function or(e,t,i,n){this.object=e,this.size=void 0!==t?t:1;var r=void 0!==i?i:16776960,a=void 0!==n?n:1,o=0,s=this.object.geometry;s&&s.isGeometry?o=s.faces.length:console.warn("THREE.FaceNormalsHelper: only THREE.Geometry is supported. Use THREE.VertexNormalsHelper, instead.");var c=new Ae,h=new be(2*o*3,3);c.addAttribute("position",h),bt.call(this,c,new xt({color:r,linewidth:a})),this.matrixAutoUpdate=!1,this.update()}function sr(e,t){ce.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,void 0===t&&(t=1);var i=new Ae;i.addAttribute("position",new be([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));var n=new xt({fog:!1});this.add(new _t(i,n)),i=new Ae,i.addAttribute("position",new be([0,0,0,0,0,1],3)),this.add(new _t(i,n)),this.update()}function cr(e){function t(e,t,n){i(e,n),i(t,n)}function i(e,t){a.push(0,0,0),o.push(t.r,t.g,t.b),void 0===s[e]&&(s[e]=[]),s[e].push(a.length/3-1)}var n=new Ae,r=new xt({color:16777215,vertexColors:la}),a=[],o=[],s={},c=new W(16755200),h=new W(16711680),l=new W(43775),u=new W(16777215),p=new W(3355443);t("n1","n2",c),t("n2","n4",c),t("n4","n3",c),t("n3","n1",c),t("f1","f2",c),t("f2","f4",c),t("f4","f3",c),t("f3","f1",c),t("n1","f1",c),t("n2","f2",c),t("n3","f3",c),t("n4","f4",c),t("p","n1",h),t("p","n2",h),t("p","n3",h),t("p","n4",h),t("u1","u2",l),t("u2","u3",l),t("u3","u1",l),t("c","t",u),t("p","c",p),t("cn1","cn2",p),t("cn3","cn4",p),t("cf1","cf2",p),t("cf3","cf4",p),n.addAttribute("position",new be(a,3)),n.addAttribute("color",new be(o,3)),bt.call(this,n,r),this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=s,this.update()}function hr(e,t){void 0===t&&(t=16776960);var i=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]),n=new Float32Array(24),r=new Ae;r.setIndex(new de(i,1)),r.addAttribute("position",new de(n,3)),bt.call(this,r,new xt({color:t})),void 0!==e&&this.update(e)}function lr(e,t,i,n,r,a){ce.call(this),void 0===n&&(n=16776960),void 0===i&&(i=1),void 0===r&&(r=.2*i),void 0===a&&(a=.2*r),void 0===Bh&&(Bh=new Ae,Bh.addAttribute("position",new be([0,0,0,0,1,0],3)),Fh=new oi(0,.5,1,5,1),Fh.translate(0,-.5,0)),this.position.copy(t),this.line=new _t(Bh,new xt({color:n})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new Le(Fh,new pe({color:n})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(i,r,a)}function ur(e){e=e||1;var t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],i=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],n=new Ae;n.addAttribute("position",new be(t,3)),n.addAttribute("color",new be(i,3));var r=new xt({vertexColors:ua});bt.call(this,n,r)}function pr(){function e(e,a,o,s){t=e,i=o,n=-3*e+3*a-2*o-s,r=2*e-2*a+o+s}var t=0,i=0,n=0,r=0;return{initCatmullRom:function(t,i,n,r,a){e(i,n,a*(n-t),a*(r-i))},initNonuniformCatmullRom:function(t,i,n,r,a,o,s){var c=(i-t)/a-(n-t)/(a+o)+(n-i)/o,h=(n-i)/o-(r-i)/(o+s)+(r-n)/s;c*=o,h*=o,e(i,n,c,h)},calc:function(e){var a=e*e,o=a*e;return t+i*e+n*a+r*o}}}function dr(e){this.points=e||[],this.closed=!1}function fr(e,t,i,n){this.v0=e,this.v1=t,this.v2=i,this.v3=n}function mr(e,t,i){this.v0=e,this.v1=t,this.v2=i}function gr(e,t){this.v1=e,this.v2=t}function vr(e,t,i,n,r,a){gn.call(this,e,t,i,i,n,r,a)}function yr(e,t,i,n,r,a,o){return console.warn("THREE.Face4 has been removed. A THREE.Face3 will be created instead."),new ue(e,t,i,r,a,o)}function xr(e){return console.warn("THREE.MeshFaceMaterial has been renamed to THREE.MultiMaterial."),new di(e)}function _r(e,t){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new Mt(e,t)}function br(e){return console.warn("THREE.Particle has been renamed to THREE.Sprite."),new ft(e)}function wr(e,t){return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),new Mt(e,t)}function Mr(e){return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),new wt(e)}function Er(e){return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),new wt(e)}function Tr(e){return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),new wt(e)}function Sr(e,t,i){return console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."),new c(e,t,i)}function Ar(e,t){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setDynamic( true ) instead."),new de(e,t).setDynamic(!0)}function Lr(e,t){return console.warn("THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead."),new fe(e,t)}function Rr(e,t){return console.warn("THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead."),new me(e,t)}function Pr(e,t){return console.warn("THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead."),new ge(e,t)}function Cr(e,t){return console.warn("THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead."),new ve(e,t)}function Ir(e,t){return console.warn("THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead."),new ye(e,t)}function Ur(e,t){return console.warn("THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead."),new xe(e,t)}function Nr(e,t){return console.warn("THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead."),new _e(e,t)}function Dr(e,t){return console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead."),new be(e,t)}function Or(e,t){return console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead."),new we(e,t)}function Br(e){console.warn("THREE.ClosedSplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),dr.call(this,e),this.type="catmullrom",this.closed=!0}function Fr(e){console.warn("THREE.SplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),dr.call(this,e),this.type="catmullrom"}function zr(e){console.warn("THREE.Spline has been removed. Use THREE.CatmullRomCurve3 instead."),dr.call(this,e),this.type="catmullrom"}function Gr(e,t){return console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead."),new hr(e,t)}function Hr(e,t){return console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."),new bt(new ri(e.geometry),new xt({color:void 0!==t?t:16777215}))}function Vr(e,t){return console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead."),new bt(new Rt(e.geometry),new xt({color:void 0!==t?t:16777215}))}function kr(e){return console.warn("THREE.XHRLoader has been renamed to THREE.FileLoader."),new wi(e)}function jr(e){return console.warn("THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader."),new Ei(e)}function Wr(){console.error("THREE.Projector has been moved to /examples/js/renderers/Projector.js."),this.projectVector=function(e,t){console.warn("THREE.Projector: .projectVector() is now vector.project()."),e.project(t)},this.unprojectVector=function(e,t){console.warn("THREE.Projector: .unprojectVector() is now vector.unproject()."),e.unproject(t)},this.pickingRay=function(){console.error("THREE.Projector: .pickingRay() is now raycaster.setFromCamera().")}}function Xr(){console.error("THREE.CanvasRenderer has been moved to /examples/js/renderers/CanvasRenderer.js"),this.domElement=document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),this.clear=function(){},this.render=function(){},this.setClearColor=function(){},this.setSize=function(){}}void 0===Number.EPSILON&&(Number.EPSILON=Math.pow(2,-52)),void 0===Math.sign&&(Math.sign=function(e){return 0>e?-1:e>0?1:+e}),void 0===Function.prototype.name&&Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*([^\(\s]*)/)[1]}}),void 0===Object.assign&&!function(){Object.assign=function(e){if(void 0===e||null===e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),i=1;i<arguments.length;i++){var n=arguments[i];if(void 0!==n&&null!==n)for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}}(),t.prototype={addEventListener:function(e,t){void 0===this._listeners&&(this._listeners={});var i=this._listeners;void 0===i[e]&&(i[e]=[]),-1===i[e].indexOf(t)&&i[e].push(t)},hasEventListener:function(e,t){if(void 0===this._listeners)return!1;var i=this._listeners;return void 0!==i[e]&&-1!==i[e].indexOf(t)},removeEventListener:function(e,t){if(void 0!==this._listeners){var i=this._listeners,n=i[e];if(void 0!==n){var r=n.indexOf(t);-1!==r&&n.splice(r,1)}}},dispatchEvent:function(e){if(void 0!==this._listeners){var t=this._listeners,i=t[e.type];if(void 0!==i){e.target=this;var n=[],r=0,a=i.length;for(r=0;a>r;r++)n[r]=i[r];for(r=0;a>r;r++)n[r].call(this,e)}}}};var qr="84",Yr={LEFT:0,MIDDLE:1,RIGHT:2},Zr=0,Jr=1,Qr=2,Kr=3,$r=0,ea=1,ta=0,ia=1,na=2,ra=0,aa=1,oa=2,sa=1,ca=2,ha=0,la=1,ua=2,pa=0,da=1,fa=2,ma=3,ga=4,va=5,ya=100,xa=101,_a=102,ba=103,wa=104,Ma=200,Ea=201,Ta=202,Sa=203,Aa=204,La=205,Ra=206,Pa=207,Ca=208,Ia=209,Ua=210,Na=0,Da=1,Oa=2,Ba=3,Fa=4,za=5,Ga=6,Ha=7,Va=0,ka=1,ja=2,Wa=0,Xa=1,qa=2,Ya=3,Za=4,Ja=300,Qa=301,Ka=302,$a=303,eo=304,to=305,io=306,no=307,ro=1e3,ao=1001,oo=1002,so=1003,co=1004,ho=1005,lo=1006,uo=1007,po=1008,fo=1009,mo=1010,go=1011,vo=1012,yo=1013,xo=1014,_o=1015,bo=1016,wo=1017,Mo=1018,Eo=1019,To=1020,So=1021,Ao=1022,Lo=1023,Ro=1024,Po=1025,Co=Lo,Io=1026,Uo=1027,No=2001,Do=2002,Oo=2003,Bo=2004,Fo=2100,zo=2101,Go=2102,Ho=2103,Vo=2151,ko=2200,jo=2201,Wo=2202,Xo=2300,qo=2301,Yo=2302,Zo=2400,Jo=2401,Qo=2402,Ko=0,$o=1,es=2,ts=3e3,is=3001,ns=3007,rs=3002,as=3003,os=3004,ss=3005,cs=3006,hs=3200,ls=3201,us={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:function(){var e,t="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),i=new Array(36),n=0;return function(){for(var r=0;36>r;r++)8===r||13===r||18===r||23===r?i[r]="-":14===r?i[r]="4":(2>=n&&(n=33554432+16777216*Math.random()|0),e=15&n,n>>=4,i[r]=t[19===r?3&e|8:e]);return i.join("")}}(),clamp:function(e,t,i){return Math.max(t,Math.min(i,e))},euclideanModulo:function(e,t){return(e%t+t)%t},mapLinear:function(e,t,i,n,r){return n+(e-t)*(r-n)/(i-t)},lerp:function(e,t,i){return(1-i)*e+i*t},smoothstep:function(e,t,i){return t>=e?0:e>=i?1:(e=(e-t)/(i-t),e*e*(3-2*e))},smootherstep:function(e,t,i){return t>=e?0:e>=i?1:(e=(e-t)/(i-t),e*e*e*(e*(6*e-15)+10))},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},degToRad:function(e){return e*us.DEG2RAD},radToDeg:function(e){return e*us.RAD2DEG},isPowerOfTwo:function(e){return 0===(e&e-1)&&0!==e},nearestPowerOfTwo:function(e){return Math.pow(2,Math.round(Math.log(e)/Math.LN2))},nextPowerOfTwo:function(e){return e--,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,e++,e}};i.prototype={constructor:i,isVector2:!0,get width(){return this.x},set width(e){this.x=e},get height(){return this.y},set height(e){this.y=e},set:function(e,t){return this.x=e,this.y=t,this},setScalar:function(e){return this.x=e,this.y=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(e){return this.x=e.x,this.y=e.y,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this)},addScalar:function(e){return this.x+=e,this.y+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this)},subScalar:function(e){return this.x-=e,this.y-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this},multiply:function(e){return this.x*=e.x,this.y*=e.y,this},multiplyScalar:function(e){return isFinite(e)?(this.x*=e,this.y*=e):(this.x=0,this.y=0),this},divide:function(e){return this.x/=e.x,this.y/=e.y,this},divideScalar:function(e){return this.multiplyScalar(1/e)},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this},clampScalar:function(){var e,t;return function(n,r){return void 0===e&&(e=new i,t=new i),e.set(n,n),t.set(r,r),this.clamp(e,t)}}(),clampLength:function(e,t){var i=this.length();return this.multiplyScalar(Math.max(e,Math.min(t,i))/i)},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this},negate:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(e){return this.x*e.x+this.y*e.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length())},angle:function(){var e=Math.atan2(this.y,this.x);return 0>e&&(e+=2*Math.PI),e},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,i=this.y-e.y;return t*t+i*i},distanceToManhattan:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)},setLength:function(e){return this.multiplyScalar(e/this.length())},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this},lerpVectors:function(e,t,i){return this.subVectors(t,e).multiplyScalar(i).add(e)},equals:function(e){return e.x===this.x&&e.y===this.y},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e},fromBufferAttribute:function(e,t,i){return void 0!==i&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this},rotateAround:function(e,t){var i=Math.cos(t),n=Math.sin(t),r=this.x-e.x,a=this.y-e.y;return this.x=r*i-a*n+e.x,this.y=r*n+a*i+e.y,this}};var ps=0;n.DEFAULT_IMAGE=void 0,n.DEFAULT_MAPPING=Ja,n.prototype={constructor:n,isTexture:!0,set needsUpdate(e){e===!0&&this.version++},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.image=e.image,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.encoding=e.encoding,this},toJSON:function(e){function t(e){var t;return void 0!==e.toDataURL?t=e:(t=document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),t.width=e.width,t.height=e.height,t.getContext("2d").drawImage(e,0,0,e.width,e.height)),t.width>2048||t.height>2048?t.toDataURL("image/jpeg",.6):t.toDataURL("image/png")}if(void 0!==e.textures[this.uuid])return e.textures[this.uuid];var i={metadata:{version:4.4,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],wrap:[this.wrapS,this.wrapT],minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY};if(void 0!==this.image){var n=this.image;void 0===n.uuid&&(n.uuid=us.generateUUID()),void 0===e.images[n.uuid]&&(e.images[n.uuid]={uuid:n.uuid,url:t(n)}),i.image=n.uuid}return e.textures[this.uuid]=i,i},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(e){if(this.mapping===Ja){if(e.multiply(this.repeat),e.add(this.offset),e.x<0||e.x>1)switch(this.wrapS){case ro:e.x=e.x-Math.floor(e.x);break;case ao:e.x=e.x<0?0:1;break;case oo:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case ro:e.y=e.y-Math.floor(e.y);break;case ao:e.y=e.y<0?0:1;break;case oo:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y)}this.flipY&&(e.y=1-e.y)}}},Object.assign(n.prototype,t.prototype),r.prototype={constructor:r,isVector4:!0,set:function(e,t,i,n){return this.x=e,this.y=t,this.z=i,this.w=n,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this.w=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setW:function(e){return this.w=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this},multiplyScalar:function(e){return isFinite(e)?(this.x*=e,this.y*=e,this.z*=e,this.w*=e):(this.x=0,this.y=0,this.z=0,this.w=0),this},applyMatrix4:function(e){var t=this.x,i=this.y,n=this.z,r=this.w,a=e.elements;return this.x=a[0]*t+a[4]*i+a[8]*n+a[12]*r,this.y=a[1]*t+a[5]*i+a[9]*n+a[13]*r,this.z=a[2]*t+a[6]*i+a[10]*n+a[14]*r,this.w=a[3]*t+a[7]*i+a[11]*n+a[15]*r,this},divideScalar:function(e){return this.multiplyScalar(1/e)},setAxisAngleFromQuaternion:function(e){this.w=2*Math.acos(e.w);var t=Math.sqrt(1-e.w*e.w);return 1e-4>t?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this},setAxisAngleFromRotationMatrix:function(e){var t,i,n,r,a=.01,o=.1,s=e.elements,c=s[0],h=s[4],l=s[8],u=s[1],p=s[5],d=s[9],f=s[2],m=s[6],g=s[10];if(Math.abs(h-u)<a&&Math.abs(l-f)<a&&Math.abs(d-m)<a){if(Math.abs(h+u)<o&&Math.abs(l+f)<o&&Math.abs(d+m)<o&&Math.abs(c+p+g-3)<o)return this.set(1,0,0,0),this;t=Math.PI;var v=(c+1)/2,y=(p+1)/2,x=(g+1)/2,_=(h+u)/4,b=(l+f)/4,w=(d+m)/4;return v>y&&v>x?a>v?(i=0,n=.707106781,r=.707106781):(i=Math.sqrt(v),n=_/i,r=b/i):y>x?a>y?(i=.707106781,n=0,r=.707106781):(n=Math.sqrt(y),i=_/n,r=w/n):a>x?(i=.707106781,n=.707106781,r=0):(r=Math.sqrt(x),i=b/r,n=w/r),this.set(i,n,r,t),this}var M=Math.sqrt((m-d)*(m-d)+(l-f)*(l-f)+(u-h)*(u-h));return Math.abs(M)<.001&&(M=1),this.x=(m-d)/M,this.y=(l-f)/M,this.z=(u-h)/M,this.w=Math.acos((c+p+g-1)/2),this},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),
6
+ this.w=Math.max(this.w,e.w),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this},clampScalar:function(){var e,t;return function(i,n){return void 0===e&&(e=new r,t=new r),e.set(i,i,i,i),t.set(n,n,n,n),this.clamp(e,t)}}(),floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.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)},lengthManhattan: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())},setLength:function(e){return this.multiplyScalar(e/this.length())},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this},lerpVectors:function(e,t,i){return this.subVectors(t,e).multiplyScalar(i).add(e)},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e},fromBufferAttribute:function(e,t,i){return void 0!==i&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}},a.prototype={constructor:a,isWebGLRenderTarget:!0,setSize:function(e,t){(this.width!==e||this.height!==t)&&(this.width=e,this.height=t,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.width=e.width,this.height=e.height,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.depthTexture=e.depthTexture,this},dispose:function(){this.dispatchEvent({type:"dispose"})}},Object.assign(a.prototype,t.prototype),o.prototype=Object.create(a.prototype),o.prototype.constructor=o,o.prototype.isWebGLRenderTargetCube=!0,s.prototype={constructor:s,get x(){return this._x},set x(e){this._x=e,this.onChangeCallback()},get y(){return this._y},set y(e){this._y=e,this.onChangeCallback()},get z(){return this._z},set z(e){this._z=e,this.onChangeCallback()},get w(){return this._w},set w(e){this._w=e,this.onChangeCallback()},set:function(e,t,i,n){return this._x=e,this._y=t,this._z=i,this._w=n,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this.onChangeCallback(),this},setFromEuler:function(e,t){if((e&&e.isEuler)===!1)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var i=Math.cos(e._x/2),n=Math.cos(e._y/2),r=Math.cos(e._z/2),a=Math.sin(e._x/2),o=Math.sin(e._y/2),s=Math.sin(e._z/2),c=e.order;return"XYZ"===c?(this._x=a*n*r+i*o*s,this._y=i*o*r-a*n*s,this._z=i*n*s+a*o*r,this._w=i*n*r-a*o*s):"YXZ"===c?(this._x=a*n*r+i*o*s,this._y=i*o*r-a*n*s,this._z=i*n*s-a*o*r,this._w=i*n*r+a*o*s):"ZXY"===c?(this._x=a*n*r-i*o*s,this._y=i*o*r+a*n*s,this._z=i*n*s+a*o*r,this._w=i*n*r-a*o*s):"ZYX"===c?(this._x=a*n*r-i*o*s,this._y=i*o*r+a*n*s,this._z=i*n*s-a*o*r,this._w=i*n*r+a*o*s):"YZX"===c?(this._x=a*n*r+i*o*s,this._y=i*o*r+a*n*s,this._z=i*n*s-a*o*r,this._w=i*n*r-a*o*s):"XZY"===c&&(this._x=a*n*r-i*o*s,this._y=i*o*r-a*n*s,this._z=i*n*s+a*o*r,this._w=i*n*r+a*o*s),t!==!1&&this.onChangeCallback(),this},setFromAxisAngle:function(e,t){var i=t/2,n=Math.sin(i);return this._x=e.x*n,this._y=e.y*n,this._z=e.z*n,this._w=Math.cos(i),this.onChangeCallback(),this},setFromRotationMatrix:function(e){var t,i=e.elements,n=i[0],r=i[4],a=i[8],o=i[1],s=i[5],c=i[9],h=i[2],l=i[6],u=i[10],p=n+s+u;return p>0?(t=.5/Math.sqrt(p+1),this._w=.25/t,this._x=(l-c)*t,this._y=(a-h)*t,this._z=(o-r)*t):n>s&&n>u?(t=2*Math.sqrt(1+n-s-u),this._w=(l-c)/t,this._x=.25*t,this._y=(r+o)/t,this._z=(a+h)/t):s>u?(t=2*Math.sqrt(1+s-n-u),this._w=(a-h)/t,this._x=(r+o)/t,this._y=.25*t,this._z=(c+l)/t):(t=2*Math.sqrt(1+u-n-s),this._w=(o-r)/t,this._x=(a+h)/t,this._y=(c+l)/t,this._z=.25*t),this.onChangeCallback(),this},setFromUnitVectors:function(){var e,t,i=1e-6;return function(n,r){return void 0===e&&(e=new c),t=n.dot(r)+1,i>t?(t=0,Math.abs(n.x)>Math.abs(n.z)?e.set(-n.y,n.x,0):e.set(0,-n.z,n.y)):e.crossVectors(n,r),this._x=e.x,this._y=e.y,this._z=e.z,this._w=t,this.normalize()}}(),inverse:function(){return this.conjugate().normalize()},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this.onChangeCallback(),this},dot:function(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._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 e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this.onChangeCallback(),this},multiply:function(e,t){return void 0!==t?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(e,t)):this.multiplyQuaternions(this,e)},premultiply:function(e){return this.multiplyQuaternions(e,this)},multiplyQuaternions:function(e,t){var i=e._x,n=e._y,r=e._z,a=e._w,o=t._x,s=t._y,c=t._z,h=t._w;return this._x=i*h+a*o+n*c-r*s,this._y=n*h+a*s+r*o-i*c,this._z=r*h+a*c+i*s-n*o,this._w=a*h-i*o-n*s-r*c,this.onChangeCallback(),this},slerp:function(e,t){if(0===t)return this;if(1===t)return this.copy(e);var i=this._x,n=this._y,r=this._z,a=this._w,o=a*e._w+i*e._x+n*e._y+r*e._z;if(0>o?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=a,this._x=i,this._y=n,this._z=r,this;var s=Math.sqrt(1-o*o);if(Math.abs(s)<.001)return this._w=.5*(a+this._w),this._x=.5*(i+this._x),this._y=.5*(n+this._y),this._z=.5*(r+this._z),this;var c=Math.atan2(s,o),h=Math.sin((1-t)*c)/s,l=Math.sin(t*c)/s;return this._w=a*h+this._w*l,this._x=i*h+this._x*l,this._y=n*h+this._y*l,this._z=r*h+this._z*l,this.onChangeCallback(),this},equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w},fromArray:function(e,t){return void 0===t&&(t=0),this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this.onChangeCallback(),this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e},onChange:function(e){return this.onChangeCallback=e,this},onChangeCallback:function(){}},Object.assign(s,{slerp:function(e,t,i,n){return i.copy(e).slerp(t,n)},slerpFlat:function(e,t,i,n,r,a,o){var s=i[n+0],c=i[n+1],h=i[n+2],l=i[n+3],u=r[a+0],p=r[a+1],d=r[a+2],f=r[a+3];if(l!==f||s!==u||c!==p||h!==d){var m=1-o,g=s*u+c*p+h*d+l*f,v=g>=0?1:-1,y=1-g*g;if(y>Number.EPSILON){var x=Math.sqrt(y),_=Math.atan2(x,g*v);m=Math.sin(m*_)/x,o=Math.sin(o*_)/x}var b=o*v;if(s=s*m+u*b,c=c*m+p*b,h=h*m+d*b,l=l*m+f*b,m===1-o){var w=1/Math.sqrt(s*s+c*c+h*h+l*l);s*=w,c*=w,h*=w,l*=w}}e[t]=s,e[t+1]=c,e[t+2]=h,e[t+3]=l}}),c.prototype={constructor:c,isVector3:!0,set:function(e,t,i){return this.x=e,this.y=t,this.z=i,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this},multiply:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(e,t)):(this.x*=e.x,this.y*=e.y,this.z*=e.z,this)},multiplyScalar:function(e){return isFinite(e)?(this.x*=e,this.y*=e,this.z*=e):(this.x=0,this.y=0,this.z=0),this},multiplyVectors:function(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this},applyEuler:function(){var e;return function(t){return(t&&t.isEuler)===!1&&console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),void 0===e&&(e=new s),this.applyQuaternion(e.setFromEuler(t))}}(),applyAxisAngle:function(){var e;return function(t,i){return void 0===e&&(e=new s),this.applyQuaternion(e.setFromAxisAngle(t,i))}}(),applyMatrix3:function(e){var t=this.x,i=this.y,n=this.z,r=e.elements;return this.x=r[0]*t+r[3]*i+r[6]*n,this.y=r[1]*t+r[4]*i+r[7]*n,this.z=r[2]*t+r[5]*i+r[8]*n,this},applyMatrix4:function(e){var t=this.x,i=this.y,n=this.z,r=e.elements;this.x=r[0]*t+r[4]*i+r[8]*n+r[12],this.y=r[1]*t+r[5]*i+r[9]*n+r[13],this.z=r[2]*t+r[6]*i+r[10]*n+r[14];var a=r[3]*t+r[7]*i+r[11]*n+r[15];return this.divideScalar(a)},applyQuaternion:function(e){var t=this.x,i=this.y,n=this.z,r=e.x,a=e.y,o=e.z,s=e.w,c=s*t+a*n-o*i,h=s*i+o*t-r*n,l=s*n+r*i-a*t,u=-r*t-a*i-o*n;return this.x=c*s+u*-r+h*-o-l*-a,this.y=h*s+u*-a+l*-r-c*-o,this.z=l*s+u*-o+c*-a-h*-r,this},project:function(){var e;return function(t){return void 0===e&&(e=new h),e.multiplyMatrices(t.projectionMatrix,e.getInverse(t.matrixWorld)),this.applyMatrix4(e)}}(),unproject:function(){var e;return function(t){return void 0===e&&(e=new h),e.multiplyMatrices(t.matrixWorld,e.getInverse(t.projectionMatrix)),this.applyMatrix4(e)}}(),transformDirection:function(e){var t=this.x,i=this.y,n=this.z,r=e.elements;return this.x=r[0]*t+r[4]*i+r[8]*n,this.y=r[1]*t+r[5]*i+r[9]*n,this.z=r[2]*t+r[6]*i+r[10]*n,this.normalize()},divide:function(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this},divideScalar:function(e){return this.multiplyScalar(1/e)},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this},clampScalar:function(){var e,t;return function(i,n){return void 0===e&&(e=new c,t=new c),e.set(i,i,i),t.set(n,n,n),this.clamp(e,t)}}(),clampLength:function(e,t){var i=this.length();return this.multiplyScalar(Math.max(e,Math.min(t,i))/i)},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.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)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length())},setLength:function(e){return this.multiplyScalar(e/this.length())},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this},lerpVectors:function(e,t,i){return this.subVectors(t,e).multiplyScalar(i).add(e)},cross:function(e,t){if(void 0!==t)return console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(e,t);var i=this.x,n=this.y,r=this.z;return this.x=n*e.z-r*e.y,this.y=r*e.x-i*e.z,this.z=i*e.y-n*e.x,this},crossVectors:function(e,t){var i=e.x,n=e.y,r=e.z,a=t.x,o=t.y,s=t.z;return this.x=n*s-r*o,this.y=r*a-i*s,this.z=i*o-n*a,this},projectOnVector:function(e){var t=e.dot(this)/e.lengthSq();return this.copy(e).multiplyScalar(t)},projectOnPlane:function(){var e;return function(t){return void 0===e&&(e=new c),e.copy(this).projectOnVector(t),this.sub(e)}}(),reflect:function(){var e;return function(t){return void 0===e&&(e=new c),this.sub(e.copy(t).multiplyScalar(2*this.dot(t)))}}(),angleTo:function(e){var t=this.dot(e)/Math.sqrt(this.lengthSq()*e.lengthSq());return Math.acos(us.clamp(t,-1,1))},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,i=this.y-e.y,n=this.z-e.z;return t*t+i*i+n*n},distanceToManhattan:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)},setFromSpherical:function(e){var t=Math.sin(e.phi)*e.radius;return this.x=t*Math.sin(e.theta),this.y=Math.cos(e.phi)*e.radius,this.z=t*Math.cos(e.theta),this},setFromCylindrical:function(e){return this.x=e.radius*Math.sin(e.theta),this.y=e.y,this.z=e.radius*Math.cos(e.theta),this},setFromMatrixPosition:function(e){return this.setFromMatrixColumn(e,3)},setFromMatrixScale:function(e){var t=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),n=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,this.z=n,this},setFromMatrixColumn:function(e,t){if("number"==typeof e){console.warn("THREE.Vector3: setFromMatrixColumn now expects ( matrix, index ).");var i=e;e=t,t=i}return this.fromArray(e.elements,4*t)},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e},fromBufferAttribute:function(e,t,i){return void 0!==i&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}},h.prototype={constructor:h,isMatrix4:!0,set:function(e,t,i,n,r,a,o,s,c,h,l,u,p,d,f,m){var g=this.elements;return g[0]=e,g[4]=t,g[8]=i,g[12]=n,g[1]=r,g[5]=a,g[9]=o,g[13]=s,g[2]=c,g[6]=h,g[10]=l,g[14]=u,g[3]=p,g[7]=d,g[11]=f,g[15]=m,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},clone:function(){return(new h).fromArray(this.elements)},copy:function(e){return this.elements.set(e.elements),this},copyPosition:function(e){var t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[14],this},extractBasis:function(e,t,i){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this},makeBasis:function(e,t,i){return this.set(e.x,t.x,i.x,0,e.y,t.y,i.y,0,e.z,t.z,i.z,0,0,0,0,1),this},extractRotation:function(){var e;return function(t){void 0===e&&(e=new c);var i=this.elements,n=t.elements,r=1/e.setFromMatrixColumn(t,0).length(),a=1/e.setFromMatrixColumn(t,1).length(),o=1/e.setFromMatrixColumn(t,2).length();return i[0]=n[0]*r,i[1]=n[1]*r,i[2]=n[2]*r,i[4]=n[4]*a,i[5]=n[5]*a,i[6]=n[6]*a,i[8]=n[8]*o,i[9]=n[9]*o,i[10]=n[10]*o,this}}(),makeRotationFromEuler:function(e){(e&&e.isEuler)===!1&&console.error("THREE.Matrix: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var t=this.elements,i=e.x,n=e.y,r=e.z,a=Math.cos(i),o=Math.sin(i),s=Math.cos(n),c=Math.sin(n),h=Math.cos(r),l=Math.sin(r);if("XYZ"===e.order){var u=a*h,p=a*l,d=o*h,f=o*l;t[0]=s*h,t[4]=-s*l,t[8]=c,t[1]=p+d*c,t[5]=u-f*c,t[9]=-o*s,t[2]=f-u*c,t[6]=d+p*c,t[10]=a*s}else if("YXZ"===e.order){var m=s*h,g=s*l,v=c*h,y=c*l;t[0]=m+y*o,t[4]=v*o-g,t[8]=a*c,t[1]=a*l,t[5]=a*h,t[9]=-o,t[2]=g*o-v,t[6]=y+m*o,t[10]=a*s}else if("ZXY"===e.order){var m=s*h,g=s*l,v=c*h,y=c*l;t[0]=m-y*o,t[4]=-a*l,t[8]=v+g*o,t[1]=g+v*o,t[5]=a*h,t[9]=y-m*o,t[2]=-a*c,t[6]=o,t[10]=a*s}else if("ZYX"===e.order){var u=a*h,p=a*l,d=o*h,f=o*l;t[0]=s*h,t[4]=d*c-p,t[8]=u*c+f,t[1]=s*l,t[5]=f*c+u,t[9]=p*c-d,t[2]=-c,t[6]=o*s,t[10]=a*s}else if("YZX"===e.order){var x=a*s,_=a*c,b=o*s,w=o*c;t[0]=s*h,t[4]=w-x*l,t[8]=b*l+_,t[1]=l,t[5]=a*h,t[9]=-o*h,t[2]=-c*h,t[6]=_*l+b,t[10]=x-w*l}else if("XZY"===e.order){var x=a*s,_=a*c,b=o*s,w=o*c;t[0]=s*h,t[4]=-l,t[8]=c*h,t[1]=x*l+w,t[5]=a*h,t[9]=_*l-b,t[2]=b*l-_,t[6]=o*h,t[10]=w*l+x}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},makeRotationFromQuaternion:function(e){var t=this.elements,i=e.x,n=e.y,r=e.z,a=e.w,o=i+i,s=n+n,c=r+r,h=i*o,l=i*s,u=i*c,p=n*s,d=n*c,f=r*c,m=a*o,g=a*s,v=a*c;return t[0]=1-(p+f),t[4]=l-v,t[8]=u+g,t[1]=l+v,t[5]=1-(h+f),t[9]=d-m,t[2]=u-g,t[6]=d+m,t[10]=1-(h+p),t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},lookAt:function(){var e,t,i;return function(n,r,a){void 0===e&&(e=new c,t=new c,i=new c);var o=this.elements;return i.subVectors(n,r).normalize(),0===i.lengthSq()&&(i.z=1),e.crossVectors(a,i).normalize(),0===e.lengthSq()&&(i.z+=1e-4,e.crossVectors(a,i).normalize()),t.crossVectors(i,e),o[0]=e.x,o[4]=t.x,o[8]=i.x,o[1]=e.y,o[5]=t.y,o[9]=i.y,o[2]=e.z,o[6]=t.z,o[10]=i.z,this}}(),multiply:function(e,t){return void 0!==t?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(e,t)):this.multiplyMatrices(this,e)},premultiply:function(e){return this.multiplyMatrices(e,this)},multiplyMatrices:function(e,t){var i=e.elements,n=t.elements,r=this.elements,a=i[0],o=i[4],s=i[8],c=i[12],h=i[1],l=i[5],u=i[9],p=i[13],d=i[2],f=i[6],m=i[10],g=i[14],v=i[3],y=i[7],x=i[11],_=i[15],b=n[0],w=n[4],M=n[8],E=n[12],T=n[1],S=n[5],A=n[9],L=n[13],R=n[2],P=n[6],C=n[10],I=n[14],U=n[3],N=n[7],D=n[11],O=n[15];return r[0]=a*b+o*T+s*R+c*U,r[4]=a*w+o*S+s*P+c*N,r[8]=a*M+o*A+s*C+c*D,r[12]=a*E+o*L+s*I+c*O,r[1]=h*b+l*T+u*R+p*U,r[5]=h*w+l*S+u*P+p*N,r[9]=h*M+l*A+u*C+p*D,r[13]=h*E+l*L+u*I+p*O,r[2]=d*b+f*T+m*R+g*U,r[6]=d*w+f*S+m*P+g*N,r[10]=d*M+f*A+m*C+g*D,r[14]=d*E+f*L+m*I+g*O,r[3]=v*b+y*T+x*R+_*U,r[7]=v*w+y*S+x*P+_*N,r[11]=v*M+y*A+x*C+_*D,r[15]=v*E+y*L+x*I+_*O,this},multiplyToArray:function(e,t,i){var n=this.elements;return this.multiplyMatrices(e,t),i[0]=n[0],i[1]=n[1],i[2]=n[2],i[3]=n[3],i[4]=n[4],i[5]=n[5],i[6]=n[6],i[7]=n[7],i[8]=n[8],i[9]=n[9],i[10]=n[10],i[11]=n[11],i[12]=n[12],i[13]=n[13],i[14]=n[14],i[15]=n[15],this},multiplyScalar:function(e){var t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this},applyToBufferAttribute:function(){var e;return function(t){void 0===e&&(e=new c);for(var i=0,n=t.count;n>i;i++)e.x=t.getX(i),e.y=t.getY(i),e.z=t.getZ(i),e.applyMatrix4(this),t.setXYZ(i,e.x,e.y,e.z);return t}}(),determinant:function(){var e=this.elements,t=e[0],i=e[4],n=e[8],r=e[12],a=e[1],o=e[5],s=e[9],c=e[13],h=e[2],l=e[6],u=e[10],p=e[14],d=e[3],f=e[7],m=e[11],g=e[15];return d*(+r*s*l-n*c*l-r*o*u+i*c*u+n*o*p-i*s*p)+f*(+t*s*p-t*c*u+r*a*u-n*a*p+n*c*h-r*s*h)+m*(+t*c*l-t*o*p-r*a*l+i*a*p+r*o*h-i*c*h)+g*(-n*o*h-t*s*l+t*o*u+n*a*l-i*a*u+i*s*h)},transpose:function(){var e,t=this.elements;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this},setPosition:function(e){var t=this.elements;return t[12]=e.x,t[13]=e.y,t[14]=e.z,this},getInverse:function(e,t){var i=this.elements,n=e.elements,r=n[0],a=n[1],o=n[2],s=n[3],c=n[4],h=n[5],l=n[6],u=n[7],p=n[8],d=n[9],f=n[10],m=n[11],g=n[12],v=n[13],y=n[14],x=n[15],_=d*y*u-v*f*u+v*l*m-h*y*m-d*l*x+h*f*x,b=g*f*u-p*y*u-g*l*m+c*y*m+p*l*x-c*f*x,w=p*v*u-g*d*u+g*h*m-c*v*m-p*h*x+c*d*x,M=g*d*l-p*v*l-g*h*f+c*v*f+p*h*y-c*d*y,E=r*_+a*b+o*w+s*M;if(0===E){var T="THREE.Matrix4.getInverse(): can't invert matrix, determinant is 0";if(t===!0)throw new Error(T);return console.warn(T),this.identity()}var S=1/E;return i[0]=_*S,i[1]=(v*f*s-d*y*s-v*o*m+a*y*m+d*o*x-a*f*x)*S,i[2]=(h*y*s-v*l*s+v*o*u-a*y*u-h*o*x+a*l*x)*S,i[3]=(d*l*s-h*f*s-d*o*u+a*f*u+h*o*m-a*l*m)*S,i[4]=b*S,i[5]=(p*y*s-g*f*s+g*o*m-r*y*m-p*o*x+r*f*x)*S,i[6]=(g*l*s-c*y*s-g*o*u+r*y*u+c*o*x-r*l*x)*S,i[7]=(c*f*s-p*l*s+p*o*u-r*f*u-c*o*m+r*l*m)*S,i[8]=w*S,i[9]=(g*d*s-p*v*s-g*a*m+r*v*m+p*a*x-r*d*x)*S,i[10]=(c*v*s-g*h*s+g*a*u-r*v*u-c*a*x+r*h*x)*S,i[11]=(p*h*s-c*d*s-p*a*u+r*d*u+c*a*m-r*h*m)*S,i[12]=M*S,i[13]=(p*v*o-g*d*o+g*a*f-r*v*f-p*a*y+r*d*y)*S,i[14]=(g*h*o-c*v*o-g*a*l+r*v*l+c*a*y-r*h*y)*S,i[15]=(c*d*o-p*h*o+p*a*l-r*d*l-c*a*f+r*h*f)*S,this},scale:function(e){var t=this.elements,i=e.x,n=e.y,r=e.z;return t[0]*=i,t[4]*=n,t[8]*=r,t[1]*=i,t[5]*=n,t[9]*=r,t[2]*=i,t[6]*=n,t[10]*=r,t[3]*=i,t[7]*=n,t[11]*=r,this},getMaxScaleOnAxis:function(){var e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],n=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,i,n))},makeTranslation:function(e,t,i){return this.set(1,0,0,e,0,1,0,t,0,0,1,i,0,0,0,1),this},makeRotationX:function(e){var t=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,t,-i,0,0,i,t,0,0,0,0,1),this},makeRotationY:function(e){var t=Math.cos(e),i=Math.sin(e);return this.set(t,0,i,0,0,1,0,0,-i,0,t,0,0,0,0,1),this},makeRotationZ:function(e){var t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,0,i,t,0,0,0,0,1,0,0,0,0,1),this},makeRotationAxis:function(e,t){var i=Math.cos(t),n=Math.sin(t),r=1-i,a=e.x,o=e.y,s=e.z,c=r*a,h=r*o;return this.set(c*a+i,c*o-n*s,c*s+n*o,0,c*o+n*s,h*o+i,h*s-n*a,0,c*s-n*o,h*s+n*a,r*s*s+i,0,0,0,0,1),this},makeScale:function(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this},makeShear:function(e,t,i){return this.set(1,t,i,0,e,1,i,0,e,t,1,0,0,0,0,1),this},compose:function(e,t,i){return this.makeRotationFromQuaternion(t),this.scale(i),this.setPosition(e),this},decompose:function(){var e,t;return function(i,n,r){void 0===e&&(e=new c,t=new h);var a=this.elements,o=e.set(a[0],a[1],a[2]).length(),s=e.set(a[4],a[5],a[6]).length(),l=e.set(a[8],a[9],a[10]).length(),u=this.determinant();0>u&&(o=-o),i.x=a[12],i.y=a[13],i.z=a[14],t.elements.set(this.elements);var p=1/o,d=1/s,f=1/l;return t.elements[0]*=p,t.elements[1]*=p,t.elements[2]*=p,t.elements[4]*=d,t.elements[5]*=d,t.elements[6]*=d,t.elements[8]*=f,t.elements[9]*=f,t.elements[10]*=f,n.setFromRotationMatrix(t),r.x=o,r.y=s,r.z=l,this}}(),makePerspective:function(e,t,i,n,r,a){void 0===a&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");var o=this.elements,s=2*r/(t-e),c=2*r/(i-n),h=(t+e)/(t-e),l=(i+n)/(i-n),u=-(a+r)/(a-r),p=-2*a*r/(a-r);return o[0]=s,o[4]=0,o[8]=h,o[12]=0,o[1]=0,o[5]=c,o[9]=l,o[13]=0,o[2]=0,o[6]=0,o[10]=u,o[14]=p,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this},makeOrthographic:function(e,t,i,n,r,a){var o=this.elements,s=1/(t-e),c=1/(i-n),h=1/(a-r),l=(t+e)*s,u=(i+n)*c,p=(a+r)*h;return o[0]=2*s,o[4]=0,o[8]=0,o[12]=-l,o[1]=0,o[5]=2*c,o[9]=0,o[13]=-u,o[2]=0,o[6]=0,o[10]=-2*h,o[14]=-p,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this},equals:function(e){for(var t=this.elements,i=e.elements,n=0;16>n;n++)if(t[n]!==i[n])return!1;return!0},fromArray:function(e,t){void 0===t&&(t=0);for(var i=0;16>i;i++)this.elements[i]=e[i+t];return this},toArray:function(e,t){void 0===e&&(e=[]),void 0===t&&(t=0);var i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],e}},l.prototype=Object.create(n.prototype),l.prototype.constructor=l,l.prototype.isCubeTexture=!0,Object.defineProperty(l.prototype,"images",{get:function(){return this.image},set:function(e){this.image=e}});var ds=new n,fs=new l,ms=[],gs=[];H.prototype.setValue=function(e,t){for(var i=this.seq,n=0,r=i.length;n!==r;++n){var a=i[n];a.setValue(e,t[a.id])}};var vs=/([\w\d_]+)(\])?(\[|\.)?/g;j.prototype.setValue=function(e,t,i){var n=this.map[t];void 0!==n&&n.setValue(e,i,this.renderer)},j.prototype.set=function(e,t,i){var n=this.map[i];void 0!==n&&n.setValue(e,t[i],this.renderer)},j.prototype.setOptional=function(e,t,i){var n=t[i];void 0!==n&&this.setValue(e,i,n)},j.upload=function(e,t,i,n){for(var r=0,a=t.length;r!==a;++r){var o=t[r],s=i[o.id];s.needsUpdate!==!1&&o.setValue(e,s.value,n)}},j.seqWithValue=function(e,t){for(var i=[],n=0,r=e.length;n!==r;++n){var a=e[n];a.id in t&&i.push(a)}return i};var ys={merge:function(e){for(var t={},i=0;i<e.length;i++){var n=this.clone(e[i]);for(var r in n)t[r]=n[r]}return t},clone:function(e){var t={};for(var i in e){t[i]={};for(var n in e[i]){var r=e[i][n];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture)?t[i][n]=r.clone():Array.isArray(r)?t[i][n]=r.slice():t[i][n]=r}}return t}},xs="#ifdef USE_ALPHAMAP\n diffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif\n",_s="#ifdef USE_ALPHAMAP\n uniform sampler2D alphaMap;\n#endif\n",bs="#ifdef ALPHATEST\n if ( diffuseColor.a < ALPHATEST ) discard;\n#endif\n",ws="#ifdef USE_AOMAP\n float ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n reflectedLight.indirectDiffuse *= ambientOcclusion;\n #if defined( USE_ENVMAP ) && defined( PHYSICAL )\n float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\n #endif\n#endif\n",Ms="#ifdef USE_AOMAP\n uniform sampler2D aoMap;\n uniform float aoMapIntensity;\n#endif",Es="\nvec3 transformed = vec3( position );\n",Ts="\nvec3 objectNormal = vec3( normal );\n",Ss="float punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n if( decayExponent > 0.0 ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n float maxDistanceCutoffFactor = pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n return distanceFalloff * maxDistanceCutoffFactor;\n#else\n return pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n#endif\n }\n return 1.0;\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n return RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n float fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n return ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n float a2 = pow2( alpha );\n float gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n float gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n return 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n float a2 = pow2( alpha );\n float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n return 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n float a2 = pow2( alpha );\n float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n return RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n float alpha = pow2( roughness );\n vec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n float dotNL = saturate( dot( geometry.normal, incidentLight.direction ) );\n float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n float dotNH = saturate( dot( geometry.normal, halfDir ) );\n float dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n vec3 F = F_Schlick( specularColor, dotLH );\n float G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n float D = D_GGX( alpha, dotNH );\n return F * ( G * D );\n}\nvec2 ltcTextureCoords( const in GeometricContext geometry, const in float roughness ) {\n const float LUT_SIZE = 64.0;\n const float LUT_SCALE = (LUT_SIZE - 1.0)/LUT_SIZE;\n const float LUT_BIAS = 0.5/LUT_SIZE;\n vec3 N = geometry.normal;\n vec3 V = geometry.viewDir;\n vec3 P = geometry.position;\n float theta = acos( dot( N, V ) );\n vec2 uv = vec2(\n sqrt( saturate( roughness ) ),\n saturate( theta / ( 0.5 * PI ) ) );\n uv = uv * LUT_SCALE + LUT_BIAS;\n return uv;\n}\nvoid clipQuadToHorizon( inout vec3 L[5], out int n ) {\n int config = 0;\n if ( L[0].z > 0.0 ) config += 1;\n if ( L[1].z > 0.0 ) config += 2;\n if ( L[2].z > 0.0 ) config += 4;\n if ( L[3].z > 0.0 ) config += 8;\n n = 0;\n if ( config == 0 ) {\n } else if ( config == 1 ) {\n n = 3;\n L[1] = -L[1].z * L[0] + L[0].z * L[1];\n L[2] = -L[3].z * L[0] + L[0].z * L[3];\n } else if ( config == 2 ) {\n n = 3;\n L[0] = -L[0].z * L[1] + L[1].z * L[0];\n L[2] = -L[2].z * L[1] + L[1].z * L[2];\n } else if ( config == 3 ) {\n n = 4;\n L[2] = -L[2].z * L[1] + L[1].z * L[2];\n L[3] = -L[3].z * L[0] + L[0].z * L[3];\n } else if ( config == 4 ) {\n n = 3;\n L[0] = -L[3].z * L[2] + L[2].z * L[3];\n L[1] = -L[1].z * L[2] + L[2].z * L[1];\n } else if ( config == 5 ) {\n n = 0;\n } else if ( config == 6 ) {\n n = 4;\n L[0] = -L[0].z * L[1] + L[1].z * L[0];\n L[3] = -L[3].z * L[2] + L[2].z * L[3];\n } else if ( config == 7 ) {\n n = 5;\n L[4] = -L[3].z * L[0] + L[0].z * L[3];\n L[3] = -L[3].z * L[2] + L[2].z * L[3];\n } else if ( config == 8 ) {\n n = 3;\n L[0] = -L[0].z * L[3] + L[3].z * L[0];\n L[1] = -L[2].z * L[3] + L[3].z * L[2];\n L[2] = L[3];\n } else if ( config == 9 ) {\n n = 4;\n L[1] = -L[1].z * L[0] + L[0].z * L[1];\n L[2] = -L[2].z * L[3] + L[3].z * L[2];\n } else if ( config == 10 ) {\n n = 0;\n } else if ( config == 11 ) {\n n = 5;\n L[4] = L[3];\n L[3] = -L[2].z * L[3] + L[3].z * L[2];\n L[2] = -L[2].z * L[1] + L[1].z * L[2];\n } else if ( config == 12 ) {\n n = 4;\n L[1] = -L[1].z * L[2] + L[2].z * L[1];\n L[0] = -L[0].z * L[3] + L[3].z * L[0];\n } else if ( config == 13 ) {\n n = 5;\n L[4] = L[3];\n L[3] = L[2];\n L[2] = -L[1].z * L[2] + L[2].z * L[1];\n L[1] = -L[1].z * L[0] + L[0].z * L[1];\n } else if ( config == 14 ) {\n n = 5;\n L[4] = -L[0].z * L[3] + L[3].z * L[0];\n L[0] = -L[0].z * L[1] + L[1].z * L[0];\n } else if ( config == 15 ) {\n n = 4;\n }\n if ( n == 3 )\n L[3] = L[0];\n if ( n == 4 )\n L[4] = L[0];\n}\nfloat integrateLtcBrdfOverRectEdge( vec3 v1, vec3 v2 ) {\n float cosTheta = dot( v1, v2 );\n float theta = acos( cosTheta );\n float res = cross( v1, v2 ).z * ( ( theta > 0.001 ) ? theta / sin( theta ) : 1.0 );\n return res;\n}\nvoid initRectPoints( const in vec3 pos, const in vec3 halfWidth, const in vec3 halfHeight, out vec3 rectPoints[4] ) {\n rectPoints[0] = pos - halfWidth - halfHeight;\n rectPoints[1] = pos + halfWidth - halfHeight;\n rectPoints[2] = pos + halfWidth + halfHeight;\n rectPoints[3] = pos - halfWidth + halfHeight;\n}\nvec3 integrateLtcBrdfOverRect( const in GeometricContext geometry, const in mat3 brdfMat, const in vec3 rectPoints[4] ) {\n vec3 N = geometry.normal;\n vec3 V = geometry.viewDir;\n vec3 P = geometry.position;\n vec3 T1, T2;\n T1 = normalize(V - N * dot( V, N ));\n T2 = - cross( N, T1 );\n mat3 brdfWrtSurface = brdfMat * transpose( mat3( T1, T2, N ) );\n vec3 clippedRect[5];\n clippedRect[0] = brdfWrtSurface * ( rectPoints[0] - P );\n clippedRect[1] = brdfWrtSurface * ( rectPoints[1] - P );\n clippedRect[2] = brdfWrtSurface * ( rectPoints[2] - P );\n clippedRect[3] = brdfWrtSurface * ( rectPoints[3] - P );\n int n;\n clipQuadToHorizon(clippedRect, n);\n if ( n == 0 )\n return vec3( 0, 0, 0 );\n clippedRect[0] = normalize( clippedRect[0] );\n clippedRect[1] = normalize( clippedRect[1] );\n clippedRect[2] = normalize( clippedRect[2] );\n clippedRect[3] = normalize( clippedRect[3] );\n clippedRect[4] = normalize( clippedRect[4] );\n float sum = 0.0;\n sum += integrateLtcBrdfOverRectEdge( clippedRect[0], clippedRect[1] );\n sum += integrateLtcBrdfOverRectEdge( clippedRect[1], clippedRect[2] );\n sum += integrateLtcBrdfOverRectEdge( clippedRect[2], clippedRect[3] );\n if (n >= 4)\n sum += integrateLtcBrdfOverRectEdge( clippedRect[3], clippedRect[4] );\n if (n == 5)\n sum += integrateLtcBrdfOverRectEdge( clippedRect[4], clippedRect[0] );\n sum = max( 0.0, sum );\n vec3 Lo_i = vec3( sum, sum, sum );\n return Lo_i;\n}\nvec3 Rect_Area_Light_Specular_Reflectance(\n const in GeometricContext geometry,\n const in vec3 lightPos, const in vec3 lightHalfWidth, const in vec3 lightHalfHeight,\n const in float roughness,\n const in sampler2D ltcMat, const in sampler2D ltcMag ) {\n vec3 rectPoints[4];\n initRectPoints( lightPos, lightHalfWidth, lightHalfHeight, rectPoints );\n vec2 uv = ltcTextureCoords( geometry, roughness );\n vec4 brdfLtcApproxParams, t;\n brdfLtcApproxParams = texture2D( ltcMat, uv );\n t = texture2D( ltcMat, uv );\n float brdfLtcScalar = texture2D( ltcMag, uv ).a;\n mat3 brdfLtcApproxMat = mat3(\n vec3( 1, 0, t.y ),\n vec3( 0, t.z, 0 ),\n vec3( t.w, 0, t.x )\n );\n vec3 specularReflectance = integrateLtcBrdfOverRect( geometry, brdfLtcApproxMat, rectPoints );\n specularReflectance *= brdfLtcScalar;\n return specularReflectance;\n}\nvec3 Rect_Area_Light_Diffuse_Reflectance(\n const in GeometricContext geometry,\n const in vec3 lightPos, const in vec3 lightHalfWidth, const in vec3 lightHalfHeight ) {\n vec3 rectPoints[4];\n initRectPoints( lightPos, lightHalfWidth, lightHalfHeight, rectPoints );\n mat3 diffuseBrdfMat = mat3(1);\n vec3 diffuseReflectance = integrateLtcBrdfOverRect( geometry, diffuseBrdfMat, rectPoints );\n return diffuseReflectance;\n}\nvec3 BRDF_Specular_GGX_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n vec4 r = roughness * c0 + c1;\n float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n vec2 AB = vec2( -1.04, 1.04 ) * a004 + r.zw;\n return specularColor * AB.x + AB.y;\n}\nfloat G_BlinnPhong_Implicit( ) {\n return 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n return 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 vec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n float dotNH = saturate( dot( geometry.normal, halfDir ) );\n float dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n vec3 F = F_Schlick( specularColor, dotLH );\n float G = G_BlinnPhong_Implicit( );\n float D = D_BlinnPhong( shininess, dotNH );\n return F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n return ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n return sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n",As="#ifdef USE_BUMPMAP\n uniform sampler2D bumpMap;\n uniform float bumpScale;\n vec2 dHdxy_fwd() {\n vec2 dSTdx = dFdx( vUv );\n vec2 dSTdy = dFdy( vUv );\n float Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n float dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n float dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n return vec2( dBx, dBy );\n }\n vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n vec3 vSigmaX = dFdx( surf_pos );\n vec3 vSigmaY = dFdy( surf_pos );\n vec3 vN = surf_norm;\n vec3 R1 = cross( vSigmaY, vN );\n vec3 R2 = cross( vN, vSigmaX );\n float fDet = dot( vSigmaX, R1 );\n vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n return normalize( abs( fDet ) * surf_norm - vGrad );\n }\n#endif\n",Ls="#if NUM_CLIPPING_PLANES > 0\n for ( int i = 0; i < UNION_CLIPPING_PLANES; ++ i ) {\n vec4 plane = clippingPlanes[ i ];\n if ( dot( vViewPosition, plane.xyz ) > plane.w ) discard;\n }\n \n #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n bool clipped = true;\n for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; ++ i ) {\n vec4 plane = clippingPlanes[ i ];\n clipped = ( dot( vViewPosition, plane.xyz ) > plane.w ) && clipped;\n }\n if ( clipped ) discard;\n \n #endif\n#endif\n",Rs="#if NUM_CLIPPING_PLANES > 0\n #if ! defined( PHYSICAL ) && ! defined( PHONG )\n varying vec3 vViewPosition;\n #endif\n uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif\n",Ps="#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n varying vec3 vViewPosition;\n#endif\n",Cs="#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n vViewPosition = - mvPosition.xyz;\n#endif\n",Is="#ifdef USE_COLOR\n diffuseColor.rgb *= vColor;\n#endif",Us="#ifdef USE_COLOR\n varying vec3 vColor;\n#endif\n",Ns="#ifdef USE_COLOR\n varying vec3 vColor;\n#endif",Ds="#ifdef USE_COLOR\n vColor.xyz = color.xyz;\n#endif",Os="#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI_HALF 1.5707963267949\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#define whiteCompliment(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n const highp float a = 12.9898, b = 78.233, c = 43758.5453;\n highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n return fract(sin(sn) * c);\n}\nstruct IncidentLight {\n vec3 color;\n vec3 direction;\n bool visible;\n};\nstruct ReflectedLight {\n vec3 directDiffuse;\n vec3 directSpecular;\n vec3 indirectDiffuse;\n vec3 indirectSpecular;\n};\nstruct GeometricContext {\n vec3 position;\n vec3 normal;\n vec3 viewDir;\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n float distance = dot( planeNormal, point - pointOnPlane );\n return - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n return sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n return lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\nmat3 transpose( const in mat3 v ) {\n mat3 tmp;\n tmp[0] = vec3(v[0].x, v[1].x, v[2].x);\n tmp[1] = vec3(v[0].y, v[1].y, v[2].y);\n tmp[2] = vec3(v[0].z, v[1].z, v[2].z);\n return tmp;\n}\n",Bs="#ifdef ENVMAP_TYPE_CUBE_UV\n#define cubeUV_textureSize (1024.0)\nint getFaceFromDirection(vec3 direction) {\n vec3 absDirection = abs(direction);\n int face = -1;\n if( absDirection.x > absDirection.z ) {\n if(absDirection.x > absDirection.y )\n face = direction.x > 0.0 ? 0 : 3;\n else\n face = direction.y > 0.0 ? 1 : 4;\n }\n else {\n if(absDirection.z > absDirection.y )\n face = direction.z > 0.0 ? 2 : 5;\n else\n face = direction.y > 0.0 ? 1 : 4;\n }\n return face;\n}\n#define cubeUV_maxLods1 (log2(cubeUV_textureSize*0.25) - 1.0)\n#define cubeUV_rangeClamp (exp2((6.0 - 1.0) * 2.0))\nvec2 MipLevelInfo( vec3 vec, float roughnessLevel, float roughness ) {\n float scale = exp2(cubeUV_maxLods1 - roughnessLevel);\n float dxRoughness = dFdx(roughness);\n float dyRoughness = dFdy(roughness);\n vec3 dx = dFdx( vec * scale * dxRoughness );\n vec3 dy = dFdy( vec * scale * dyRoughness );\n float d = max( dot( dx, dx ), dot( dy, dy ) );\n d = clamp(d, 1.0, cubeUV_rangeClamp);\n float mipLevel = 0.5 * log2(d);\n return vec2(floor(mipLevel), fract(mipLevel));\n}\n#define cubeUV_maxLods2 (log2(cubeUV_textureSize*0.25) - 2.0)\n#define cubeUV_rcpTextureSize (1.0 / cubeUV_textureSize)\nvec2 getCubeUV(vec3 direction, float roughnessLevel, float mipLevel) {\n mipLevel = roughnessLevel > cubeUV_maxLods2 - 3.0 ? 0.0 : mipLevel;\n float a = 16.0 * cubeUV_rcpTextureSize;\n vec2 exp2_packed = exp2( vec2( roughnessLevel, mipLevel ) );\n vec2 rcp_exp2_packed = vec2( 1.0 ) / exp2_packed;\n float powScale = exp2_packed.x * exp2_packed.y;\n float scale = rcp_exp2_packed.x * rcp_exp2_packed.y * 0.25;\n float mipOffset = 0.75*(1.0 - rcp_exp2_packed.y) * rcp_exp2_packed.x;\n bool bRes = mipLevel == 0.0;\n scale = bRes && (scale < a) ? a : scale;\n vec3 r;\n vec2 offset;\n int face = getFaceFromDirection(direction);\n float rcpPowScale = 1.0 / powScale;\n if( face == 0) {\n r = vec3(direction.x, -direction.z, direction.y);\n offset = vec2(0.0+mipOffset,0.75 * rcpPowScale);\n offset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n }\n else if( face == 1) {\n r = vec3(direction.y, direction.x, direction.z);\n offset = vec2(scale+mipOffset, 0.75 * rcpPowScale);\n offset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n }\n else if( face == 2) {\n r = vec3(direction.z, direction.x, direction.y);\n offset = vec2(2.0*scale+mipOffset, 0.75 * rcpPowScale);\n offset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n }\n else if( face == 3) {\n r = vec3(direction.x, direction.z, direction.y);\n offset = vec2(0.0+mipOffset,0.5 * rcpPowScale);\n offset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n }\n else if( face == 4) {\n r = vec3(direction.y, direction.x, -direction.z);\n offset = vec2(scale+mipOffset, 0.5 * rcpPowScale);\n offset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n }\n else {\n r = vec3(direction.z, -direction.x, direction.y);\n offset = vec2(2.0*scale+mipOffset, 0.5 * rcpPowScale);\n offset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n }\n r = normalize(r);\n float texelOffset = 0.5 * cubeUV_rcpTextureSize;\n vec2 s = ( r.yz / abs( r.x ) + vec2( 1.0 ) ) * 0.5;\n vec2 base = offset + vec2( texelOffset );\n return base + s * ( scale - 2.0 * texelOffset );\n}\n#define cubeUV_maxLods3 (log2(cubeUV_textureSize*0.25) - 3.0)\nvec4 textureCubeUV(vec3 reflectedDirection, float roughness ) {\n float roughnessVal = roughness* cubeUV_maxLods3;\n float r1 = floor(roughnessVal);\n float r2 = r1 + 1.0;\n float t = fract(roughnessVal);\n vec2 mipInfo = MipLevelInfo(reflectedDirection, r1, roughness);\n float s = mipInfo.y;\n float level0 = mipInfo.x;\n float level1 = level0 + 1.0;\n level1 = level1 > 5.0 ? 5.0 : level1;\n level0 += min( floor( s + 0.5 ), 5.0 );\n vec2 uv_10 = getCubeUV(reflectedDirection, r1, level0);\n vec4 color10 = envMapTexelToLinear(texture2D(envMap, uv_10));\n vec2 uv_20 = getCubeUV(reflectedDirection, r2, level0);\n vec4 color20 = envMapTexelToLinear(texture2D(envMap, uv_20));\n vec4 result = mix(color10, color20, t);\n return vec4(result.rgb, 1.0);\n}\n#endif\n",Fs="#ifdef FLIP_SIDED\n objectNormal = -objectNormal;\n#endif\nvec3 transformedNormal = normalMatrix * objectNormal;\n",zs="#ifdef USE_DISPLACEMENTMAP\n uniform sampler2D displacementMap;\n uniform float displacementScale;\n uniform float displacementBias;\n#endif\n",Gs="#ifdef USE_DISPLACEMENTMAP\n transformed += normal * ( texture2D( displacementMap, uv ).x * displacementScale + displacementBias );\n#endif\n",Hs="#ifdef USE_EMISSIVEMAP\n vec4 emissiveColor = texture2D( emissiveMap, vUv );\n emissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n totalEmissiveRadiance *= emissiveColor.rgb;\n#endif\n",Vs="#ifdef USE_EMISSIVEMAP\n uniform sampler2D emissiveMap;\n#endif\n",ks=" gl_FragColor = linearToOutputTexel( gl_FragColor );\n",js="\nvec4 LinearToLinear( in vec4 value ) {\n return value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n return vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n return vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.w );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n return vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n float maxComponent = max( max( value.r, value.g ), value.b );\n float fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n return vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n return vec4( value.xyz * value.w * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n float maxRGB = max( value.x, max( value.g, value.b ) );\n float M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n M = ceil( M * 255.0 ) / 255.0;\n return vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n return vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n float maxRGB = max( value.x, max( value.g, value.b ) );\n float D = max( maxRange / maxRGB, 1.0 );\n D = min( floor( D ) / 255.0, 1.0 );\n return vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value ) {\n vec3 Xp_Y_XYZp = value.rgb * cLogLuvM;\n Xp_Y_XYZp = max(Xp_Y_XYZp, vec3(1e-6, 1e-6, 1e-6));\n vec4 vResult;\n vResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n float Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n vResult.w = fract(Le);\n vResult.z = (Le - (floor(vResult.w*255.0))/255.0)/255.0;\n return vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n float Le = value.z * 255.0 + value.w;\n vec3 Xp_Y_XYZp;\n Xp_Y_XYZp.y = exp2((Le - 127.0) / 2.0);\n Xp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n Xp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n vec3 vRGB = Xp_Y_XYZp.rgb * cLogLuvInverseM;\n return vec4( max(vRGB, 0.0), 1.0 );\n}\n",Ws="#ifdef USE_ENVMAP\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n vec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n #ifdef ENVMAP_MODE_REFLECTION\n vec3 reflectVec = reflect( cameraToVertex, worldNormal );\n #else\n vec3 reflectVec = refract( cameraToVertex, worldNormal, refractionRatio );\n #endif\n #else\n vec3 reflectVec = vReflect;\n #endif\n #ifdef ENVMAP_TYPE_CUBE\n vec4 envColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n #elif defined( ENVMAP_TYPE_EQUIREC )\n vec2 sampleUV;\n sampleUV.y = saturate( flipNormal * reflectVec.y * 0.5 + 0.5 );\n sampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n vec4 envColor = texture2D( envMap, sampleUV );\n #elif defined( ENVMAP_TYPE_SPHERE )\n vec3 reflectView = flipNormal * normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) );\n vec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n #else\n vec4 envColor = vec4( 0.0 );\n #endif\n envColor = envMapTexelToLinear( envColor );\n #ifdef ENVMAP_BLENDING_MULTIPLY\n outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n #elif defined( ENVMAP_BLENDING_MIX )\n outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n #elif defined( ENVMAP_BLENDING_ADD )\n outgoingLight += envColor.xyz * specularStrength * reflectivity;\n #endif\n#endif\n",Xs="#if defined( USE_ENVMAP ) || defined( PHYSICAL )\n uniform float reflectivity;\n uniform float envMapIntensity;\n#endif\n#ifdef USE_ENVMAP\n #if ! defined( PHYSICAL ) && ( defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) )\n varying vec3 vWorldPosition;\n #endif\n #ifdef ENVMAP_TYPE_CUBE\n uniform samplerCube envMap;\n #else\n uniform sampler2D envMap;\n #endif\n uniform float flipEnvMap;\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( PHYSICAL )\n uniform float refractionRatio;\n #else\n varying vec3 vReflect;\n #endif\n#endif\n",qs="#ifdef USE_ENVMAP\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n varying vec3 vWorldPosition;\n #else\n varying vec3 vReflect;\n uniform float refractionRatio;\n #endif\n#endif\n",Ys="#ifdef USE_ENVMAP\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n vWorldPosition = worldPosition.xyz;\n #else\n vec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n #ifdef ENVMAP_MODE_REFLECTION\n vReflect = reflect( cameraToVertex, worldNormal );\n #else\n vReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n #endif\n #endif\n#endif\n",Zs="\n#ifdef USE_FOG\nfogDepth = -mvPosition.z;\n#endif",Js="#ifdef USE_FOG\n varying float fogDepth;\n#endif\n",Qs="#ifdef USE_FOG\n #ifdef FOG_EXP2\n float fogFactor = whiteCompliment( exp2( - fogDensity * fogDensity * fogDepth * fogDepth * LOG2 ) );\n #else\n float fogFactor = smoothstep( fogNear, fogFar, fogDepth );\n #endif\n gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif\n",Ks="#ifdef USE_FOG\n uniform vec3 fogColor;\n varying float fogDepth;\n #ifdef FOG_EXP2\n uniform float fogDensity;\n #else\n uniform float fogNear;\n uniform float fogFar;\n #endif\n#endif\n",$s="#ifdef TOON\n uniform sampler2D gradientMap;\n vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n float dotNL = dot( normal, lightDirection );\n vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n #ifdef USE_GRADIENTMAP\n return texture2D( gradientMap, coord ).rgb;\n #else\n return ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n #endif\n }\n#endif\n",ec="#ifdef USE_LIGHTMAP\n reflectedLight.indirectDiffuse += PI * texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n#endif\n",tc="#ifdef USE_LIGHTMAP\n uniform sampler2D lightMap;\n uniform float lightMapIntensity;\n#endif",ic="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 );\n#ifdef DOUBLE_SIDED\n vLightBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\n#if NUM_POINT_LIGHTS > 0\n for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n getPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n dotNL = dot( geometry.normal, directLight.direction );\n directLightColor_Diffuse = PI * directLight.color;\n vLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n #ifdef DOUBLE_SIDED\n vLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n #endif\n }\n#endif\n#if NUM_SPOT_LIGHTS > 0\n for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n getSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n dotNL = dot( geometry.normal, directLight.direction );\n directLightColor_Diffuse = PI * directLight.color;\n vLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n #ifdef DOUBLE_SIDED\n vLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n #endif\n }\n#endif\n#if NUM_DIR_LIGHTS > 0\n for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n getDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n dotNL = dot( geometry.normal, directLight.direction );\n directLightColor_Diffuse = PI * directLight.color;\n vLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n #ifdef DOUBLE_SIDED\n vLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n #endif\n }\n#endif\n#if NUM_HEMI_LIGHTS > 0\n for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n vLightFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n #ifdef DOUBLE_SIDED\n vLightBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n #endif\n }\n#endif\n",nc="uniform vec3 ambientLightColor;\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n vec3 irradiance = ambientLightColor;\n #ifndef PHYSICALLY_CORRECT_LIGHTS\n irradiance *= PI;\n #endif\n return irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n struct DirectionalLight {\n vec3 direction;\n vec3 color;\n int shadow;\n float shadowBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n void getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n directLight.color = directionalLight.color;\n directLight.direction = directionalLight.direction;\n directLight.visible = true;\n }\n#endif\n#if NUM_POINT_LIGHTS > 0\n struct PointLight {\n vec3 position;\n vec3 color;\n float distance;\n float decay;\n int shadow;\n float shadowBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n void getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n vec3 lVector = pointLight.position - geometry.position;\n directLight.direction = normalize( lVector );\n float lightDistance = length( lVector );\n directLight.color = pointLight.color;\n directLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n directLight.visible = ( directLight.color != vec3( 0.0 ) );\n }\n#endif\n#if NUM_SPOT_LIGHTS > 0\n struct SpotLight {\n vec3 position;\n vec3 direction;\n vec3 color;\n float distance;\n float decay;\n float coneCos;\n float penumbraCos;\n int shadow;\n float shadowBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n void getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n vec3 lVector = spotLight.position - geometry.position;\n directLight.direction = normalize( lVector );\n float lightDistance = length( lVector );\n float angleCos = dot( directLight.direction, spotLight.direction );\n if ( angleCos > spotLight.coneCos ) {\n float spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n directLight.color = spotLight.color;\n directLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n directLight.visible = true;\n } else {\n directLight.color = vec3( 0.0 );\n directLight.visible = false;\n }\n }\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n struct RectAreaLight {\n vec3 color;\n vec3 position;\n vec3 halfWidth;\n vec3 halfHeight;\n };\n uniform sampler2D ltcMat; uniform sampler2D ltcMag;\n uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n struct HemisphereLight {\n vec3 direction;\n vec3 skyColor;\n vec3 groundColor;\n };\n uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n float dotNL = dot( geometry.normal, hemiLight.direction );\n float hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n #ifndef PHYSICALLY_CORRECT_LIGHTS\n irradiance *= PI;\n #endif\n return irradiance;\n }\n#endif\n#if defined( USE_ENVMAP ) && defined( PHYSICAL )\n vec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n vec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n #ifdef ENVMAP_TYPE_CUBE\n vec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n #ifdef TEXTURE_LOD_EXT\n vec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n #else\n vec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n #endif\n envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n #elif defined( ENVMAP_TYPE_CUBE_UV )\n vec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n vec4 envMapColor = textureCubeUV( queryVec, 1.0 );\n #else\n vec4 envMapColor = vec4( 0.0 );\n #endif\n return PI * envMapColor.rgb * envMapIntensity;\n }\n float getSpecularMIPLevel( const in float blinnShininessExponent, const in int maxMIPLevel ) {\n float maxMIPLevelScalar = float( maxMIPLevel );\n float desiredMIPLevel = maxMIPLevelScalar - 0.79248 - 0.5 * log2( pow2( blinnShininessExponent ) + 1.0 );\n return clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n }\n vec3 getLightProbeIndirectRadiance( const in GeometricContext geometry, const in float blinnShininessExponent, const in int maxMIPLevel ) {\n #ifdef ENVMAP_MODE_REFLECTION\n vec3 reflectVec = reflect( -geometry.viewDir, geometry.normal );\n #else\n vec3 reflectVec = refract( -geometry.viewDir, geometry.normal, refractionRatio );\n #endif\n reflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n float specularMIPLevel = getSpecularMIPLevel( blinnShininessExponent, maxMIPLevel );\n #ifdef ENVMAP_TYPE_CUBE\n vec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n #ifdef TEXTURE_LOD_EXT\n vec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n #else\n vec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n #endif\n envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n #elif defined( ENVMAP_TYPE_CUBE_UV )\n vec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n vec4 envMapColor = textureCubeUV(queryReflectVec, BlinnExponentToGGXRoughness(blinnShininessExponent));\n #elif defined( ENVMAP_TYPE_EQUIREC )\n vec2 sampleUV;\n sampleUV.y = saturate( reflectVec.y * 0.5 + 0.5 );\n sampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n #ifdef TEXTURE_LOD_EXT\n vec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );\n #else\n vec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );\n #endif\n envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n #elif defined( ENVMAP_TYPE_SPHERE )\n vec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0,0.0,1.0 ) );\n #ifdef TEXTURE_LOD_EXT\n vec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n #else\n vec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n #endif\n envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n #endif\n return envMapColor.rgb * envMapIntensity;\n }\n#endif\n",rc="BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;\n",ac="varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n vec3 diffuseColor;\n vec3 specularColor;\n float specularShininess;\n float specularStrength;\n};\n#if NUM_RECT_AREA_LIGHTS > 0\n void RE_Direct_RectArea_BlinnPhong( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n vec3 matDiffColor = material.diffuseColor;\n vec3 matSpecColor = material.specularColor;\n vec3 lightColor = rectAreaLight.color;\n float roughness = BlinnExponentToGGXRoughness( material.specularShininess );\n vec3 spec = Rect_Area_Light_Specular_Reflectance(\n geometry,\n rectAreaLight.position, rectAreaLight.halfWidth, rectAreaLight.halfHeight,\n roughness,\n ltcMat, ltcMag );\n vec3 diff = Rect_Area_Light_Diffuse_Reflectance(\n geometry,\n rectAreaLight.position, rectAreaLight.halfWidth, rectAreaLight.halfHeight );\n reflectedLight.directSpecular += lightColor * matSpecColor * spec / PI2;\n reflectedLight.directDiffuse += lightColor * matDiffColor * diff / PI2;\n }\n#endif\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n #ifdef TOON\n vec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n #else\n float dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n #endif\n #ifndef PHYSICALLY_CORRECT_LIGHTS\n irradiance *= PI;\n #endif\n reflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n reflectedLight.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 reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_BlinnPhong\n#define RE_Direct_RectArea RE_Direct_RectArea_BlinnPhong\n#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material ) (0)\n",oc="PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 );\n#ifdef STANDARD\n material.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#else\n material.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n material.clearCoat = saturate( clearCoat ); material.clearCoatRoughness = clamp( clearCoatRoughness, 0.04, 1.0 );\n#endif\n",sc="struct PhysicalMaterial {\n vec3 diffuseColor;\n float specularRoughness;\n vec3 specularColor;\n #ifndef STANDARD\n float clearCoat;\n float clearCoatRoughness;\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 return 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 void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n vec3 matDiffColor = material.diffuseColor;\n vec3 matSpecColor = material.specularColor;\n vec3 lightColor = rectAreaLight.color;\n float roughness = material.specularRoughness;\n vec3 spec = Rect_Area_Light_Specular_Reflectance(\n geometry,\n rectAreaLight.position, rectAreaLight.halfWidth, rectAreaLight.halfHeight,\n roughness,\n ltcMat, ltcMag );\n vec3 diff = Rect_Area_Light_Diffuse_Reflectance(\n geometry,\n rectAreaLight.position, rectAreaLight.halfWidth, rectAreaLight.halfHeight );\n reflectedLight.directSpecular += lightColor * matSpecColor * spec;\n reflectedLight.directDiffuse += lightColor * matDiffColor * diff;\n }\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n #ifndef PHYSICALLY_CORRECT_LIGHTS\n irradiance *= PI;\n #endif\n #ifndef STANDARD\n float clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n #else\n float clearCoatDHR = 0.0;\n #endif\n reflectedLight.directSpecular += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry, material.specularColor, material.specularRoughness );\n reflectedLight.directDiffuse += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n #ifndef STANDARD\n reflectedLight.directSpecular += irradiance * material.clearCoat * BRDF_Specular_GGX( directLight, geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n #endif\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 clearCoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n #ifndef STANDARD\n float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n float dotNL = dotNV;\n float clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n #else\n float clearCoatDHR = 0.0;\n #endif\n reflectedLight.indirectSpecular += ( 1.0 - clearCoatDHR ) * radiance * BRDF_Specular_GGX_Environment( geometry, material.specularColor, material.specularRoughness );\n #ifndef STANDARD\n reflectedLight.indirectSpecular += clearCoatRadiance * material.clearCoat * BRDF_Specular_GGX_Environment( geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n #endif\n}\n#define RE_Direct RE_Direct_Physical\n#define RE_Direct_RectArea RE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular RE_IndirectSpecular_Physical\n#define Material_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.specularRoughness )\n#define Material_ClearCoat_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.clearCoatRoughness )\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}\n",cc="\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = normalize( vViewPosition );\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n PointLight pointLight;\n for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n pointLight = pointLights[ i ];\n getPointDirectLightIrradiance( pointLight, geometry, directLight );\n #ifdef USE_SHADOWMAP\n directLight.color *= all( bvec2( pointLight.shadow, directLight.visible ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometry, material, reflectedLight );\n }\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n SpotLight spotLight;\n for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n spotLight = spotLights[ i ];\n getSpotDirectLightIrradiance( spotLight, geometry, directLight );\n #ifdef USE_SHADOWMAP\n directLight.color *= all( bvec2( spotLight.shadow, directLight.visible ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometry, material, reflectedLight );\n }\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n DirectionalLight directionalLight;\n for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n directionalLight = directionalLights[ i ];\n getDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n #ifdef USE_SHADOWMAP\n directLight.color *= all( bvec2( directionalLight.shadow, directLight.visible ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometry, material, reflectedLight );\n }\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n RectAreaLight rectAreaLight;\n for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n rectAreaLight = rectAreaLights[ i ];\n RE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n }\n#endif\n#if defined( RE_IndirectDiffuse )\n vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n #ifdef USE_LIGHTMAP\n vec3 lightMapIrradiance = texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n #ifndef PHYSICALLY_CORRECT_LIGHTS\n lightMapIrradiance *= PI;\n #endif\n irradiance += lightMapIrradiance;\n #endif\n #if ( NUM_HEMI_LIGHTS > 0 )\n for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n }\n #endif\n #if defined( USE_ENVMAP ) && defined( PHYSICAL ) && defined( ENVMAP_TYPE_CUBE_UV )\n irradiance += getLightProbeIndirectIrradiance( geometry, 8 );\n #endif\n RE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n vec3 radiance = getLightProbeIndirectRadiance( geometry, Material_BlinnShininessExponent( material ), 8 );\n #ifndef STANDARD\n vec3 clearCoatRadiance = getLightProbeIndirectRadiance( geometry, Material_ClearCoat_BlinnShininessExponent( material ), 8 );\n #else\n vec3 clearCoatRadiance = vec3( 0.0 );\n #endif\n RE_IndirectSpecular( radiance, clearCoatRadiance, geometry, material, reflectedLight );\n#endif\n",hc="#if defined(USE_LOGDEPTHBUF) && defined(USE_LOGDEPTHBUF_EXT)\n gl_FragDepthEXT = log2(vFragDepth) * logDepthBufFC * 0.5;\n#endif",lc="#ifdef USE_LOGDEPTHBUF\n uniform float logDepthBufFC;\n #ifdef USE_LOGDEPTHBUF_EXT\n varying float vFragDepth;\n #endif\n#endif\n",uc="#ifdef USE_LOGDEPTHBUF\n #ifdef USE_LOGDEPTHBUF_EXT\n varying float vFragDepth;\n #endif\n uniform float logDepthBufFC;\n#endif",pc="#ifdef USE_LOGDEPTHBUF\n gl_Position.z = log2(max( EPSILON, gl_Position.w + 1.0 )) * logDepthBufFC;\n #ifdef USE_LOGDEPTHBUF_EXT\n vFragDepth = 1.0 + gl_Position.w;\n #else\n gl_Position.z = (gl_Position.z - 1.0) * gl_Position.w;\n #endif\n#endif\n",dc="#ifdef USE_MAP\n vec4 texelColor = texture2D( map, vUv );\n texelColor = mapTexelToLinear( texelColor );\n diffuseColor *= texelColor;\n#endif\n",fc="#ifdef USE_MAP\n uniform sampler2D map;\n#endif\n",mc="#ifdef USE_MAP\n vec4 mapTexel = texture2D( map, vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y ) * offsetRepeat.zw + offsetRepeat.xy );\n diffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n",gc="#ifdef USE_MAP\n uniform vec4 offsetRepeat;\n uniform sampler2D map;\n#endif\n",vc="float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n vec4 texelMetalness = texture2D( metalnessMap, vUv );\n metalnessFactor *= texelMetalness.r;\n#endif\n",yc="#ifdef USE_METALNESSMAP\n uniform sampler2D metalnessMap;\n#endif",xc="#ifdef USE_MORPHNORMALS\n objectNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\n objectNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\n objectNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\n objectNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\n#endif\n",_c="#ifdef USE_MORPHTARGETS\n #ifndef USE_MORPHNORMALS\n uniform float morphTargetInfluences[ 8 ];\n #else\n uniform float morphTargetInfluences[ 4 ];\n #endif\n#endif",bc="#ifdef USE_MORPHTARGETS\n transformed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\n transformed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\n transformed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\n transformed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n #ifndef USE_MORPHNORMALS\n transformed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\n transformed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\n transformed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\n transformed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n #endif\n#endif\n",wc="#ifdef DOUBLE_SIDED\n float flipNormal = ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n#else\n float flipNormal = 1.0;\n#endif\n",Mc="#ifdef FLAT_SHADED\n vec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n vec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n vec3 normal = normalize( cross( fdx, fdy ) );\n#else\n vec3 normal = normalize( vNormal ) * flipNormal;\n#endif\n#ifdef USE_NORMALMAP\n normal = perturbNormal2Arb( -vViewPosition, normal );\n#elif defined( USE_BUMPMAP )\n normal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif\n",Ec="#ifdef USE_NORMALMAP\n uniform sampler2D normalMap;\n uniform vec2 normalScale;\n vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\n vec3 q0 = dFdx( eye_pos.xyz );\n vec3 q1 = dFdy( eye_pos.xyz );\n vec2 st0 = dFdx( vUv.st );\n vec2 st1 = dFdy( vUv.st );\n vec3 S = normalize( q0 * st1.t - q1 * st0.t );\n vec3 T = normalize( -q0 * st1.s + q1 * st0.s );\n vec3 N = normalize( surf_norm );\n vec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n mapN.xy = normalScale * mapN.xy;\n mat3 tsn = mat3( S, T, N );\n return normalize( tsn * mapN );\n }\n#endif\n",Tc="vec3 packNormalToRGB( const in vec3 normal ) {\n return normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n return 1.0 - 2.0 * rgb.xyz;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n vec4 r = vec4( fract( v * PackFactors ), v );\n r.yzw -= r.xyz * ShiftRight8; return r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n return dot( v, UnpackFactors );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n return ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n return linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n return (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n return ( near * far ) / ( ( far - near ) * invClipZ - far );\n}\n",Sc="#ifdef PREMULTIPLIED_ALPHA\n gl_FragColor.rgb *= gl_FragColor.a;\n#endif\n",Ac="#ifdef USE_SKINNING\n vec4 mvPosition = modelViewMatrix * skinned;\n#else\n vec4 mvPosition = modelViewMatrix * vec4( transformed, 1.0 );\n#endif\ngl_Position = projectionMatrix * mvPosition;\n",Lc="float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n vec4 texelRoughness = texture2D( roughnessMap, vUv );\n roughnessFactor *= texelRoughness.r;\n#endif\n",Rc="#ifdef USE_ROUGHNESSMAP\n uniform sampler2D roughnessMap;\n#endif",Pc="#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHTS > 0\n uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHTS ];\n varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n #endif\n #if NUM_SPOT_LIGHTS > 0\n uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHTS ];\n varying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n #endif\n #if NUM_POINT_LIGHTS > 0\n uniform sampler2D pointShadowMap[ NUM_POINT_LIGHTS ];\n varying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n #endif\n float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n }\n float texture2DShadowLerp( sampler2D depths, vec2 size, vec2 uv, float compare ) {\n const vec2 offset = vec2( 0.0, 1.0 );\n vec2 texelSize = vec2( 1.0 ) / size;\n vec2 centroidUV = floor( uv * size + 0.5 ) / size;\n float lb = texture2DCompare( depths, centroidUV + texelSize * offset.xx, compare );\n float lt = texture2DCompare( depths, centroidUV + texelSize * offset.xy, compare );\n float rb = texture2DCompare( depths, centroidUV + texelSize * offset.yx, compare );\n float rt = texture2DCompare( depths, centroidUV + texelSize * offset.yy, compare );\n vec2 f = fract( uv * size + 0.5 );\n float a = mix( lb, lt, f.y );\n float b = mix( rb, rt, f.y );\n float c = mix( a, b, f.x );\n return c;\n }\n float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n shadowCoord.xyz /= shadowCoord.w;\n shadowCoord.z += shadowBias;\n bvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n bool inFrustum = all( inFrustumVec );\n bvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n bool frustumTest = all( frustumTestVec );\n if ( frustumTest ) {\n #if defined( SHADOWMAP_TYPE_PCF )\n vec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n float dx0 = - texelSize.x * shadowRadius;\n float dy0 = - texelSize.y * shadowRadius;\n float dx1 = + texelSize.x * shadowRadius;\n float dy1 = + texelSize.y * shadowRadius;\n return (\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n ) * ( 1.0 / 9.0 );\n #elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n vec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n float dx0 = - texelSize.x * shadowRadius;\n float dy0 = - texelSize.y * shadowRadius;\n float dx1 = + texelSize.x * shadowRadius;\n float dy1 = + texelSize.y * shadowRadius;\n return (\n texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy, shadowCoord.z ) +\n texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n ) * ( 1.0 / 9.0 );\n #else\n return texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n #endif\n }\n return 1.0;\n }\n vec2 cubeToUV( vec3 v, float texelSizeY ) {\n vec3 absV = abs( v );\n float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n absV *= scaleToCube;\n v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n vec2 planar = v.xy;\n float almostATexel = 1.5 * texelSizeY;\n float almostOne = 1.0 - almostATexel;\n if ( absV.z >= almostOne ) {\n if ( v.z > 0.0 )\n planar.x = 4.0 - v.x;\n } else if ( absV.x >= almostOne ) {\n float signX = sign( v.x );\n planar.x = v.z * signX + 2.0 * signX;\n } else if ( absV.y >= almostOne ) {\n float signY = sign( v.y );\n planar.x = v.x + 2.0 * signY + 2.0;\n planar.y = v.z * signY - 2.0;\n }\n return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n }\n float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n vec3 lightToPosition = shadowCoord.xyz;\n vec3 bd3D = normalize( lightToPosition );\n float dp = ( length( lightToPosition ) - shadowBias ) / 1000.0;\n #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT )\n vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n return (\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n ) * ( 1.0 / 9.0 );\n #else\n return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n #endif\n }\n#endif\n",Cc="#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHTS > 0\n uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHTS ];\n varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n #endif\n #if NUM_SPOT_LIGHTS > 0\n uniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHTS ];\n varying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n #endif\n #if NUM_POINT_LIGHTS > 0\n uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHTS ];\n varying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n #endif\n#endif\n",Ic="#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHTS > 0\n for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\n }\n #endif\n #if NUM_SPOT_LIGHTS > 0\n for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n vSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\n }\n #endif\n #if NUM_POINT_LIGHTS > 0\n for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\n }\n #endif\n#endif\n",Uc="float getShadowMask() {\n float shadow = 1.0;\n #ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHTS > 0\n DirectionalLight directionalLight;\n for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n directionalLight = directionalLights[ i ];\n shadow *= bool( directionalLight.shadow ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n }\n #endif\n #if NUM_SPOT_LIGHTS > 0\n SpotLight spotLight;\n for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n spotLight = spotLights[ i ];\n shadow *= bool( spotLight.shadow ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n }\n #endif\n #if NUM_POINT_LIGHTS > 0\n PointLight pointLight;\n for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n pointLight = pointLights[ i ];\n shadow *= bool( pointLight.shadow ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ] ) : 1.0;\n }\n #endif\n #endif\n return shadow;\n}\n",Nc="#ifdef USE_SKINNING\n mat4 boneMatX = getBoneMatrix( skinIndex.x );\n mat4 boneMatY = getBoneMatrix( skinIndex.y );\n mat4 boneMatZ = getBoneMatrix( skinIndex.z );\n mat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",Dc="#ifdef USE_SKINNING\n uniform mat4 bindMatrix;\n uniform mat4 bindMatrixInverse;\n #ifdef BONE_TEXTURE\n uniform sampler2D boneTexture;\n uniform int boneTextureWidth;\n uniform int boneTextureHeight;\n mat4 getBoneMatrix( const in float i ) {\n float j = i * 4.0;\n float x = mod( j, float( boneTextureWidth ) );\n float y = floor( j / float( boneTextureWidth ) );\n float dx = 1.0 / float( boneTextureWidth );\n float dy = 1.0 / float( boneTextureHeight );\n y = dy * ( y + 0.5 );\n vec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n vec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n vec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n vec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n mat4 bone = mat4( v1, v2, v3, v4 );\n return bone;\n }\n #else\n uniform mat4 boneMatrices[ MAX_BONES ];\n mat4 getBoneMatrix( const in float i ) {\n mat4 bone = boneMatrices[ int(i) ];\n return bone;\n }\n #endif\n#endif\n",Oc="#ifdef USE_SKINNING\n vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n vec4 skinned = vec4( 0.0 );\n skinned += boneMatX * skinVertex * skinWeight.x;\n skinned += boneMatY * skinVertex * skinWeight.y;\n skinned += boneMatZ * skinVertex * skinWeight.z;\n skinned += boneMatW * skinVertex * skinWeight.w;\n skinned = bindMatrixInverse * skinned;\n#endif\n",Bc="#ifdef USE_SKINNING\n mat4 skinMatrix = mat4( 0.0 );\n skinMatrix += skinWeight.x * boneMatX;\n skinMatrix += skinWeight.y * boneMatY;\n skinMatrix += skinWeight.z * boneMatZ;\n skinMatrix += skinWeight.w * boneMatW;\n skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n#endif\n",Fc="float specularStrength;\n#ifdef USE_SPECULARMAP\n vec4 texelSpecular = texture2D( specularMap, vUv );\n specularStrength = texelSpecular.r;\n#else\n specularStrength = 1.0;\n#endif",zc="#ifdef USE_SPECULARMAP\n uniform sampler2D specularMap;\n#endif",Gc="#if defined( TONE_MAPPING )\n gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif\n",Hc="#define saturate(a) clamp( a, 0.0, 1.0 )\nuniform float toneMappingExposure;\nuniform float toneMappingWhitePoint;\nvec3 LinearToneMapping( vec3 color ) {\n return toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n return 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 color *= toneMappingExposure;\n return saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n color = max( vec3( 0.0 ), color - 0.004 );\n return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\n",Vc="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n varying vec2 vUv;\n#endif",kc="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n varying vec2 vUv;\n uniform vec4 offsetRepeat;\n#endif\n",jc="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n vUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif",Wc="#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n varying vec2 vUv2;\n#endif",Xc="#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n attribute vec2 uv2;\n varying vec2 vUv2;\n#endif",qc="#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n vUv2 = uv2;\n#endif",Yc="#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( PHYSICAL ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )\n #ifdef USE_SKINNING\n vec4 worldPosition = modelMatrix * skinned;\n #else\n vec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n #endif\n#endif\n",Zc="uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n gl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );\n gl_FragColor.a *= opacity;\n}\n",Jc="varying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n vWorldPosition = transformDirection( position, modelMatrix );\n #include <begin_vertex>\n #include <project_vertex>\n}\n",Qc="#if DEPTH_PACKING == 3200\n uniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( 1.0 );\n #if DEPTH_PACKING == 3200\n diffuseColor.a = opacity;\n #endif\n #include <map_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <logdepthbuf_fragment>\n #if DEPTH_PACKING == 3200\n gl_FragColor = vec4( vec3( gl_FragCoord.z ), opacity );\n #elif DEPTH_PACKING == 3201\n gl_FragColor = packDepthToRGBA( gl_FragCoord.z );\n #endif\n}\n",Kc="#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <skinbase_vertex>\n #include <begin_vertex>\n #include <displacementmap_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n}\n",$c="uniform vec3 lightPos;\nvarying vec4 vWorldPosition;\n#include <common>\n#include <packing>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n #include <clipping_planes_fragment>\n gl_FragColor = packDepthToRGBA( length( vWorldPosition.xyz - lightPos.xyz ) / 1000.0 );\n}\n",eh="varying vec4 vWorldPosition;\n#include <common>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <skinbase_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <project_vertex>\n #include <worldpos_vertex>\n #include <clipping_planes_vertex>\n vWorldPosition = worldPosition;\n}\n",th="uniform sampler2D tEquirect;\nuniform float tFlip;\nvarying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n vec3 direction = normalize( vWorldPosition );\n vec2 sampleUV;\n sampleUV.y = saturate( tFlip * direction.y * -0.5 + 0.5 );\n sampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\n gl_FragColor = texture2D( tEquirect, sampleUV );\n}\n",ih="varying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n vWorldPosition = transformDirection( position, modelMatrix );\n #include <begin_vertex>\n #include <project_vertex>\n}\n",nh="uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n if ( mod( vLineDistance, totalSize ) > dashSize ) {\n discard;\n }\n vec3 outgoingLight = vec3( 0.0 );\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <logdepthbuf_fragment>\n #include <color_fragment>\n outgoingLight = diffuseColor.rgb;\n gl_FragColor = vec4( outgoingLight, diffuseColor.a );\n #include <premultiplied_alpha_fragment>\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n}\n",rh="uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <color_vertex>\n vLineDistance = scale * lineDistance;\n vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n gl_Position = projectionMatrix * mvPosition;\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <fog_vertex>\n}\n",ah="uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <specularmap_fragment>\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n #ifdef USE_LIGHTMAP\n reflectedLight.indirectDiffuse += texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n #else\n reflectedLight.indirectDiffuse += vec3( 1.0 );\n #endif\n #include <aomap_fragment>\n reflectedLight.indirectDiffuse *= diffuseColor.rgb;\n vec3 outgoingLight = reflectedLight.indirectDiffuse;\n #include <normal_flip>\n #include <envmap_fragment>\n gl_FragColor = vec4( outgoingLight, diffuseColor.a );\n #include <premultiplied_alpha_fragment>\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n}\n",oh="#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <uv2_vertex>\n #include <color_vertex>\n #include <skinbase_vertex>\n #ifdef USE_ENVMAP\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <worldpos_vertex>\n #include <clipping_planes_vertex>\n #include <envmap_vertex>\n #include <fog_vertex>\n}\n",sh="uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n varying vec3 vLightBack;\n#endif\n#include <common>\n#include <packing>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <bsdfs>\n#include <lights_pars>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( diffuse, opacity );\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <specularmap_fragment>\n #include <emissivemap_fragment>\n reflectedLight.indirectDiffuse = getAmbientLightIrradiance( ambientLightColor );\n #include <lightmap_fragment>\n reflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );\n #ifdef DOUBLE_SIDED\n reflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n #else\n reflectedLight.directDiffuse = vLightFront;\n #endif\n reflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n #include <aomap_fragment>\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n #include <normal_flip>\n #include <envmap_fragment>\n gl_FragColor = vec4( outgoingLight, diffuseColor.a );\n #include <premultiplied_alpha_fragment>\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n}\n",ch="#define LAMBERT\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n varying vec3 vLightBack;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <bsdfs>\n#include <lights_pars>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <uv2_vertex>\n #include <color_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <worldpos_vertex>\n #include <envmap_vertex>\n #include <lights_lambert_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}\n",hh="#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( diffuse, opacity );\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <specularmap_fragment>\n #include <normal_flip>\n #include <normal_fragment>\n #include <emissivemap_fragment>\n #include <lights_phong_fragment>\n #include <lights_template>\n #include <aomap_fragment>\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n #include <envmap_fragment>\n gl_FragColor = vec4( outgoingLight, diffuseColor.a );\n #include <premultiplied_alpha_fragment>\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n}\n",lh="#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <uv2_vertex>\n #include <color_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n vNormal = normalize( transformedNormal );\n#endif\n #include <begin_vertex>\n #include <displacementmap_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <envmap_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}\n",uh="#define PHYSICAL\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifndef STANDARD\n uniform float clearCoat;\n uniform float clearCoatRoughness;\n#endif\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\n#include <common>\n#include <packing>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <cube_uv_reflection_fragment>\n#include <lights_pars>\n#include <lights_physical_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( diffuse, opacity );\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <specularmap_fragment>\n #include <roughnessmap_fragment>\n #include <metalnessmap_fragment>\n #include <normal_flip>\n #include <normal_fragment>\n #include <emissivemap_fragment>\n #include <lights_physical_fragment>\n #include <lights_template>\n #include <aomap_fragment>\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n gl_FragColor = vec4( outgoingLight, diffuseColor.a );\n #include <premultiplied_alpha_fragment>\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n}\n",ph="#define PHYSICAL\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <uv2_vertex>\n #include <color_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n vNormal = normalize( transformedNormal );\n#endif\n #include <begin_vertex>\n #include <displacementmap_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}\n",dh="#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n varying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\nvoid main() {\n #include <logdepthbuf_fragment>\n #include <normal_flip>\n #include <normal_fragment>\n gl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n}\n",fh="#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n varying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n vNormal = normalize( transformedNormal );\n#endif\n #include <begin_vertex>\n #include <displacementmap_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n vViewPosition = - mvPosition.xyz;\n#endif\n}\n",mh="uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec3 outgoingLight = vec3( 0.0 );\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <logdepthbuf_fragment>\n #include <map_particle_fragment>\n #include <color_fragment>\n #include <alphatest_fragment>\n outgoingLight = diffuseColor.rgb;\n gl_FragColor = vec4( outgoingLight, diffuseColor.a );\n #include <premultiplied_alpha_fragment>\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n}\n",gh="uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <color_vertex>\n #include <begin_vertex>\n #include <project_vertex>\n #ifdef USE_SIZEATTENUATION\n gl_PointSize = size * ( scale / - mvPosition.z );\n #else\n gl_PointSize = size;\n #endif\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}\n",vh="uniform float opacity;\n#include <common>\n#include <packing>\n#include <bsdfs>\n#include <lights_pars>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n gl_FragColor = vec4( 0.0, 0.0, 0.0, opacity * ( 1.0 - getShadowMask() ) );\n}\n",yh="#include <shadowmap_pars_vertex>\nvoid main() {\n #include <begin_vertex>\n #include <project_vertex>\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n}\n",xh={
7
+ alphamap_fragment:xs,alphamap_pars_fragment:_s,alphatest_fragment:bs,aomap_fragment:ws,aomap_pars_fragment:Ms,begin_vertex:Es,beginnormal_vertex:Ts,bsdfs:Ss,bumpmap_pars_fragment:As,clipping_planes_fragment:Ls,clipping_planes_pars_fragment:Rs,clipping_planes_pars_vertex:Ps,clipping_planes_vertex:Cs,color_fragment:Is,color_pars_fragment:Us,color_pars_vertex:Ns,color_vertex:Ds,common:Os,cube_uv_reflection_fragment:Bs,defaultnormal_vertex:Fs,displacementmap_pars_vertex:zs,displacementmap_vertex:Gs,emissivemap_fragment:Hs,emissivemap_pars_fragment:Vs,encodings_fragment:ks,encodings_pars_fragment:js,envmap_fragment:Ws,envmap_pars_fragment:Xs,envmap_pars_vertex:qs,envmap_vertex:Ys,fog_vertex:Zs,fog_pars_vertex:Js,fog_fragment:Qs,fog_pars_fragment:Ks,gradientmap_pars_fragment:$s,lightmap_fragment:ec,lightmap_pars_fragment:tc,lights_lambert_vertex:ic,lights_pars:nc,lights_phong_fragment:rc,lights_phong_pars_fragment:ac,lights_physical_fragment:oc,lights_physical_pars_fragment:sc,lights_template:cc,logdepthbuf_fragment:hc,logdepthbuf_pars_fragment:lc,logdepthbuf_pars_vertex:uc,logdepthbuf_vertex:pc,map_fragment:dc,map_pars_fragment:fc,map_particle_fragment:mc,map_particle_pars_fragment:gc,metalnessmap_fragment:vc,metalnessmap_pars_fragment:yc,morphnormal_vertex:xc,morphtarget_pars_vertex:_c,morphtarget_vertex:bc,normal_flip:wc,normal_fragment:Mc,normalmap_pars_fragment:Ec,packing:Tc,premultiplied_alpha_fragment:Sc,project_vertex:Ac,roughnessmap_fragment:Lc,roughnessmap_pars_fragment:Rc,shadowmap_pars_fragment:Pc,shadowmap_pars_vertex:Cc,shadowmap_vertex:Ic,shadowmask_pars_fragment:Uc,skinbase_vertex:Nc,skinning_pars_vertex:Dc,skinning_vertex:Oc,skinnormal_vertex:Bc,specularmap_fragment:Fc,specularmap_pars_fragment:zc,tonemapping_fragment:Gc,tonemapping_pars_fragment:Hc,uv_pars_fragment:Vc,uv_pars_vertex:kc,uv_vertex:jc,uv2_pars_fragment:Wc,uv2_pars_vertex:Xc,uv2_vertex:qc,worldpos_vertex:Yc,cube_frag:Zc,cube_vert:Jc,depth_frag:Qc,depth_vert:Kc,distanceRGBA_frag:$c,distanceRGBA_vert:eh,equirect_frag:th,equirect_vert:ih,linedashed_frag:nh,linedashed_vert:rh,meshbasic_frag:ah,meshbasic_vert:oh,meshlambert_frag:sh,meshlambert_vert:ch,meshphong_frag:hh,meshphong_vert:lh,meshphysical_frag:uh,meshphysical_vert:ph,normal_frag:dh,normal_vert:fh,points_frag:mh,points_vert:gh,shadow_frag:vh,shadow_vert:yh};W.prototype={constructor:W,isColor:!0,r:1,g:1,b:1,set:function(e){return e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e),this},setScalar:function(e){return this.r=e,this.g=e,this.b=e,this},setHex:function(e){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,this},setRGB:function(e,t,i){return this.r=e,this.g=t,this.b=i,this},setHSL:function(){function e(e,t,i){return 0>i&&(i+=1),i>1&&(i-=1),1/6>i?e+6*(t-e)*i:.5>i?t:2/3>i?e+6*(t-e)*(2/3-i):e}return function(t,i,n){if(t=us.euclideanModulo(t,1),i=us.clamp(i,0,1),n=us.clamp(n,0,1),0===i)this.r=this.g=this.b=n;else{var r=.5>=n?n*(1+i):n+i-n*i,a=2*n-r;this.r=e(a,r,t+1/3),this.g=e(a,r,t),this.b=e(a,r,t-1/3)}return this}}(),setStyle:function(e){function t(t){void 0!==t&&parseFloat(t)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}var i;if(i=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(e)){var n,r=i[1],a=i[2];switch(r){case"rgb":case"rgba":if(n=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a))return this.r=Math.min(255,parseInt(n[1],10))/255,this.g=Math.min(255,parseInt(n[2],10))/255,this.b=Math.min(255,parseInt(n[3],10))/255,t(n[5]),this;if(n=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a))return this.r=Math.min(100,parseInt(n[1],10))/100,this.g=Math.min(100,parseInt(n[2],10))/100,this.b=Math.min(100,parseInt(n[3],10))/100,t(n[5]),this;break;case"hsl":case"hsla":if(n=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a)){var o=parseFloat(n[1])/360,s=parseInt(n[2],10)/100,c=parseInt(n[3],10)/100;return t(n[5]),this.setHSL(o,s,c)}}}else if(i=/^\#([A-Fa-f0-9]+)$/.exec(e)){var h=i[1],l=h.length;if(3===l)return this.r=parseInt(h.charAt(0)+h.charAt(0),16)/255,this.g=parseInt(h.charAt(1)+h.charAt(1),16)/255,this.b=parseInt(h.charAt(2)+h.charAt(2),16)/255,this;if(6===l)return this.r=parseInt(h.charAt(0)+h.charAt(1),16)/255,this.g=parseInt(h.charAt(2)+h.charAt(3),16)/255,this.b=parseInt(h.charAt(4)+h.charAt(5),16)/255,this}if(e&&e.length>0){var h=_h[e];void 0!==h?this.setHex(h):console.warn("THREE.Color: Unknown color "+e)}return this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(e){return this.r=e.r,this.g=e.g,this.b=e.b,this},copyGammaToLinear:function(e,t){return void 0===t&&(t=2),this.r=Math.pow(e.r,t),this.g=Math.pow(e.g,t),this.b=Math.pow(e.b,t),this},copyLinearToGamma:function(e,t){void 0===t&&(t=2);var i=t>0?1/t:1;return this.r=Math.pow(e.r,i),this.g=Math.pow(e.g,i),this.b=Math.pow(e.b,i),this},convertGammaToLinear:function(){var e=this.r,t=this.g,i=this.b;return this.r=e*e,this.g=t*t,this.b=i*i,this},convertLinearToGamma:function(){return this.r=Math.sqrt(this.r),this.g=Math.sqrt(this.g),this.b=Math.sqrt(this.b),this},getHex:function(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(e){var t,i,n=e||{h:0,s:0,l:0},r=this.r,a=this.g,o=this.b,s=Math.max(r,a,o),c=Math.min(r,a,o),h=(c+s)/2;if(c===s)t=0,i=0;else{var l=s-c;switch(i=.5>=h?l/(s+c):l/(2-s-c),s){case r:t=(a-o)/l+(o>a?6:0);break;case a:t=(o-r)/l+2;break;case o:t=(r-a)/l+4}t/=6}return n.h=t,n.s=i,n.l=h,n},getStyle:function(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"},offsetHSL:function(e,t,i){var n=this.getHSL();return n.h+=e,n.s+=t,n.l+=i,this.setHSL(n.h,n.s,n.l),this},add:function(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this},addColors:function(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this},addScalar:function(e){return this.r+=e,this.g+=e,this.b+=e,this},sub:function(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this},multiply:function(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this},multiplyScalar:function(e){return this.r*=e,this.g*=e,this.b*=e,this},lerp:function(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this},equals:function(e){return e.r===this.r&&e.g===this.g&&e.b===this.b},fromArray:function(e,t){return void 0===t&&(t=0),this.r=e[t],this.g=e[t+1],this.b=e[t+2],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e},toJSON:function(){return this.getHex()}};var _h={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,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};X.prototype=Object.create(n.prototype),X.prototype.constructor=X,X.prototype.isDataTexture=!0;var bh={common:{diffuse:{value:new W(15658734)},opacity:{value:1},map:{value:null},offsetRepeat:{value:new r(0,0,1,1)},specularMap:{value:null},alphaMap:{value:null},envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},refractionRatio:{value:.98}},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 i(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:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new W(16777215)}},lights:{ambientLightColor:{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:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}}},points:{diffuse:{value:new W(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},offsetRepeat:{value:new r(0,0,1,1)}}},wh={basic:{uniforms:ys.merge([bh.common,bh.aomap,bh.lightmap,bh.fog]),vertexShader:xh.meshbasic_vert,fragmentShader:xh.meshbasic_frag},lambert:{uniforms:ys.merge([bh.common,bh.aomap,bh.lightmap,bh.emissivemap,bh.fog,bh.lights,{emissive:{value:new W(0)}}]),vertexShader:xh.meshlambert_vert,fragmentShader:xh.meshlambert_frag},phong:{uniforms:ys.merge([bh.common,bh.aomap,bh.lightmap,bh.emissivemap,bh.bumpmap,bh.normalmap,bh.displacementmap,bh.gradientmap,bh.fog,bh.lights,{emissive:{value:new W(0)},specular:{value:new W(1118481)},shininess:{value:30}}]),vertexShader:xh.meshphong_vert,fragmentShader:xh.meshphong_frag},standard:{uniforms:ys.merge([bh.common,bh.aomap,bh.lightmap,bh.emissivemap,bh.bumpmap,bh.normalmap,bh.displacementmap,bh.roughnessmap,bh.metalnessmap,bh.fog,bh.lights,{emissive:{value:new W(0)},roughness:{value:.5},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:xh.meshphysical_vert,fragmentShader:xh.meshphysical_frag},points:{uniforms:ys.merge([bh.points,bh.fog]),vertexShader:xh.points_vert,fragmentShader:xh.points_frag},dashed:{uniforms:ys.merge([bh.common,bh.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:xh.linedashed_vert,fragmentShader:xh.linedashed_frag},depth:{uniforms:ys.merge([bh.common,bh.displacementmap]),vertexShader:xh.depth_vert,fragmentShader:xh.depth_frag},normal:{uniforms:ys.merge([bh.common,bh.bumpmap,bh.normalmap,bh.displacementmap,{opacity:{value:1}}]),vertexShader:xh.normal_vert,fragmentShader:xh.normal_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:xh.cube_vert,fragmentShader:xh.cube_frag},equirect:{uniforms:{tEquirect:{value:null},tFlip:{value:-1}},vertexShader:xh.equirect_vert,fragmentShader:xh.equirect_frag},distanceRGBA:{uniforms:{lightPos:{value:new c}},vertexShader:xh.distanceRGBA_vert,fragmentShader:xh.distanceRGBA_frag}};wh.physical={uniforms:ys.merge([wh.standard.uniforms,{clearCoat:{value:0},clearCoatRoughness:{value:0}}]),vertexShader:xh.meshphysical_vert,fragmentShader:xh.meshphysical_frag},q.prototype={constructor:q,set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,i=e.length;i>t;t++)this.expandByPoint(e[t]);return this},setFromCenterAndSize:function(){var e=new i;return function(t,i){var n=e.copy(i).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.min.copy(e.min),this.max.copy(e.max),this},makeEmpty:function(){return this.min.x=this.min.y=+(1/0),this.max.x=this.max.y=-(1/0),this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y},getCenter:function(e){var t=e||new i;return this.isEmpty()?t.set(0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(e){var t=e||new i;return this.isEmpty()?t.set(0,0):t.subVectors(this.max,this.min)},expandByPoint:function(e){return this.min.min(e),this.max.max(e),this},expandByVector:function(e){return this.min.sub(e),this.max.add(e),this},expandByScalar:function(e){return this.min.addScalar(-e),this.max.addScalar(e),this},containsPoint:function(e){return e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y?!1:!0},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y},getParameter:function(e,t){var n=t||new i;return n.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(e){return e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y?!1:!0},clampPoint:function(e,t){var n=t||new i;return n.copy(e).clamp(this.min,this.max)},distanceToPoint:function(){var e=new i;return function(t){var i=e.copy(t).clamp(this.min,this.max);return i.sub(t).length()}}(),intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}};var Mh=0;J.prototype={constructor:J,isMaterial:!0,get needsUpdate(){return this._needsUpdate},set needsUpdate(e){e===!0&&this.update(),this._needsUpdate=e},setValues:function(e){if(void 0!==e)for(var t in e){var i=e[t];if(void 0!==i){var n=this[t];void 0!==n?n&&n.isColor?n.set(i):n&&n.isVector3&&i&&i.isVector3?n.copy(i):"overdraw"===t?this[t]=Number(i):this[t]=i:console.warn("THREE."+this.type+": '"+t+"' is not a property of this material.")}else console.warn("THREE.Material: '"+t+"' parameter is undefined.")}},toJSON:function(e){function t(e){var t=[];for(var i in e){var n=e[i];delete n.metadata,t.push(n)}return t}var i=void 0===e;i&&(e={textures:{},images:{}});var n={metadata:{version:4.4,type:"Material",generator:"Material.toJSON"}};if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearCoat&&(n.clearCoat=this.clearCoat),void 0!==this.clearCoatRoughness&&(n.clearCoatRoughness=this.clearCoatRoughness),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,n.reflectivity=this.reflectivity),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),void 0!==this.size&&(n.size=this.size),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==da&&(n.blending=this.blending),this.shading!==ca&&(n.shading=this.shading),this.side!==ra&&(n.side=this.side),this.vertexColors!==ha&&(n.vertexColors=this.vertexColors),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=this.premultipliedAlpha),this.wireframe===!0&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),n.skinning=this.skinning,n.morphTargets=this.morphTargets,i){var r=t(e.textures),a=t(e.images);r.length>0&&(n.textures=r),a.length>0&&(n.images=a)}return n},clone:function(){return(new this.constructor).copy(this)},copy:function(e){this.name=e.name,this.fog=e.fog,this.lights=e.lights,this.blending=e.blending,this.side=e.side,this.shading=e.shading,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.alphaTest=e.alphaTest,this.premultipliedAlpha=e.premultipliedAlpha,this.overdraw=e.overdraw,this.visible=e.visible,this.clipShadows=e.clipShadows,this.clipIntersection=e.clipIntersection;var t=e.clippingPlanes,i=null;if(null!==t){var n=t.length;i=new Array(n);for(var r=0;r!==n;++r)i[r]=t[r].clone()}return this.clippingPlanes=i,this},update:function(){this.dispatchEvent({type:"update"})},dispose:function(){this.dispatchEvent({type:"dispose"})}},Object.assign(J.prototype,t.prototype),Q.prototype=Object.create(J.prototype),Q.prototype.constructor=Q,Q.prototype.isShaderMaterial=!0,Q.prototype.copy=function(e){return J.prototype.copy.call(this,e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=ys.clone(e.uniforms),this.defines=e.defines,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.lights=e.lights,this.clipping=e.clipping,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.extensions=e.extensions,this},Q.prototype.toJSON=function(e){var t=J.prototype.toJSON.call(this,e);return t.uniforms=this.uniforms,t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t},K.prototype=Object.create(J.prototype),K.prototype.constructor=K,K.prototype.isMeshDepthMaterial=!0,K.prototype.copy=function(e){return J.prototype.copy.call(this,e),this.depthPacking=e.depthPacking,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this},$.prototype={constructor:$,isBox3:!0,set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromArray:function(e){for(var t=+(1/0),i=+(1/0),n=+(1/0),r=-(1/0),a=-(1/0),o=-(1/0),s=0,c=e.length;c>s;s+=3){var h=e[s],l=e[s+1],u=e[s+2];t>h&&(t=h),i>l&&(i=l),n>u&&(n=u),h>r&&(r=h),l>a&&(a=l),u>o&&(o=u)}return this.min.set(t,i,n),this.max.set(r,a,o),this},setFromBufferAttribute:function(e){for(var t=+(1/0),i=+(1/0),n=+(1/0),r=-(1/0),a=-(1/0),o=-(1/0),s=0,c=e.count;c>s;s++){var h=e.getX(s),l=e.getY(s),u=e.getZ(s);t>h&&(t=h),i>l&&(i=l),n>u&&(n=u),h>r&&(r=h),l>a&&(a=l),u>o&&(o=u)}return this.min.set(t,i,n),this.max.set(r,a,o),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,i=e.length;i>t;t++)this.expandByPoint(e[t]);return this},setFromCenterAndSize:function(){var e=new c;return function(t,i){var n=e.copy(i).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),this}}(),setFromObject:function(e){return this.makeEmpty(),this.expandByObject(e)},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.min.copy(e.min),this.max.copy(e.max),this},makeEmpty:function(){return this.min.x=this.min.y=this.min.z=+(1/0),this.max.x=this.max.y=this.max.z=-(1/0),this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},getCenter:function(e){var t=e||new c;return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(e){var t=e||new c;return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)},expandByPoint:function(e){return this.min.min(e),this.max.max(e),this},expandByVector:function(e){return this.min.sub(e),this.max.add(e),this},expandByScalar:function(e){return this.min.addScalar(-e),this.max.addScalar(e),this},expandByObject:function(){var e=new c;return function(t){var i=this;return t.updateMatrixWorld(!0),t.traverse(function(t){var n,r,a=t.geometry;if(void 0!==a)if(a.isGeometry){var o=a.vertices;for(n=0,r=o.length;r>n;n++)e.copy(o[n]),e.applyMatrix4(t.matrixWorld),i.expandByPoint(e)}else if(a.isBufferGeometry){var s=a.attributes.position;if(void 0!==s)for(n=0,r=s.count;r>n;n++)e.fromBufferAttribute(s,n).applyMatrix4(t.matrixWorld),i.expandByPoint(e)}}),this}}(),containsPoint:function(e){return e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z?!1:!0},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z},getParameter:function(e,t){var i=t||new c;return i.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(e){return e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z?!1:!0},intersectsSphere:function(){var e;return function(t){return void 0===e&&(e=new c),this.clampPoint(t.center,e),e.distanceToSquared(t.center)<=t.radius*t.radius}}(),intersectsPlane:function(e){var t,i;return e.normal.x>0?(t=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),t<=e.constant&&i>=e.constant},clampPoint:function(e,t){var i=t||new c;return i.copy(e).clamp(this.min,this.max)},distanceToPoint:function(){var e=new c;return function(t){var i=e.copy(t).clamp(this.min,this.max);return i.sub(t).length()}}(),getBoundingSphere:function(){var e=new c;return function(t){var i=t||new ee;return this.getCenter(i.center),i.radius=.5*this.getSize(e).length(),i}}(),intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},applyMatrix4:function(){var e=[new c,new c,new c,new c,new c,new c,new c,new c];return function(t){return this.isEmpty()?this:(e[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),e[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),e[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),e[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),e[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),e[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),e[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),e[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(e),this)}}(),translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}},ee.prototype={constructor:ee,set:function(e,t){return this.center.copy(e),this.radius=t,this},setFromPoints:function(){var e;return function(t,i){void 0===e&&(e=new $);var n=this.center;void 0!==i?n.copy(i):e.setFromPoints(t).getCenter(n);for(var r=0,a=0,o=t.length;o>a;a++)r=Math.max(r,n.distanceToSquared(t[a]));return this.radius=Math.sqrt(r),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.center.copy(e.center),this.radius=e.radius,this},empty:function(){return this.radius<=0},containsPoint:function(e){return e.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(e){return e.distanceTo(this.center)-this.radius},intersectsSphere:function(e){var t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t},intersectsBox:function(e){return e.intersectsSphere(this)},intersectsPlane:function(e){return Math.abs(this.center.dot(e.normal)-e.constant)<=this.radius},clampPoint:function(e,t){var i=this.center.distanceToSquared(e),n=t||new c;return n.copy(e),i>this.radius*this.radius&&(n.sub(this.center).normalize(),n.multiplyScalar(this.radius).add(this.center)),n},getBoundingBox:function(e){var t=e||new $;return t.set(this.center,this.center),t.expandByScalar(this.radius),t},applyMatrix4:function(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this},translate:function(e){return this.center.add(e),this},equals:function(e){return e.center.equals(this.center)&&e.radius===this.radius}},te.prototype={constructor:te,isMatrix3:!0,set:function(e,t,i,n,r,a,o,s,c){var h=this.elements;return h[0]=e,h[1]=n,h[2]=o,h[3]=t,h[4]=r,h[5]=s,h[6]=i,h[7]=a,h[8]=c,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(e){var t=e.elements;return this.set(t[0],t[3],t[6],t[1],t[4],t[7],t[2],t[5],t[8]),this},setFromMatrix4:function(e){var t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this},applyToBufferAttribute:function(){var e;return function(t){void 0===e&&(e=new c);for(var i=0,n=t.count;n>i;i++)e.x=t.getX(i),e.y=t.getY(i),e.z=t.getZ(i),e.applyMatrix3(this),t.setXYZ(i,e.x,e.y,e.z);return t}}(),multiplyScalar:function(e){var t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this},determinant:function(){var e=this.elements,t=e[0],i=e[1],n=e[2],r=e[3],a=e[4],o=e[5],s=e[6],c=e[7],h=e[8];return t*a*h-t*o*c-i*r*h+i*o*s+n*r*c-n*a*s},getInverse:function(e,t){e&&e.isMatrix4&&console.error("THREE.Matrix3.getInverse no longer takes a Matrix4 argument.");var i=e.elements,n=this.elements,r=i[0],a=i[1],o=i[2],s=i[3],c=i[4],h=i[5],l=i[6],u=i[7],p=i[8],d=p*c-h*u,f=h*l-p*s,m=u*s-c*l,g=r*d+a*f+o*m;if(0===g){var v="THREE.Matrix3.getInverse(): can't invert matrix, determinant is 0";if(t===!0)throw new Error(v);return console.warn(v),this.identity()}var y=1/g;return n[0]=d*y,n[1]=(o*u-p*a)*y,n[2]=(h*a-o*c)*y,n[3]=f*y,n[4]=(p*r-o*l)*y,n[5]=(o*s-h*r)*y,n[6]=m*y,n[7]=(a*l-u*r)*y,n[8]=(c*r-a*s)*y,this},transpose:function(){var e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this},getNormalMatrix:function(e){return this.setFromMatrix4(e).getInverse(this).transpose()},transposeIntoArray:function(e){var t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this},fromArray:function(e,t){void 0===t&&(t=0);for(var i=0;9>i;i++)this.elements[i]=e[i+t];return this},toArray:function(e,t){void 0===e&&(e=[]),void 0===t&&(t=0);var i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e}},ie.prototype={constructor:ie,set:function(e,t){return this.normal.copy(e),this.constant=t,this},setComponents:function(e,t,i,n){return this.normal.set(e,t,i),this.constant=n,this},setFromNormalAndCoplanarPoint:function(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this},setFromCoplanarPoints:function(){var e=new c,t=new c;return function(i,n,r){var a=e.subVectors(r,n).cross(t.subVectors(i,n)).normalize();return this.setFromNormalAndCoplanarPoint(a,i),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.normal.copy(e.normal),this.constant=e.constant,this},normalize:function(){var e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(e){return this.normal.dot(e)+this.constant},distanceToSphere:function(e){return this.distanceToPoint(e.center)-e.radius},projectPoint:function(e,t){return this.orthoPoint(e,t).sub(e).negate()},orthoPoint:function(e,t){var i=this.distanceToPoint(e),n=t||new c;return n.copy(this.normal).multiplyScalar(i)},intersectLine:function(){var e=new c;return function(t,i){var n=i||new c,r=t.delta(e),a=this.normal.dot(r);if(0===a)return 0===this.distanceToPoint(t.start)?n.copy(t.start):void 0;var o=-(t.start.dot(this.normal)+this.constant)/a;return 0>o||o>1?void 0:n.copy(r).multiplyScalar(o).add(t.start)}}(),intersectsLine:function(e){var t=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return 0>t&&i>0||0>i&&t>0},intersectsBox:function(e){return e.intersectsPlane(this)},intersectsSphere:function(e){return e.intersectsPlane(this)},coplanarPoint:function(e){var t=e||new c;return t.copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(){var e=new c,t=new te;return function(i,n){var r=this.coplanarPoint(e).applyMatrix4(i),a=n||t.getNormalMatrix(i),o=this.normal.applyMatrix3(a).normalize();return this.constant=-r.dot(o),this}}(),translate:function(e){return this.constant=this.constant-e.dot(this.normal),
8
+ this},equals:function(e){return e.normal.equals(this.normal)&&e.constant===this.constant}},ne.prototype={constructor:ne,set:function(e,t,i,n,r,a){var o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(i),o[3].copy(n),o[4].copy(r),o[5].copy(a),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){for(var t=this.planes,i=0;6>i;i++)t[i].copy(e.planes[i]);return this},setFromMatrix:function(e){var t=this.planes,i=e.elements,n=i[0],r=i[1],a=i[2],o=i[3],s=i[4],c=i[5],h=i[6],l=i[7],u=i[8],p=i[9],d=i[10],f=i[11],m=i[12],g=i[13],v=i[14],y=i[15];return t[0].setComponents(o-n,l-s,f-u,y-m).normalize(),t[1].setComponents(o+n,l+s,f+u,y+m).normalize(),t[2].setComponents(o+r,l+c,f+p,y+g).normalize(),t[3].setComponents(o-r,l-c,f-p,y-g).normalize(),t[4].setComponents(o-a,l-h,f-d,y-v).normalize(),t[5].setComponents(o+a,l+h,f+d,y+v).normalize(),this},intersectsObject:function(){var e=new ee;return function(t){var i=t.geometry;return null===i.boundingSphere&&i.computeBoundingSphere(),e.copy(i.boundingSphere).applyMatrix4(t.matrixWorld),this.intersectsSphere(e)}}(),intersectsSprite:function(){var e=new ee;return function(t){return e.center.set(0,0,0),e.radius=.7071067811865476,e.applyMatrix4(t.matrixWorld),this.intersectsSphere(e)}}(),intersectsSphere:function(e){for(var t=this.planes,i=e.center,n=-e.radius,r=0;6>r;r++){var a=t[r].distanceToPoint(i);if(n>a)return!1}return!0},intersectsBox:function(){var e=new c,t=new c;return function(i){for(var n=this.planes,r=0;6>r;r++){var a=n[r];e.x=a.normal.x>0?i.min.x:i.max.x,t.x=a.normal.x>0?i.max.x:i.min.x,e.y=a.normal.y>0?i.min.y:i.max.y,t.y=a.normal.y>0?i.max.y:i.min.y,e.z=a.normal.z>0?i.min.z:i.max.z,t.z=a.normal.z>0?i.max.z:i.min.z;var o=a.distanceToPoint(e),s=a.distanceToPoint(t);if(0>o&&0>s)return!1}return!0}}(),containsPoint:function(e){for(var t=this.planes,i=0;6>i;i++)if(t[i].distanceToPoint(e)<0)return!1;return!0}},ae.prototype={constructor:ae,set:function(e,t){return this.origin.copy(e),this.direction.copy(t),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this},at:function(e,t){var i=t||new c;return i.copy(this.direction).multiplyScalar(e).add(this.origin)},lookAt:function(e){return this.direction.copy(e).sub(this.origin).normalize(),this},recast:function(){var e=new c;return function(t){return this.origin.copy(this.at(t,e)),this}}(),closestPointToPoint:function(e,t){var i=t||new c;i.subVectors(e,this.origin);var n=i.dot(this.direction);return 0>n?i.copy(this.origin):i.copy(this.direction).multiplyScalar(n).add(this.origin)},distanceToPoint:function(e){return Math.sqrt(this.distanceSqToPoint(e))},distanceSqToPoint:function(){var e=new c;return function(t){var i=e.subVectors(t,this.origin).dot(this.direction);return 0>i?this.origin.distanceToSquared(t):(e.copy(this.direction).multiplyScalar(i).add(this.origin),e.distanceToSquared(t))}}(),distanceSqToSegment:function(){var e=new c,t=new c,i=new c;return function(n,r,a,o){e.copy(n).add(r).multiplyScalar(.5),t.copy(r).sub(n).normalize(),i.copy(this.origin).sub(e);var s,c,h,l,u=.5*n.distanceTo(r),p=-this.direction.dot(t),d=i.dot(this.direction),f=-i.dot(t),m=i.lengthSq(),g=Math.abs(1-p*p);if(g>0)if(s=p*f-d,c=p*d-f,l=u*g,s>=0)if(c>=-l)if(l>=c){var v=1/g;s*=v,c*=v,h=s*(s+p*c+2*d)+c*(p*s+c+2*f)+m}else c=u,s=Math.max(0,-(p*c+d)),h=-s*s+c*(c+2*f)+m;else c=-u,s=Math.max(0,-(p*c+d)),h=-s*s+c*(c+2*f)+m;else-l>=c?(s=Math.max(0,-(-p*u+d)),c=s>0?-u:Math.min(Math.max(-u,-f),u),h=-s*s+c*(c+2*f)+m):l>=c?(s=0,c=Math.min(Math.max(-u,-f),u),h=c*(c+2*f)+m):(s=Math.max(0,-(p*u+d)),c=s>0?u:Math.min(Math.max(-u,-f),u),h=-s*s+c*(c+2*f)+m);else c=p>0?-u:u,s=Math.max(0,-(p*c+d)),h=-s*s+c*(c+2*f)+m;return a&&a.copy(this.direction).multiplyScalar(s).add(this.origin),o&&o.copy(t).multiplyScalar(c).add(e),h}}(),intersectSphere:function(){var e=new c;return function(t,i){e.subVectors(t.center,this.origin);var n=e.dot(this.direction),r=e.dot(e)-n*n,a=t.radius*t.radius;if(r>a)return null;var o=Math.sqrt(a-r),s=n-o,c=n+o;return 0>s&&0>c?null:0>s?this.at(c,i):this.at(s,i)}}(),intersectsSphere:function(e){return this.distanceToPoint(e.center)<=e.radius},distanceToPlane:function(e){var t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;var i=-(this.origin.dot(e.normal)+e.constant)/t;return i>=0?i:null},intersectPlane:function(e,t){var i=this.distanceToPlane(e);return null===i?null:this.at(i,t)},intersectsPlane:function(e){var t=e.distanceToPoint(this.origin);if(0===t)return!0;var i=e.normal.dot(this.direction);return 0>i*t?!0:!1},intersectBox:function(e,t){var i,n,r,a,o,s,c=1/this.direction.x,h=1/this.direction.y,l=1/this.direction.z,u=this.origin;return c>=0?(i=(e.min.x-u.x)*c,n=(e.max.x-u.x)*c):(i=(e.max.x-u.x)*c,n=(e.min.x-u.x)*c),h>=0?(r=(e.min.y-u.y)*h,a=(e.max.y-u.y)*h):(r=(e.max.y-u.y)*h,a=(e.min.y-u.y)*h),i>a||r>n?null:((r>i||i!==i)&&(i=r),(n>a||n!==n)&&(n=a),l>=0?(o=(e.min.z-u.z)*l,s=(e.max.z-u.z)*l):(o=(e.max.z-u.z)*l,s=(e.min.z-u.z)*l),i>s||o>n?null:((o>i||i!==i)&&(i=o),(n>s||n!==n)&&(n=s),0>n?null:this.at(i>=0?i:n,t)))},intersectsBox:function(){var e=new c;return function(t){return null!==this.intersectBox(t,e)}}(),intersectTriangle:function(){var e=new c,t=new c,i=new c,n=new c;return function(r,a,o,s,c){t.subVectors(a,r),i.subVectors(o,r),n.crossVectors(t,i);var h,l=this.direction.dot(n);if(l>0){if(s)return null;h=1}else{if(!(0>l))return null;h=-1,l=-l}e.subVectors(this.origin,r);var u=h*this.direction.dot(i.crossVectors(e,i));if(0>u)return null;var p=h*this.direction.dot(t.cross(e));if(0>p)return null;if(u+p>l)return null;var d=-h*e.dot(n);return 0>d?null:this.at(d/l,c)}}(),applyMatrix4:function(e){return this.direction.add(this.origin).applyMatrix4(e),this.origin.applyMatrix4(e),this.direction.sub(this.origin),this.direction.normalize(),this},equals:function(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}},oe.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"],oe.DefaultOrder="XYZ",oe.prototype={constructor:oe,isEuler:!0,get x(){return this._x},set x(e){this._x=e,this.onChangeCallback()},get y(){return this._y},set y(e){this._y=e,this.onChangeCallback()},get z(){return this._z},set z(e){this._z=e,this.onChangeCallback()},get order(){return this._order},set order(e){this._order=e,this.onChangeCallback()},set:function(e,t,i,n){return this._x=e,this._y=t,this._z=i,this._order=n||this._order,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this.onChangeCallback(),this},setFromRotationMatrix:function(e,t,i){var n=us.clamp,r=e.elements,a=r[0],o=r[4],s=r[8],c=r[1],h=r[5],l=r[9],u=r[2],p=r[6],d=r[10];return t=t||this._order,"XYZ"===t?(this._y=Math.asin(n(s,-1,1)),Math.abs(s)<.99999?(this._x=Math.atan2(-l,d),this._z=Math.atan2(-o,a)):(this._x=Math.atan2(p,h),this._z=0)):"YXZ"===t?(this._x=Math.asin(-n(l,-1,1)),Math.abs(l)<.99999?(this._y=Math.atan2(s,d),this._z=Math.atan2(c,h)):(this._y=Math.atan2(-u,a),this._z=0)):"ZXY"===t?(this._x=Math.asin(n(p,-1,1)),Math.abs(p)<.99999?(this._y=Math.atan2(-u,d),this._z=Math.atan2(-o,h)):(this._y=0,this._z=Math.atan2(c,a))):"ZYX"===t?(this._y=Math.asin(-n(u,-1,1)),Math.abs(u)<.99999?(this._x=Math.atan2(p,d),this._z=Math.atan2(c,a)):(this._x=0,this._z=Math.atan2(-o,h))):"YZX"===t?(this._z=Math.asin(n(c,-1,1)),Math.abs(c)<.99999?(this._x=Math.atan2(-l,h),this._y=Math.atan2(-u,a)):(this._x=0,this._y=Math.atan2(s,d))):"XZY"===t?(this._z=Math.asin(-n(o,-1,1)),Math.abs(o)<.99999?(this._x=Math.atan2(p,h),this._y=Math.atan2(s,a)):(this._x=Math.atan2(-l,d),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+t),this._order=t,i!==!1&&this.onChangeCallback(),this},setFromQuaternion:function(){var e;return function(t,i,n){return void 0===e&&(e=new h),e.makeRotationFromQuaternion(t),this.setFromRotationMatrix(e,i,n)}}(),setFromVector3:function(e,t){return this.set(e.x,e.y,e.z,t||this._order)},reorder:function(){var e=new s;return function(t){return e.setFromEuler(this),this.setFromQuaternion(e,t)}}(),equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order},fromArray:function(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this.onChangeCallback(),this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e},toVector3:function(e){return e?e.set(this._x,this._y,this._z):new c(this._x,this._y,this._z)},onChange:function(e){return this.onChangeCallback=e,this},onChangeCallback:function(){}},se.prototype={constructor:se,set:function(e){this.mask=1<<e},enable:function(e){this.mask|=1<<e},toggle:function(e){this.mask^=1<<e},disable:function(e){this.mask&=~(1<<e)},test:function(e){return 0!==(this.mask&e.mask)}};var Eh=0;ce.DefaultUp=new c(0,1,0),ce.DefaultMatrixAutoUpdate=!0,ce.prototype={constructor:ce,isObject3D:!0,applyMatrix:function(e){this.matrix.multiplyMatrices(e,this.matrix),this.matrix.decompose(this.position,this.quaternion,this.scale)},setRotationFromAxisAngle:function(e,t){this.quaternion.setFromAxisAngle(e,t)},setRotationFromEuler:function(e){this.quaternion.setFromEuler(e,!0)},setRotationFromMatrix:function(e){this.quaternion.setFromRotationMatrix(e)},setRotationFromQuaternion:function(e){this.quaternion.copy(e)},rotateOnAxis:function(){var e=new s;return function(t,i){return e.setFromAxisAngle(t,i),this.quaternion.multiply(e),this}}(),rotateX:function(){var e=new c(1,0,0);return function(t){return this.rotateOnAxis(e,t)}}(),rotateY:function(){var e=new c(0,1,0);return function(t){return this.rotateOnAxis(e,t)}}(),rotateZ:function(){var e=new c(0,0,1);return function(t){return this.rotateOnAxis(e,t)}}(),translateOnAxis:function(){var e=new c;return function(t,i){return e.copy(t).applyQuaternion(this.quaternion),this.position.add(e.multiplyScalar(i)),this}}(),translateX:function(){var e=new c(1,0,0);return function(t){return this.translateOnAxis(e,t)}}(),translateY:function(){var e=new c(0,1,0);return function(t){return this.translateOnAxis(e,t)}}(),translateZ:function(){var e=new c(0,0,1);return function(t){return this.translateOnAxis(e,t)}}(),localToWorld:function(e){return e.applyMatrix4(this.matrixWorld)},worldToLocal:function(){var e=new h;return function(t){return t.applyMatrix4(e.getInverse(this.matrixWorld))}}(),lookAt:function(){var e=new h;return function(t){e.lookAt(t,this.position,this.up),this.quaternion.setFromRotationMatrix(e)}}(),add:function(e){if(arguments.length>1){for(var t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(null!==e.parent&&e.parent.remove(e),e.parent=this,e.dispatchEvent({type:"added"}),this.children.push(e)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)},remove:function(e){if(arguments.length>1)for(var t=0;t<arguments.length;t++)this.remove(arguments[t]);var i=this.children.indexOf(e);-1!==i&&(e.parent=null,e.dispatchEvent({type:"removed"}),this.children.splice(i,1))},getObjectById:function(e){return this.getObjectByProperty("id",e)},getObjectByName:function(e){return this.getObjectByProperty("name",e)},getObjectByProperty:function(e,t){if(this[e]===t)return this;for(var i=0,n=this.children.length;n>i;i++){var r=this.children[i],a=r.getObjectByProperty(e,t);if(void 0!==a)return a}return void 0},getWorldPosition:function(e){var t=e||new c;return this.updateMatrixWorld(!0),t.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:function(){var e=new c,t=new c;return function(i){var n=i||new s;return this.updateMatrixWorld(!0),this.matrixWorld.decompose(e,n,t),n}}(),getWorldRotation:function(){var e=new s;return function(t){var i=t||new oe;return this.getWorldQuaternion(e),i.setFromQuaternion(e,this.rotation.order,!1)}}(),getWorldScale:function(){var e=new c,t=new s;return function(i){var n=i||new c;return this.updateMatrixWorld(!0),this.matrixWorld.decompose(e,t,n),n}}(),getWorldDirection:function(){var e=new s;return function(t){var i=t||new c;return this.getWorldQuaternion(e),i.set(0,0,1).applyQuaternion(e)}}(),raycast:function(){},traverse:function(e){e(this);for(var t=this.children,i=0,n=t.length;n>i;i++)t[i].traverse(e)},traverseVisible:function(e){if(this.visible!==!1){e(this);for(var t=this.children,i=0,n=t.length;n>i;i++)t[i].traverseVisible(e)}},traverseAncestors:function(e){var t=this.parent;null!==t&&(e(t),t.traverseAncestors(e))},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(e){this.matrixAutoUpdate===!0&&this.updateMatrix(),(this.matrixWorldNeedsUpdate===!0||e===!0)&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);for(var t=this.children,i=0,n=t.length;n>i;i++)t[i].updateMatrixWorld(e)},toJSON:function(e){function t(e){var t=[];for(var i in e){var n=e[i];delete n.metadata,t.push(n)}return t}var i=void 0===e||""===e,n={};i&&(e={geometries:{},materials:{},textures:{},images:{}},n.metadata={version:4.4,type:"Object",generator:"Object3D.toJSON"});var r={};if(r.uuid=this.uuid,r.type=this.type,""!==this.name&&(r.name=this.name),"{}"!==JSON.stringify(this.userData)&&(r.userData=this.userData),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),r.matrix=this.matrix.toArray(),void 0!==this.geometry&&(void 0===e.geometries[this.geometry.uuid]&&(e.geometries[this.geometry.uuid]=this.geometry.toJSON(e)),r.geometry=this.geometry.uuid),void 0!==this.material&&(void 0===e.materials[this.material.uuid]&&(e.materials[this.material.uuid]=this.material.toJSON(e)),r.material=this.material.uuid),this.children.length>0){r.children=[];for(var a=0;a<this.children.length;a++)r.children.push(this.children[a].toJSON(e).object)}if(i){var o=t(e.geometries),s=t(e.materials),c=t(e.textures),h=t(e.images);o.length>0&&(n.geometries=o),s.length>0&&(n.materials=s),c.length>0&&(n.textures=c),h.length>0&&(n.images=h)}return n.object=r,n},clone:function(e){return(new this.constructor).copy(this,e)},copy:function(e,t){if(void 0===t&&(t=!0),this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(var i=0;i<e.children.length;i++){var n=e.children[i];this.add(n.clone())}return this}},Object.assign(ce.prototype,t.prototype),he.prototype={constructor:he,set:function(e,t){return this.start.copy(e),this.end.copy(t),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.start.copy(e.start),this.end.copy(e.end),this},getCenter:function(e){var t=e||new c;return t.addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(e){var t=e||new c;return t.subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(e,t){var i=t||new c;return this.delta(i).multiplyScalar(e).add(this.start)},closestPointToPointParameter:function(){var e=new c,t=new c;return function(i,n){e.subVectors(i,this.start),t.subVectors(this.end,this.start);var r=t.dot(t),a=t.dot(e),o=a/r;return n&&(o=us.clamp(o,0,1)),o}}(),closestPointToPoint:function(e,t,i){var n=this.closestPointToPointParameter(e,t),r=i||new c;return this.delta(r).multiplyScalar(n).add(this.start)},applyMatrix4:function(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this},equals:function(e){return e.start.equals(this.start)&&e.end.equals(this.end)}},le.normal=function(){var e=new c;return function(t,i,n,r){var a=r||new c;a.subVectors(n,i),e.subVectors(t,i),a.cross(e);var o=a.lengthSq();return o>0?a.multiplyScalar(1/Math.sqrt(o)):a.set(0,0,0)}}(),le.barycoordFromPoint=function(){var e=new c,t=new c,i=new c;return function(n,r,a,o,s){e.subVectors(o,r),t.subVectors(a,r),i.subVectors(n,r);var h=e.dot(e),l=e.dot(t),u=e.dot(i),p=t.dot(t),d=t.dot(i),f=h*p-l*l,m=s||new c;if(0===f)return m.set(-2,-1,-1);var g=1/f,v=(p*u-l*d)*g,y=(h*d-l*u)*g;return m.set(1-v-y,y,v)}}(),le.containsPoint=function(){var e=new c;return function(t,i,n,r){var a=le.barycoordFromPoint(t,i,n,r,e);return a.x>=0&&a.y>=0&&a.x+a.y<=1}}(),le.prototype={constructor:le,set:function(e,t,i){return this.a.copy(e),this.b.copy(t),this.c.copy(i),this},setFromPointsAndIndices:function(e,t,i,n){return this.a.copy(e[t]),this.b.copy(e[i]),this.c.copy(e[n]),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this},area:function(){var e=new c,t=new c;return function(){return e.subVectors(this.c,this.b),t.subVectors(this.a,this.b),.5*e.cross(t).length()}}(),midpoint:function(e){var t=e||new c;return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},normal:function(e){return le.normal(this.a,this.b,this.c,e)},plane:function(e){var t=e||new ie;return t.setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(e,t){return le.barycoordFromPoint(e,this.a,this.b,this.c,t)},containsPoint:function(e){return le.containsPoint(e,this.a,this.b,this.c)},closestPointToPoint:function(){var e,t,i,n;return function(r,a){void 0===e&&(e=new ie,t=[new he,new he,new he],i=new c,n=new c);var o=a||new c,s=1/0;if(e.setFromCoplanarPoints(this.a,this.b,this.c),e.projectPoint(r,i),this.containsPoint(i)===!0)o.copy(i);else{t[0].set(this.a,this.b),t[1].set(this.b,this.c),t[2].set(this.c,this.a);for(var h=0;h<t.length;h++){t[h].closestPointToPoint(i,!0,n);var l=i.distanceToSquared(n);s>l&&(s=l,o.copy(n))}}return o}}(),equals:function(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}},ue.prototype={constructor:ue,clone:function(){return(new this.constructor).copy(this)},copy:function(e){this.a=e.a,this.b=e.b,this.c=e.c,this.normal.copy(e.normal),this.color.copy(e.color),this.materialIndex=e.materialIndex;for(var t=0,i=e.vertexNormals.length;i>t;t++)this.vertexNormals[t]=e.vertexNormals[t].clone();for(var t=0,i=e.vertexColors.length;i>t;t++)this.vertexColors[t]=e.vertexColors[t].clone();return this}},pe.prototype=Object.create(J.prototype),pe.prototype.constructor=pe,pe.prototype.isMeshBasicMaterial=!0,pe.prototype.copy=function(e){return J.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this},de.prototype={constructor:de,isBufferAttribute:!0,set needsUpdate(e){e===!0&&this.version++},setArray:function(e){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.count=void 0!==e?e.length/this.itemSize:0,this.array=e},setDynamic:function(e){return this.dynamic=e,this},copy:function(e){return this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.dynamic=e.dynamic,this},copyAt:function(e,t,i){e*=this.itemSize,i*=t.itemSize;for(var n=0,r=this.itemSize;r>n;n++)this.array[e+n]=t.array[i+n];return this},copyArray:function(e){return this.array.set(e),this},copyColorsArray:function(e){for(var t=this.array,i=0,n=0,r=e.length;r>n;n++){var a=e[n];void 0===a&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",n),a=new W),t[i++]=a.r,t[i++]=a.g,t[i++]=a.b}return this},copyIndicesArray:function(e){for(var t=this.array,i=0,n=0,r=e.length;r>n;n++){var a=e[n];t[i++]=a.a,t[i++]=a.b,t[i++]=a.c}return this},copyVector2sArray:function(e){for(var t=this.array,n=0,r=0,a=e.length;a>r;r++){var o=e[r];void 0===o&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",r),o=new i),t[n++]=o.x,t[n++]=o.y}return this},copyVector3sArray:function(e){for(var t=this.array,i=0,n=0,r=e.length;r>n;n++){var a=e[n];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",n),a=new c),t[i++]=a.x,t[i++]=a.y,t[i++]=a.z}return this},copyVector4sArray:function(e){for(var t=this.array,i=0,n=0,a=e.length;a>n;n++){var o=e[n];void 0===o&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",n),o=new r),t[i++]=o.x,t[i++]=o.y,t[i++]=o.z,t[i++]=o.w}return this},set:function(e,t){return void 0===t&&(t=0),this.array.set(e,t),this},getX:function(e){return this.array[e*this.itemSize]},setX:function(e,t){return this.array[e*this.itemSize]=t,this},getY:function(e){return this.array[e*this.itemSize+1]},setY:function(e,t){return this.array[e*this.itemSize+1]=t,this},getZ:function(e){return this.array[e*this.itemSize+2]},setZ:function(e,t){return this.array[e*this.itemSize+2]=t,this},getW:function(e){return this.array[e*this.itemSize+3]},setW:function(e,t){return this.array[e*this.itemSize+3]=t,this},setXY:function(e,t,i){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=i,this},setXYZ:function(e,t,i,n){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=n,this},setXYZW:function(e,t,i,n,r){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=n,this.array[e+3]=r,this},onUpload:function(e){return this.onUploadCallback=e,this},clone:function(){return new this.constructor(this.array,this.itemSize).copy(this)}},fe.prototype=Object.create(de.prototype),fe.prototype.constructor=fe,me.prototype=Object.create(de.prototype),me.prototype.constructor=me,ge.prototype=Object.create(de.prototype),ge.prototype.constructor=ge,ve.prototype=Object.create(de.prototype),ve.prototype.constructor=ve,ye.prototype=Object.create(de.prototype),ye.prototype.constructor=ye,xe.prototype=Object.create(de.prototype),xe.prototype.constructor=xe,_e.prototype=Object.create(de.prototype),_e.prototype.constructor=_e,be.prototype=Object.create(de.prototype),be.prototype.constructor=be,we.prototype=Object.create(de.prototype),we.prototype.constructor=we,Object.assign(Me.prototype,{computeGroups:function(e){for(var t,i=[],n=void 0,r=e.faces,a=0;a<r.length;a++){var o=r[a];o.materialIndex!==n&&(n=o.materialIndex,void 0!==t&&(t.count=3*a-t.start,i.push(t)),t={start:3*a,materialIndex:n})}void 0!==t&&(t.count=3*a-t.start,i.push(t)),this.groups=i},fromGeometry:function(e){var t,n=e.faces,r=e.vertices,a=e.faceVertexUvs,o=a[0]&&a[0].length>0,s=a[1]&&a[1].length>0,c=e.morphTargets,h=c.length;if(h>0){t=[];for(var l=0;h>l;l++)t[l]=[];this.morphTargets.position=t}var u,p=e.morphNormals,d=p.length;if(d>0){u=[];for(var l=0;d>l;l++)u[l]=[];this.morphTargets.normal=u}for(var f=e.skinIndices,m=e.skinWeights,g=f.length===r.length,v=m.length===r.length,l=0;l<n.length;l++){var y=n[l];this.vertices.push(r[y.a],r[y.b],r[y.c]);var x=y.vertexNormals;if(3===x.length)this.normals.push(x[0],x[1],x[2]);else{var _=y.normal;this.normals.push(_,_,_)}var b=y.vertexColors;if(3===b.length)this.colors.push(b[0],b[1],b[2]);else{var w=y.color;this.colors.push(w,w,w)}if(o===!0){var M=a[0][l];void 0!==M?this.uvs.push(M[0],M[1],M[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",l),this.uvs.push(new i,new i,new i))}if(s===!0){var M=a[1][l];void 0!==M?this.uvs2.push(M[0],M[1],M[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",l),this.uvs2.push(new i,new i,new i))}for(var E=0;h>E;E++){var T=c[E].vertices;t[E].push(T[y.a],T[y.b],T[y.c])}for(var E=0;d>E;E++){var S=p[E].vertexNormals[l];u[E].push(S.a,S.b,S.c)}g&&this.skinIndices.push(f[y.a],f[y.b],f[y.c]),v&&this.skinWeights.push(m[y.a],m[y.b],m[y.c])}return this.computeGroups(e),this.verticesNeedUpdate=e.verticesNeedUpdate,this.normalsNeedUpdate=e.normalsNeedUpdate,this.colorsNeedUpdate=e.colorsNeedUpdate,this.uvsNeedUpdate=e.uvsNeedUpdate,this.groupsNeedUpdate=e.groupsNeedUpdate,this}});var Th=0;Se.prototype={constructor:Se,isGeometry:!0,applyMatrix:function(e){for(var t=(new te).getNormalMatrix(e),i=0,n=this.vertices.length;n>i;i++){var r=this.vertices[i];r.applyMatrix4(e)}for(var i=0,n=this.faces.length;n>i;i++){var a=this.faces[i];a.normal.applyMatrix3(t).normalize();for(var o=0,s=a.vertexNormals.length;s>o;o++)a.vertexNormals[o].applyMatrix3(t).normalize()}return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this.verticesNeedUpdate=!0,this.normalsNeedUpdate=!0,this},rotateX:function(){var e;return function(t){return void 0===e&&(e=new h),e.makeRotationX(t),this.applyMatrix(e),this}}(),rotateY:function(){var e;return function(t){return void 0===e&&(e=new h),e.makeRotationY(t),this.applyMatrix(e),this}}(),rotateZ:function(){var e;return function(t){return void 0===e&&(e=new h),e.makeRotationZ(t),this.applyMatrix(e),this}}(),translate:function(){var e;return function(t,i,n){return void 0===e&&(e=new h),e.makeTranslation(t,i,n),this.applyMatrix(e),this}}(),scale:function(){var e;return function(t,i,n){return void 0===e&&(e=new h),e.makeScale(t,i,n),this.applyMatrix(e),this}}(),lookAt:function(){var e;return function(t){void 0===e&&(e=new ce),e.lookAt(t),e.updateMatrix(),this.applyMatrix(e.matrix)}}(),fromBufferGeometry:function(e){function t(e,t,i,r){var a=void 0!==s?[p[e].clone(),p[t].clone(),p[i].clone()]:[],o=void 0!==h?[n.colors[e].clone(),n.colors[t].clone(),n.colors[i].clone()]:[],c=new ue(e,t,i,a,o,r);n.faces.push(c),void 0!==l&&n.faceVertexUvs[0].push([d[e].clone(),d[t].clone(),d[i].clone()]),void 0!==u&&n.faceVertexUvs[1].push([f[e].clone(),f[t].clone(),f[i].clone()])}var n=this,r=null!==e.index?e.index.array:void 0,a=e.attributes,o=a.position.array,s=void 0!==a.normal?a.normal.array:void 0,h=void 0!==a.color?a.color.array:void 0,l=void 0!==a.uv?a.uv.array:void 0,u=void 0!==a.uv2?a.uv2.array:void 0;void 0!==u&&(this.faceVertexUvs[1]=[]);for(var p=[],d=[],f=[],m=0,g=0;m<o.length;m+=3,g+=2)n.vertices.push(new c(o[m],o[m+1],o[m+2])),void 0!==s&&p.push(new c(s[m],s[m+1],s[m+2])),void 0!==h&&n.colors.push(new W(h[m],h[m+1],h[m+2])),void 0!==l&&d.push(new i(l[g],l[g+1])),void 0!==u&&f.push(new i(u[g],u[g+1]));if(void 0!==r){var v=e.groups;if(v.length>0)for(var m=0;m<v.length;m++)for(var y=v[m],x=y.start,_=y.count,g=x,b=x+_;b>g;g+=3)t(r[g],r[g+1],r[g+2],y.materialIndex);else for(var m=0;m<r.length;m+=3)t(r[m],r[m+1],r[m+2])}else for(var m=0;m<o.length/3;m+=3)t(m,m+1,m+2);return this.computeFaceNormals(),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),this},center:function(){this.computeBoundingBox();var e=this.boundingBox.getCenter().negate();return this.translate(e.x,e.y,e.z),e},normalize:function(){this.computeBoundingSphere();var e=this.boundingSphere.center,t=this.boundingSphere.radius,i=0===t?1:1/t,n=new h;return n.set(i,0,0,-i*e.x,0,i,0,-i*e.y,0,0,i,-i*e.z,0,0,0,1),this.applyMatrix(n),this},computeFaceNormals:function(){for(var e=new c,t=new c,i=0,n=this.faces.length;n>i;i++){var r=this.faces[i],a=this.vertices[r.a],o=this.vertices[r.b],s=this.vertices[r.c];e.subVectors(s,o),t.subVectors(a,o),e.cross(t),e.normalize(),r.normal.copy(e)}},computeVertexNormals:function(e){void 0===e&&(e=!0);var t,i,n,r,a,o;for(o=new Array(this.vertices.length),t=0,i=this.vertices.length;i>t;t++)o[t]=new c;if(e){var s,h,l,u=new c,p=new c;for(n=0,r=this.faces.length;r>n;n++)a=this.faces[n],s=this.vertices[a.a],h=this.vertices[a.b],l=this.vertices[a.c],u.subVectors(l,h),p.subVectors(s,h),u.cross(p),o[a.a].add(u),o[a.b].add(u),o[a.c].add(u)}else for(this.computeFaceNormals(),n=0,r=this.faces.length;r>n;n++)a=this.faces[n],o[a.a].add(a.normal),o[a.b].add(a.normal),o[a.c].add(a.normal);for(t=0,i=this.vertices.length;i>t;t++)o[t].normalize();for(n=0,r=this.faces.length;r>n;n++){a=this.faces[n];var d=a.vertexNormals;3===d.length?(d[0].copy(o[a.a]),d[1].copy(o[a.b]),d[2].copy(o[a.c])):(d[0]=o[a.a].clone(),d[1]=o[a.b].clone(),d[2]=o[a.c].clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},computeFlatVertexNormals:function(){var e,t,i;for(this.computeFaceNormals(),e=0,t=this.faces.length;t>e;e++){i=this.faces[e];var n=i.vertexNormals;3===n.length?(n[0].copy(i.normal),n[1].copy(i.normal),n[2].copy(i.normal)):(n[0]=i.normal.clone(),n[1]=i.normal.clone(),n[2]=i.normal.clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var e,t,i,n,r;for(i=0,n=this.faces.length;n>i;i++)for(r=this.faces[i],r.__originalFaceNormal?r.__originalFaceNormal.copy(r.normal):r.__originalFaceNormal=r.normal.clone(),r.__originalVertexNormals||(r.__originalVertexNormals=[]),e=0,t=r.vertexNormals.length;t>e;e++)r.__originalVertexNormals[e]?r.__originalVertexNormals[e].copy(r.vertexNormals[e]):r.__originalVertexNormals[e]=r.vertexNormals[e].clone();var a=new Se;for(a.faces=this.faces,e=0,t=this.morphTargets.length;t>e;e++){if(!this.morphNormals[e]){this.morphNormals[e]={},this.morphNormals[e].faceNormals=[],this.morphNormals[e].vertexNormals=[];var o,s,h=this.morphNormals[e].faceNormals,l=this.morphNormals[e].vertexNormals;for(i=0,n=this.faces.length;n>i;i++)o=new c,s={a:new c,b:new c,c:new c},h.push(o),l.push(s)}var u=this.morphNormals[e];a.vertices=this.morphTargets[e].vertices,a.computeFaceNormals(),a.computeVertexNormals();var o,s;for(i=0,n=this.faces.length;n>i;i++)r=this.faces[i],o=u.faceNormals[i],s=u.vertexNormals[i],o.copy(r.normal),s.a.copy(r.vertexNormals[0]),s.b.copy(r.vertexNormals[1]),s.c.copy(r.vertexNormals[2])}for(i=0,n=this.faces.length;n>i;i++)r=this.faces[i],r.normal=r.__originalFaceNormal,r.vertexNormals=r.__originalVertexNormals},computeLineDistances:function(){for(var e=0,t=this.vertices,i=0,n=t.length;n>i;i++)i>0&&(e+=t[i].distanceTo(t[i-1])),this.lineDistances[i]=e},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new $),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new ee),this.boundingSphere.setFromPoints(this.vertices)},merge:function(e,t,i){if((e&&e.isGeometry)===!1)return void console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",e);var n,r=this.vertices.length,a=this.vertices,o=e.vertices,s=this.faces,c=e.faces,h=this.faceVertexUvs[0],l=e.faceVertexUvs[0],u=this.colors,p=e.colors;void 0===i&&(i=0),void 0!==t&&(n=(new te).getNormalMatrix(t));for(var d=0,f=o.length;f>d;d++){var m=o[d],g=m.clone();void 0!==t&&g.applyMatrix4(t),a.push(g)}for(var d=0,f=p.length;f>d;d++)u.push(p[d].clone());for(d=0,f=c.length;f>d;d++){var v,y,x,_=c[d],b=_.vertexNormals,w=_.vertexColors;v=new ue(_.a+r,_.b+r,_.c+r),v.normal.copy(_.normal),void 0!==n&&v.normal.applyMatrix3(n).normalize();for(var M=0,E=b.length;E>M;M++)y=b[M].clone(),void 0!==n&&y.applyMatrix3(n).normalize(),v.vertexNormals.push(y);v.color.copy(_.color);for(var M=0,E=w.length;E>M;M++)x=w[M],v.vertexColors.push(x.clone());v.materialIndex=_.materialIndex+i,s.push(v)}for(d=0,f=l.length;f>d;d++){var T=l[d],S=[];if(void 0!==T){for(var M=0,E=T.length;E>M;M++)S.push(T[M].clone());h.push(S)}}},mergeMesh:function(e){return(e&&e.isMesh)===!1?void console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",e):(e.matrixAutoUpdate&&e.updateMatrix(),
9
+ void this.merge(e.geometry,e.matrix))},mergeVertices:function(){var e,t,i,n,r,a,o,s,c={},h=[],l=[],u=4,p=Math.pow(10,u);for(i=0,n=this.vertices.length;n>i;i++)e=this.vertices[i],t=Math.round(e.x*p)+"_"+Math.round(e.y*p)+"_"+Math.round(e.z*p),void 0===c[t]?(c[t]=i,h.push(this.vertices[i]),l[i]=h.length-1):l[i]=l[c[t]];var d=[];for(i=0,n=this.faces.length;n>i;i++){r=this.faces[i],r.a=l[r.a],r.b=l[r.b],r.c=l[r.c],a=[r.a,r.b,r.c];for(var f=0;3>f;f++)if(a[f]===a[(f+1)%3]){d.push(i);break}}for(i=d.length-1;i>=0;i--){var m=d[i];for(this.faces.splice(m,1),o=0,s=this.faceVertexUvs.length;s>o;o++)this.faceVertexUvs[o].splice(m,1)}var g=this.vertices.length-h.length;return this.vertices=h,g},sortFacesByMaterialIndex:function(){function e(e,t){return e.materialIndex-t.materialIndex}for(var t=this.faces,i=t.length,n=0;i>n;n++)t[n]._id=n;t.sort(e);var r,a,o=this.faceVertexUvs[0],s=this.faceVertexUvs[1];o&&o.length===i&&(r=[]),s&&s.length===i&&(a=[]);for(var n=0;i>n;n++){var c=t[n]._id;r&&r.push(o[c]),a&&a.push(s[c])}r&&(this.faceVertexUvs[0]=r),a&&(this.faceVertexUvs[1]=a)},toJSON:function(){function e(e,t,i){return i?e|1<<t:e&~(1<<t)}function t(e){var t=e.x.toString()+e.y.toString()+e.z.toString();return void 0!==p[t]?p[t]:(p[t]=u.length/3,u.push(e.x,e.y,e.z),p[t])}function i(e){var t=e.r.toString()+e.g.toString()+e.b.toString();return void 0!==f[t]?f[t]:(f[t]=d.length,d.push(e.getHex()),f[t])}function n(e){var t=e.x.toString()+e.y.toString();return void 0!==g[t]?g[t]:(g[t]=m.length/2,m.push(e.x,e.y),g[t])}var r={metadata:{version:4.4,type:"Geometry",generator:"Geometry.toJSON"}};if(r.uuid=this.uuid,r.type=this.type,""!==this.name&&(r.name=this.name),void 0!==this.parameters){var a=this.parameters;for(var o in a)void 0!==a[o]&&(r[o]=a[o]);return r}for(var s=[],c=0;c<this.vertices.length;c++){var h=this.vertices[c];s.push(h.x,h.y,h.z)}for(var l=[],u=[],p={},d=[],f={},m=[],g={},c=0;c<this.faces.length;c++){var v=this.faces[c],y=!0,x=!1,_=void 0!==this.faceVertexUvs[0][c],b=v.normal.length()>0,w=v.vertexNormals.length>0,M=1!==v.color.r||1!==v.color.g||1!==v.color.b,E=v.vertexColors.length>0,T=0;if(T=e(T,0,0),T=e(T,1,y),T=e(T,2,x),T=e(T,3,_),T=e(T,4,b),T=e(T,5,w),T=e(T,6,M),T=e(T,7,E),l.push(T),l.push(v.a,v.b,v.c),l.push(v.materialIndex),_){var S=this.faceVertexUvs[0][c];l.push(n(S[0]),n(S[1]),n(S[2]))}if(b&&l.push(t(v.normal)),w){var A=v.vertexNormals;l.push(t(A[0]),t(A[1]),t(A[2]))}if(M&&l.push(i(v.color)),E){var L=v.vertexColors;l.push(i(L[0]),i(L[1]),i(L[2]))}}return r.data={},r.data.vertices=s,r.data.normals=u,d.length>0&&(r.data.colors=d),m.length>0&&(r.data.uvs=[m]),r.data.faces=l,r},clone:function(){return(new Se).copy(this)},copy:function(e){var t,i,n,r,a,o;this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.name=e.name;var s=e.vertices;for(t=0,i=s.length;i>t;t++)this.vertices.push(s[t].clone());var c=e.colors;for(t=0,i=c.length;i>t;t++)this.colors.push(c[t].clone());var h=e.faces;for(t=0,i=h.length;i>t;t++)this.faces.push(h[t].clone());for(t=0,i=e.faceVertexUvs.length;i>t;t++){var l=e.faceVertexUvs[t];for(void 0===this.faceVertexUvs[t]&&(this.faceVertexUvs[t]=[]),n=0,r=l.length;r>n;n++){var u=l[n],p=[];for(a=0,o=u.length;o>a;a++){var d=u[a];p.push(d.clone())}this.faceVertexUvs[t].push(p)}}var f=e.morphTargets;for(t=0,i=f.length;i>t;t++){var m={};if(m.name=f[t].name,void 0!==f[t].vertices)for(m.vertices=[],n=0,r=f[t].vertices.length;r>n;n++)m.vertices.push(f[t].vertices[n].clone());if(void 0!==f[t].normals)for(m.normals=[],n=0,r=f[t].normals.length;r>n;n++)m.normals.push(f[t].normals[n].clone());this.morphTargets.push(m)}var g=e.morphNormals;for(t=0,i=g.length;i>t;t++){var v={};if(void 0!==g[t].vertexNormals)for(v.vertexNormals=[],n=0,r=g[t].vertexNormals.length;r>n;n++){var y=g[t].vertexNormals[n],x={};x.a=y.a.clone(),x.b=y.b.clone(),x.c=y.c.clone(),v.vertexNormals.push(x)}if(void 0!==g[t].faceNormals)for(v.faceNormals=[],n=0,r=g[t].faceNormals.length;r>n;n++)v.faceNormals.push(g[t].faceNormals[n].clone());this.morphNormals.push(v)}var _=e.skinWeights;for(t=0,i=_.length;i>t;t++)this.skinWeights.push(_[t].clone());var b=e.skinIndices;for(t=0,i=b.length;i>t;t++)this.skinIndices.push(b[t].clone());var w=e.lineDistances;for(t=0,i=w.length;i>t;t++)this.lineDistances.push(w[t]);var M=e.boundingBox;null!==M&&(this.boundingBox=M.clone());var E=e.boundingSphere;return null!==E&&(this.boundingSphere=E.clone()),this.elementsNeedUpdate=e.elementsNeedUpdate,this.verticesNeedUpdate=e.verticesNeedUpdate,this.uvsNeedUpdate=e.uvsNeedUpdate,this.normalsNeedUpdate=e.normalsNeedUpdate,this.colorsNeedUpdate=e.colorsNeedUpdate,this.lineDistancesNeedUpdate=e.lineDistancesNeedUpdate,this.groupsNeedUpdate=e.groupsNeedUpdate,this},dispose:function(){this.dispatchEvent({type:"dispose"})}},Object.assign(Se.prototype,t.prototype),Ae.prototype={constructor:Ae,isBufferGeometry:!0,getIndex:function(){return this.index},setIndex:function(e){Array.isArray(e)?this.index=new(Ee(e)>65535?_e:ye)(e,1):this.index=e},addAttribute:function(e,t){return(t&&t.isBufferAttribute)===!1&&(t&&t.isInterleavedBufferAttribute)===!1?(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),void this.addAttribute(e,new de(arguments[1],arguments[2]))):"index"===e?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),void this.setIndex(t)):(this.attributes[e]=t,this)},getAttribute:function(e){return this.attributes[e]},removeAttribute:function(e){return delete this.attributes[e],this},addGroup:function(e,t,i){this.groups.push({start:e,count:t,materialIndex:void 0!==i?i:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(e,t){this.drawRange.start=e,this.drawRange.count=t},applyMatrix:function(e){var t=this.attributes.position;void 0!==t&&(e.applyToBufferAttribute(t),t.needsUpdate=!0);var i=this.attributes.normal;if(void 0!==i){var n=(new te).getNormalMatrix(e);n.applyToBufferAttribute(i),i.needsUpdate=!0}return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:function(){var e;return function(t){return void 0===e&&(e=new h),e.makeRotationX(t),this.applyMatrix(e),this}}(),rotateY:function(){var e;return function(t){return void 0===e&&(e=new h),e.makeRotationY(t),this.applyMatrix(e),this}}(),rotateZ:function(){var e;return function(t){return void 0===e&&(e=new h),e.makeRotationZ(t),this.applyMatrix(e),this}}(),translate:function(){var e;return function(t,i,n){return void 0===e&&(e=new h),e.makeTranslation(t,i,n),this.applyMatrix(e),this}}(),scale:function(){var e;return function(t,i,n){return void 0===e&&(e=new h),e.makeScale(t,i,n),this.applyMatrix(e),this}}(),lookAt:function(){var e;return function(t){void 0===e&&(e=new ce),e.lookAt(t),e.updateMatrix(),this.applyMatrix(e.matrix)}}(),center:function(){this.computeBoundingBox();var e=this.boundingBox.getCenter().negate();return this.translate(e.x,e.y,e.z),e},setFromObject:function(e){var t=e.geometry;if(e.isPoints||e.isLine){var i=new be(3*t.vertices.length,3),n=new be(3*t.colors.length,3);if(this.addAttribute("position",i.copyVector3sArray(t.vertices)),this.addAttribute("color",n.copyColorsArray(t.colors)),t.lineDistances&&t.lineDistances.length===t.vertices.length){var r=new be(t.lineDistances.length,1);this.addAttribute("lineDistance",r.copyArray(t.lineDistances))}null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone())}else e.isMesh&&t&&t.isGeometry&&this.fromGeometry(t);return this},updateFromObject:function(e){var t=e.geometry;if(e.isMesh){var i=t.__directGeometry;if(t.elementsNeedUpdate===!0&&(i=void 0,t.elementsNeedUpdate=!1),void 0===i)return this.fromGeometry(t);i.verticesNeedUpdate=t.verticesNeedUpdate,i.normalsNeedUpdate=t.normalsNeedUpdate,i.colorsNeedUpdate=t.colorsNeedUpdate,i.uvsNeedUpdate=t.uvsNeedUpdate,i.groupsNeedUpdate=t.groupsNeedUpdate,t.verticesNeedUpdate=!1,t.normalsNeedUpdate=!1,t.colorsNeedUpdate=!1,t.uvsNeedUpdate=!1,t.groupsNeedUpdate=!1,t=i}var n;return t.verticesNeedUpdate===!0&&(n=this.attributes.position,void 0!==n&&(n.copyVector3sArray(t.vertices),n.needsUpdate=!0),t.verticesNeedUpdate=!1),t.normalsNeedUpdate===!0&&(n=this.attributes.normal,void 0!==n&&(n.copyVector3sArray(t.normals),n.needsUpdate=!0),t.normalsNeedUpdate=!1),t.colorsNeedUpdate===!0&&(n=this.attributes.color,void 0!==n&&(n.copyColorsArray(t.colors),n.needsUpdate=!0),t.colorsNeedUpdate=!1),t.uvsNeedUpdate&&(n=this.attributes.uv,void 0!==n&&(n.copyVector2sArray(t.uvs),n.needsUpdate=!0),t.uvsNeedUpdate=!1),t.lineDistancesNeedUpdate&&(n=this.attributes.lineDistance,void 0!==n&&(n.copyArray(t.lineDistances),n.needsUpdate=!0),t.lineDistancesNeedUpdate=!1),t.groupsNeedUpdate&&(t.computeGroups(e.geometry),this.groups=t.groups,t.groupsNeedUpdate=!1),this},fromGeometry:function(e){return e.__directGeometry=(new Me).fromGeometry(e),this.fromDirectGeometry(e.__directGeometry)},fromDirectGeometry:function(e){var t=new Float32Array(3*e.vertices.length);if(this.addAttribute("position",new de(t,3).copyVector3sArray(e.vertices)),e.normals.length>0){var i=new Float32Array(3*e.normals.length);this.addAttribute("normal",new de(i,3).copyVector3sArray(e.normals))}if(e.colors.length>0){var n=new Float32Array(3*e.colors.length);this.addAttribute("color",new de(n,3).copyColorsArray(e.colors))}if(e.uvs.length>0){var r=new Float32Array(2*e.uvs.length);this.addAttribute("uv",new de(r,2).copyVector2sArray(e.uvs))}if(e.uvs2.length>0){var a=new Float32Array(2*e.uvs2.length);this.addAttribute("uv2",new de(a,2).copyVector2sArray(e.uvs2))}if(e.indices.length>0){var o=Ee(e.indices)>65535?Uint32Array:Uint16Array,s=new o(3*e.indices.length);this.setIndex(new de(s,1).copyIndicesArray(e.indices))}this.groups=e.groups;for(var c in e.morphTargets){for(var h=[],l=e.morphTargets[c],u=0,p=l.length;p>u;u++){var d=l[u],f=new be(3*d.length,3);h.push(f.copyVector3sArray(d))}this.morphAttributes[c]=h}if(e.skinIndices.length>0){var m=new be(4*e.skinIndices.length,4);this.addAttribute("skinIndex",m.copyVector4sArray(e.skinIndices))}if(e.skinWeights.length>0){var g=new be(4*e.skinWeights.length,4);this.addAttribute("skinWeight",g.copyVector4sArray(e.skinWeights))}return null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),this},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new $);var e=this.attributes.position;void 0!==e?this.boundingBox.setFromBufferAttribute(e):this.boundingBox.makeEmpty(),(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox: Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)},computeBoundingSphere:function(){var e=new $,t=new c;return function(){null===this.boundingSphere&&(this.boundingSphere=new ee);var i=this.attributes.position;if(i){var n=this.boundingSphere.center;e.setFromBufferAttribute(i),e.getCenter(n);for(var r=0,a=0,o=i.count;o>a;a++)t.x=i.getX(a),t.y=i.getY(a),t.z=i.getZ(a),r=Math.max(r,n.distanceToSquared(t));this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}}(),computeFaceNormals:function(){},computeVertexNormals:function(){var e=this.index,t=this.attributes,i=this.groups;if(t.position){var n=t.position.array;if(void 0===t.normal)this.addAttribute("normal",new de(new Float32Array(n.length),3));else for(var r=t.normal.array,a=0,o=r.length;o>a;a++)r[a]=0;var s,h,l,u=t.normal.array,p=new c,d=new c,f=new c,m=new c,g=new c;if(e){var v=e.array;0===i.length&&this.addGroup(0,v.length);for(var y=0,x=i.length;x>y;++y)for(var _=i[y],b=_.start,w=_.count,a=b,o=b+w;o>a;a+=3)s=3*v[a+0],h=3*v[a+1],l=3*v[a+2],p.fromArray(n,s),d.fromArray(n,h),f.fromArray(n,l),m.subVectors(f,d),g.subVectors(p,d),m.cross(g),u[s]+=m.x,u[s+1]+=m.y,u[s+2]+=m.z,u[h]+=m.x,u[h+1]+=m.y,u[h+2]+=m.z,u[l]+=m.x,u[l+1]+=m.y,u[l+2]+=m.z}else for(var a=0,o=n.length;o>a;a+=9)p.fromArray(n,a),d.fromArray(n,a+3),f.fromArray(n,a+6),m.subVectors(f,d),g.subVectors(p,d),m.cross(g),u[a]=m.x,u[a+1]=m.y,u[a+2]=m.z,u[a+3]=m.x,u[a+4]=m.y,u[a+5]=m.z,u[a+6]=m.x,u[a+7]=m.y,u[a+8]=m.z;this.normalizeNormals(),t.normal.needsUpdate=!0}},merge:function(e,t){if((e&&e.isBufferGeometry)===!1)return void console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",e);void 0===t&&(t=0);var i=this.attributes;for(var n in i)if(void 0!==e.attributes[n])for(var r=i[n],a=r.array,o=e.attributes[n],s=o.array,c=o.itemSize,h=0,l=c*t;h<s.length;h++,l++)a[l]=s[h];return this},normalizeNormals:function(){for(var e,t,i,n,r=this.attributes.normal.array,a=0,o=r.length;o>a;a+=3)e=r[a],t=r[a+1],i=r[a+2],n=1/Math.sqrt(e*e+t*t+i*i),r[a]*=n,r[a+1]*=n,r[a+2]*=n},toNonIndexed:function(){if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): Geometry is already non-indexed."),this;var e=new Ae,t=this.index.array,i=this.attributes;for(var n in i){for(var r=i[n],a=r.array,o=r.itemSize,s=new a.constructor(t.length*o),c=0,h=0,l=0,u=t.length;u>l;l++){c=t[l]*o;for(var p=0;o>p;p++)s[h++]=a[c++]}e.addAttribute(n,new de(s,o))}return e},toJSON:function(){var e={metadata:{version:4.4,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,""!==this.name&&(e.name=this.name),void 0!==this.parameters){var t=this.parameters;for(var i in t)void 0!==t[i]&&(e[i]=t[i]);return e}e.data={attributes:{}};var n=this.index;if(null!==n){var r=Array.prototype.slice.call(n.array);e.data.index={type:n.array.constructor.name,array:r}}var a=this.attributes;for(var i in a){var o=a[i],r=Array.prototype.slice.call(o.array);e.data.attributes[i]={itemSize:o.itemSize,type:o.array.constructor.name,array:r,normalized:o.normalized}}var s=this.groups;s.length>0&&(e.data.groups=JSON.parse(JSON.stringify(s)));var c=this.boundingSphere;return null!==c&&(e.data.boundingSphere={center:c.center.toArray(),radius:c.radius}),e},clone:function(){return(new Ae).copy(this)},copy:function(e){var t,i,n;this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.name=e.name;var r=e.index;null!==r&&this.setIndex(r.clone());var a=e.attributes;for(t in a){var o=a[t];this.addAttribute(t,o.clone())}var s=e.morphAttributes;for(t in s){var c=[],h=s[t];for(i=0,n=h.length;n>i;i++)c.push(h[i].clone());this.morphAttributes[t]=c}var l=e.groups;for(i=0,n=l.length;n>i;i++){var u=l[i];this.addGroup(u.start,u.count,u.materialIndex)}var p=e.boundingBox;null!==p&&(this.boundingBox=p.clone());var d=e.boundingSphere;return null!==d&&(this.boundingSphere=d.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this},dispose:function(){this.dispatchEvent({type:"dispose"})}},Ae.MaxIndex=65535,Object.assign(Ae.prototype,t.prototype),Le.prototype=Object.assign(Object.create(ce.prototype),{constructor:Le,isMesh:!0,setDrawMode:function(e){this.drawMode=e},copy:function(e){return ce.prototype.copy.call(this,e),this.drawMode=e.drawMode,this},updateMorphTargets:function(){var e=this.geometry.morphTargets;if(void 0!==e&&e.length>0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var t=0,i=e.length;i>t;t++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[e[t].name]=t}},raycast:function(){function e(e,t,i,n,r,a,o){return le.barycoordFromPoint(e,t,i,n,y),r.multiplyScalar(y.x),a.multiplyScalar(y.y),o.multiplyScalar(y.z),r.add(a).add(o),r.clone()}function t(e,t,i,n,r,a,o){var s,c=e.material;if(s=c.side===aa?i.intersectTriangle(a,r,n,!0,o):i.intersectTriangle(n,r,a,c.side!==oa,o),null===s)return null;_.copy(o),_.applyMatrix4(e.matrixWorld);var h=t.ray.origin.distanceTo(_);return h<t.near||h>t.far?null:{distance:h,point:_.clone(),object:e}}function n(i,n,r,a,o,c,h,p){s.fromBufferAttribute(a,c),l.fromBufferAttribute(a,h),u.fromBufferAttribute(a,p);var d=t(i,n,r,s,l,u,x);return d&&(o&&(m.fromBufferAttribute(o,c),g.fromBufferAttribute(o,h),v.fromBufferAttribute(o,p),d.uv=e(x,s,l,u,m,g,v)),d.face=new ue(c,h,p,le.normal(s,l,u)),d.faceIndex=c),d}var r=new h,a=new ae,o=new ee,s=new c,l=new c,u=new c,p=new c,d=new c,f=new c,m=new i,g=new i,v=new i,y=new c,x=new c,_=new c;return function(i,c){var h=this.geometry,y=this.material,_=this.matrixWorld;if(void 0!==y&&(null===h.boundingSphere&&h.computeBoundingSphere(),o.copy(h.boundingSphere),o.applyMatrix4(_),i.ray.intersectsSphere(o)!==!1&&(r.getInverse(_),a.copy(i.ray).applyMatrix4(r),null===h.boundingBox||a.intersectsBox(h.boundingBox)!==!1))){var b;if(h.isBufferGeometry){var w,M,E,T,S,A=h.index,L=h.attributes.position,R=h.attributes.uv;if(null!==A)for(T=0,S=A.count;S>T;T+=3)w=A.getX(T),M=A.getX(T+1),E=A.getX(T+2),b=n(this,i,a,L,R,w,M,E),b&&(b.faceIndex=Math.floor(T/3),c.push(b));else for(T=0,S=L.count;S>T;T+=3)w=T,M=T+1,E=T+2,b=n(this,i,a,L,R,w,M,E),b&&(b.index=w,c.push(b))}else if(h.isGeometry){var P,C,I,U,N=y&&y.isMultiMaterial,D=N===!0?y.materials:null,O=h.vertices,B=h.faces,F=h.faceVertexUvs[0];F.length>0&&(U=F);for(var z=0,G=B.length;G>z;z++){var H=B[z],V=N===!0?D[H.materialIndex]:y;if(void 0!==V){if(P=O[H.a],C=O[H.b],I=O[H.c],V.morphTargets===!0){var k=h.morphTargets,j=this.morphTargetInfluences;s.set(0,0,0),l.set(0,0,0),u.set(0,0,0);for(var W=0,X=k.length;X>W;W++){var q=j[W];if(0!==q){var Y=k[W].vertices;s.addScaledVector(p.subVectors(Y[H.a],P),q),l.addScaledVector(d.subVectors(Y[H.b],C),q),u.addScaledVector(f.subVectors(Y[H.c],I),q)}}s.add(P),l.add(C),u.add(I),P=s,C=l,I=u}if(b=t(this,i,a,P,C,I,x)){if(U){var Z=U[z];m.copy(Z[0]),g.copy(Z[1]),v.copy(Z[2]),b.uv=e(x,P,C,I,m,g,v)}b.face=H,b.faceIndex=z,c.push(b)}}}}}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),Re.prototype=Object.create(Se.prototype),Re.prototype.constructor=Re,Pe.prototype=Object.create(Ae.prototype),Pe.prototype.constructor=Pe,Ce.prototype=Object.create(Se.prototype),Ce.prototype.constructor=Ce,Ie.prototype=Object.create(Ae.prototype),Ie.prototype.constructor=Ie,Ue.prototype=Object.create(ce.prototype),Ue.prototype.constructor=Ue,Ue.prototype.isCamera=!0,Ue.prototype.getWorldDirection=function(){var e=new s;return function(t){var i=t||new c;return this.getWorldQuaternion(e),i.set(0,0,-1).applyQuaternion(e)}}(),Ue.prototype.lookAt=function(){var e=new h;return function(t){e.lookAt(this.position,t,this.up),this.quaternion.setFromRotationMatrix(e)}}(),Ue.prototype.clone=function(){return(new this.constructor).copy(this)},Ue.prototype.copy=function(e){return ce.prototype.copy.call(this,e),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this},Ne.prototype=Object.assign(Object.create(Ue.prototype),{constructor:Ne,isPerspectiveCamera:!0,copy:function(e){return Ue.prototype.copy.call(this,e),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=null===e.view?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this},setFocalLength:function(e){var t=.5*this.getFilmHeight()/e;this.fov=2*us.RAD2DEG*Math.atan(t),this.updateProjectionMatrix()},getFocalLength:function(){var e=Math.tan(.5*us.DEG2RAD*this.fov);return.5*this.getFilmHeight()/e},getEffectiveFOV:function(){return 2*us.RAD2DEG*Math.atan(Math.tan(.5*us.DEG2RAD*this.fov)/this.zoom)},getFilmWidth:function(){return this.filmGauge*Math.min(this.aspect,1)},getFilmHeight:function(){return this.filmGauge/Math.max(this.aspect,1)},setViewOffset:function(e,t,i,n,r,a){this.aspect=e/t,this.view={fullWidth:e,fullHeight:t,offsetX:i,offsetY:n,width:r,height:a},this.updateProjectionMatrix()},clearViewOffset:function(){this.view=null,this.updateProjectionMatrix()},updateProjectionMatrix:function(){var e=this.near,t=e*Math.tan(.5*us.DEG2RAD*this.fov)/this.zoom,i=2*t,n=this.aspect*i,r=-.5*n,a=this.view;if(null!==a){var o=a.fullWidth,s=a.fullHeight;r+=a.offsetX*n/o,t-=a.offsetY*i/s,n*=a.width/o,i*=a.height/s}var c=this.filmOffset;0!==c&&(r+=e*c/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+n,t,t-i,e,this.far)},toJSON:function(e){var t=ce.prototype.toJSON.call(this,e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,null!==this.view&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}),De.prototype=Object.assign(Object.create(Ue.prototype),{constructor:De,isOrthographicCamera:!0,copy:function(e){return Ue.prototype.copy.call(this,e),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=null===e.view?null:Object.assign({},e.view),this},setViewOffset:function(e,t,i,n,r,a){this.view={fullWidth:e,fullHeight:t,offsetX:i,offsetY:n,width:r,height:a},this.updateProjectionMatrix()},clearViewOffset:function(){this.view=null,this.updateProjectionMatrix()},updateProjectionMatrix:function(){var e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,n=(this.top+this.bottom)/2,r=i-e,a=i+e,o=n+t,s=n-t;if(null!==this.view){var c=this.zoom/(this.view.width/this.view.fullWidth),h=this.zoom/(this.view.height/this.view.fullHeight),l=(this.right-this.left)/this.view.width,u=(this.top-this.bottom)/this.view.height;r+=l*(this.view.offsetX/c),a=r+l*(this.view.width/c),o-=u*(this.view.offsetY/h),s=o-u*(this.view.height/h)}this.projectionMatrix.makeOrthographic(r,a,o,s,this.near,this.far)},toJSON:function(e){var t=ce.prototype.toJSON.call(this,e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,null!==this.view&&(t.object.view=Object.assign({},this.view)),t}});var Sh=0;ht.prototype.isFogExp2=!0,ht.prototype.clone=function(){return new ht(this.color.getHex(),this.density)},ht.prototype.toJSON=function(e){return{type:"FogExp2",color:this.color.getHex(),density:this.density}},lt.prototype.isFog=!0,lt.prototype.clone=function(){return new lt(this.color.getHex(),this.near,this.far)},lt.prototype.toJSON=function(e){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}},ut.prototype=Object.create(ce.prototype),ut.prototype.constructor=ut,ut.prototype.copy=function(e,t){return ce.prototype.copy.call(this,e,t),null!==e.background&&(this.background=e.background.clone()),null!==e.fog&&(this.fog=e.fog.clone()),null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.autoUpdate=e.autoUpdate,this.matrixAutoUpdate=e.matrixAutoUpdate,this},ut.prototype.toJSON=function(e){var t=ce.prototype.toJSON.call(this,e);return null!==this.background&&(t.object.background=this.background.toJSON(e)),null!==this.fog&&(t.object.fog=this.fog.toJSON()),t},pt.prototype=Object.assign(Object.create(ce.prototype),{constructor:pt,isLensFlare:!0,copy:function(e){ce.prototype.copy.call(this,e),this.positionScreen.copy(e.positionScreen),this.customUpdateCallback=e.customUpdateCallback;for(var t=0,i=e.lensFlares.length;i>t;t++)this.lensFlares.push(e.lensFlares[t]);return this},add:function(e,t,i,n,r,a){void 0===t&&(t=-1),void 0===i&&(i=0),void 0===a&&(a=1),void 0===r&&(r=new W(16777215)),void 0===n&&(n=da),i=Math.min(i,Math.max(0,i)),this.lensFlares.push({texture:e,size:t,distance:i,x:0,y:0,z:0,scale:1,rotation:0,opacity:a,color:r,blending:n})},updateLensFlares:function(){var e,t,i=this.lensFlares.length,n=2*-this.positionScreen.x,r=2*-this.positionScreen.y;for(e=0;i>e;e++)t=this.lensFlares[e],t.x=this.positionScreen.x+n*t.distance,t.y=this.positionScreen.y+r*t.distance,t.wantedRotation=t.x*Math.PI*.25,t.rotation+=.25*(t.wantedRotation-t.rotation)}}),dt.prototype=Object.create(J.prototype),dt.prototype.constructor=dt,dt.prototype.copy=function(e){return J.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.rotation=e.rotation,this},ft.prototype=Object.assign(Object.create(ce.prototype),{constructor:ft,isSprite:!0,raycast:function(){var e=new c;return function(t,i){e.setFromMatrixPosition(this.matrixWorld);var n=t.ray.distanceSqToPoint(e),r=this.scale.x*this.scale.y/4;n>r||i.push({distance:Math.sqrt(n),point:this.position,face:null,object:this})}}(),clone:function(){return new this.constructor(this.material).copy(this)}}),mt.prototype=Object.assign(Object.create(ce.prototype),{constructor:mt,copy:function(e){ce.prototype.copy.call(this,e,!1);for(var t=e.levels,i=0,n=t.length;n>i;i++){var r=t[i];this.addLevel(r.object.clone(),r.distance)}return this},addLevel:function(e,t){void 0===t&&(t=0),t=Math.abs(t);for(var i=this.levels,n=0;n<i.length&&!(t<i[n].distance);n++);i.splice(n,0,{distance:t,object:e}),this.add(e)},getObjectForDistance:function(e){for(var t=this.levels,i=1,n=t.length;n>i&&!(e<t[i].distance);i++);return t[i-1].object},raycast:function(){var e=new c;return function(t,i){e.setFromMatrixPosition(this.matrixWorld);var n=t.ray.origin.distanceTo(e);this.getObjectForDistance(n).raycast(t,i)}}(),update:function(){var e=new c,t=new c;return function(i){var n=this.levels;if(n.length>1){e.setFromMatrixPosition(i.matrixWorld),t.setFromMatrixPosition(this.matrixWorld);var r=e.distanceTo(t);n[0].object.visible=!0;for(var a=1,o=n.length;o>a&&r>=n[a].distance;a++)n[a-1].object.visible=!1,n[a].object.visible=!0;for(;o>a;a++)n[a].object.visible=!1}}}(),toJSON:function(e){var t=ce.prototype.toJSON.call(this,e);t.object.levels=[];for(var i=this.levels,n=0,r=i.length;r>n;n++){var a=i[n];t.object.levels.push({object:a.object.uuid,distance:a.distance})}return t}}),Object.assign(gt.prototype,{calculateInverses:function(){this.boneInverses=[];for(var e=0,t=this.bones.length;t>e;e++){var i=new h;this.bones[e]&&i.getInverse(this.bones[e].matrixWorld),this.boneInverses.push(i)}},pose:function(){for(var e,t=0,i=this.bones.length;i>t;t++)e=this.bones[t],e&&e.matrixWorld.getInverse(this.boneInverses[t]);for(var t=0,i=this.bones.length;i>t;t++)e=this.bones[t],e&&(e.parent&&e.parent.isBone?(e.matrix.getInverse(e.parent.matrixWorld),e.matrix.multiply(e.matrixWorld)):e.matrix.copy(e.matrixWorld),e.matrix.decompose(e.position,e.quaternion,e.scale))},update:function(){var e=new h;return function(){for(var t=0,i=this.bones.length;i>t;t++){var n=this.bones[t]?this.bones[t].matrixWorld:this.identityMatrix;e.multiplyMatrices(n,this.boneInverses[t]),e.toArray(this.boneMatrices,16*t)}this.useVertexTexture&&(this.boneTexture.needsUpdate=!0)}}(),clone:function(){return new gt(this.bones,this.boneInverses,this.useVertexTexture)}}),vt.prototype=Object.assign(Object.create(ce.prototype),{constructor:vt,isBone:!0}),yt.prototype=Object.assign(Object.create(Le.prototype),{constructor:yt,isSkinnedMesh:!0,bind:function(e,t){this.skeleton=e,void 0===t&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.getInverse(t)},pose:function(){this.skeleton.pose()},normalizeSkinWeights:function(){if(this.geometry&&this.geometry.isGeometry)for(var e=0;e<this.geometry.skinWeights.length;e++){var t=this.geometry.skinWeights[e],i=1/t.lengthManhattan();i!==1/0?t.multiplyScalar(i):t.set(1,0,0,0)}else if(this.geometry&&this.geometry.isBufferGeometry)for(var n=new r,a=this.geometry.attributes.skinWeight,e=0;e<a.count;e++){n.x=a.getX(e),n.y=a.getY(e),n.z=a.getZ(e),n.w=a.getW(e);var i=1/n.lengthManhattan();i!==1/0?n.multiplyScalar(i):n.set(1,0,0,0),a.setXYZW(e,n.x,n.y,n.z,n.w)}},updateMatrixWorld:function(e){Le.prototype.updateMatrixWorld.call(this,!0),"attached"===this.bindMode?this.bindMatrixInverse.getInverse(this.matrixWorld):"detached"===this.bindMode?this.bindMatrixInverse.getInverse(this.bindMatrix):console.warn("THREE.SkinnedMesh unrecognized bindMode: "+this.bindMode)},clone:function(){return new this.constructor(this.geometry,this.material,this.skeleton.useVertexTexture).copy(this)}}),xt.prototype=Object.create(J.prototype),xt.prototype.constructor=xt,xt.prototype.isLineBasicMaterial=!0,xt.prototype.copy=function(e){return J.prototype.copy.call(this,e),this.color.copy(e.color),this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this},_t.prototype=Object.assign(Object.create(ce.prototype),{constructor:_t,isLine:!0,raycast:function(){var e=new h,t=new ae,i=new ee;return function(n,r){var a=n.linePrecision,o=a*a,s=this.geometry,h=this.matrixWorld;if(null===s.boundingSphere&&s.computeBoundingSphere(),i.copy(s.boundingSphere),i.applyMatrix4(h),n.ray.intersectsSphere(i)!==!1){e.getInverse(h),t.copy(n.ray).applyMatrix4(e);var l=new c,u=new c,p=new c,d=new c,f=this&&this.isLineSegments?2:1;if(s.isBufferGeometry){var m=s.index,g=s.attributes,v=g.position.array;if(null!==m)for(var y=m.array,x=0,_=y.length-1;_>x;x+=f){var b=y[x],w=y[x+1];l.fromArray(v,3*b),u.fromArray(v,3*w);var M=t.distanceSqToSegment(l,u,d,p);if(!(M>o)){d.applyMatrix4(this.matrixWorld);var E=n.ray.origin.distanceTo(d);E<n.near||E>n.far||r.push({distance:E,point:p.clone().applyMatrix4(this.matrixWorld),index:x,face:null,faceIndex:null,object:this})}}else for(var x=0,_=v.length/3-1;_>x;x+=f){l.fromArray(v,3*x),u.fromArray(v,3*x+3);var M=t.distanceSqToSegment(l,u,d,p);if(!(M>o)){d.applyMatrix4(this.matrixWorld);var E=n.ray.origin.distanceTo(d);E<n.near||E>n.far||r.push({distance:E,point:p.clone().applyMatrix4(this.matrixWorld),index:x,face:null,faceIndex:null,object:this})}}}else if(s.isGeometry)for(var T=s.vertices,S=T.length,x=0;S-1>x;x+=f){var M=t.distanceSqToSegment(T[x],T[x+1],d,p);if(!(M>o)){d.applyMatrix4(this.matrixWorld);var E=n.ray.origin.distanceTo(d);E<n.near||E>n.far||r.push({distance:E,point:p.clone().applyMatrix4(this.matrixWorld),index:x,face:null,faceIndex:null,object:this})}}}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),bt.prototype=Object.assign(Object.create(_t.prototype),{constructor:bt,isLineSegments:!0}),wt.prototype=Object.create(J.prototype),wt.prototype.constructor=wt,wt.prototype.isPointsMaterial=!0,wt.prototype.copy=function(e){return J.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this},Mt.prototype=Object.assign(Object.create(ce.prototype),{constructor:Mt,isPoints:!0,raycast:function(){var e=new h,t=new ae,i=new ee;return function(n,r){function a(e,i){var a=t.distanceSqToPoint(e);if(p>a){var s=t.closestPointToPoint(e);s.applyMatrix4(h);var c=n.ray.origin.distanceTo(s);if(c<n.near||c>n.far)return;r.push({distance:c,distanceToRay:Math.sqrt(a),point:s.clone(),index:i,face:null,object:o})}}var o=this,s=this.geometry,h=this.matrixWorld,l=n.params.Points.threshold;if(null===s.boundingSphere&&s.computeBoundingSphere(),i.copy(s.boundingSphere),i.applyMatrix4(h),n.ray.intersectsSphere(i)!==!1){e.getInverse(h),t.copy(n.ray).applyMatrix4(e);var u=l/((this.scale.x+this.scale.y+this.scale.z)/3),p=u*u,d=new c;if(s.isBufferGeometry){var f=s.index,m=s.attributes,g=m.position.array;if(null!==f)for(var v=f.array,y=0,x=v.length;x>y;y++){var _=v[y];d.fromArray(g,3*_),a(d,_)}else for(var y=0,b=g.length/3;b>y;y++)d.fromArray(g,3*y),a(d,y)}else for(var w=s.vertices,y=0,b=w.length;b>y;y++)a(w[y],y)}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),Et.prototype=Object.assign(Object.create(ce.prototype),{constructor:Et}),Tt.prototype=Object.create(n.prototype),Tt.prototype.constructor=Tt,St.prototype=Object.create(n.prototype),St.prototype.constructor=St,St.prototype.isCompressedTexture=!0,At.prototype=Object.create(n.prototype),At.prototype.constructor=At,
10
+ Lt.prototype=Object.create(n.prototype),Lt.prototype.constructor=Lt,Lt.prototype.isDepthTexture=!0,Rt.prototype=Object.create(Ae.prototype),Rt.prototype.constructor=Rt,Pt.prototype=Object.create(Se.prototype),Pt.prototype.constructor=Pt,Ct.prototype=Object.create(Ae.prototype),Ct.prototype.constructor=Ct,It.prototype=Object.create(Se.prototype),It.prototype.constructor=It,Ut.prototype=Object.create(Ae.prototype),Ut.prototype.constructor=Ut,Nt.prototype=Object.create(Se.prototype),Nt.prototype.constructor=Nt,Dt.prototype=Object.create(Ut.prototype),Dt.prototype.constructor=Dt,Ot.prototype=Object.create(Se.prototype),Ot.prototype.constructor=Ot,Bt.prototype=Object.create(Ut.prototype),Bt.prototype.constructor=Bt,Ft.prototype=Object.create(Se.prototype),Ft.prototype.constructor=Ft,zt.prototype=Object.create(Ut.prototype),zt.prototype.constructor=zt,Gt.prototype=Object.create(Se.prototype),Gt.prototype.constructor=Gt,Ht.prototype=Object.create(Ut.prototype),Ht.prototype.constructor=Ht,Vt.prototype=Object.create(Se.prototype),Vt.prototype.constructor=Vt,kt.prototype=Object.create(Ae.prototype),kt.prototype.constructor=kt,jt.prototype=Object.create(Se.prototype),jt.prototype.constructor=jt,Wt.prototype=Object.create(Ae.prototype),Wt.prototype.constructor=Wt,Xt.prototype=Object.create(Se.prototype),Xt.prototype.constructor=Xt,qt.prototype=Object.create(Ae.prototype),qt.prototype.constructor=qt;var Ah={area:function(e){for(var t=e.length,i=0,n=t-1,r=0;t>r;n=r++)i+=e[n].x*e[r].y-e[r].x*e[n].y;return.5*i},triangulate:function(){function e(e,t,i,n,r,a){var o,s,c,h,l,u,p,d,f;if(s=e[a[t]].x,c=e[a[t]].y,h=e[a[i]].x,l=e[a[i]].y,u=e[a[n]].x,p=e[a[n]].y,0>=(h-s)*(p-c)-(l-c)*(u-s))return!1;var m,g,v,y,x,_,b,w,M,E,T,S,A,L,R;for(m=u-h,g=p-l,v=s-u,y=c-p,x=h-s,_=l-c,o=0;r>o;o++)if(d=e[a[o]].x,f=e[a[o]].y,!(d===s&&f===c||d===h&&f===l||d===u&&f===p)&&(b=d-s,w=f-c,M=d-h,E=f-l,T=d-u,S=f-p,R=m*E-g*M,A=x*w-_*b,L=v*S-y*T,R>=-Number.EPSILON&&L>=-Number.EPSILON&&A>=-Number.EPSILON))return!1;return!0}return function(t,i){var n=t.length;if(3>n)return null;var r,a,o,s=[],c=[],h=[];if(Ah.area(t)>0)for(a=0;n>a;a++)c[a]=a;else for(a=0;n>a;a++)c[a]=n-1-a;var l=n,u=2*l;for(a=l-1;l>2;){if(u--<=0)return console.warn("THREE.ShapeUtils: Unable to triangulate polygon! in triangulate()"),i?h:s;if(r=a,r>=l&&(r=0),a=r+1,a>=l&&(a=0),o=a+1,o>=l&&(o=0),e(t,r,a,o,l,c)){var p,d,f,m,g;for(p=c[r],d=c[a],f=c[o],s.push([t[p],t[d],t[f]]),h.push([c[r],c[a],c[o]]),m=a,g=a+1;l>g;m++,g++)c[m]=c[g];l--,u=2*l}}return i?h:s}}(),triangulateShape:function(e,t){function i(e){var t=e.length;t>2&&e[t-1].equals(e[0])&&e.pop()}function n(e,t,i){return e.x!==t.x?e.x<t.x?e.x<=i.x&&i.x<=t.x:t.x<=i.x&&i.x<=e.x:e.y<t.y?e.y<=i.y&&i.y<=t.y:t.y<=i.y&&i.y<=e.y}function r(e,t,i,r,a){var o=t.x-e.x,s=t.y-e.y,c=r.x-i.x,h=r.y-i.y,l=e.x-i.x,u=e.y-i.y,p=s*c-o*h,d=s*l-o*u;if(Math.abs(p)>Number.EPSILON){var f;if(p>0){if(0>d||d>p)return[];if(f=h*l-c*u,0>f||f>p)return[]}else{if(d>0||p>d)return[];if(f=h*l-c*u,f>0||p>f)return[]}if(0===f)return!a||0!==d&&d!==p?[e]:[];if(f===p)return!a||0!==d&&d!==p?[t]:[];if(0===d)return[i];if(d===p)return[r];var m=f/p;return[{x:e.x+m*o,y:e.y+m*s}]}if(0!==d||h*l!==c*u)return[];var g=0===o&&0===s,v=0===c&&0===h;if(g&&v)return e.x!==i.x||e.y!==i.y?[]:[e];if(g)return n(i,r,e)?[e]:[];if(v)return n(e,t,i)?[i]:[];var y,x,_,b,w,M,E,T;return 0!==o?(e.x<t.x?(y=e,_=e.x,x=t,b=t.x):(y=t,_=t.x,x=e,b=e.x),i.x<r.x?(w=i,E=i.x,M=r,T=r.x):(w=r,E=r.x,M=i,T=i.x)):(e.y<t.y?(y=e,_=e.y,x=t,b=t.y):(y=t,_=t.y,x=e,b=e.y),i.y<r.y?(w=i,E=i.y,M=r,T=r.y):(w=r,E=r.y,M=i,T=i.y)),E>=_?E>b?[]:b===E?a?[]:[w]:T>=b?[w,x]:[w,M]:_>T?[]:_===T?a?[]:[y]:T>=b?[y,x]:[y,M]}function a(e,t,i,n){var r=t.x-e.x,a=t.y-e.y,o=i.x-e.x,s=i.y-e.y,c=n.x-e.x,h=n.y-e.y,l=r*s-a*o,u=r*h-a*c;if(Math.abs(l)>Number.EPSILON){var p=c*s-h*o;return l>0?u>=0&&p>=0:u>=0||p>=0}return u>0}function o(e,t){function i(e,t){var i=y.length-1,n=e-1;0>n&&(n=i);var r=e+1;r>i&&(r=0);var o=a(y[e],y[n],y[r],s[t]);if(!o)return!1;var c=s.length-1,h=t-1;0>h&&(h=c);var l=t+1;return l>c&&(l=0),o=a(s[t],s[h],s[l],y[e]),o?!0:!1}function n(e,t){var i,n,a;for(i=0;i<y.length;i++)if(n=i+1,n%=y.length,a=r(e,t,y[i],y[n],!0),a.length>0)return!0;return!1}function o(e,i){var n,a,o,s,c;for(n=0;n<x.length;n++)for(a=t[x[n]],o=0;o<a.length;o++)if(s=o+1,s%=a.length,c=r(e,i,a[o],a[s],!0),c.length>0)return!0;return!1}for(var s,c,h,l,u,p,d,f,m,g,v,y=e.concat(),x=[],_=[],b=0,w=t.length;w>b;b++)x.push(b);for(var M=0,E=2*x.length;x.length>0;){if(E--,0>E){console.log("Infinite Loop! Holes left:"+x.length+", Probably Hole outside Shape!");break}for(h=M;h<y.length;h++){l=y[h],c=-1;for(var b=0;b<x.length;b++)if(p=x[b],d=l.x+":"+l.y+":"+p,void 0===_[d]){s=t[p];for(var T=0;T<s.length;T++)if(u=s[T],i(h,T)&&!n(l,u)&&!o(l,u)){c=T,x.splice(b,1),f=y.slice(0,h+1),m=y.slice(h),g=s.slice(c),v=s.slice(0,c+1),y=f.concat(g).concat(v).concat(m),M=h;break}if(c>=0)break;_[d]=!0}if(c>=0)break}}return y}i(e),t.forEach(i);for(var s,c,h,l,u,p,d={},f=e.concat(),m=0,g=t.length;g>m;m++)Array.prototype.push.apply(f,t[m]);for(s=0,c=f.length;c>s;s++)u=f[s].x+":"+f[s].y,void 0!==d[u]&&console.warn("THREE.ShapeUtils: Duplicate point",u,s),d[u]=s;var v=o(e,t),y=Ah.triangulate(v,!1);for(s=0,c=y.length;c>s;s++)for(l=y[s],h=0;3>h;h++)u=l[h].x+":"+l[h].y,p=d[u],void 0!==p&&(l[h]=p);return y.concat()},isClockWise:function(e){return Ah.area(e)<0}};Yt.prototype=Object.create(Se.prototype),Yt.prototype.constructor=Yt,Yt.prototype.addShapeList=function(e,t){for(var i=e.length,n=0;i>n;n++){var r=e[n];this.addShape(r,t)}},Yt.prototype.addShape=function(e,t){function n(e,t,i){return t||console.error("THREE.ExtrudeGeometry: vec does not exist"),t.clone().multiplyScalar(i).add(e)}function r(e,t,n){var r,a,o=1,s=e.x-t.x,c=e.y-t.y,h=n.x-e.x,l=n.y-e.y,u=s*s+c*c,p=s*l-c*h;if(Math.abs(p)>Number.EPSILON){var d=Math.sqrt(u),f=Math.sqrt(h*h+l*l),m=t.x-c/d,g=t.y+s/d,v=n.x-l/f,y=n.y+h/f,x=((v-m)*l-(y-g)*h)/(s*l-c*h);r=m+s*x-e.x,a=g+c*x-e.y;var _=r*r+a*a;if(2>=_)return new i(r,a);o=Math.sqrt(_/2)}else{var b=!1;s>Number.EPSILON?h>Number.EPSILON&&(b=!0):s<-Number.EPSILON?h<-Number.EPSILON&&(b=!0):Math.sign(c)===Math.sign(l)&&(b=!0),b?(r=-c,a=s,o=Math.sqrt(u)):(r=s,a=c,o=Math.sqrt(u/2))}return new i(r/o,a/o)}function a(){if(b){var e=0,t=j*e;for(q=0;W>q;q++)k=O[q],l(k[2]+t,k[1]+t,k[0]+t);for(e=M+2*_,t=j*e,q=0;W>q;q++)k=O[q],l(k[0]+t,k[1]+t,k[2]+t)}else{for(q=0;W>q;q++)k=O[q],l(k[2],k[1],k[0]);for(q=0;W>q;q++)k=O[q],l(k[0]+j*M,k[1]+j*M,k[2]+j*M)}}function o(){var e=0;for(s(B,e),e+=B.length,L=0,R=N.length;R>L;L++)A=N[L],s(A,e),e+=A.length}function s(e,t){var i,n;for(q=e.length;--q>=0;){i=q,n=q-1,0>n&&(n=e.length-1);var r=0,a=M+2*_;for(r=0;a>r;r++){var o=j*r,s=j*(r+1),c=t+i+o,h=t+n+o,l=t+n+s,p=t+i+s;u(c,h,l,p,e,r,a,i,n)}}}function h(e,t,i){P.vertices.push(new c(e,t,i))}function l(e,t,i){e+=C,t+=C,i+=C,P.faces.push(new ue(e,t,i,null,null,0));var n=S.generateTopUV(P,e,t,i);P.faceVertexUvs[0].push(n)}function u(e,t,i,n,r,a,o,s,c){e+=C,t+=C,i+=C,n+=C,P.faces.push(new ue(e,t,n,null,null,1)),P.faces.push(new ue(t,i,n,null,null,1));var h=S.generateSideWallUV(P,e,t,i,n);P.faceVertexUvs[0].push([h[0],h[1],h[3]]),P.faceVertexUvs[0].push([h[1],h[2],h[3]])}var p,d,f,m,g,v=void 0!==t.amount?t.amount:100,y=void 0!==t.bevelThickness?t.bevelThickness:6,x=void 0!==t.bevelSize?t.bevelSize:y-2,_=void 0!==t.bevelSegments?t.bevelSegments:3,b=void 0!==t.bevelEnabled?t.bevelEnabled:!0,w=void 0!==t.curveSegments?t.curveSegments:12,M=void 0!==t.steps?t.steps:1,E=t.extrudePath,T=!1,S=void 0!==t.UVGenerator?t.UVGenerator:Yt.WorldUVGenerator;E&&(p=E.getSpacedPoints(M),T=!0,b=!1,d=void 0!==t.frames?t.frames:E.computeFrenetFrames(M,!1),f=new c,m=new c,g=new c),b||(_=0,y=0,x=0);var A,L,R,P=this,C=this.vertices.length,I=e.extractPoints(w),U=I.shape,N=I.holes,D=!Ah.isClockWise(U);if(D){for(U=U.reverse(),L=0,R=N.length;R>L;L++)A=N[L],Ah.isClockWise(A)&&(N[L]=A.reverse());D=!1}var O=Ah.triangulateShape(U,N),B=U;for(L=0,R=N.length;R>L;L++)A=N[L],U=U.concat(A);for(var F,z,G,H,V,k,j=U.length,W=O.length,X=[],q=0,Y=B.length,Z=Y-1,J=q+1;Y>q;q++,Z++,J++)Z===Y&&(Z=0),J===Y&&(J=0),X[q]=r(B[q],B[Z],B[J]);var Q,K=[],$=X.concat();for(L=0,R=N.length;R>L;L++){for(A=N[L],Q=[],q=0,Y=A.length,Z=Y-1,J=q+1;Y>q;q++,Z++,J++)Z===Y&&(Z=0),J===Y&&(J=0),Q[q]=r(A[q],A[Z],A[J]);K.push(Q),$=$.concat(Q)}for(F=0;_>F;F++){for(G=F/_,H=y*Math.cos(G*Math.PI/2),z=x*Math.sin(G*Math.PI/2),q=0,Y=B.length;Y>q;q++)V=n(B[q],X[q],z),h(V.x,V.y,-H);for(L=0,R=N.length;R>L;L++)for(A=N[L],Q=K[L],q=0,Y=A.length;Y>q;q++)V=n(A[q],Q[q],z),h(V.x,V.y,-H)}for(z=x,q=0;j>q;q++)V=b?n(U[q],$[q],z):U[q],T?(m.copy(d.normals[0]).multiplyScalar(V.x),f.copy(d.binormals[0]).multiplyScalar(V.y),g.copy(p[0]).add(m).add(f),h(g.x,g.y,g.z)):h(V.x,V.y,0);var ee;for(ee=1;M>=ee;ee++)for(q=0;j>q;q++)V=b?n(U[q],$[q],z):U[q],T?(m.copy(d.normals[ee]).multiplyScalar(V.x),f.copy(d.binormals[ee]).multiplyScalar(V.y),g.copy(p[ee]).add(m).add(f),h(g.x,g.y,g.z)):h(V.x,V.y,v/M*ee);for(F=_-1;F>=0;F--){for(G=F/_,H=y*Math.cos(G*Math.PI/2),z=x*Math.sin(G*Math.PI/2),q=0,Y=B.length;Y>q;q++)V=n(B[q],X[q],z),h(V.x,V.y,v+H);for(L=0,R=N.length;R>L;L++)for(A=N[L],Q=K[L],q=0,Y=A.length;Y>q;q++)V=n(A[q],Q[q],z),T?h(V.x,V.y+p[M-1].y,p[M-1].x+H):h(V.x,V.y,v+H)}a(),o()},Yt.WorldUVGenerator={generateTopUV:function(e,t,n,r){var a=e.vertices,o=a[t],s=a[n],c=a[r];return[new i(o.x,o.y),new i(s.x,s.y),new i(c.x,c.y)]},generateSideWallUV:function(e,t,n,r,a){var o=e.vertices,s=o[t],c=o[n],h=o[r],l=o[a];return Math.abs(s.y-c.y)<.01?[new i(s.x,1-s.z),new i(c.x,1-c.z),new i(h.x,1-h.z),new i(l.x,1-l.z)]:[new i(s.y,1-s.z),new i(c.y,1-c.z),new i(h.y,1-h.z),new i(l.y,1-l.z)]}},Zt.prototype=Object.create(Yt.prototype),Zt.prototype.constructor=Zt,Jt.prototype=Object.create(Se.prototype),Jt.prototype.constructor=Jt,Qt.prototype=Object.create(Ae.prototype),Qt.prototype.constructor=Qt,Kt.prototype=Object.create(Se.prototype),Kt.prototype.constructor=Kt,$t.prototype=Object.create(Ae.prototype),$t.prototype.constructor=$t,ei.prototype=Object.create(Se.prototype),ei.prototype.constructor=ei,ti.prototype=Object.create(Ae.prototype),ti.prototype.constructor=ti,ii.prototype=Object.create(Se.prototype),ii.prototype.constructor=ii,ni.prototype=Object.create(Ae.prototype),ni.prototype.constructor=ni,ri.prototype=Object.create(Ae.prototype),ri.prototype.constructor=ri,ai.prototype=Object.create(Se.prototype),ai.prototype.constructor=ai,oi.prototype=Object.create(Ae.prototype),oi.prototype.constructor=oi,si.prototype=Object.create(ai.prototype),si.prototype.constructor=si,ci.prototype=Object.create(oi.prototype),ci.prototype.constructor=ci,hi.prototype=Object.create(Se.prototype),hi.prototype.constructor=hi,li.prototype=Object.create(Ae.prototype),li.prototype.constructor=li;var Lh=Object.freeze({WireframeGeometry:Rt,ParametricGeometry:Pt,ParametricBufferGeometry:Ct,TetrahedronGeometry:Nt,TetrahedronBufferGeometry:Dt,OctahedronGeometry:Ot,OctahedronBufferGeometry:Bt,IcosahedronGeometry:Ft,IcosahedronBufferGeometry:zt,DodecahedronGeometry:Gt,DodecahedronBufferGeometry:Ht,PolyhedronGeometry:It,PolyhedronBufferGeometry:Ut,TubeGeometry:Vt,TubeBufferGeometry:kt,TorusKnotGeometry:jt,TorusKnotBufferGeometry:Wt,TorusGeometry:Xt,TorusBufferGeometry:qt,TextGeometry:Zt,SphereGeometry:Jt,SphereBufferGeometry:Qt,RingGeometry:Kt,RingBufferGeometry:$t,PlaneGeometry:Ce,PlaneBufferGeometry:Ie,LatheGeometry:ei,LatheBufferGeometry:ti,ShapeGeometry:ii,ShapeBufferGeometry:ni,ExtrudeGeometry:Yt,EdgesGeometry:ri,ConeGeometry:si,ConeBufferGeometry:ci,CylinderGeometry:ai,CylinderBufferGeometry:oi,CircleGeometry:hi,CircleBufferGeometry:li,BoxGeometry:Re,BoxBufferGeometry:Pe});ui.prototype=Object.create(Q.prototype),ui.prototype.constructor=ui,ui.prototype.isShadowMaterial=!0,pi.prototype=Object.create(Q.prototype),pi.prototype.constructor=pi,pi.prototype.isRawShaderMaterial=!0,di.prototype={constructor:di,isMultiMaterial:!0,toJSON:function(e){for(var t={metadata:{version:4.2,type:"material",generator:"MaterialExporter"},uuid:this.uuid,type:this.type,materials:[]},i=this.materials,n=0,r=i.length;r>n;n++){var a=i[n].toJSON(e);delete a.metadata,t.materials.push(a)}return t.visible=this.visible,t},clone:function(){for(var e=new this.constructor,t=0;t<this.materials.length;t++)e.materials.push(this.materials[t].clone());return e.visible=this.visible,e}},fi.prototype=Object.create(J.prototype),fi.prototype.constructor=fi,fi.prototype.isMeshStandardMaterial=!0,fi.prototype.copy=function(e){return J.prototype.copy.call(this,e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},mi.prototype=Object.create(fi.prototype),mi.prototype.constructor=mi,mi.prototype.isMeshPhysicalMaterial=!0,mi.prototype.copy=function(e){return fi.prototype.copy.call(this,e),this.defines={PHYSICAL:""},this.reflectivity=e.reflectivity,this.clearCoat=e.clearCoat,this.clearCoatRoughness=e.clearCoatRoughness,this},gi.prototype=Object.create(J.prototype),gi.prototype.constructor=gi,gi.prototype.isMeshPhongMaterial=!0,gi.prototype.copy=function(e){return J.prototype.copy.call(this,e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},vi.prototype=Object.create(gi.prototype),vi.prototype.constructor=vi,vi.prototype.isMeshToonMaterial=!0,vi.prototype.copy=function(e){return gi.prototype.copy.call(this,e),this.gradientMap=e.gradientMap,this},yi.prototype=Object.create(J.prototype),yi.prototype.constructor=yi,yi.prototype.isMeshNormalMaterial=!0,yi.prototype.copy=function(e){return J.prototype.copy.call(this,e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},xi.prototype=Object.create(J.prototype),xi.prototype.constructor=xi,xi.prototype.isMeshLambertMaterial=!0,xi.prototype.copy=function(e){return J.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},_i.prototype=Object.create(J.prototype),_i.prototype.constructor=_i,_i.prototype.isLineDashedMaterial=!0,_i.prototype.copy=function(e){return J.prototype.copy.call(this,e),this.color.copy(e.color),this.linewidth=e.linewidth,this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this};var Rh=Object.freeze({ShadowMaterial:ui,SpriteMaterial:dt,RawShaderMaterial:pi,ShaderMaterial:Q,PointsMaterial:wt,MultiMaterial:di,MeshPhysicalMaterial:mi,MeshStandardMaterial:fi,MeshPhongMaterial:gi,MeshToonMaterial:vi,MeshNormalMaterial:yi,MeshLambertMaterial:xi,MeshDepthMaterial:K,MeshBasicMaterial:pe,LineDashedMaterial:_i,LineBasicMaterial:xt,Material:J}),Ph={enabled:!1,files:{},add:function(e,t){this.enabled!==!1&&(this.files[e]=t)},get:function(e){return this.enabled!==!1?this.files[e]:void 0},remove:function(e){delete this.files[e]},clear:function(){this.files={}}},Ch=new bi;Object.assign(wi.prototype,{load:function(e,t,i,n){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e);var r=this,a=Ph.get(e);if(void 0!==a)return r.manager.itemStart(e),setTimeout(function(){t&&t(a),r.manager.itemEnd(e)},0),a;var o=/^data:(.*?)(;base64)?,(.*)$/,s=e.match(o);if(s){var c=s[1],h=!!s[2],l=s[3];l=window.decodeURIComponent(l),h&&(l=window.atob(l));try{var u,p=(this.responseType||"").toLowerCase();switch(p){case"arraybuffer":case"blob":u=new ArrayBuffer(l.length);for(var d=new Uint8Array(u),f=0;f<l.length;f++)d[f]=l.charCodeAt(f);"blob"===p&&(u=new Blob([u],{type:c}));break;case"document":var m=new DOMParser;u=m.parseFromString(l,c);break;case"json":u=JSON.parse(l);break;default:u=l}window.setTimeout(function(){t&&t(u),r.manager.itemEnd(e)},0)}catch(g){window.setTimeout(function(){n&&n(g),r.manager.itemError(e)},0)}}else{var v=new XMLHttpRequest;v.open("GET",e,!0),v.addEventListener("load",function(i){var a=i.target.response;Ph.add(e,a),200===this.status?(t&&t(a),r.manager.itemEnd(e)):0===this.status?(console.warn("THREE.FileLoader: HTTP Status 0 received."),t&&t(a),r.manager.itemEnd(e)):(n&&n(i),r.manager.itemError(e))},!1),void 0!==i&&v.addEventListener("progress",function(e){i(e)},!1),v.addEventListener("error",function(t){n&&n(t),r.manager.itemError(e)},!1),void 0!==this.responseType&&(v.responseType=this.responseType),void 0!==this.withCredentials&&(v.withCredentials=this.withCredentials),v.overrideMimeType&&v.overrideMimeType(void 0!==this.mimeType?this.mimeType:"text/plain"),v.send(null)}return r.manager.itemStart(e),v},setPath:function(e){return this.path=e,this},setResponseType:function(e){return this.responseType=e,this},setWithCredentials:function(e){return this.withCredentials=e,this},setMimeType:function(e){return this.mimeType=e,this}}),Object.assign(Mi.prototype,{load:function(e,t,i,n){function r(r){c.load(e[r],function(e){var i=a._parser(e,!0);o[r]={width:i.width,height:i.height,format:i.format,mipmaps:i.mipmaps},h+=1,6===h&&(1===i.mipmapCount&&(s.minFilter=lo),s.format=i.format,s.needsUpdate=!0,t&&t(s))},i,n)}var a=this,o=[],s=new St;s.image=o;var c=new wi(this.manager);if(c.setPath(this.path),c.setResponseType("arraybuffer"),Array.isArray(e))for(var h=0,l=0,u=e.length;u>l;++l)r(l);else c.load(e,function(e){var i=a._parser(e,!0);if(i.isCubemap)for(var n=i.mipmaps.length/i.mipmapCount,r=0;n>r;r++){o[r]={mipmaps:[]};for(var c=0;c<i.mipmapCount;c++)o[r].mipmaps.push(i.mipmaps[r*i.mipmapCount+c]),o[r].format=i.format,o[r].width=i.width,o[r].height=i.height}else s.image.width=i.width,s.image.height=i.height,s.mipmaps=i.mipmaps;1===i.mipmapCount&&(s.minFilter=lo),s.format=i.format,s.needsUpdate=!0,t&&t(s)},i,n);return s},setPath:function(e){return this.path=e,this}}),Object.assign(Ei.prototype,{load:function(e,t,i,n){var r=this,a=new X,o=new wi(this.manager);return o.setResponseType("arraybuffer"),o.load(e,function(e){var i=r._parser(e);i&&(void 0!==i.image?a.image=i.image:void 0!==i.data&&(a.image.width=i.width,a.image.height=i.height,a.image.data=i.data),a.wrapS=void 0!==i.wrapS?i.wrapS:ao,a.wrapT=void 0!==i.wrapT?i.wrapT:ao,a.magFilter=void 0!==i.magFilter?i.magFilter:lo,a.minFilter=void 0!==i.minFilter?i.minFilter:po,a.anisotropy=void 0!==i.anisotropy?i.anisotropy:1,void 0!==i.format&&(a.format=i.format),void 0!==i.type&&(a.type=i.type),void 0!==i.mipmaps&&(a.mipmaps=i.mipmaps),1===i.mipmapCount&&(a.minFilter=lo),a.needsUpdate=!0,t&&t(a,i))},i,n),a}}),Object.assign(Ti.prototype,{load:function(e,t,i,n){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e);var r=this,a=Ph.get(e);if(void 0!==a)return r.manager.itemStart(e),setTimeout(function(){t&&t(a),r.manager.itemEnd(e)},0),a;var o=document.createElementNS("http://www.w3.org/1999/xhtml","img");return o.addEventListener("load",function(){Ph.add(e,this),t&&t(this),r.manager.itemEnd(e)},!1),o.addEventListener("error",function(t){n&&n(t),r.manager.itemError(e)},!1),void 0!==this.crossOrigin&&(o.crossOrigin=this.crossOrigin),r.manager.itemStart(e),o.src=e,o},setCrossOrigin:function(e){return this.crossOrigin=e,this},setPath:function(e){return this.path=e,this}}),Object.assign(Si.prototype,{load:function(e,t,i,n){function r(i){o.load(e[i],function(e){a.images[i]=e,s++,6===s&&(a.needsUpdate=!0,t&&t(a))},void 0,n)}var a=new l,o=new Ti(this.manager);o.setCrossOrigin(this.crossOrigin),o.setPath(this.path);for(var s=0,c=0;c<e.length;++c)r(c);return a},setCrossOrigin:function(e){return this.crossOrigin=e,this},setPath:function(e){return this.path=e,this}}),Object.assign(Ai.prototype,{load:function(e,t,i,r){var a=new n,o=new Ti(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(e,function(i){var n=e.search(/\.(jpg|jpeg)$/)>0||0===e.search(/^data\:image\/jpeg/);a.format=n?Ao:Lo,a.image=i,a.needsUpdate=!0,void 0!==t&&t(a)},i,r),a},setCrossOrigin:function(e){return this.crossOrigin=e,this},setPath:function(e){return this.path=e,this}}),Li.prototype=Object.assign(Object.create(ce.prototype),{constructor:Li,isLight:!0,copy:function(e){return ce.prototype.copy.call(this,e),this.color.copy(e.color),this.intensity=e.intensity,this},toJSON:function(e){var t=ce.prototype.toJSON.call(this,e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,void 0!==this.groundColor&&(t.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(t.object.distance=this.distance),void 0!==this.angle&&(t.object.angle=this.angle),void 0!==this.decay&&(t.object.decay=this.decay),void 0!==this.penumbra&&(t.object.penumbra=this.penumbra),void 0!==this.shadow&&(t.object.shadow=this.shadow.toJSON()),t}}),Ri.prototype=Object.assign(Object.create(Li.prototype),{constructor:Ri,isHemisphereLight:!0,copy:function(e){return Li.prototype.copy.call(this,e),this.groundColor.copy(e.groundColor),this}}),Object.assign(Pi.prototype,{copy:function(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){var e={};return 0!==this.bias&&(e.bias=this.bias),1!==this.radius&&(e.radius=this.radius),(512!==this.mapSize.x||512!==this.mapSize.y)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}),Ci.prototype=Object.assign(Object.create(Pi.prototype),{constructor:Ci,isSpotLightShadow:!0,update:function(e){var t=2*us.RAD2DEG*e.angle,i=this.mapSize.width/this.mapSize.height,n=e.distance||500,r=this.camera;(t!==r.fov||i!==r.aspect||n!==r.far)&&(r.fov=t,r.aspect=i,r.far=n,r.updateProjectionMatrix())}}),Ii.prototype=Object.assign(Object.create(Li.prototype),{constructor:Ii,isSpotLight:!0,copy:function(e){return Li.prototype.copy.call(this,e),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}),Ui.prototype=Object.assign(Object.create(Li.prototype),{constructor:Ui,isPointLight:!0,copy:function(e){return Li.prototype.copy.call(this,e),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}),Ni.prototype=Object.assign(Object.create(Pi.prototype),{constructor:Ni}),Di.prototype=Object.assign(Object.create(Li.prototype),{constructor:Di,isDirectionalLight:!0,copy:function(e){return Li.prototype.copy.call(this,e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}),Oi.prototype=Object.assign(Object.create(Li.prototype),{constructor:Oi,isAmbientLight:!0});var Ih={arraySlice:function(e,t,i){return Ih.isTypedArray(e)?new e.constructor(e.subarray(t,i)):e.slice(t,i)},convertArray:function(e,t,i){return!e||!i&&e.constructor===t?e:"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e)},isTypedArray:function(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)},getKeyframeOrder:function(e){function t(t,i){return e[t]-e[i]}for(var i=e.length,n=new Array(i),r=0;r!==i;++r)n[r]=r;return n.sort(t),n},sortedArray:function(e,t,i){for(var n=e.length,r=new e.constructor(n),a=0,o=0;o!==n;++a)for(var s=i[a]*t,c=0;c!==t;++c)r[o++]=e[s+c];return r},flattenJSON:function(e,t,i,n){for(var r=1,a=e[0];void 0!==a&&void 0===a[n];)a=e[r++];if(void 0!==a){var o=a[n];if(void 0!==o)if(Array.isArray(o)){do o=a[n],void 0!==o&&(t.push(a.time),i.push.apply(i,o)),a=e[r++];while(void 0!==a)}else if(void 0!==o.toArray){do o=a[n],void 0!==o&&(t.push(a.time),o.toArray(i,i.length)),a=e[r++];while(void 0!==a)}else do o=a[n],void 0!==o&&(t.push(a.time),i.push(o)),a=e[r++];while(void 0!==a)}}};Bi.prototype={constructor:Bi,evaluate:function(e){var t=this.parameterPositions,i=this._cachedIndex,n=t[i],r=t[i-1];e:{t:{var a;i:{n:if(!(n>e)){for(var o=i+2;;){if(void 0===n){if(r>e)break n;return i=t.length,this._cachedIndex=i,this.afterEnd_(i-1,e,r)}if(i===o)break;if(r=n,n=t[++i],n>e)break t}a=t.length;break i}{if(e>=r)break e;var s=t[1];s>e&&(i=2,r=s);for(var o=i-2;;){if(void 0===r)return this._cachedIndex=0,this.beforeStart_(0,e,n);if(i===o)break;if(n=r,r=t[--i-1],e>=r)break t}a=i,i=0}}for(;a>i;){var c=i+a>>>1;e<t[c]?a=c:i=c+1}if(n=t[i],r=t[i-1],void 0===r)return this._cachedIndex=0,this.beforeStart_(0,e,n);if(void 0===n)return i=t.length,this._cachedIndex=i,this.afterEnd_(i-1,r,e)}this._cachedIndex=i,this.intervalChanged_(i,r,n)}return this.interpolate_(i,r,e,n)},settings:null,DefaultSettings_:{},getSettings_:function(){return this.settings||this.DefaultSettings_},copySampleValue_:function(e){for(var t=this.resultBuffer,i=this.sampleValues,n=this.valueSize,r=e*n,a=0;a!==n;++a)t[a]=i[r+a];return t},interpolate_:function(e,t,i,n){throw new Error("call to abstract method")},intervalChanged_:function(e,t,i){}},Object.assign(Bi.prototype,{beforeStart_:Bi.prototype.copySampleValue_,afterEnd_:Bi.prototype.copySampleValue_}),Fi.prototype=Object.assign(Object.create(Bi.prototype),{constructor:Fi,DefaultSettings_:{endingStart:Zo,endingEnd:Zo},intervalChanged_:function(e,t,i){var n=this.parameterPositions,r=e-2,a=e+1,o=n[r],s=n[a];if(void 0===o)switch(this.getSettings_().endingStart){case Jo:r=e,o=2*t-i;break;case Qo:r=n.length-2,o=t+n[r]-n[r+1];break;default:r=e,o=i}if(void 0===s)switch(this.getSettings_().endingEnd){case Jo:a=e,s=2*i-t;break;case Qo:a=1,s=i+n[1]-n[0];break;default:a=e-1,s=t}var c=.5*(i-t),h=this.valueSize;this._weightPrev=c/(t-o),this._weightNext=c/(s-i),this._offsetPrev=r*h,this._offsetNext=a*h},interpolate_:function(e,t,i,n){for(var r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,c=s-o,h=this._offsetPrev,l=this._offsetNext,u=this._weightPrev,p=this._weightNext,d=(i-t)/(n-t),f=d*d,m=f*d,g=-u*m+2*u*f-u*d,v=(1+u)*m+(-1.5-2*u)*f+(-.5+u)*d+1,y=(-1-p)*m+(1.5+p)*f+.5*d,x=p*m-p*f,_=0;_!==o;++_)r[_]=g*a[h+_]+v*a[c+_]+y*a[s+_]+x*a[l+_];return r}}),zi.prototype=Object.assign(Object.create(Bi.prototype),{constructor:zi,interpolate_:function(e,t,i,n){for(var r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,c=s-o,h=(i-t)/(n-t),l=1-h,u=0;u!==o;++u)r[u]=a[c+u]*l+a[s+u]*h;return r}}),Gi.prototype=Object.assign(Object.create(Bi.prototype),{constructor:Gi,interpolate_:function(e,t,i,n){return this.copySampleValue_(e-1)}});var Uh;Uh={TimeBufferType:Float32Array,ValueBufferType:Float32Array,DefaultInterpolation:qo,InterpolantFactoryMethodDiscrete:function(e){return new Gi(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodLinear:function(e){return new zi(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:function(e){return new Fi(this.times,this.values,this.getValueSize(),e)},setInterpolation:function(e){var t;switch(e){case Xo:t=this.InterpolantFactoryMethodDiscrete;break;case qo:t=this.InterpolantFactoryMethodLinear;break;case Yo:t=this.InterpolantFactoryMethodSmooth}if(void 0===t){var i="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(e===this.DefaultInterpolation)throw new Error(i);this.setInterpolation(this.DefaultInterpolation)}return void console.warn(i)}this.createInterpolant=t},getInterpolation:function(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Xo;case this.InterpolantFactoryMethodLinear:return qo;case this.InterpolantFactoryMethodSmooth:return Yo}},getValueSize:function(){return this.values.length/this.times.length},shift:function(e){if(0!==e)for(var t=this.times,i=0,n=t.length;i!==n;++i)t[i]+=e;return this},scale:function(e){if(1!==e)for(var t=this.times,i=0,n=t.length;i!==n;++i)t[i]*=e;return this},trim:function(e,t){for(var i=this.times,n=i.length,r=0,a=n-1;r!==n&&i[r]<e;)++r;for(;-1!==a&&i[a]>t;)--a;if(++a,0!==r||a!==n){r>=a&&(a=Math.max(a,1),r=a-1);var o=this.getValueSize();this.times=Ih.arraySlice(i,r,a),this.values=Ih.arraySlice(this.values,r*o,a*o)}return this},validate:function(){var e=!0,t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("invalid value size in track",this),e=!1);var i=this.times,n=this.values,r=i.length;0===r&&(console.error("track is empty",this),e=!1);for(var a=null,o=0;o!==r;o++){var s=i[o];if("number"==typeof s&&isNaN(s)){console.error("time is not a valid number",this,o,s),e=!1;break}if(null!==a&&a>s){console.error("out of order keys",this,o,s,a),e=!1;break}a=s}if(void 0!==n&&Ih.isTypedArray(n))for(var o=0,c=n.length;o!==c;++o){var h=n[o];if(isNaN(h)){console.error("value is not a valid number",this,o,h),e=!1;break}}return e},optimize:function(){for(var e=this.times,t=this.values,i=this.getValueSize(),n=this.getInterpolation()===Yo,r=1,a=e.length-1,o=1;a>o;++o){var s=!1,c=e[o],h=e[o+1];if(c!==h&&(1!==o||c!==c[0]))if(n)s=!0;else for(var l=o*i,u=l-i,p=l+i,d=0;d!==i;++d){var f=t[l+d];if(f!==t[u+d]||f!==t[p+d]){s=!0;break}}if(s){if(o!==r){e[r]=e[o];for(var m=o*i,g=r*i,d=0;d!==i;++d)t[g+d]=t[m+d]}++r}}if(a>0){e[r]=e[a];for(var m=a*i,g=r*i,d=0;d!==i;++d)t[g+d]=t[m+d];++r}return r!==e.length&&(this.times=Ih.arraySlice(e,0,r),this.values=Ih.arraySlice(t,0,r*i)),this}},Vi.prototype=Object.assign(Object.create(Uh),{constructor:Vi,ValueTypeName:"vector"}),ki.prototype=Object.assign(Object.create(Bi.prototype),{constructor:ki,interpolate_:function(e,t,i,n){for(var r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,c=e*o,h=(i-t)/(n-t),l=c+o;c!==l;c+=4)s.slerpFlat(r,0,a,c-o,a,c,h);return r}}),ji.prototype=Object.assign(Object.create(Uh),{constructor:ji,ValueTypeName:"quaternion",DefaultInterpolation:qo,InterpolantFactoryMethodLinear:function(e){return new ki(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:void 0}),Wi.prototype=Object.assign(Object.create(Uh),{
11
+ constructor:Wi,ValueTypeName:"number"}),Xi.prototype=Object.assign(Object.create(Uh),{constructor:Xi,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:Xo,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),qi.prototype=Object.assign(Object.create(Uh),{constructor:qi,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:Xo,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),Yi.prototype=Object.assign(Object.create(Uh),{constructor:Yi,ValueTypeName:"color"}),Zi.prototype=Uh,Uh.constructor=Zi,Object.assign(Zi,{parse:function(e){if(void 0===e.type)throw new Error("track type undefined, can not parse");var t=Zi._getTrackTypeForValueTypeName(e.type);if(void 0===e.times){var i=[],n=[];Ih.flattenJSON(e.keys,i,n,"value"),e.times=i,e.values=n}return void 0!==t.parse?t.parse(e):new t(e.name,e.times,e.values,e.interpolation)},toJSON:function(e){var t,i=e.constructor;if(void 0!==i.toJSON)t=i.toJSON(e);else{t={name:e.name,times:Ih.convertArray(e.times,Array),values:Ih.convertArray(e.values,Array)};var n=e.getInterpolation();n!==e.DefaultInterpolation&&(t.interpolation=n)}return t.type=e.ValueTypeName,t},_getTrackTypeForValueTypeName:function(e){switch(e.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Wi;case"vector":case"vector2":case"vector3":case"vector4":return Vi;case"color":return Yi;case"quaternion":return ji;case"bool":case"boolean":return qi;case"string":return Xi}throw new Error("Unsupported typeName: "+e)}}),Ji.prototype={constructor:Ji,resetDuration:function(){for(var e=this.tracks,t=0,i=0,n=e.length;i!==n;++i){var r=this.tracks[i];t=Math.max(t,r.times[r.times.length-1])}this.duration=t},trim:function(){for(var e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this},optimize:function(){for(var e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}},Object.assign(Ji,{parse:function(e){for(var t=[],i=e.tracks,n=1/(e.fps||1),r=0,a=i.length;r!==a;++r)t.push(Zi.parse(i[r]).scale(n));return new Ji(e.name,e.duration,t)},toJSON:function(e){for(var t=[],i=e.tracks,n={name:e.name,duration:e.duration,tracks:t},r=0,a=i.length;r!==a;++r)t.push(Zi.toJSON(i[r]));return n},CreateFromMorphTargetSequence:function(e,t,i,n){for(var r=t.length,a=[],o=0;r>o;o++){var s=[],c=[];s.push((o+r-1)%r,o,(o+1)%r),c.push(0,1,0);var h=Ih.getKeyframeOrder(s);s=Ih.sortedArray(s,1,h),c=Ih.sortedArray(c,1,h),n||0!==s[0]||(s.push(r),c.push(c[0])),a.push(new Wi(".morphTargetInfluences["+t[o].name+"]",s,c).scale(1/i))}return new Ji(e,-1,a)},findByName:function(e,t){var i=e;if(!Array.isArray(e)){var n=e;i=n.geometry&&n.geometry.animations||n.animations}for(var r=0;r<i.length;r++)if(i[r].name===t)return i[r];return null},CreateClipsFromMorphTargetSequences:function(e,t,i){for(var n={},r=/^([\w-]*?)([\d]+)$/,a=0,o=e.length;o>a;a++){var s=e[a],c=s.name.match(r);if(c&&c.length>1){var h=c[1],l=n[h];l||(n[h]=l=[]),l.push(s)}}var u=[];for(var h in n)u.push(Ji.CreateFromMorphTargetSequence(h,n[h],t,i));return u},parseAnimation:function(e,t){if(!e)return console.error(" no animation in JSONLoader data"),null;for(var i=function(e,t,i,n,r){if(0!==i.length){var a=[],o=[];Ih.flattenJSON(i,a,o,n),0!==a.length&&r.push(new e(t,a,o))}},n=[],r=e.name||"default",a=e.length||-1,o=e.fps||30,s=e.hierarchy||[],c=0;c<s.length;c++){var h=s[c].keys;if(h&&0!==h.length)if(h[0].morphTargets){for(var l={},u=0;u<h.length;u++)if(h[u].morphTargets)for(var p=0;p<h[u].morphTargets.length;p++)l[h[u].morphTargets[p]]=-1;for(var d in l){for(var f=[],m=[],p=0;p!==h[u].morphTargets.length;++p){var g=h[u];f.push(g.time),m.push(g.morphTarget===d?1:0)}n.push(new Wi(".morphTargetInfluence["+d+"]",f,m))}a=l.length*(o||1)}else{var v=".bones["+t[c].name+"]";i(Vi,v+".position",h,"pos",n),i(ji,v+".quaternion",h,"rot",n),i(Vi,v+".scale",h,"scl",n)}}if(0===n.length)return null;var y=new Ji(r,a,n);return y}}),Object.assign(Qi.prototype,{load:function(e,t,i,n){var r=this,a=new wi(r.manager);a.load(e,function(e){t(r.parse(JSON.parse(e)))},i,n)},setTextures:function(e){this.textures=e},parse:function(e){function t(e){return void 0===n[e]&&console.warn("THREE.MaterialLoader: Undefined texture",e),n[e]}var n=this.textures,r=new Rh[e.type];if(void 0!==e.uuid&&(r.uuid=e.uuid),void 0!==e.name&&(r.name=e.name),void 0!==e.color&&r.color.setHex(e.color),void 0!==e.roughness&&(r.roughness=e.roughness),void 0!==e.metalness&&(r.metalness=e.metalness),void 0!==e.emissive&&r.emissive.setHex(e.emissive),void 0!==e.specular&&r.specular.setHex(e.specular),void 0!==e.shininess&&(r.shininess=e.shininess),void 0!==e.clearCoat&&(r.clearCoat=e.clearCoat),void 0!==e.clearCoatRoughness&&(r.clearCoatRoughness=e.clearCoatRoughness),void 0!==e.uniforms&&(r.uniforms=e.uniforms),void 0!==e.vertexShader&&(r.vertexShader=e.vertexShader),void 0!==e.fragmentShader&&(r.fragmentShader=e.fragmentShader),void 0!==e.vertexColors&&(r.vertexColors=e.vertexColors),void 0!==e.fog&&(r.fog=e.fog),void 0!==e.shading&&(r.shading=e.shading),void 0!==e.blending&&(r.blending=e.blending),void 0!==e.side&&(r.side=e.side),void 0!==e.opacity&&(r.opacity=e.opacity),void 0!==e.transparent&&(r.transparent=e.transparent),void 0!==e.alphaTest&&(r.alphaTest=e.alphaTest),void 0!==e.depthTest&&(r.depthTest=e.depthTest),void 0!==e.depthWrite&&(r.depthWrite=e.depthWrite),void 0!==e.colorWrite&&(r.colorWrite=e.colorWrite),void 0!==e.wireframe&&(r.wireframe=e.wireframe),void 0!==e.wireframeLinewidth&&(r.wireframeLinewidth=e.wireframeLinewidth),void 0!==e.wireframeLinecap&&(r.wireframeLinecap=e.wireframeLinecap),void 0!==e.wireframeLinejoin&&(r.wireframeLinejoin=e.wireframeLinejoin),void 0!==e.skinning&&(r.skinning=e.skinning),void 0!==e.morphTargets&&(r.morphTargets=e.morphTargets),void 0!==e.size&&(r.size=e.size),void 0!==e.sizeAttenuation&&(r.sizeAttenuation=e.sizeAttenuation),void 0!==e.map&&(r.map=t(e.map)),void 0!==e.alphaMap&&(r.alphaMap=t(e.alphaMap),r.transparent=!0),void 0!==e.bumpMap&&(r.bumpMap=t(e.bumpMap)),void 0!==e.bumpScale&&(r.bumpScale=e.bumpScale),void 0!==e.normalMap&&(r.normalMap=t(e.normalMap)),void 0!==e.normalScale){var a=e.normalScale;Array.isArray(a)===!1&&(a=[a,a]),r.normalScale=(new i).fromArray(a)}if(void 0!==e.displacementMap&&(r.displacementMap=t(e.displacementMap)),void 0!==e.displacementScale&&(r.displacementScale=e.displacementScale),void 0!==e.displacementBias&&(r.displacementBias=e.displacementBias),void 0!==e.roughnessMap&&(r.roughnessMap=t(e.roughnessMap)),void 0!==e.metalnessMap&&(r.metalnessMap=t(e.metalnessMap)),void 0!==e.emissiveMap&&(r.emissiveMap=t(e.emissiveMap)),void 0!==e.emissiveIntensity&&(r.emissiveIntensity=e.emissiveIntensity),void 0!==e.specularMap&&(r.specularMap=t(e.specularMap)),void 0!==e.envMap&&(r.envMap=t(e.envMap)),void 0!==e.reflectivity&&(r.reflectivity=e.reflectivity),void 0!==e.lightMap&&(r.lightMap=t(e.lightMap)),void 0!==e.lightMapIntensity&&(r.lightMapIntensity=e.lightMapIntensity),void 0!==e.aoMap&&(r.aoMap=t(e.aoMap)),void 0!==e.aoMapIntensity&&(r.aoMapIntensity=e.aoMapIntensity),void 0!==e.gradientMap&&(r.gradientMap=t(e.gradientMap)),void 0!==e.materials)for(var o=0,s=e.materials.length;s>o;o++)r.materials.push(this.parse(e.materials[o]));return r}}),Object.assign(Ki.prototype,{load:function(e,t,i,n){var r=this,a=new wi(r.manager);a.load(e,function(e){t(r.parse(JSON.parse(e)))},i,n)},parse:function(e){var t=new Ae,i=e.data.index,n={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:Uint8ClampedArray,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};if(void 0!==i){var r=new n[i.type](i.array);t.setIndex(new de(r,1))}var a=e.data.attributes;for(var o in a){var s=a[o],r=new n[s.type](s.array);t.addAttribute(o,new de(r,s.itemSize,s.normalized))}var h=e.data.groups||e.data.drawcalls||e.data.offsets;if(void 0!==h)for(var l=0,u=h.length;l!==u;++l){var p=h[l];t.addGroup(p.start,p.count,p.materialIndex)}var d=e.data.boundingSphere;if(void 0!==d){var f=new c;void 0!==d.center&&f.fromArray(d.center),t.boundingSphere=new ee(f,d.radius)}return t}}),$i.prototype={constructor:$i,crossOrigin:void 0,extractUrlBase:function(e){var t=e.split("/");return 1===t.length?"./":(t.pop(),t.join("/")+"/")},initMaterials:function(e,t,i){for(var n=[],r=0;r<e.length;++r)n[r]=this.createMaterial(e[r],t,i);return n},createMaterial:function(){var e,t,i,n={NoBlending:pa,NormalBlending:da,AdditiveBlending:fa,SubtractiveBlending:ma,MultiplyBlending:ga,CustomBlending:va};return function(r,a,o){function s(e,i,n,r,s){var h,l=a+e,u=$i.Handlers.get(l);null!==u?h=u.load(l):(t.setCrossOrigin(o),h=t.load(l)),void 0!==i&&(h.repeat.fromArray(i),1!==i[0]&&(h.wrapS=ro),1!==i[1]&&(h.wrapT=ro)),void 0!==n&&h.offset.fromArray(n),void 0!==r&&("repeat"===r[0]&&(h.wrapS=ro),"mirror"===r[0]&&(h.wrapS=oo),"repeat"===r[1]&&(h.wrapT=ro),"mirror"===r[1]&&(h.wrapT=oo)),void 0!==s&&(h.anisotropy=s);var p=us.generateUUID();return c[p]=h,p}void 0===e&&(e=new W),void 0===t&&(t=new Ai),void 0===i&&(i=new Qi);var c={},h={uuid:us.generateUUID(),type:"MeshLambertMaterial"};for(var l in r){var u=r[l];switch(l){case"DbgColor":case"DbgIndex":case"opticalDensity":case"illumination":break;case"DbgName":h.name=u;break;case"blending":h.blending=n[u];break;case"colorAmbient":case"mapAmbient":console.warn("THREE.Loader.createMaterial:",l,"is no longer supported.");break;case"colorDiffuse":h.color=e.fromArray(u).getHex();break;case"colorSpecular":h.specular=e.fromArray(u).getHex();break;case"colorEmissive":h.emissive=e.fromArray(u).getHex();break;case"specularCoef":h.shininess=u;break;case"shading":"basic"===u.toLowerCase()&&(h.type="MeshBasicMaterial"),"phong"===u.toLowerCase()&&(h.type="MeshPhongMaterial"),"standard"===u.toLowerCase()&&(h.type="MeshStandardMaterial");break;case"mapDiffuse":h.map=s(u,r.mapDiffuseRepeat,r.mapDiffuseOffset,r.mapDiffuseWrap,r.mapDiffuseAnisotropy);break;case"mapDiffuseRepeat":case"mapDiffuseOffset":case"mapDiffuseWrap":case"mapDiffuseAnisotropy":break;case"mapEmissive":h.emissiveMap=s(u,r.mapEmissiveRepeat,r.mapEmissiveOffset,r.mapEmissiveWrap,r.mapEmissiveAnisotropy);break;case"mapEmissiveRepeat":case"mapEmissiveOffset":case"mapEmissiveWrap":case"mapEmissiveAnisotropy":break;case"mapLight":h.lightMap=s(u,r.mapLightRepeat,r.mapLightOffset,r.mapLightWrap,r.mapLightAnisotropy);break;case"mapLightRepeat":case"mapLightOffset":case"mapLightWrap":case"mapLightAnisotropy":break;case"mapAO":h.aoMap=s(u,r.mapAORepeat,r.mapAOOffset,r.mapAOWrap,r.mapAOAnisotropy);break;case"mapAORepeat":case"mapAOOffset":case"mapAOWrap":case"mapAOAnisotropy":break;case"mapBump":h.bumpMap=s(u,r.mapBumpRepeat,r.mapBumpOffset,r.mapBumpWrap,r.mapBumpAnisotropy);break;case"mapBumpScale":h.bumpScale=u;break;case"mapBumpRepeat":case"mapBumpOffset":case"mapBumpWrap":case"mapBumpAnisotropy":break;case"mapNormal":h.normalMap=s(u,r.mapNormalRepeat,r.mapNormalOffset,r.mapNormalWrap,r.mapNormalAnisotropy);break;case"mapNormalFactor":h.normalScale=[u,u];break;case"mapNormalRepeat":case"mapNormalOffset":case"mapNormalWrap":case"mapNormalAnisotropy":break;case"mapSpecular":h.specularMap=s(u,r.mapSpecularRepeat,r.mapSpecularOffset,r.mapSpecularWrap,r.mapSpecularAnisotropy);break;case"mapSpecularRepeat":case"mapSpecularOffset":case"mapSpecularWrap":case"mapSpecularAnisotropy":break;case"mapMetalness":h.metalnessMap=s(u,r.mapMetalnessRepeat,r.mapMetalnessOffset,r.mapMetalnessWrap,r.mapMetalnessAnisotropy);break;case"mapMetalnessRepeat":case"mapMetalnessOffset":case"mapMetalnessWrap":case"mapMetalnessAnisotropy":break;case"mapRoughness":h.roughnessMap=s(u,r.mapRoughnessRepeat,r.mapRoughnessOffset,r.mapRoughnessWrap,r.mapRoughnessAnisotropy);break;case"mapRoughnessRepeat":case"mapRoughnessOffset":case"mapRoughnessWrap":case"mapRoughnessAnisotropy":break;case"mapAlpha":h.alphaMap=s(u,r.mapAlphaRepeat,r.mapAlphaOffset,r.mapAlphaWrap,r.mapAlphaAnisotropy);break;case"mapAlphaRepeat":case"mapAlphaOffset":case"mapAlphaWrap":case"mapAlphaAnisotropy":break;case"flipSided":h.side=aa;break;case"doubleSided":h.side=oa;break;case"transparency":console.warn("THREE.Loader.createMaterial: transparency has been renamed to opacity"),h.opacity=u;break;case"depthTest":case"depthWrite":case"colorWrite":case"opacity":case"reflectivity":case"transparent":case"visible":case"wireframe":h[l]=u;break;case"vertexColors":u===!0&&(h.vertexColors=ua),"face"===u&&(h.vertexColors=la);break;default:console.error("THREE.Loader.createMaterial: Unsupported",l,u)}}return"MeshBasicMaterial"===h.type&&delete h.emissive,"MeshPhongMaterial"!==h.type&&delete h.specular,h.opacity<1&&(h.transparent=!0),i.setTextures(c),i.parse(h)}}()},$i.Handlers={handlers:[],add:function(e,t){this.handlers.push(e,t)},get:function(e){for(var t=this.handlers,i=0,n=t.length;n>i;i+=2){var r=t[i],a=t[i+1];if(r.test(e))return a}return null}},Object.assign(en.prototype,{load:function(e,t,i,n){var r=this,a=this.texturePath&&"string"==typeof this.texturePath?this.texturePath:$i.prototype.extractUrlBase(e),o=new wi(this.manager);o.setWithCredentials(this.withCredentials),o.load(e,function(i){var n=JSON.parse(i),o=n.metadata;if(void 0!==o){var s=o.type;if(void 0!==s){if("object"===s.toLowerCase())return void console.error("THREE.JSONLoader: "+e+" should be loaded with THREE.ObjectLoader instead.");if("scene"===s.toLowerCase())return void console.error("THREE.JSONLoader: "+e+" should be loaded with THREE.SceneLoader instead.")}}var c=r.parse(n,a);t(c.geometry,c.materials)},i,n)},setTexturePath:function(e){this.texturePath=e},parse:function(e,t){function n(t){function n(e,t){return e&1<<t}var r,a,o,s,l,u,p,d,f,m,g,v,y,x,_,b,w,M,E,T,S,A,L,R,P,C,I,U=e.faces,N=e.vertices,D=e.normals,O=e.colors,B=0;if(void 0!==e.uvs){for(r=0;r<e.uvs.length;r++)e.uvs[r].length&&B++;for(r=0;B>r;r++)h.faceVertexUvs[r]=[]}for(s=0,l=N.length;l>s;)M=new c,M.x=N[s++]*t,M.y=N[s++]*t,M.z=N[s++]*t,h.vertices.push(M);for(s=0,l=U.length;l>s;)if(m=U[s++],g=n(m,0),v=n(m,1),y=n(m,3),x=n(m,4),_=n(m,5),b=n(m,6),w=n(m,7),g){if(T=new ue,T.a=U[s],T.b=U[s+1],T.c=U[s+3],S=new ue,S.a=U[s+1],S.b=U[s+2],S.c=U[s+3],s+=4,v&&(f=U[s++],T.materialIndex=f,S.materialIndex=f),o=h.faces.length,y)for(r=0;B>r;r++)for(R=e.uvs[r],h.faceVertexUvs[r][o]=[],h.faceVertexUvs[r][o+1]=[],a=0;4>a;a++)d=U[s++],C=R[2*d],I=R[2*d+1],P=new i(C,I),2!==a&&h.faceVertexUvs[r][o].push(P),0!==a&&h.faceVertexUvs[r][o+1].push(P);if(x&&(p=3*U[s++],T.normal.set(D[p++],D[p++],D[p]),S.normal.copy(T.normal)),_)for(r=0;4>r;r++)p=3*U[s++],L=new c(D[p++],D[p++],D[p]),2!==r&&T.vertexNormals.push(L),0!==r&&S.vertexNormals.push(L);if(b&&(u=U[s++],A=O[u],T.color.setHex(A),S.color.setHex(A)),w)for(r=0;4>r;r++)u=U[s++],A=O[u],2!==r&&T.vertexColors.push(new W(A)),0!==r&&S.vertexColors.push(new W(A));h.faces.push(T),h.faces.push(S)}else{if(E=new ue,E.a=U[s++],E.b=U[s++],E.c=U[s++],v&&(f=U[s++],E.materialIndex=f),o=h.faces.length,y)for(r=0;B>r;r++)for(R=e.uvs[r],h.faceVertexUvs[r][o]=[],a=0;3>a;a++)d=U[s++],C=R[2*d],I=R[2*d+1],P=new i(C,I),h.faceVertexUvs[r][o].push(P);if(x&&(p=3*U[s++],E.normal.set(D[p++],D[p++],D[p])),_)for(r=0;3>r;r++)p=3*U[s++],L=new c(D[p++],D[p++],D[p]),E.vertexNormals.push(L);if(b&&(u=U[s++],E.color.setHex(O[u])),w)for(r=0;3>r;r++)u=U[s++],E.vertexColors.push(new W(O[u]));h.faces.push(E)}}function a(){var t=void 0!==e.influencesPerVertex?e.influencesPerVertex:2;if(e.skinWeights)for(var i=0,n=e.skinWeights.length;n>i;i+=t){var a=e.skinWeights[i],o=t>1?e.skinWeights[i+1]:0,s=t>2?e.skinWeights[i+2]:0,c=t>3?e.skinWeights[i+3]:0;h.skinWeights.push(new r(a,o,s,c))}if(e.skinIndices)for(var i=0,n=e.skinIndices.length;n>i;i+=t){var l=e.skinIndices[i],u=t>1?e.skinIndices[i+1]:0,p=t>2?e.skinIndices[i+2]:0,d=t>3?e.skinIndices[i+3]:0;h.skinIndices.push(new r(l,u,p,d))}h.bones=e.bones,h.bones&&h.bones.length>0&&(h.skinWeights.length!==h.skinIndices.length||h.skinIndices.length!==h.vertices.length)&&console.warn("When skinning, number of vertices ("+h.vertices.length+"), skinIndices ("+h.skinIndices.length+"), and skinWeights ("+h.skinWeights.length+") should match.")}function o(t){if(void 0!==e.morphTargets)for(var i=0,n=e.morphTargets.length;n>i;i++){h.morphTargets[i]={},h.morphTargets[i].name=e.morphTargets[i].name,h.morphTargets[i].vertices=[];for(var r=h.morphTargets[i].vertices,a=e.morphTargets[i].vertices,o=0,s=a.length;s>o;o+=3){var l=new c;l.x=a[o]*t,l.y=a[o+1]*t,l.z=a[o+2]*t,r.push(l)}}if(void 0!==e.morphColors&&e.morphColors.length>0){console.warn('THREE.JSONLoader: "morphColors" no longer supported. Using them as face colors.');for(var u=h.faces,p=e.morphColors[0].colors,i=0,n=u.length;n>i;i++)u[i].color.fromArray(p,3*i)}}function s(){var t=[],i=[];void 0!==e.animation&&i.push(e.animation),void 0!==e.animations&&(e.animations.length?i=i.concat(e.animations):i.push(e.animations));for(var n=0;n<i.length;n++){var r=Ji.parseAnimation(i[n],h.bones);r&&t.push(r)}if(h.morphTargets){var a=Ji.CreateClipsFromMorphTargetSequences(h.morphTargets,10);t=t.concat(a)}t.length>0&&(h.animations=t)}var h=new Se,l=void 0!==e.scale?1/e.scale:1;if(n(l),a(),o(l),s(),h.computeFaceNormals(),h.computeBoundingSphere(),void 0===e.materials||0===e.materials.length)return{geometry:h};var u=$i.prototype.initMaterials(e.materials,t,this.crossOrigin);return{geometry:h,materials:u}}}),Object.assign(tn.prototype,{load:function(e,t,i,n){""===this.texturePath&&(this.texturePath=e.substring(0,e.lastIndexOf("/")+1));var r=this,a=new wi(r.manager);a.load(e,function(i){var a=null;try{a=JSON.parse(i)}catch(o){return void 0!==n&&n(o),void console.error("THREE:ObjectLoader: Can't parse "+e+".",o.message)}var s=a.metadata;return void 0===s||void 0===s.type||"geometry"===s.type.toLowerCase()?void console.error("THREE.ObjectLoader: Can't load "+e+". Use THREE.JSONLoader instead."):void r.parse(a,t)},i,n)},setTexturePath:function(e){this.texturePath=e},setCrossOrigin:function(e){this.crossOrigin=e},parse:function(e,t){var i=this.parseGeometries(e.geometries),n=this.parseImages(e.images,function(){void 0!==t&&t(o)}),r=this.parseTextures(e.textures,n),a=this.parseMaterials(e.materials,r),o=this.parseObject(e.object,i,a);return e.animations&&(o.animations=this.parseAnimations(e.animations)),(void 0===e.images||0===e.images.length)&&void 0!==t&&t(o),o},parseGeometries:function(e){var t={};if(void 0!==e)for(var i=new en,n=new Ki,r=0,a=e.length;a>r;r++){var o,s=e[r];switch(s.type){case"PlaneGeometry":case"PlaneBufferGeometry":o=new Lh[s.type](s.width,s.height,s.widthSegments,s.heightSegments);break;case"BoxGeometry":case"BoxBufferGeometry":case"CubeGeometry":o=new Lh[s.type](s.width,s.height,s.depth,s.widthSegments,s.heightSegments,s.depthSegments);break;case"CircleGeometry":case"CircleBufferGeometry":o=new Lh[s.type](s.radius,s.segments,s.thetaStart,s.thetaLength);break;case"CylinderGeometry":case"CylinderBufferGeometry":o=new Lh[s.type](s.radiusTop,s.radiusBottom,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);break;case"ConeGeometry":case"ConeBufferGeometry":o=new Lh[s.type](s.radius,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);break;case"SphereGeometry":case"SphereBufferGeometry":o=new Lh[s.type](s.radius,s.widthSegments,s.heightSegments,s.phiStart,s.phiLength,s.thetaStart,s.thetaLength);break;case"DodecahedronGeometry":case"IcosahedronGeometry":case"OctahedronGeometry":case"TetrahedronGeometry":o=new Lh[s.type](s.radius,s.detail);break;case"RingGeometry":case"RingBufferGeometry":o=new Lh[s.type](s.innerRadius,s.outerRadius,s.thetaSegments,s.phiSegments,s.thetaStart,s.thetaLength);break;case"TorusGeometry":case"TorusBufferGeometry":o=new Lh[s.type](s.radius,s.tube,s.radialSegments,s.tubularSegments,s.arc);break;case"TorusKnotGeometry":case"TorusKnotBufferGeometry":o=new Lh[s.type](s.radius,s.tube,s.tubularSegments,s.radialSegments,s.p,s.q);break;case"LatheGeometry":case"LatheBufferGeometry":o=new Lh[s.type](s.points,s.segments,s.phiStart,s.phiLength);break;case"BufferGeometry":o=n.parse(s);break;case"Geometry":o=i.parse(s.data,this.texturePath).geometry;break;default:console.warn('THREE.ObjectLoader: Unsupported geometry type "'+s.type+'"');continue}o.uuid=s.uuid,void 0!==s.name&&(o.name=s.name),t[s.uuid]=o}return t},parseMaterials:function(e,t){var i={};if(void 0!==e){var n=new Qi;n.setTextures(t);for(var r=0,a=e.length;a>r;r++){var o=n.parse(e[r]);i[o.uuid]=o}}return i},parseAnimations:function(e){for(var t=[],i=0;i<e.length;i++){var n=Ji.parse(e[i]);t.push(n)}return t},parseImages:function(e,t){function i(e){return n.manager.itemStart(e),o.load(e,function(){n.manager.itemEnd(e)},void 0,function(){n.manager.itemError(e)})}var n=this,r={};if(void 0!==e&&e.length>0){var a=new bi(t),o=new Ti(a);o.setCrossOrigin(this.crossOrigin);for(var s=0,c=e.length;c>s;s++){var h=e[s],l=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(h.url)?h.url:n.texturePath+h.url;r[h.uuid]=i(l)}}return r},parseTextures:function(e,t){function i(e,t){return"number"==typeof e?e:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",e),t[e])}var r={UVMapping:Ja,CubeReflectionMapping:Qa,CubeRefractionMapping:Ka,EquirectangularReflectionMapping:$a,EquirectangularRefractionMapping:eo,SphericalReflectionMapping:to,CubeUVReflectionMapping:io,CubeUVRefractionMapping:no},a={RepeatWrapping:ro,ClampToEdgeWrapping:ao,MirroredRepeatWrapping:oo},o={NearestFilter:so,NearestMipMapNearestFilter:co,NearestMipMapLinearFilter:ho,LinearFilter:lo,LinearMipMapNearestFilter:uo,LinearMipMapLinearFilter:po},s={};if(void 0!==e)for(var c=0,h=e.length;h>c;c++){var l=e[c];void 0===l.image&&console.warn('THREE.ObjectLoader: No "image" specified for',l.uuid),void 0===t[l.image]&&console.warn("THREE.ObjectLoader: Undefined image",l.image);var u=new n(t[l.image]);u.needsUpdate=!0,u.uuid=l.uuid,void 0!==l.name&&(u.name=l.name),void 0!==l.mapping&&(u.mapping=i(l.mapping,r)),void 0!==l.offset&&u.offset.fromArray(l.offset),void 0!==l.repeat&&u.repeat.fromArray(l.repeat),void 0!==l.wrap&&(u.wrapS=i(l.wrap[0],a),u.wrapT=i(l.wrap[1],a)),void 0!==l.minFilter&&(u.minFilter=i(l.minFilter,o)),void 0!==l.magFilter&&(u.magFilter=i(l.magFilter,o)),void 0!==l.anisotropy&&(u.anisotropy=l.anisotropy),void 0!==l.flipY&&(u.flipY=l.flipY),s[l.uuid]=u}return s},parseObject:function(){var e=new h;return function(t,i,n){function r(e){return void 0===i[e]&&console.warn("THREE.ObjectLoader: Undefined geometry",e),i[e]}function a(e){return void 0===e?void 0:(void 0===n[e]&&console.warn("THREE.ObjectLoader: Undefined material",e),n[e])}var o;switch(t.type){case"Scene":o=new ut,void 0!==t.background&&Number.isInteger(t.background)&&(o.background=new W(t.background)),void 0!==t.fog&&("Fog"===t.fog.type?o.fog=new lt(t.fog.color,t.fog.near,t.fog.far):"FogExp2"===t.fog.type&&(o.fog=new ht(t.fog.color,t.fog.density)));break;case"PerspectiveCamera":o=new Ne(t.fov,t.aspect,t.near,t.far),void 0!==t.focus&&(o.focus=t.focus),void 0!==t.zoom&&(o.zoom=t.zoom),void 0!==t.filmGauge&&(o.filmGauge=t.filmGauge),void 0!==t.filmOffset&&(o.filmOffset=t.filmOffset),void 0!==t.view&&(o.view=Object.assign({},t.view));break;case"OrthographicCamera":o=new De(t.left,t.right,t.top,t.bottom,t.near,t.far);break;case"AmbientLight":o=new Oi(t.color,t.intensity);break;case"DirectionalLight":o=new Di(t.color,t.intensity);break;case"PointLight":o=new Ui(t.color,t.intensity,t.distance,t.decay);break;case"SpotLight":o=new Ii(t.color,t.intensity,t.distance,t.angle,t.penumbra,t.decay);break;case"HemisphereLight":o=new Ri(t.color,t.groundColor,t.intensity);break;case"Mesh":var s=r(t.geometry),c=a(t.material);o=s.bones&&s.bones.length>0?new yt(s,c):new Le(s,c);break;case"LOD":o=new mt;break;case"Line":o=new _t(r(t.geometry),a(t.material),t.mode);break;case"LineSegments":o=new bt(r(t.geometry),a(t.material));break;case"PointCloud":case"Points":o=new Mt(r(t.geometry),a(t.material));break;case"Sprite":o=new ft(a(t.material));break;case"Group":o=new Et;break;case"SkinnedMesh":console.warn("THREE.ObjectLoader.parseObject() does not support SkinnedMesh type. Instantiates Object3D instead.");default:o=new ce}if(o.uuid=t.uuid,void 0!==t.name&&(o.name=t.name),void 0!==t.matrix?(e.fromArray(t.matrix),e.decompose(o.position,o.quaternion,o.scale)):(void 0!==t.position&&o.position.fromArray(t.position),void 0!==t.rotation&&o.rotation.fromArray(t.rotation),void 0!==t.quaternion&&o.quaternion.fromArray(t.quaternion),void 0!==t.scale&&o.scale.fromArray(t.scale)),void 0!==t.castShadow&&(o.castShadow=t.castShadow),void 0!==t.receiveShadow&&(o.receiveShadow=t.receiveShadow),t.shadow&&(void 0!==t.shadow.bias&&(o.shadow.bias=t.shadow.bias),void 0!==t.shadow.radius&&(o.shadow.radius=t.shadow.radius),void 0!==t.shadow.mapSize&&o.shadow.mapSize.fromArray(t.shadow.mapSize),void 0!==t.shadow.camera&&(o.shadow.camera=this.parseObject(t.shadow.camera))),void 0!==t.visible&&(o.visible=t.visible),void 0!==t.userData&&(o.userData=t.userData),void 0!==t.children)for(var h in t.children)o.add(this.parseObject(t.children[h],i,n));if("LOD"===t.type)for(var l=t.levels,u=0;u<l.length;u++){var p=l[u],h=o.getObjectByProperty("uuid",p.object);void 0!==h&&o.addLevel(h,p.distance)}return o}}()}),dn.prototype={constructor:dn,getPoint:function(e){return console.warn("THREE.Curve: Warning, getPoint() not implemented!"),null},getPointAt:function(e){var t=this.getUtoTmapping(e);return this.getPoint(t)},getPoints:function(e){isNaN(e)&&(e=5);for(var t=[],i=0;e>=i;i++)t.push(this.getPoint(i/e));return t},getSpacedPoints:function(e){isNaN(e)&&(e=5);for(var t=[],i=0;e>=i;i++)t.push(this.getPointAt(i/e));return t},getLength:function(){var e=this.getLengths();return e[e.length-1]},getLengths:function(e){if(isNaN(e)&&(e=this.__arcLengthDivisions?this.__arcLengthDivisions:200),this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var t,i,n=[],r=this.getPoint(0),a=0;for(n.push(0),i=1;e>=i;i++)t=this.getPoint(i/e),a+=t.distanceTo(r),n.push(a),r=t;return this.cacheArcLengths=n,n},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(e,t){var i,n=this.getLengths(),r=0,a=n.length;i=t?t:e*n[a-1];for(var o,s=0,c=a-1;c>=s;)if(r=Math.floor(s+(c-s)/2),o=n[r]-i,0>o)s=r+1;else{if(!(o>0)){c=r;break}c=r-1}if(r=c,n[r]===i){var h=r/(a-1);return h}var l=n[r],u=n[r+1],p=u-l,d=(i-l)/p,h=(r+d)/(a-1);return h},getTangent:function(e){var t=1e-4,i=e-t,n=e+t;0>i&&(i=0),n>1&&(n=1);var r=this.getPoint(i),a=this.getPoint(n),o=a.clone().sub(r);return o.normalize()},getTangentAt:function(e){var t=this.getUtoTmapping(e);return this.getTangent(t)},computeFrenetFrames:function(e,t){var i,n,r,a=new c,o=[],s=[],l=[],u=new c,p=new h;for(i=0;e>=i;i++)n=i/e,o[i]=this.getTangentAt(n),o[i].normalize();s[0]=new c,l[0]=new c;var d=Number.MAX_VALUE,f=Math.abs(o[0].x),m=Math.abs(o[0].y),g=Math.abs(o[0].z);for(d>=f&&(d=f,a.set(1,0,0)),d>=m&&(d=m,a.set(0,1,0)),d>=g&&a.set(0,0,1),u.crossVectors(o[0],a).normalize(),s[0].crossVectors(o[0],u),l[0].crossVectors(o[0],s[0]),i=1;e>=i;i++)s[i]=s[i-1].clone(),l[i]=l[i-1].clone(),u.crossVectors(o[i-1],o[i]),u.length()>Number.EPSILON&&(u.normalize(),r=Math.acos(us.clamp(o[i-1].dot(o[i]),-1,1)),s[i].applyMatrix4(p.makeRotationAxis(u,r))),l[i].crossVectors(o[i],s[i]);if(t===!0)for(r=Math.acos(us.clamp(s[0].dot(s[e]),-1,1)),r/=e,o[0].dot(u.crossVectors(s[0],s[e]))>0&&(r=-r),i=1;e>=i;i++)s[i].applyMatrix4(p.makeRotationAxis(o[i],r*i)),l[i].crossVectors(o[i],s[i]);return{tangents:o,normals:s,binormals:l}}},fn.prototype=Object.create(dn.prototype),fn.prototype.constructor=fn,fn.prototype.isLineCurve=!0,fn.prototype.getPoint=function(e){if(1===e)return this.v2.clone();var t=this.v2.clone().sub(this.v1);return t.multiplyScalar(e).add(this.v1),t},fn.prototype.getPointAt=function(e){return this.getPoint(e)},fn.prototype.getTangent=function(e){var t=this.v2.clone().sub(this.v1);return t.normalize()},mn.prototype=Object.assign(Object.create(dn.prototype),{constructor:mn,add:function(e){this.curves.push(e)},closePath:function(){var e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);e.equals(t)||this.curves.push(new fn(t,e))},getPoint:function(e){for(var t=e*this.getLength(),i=this.getCurveLengths(),n=0;n<i.length;){if(i[n]>=t){var r=i[n]-t,a=this.curves[n],o=a.getLength(),s=0===o?0:1-r/o;return a.getPointAt(s)}n++}return null},getLength:function(){var e=this.getCurveLengths();return e[e.length-1]},updateArcLengths:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var e=[],t=0,i=0,n=this.curves.length;n>i;i++)t+=this.curves[i].getLength(),e.push(t);return this.cacheLengths=e,e},getSpacedPoints:function(e){isNaN(e)&&(e=40);for(var t=[],i=0;e>=i;i++)t.push(this.getPoint(i/e));return this.autoClose&&t.push(t[0]),t},getPoints:function(e){e=e||12;for(var t,i=[],n=0,r=this.curves;n<r.length;n++)for(var a=r[n],o=a&&a.isEllipseCurve?2*e:a&&a.isLineCurve?1:a&&a.isSplineCurve?e*a.points.length:e,s=a.getPoints(o),c=0;c<s.length;c++){var h=s[c];t&&t.equals(h)||(i.push(h),t=h)}return this.autoClose&&i.length>1&&!i[i.length-1].equals(i[0])&&i.push(i[0]),i},createPointsGeometry:function(e){var t=this.getPoints(e);return this.createGeometry(t)},createSpacedPointsGeometry:function(e){var t=this.getSpacedPoints(e);return this.createGeometry(t)},createGeometry:function(e){for(var t=new Se,i=0,n=e.length;n>i;i++){var r=e[i];t.vertices.push(new c(r.x,r.y,r.z||0))}return t}}),gn.prototype=Object.create(dn.prototype),gn.prototype.constructor=gn,gn.prototype.isEllipseCurve=!0,gn.prototype.getPoint=function(e){for(var t=2*Math.PI,n=this.aEndAngle-this.aStartAngle,r=Math.abs(n)<Number.EPSILON;0>n;)n+=t;for(;n>t;)n-=t;n<Number.EPSILON&&(n=r?0:t),this.aClockwise!==!0||r||(n===t?n=-t:n-=t);var a=this.aStartAngle+e*n,o=this.aX+this.xRadius*Math.cos(a),s=this.aY+this.yRadius*Math.sin(a);if(0!==this.aRotation){var c=Math.cos(this.aRotation),h=Math.sin(this.aRotation),l=o-this.aX,u=s-this.aY;o=l*c-u*h+this.aX,s=l*h+u*c+this.aY}return new i(o,s)},vn.prototype=Object.create(dn.prototype),vn.prototype.constructor=vn,vn.prototype.isSplineCurve=!0,vn.prototype.getPoint=function(e){var t=this.points,n=(t.length-1)*e,r=Math.floor(n),a=n-r,o=t[0===r?r:r-1],s=t[r],c=t[r>t.length-2?t.length-1:r+1],h=t[r>t.length-3?t.length-1:r+2];return new i(nn(a,o.x,s.x,c.x,h.x),nn(a,o.y,s.y,c.y,h.y))},yn.prototype=Object.create(dn.prototype),yn.prototype.constructor=yn,yn.prototype.getPoint=function(e){var t=this.v0,n=this.v1,r=this.v2,a=this.v3;return new i(pn(e,t.x,n.x,r.x,a.x),pn(e,t.y,n.y,r.y,a.y))},xn.prototype=Object.create(dn.prototype),xn.prototype.constructor=xn,xn.prototype.getPoint=function(e){var t=this.v0,n=this.v1,r=this.v2;return new i(sn(e,t.x,n.x,r.x),sn(e,t.y,n.y,r.y))};var Nh=Object.assign(Object.create(mn.prototype),{fromPoints:function(e){this.moveTo(e[0].x,e[0].y);for(var t=1,i=e.length;i>t;t++)this.lineTo(e[t].x,e[t].y)},moveTo:function(e,t){this.currentPoint.set(e,t)},lineTo:function(e,t){var n=new fn(this.currentPoint.clone(),new i(e,t));this.curves.push(n),this.currentPoint.set(e,t)},quadraticCurveTo:function(e,t,n,r){var a=new xn(this.currentPoint.clone(),new i(e,t),new i(n,r));this.curves.push(a),this.currentPoint.set(n,r)},bezierCurveTo:function(e,t,n,r,a,o){var s=new yn(this.currentPoint.clone(),new i(e,t),new i(n,r),new i(a,o));this.curves.push(s),this.currentPoint.set(a,o)},splineThru:function(e){var t=[this.currentPoint.clone()].concat(e),i=new vn(t);this.curves.push(i),this.currentPoint.copy(e[e.length-1])},arc:function(e,t,i,n,r,a){var o=this.currentPoint.x,s=this.currentPoint.y;this.absarc(e+o,t+s,i,n,r,a)},absarc:function(e,t,i,n,r,a){this.absellipse(e,t,i,i,n,r,a)},ellipse:function(e,t,i,n,r,a,o,s){var c=this.currentPoint.x,h=this.currentPoint.y;this.absellipse(e+c,t+h,i,n,r,a,o,s)},absellipse:function(e,t,i,n,r,a,o,s){var c=new gn(e,t,i,n,r,a,o,s);if(this.curves.length>0){
12
+ var h=c.getPoint(0);h.equals(this.currentPoint)||this.lineTo(h.x,h.y)}this.curves.push(c);var l=c.getPoint(1);this.currentPoint.copy(l)}});_n.prototype=Nh,Nh.constructor=_n,bn.prototype=Object.assign(Object.create(Nh),{constructor:bn,getPointsHoles:function(e){for(var t=[],i=0,n=this.holes.length;n>i;i++)t[i]=this.holes[i].getPoints(e);return t},extractAllPoints:function(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}},extractPoints:function(e){return this.extractAllPoints(e)}}),wn.prototype={moveTo:function(e,t){this.currentPath=new _n,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t)},lineTo:function(e,t){this.currentPath.lineTo(e,t)},quadraticCurveTo:function(e,t,i,n){this.currentPath.quadraticCurveTo(e,t,i,n)},bezierCurveTo:function(e,t,i,n,r,a){this.currentPath.bezierCurveTo(e,t,i,n,r,a)},splineThru:function(e){this.currentPath.splineThru(e)},toShapes:function(e,t){function i(e){for(var t=[],i=0,n=e.length;n>i;i++){var r=e[i],a=new bn;a.curves=r.curves,t.push(a)}return t}function n(e,t){for(var i=t.length,n=!1,r=i-1,a=0;i>a;r=a++){var o=t[r],s=t[a],c=s.x-o.x,h=s.y-o.y;if(Math.abs(h)>Number.EPSILON){if(0>h&&(o=t[a],c=-c,s=t[r],h=-h),e.y<o.y||e.y>s.y)continue;if(e.y===o.y){if(e.x===o.x)return!0}else{var l=h*(e.x-o.x)-c*(e.y-o.y);if(0===l)return!0;if(0>l)continue;n=!n}}else{if(e.y!==o.y)continue;if(s.x<=e.x&&e.x<=o.x||o.x<=e.x&&e.x<=s.x)return!0}}return n}var r=Ah.isClockWise,a=this.subPaths;if(0===a.length)return[];if(t===!0)return i(a);var o,s,c,h=[];if(1===a.length)return s=a[0],c=new bn,c.curves=s.curves,h.push(c),h;var l=!r(a[0].getPoints());l=e?!l:l;var u,p=[],d=[],f=[],m=0;d[m]=void 0,f[m]=[];for(var g=0,v=a.length;v>g;g++)s=a[g],u=s.getPoints(),o=r(u),o=e?!o:o,o?(!l&&d[m]&&m++,d[m]={s:new bn,p:u},d[m].s.curves=s.curves,l&&m++,f[m]=[]):f[m].push({h:s,p:u[0]});if(!d[0])return i(a);if(d.length>1){for(var y=!1,x=[],_=0,b=d.length;b>_;_++)p[_]=[];for(var _=0,b=d.length;b>_;_++)for(var w=f[_],M=0;M<w.length;M++){for(var E=w[M],T=!0,S=0;S<d.length;S++)n(E.p,d[S].p)&&(_!==S&&x.push({froms:_,tos:S,hole:M}),T?(T=!1,p[S].push(E)):y=!0);T&&p[_].push(E)}x.length>0&&(y||(f=p))}for(var A,g=0,L=d.length;L>g;g++){c=d[g].s,h.push(c),A=f[g];for(var R=0,P=A.length;P>R;R++)c.holes.push(A[R].h)}return h}},Object.assign(Mn.prototype,{isFont:!0,generateShapes:function(e,t,i){function n(e){for(var i=String(e).split(""),n=t/a.resolution,o=(a.boundingBox.yMax-a.boundingBox.yMin+a.underlineThickness)*n,s=0,c=0,h=[],l=0;l<i.length;l++){var u=i[l];if("\n"===u)s=0,c-=o;else{var p=r(u,n,s,c);s+=p.offsetX,h.push(p.path)}}return h}function r(e,t,n,r){var o=a.glyphs[e]||a.glyphs["?"];if(o){var s,c,h,l,u,p,d,f,m,g,v,y=new wn,x=[];if(o.o)for(var _=o._cachedOutline||(o._cachedOutline=o.o.split(" ")),b=0,w=_.length;w>b;){var M=_[b++];switch(M){case"m":s=_[b++]*t+n,c=_[b++]*t+r,y.moveTo(s,c);break;case"l":s=_[b++]*t+n,c=_[b++]*t+r,y.lineTo(s,c);break;case"q":if(h=_[b++]*t+n,l=_[b++]*t+r,d=_[b++]*t+n,f=_[b++]*t+r,y.quadraticCurveTo(d,f,h,l),v=x[x.length-1]){u=v.x,p=v.y;for(var E=1;i>=E;E++){var T=E/i;sn(T,u,d,h),sn(T,p,f,l)}}break;case"b":if(h=_[b++]*t+n,l=_[b++]*t+r,d=_[b++]*t+n,f=_[b++]*t+r,m=_[b++]*t+n,g=_[b++]*t+r,y.bezierCurveTo(d,f,m,g,h,l),v=x[x.length-1]){u=v.x,p=v.y;for(var E=1;i>=E;E++){var T=E/i;pn(T,u,d,m,h),pn(T,p,f,g,l)}}}}return{offsetX:o.ha*t,path:y}}}void 0===t&&(t=100),void 0===i&&(i=4);for(var a=this.data,o=n(e),s=[],c=0,h=o.length;h>c;c++)Array.prototype.push.apply(s,o[c].toShapes());return s}}),Object.assign(En.prototype,{load:function(e,t,i,n){var r=this,a=new wi(this.manager);a.load(e,function(e){var i;try{i=JSON.parse(e)}catch(n){console.warn("THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead."),i=JSON.parse(e.substring(65,e.length-2))}var a=r.parse(i);t&&t(a)},i,n)},parse:function(e){return new Mn(e)}});var Dh,Oh={getContext:function(){return void 0===Dh&&(Dh=new(window.AudioContext||window.webkitAudioContext)),Dh},setContext:function(e){Dh=e}};Object.assign(Tn.prototype,{load:function(e,t,i,n){var r=new wi(this.manager);r.setResponseType("arraybuffer"),r.load(e,function(e){var i=Oh.getContext();i.decodeAudioData(e,function(e){t(e)})},i,n)}}),Sn.prototype=Object.assign(Object.create(Li.prototype),{constructor:Sn,isRectAreaLight:!0,copy:function(e){return Li.prototype.copy.call(this,e),this.width=e.width,this.height=e.height,this}}),Object.assign(An.prototype,{update:function(){var e,t,i,n,r,a,o,s=new h,c=new h;return function(h){var l=e!==this||t!==h.focus||i!==h.fov||n!==h.aspect*this.aspect||r!==h.near||a!==h.far||o!==h.zoom;if(l){e=this,t=h.focus,i=h.fov,n=h.aspect*this.aspect,r=h.near,a=h.far,o=h.zoom;var u,p,d=h.projectionMatrix.clone(),f=this.eyeSep/2,m=f*r/t,g=r*Math.tan(us.DEG2RAD*i*.5)/o;c.elements[12]=-f,s.elements[12]=f,u=-g*n+m,p=g*n+m,d.elements[0]=2*r/(p-u),d.elements[8]=(p+u)/(p-u),this.cameraL.projectionMatrix.copy(d),u=-g*n-m,p=g*n-m,d.elements[0]=2*r/(p-u),d.elements[8]=(p+u)/(p-u),this.cameraR.projectionMatrix.copy(d)}this.cameraL.matrixWorld.copy(h.matrixWorld).multiply(c),this.cameraR.matrixWorld.copy(h.matrixWorld).multiply(s)}}()}),Ln.prototype=Object.create(ce.prototype),Ln.prototype.constructor=Ln,Rn.prototype=Object.assign(Object.create(ce.prototype),{constructor:Rn,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)},getFilter:function(){return this.filter},setFilter:function(e){null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination)},getMasterVolume:function(){return this.gain.gain.value},setMasterVolume:function(e){this.gain.gain.value=e},updateMatrixWorld:function(){var e=new c,t=new s,i=new c,n=new c;return function(r){ce.prototype.updateMatrixWorld.call(this,r);var a=this.context.listener,o=this.up;this.matrixWorld.decompose(e,t,i),n.set(0,0,-1).applyQuaternion(t),a.positionX?(a.positionX.setValueAtTime(e.x,this.context.currentTime),a.positionY.setValueAtTime(e.y,this.context.currentTime),a.positionZ.setValueAtTime(e.z,this.context.currentTime),a.forwardX.setValueAtTime(n.x,this.context.currentTime),a.forwardY.setValueAtTime(n.y,this.context.currentTime),a.forwardZ.setValueAtTime(n.z,this.context.currentTime),a.upX.setValueAtTime(o.x,this.context.currentTime),a.upY.setValueAtTime(o.y,this.context.currentTime),a.upZ.setValueAtTime(o.z,this.context.currentTime)):(a.setPosition(e.x,e.y,e.z),a.setOrientation(n.x,n.y,n.z,o.x,o.y,o.z))}}()}),Pn.prototype=Object.assign(Object.create(ce.prototype),{constructor:Pn,getOutput:function(){return this.gain},setNodeSource:function(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this},setBuffer:function(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this},play:function(){if(this.isPlaying===!0)return void console.warn("THREE.Audio: Audio is already playing.");if(this.hasPlaybackControl===!1)return void console.warn("THREE.Audio: this Audio has no playback control.");var e=this.context.createBufferSource();return e.buffer=this.buffer,e.loop=this.loop,e.onended=this.onEnded.bind(this),e.playbackRate.setValueAtTime(this.playbackRate,this.startTime),e.start(0,this.startTime),this.isPlaying=!0,this.source=e,this.connect()},pause:function(){return this.hasPlaybackControl===!1?void console.warn("THREE.Audio: this Audio has no playback control."):(this.source.stop(),this.startTime=this.context.currentTime,this.isPlaying=!1,this)},stop:function(){return this.hasPlaybackControl===!1?void console.warn("THREE.Audio: this Audio has no playback control."):(this.source.stop(),this.startTime=0,this.isPlaying=!1,this)},connect:function(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(var e=1,t=this.filters.length;t>e;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this},disconnect:function(){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(var e=1,t=this.filters.length;t>e;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this},getFilters:function(){return this.filters},setFilters:function(e){return e||(e=[]),this.isPlaying===!0?(this.disconnect(),this.filters=e,this.connect()):this.filters=e,this},getFilter:function(){return this.getFilters()[0]},setFilter:function(e){return this.setFilters(e?[e]:[])},setPlaybackRate:function(e){return this.hasPlaybackControl===!1?void console.warn("THREE.Audio: this Audio has no playback control."):(this.playbackRate=e,this.isPlaying===!0&&this.source.playbackRate.setValueAtTime(this.playbackRate,this.context.currentTime),this)},getPlaybackRate:function(){return this.playbackRate},onEnded:function(){this.isPlaying=!1},getLoop:function(){return this.hasPlaybackControl===!1?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop},setLoop:function(e){return this.hasPlaybackControl===!1?void console.warn("THREE.Audio: this Audio has no playback control."):(this.loop=e,this.isPlaying===!0&&(this.source.loop=this.loop),this)},getVolume:function(){return this.gain.gain.value},setVolume:function(e){return this.gain.gain.value=e,this}}),Cn.prototype=Object.assign(Object.create(Pn.prototype),{constructor:Cn,getOutput:function(){return this.panner},getRefDistance:function(){return this.panner.refDistance},setRefDistance:function(e){this.panner.refDistance=e},getRolloffFactor:function(){return this.panner.rolloffFactor},setRolloffFactor:function(e){this.panner.rolloffFactor=e},getDistanceModel:function(){return this.panner.distanceModel},setDistanceModel:function(e){this.panner.distanceModel=e},getMaxDistance:function(){return this.panner.maxDistance},setMaxDistance:function(e){this.panner.maxDistance=e},updateMatrixWorld:function(){var e=new c;return function(t){ce.prototype.updateMatrixWorld.call(this,t),e.setFromMatrixPosition(this.matrixWorld),this.panner.setPosition(e.x,e.y,e.z)}}()}),Object.assign(In.prototype,{getFrequencyData:function(){return this.analyser.getByteFrequencyData(this.data),this.data},getAverageFrequency:function(){for(var e=0,t=this.getFrequencyData(),i=0;i<t.length;i++)e+=t[i];return e/t.length}}),Un.prototype={constructor:Un,accumulate:function(e,t){var i=this.buffer,n=this.valueSize,r=e*n+n,a=this.cumulativeWeight;if(0===a){for(var o=0;o!==n;++o)i[r+o]=i[o];a=t}else{a+=t;var s=t/a;this._mixBufferRegion(i,r,0,s,n)}this.cumulativeWeight=a},apply:function(e){var t=this.valueSize,i=this.buffer,n=e*t+t,r=this.cumulativeWeight,a=this.binding;if(this.cumulativeWeight=0,1>r){var o=3*t;this._mixBufferRegion(i,n,o,1-r,t)}for(var s=t,c=t+t;s!==c;++s)if(i[s]!==i[s+t]){a.setValue(i,n);break}},saveOriginalState:function(){var e=this.binding,t=this.buffer,i=this.valueSize,n=3*i;e.getValue(t,n);for(var r=i,a=n;r!==a;++r)t[r]=t[n+r%i];this.cumulativeWeight=0},restoreOriginalState:function(){var e=3*this.valueSize;this.binding.setValue(this.buffer,e)},_select:function(e,t,i,n,r){if(n>=.5)for(var a=0;a!==r;++a)e[t+a]=e[i+a]},_slerp:function(e,t,i,n,r){s.slerpFlat(e,t,e,t,e,i,n)},_lerp:function(e,t,i,n,r){for(var a=1-n,o=0;o!==r;++o){var s=t+o;e[s]=e[s]*a+e[i+o]*n}}},Nn.prototype={constructor:Nn,getValue:function(e,t){this.bind(),this.getValue(e,t)},setValue:function(e,t){this.bind(),this.setValue(e,t)},bind:function(){var e=this.node,t=this.parsedPath,i=t.objectName,n=t.propertyName,r=t.propertyIndex;if(e||(e=Nn.findNode(this.rootNode,t.nodeName)||this.rootNode,this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e)return void console.error(" trying to update node for track: "+this.path+" but it wasn't found.");if(i){var a=t.objectIndex;switch(i){case"materials":if(!e.material)return void console.error(" can not bind to material as node does not have a material",this);if(!e.material.materials)return void console.error(" can not bind to material.materials as node.material does not have a materials array",this);e=e.material.materials;break;case"bones":if(!e.skeleton)return void console.error(" can not bind to bones as node does not have a skeleton",this);e=e.skeleton.bones;for(var o=0;o<e.length;o++)if(e[o].name===a){a=o;break}break;default:if(void 0===e[i])return void console.error(" can not bind to objectName of node, undefined",this);e=e[i]}if(void 0!==a){if(void 0===e[a])return void console.error(" trying to bind to objectIndex of objectName, but is undefined:",this,e);e=e[a]}}var s=e[n];if(void 0===s){var c=t.nodeName;return void console.error(" trying to update property for track: "+c+"."+n+" but it wasn't found.",e)}var h=this.Versioning.None;void 0!==e.needsUpdate?(h=this.Versioning.NeedsUpdate,this.targetObject=e):void 0!==e.matrixWorldNeedsUpdate&&(h=this.Versioning.MatrixWorldNeedsUpdate,this.targetObject=e);var l=this.BindingType.Direct;if(void 0!==r){if("morphTargetInfluences"===n){if(!e.geometry)return void console.error(" can not bind to morphTargetInfluences becasuse node does not have a geometry",this);if(!e.geometry.morphTargets)return void console.error(" can not bind to morphTargetInfluences becasuse node does not have a geometry.morphTargets",this);for(var o=0;o<this.node.geometry.morphTargets.length;o++)if(e.geometry.morphTargets[o].name===r){r=o;break}}l=this.BindingType.ArrayElement,this.resolvedProperty=s,this.propertyIndex=r}else void 0!==s.fromArray&&void 0!==s.toArray?(l=this.BindingType.HasFromToArray,this.resolvedProperty=s):void 0!==s.length?(l=this.BindingType.EntireArray,this.resolvedProperty=s):this.propertyName=n;this.getValue=this.GetterByBindingType[l],this.setValue=this.SetterByBindingTypeAndVersioning[l][h]},unbind:function(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}},Object.assign(Nn.prototype,{_getValue_unavailable:function(){},_setValue_unavailable:function(){},_getValue_unbound:Nn.prototype.getValue,_setValue_unbound:Nn.prototype.setValue,BindingType:{Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Versioning:{None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},GetterByBindingType:[function(e,t){e[t]=this.node[this.propertyName]},function(e,t){for(var i=this.resolvedProperty,n=0,r=i.length;n!==r;++n)e[t++]=i[n]},function(e,t){e[t]=this.resolvedProperty[this.propertyIndex]},function(e,t){this.resolvedProperty.toArray(e,t)}],SetterByBindingTypeAndVersioning:[[function(e,t){this.node[this.propertyName]=e[t]},function(e,t){this.node[this.propertyName]=e[t],this.targetObject.needsUpdate=!0},function(e,t){this.node[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){for(var i=this.resolvedProperty,n=0,r=i.length;n!==r;++n)i[n]=e[t++]},function(e,t){for(var i=this.resolvedProperty,n=0,r=i.length;n!==r;++n)i[n]=e[t++];this.targetObject.needsUpdate=!0},function(e,t){for(var i=this.resolvedProperty,n=0,r=i.length;n!==r;++n)i[n]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){this.resolvedProperty[this.propertyIndex]=e[t]},function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0},function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){this.resolvedProperty.fromArray(e,t)},function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0},function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}]]}),Nn.Composite=function(e,t,i){var n=i||Nn.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,n)},Nn.Composite.prototype={constructor:Nn.Composite,getValue:function(e,t){this.bind();var i=this._targetGroup.nCachedObjects_,n=this._bindings[i];void 0!==n&&n.getValue(e,t)},setValue:function(e,t){for(var i=this._bindings,n=this._targetGroup.nCachedObjects_,r=i.length;n!==r;++n)i[n].setValue(e,t)},bind:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].bind()},unbind:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].unbind()}},Nn.create=function(e,t,i){return e&&e.isAnimationObjectGroup?new Nn.Composite(e,t,i):new Nn(e,t,i)},Nn.parseTrackName=function(e){var t=/^((?:[\w-]+[\/:])*)([\w-]+)?(?:\.([\w-]+)(?:\[(.+)\])?)?\.([\w-]+)(?:\[(.+)\])?$/,i=t.exec(e);if(!i)throw new Error("cannot parse trackName at all: "+e);var n={nodeName:i[2],objectName:i[3],objectIndex:i[4],propertyName:i[5],propertyIndex:i[6]};if(null===n.propertyName||0===n.propertyName.length)throw new Error("can not parse propertyName from trackName: "+e);return n},Nn.findNode=function(e,t){if(!t||""===t||"root"===t||"."===t||-1===t||t===e.name||t===e.uuid)return e;if(e.skeleton){var i=function(e){for(var i=0;i<e.bones.length;i++){var n=e.bones[i];if(n.name===t)return n}return null},n=i(e.skeleton);if(n)return n}if(e.children){var r=function(e){for(var i=0;i<e.length;i++){var n=e[i];if(n.name===t||n.uuid===t)return n;var a=r(n.children);if(a)return a}return null},a=r(e.children);if(a)return a}return null},Dn.prototype={constructor:Dn,isAnimationObjectGroup:!0,add:function(e){for(var t=this._objects,i=t.length,n=this.nCachedObjects_,r=this._indicesByUUID,a=this._paths,o=this._parsedPaths,s=this._bindings,c=s.length,h=0,l=arguments.length;h!==l;++h){var u=arguments[h],p=u.uuid,d=r[p],f=void 0;if(void 0===d){d=i++,r[p]=d,t.push(u);for(var m=0,g=c;m!==g;++m)s[m].push(new Nn(u,a[m],o[m]))}else if(n>d){f=t[d];var v=--n,y=t[v];r[y.uuid]=d,t[d]=y,r[p]=v,t[v]=u;for(var m=0,g=c;m!==g;++m){var x=s[m],_=x[v],b=x[d];x[d]=_,void 0===b&&(b=new Nn(u,a[m],o[m])),x[v]=b}}else t[d]!==f&&console.error("Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes...")}this.nCachedObjects_=n},remove:function(e){for(var t=this._objects,i=this.nCachedObjects_,n=this._indicesByUUID,r=this._bindings,a=r.length,o=0,s=arguments.length;o!==s;++o){var c=arguments[o],h=c.uuid,l=n[h];if(void 0!==l&&l>=i){var u=i++,p=t[u];n[p.uuid]=l,t[l]=p,n[h]=u,t[u]=c;for(var d=0,f=a;d!==f;++d){var m=r[d],g=m[u],v=m[l];m[l]=g,m[u]=v}}}this.nCachedObjects_=i},uncache:function(e){for(var t=this._objects,i=t.length,n=this.nCachedObjects_,r=this._indicesByUUID,a=this._bindings,o=a.length,s=0,c=arguments.length;s!==c;++s){var h=arguments[s],l=h.uuid,u=r[l];if(void 0!==u)if(delete r[l],n>u){var p=--n,d=t[p],f=--i,m=t[f];r[d.uuid]=u,t[u]=d,r[m.uuid]=p,t[p]=m,t.pop();for(var g=0,v=o;g!==v;++g){var y=a[g],x=y[p],_=y[f];y[u]=x,y[p]=_,y.pop()}}else{var f=--i,m=t[f];r[m.uuid]=u,t[u]=m,t.pop();for(var g=0,v=o;g!==v;++g){var y=a[g];y[u]=y[f],y.pop()}}}this.nCachedObjects_=n},subscribe_:function(e,t){var i=this._bindingsIndicesByPath,n=i[e],r=this._bindings;if(void 0!==n)return r[n];var a=this._paths,o=this._parsedPaths,s=this._objects,c=s.length,h=this.nCachedObjects_,l=new Array(c);n=r.length,i[e]=n,a.push(e),o.push(t),r.push(l);for(var u=h,p=s.length;u!==p;++u){var d=s[u];l[u]=new Nn(d,e,t)}return l},unsubscribe_:function(e){var t=this._bindingsIndicesByPath,i=t[e];if(void 0!==i){var n=this._paths,r=this._parsedPaths,a=this._bindings,o=a.length-1,s=a[o],c=e[o];t[c]=i,a[i]=s,a.pop(),r[i]=r[o],r.pop(),n[i]=n[o],n.pop()}}},On.prototype={constructor:On,play:function(){return this._mixer._activateAction(this),this},stop:function(){return this._mixer._deactivateAction(this),this.reset()},reset:function(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()},isRunning:function(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)},isScheduled:function(){return this._mixer._isActiveAction(this)},startAt:function(e){return this._startTime=e,this},setLoop:function(e,t){return this.loop=e,this.repetitions=t,this},setEffectiveWeight:function(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()},getEffectiveWeight:function(){return this._effectiveWeight},fadeIn:function(e){return this._scheduleFading(e,0,1)},fadeOut:function(e){return this._scheduleFading(e,1,0)},crossFadeFrom:function(e,t,i){if(e.fadeOut(t),this.fadeIn(t),i){var n=this._clip.duration,r=e._clip.duration,a=r/n,o=n/r;e.warp(1,a,t),this.warp(o,1,t)}return this},crossFadeTo:function(e,t,i){return e.crossFadeFrom(this,t,i)},stopFading:function(){var e=this._weightInterpolant;return null!==e&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this},setEffectiveTimeScale:function(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()},getEffectiveTimeScale:function(){return this._effectiveTimeScale},setDuration:function(e){return this.timeScale=this._clip.duration/e,this.stopWarping()},syncWith:function(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()},halt:function(e){return this.warp(this._effectiveTimeScale,0,e)},warp:function(e,t,i){var n=this._mixer,r=n.time,a=this._timeScaleInterpolant,o=this.timeScale;null===a&&(a=n._lendControlInterpolant(),this._timeScaleInterpolant=a);var s=a.parameterPositions,c=a.sampleValues;return s[0]=r,s[1]=r+i,c[0]=e/o,c[1]=t/o,this},stopWarping:function(){var e=this._timeScaleInterpolant;return null!==e&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this},getMixer:function(){return this._mixer},getClip:function(){return this._clip},getRoot:function(){return this._localRoot||this._mixer._root},_update:function(e,t,i,n){var r=this._startTime;if(null!==r){var a=(e-r)*i;if(0>a||0===i)return;this._startTime=null,t=i*a}t*=this._updateTimeScale(e);var o=this._updateTime(t),s=this._updateWeight(e);if(s>0)for(var c=this._interpolants,h=this._propertyBindings,l=0,u=c.length;l!==u;++l)c[l].evaluate(o),h[l].accumulate(n,s)},_updateWeight:function(e){var t=0;if(this.enabled){t=this.weight;var i=this._weightInterpolant;if(null!==i){var n=i.evaluate(e)[0];t*=n,e>i.parameterPositions[1]&&(this.stopFading(),0===n&&(this.enabled=!1))}}return this._effectiveWeight=t,t},_updateTimeScale:function(e){var t=0;if(!this.paused){t=this.timeScale;var i=this._timeScaleInterpolant;if(null!==i){var n=i.evaluate(e)[0];t*=n,e>i.parameterPositions[1]&&(this.stopWarping(),0===t?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t},_updateTime:function(e){var t=this.time+e;if(0===e)return t;var i=this._clip.duration,n=this.loop,r=this._loopCount;if(n===ko){-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(t>=i)t=i;else{if(!(0>t))break e;t=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this._mixer.dispatchEvent({type:"finished",action:this,direction:0>e?-1:1})}}else{var a=n===Wo;if(-1===r&&(e>=0?(r=0,this._setEndings(!0,0===this.repetitions,a)):this._setEndings(0===this.repetitions,!0,a)),t>=i||0>t){var o=Math.floor(t/i);t-=i*o,r+=Math.abs(o);var s=this.repetitions-r;if(0>s)this.clampWhenFinished?this.paused=!0:this.enabled=!1,t=e>0?i:0,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(0===s){var c=0>e;this._setEndings(c,!c,a)}else this._setEndings(!1,!1,a);this._loopCount=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}if(a&&1===(1&r))return this.time=t,i-t}return this.time=t,t},_setEndings:function(e,t,i){var n=this._interpolantSettings;i?(n.endingStart=Jo,n.endingEnd=Jo):(e?n.endingStart=this.zeroSlopeAtStart?Jo:Zo:n.endingStart=Qo,t?n.endingEnd=this.zeroSlopeAtEnd?Jo:Zo:n.endingEnd=Qo)},_scheduleFading:function(e,t,i){var n=this._mixer,r=n.time,a=this._weightInterpolant;null===a&&(a=n._lendControlInterpolant(),this._weightInterpolant=a);var o=a.parameterPositions,s=a.sampleValues;return o[0]=r,s[0]=t,o[1]=r+e,s[1]=i,this}},Bn.prototype={constructor:Bn,clipAction:function(e,t){var i=t||this._root,n=i.uuid,r="string"==typeof e?Ji.findByName(i,e):e,a=null!==r?r.uuid:e,o=this._actionsByClip[a],s=null;if(void 0!==o){var c=o.actionByRoot[n];if(void 0!==c)return c;s=o.knownActions[0],null===r&&(r=s._clip)}if(null===r)return null;var h=new On(this,r,t);return this._bindAction(h,s),this._addInactiveAction(h,a,n),h},existingAction:function(e,t){var i=t||this._root,n=i.uuid,r="string"==typeof e?Ji.findByName(i,e):e,a=r?r.uuid:e,o=this._actionsByClip[a];return void 0!==o?o.actionByRoot[n]||null:null},stopAllAction:function(){var e=this._actions,t=this._nActiveActions,i=this._bindings,n=this._nActiveBindings;this._nActiveActions=0,this._nActiveBindings=0;for(var r=0;r!==t;++r)e[r].reset();for(var r=0;r!==n;++r)i[r].useCount=0;return this},update:function(e){e*=this.timeScale;for(var t=this._actions,i=this._nActiveActions,n=this.time+=e,r=Math.sign(e),a=this._accuIndex^=1,o=0;o!==i;++o){var s=t[o];s.enabled&&s._update(n,e,r,a)}for(var c=this._bindings,h=this._nActiveBindings,o=0;o!==h;++o)c[o].apply(a);return this},getRoot:function(){return this._root},uncacheClip:function(e){var t=this._actions,i=e.uuid,n=this._actionsByClip,r=n[i];if(void 0!==r){for(var a=r.knownActions,o=0,s=a.length;o!==s;++o){var c=a[o];this._deactivateAction(c);var h=c._cacheIndex,l=t[t.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,l._cacheIndex=h,t[h]=l,t.pop(),this._removeInactiveBindingsForAction(c)}delete n[i]}},uncacheRoot:function(e){var t=e.uuid,i=this._actionsByClip;for(var n in i){var r=i[n].actionByRoot,a=r[t];void 0!==a&&(this._deactivateAction(a),this._removeInactiveAction(a))}var o=this._bindingsByRootAndName,s=o[t];if(void 0!==s)for(var c in s){var h=s[c];h.restoreOriginalState(),this._removeInactiveBinding(h)}},uncacheAction:function(e,t){var i=this.existingAction(e,t);null!==i&&(this._deactivateAction(i),this._removeInactiveAction(i))}},Object.assign(Bn.prototype,{_bindAction:function(e,t){var i=e._localRoot||this._root,n=e._clip.tracks,r=n.length,a=e._propertyBindings,o=e._interpolants,s=i.uuid,c=this._bindingsByRootAndName,h=c[s];void 0===h&&(h={},c[s]=h);for(var l=0;l!==r;++l){var u=n[l],p=u.name,d=h[p];if(void 0!==d)a[l]=d;else{if(d=a[l],void 0!==d){null===d._cacheIndex&&(++d.referenceCount,this._addInactiveBinding(d,s,p));continue}var f=t&&t._propertyBindings[l].binding.parsedPath;d=new Un(Nn.create(i,p,f),u.ValueTypeName,u.getValueSize()),++d.referenceCount,this._addInactiveBinding(d,s,p),a[l]=d}o[l].resultBuffer=d.buffer}},_activateAction:function(e){if(!this._isActiveAction(e)){if(null===e._cacheIndex){var t=(e._localRoot||this._root).uuid,i=e._clip.uuid,n=this._actionsByClip[i];this._bindAction(e,n&&n.knownActions[0]),this._addInactiveAction(e,i,t)}for(var r=e._propertyBindings,a=0,o=r.length;a!==o;++a){var s=r[a];0===s.useCount++&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}},_deactivateAction:function(e){if(this._isActiveAction(e)){for(var t=e._propertyBindings,i=0,n=t.length;i!==n;++i){var r=t[i];0===--r.useCount&&(r.restoreOriginalState(),this._takeBackBinding(r))}this._takeBackAction(e)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}},_isActiveAction:function(e){var t=e._cacheIndex;return null!==t&&t<this._nActiveActions},_addInactiveAction:function(e,t,i){var n=this._actions,r=this._actionsByClip,a=r[t];if(void 0===a)a={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,r[t]=a;else{var o=a.knownActions;e._byClipCacheIndex=o.length,o.push(e)}e._cacheIndex=n.length,n.push(e),a.actionByRoot[i]=e},_removeInactiveAction:function(e){var t=this._actions,i=t[t.length-1],n=e._cacheIndex;i._cacheIndex=n,t[n]=i,t.pop(),e._cacheIndex=null;var r=e._clip.uuid,a=this._actionsByClip,o=a[r],s=o.knownActions,c=s[s.length-1],h=e._byClipCacheIndex;c._byClipCacheIndex=h,s[h]=c,s.pop(),e._byClipCacheIndex=null;var l=o.actionByRoot,u=(t._localRoot||this._root).uuid;delete l[u],0===s.length&&delete a[r],this._removeInactiveBindingsForAction(e)},_removeInactiveBindingsForAction:function(e){for(var t=e._propertyBindings,i=0,n=t.length;i!==n;++i){var r=t[i];0===--r.referenceCount&&this._removeInactiveBinding(r)}},_lendAction:function(e){var t=this._actions,i=e._cacheIndex,n=this._nActiveActions++,r=t[n];e._cacheIndex=n,t[n]=e,r._cacheIndex=i,t[i]=r},_takeBackAction:function(e){var t=this._actions,i=e._cacheIndex,n=--this._nActiveActions,r=t[n];e._cacheIndex=n,t[n]=e,r._cacheIndex=i,t[i]=r},_addInactiveBinding:function(e,t,i){var n=this._bindingsByRootAndName,r=n[t],a=this._bindings;void 0===r&&(r={},n[t]=r),r[i]=e,e._cacheIndex=a.length,a.push(e)},_removeInactiveBinding:function(e){var t=this._bindings,i=e.binding,n=i.rootNode.uuid,r=i.path,a=this._bindingsByRootAndName,o=a[n],s=t[t.length-1],c=e._cacheIndex;s._cacheIndex=c,t[c]=s,t.pop(),delete o[r];e:{for(var h in o)break e;delete a[n]}},_lendBinding:function(e){var t=this._bindings,i=e._cacheIndex,n=this._nActiveBindings++,r=t[n];e._cacheIndex=n,t[n]=e,r._cacheIndex=i,t[i]=r},_takeBackBinding:function(e){var t=this._bindings,i=e._cacheIndex,n=--this._nActiveBindings,r=t[n];e._cacheIndex=n,t[n]=e,r._cacheIndex=i,t[i]=r},_lendControlInterpolant:function(){var e=this._controlInterpolants,t=this._nActiveControlInterpolants++,i=e[t];return void 0===i&&(i=new zi(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer),i.__cacheIndex=t,e[t]=i),i},_takeBackControlInterpolant:function(e){var t=this._controlInterpolants,i=e.__cacheIndex,n=--this._nActiveControlInterpolants,r=t[n];e.__cacheIndex=n,t[n]=e,r.__cacheIndex=i,t[i]=r},_controlInterpolantsResultBuffer:new Float32Array(1)}),Object.assign(Bn.prototype,t.prototype),Fn.prototype.clone=function(){return new Fn(void 0===this.value.clone?this.value:this.value.clone())},zn.prototype=Object.create(Ae.prototype),zn.prototype.constructor=zn,zn.prototype.isInstancedBufferGeometry=!0,zn.prototype.addGroup=function(e,t,i){this.groups.push({start:e,count:t,materialIndex:i})},zn.prototype.copy=function(e){var t=e.index;null!==t&&this.setIndex(t.clone());var i=e.attributes;for(var n in i){var r=i[n];this.addAttribute(n,r.clone())}for(var a=e.groups,o=0,s=a.length;s>o;o++){var c=a[o];this.addGroup(c.start,c.count,c.materialIndex)}return this},Gn.prototype={constructor:Gn,isInterleavedBufferAttribute:!0,get count(){return this.data.count},get array(){return this.data.array},setX:function(e,t){return this.data.array[e*this.data.stride+this.offset]=t,this},setY:function(e,t){return this.data.array[e*this.data.stride+this.offset+1]=t,this},setZ:function(e,t){return this.data.array[e*this.data.stride+this.offset+2]=t,this},setW:function(e,t){return this.data.array[e*this.data.stride+this.offset+3]=t,this},getX:function(e){return this.data.array[e*this.data.stride+this.offset]},getY:function(e){return this.data.array[e*this.data.stride+this.offset+1]},getZ:function(e){return this.data.array[e*this.data.stride+this.offset+2]},getW:function(e){return this.data.array[e*this.data.stride+this.offset+3]},setXY:function(e,t,i){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=i,this},setXYZ:function(e,t,i,n){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=i,this.data.array[e+2]=n,this},setXYZW:function(e,t,i,n,r){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=i,this.data.array[e+2]=n,this.data.array[e+3]=r,this}},Hn.prototype={constructor:Hn,
13
+ isInterleavedBuffer:!0,set needsUpdate(e){e===!0&&this.version++},setArray:function(e){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.count=void 0!==e?e.length/this.stride:0,this.array=e},setDynamic:function(e){return this.dynamic=e,this},copy:function(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.dynamic=e.dynamic,this},copyAt:function(e,t,i){e*=this.stride,i*=t.stride;for(var n=0,r=this.stride;r>n;n++)this.array[e+n]=t.array[i+n];return this},set:function(e,t){return void 0===t&&(t=0),this.array.set(e,t),this},clone:function(){return(new this.constructor).copy(this)},onUpload:function(e){return this.onUploadCallback=e,this}},Vn.prototype=Object.create(Hn.prototype),Vn.prototype.constructor=Vn,Vn.prototype.isInstancedInterleavedBuffer=!0,Vn.prototype.copy=function(e){return Hn.prototype.copy.call(this,e),this.meshPerAttribute=e.meshPerAttribute,this},kn.prototype=Object.create(de.prototype),kn.prototype.constructor=kn,kn.prototype.isInstancedBufferAttribute=!0,kn.prototype.copy=function(e){return de.prototype.copy.call(this,e),this.meshPerAttribute=e.meshPerAttribute,this},jn.prototype={constructor:jn,linePrecision:1,set:function(e,t){this.ray.set(e,t)},setFromCamera:function(e,t){t&&t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize()):t&&t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld)):console.error("THREE.Raycaster: Unsupported camera type.")},intersectObject:function(e,t){var i=[];return Xn(e,this,i,t),i.sort(Wn),i},intersectObjects:function(e,t){var i=[];if(Array.isArray(e)===!1)return console.warn("THREE.Raycaster.intersectObjects: objects is not an Array."),i;for(var n=0,r=e.length;r>n;n++)Xn(e[n],this,i,t);return i.sort(Wn),i}},qn.prototype={constructor:qn,start:function(){this.startTime=(performance||Date).now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0},stop:function(){this.getElapsedTime(),this.running=!1},getElapsedTime:function(){return this.getDelta(),this.elapsedTime},getDelta:function(){var e=0;if(this.autoStart&&!this.running&&this.start(),this.running){var t=(performance||Date).now();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}},Yn.prototype={constructor:Yn,set:function(e,t,i){return this.radius=e,this.phi=t,this.theta=i,this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this},makeSafe:function(){var e=1e-6;return this.phi=Math.max(e,Math.min(Math.PI-e,this.phi)),this},setFromVector3:function(e){return this.radius=e.length(),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e.x,e.z),this.phi=Math.acos(us.clamp(e.y/this.radius,-1,1))),this}},Zn.prototype={constructor:Zn,set:function(e,t,i){return this.radius=e,this.theta=t,this.y=i,this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this},setFromVector3:function(e){return this.radius=Math.sqrt(e.x*e.x+e.z*e.z),this.theta=Math.atan2(e.x,e.z),this.y=e.y,this}},Jn.prototype=Object.create(Le.prototype),Jn.prototype.constructor=Jn,Jn.prototype.createAnimation=function(e,t,i,n){var r={start:t,end:i,length:i-t+1,fps:n,duration:(i-t)/n,lastFrame:0,currentFrame:0,active:!1,time:0,direction:1,weight:1,directionBackwards:!1,mirroredLoop:!1};this.animationsMap[e]=r,this.animationsList.push(r)},Jn.prototype.autoCreateAnimations=function(e){for(var t,i=/([a-z]+)_?(\d+)/i,n={},r=this.geometry,a=0,o=r.morphTargets.length;o>a;a++){var s=r.morphTargets[a],c=s.name.match(i);if(c&&c.length>1){var h=c[1];n[h]||(n[h]={start:1/0,end:-(1/0)});var l=n[h];a<l.start&&(l.start=a),a>l.end&&(l.end=a),t||(t=h)}}for(var h in n){var l=n[h];this.createAnimation(h,l.start,l.end,e)}this.firstAnimation=t},Jn.prototype.setAnimationDirectionForward=function(e){var t=this.animationsMap[e];t&&(t.direction=1,t.directionBackwards=!1)},Jn.prototype.setAnimationDirectionBackward=function(e){var t=this.animationsMap[e];t&&(t.direction=-1,t.directionBackwards=!0)},Jn.prototype.setAnimationFPS=function(e,t){var i=this.animationsMap[e];i&&(i.fps=t,i.duration=(i.end-i.start)/i.fps)},Jn.prototype.setAnimationDuration=function(e,t){var i=this.animationsMap[e];i&&(i.duration=t,i.fps=(i.end-i.start)/i.duration)},Jn.prototype.setAnimationWeight=function(e,t){var i=this.animationsMap[e];i&&(i.weight=t)},Jn.prototype.setAnimationTime=function(e,t){var i=this.animationsMap[e];i&&(i.time=t)},Jn.prototype.getAnimationTime=function(e){var t=0,i=this.animationsMap[e];return i&&(t=i.time),t},Jn.prototype.getAnimationDuration=function(e){var t=-1,i=this.animationsMap[e];return i&&(t=i.duration),t},Jn.prototype.playAnimation=function(e){var t=this.animationsMap[e];t?(t.time=0,t.active=!0):console.warn("THREE.MorphBlendMesh: animation["+e+"] undefined in .playAnimation()")},Jn.prototype.stopAnimation=function(e){var t=this.animationsMap[e];t&&(t.active=!1)},Jn.prototype.update=function(e){for(var t=0,i=this.animationsList.length;i>t;t++){var n=this.animationsList[t];if(n.active){var r=n.duration/n.length;n.time+=n.direction*e,n.mirroredLoop?(n.time>n.duration||n.time<0)&&(n.direction*=-1,n.time>n.duration&&(n.time=n.duration,n.directionBackwards=!0),n.time<0&&(n.time=0,n.directionBackwards=!1)):(n.time=n.time%n.duration,n.time<0&&(n.time+=n.duration));var a=n.start+us.clamp(Math.floor(n.time/r),0,n.length-1),o=n.weight;a!==n.currentFrame&&(this.morphTargetInfluences[n.lastFrame]=0,this.morphTargetInfluences[n.currentFrame]=1*o,this.morphTargetInfluences[a]=0,n.lastFrame=n.currentFrame,n.currentFrame=a);var s=n.time%r/r;n.directionBackwards&&(s=1-s),n.currentFrame!==n.lastFrame?(this.morphTargetInfluences[n.currentFrame]=s*o,this.morphTargetInfluences[n.lastFrame]=(1-s)*o):this.morphTargetInfluences[n.currentFrame]=o}}},Qn.prototype=Object.create(ce.prototype),Qn.prototype.constructor=Qn,Qn.prototype.isImmediateRenderObject=!0,Kn.prototype=Object.create(bt.prototype),Kn.prototype.constructor=Kn,Kn.prototype.update=function(){var e=new c,t=new c,i=new te;return function(){var n=["a","b","c"];this.object.updateMatrixWorld(!0),i.getNormalMatrix(this.object.matrixWorld);var r=this.object.matrixWorld,a=this.geometry.attributes.position,o=this.object.geometry;if(o&&o.isGeometry)for(var s=o.vertices,c=o.faces,h=0,l=0,u=c.length;u>l;l++)for(var p=c[l],d=0,f=p.vertexNormals.length;f>d;d++){var m=s[p[n[d]]],g=p.vertexNormals[d];e.copy(m).applyMatrix4(r),t.copy(g).applyMatrix3(i).normalize().multiplyScalar(this.size).add(e),a.setXYZ(h,e.x,e.y,e.z),h+=1,a.setXYZ(h,t.x,t.y,t.z),h+=1}else if(o&&o.isBufferGeometry)for(var v=o.attributes.position,y=o.attributes.normal,h=0,d=0,f=v.count;f>d;d++)e.set(v.getX(d),v.getY(d),v.getZ(d)).applyMatrix4(r),t.set(y.getX(d),y.getY(d),y.getZ(d)),t.applyMatrix3(i).normalize().multiplyScalar(this.size).add(e),a.setXYZ(h,e.x,e.y,e.z),h+=1,a.setXYZ(h,t.x,t.y,t.z),h+=1;return a.needsUpdate=!0,this}}(),$n.prototype=Object.create(ce.prototype),$n.prototype.constructor=$n,$n.prototype.dispose=function(){this.cone.geometry.dispose(),this.cone.material.dispose()},$n.prototype.update=function(){var e=new c,t=new c;return function(){var i=this.light.distance?this.light.distance:1e3,n=i*Math.tan(this.light.angle);this.cone.scale.set(n,n,i),e.setFromMatrixPosition(this.light.matrixWorld),t.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(t.sub(e)),this.cone.material.color.copy(this.light.color).multiplyScalar(this.light.intensity)}}(),er.prototype=Object.create(bt.prototype),er.prototype.constructor=er,er.prototype.getBoneList=function(e){var t=[];e&&e.isBone&&t.push(e);for(var i=0;i<e.children.length;i++)t.push.apply(t,this.getBoneList(e.children[i]));return t},er.prototype.update=function(){var e=new c,t=new h,i=new h;return function(){var n=this.geometry,r=n.getAttribute("position");i.getInverse(this.root.matrixWorld);for(var a=0,o=0;a<this.bones.length;a++){var s=this.bones[a];s.parent&&s.parent.isBone&&(t.multiplyMatrices(i,s.matrixWorld),e.setFromMatrixPosition(t),r.setXYZ(o,e.x,e.y,e.z),t.multiplyMatrices(i,s.parent.matrixWorld),e.setFromMatrixPosition(t),r.setXYZ(o+1,e.x,e.y,e.z),o+=2)}n.getAttribute("position").needsUpdate=!0}}(),tr.prototype=Object.create(Le.prototype),tr.prototype.constructor=tr,tr.prototype.dispose=function(){this.geometry.dispose(),this.material.dispose()},tr.prototype.update=function(){this.material.color.copy(this.light.color).multiplyScalar(this.light.intensity)},ir.prototype=Object.create(ce.prototype),ir.prototype.constructor=ir,ir.prototype.dispose=function(){this.children[0].geometry.dispose(),this.children[0].material.dispose(),this.children[1].geometry.dispose(),this.children[1].material.dispose()},ir.prototype.update=function(){var e=new c,t=new c;return function(){var i=this.children[0],n=this.children[1];if(this.light.target){e.setFromMatrixPosition(this.light.matrixWorld),t.setFromMatrixPosition(this.light.target.matrixWorld);var r=t.clone().sub(e);i.lookAt(r),n.lookAt(r)}i.material.color.copy(this.light.color).multiplyScalar(this.light.intensity),n.material.color.copy(this.light.color).multiplyScalar(this.light.intensity);var a=.5*this.light.width,o=.5*this.light.height,s=i.geometry.getAttribute("position"),c=s.array;c[0]=a,c[1]=-o,c[2]=0,c[3]=a,c[4]=o,c[5]=0,c[6]=-a,c[7]=o,c[8]=0,c[9]=-a,c[10]=o,c[11]=0,c[12]=-a,c[13]=-o,c[14]=0,c[15]=a,c[16]=-o,c[17]=0,s.needsUpdate=!0}}(),nr.prototype=Object.create(ce.prototype),nr.prototype.constructor=nr,nr.prototype.dispose=function(){this.children[0].geometry.dispose(),this.children[0].material.dispose()},nr.prototype.update=function(){var e=new c,t=new W,i=new W;return function(){var n=this.children[0],r=n.geometry.getAttribute("color");t.copy(this.light.color).multiplyScalar(this.light.intensity),i.copy(this.light.groundColor).multiplyScalar(this.light.intensity);for(var a=0,o=r.count;o>a;a++){var s=o/2>a?t:i;r.setXYZ(a,s.r,s.g,s.b)}n.lookAt(e.setFromMatrixPosition(this.light.matrixWorld).negate()),r.needsUpdate=!0}}(),rr.prototype=Object.create(bt.prototype),rr.prototype.constructor=rr,ar.prototype=Object.create(bt.prototype),ar.prototype.constructor=ar,or.prototype=Object.create(bt.prototype),or.prototype.constructor=or,or.prototype.update=function(){var e=new c,t=new c,i=new te;return function(){this.object.updateMatrixWorld(!0),i.getNormalMatrix(this.object.matrixWorld);for(var n=this.object.matrixWorld,r=this.geometry.attributes.position,a=this.object.geometry,o=a.vertices,s=a.faces,c=0,h=0,l=s.length;l>h;h++){var u=s[h],p=u.normal;e.copy(o[u.a]).add(o[u.b]).add(o[u.c]).divideScalar(3).applyMatrix4(n),t.copy(p).applyMatrix3(i).normalize().multiplyScalar(this.size).add(e),r.setXYZ(c,e.x,e.y,e.z),c+=1,r.setXYZ(c,t.x,t.y,t.z),c+=1}return r.needsUpdate=!0,this}}(),sr.prototype=Object.create(ce.prototype),sr.prototype.constructor=sr,sr.prototype.dispose=function(){var e=this.children[0],t=this.children[1];e.geometry.dispose(),e.material.dispose(),t.geometry.dispose(),t.material.dispose()},sr.prototype.update=function(){var e=new c,t=new c,i=new c;return function(){e.setFromMatrixPosition(this.light.matrixWorld),t.setFromMatrixPosition(this.light.target.matrixWorld),i.subVectors(t,e);var n=this.children[0],r=this.children[1];n.lookAt(i),n.material.color.copy(this.light.color).multiplyScalar(this.light.intensity),r.lookAt(i),r.scale.z=i.length()}}(),cr.prototype=Object.create(bt.prototype),cr.prototype.constructor=cr,cr.prototype.update=function(){function e(e,a,o,s){n.set(a,o,s).unproject(r);var c=i[e];if(void 0!==c)for(var h=t.getAttribute("position"),l=0,u=c.length;u>l;l++)h.setXYZ(c[l],n.x,n.y,n.z)}var t,i,n=new c,r=new Ue;return function(){t=this.geometry,i=this.pointMap;var n=1,a=1;r.projectionMatrix.copy(this.camera.projectionMatrix),e("c",0,0,-1),e("t",0,0,1),e("n1",-n,-a,-1),e("n2",n,-a,-1),e("n3",-n,a,-1),e("n4",n,a,-1),e("f1",-n,-a,1),e("f2",n,-a,1),e("f3",-n,a,1),e("f4",n,a,1),e("u1",.7*n,1.1*a,-1),e("u2",.7*-n,1.1*a,-1),e("u3",0,2*a,-1),e("cf1",-n,0,1),e("cf2",n,0,1),e("cf3",0,-a,1),e("cf4",0,a,1),e("cn1",-n,0,-1),e("cn2",n,0,-1),e("cn3",0,-a,-1),e("cn4",0,a,-1),t.getAttribute("position").needsUpdate=!0}}(),hr.prototype=Object.create(bt.prototype),hr.prototype.constructor=hr,hr.prototype.update=function(){var e=new $;return function(t){if(t&&t.isBox3?e.copy(t):e.setFromObject(t),!e.isEmpty()){var i=e.min,n=e.max,r=this.geometry.attributes.position,a=r.array;a[0]=n.x,a[1]=n.y,a[2]=n.z,a[3]=i.x,a[4]=n.y,a[5]=n.z,a[6]=i.x,a[7]=i.y,a[8]=n.z,a[9]=n.x,a[10]=i.y,a[11]=n.z,a[12]=n.x,a[13]=n.y,a[14]=i.z,a[15]=i.x,a[16]=n.y,a[17]=i.z,a[18]=i.x,a[19]=i.y,a[20]=i.z,a[21]=n.x,a[22]=i.y,a[23]=i.z,r.needsUpdate=!0,this.geometry.computeBoundingSphere()}}}();var Bh,Fh;lr.prototype=Object.create(ce.prototype),lr.prototype.constructor=lr,lr.prototype.setDirection=function(){var e,t=new c;return function(i){i.y>.99999?this.quaternion.set(0,0,0,1):i.y<-.99999?this.quaternion.set(1,0,0,0):(t.set(i.z,0,-i.x).normalize(),e=Math.acos(i.y),this.quaternion.setFromAxisAngle(t,e))}}(),lr.prototype.setLength=function(e,t,i){void 0===t&&(t=.2*e),void 0===i&&(i=.2*t),this.line.scale.set(1,Math.max(0,e-t),1),this.line.updateMatrix(),this.cone.scale.set(i,t,i),this.cone.position.y=e,this.cone.updateMatrix()},lr.prototype.setColor=function(e){this.line.material.color.copy(e),this.cone.material.color.copy(e)},ur.prototype=Object.create(bt.prototype),ur.prototype.constructor=ur;var zh=new c,Gh=new pr,Hh=new pr,Vh=new pr;dr.prototype=Object.create(dn.prototype),dr.prototype.constructor=dr,dr.prototype.getPoint=function(e){var t=this.points,i=t.length;2>i&&console.log("duh, you need at least 2 points");var n=(i-(this.closed?0:1))*e,r=Math.floor(n),a=n-r;this.closed?r+=r>0?0:(Math.floor(Math.abs(r)/t.length)+1)*t.length:0===a&&r===i-1&&(r=i-2,a=1);var o,s,h,l;if(this.closed||r>0?o=t[(r-1)%i]:(zh.subVectors(t[0],t[1]).add(t[0]),o=zh),s=t[r%i],h=t[(r+1)%i],this.closed||i>r+2?l=t[(r+2)%i]:(zh.subVectors(t[i-1],t[i-2]).add(t[i-1]),l=zh),void 0===this.type||"centripetal"===this.type||"chordal"===this.type){var u="chordal"===this.type?.5:.25,p=Math.pow(o.distanceToSquared(s),u),d=Math.pow(s.distanceToSquared(h),u),f=Math.pow(h.distanceToSquared(l),u);1e-4>d&&(d=1),1e-4>p&&(p=d),1e-4>f&&(f=d),Gh.initNonuniformCatmullRom(o.x,s.x,h.x,l.x,p,d,f),Hh.initNonuniformCatmullRom(o.y,s.y,h.y,l.y,p,d,f),Vh.initNonuniformCatmullRom(o.z,s.z,h.z,l.z,p,d,f)}else if("catmullrom"===this.type){var m=void 0!==this.tension?this.tension:.5;Gh.initCatmullRom(o.x,s.x,h.x,l.x,m),Hh.initCatmullRom(o.y,s.y,h.y,l.y,m),Vh.initCatmullRom(o.z,s.z,h.z,l.z,m)}return new c(Gh.calc(a),Hh.calc(a),Vh.calc(a))},fr.prototype=Object.create(dn.prototype),fr.prototype.constructor=fr,fr.prototype.getPoint=function(e){var t=this.v0,i=this.v1,n=this.v2,r=this.v3;return new c(pn(e,t.x,i.x,n.x,r.x),pn(e,t.y,i.y,n.y,r.y),pn(e,t.z,i.z,n.z,r.z))},mr.prototype=Object.create(dn.prototype),mr.prototype.constructor=mr,mr.prototype.getPoint=function(e){var t=this.v0,i=this.v1,n=this.v2;return new c(sn(e,t.x,i.x,n.x),sn(e,t.y,i.y,n.y),sn(e,t.z,i.z,n.z))},gr.prototype=Object.create(dn.prototype),gr.prototype.constructor=gr,gr.prototype.getPoint=function(e){if(1===e)return this.v2.clone();var t=new c;return t.subVectors(this.v2,this.v1),t.multiplyScalar(e),t.add(this.v1),t},vr.prototype=Object.create(gn.prototype),vr.prototype.constructor=vr;var kh={createMultiMaterialObject:function(e,t){for(var i=new Et,n=0,r=t.length;r>n;n++)i.add(new Le(e,t[n]));return i},detach:function(e,t,i){e.applyMatrix(t.matrixWorld),t.remove(e),i.add(e)},attach:function(e,t,i){var n=new h;n.getInverse(i.matrixWorld),e.applyMatrix(n),t.remove(e),i.add(e)}},jh=0,Wh=1;dn.create=function(e,t){return console.log("THREE.Curve.create() has been deprecated"),e.prototype=Object.create(dn.prototype),e.prototype.constructor=e,e.prototype.getPoint=t,e},Br.prototype=Object.create(dr.prototype),Fr.prototype=Object.create(dr.prototype),zr.prototype=Object.create(dr.prototype),Object.assign(zr.prototype,{initFromArray:function(e){console.error("THREE.Spline: .initFromArray() has been removed.")},getControlPointsArray:function(e){console.error("THREE.Spline: .getControlPointsArray() has been removed.")},reparametrizeByArcLength:function(e){console.error("THREE.Spline: .reparametrizeByArcLength() has been removed.")}}),rr.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},Object.assign(q.prototype,{center:function(e){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(e)},empty:function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(e){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},size:function(e){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(e)}}),Object.assign($.prototype,{center:function(e){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(e)},empty:function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(e){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},isIntersectionSphere:function(e){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)},size:function(e){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(e)}}),he.prototype.center=function(e){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(e)},us.random16=function(){return console.warn("THREE.Math.random16() has been deprecated. Use Math.random() instead."),Math.random()},Object.assign(te.prototype,{flattenToArrayOffset:function(e,t){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(e,t)},multiplyVector3:function(e){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),e.applyMatrix3(this)},multiplyVector3Array:function(e){return console.warn("THREE.Matrix3: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead."),this.applyToVector3Array(e)},applyToBuffer:function(e,t,i){return console.warn("THREE.Matrix3: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute( attribute ) instead."),this.applyToBufferAttribute(e)},applyToVector3Array:function(e,t,i){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")}}),Object.assign(h.prototype,{extractPosition:function(e){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(e)},flattenToArrayOffset:function(e,t){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(e,t)},getPosition:function(){var e;return function(){return void 0===e&&(e=new c),console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),e.setFromMatrixColumn(this,3)}}(),setRotationFromQuaternion:function(e){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(e)},multiplyVector3:function(e){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},multiplyVector4:function(e){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},multiplyVector3Array:function(e){return console.warn("THREE.Matrix4: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead."),this.applyToVector3Array(e)},rotateAxis:function(e){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),e.transformDirection(this)},crossVector:function(e){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},translate:function(){console.error("THREE.Matrix4: .translate() has been removed.")},rotateX:function(){console.error("THREE.Matrix4: .rotateX() has been removed.")},rotateY:function(){console.error("THREE.Matrix4: .rotateY() has been removed.")},rotateZ:function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},rotateByAxis:function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},applyToBuffer:function(e,t,i){return console.warn("THREE.Matrix4: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute( attribute ) instead."),this.applyToBufferAttribute(e)},applyToVector3Array:function(e,t,i){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},makeFrustum:function(e,t,i,n,r,a){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(e,t,n,i,r,a)}}),ie.prototype.isIntersectionLine=function(e){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(e)},s.prototype.multiplyVector3=function(e){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),e.applyQuaternion(this)},Object.assign(ae.prototype,{isIntersectionBox:function(e){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},isIntersectionPlane:function(e){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(e)},isIntersectionSphere:function(e){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)}}),Object.assign(bn.prototype,{extrude:function(e){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new Yt(this,e)},makeGeometry:function(e){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new ii(this,e)}}),Object.assign(i.prototype,{fromAttribute:function(e,t,i){return console.error("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,i)}}),Object.assign(c.prototype,{setEulerFromRotationMatrix:function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},setEulerFromQuaternion:function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},getPositionFromMatrix:function(e){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(e)},getScaleFromMatrix:function(e){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(e)},getColumnFromMatrix:function(e,t){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(t,e)},applyProjection:function(e){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(e)},fromAttribute:function(e,t,i){return console.error("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,i)}}),Object.assign(r.prototype,{fromAttribute:function(e,t,i){return console.error("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,i)}}),Se.prototype.computeTangents=function(){console.warn("THREE.Geometry: .computeTangents() has been removed.")},Object.assign(ce.prototype,{getChildByName:function(e){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(e)},renderDepth:function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},translate:function(e,t){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(t,e)}}),Object.defineProperties(ce.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(e){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=e}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}}),Object.defineProperties(mt.prototype,{objects:{get:function(){return console.warn("THREE.LOD: .objects has been renamed to .levels."),this.levels}}}),Ne.prototype.setLens=function(e,t){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),void 0!==t&&(this.filmGauge=t),this.setFocalLength(e)},Object.defineProperties(Li.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(e){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=e}},shadowCameraLeft:{set:function(e){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=e}},shadowCameraRight:{set:function(e){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=e}},shadowCameraTop:{set:function(e){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=e}},shadowCameraBottom:{set:function(e){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=e}},shadowCameraNear:{set:function(e){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=e}},shadowCameraFar:{set:function(e){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=e}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(e){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=e}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(e){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=e}},shadowMapHeight:{set:function(e){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=e}}}),Object.defineProperties(de.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}}}),Object.assign(Ae.prototype,{addIndex:function(e){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(e)},addDrawCall:function(e,t,i){void 0!==i&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(e,t)},clearDrawCalls:function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},computeTangents:function(){console.warn("THREE.BufferGeometry: .computeTangents() has been removed.")},computeOffsets:function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")}}),Object.defineProperties(Ae.prototype,{drawcalls:{get:function(){return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups}},offsets:{get:function(){return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),this.groups}}}),Object.defineProperties(Fn.prototype,{dynamic:{set:function(){console.warn("THREE.Uniform: .dynamic has been removed. Use object.onBeforeRender() instead.")}},onUpdate:{value:function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this}}}),Object.defineProperties(J.prototype,{wrapAround:{get:function(){console.warn("THREE."+this.type+": .wrapAround has been removed.")},set:function(){console.warn("THREE."+this.type+": .wrapAround has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE."+this.type+": .wrapRGB has been removed."),new W}}}),Object.defineProperties(gi.prototype,{metal:{get:function(){return console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead."),!1},set:function(){console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead")}}}),Object.defineProperties(Q.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(e){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=e}}}),Object.assign(ct.prototype,{supportsFloatTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")},supportsHalfFloatTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")},supportsStandardDerivatives:function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")},supportsCompressedTextureS3TC:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")},supportsCompressedTexturePVRTC:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},supportsBlendMinMax:function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")},supportsVertexTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures},supportsInstancedArrays:function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")},enableScissorTest:function(e){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(e)},initMaterial:function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},addPrePlugin:function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},addPostPlugin:function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},updateShadowMap:function(){
14
+ console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")}}),Object.defineProperties(ct.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=e}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=e}},shadowMapCullFace:{get:function(){return this.shadowMap.cullFace},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapCullFace is now .shadowMap.cullFace."),this.shadowMap.cullFace=e}}}),Object.defineProperties(re.prototype,{cullFace:{get:function(){return this.renderReverseSided?Qr:Jr},set:function(e){var t=e!==Jr;console.warn("WebGLRenderer: .shadowMap.cullFace is deprecated. Set .shadowMap.renderReverseSided to "+t+"."),this.renderReverseSided=t}}}),Object.defineProperties(a.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(e){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=e}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(e){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=e}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(e){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=e}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(e){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=e}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(e){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=e}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(e){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=e}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(e){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=e}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(e){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=e}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(e){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=e}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(e){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=e}}}),Pn.prototype.load=function(e){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");var t=this,i=new Tn;return i.load(e,function(e){t.setBuffer(e)}),this},In.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()};var Xh={merge:function(e,t,i){console.warn("THREE.GeometryUtils: .merge() has been moved to Geometry. Use geometry.merge( geometry2, matrix, materialIndexOffset ) instead.");var n;t.isMesh&&(t.matrixAutoUpdate&&t.updateMatrix(),n=t.matrix,t=t.geometry),e.merge(t,n,i)},center:function(e){return console.warn("THREE.GeometryUtils: .center() has been moved to Geometry. Use geometry.center() instead."),e.center()}},qh={crossOrigin:void 0,loadTexture:function(e,t,i,n){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");var r=new Ai;r.setCrossOrigin(this.crossOrigin);var a=r.load(e,i,void 0,n);return t&&(a.mapping=t),a},loadTextureCube:function(e,t,i,n){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");var r=new Si;r.setCrossOrigin(this.crossOrigin);var a=r.load(e,i,void 0,n);return t&&(a.mapping=t),a},loadCompressedTexture:function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},loadCompressedTextureCube:function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")}};e.WebGLRenderTargetCube=o,e.WebGLRenderTarget=a,e.WebGLRenderer=ct,e.ShaderLib=wh,e.UniformsLib=bh,e.UniformsUtils=ys,e.ShaderChunk=xh,e.FogExp2=ht,e.Fog=lt,e.Scene=ut,e.LensFlare=pt,e.Sprite=ft,e.LOD=mt,e.SkinnedMesh=yt,e.Skeleton=gt,e.Bone=vt,e.Mesh=Le,e.LineSegments=bt,e.Line=_t,e.Points=Mt,e.Group=Et,e.VideoTexture=Tt,e.DataTexture=X,e.CompressedTexture=St,e.CubeTexture=l,e.CanvasTexture=At,e.DepthTexture=Lt,e.Texture=n,e.CompressedTextureLoader=Mi,e.DataTextureLoader=Ei,e.CubeTextureLoader=Si,e.TextureLoader=Ai,e.ObjectLoader=tn,e.MaterialLoader=Qi,e.BufferGeometryLoader=Ki,e.DefaultLoadingManager=Ch,e.LoadingManager=bi,e.JSONLoader=en,e.ImageLoader=Ti,e.FontLoader=En,e.FileLoader=wi,e.Loader=$i,e.Cache=Ph,e.AudioLoader=Tn,e.SpotLightShadow=Ci,e.SpotLight=Ii,e.PointLight=Ui,e.RectAreaLight=Sn,e.HemisphereLight=Ri,e.DirectionalLightShadow=Ni,e.DirectionalLight=Di,e.AmbientLight=Oi,e.LightShadow=Pi,e.Light=Li,e.StereoCamera=An,e.PerspectiveCamera=Ne,e.OrthographicCamera=De,e.CubeCamera=Ln,e.Camera=Ue,e.AudioListener=Rn,e.PositionalAudio=Cn,e.AudioContext=Oh,e.AudioAnalyser=In,e.Audio=Pn,e.VectorKeyframeTrack=Vi,e.StringKeyframeTrack=Xi,e.QuaternionKeyframeTrack=ji,e.NumberKeyframeTrack=Wi,e.ColorKeyframeTrack=Yi,e.BooleanKeyframeTrack=qi,e.PropertyMixer=Un,e.PropertyBinding=Nn,e.KeyframeTrack=Zi,e.AnimationUtils=Ih,e.AnimationObjectGroup=Dn,e.AnimationMixer=Bn,e.AnimationClip=Ji,e.Uniform=Fn,e.InstancedBufferGeometry=zn,e.BufferGeometry=Ae,e.GeometryIdCount=Te,e.Geometry=Se,e.InterleavedBufferAttribute=Gn,e.InstancedInterleavedBuffer=Vn,e.InterleavedBuffer=Hn,e.InstancedBufferAttribute=kn,e.Face3=ue,e.Object3D=ce,e.Raycaster=jn,e.Layers=se,e.EventDispatcher=t,e.Clock=qn,e.QuaternionLinearInterpolant=ki,e.LinearInterpolant=zi,e.DiscreteInterpolant=Gi,e.CubicInterpolant=Fi,e.Interpolant=Bi,e.Triangle=le,e.Math=us,e.Spherical=Yn,e.Cylindrical=Zn,e.Plane=ie,e.Frustum=ne,e.Sphere=ee,e.Ray=ae,e.Matrix4=h,e.Matrix3=te,e.Box3=$,e.Box2=q,e.Line3=he,e.Euler=oe,e.Vector4=r,e.Vector3=c,e.Vector2=i,e.Quaternion=s,e.Color=W,e.MorphBlendMesh=Jn,e.ImmediateRenderObject=Qn,e.VertexNormalsHelper=Kn,e.SpotLightHelper=$n,e.SkeletonHelper=er,e.PointLightHelper=tr,e.RectAreaLightHelper=ir,e.HemisphereLightHelper=nr,e.GridHelper=rr,e.PolarGridHelper=ar,e.FaceNormalsHelper=or,e.DirectionalLightHelper=sr,e.CameraHelper=cr,e.BoxHelper=hr,e.ArrowHelper=lr,e.AxisHelper=ur,e.CatmullRomCurve3=dr,e.CubicBezierCurve3=fr,e.QuadraticBezierCurve3=mr,e.LineCurve3=gr,e.ArcCurve=vr,e.EllipseCurve=gn,e.SplineCurve=vn,e.CubicBezierCurve=yn,e.QuadraticBezierCurve=xn,e.LineCurve=fn,e.Shape=bn,e.Path=_n,e.ShapePath=wn,e.Font=Mn,e.CurvePath=mn,e.Curve=dn,e.ShapeUtils=Ah,e.SceneUtils=kh,e.WireframeGeometry=Rt,e.ParametricGeometry=Pt,e.ParametricBufferGeometry=Ct,e.TetrahedronGeometry=Nt,e.TetrahedronBufferGeometry=Dt,e.OctahedronGeometry=Ot,e.OctahedronBufferGeometry=Bt,e.IcosahedronGeometry=Ft,e.IcosahedronBufferGeometry=zt,e.DodecahedronGeometry=Gt,e.DodecahedronBufferGeometry=Ht,e.PolyhedronGeometry=It,e.PolyhedronBufferGeometry=Ut,e.TubeGeometry=Vt,e.TubeBufferGeometry=kt,e.TorusKnotGeometry=jt,e.TorusKnotBufferGeometry=Wt,e.TorusGeometry=Xt,e.TorusBufferGeometry=qt,e.TextGeometry=Zt,e.SphereGeometry=Jt,e.SphereBufferGeometry=Qt,e.RingGeometry=Kt,e.RingBufferGeometry=$t,e.PlaneGeometry=Ce,e.PlaneBufferGeometry=Ie,e.LatheGeometry=ei,e.LatheBufferGeometry=ti,e.ShapeGeometry=ii,e.ShapeBufferGeometry=ni,e.ExtrudeGeometry=Yt,e.EdgesGeometry=ri,e.ConeGeometry=si,e.ConeBufferGeometry=ci,e.CylinderGeometry=ai,e.CylinderBufferGeometry=oi,e.CircleGeometry=hi,e.CircleBufferGeometry=li,e.BoxGeometry=Re,e.BoxBufferGeometry=Pe,e.ShadowMaterial=ui,e.SpriteMaterial=dt,e.RawShaderMaterial=pi,e.ShaderMaterial=Q,e.PointsMaterial=wt,e.MultiMaterial=di,e.MeshPhysicalMaterial=mi,e.MeshStandardMaterial=fi,e.MeshPhongMaterial=gi,e.MeshToonMaterial=vi,e.MeshNormalMaterial=yi,e.MeshLambertMaterial=xi,e.MeshDepthMaterial=K,e.MeshBasicMaterial=pe,e.LineDashedMaterial=_i,e.LineBasicMaterial=xt,e.Material=J,e.Float64BufferAttribute=we,e.Float32BufferAttribute=be,e.Uint32BufferAttribute=_e,e.Int32BufferAttribute=xe,e.Uint16BufferAttribute=ye,e.Int16BufferAttribute=ve,e.Uint8ClampedBufferAttribute=ge,e.Uint8BufferAttribute=me,e.Int8BufferAttribute=fe,e.BufferAttribute=de,e.REVISION=qr,e.MOUSE=Yr,e.CullFaceNone=Zr,e.CullFaceBack=Jr,e.CullFaceFront=Qr,e.CullFaceFrontBack=Kr,e.FrontFaceDirectionCW=$r,e.FrontFaceDirectionCCW=ea,e.BasicShadowMap=ta,e.PCFShadowMap=ia,e.PCFSoftShadowMap=na,e.FrontSide=ra,e.BackSide=aa,e.DoubleSide=oa,e.FlatShading=sa,e.SmoothShading=ca,e.NoColors=ha,e.FaceColors=la,e.VertexColors=ua,e.NoBlending=pa,e.NormalBlending=da,e.AdditiveBlending=fa,e.SubtractiveBlending=ma,e.MultiplyBlending=ga,e.CustomBlending=va,e.AddEquation=ya,e.SubtractEquation=xa,e.ReverseSubtractEquation=_a,e.MinEquation=ba,e.MaxEquation=wa,e.ZeroFactor=Ma,e.OneFactor=Ea,e.SrcColorFactor=Ta,e.OneMinusSrcColorFactor=Sa,e.SrcAlphaFactor=Aa,e.OneMinusSrcAlphaFactor=La,e.DstAlphaFactor=Ra,e.OneMinusDstAlphaFactor=Pa,e.DstColorFactor=Ca,e.OneMinusDstColorFactor=Ia,e.SrcAlphaSaturateFactor=Ua,e.NeverDepth=Na,e.AlwaysDepth=Da,e.LessDepth=Oa,e.LessEqualDepth=Ba,e.EqualDepth=Fa,e.GreaterEqualDepth=za,e.GreaterDepth=Ga,e.NotEqualDepth=Ha,e.MultiplyOperation=Va,e.MixOperation=ka,e.AddOperation=ja,e.NoToneMapping=Wa,e.LinearToneMapping=Xa,e.ReinhardToneMapping=qa,e.Uncharted2ToneMapping=Ya,e.CineonToneMapping=Za,e.UVMapping=Ja,e.CubeReflectionMapping=Qa,e.CubeRefractionMapping=Ka,e.EquirectangularReflectionMapping=$a,e.EquirectangularRefractionMapping=eo,e.SphericalReflectionMapping=to,e.CubeUVReflectionMapping=io,e.CubeUVRefractionMapping=no,e.RepeatWrapping=ro,e.ClampToEdgeWrapping=ao,e.MirroredRepeatWrapping=oo,e.NearestFilter=so,e.NearestMipMapNearestFilter=co,e.NearestMipMapLinearFilter=ho,e.LinearFilter=lo,e.LinearMipMapNearestFilter=uo,e.LinearMipMapLinearFilter=po,e.UnsignedByteType=fo,e.ByteType=mo,e.ShortType=go,e.UnsignedShortType=vo,e.IntType=yo,e.UnsignedIntType=xo,e.FloatType=_o,e.HalfFloatType=bo,e.UnsignedShort4444Type=wo,e.UnsignedShort5551Type=Mo,e.UnsignedShort565Type=Eo,e.UnsignedInt248Type=To,e.AlphaFormat=So,e.RGBFormat=Ao,e.RGBAFormat=Lo,e.LuminanceFormat=Ro,e.LuminanceAlphaFormat=Po,e.RGBEFormat=Co,e.DepthFormat=Io,e.DepthStencilFormat=Uo,e.RGB_S3TC_DXT1_Format=No,e.RGBA_S3TC_DXT1_Format=Do,e.RGBA_S3TC_DXT3_Format=Oo,e.RGBA_S3TC_DXT5_Format=Bo,e.RGB_PVRTC_4BPPV1_Format=Fo,e.RGB_PVRTC_2BPPV1_Format=zo,e.RGBA_PVRTC_4BPPV1_Format=Go,e.RGBA_PVRTC_2BPPV1_Format=Ho,e.RGB_ETC1_Format=Vo,e.LoopOnce=ko,e.LoopRepeat=jo,e.LoopPingPong=Wo,e.InterpolateDiscrete=Xo,e.InterpolateLinear=qo,e.InterpolateSmooth=Yo,e.ZeroCurvatureEnding=Zo,e.ZeroSlopeEnding=Jo,e.WrapAroundEnding=Qo,e.TrianglesDrawMode=Ko,e.TriangleStripDrawMode=$o,e.TriangleFanDrawMode=es,e.LinearEncoding=ts,e.sRGBEncoding=is,e.GammaEncoding=ns,e.RGBEEncoding=rs,e.LogLuvEncoding=as,e.RGBM7Encoding=os,e.RGBM16Encoding=ss,e.RGBDEncoding=cs,e.BasicDepthPacking=hs,e.RGBADepthPacking=ls,e.CubeGeometry=Re,e.Face4=yr,e.LineStrip=jh,e.LinePieces=Wh,e.MeshFaceMaterial=xr,e.PointCloud=_r,e.Particle=br,e.ParticleSystem=wr,e.PointCloudMaterial=Mr,e.ParticleBasicMaterial=Er,e.ParticleSystemMaterial=Tr,e.Vertex=Sr,e.DynamicBufferAttribute=Ar,e.Int8Attribute=Lr,e.Uint8Attribute=Rr,e.Uint8ClampedAttribute=Pr,e.Int16Attribute=Cr,e.Uint16Attribute=Ir,e.Int32Attribute=Ur,e.Uint32Attribute=Nr,e.Float32Attribute=Dr,e.Float64Attribute=Or,e.ClosedSplineCurve3=Br,e.SplineCurve3=Fr,e.Spline=zr,e.BoundingBoxHelper=Gr,e.EdgesHelper=Hr,e.WireframeHelper=Vr,e.XHRLoader=kr,e.BinaryTextureLoader=jr,e.GeometryUtils=Xh,e.ImageUtils=qh,e.Projector=Wr,e.CanvasRenderer=Xr,Object.defineProperty(e,"__esModule",{value:!0})});
@@ -0,0 +1,172 @@
1
+ //color variables
2
+ var dark = 0x262525;
3
+ var darkGrey = 0x5c5c5c;
4
+ var mdGrey = 0xc8c8c8;
5
+ var light = 0xf4f4f4;
6
+ var pop = 0x2A7F62;
7
+
8
+ //THREE variables
9
+ var camera,
10
+ mySphereCanvas = document.getElementById('three-sphere'),
11
+ myTorusCanvas = document.getElementById('three-torus');
12
+ myCubeCanvas = document.getElementById('three-cube');
13
+
14
+ // Camera
15
+ camera = new THREE.PerspectiveCamera( 35, window.innerWidth / window.innerHeight, 0.1, 1000 );
16
+
17
+ // Materials
18
+ var materialWireframe = new THREE.MeshLambertMaterial({
19
+ color: mdGrey, //material color
20
+ wireframe: true,
21
+ transparent: true,
22
+ opacity: 0.4
23
+ });
24
+ var materialShiny = new THREE.MeshPhongMaterial({
25
+ // depthTest: false,
26
+ color: dark, //material color
27
+ shading: THREE.FlatShading,
28
+ shininess: 100,
29
+ specular: pop,
30
+ // wireframe: true,
31
+ // emissive: dark
32
+ });
33
+ var reflection = THREE.CubeTextureLoader( ['./img/palms-dark.png', './img/palms-dark.png','./img/palms-dark.png','./img/palms-dark.png','./img/palms-dark.png','./img/palms-dark.png', ] );
34
+
35
+
36
+ //If mySphereCanvas exists render the sphere
37
+ if (mySphereCanvas) {
38
+ var sphereRenderer,
39
+ sceneSphere;
40
+
41
+ window.addEventListener("resize", function() {
42
+ sphereRenderer.setSize( window.innerWidth, window.innerHeight );
43
+ camera = new THREE.PerspectiveCamera( 35, window.innerWidth / window.innerHeight, 0.1, 1000 );
44
+ });
45
+
46
+ // sphereRenderer
47
+ sphereRenderer = new THREE.WebGLRenderer({antialias: true});
48
+ sphereRenderer.setSize( window.innerWidth, window.innerHeight);
49
+ mySphereCanvas.appendChild( sphereRenderer.domElement );
50
+ sphereRenderer.setClearColor(dark); //Background color of sphere canvas
51
+ sphereRenderer.setPixelRatio(window.devicePixelRatio);
52
+
53
+ //Scene
54
+ sceneSphere = new THREE.Scene();
55
+
56
+ // Lights
57
+ var lightSphere = new THREE.AmbientLight(0xffffff, 0.5);
58
+ sceneSphere.add(lightSphere);
59
+ var light2Sphere = new THREE.PointLight(0xffffff, 0.5);
60
+ sceneSphere.add(light2Sphere);
61
+
62
+ //Geometry
63
+ var sphere = new THREE.SphereGeometry( 80, 10, 10 );
64
+
65
+ // Creating and adding shapes
66
+ var sphere = new THREE.Mesh( sphere, materialWireframe ); //change sphere material here
67
+ sphere.position.z = -500;
68
+ sceneSphere.add( sphere );
69
+
70
+
71
+ function sphereRender() {
72
+ requestAnimationFrame( sphereRender );
73
+ sphere.rotation.x += 0.007;
74
+ sphere.rotation.y += 0.01;
75
+ sphereRenderer.render( sceneSphere, camera );
76
+ }
77
+ sphereRender();
78
+
79
+ }
80
+
81
+ //If myCubeCanvas exists render the sphere
82
+ if (myCubeCanvas) {
83
+ var cubeRenderer,
84
+ sceneCube;
85
+
86
+ window.addEventListener("resize", function() {
87
+ cubeRenderer.setSize( window.innerWidth, window.innerHeight );
88
+ camera = new THREE.PerspectiveCamera( 35, window.innerWidth / window.innerHeight, 0.1, 1000 );
89
+ });
90
+
91
+ // cubeRenderer
92
+ cubeRenderer = new THREE.WebGLRenderer({antialias: true});
93
+ cubeRenderer.setSize( window.innerWidth, window.innerHeight);
94
+ myCubeCanvas.appendChild( cubeRenderer.domElement );
95
+ cubeRenderer.setClearColor(dark); //Background color of cube canvas
96
+ cubeRenderer.setPixelRatio(window.devicePixelRatio);
97
+
98
+ //Scene
99
+ sceneCube = new THREE.Scene();
100
+
101
+ // Lights
102
+ var lightCube = new THREE.AmbientLight(0xffffff, 0.5);
103
+ sceneCube.add(lightCube);
104
+ var light2Cube = new THREE.PointLight(0xffffff, 0.5);
105
+ sceneCube.add(light2Cube);
106
+
107
+ //Geometry
108
+ var cube = new THREE.CubeGeometry( 20, 20, 20, 20, 2, 2 );
109
+
110
+ // Creating and adding shapes
111
+ var cube = new THREE.Mesh( cube, materialWireframe ); //change cube material here
112
+ cube.position.z = -100;
113
+ sceneCube.add( cube );
114
+
115
+
116
+ function cubeRender() {
117
+ requestAnimationFrame( cubeRender );
118
+ cube.rotation.x += 0.007;
119
+ cube.rotation.y += 0.01;
120
+ cubeRenderer.render( sceneCube, camera );
121
+ }
122
+ cubeRender();
123
+
124
+ }
125
+
126
+ //If myTorusCanvas exists render the Torus Knot
127
+ if (myTorusCanvas) {
128
+ var torusRenderer,
129
+ sceneTorus;
130
+
131
+ window.addEventListener("resize", function() {
132
+ torusRenderer.setSize( window.innerWidth, window.innerHeight );
133
+ camera = new THREE.PerspectiveCamera( 35, window.innerWidth / window.innerHeight, 0.1, 1000 );
134
+ });
135
+
136
+
137
+ // window.onresize = function() {
138
+ // }
139
+
140
+ // torusRenderer
141
+ torusRenderer = new THREE.WebGLRenderer({antialias: true});
142
+ torusRenderer.setSize( window.innerWidth, window.innerHeight);
143
+ myTorusCanvas.appendChild( torusRenderer.domElement );
144
+ torusRenderer.setClearColor(dark); //Background color of canvas
145
+ torusRenderer.setPixelRatio(window.devicePixelRatio);
146
+
147
+ // Scene
148
+ sceneTorus = new THREE.Scene();
149
+
150
+ // Lights
151
+ var lightTorus = new THREE.AmbientLight(0xffffff, 0.5);
152
+ sceneTorus.add(lightTorus);
153
+ var light2Torus = new THREE.PointLight(0xffffff, 0.5);
154
+ sceneTorus.add(light2Torus);
155
+
156
+ // Geometry
157
+ var torusKnotGeometry = new THREE.TorusKnotGeometry( 70, 18, 10, 10 );
158
+
159
+ // Creating and adding shapes
160
+ var torusKnot = new THREE.Mesh( torusKnotGeometry, materialShiny ); //change torus material here
161
+ torusKnot.position.z = -500;
162
+ sceneTorus.add( torusKnot );
163
+
164
+ function torusRender() {
165
+ requestAnimationFrame( torusRender );
166
+ torusKnot.rotation.x -= 0.007;
167
+ torusKnot.rotation.y -= 0.01;
168
+ // torusKnot.rotation.z -= 0.007;
169
+ torusRenderer.render( sceneTorus, camera );
170
+ }
171
+ torusRender();
172
+ }