var l=x(b,c,m,h);oa="";h.render(function(a){W.renderBufferImmediate(a,l,m)})}else W.renderBufferDirect(b,c,k,m,h,f)}}function u(a){a.side!==THREE.DoubleSide?J.enable(t.CULL_FACE):J.disable(t.CULL_FACE);J.setFlipSided(a.side===THREE.BackSide);!0===a.transparent?J.setBlending(a.blending,a.blendEquation,a.blendSrc,a.blendDst,a.blendEquationAlpha,a.blendSrcAlpha,a.blendDstAlpha,a.premultipliedAlpha):J.setBlending(THREE.NoBlending);J.setDepthFunc(a.depthFunc);J.setDepthTest(a.depthTest);J.setDepthWrite(a.depthWrite);
(a.envMapIntensity.value=b.envMapIntensity)}function C(a,b,c){c?(t.texParameteri(a,t.TEXTURE_WRAP_S,G(b.wrapS)),t.texParameteri(a,t.TEXTURE_WRAP_T,G(b.wrapT)),t.texParameteri(a,t.TEXTURE_MAG_FILTER,G(b.magFilter)),t.texParameteri(a,t.TEXTURE_MIN_FILTER,G(b.minFilter))):(t.texParameteri(a,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(a,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),b.wrapS===THREE.ClampToEdgeWrapping&&b.wrapT===THREE.ClampToEdgeWrapping||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping.",
b),t.texParameteri(a,t.TEXTURE_MAG_FILTER,B(b.magFilter)),t.texParameteri(a,t.TEXTURE_MIN_FILTER,B(b.minFilter)),b.minFilter!==THREE.NearestFilter&&b.minFilter!==THREE.LinearFilter&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.",b));!(c=V.get("EXT_texture_filter_anisotropic"))||b.type===THREE.FloatType&&null===V.get("OES_texture_float_linear")||b.type===THREE.HalfFloatType&&null===V.get("OES_texture_half_float_linear")||
!(1<b.anisotropy||T.get(b).__currentAnisotropy)||(t.texParameterf(a,c.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(b.anisotropy,W.getMaxAnisotropy())),T.get(b).__currentAnisotropy=b.anisotropy)}function w(a,b){if(a.width>b||a.height>b){var c=b/Math.max(a.width,a.height),d=document.createElement("canvas");d.width=Math.floor(a.width*c);d.height=Math.floor(a.height*c);d.getContext("2d").drawImage(a,0,0,a.width,a.height,0,0,d.width,d.height);console.warn("THREE.WebGLRenderer: image is too big ("+a.width+"x"+a.height+
t.texParameteri(a,t.TEXTURE_WRAP_T,G(b.wrapT)),t.texParameteri(a,t.TEXTURE_MAG_FILTER,G(b.magFilter)),t.texParameteri(a,t.TEXTURE_MIN_FILTER,G(b.minFilter))):(t.texParameteri(a,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(a,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),b.wrapS===THREE.ClampToEdgeWrapping&&b.wrapT===THREE.ClampToEdgeWrapping||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping.",b),t.texParameteri(a,t.TEXTURE_MAG_FILTER,
B(b.magFilter)),t.texParameteri(a,t.TEXTURE_MIN_FILTER,B(b.minFilter)),b.minFilter!==THREE.NearestFilter&&b.minFilter!==THREE.LinearFilter&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.",b));!(c=U.get("EXT_texture_filter_anisotropic"))||b.type===THREE.FloatType&&null===U.get("OES_texture_float_linear")||b.type===THREE.HalfFloatType&&null===U.get("OES_texture_half_float_linear")||!(1<b.anisotropy||T.get(b).__currentAnisotropy)||
(t.texParameterf(a,c.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(b.anisotropy,W.getMaxAnisotropy())),T.get(b).__currentAnisotropy=b.anisotropy)}function w(a,b){if(a.width>b||a.height>b){var c=b/Math.max(a.width,a.height),d=document.createElement("canvas");d.width=Math.floor(a.width*c);d.height=Math.floor(a.height*c);d.getContext("2d").drawImage(a,0,0,a.width,a.height,0,0,d.width,d.height);console.warn("THREE.WebGLRenderer: image is too big ("+a.width+"x"+a.height+"). Resized to "+d.width+"x"+d.height,a);
THREE.InstancedBufferGeometry&&(n=V.get("ANGLE_instanced_arrays"),null===n)){console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");break a}void 0===h&&(h=0);J.initAttributes();var m=c.attributes,g=g.getAttributes(),p=d.defaultAttributeValues,q;for(q in g){var r=g[q];if(0<=r){var s=m[q];if(void 0!==s){var v=t.FLOAT,w=s.array,E=s.normalized;w instanceof Float32Array?v=t.FLOAT:w instanceof Float64Array?
THREE.InstancedBufferGeometry&&(n=U.get("ANGLE_instanced_arrays"),null===n)){console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");break a}void 0===h&&(h=0);J.initAttributes();var m=c.attributes,g=g.getAttributes(),p=d.defaultAttributeValues,q;for(q in g){var r=g[q];if(0<=r){var s=m[q];if(void 0!==s){var v=t.FLOAT,w=s.array,E=s.normalized;w instanceof Float32Array?v=t.FLOAT:w instanceof Float64Array?
a.setMode(t.POINTS);c instanceof THREE.InstancedBufferGeometry?0<c.maxInstancedCount&&a.renderInstances(c,f,n):a.render(f,n)};this.render=function(a,b,c,d){if(!1===b instanceof THREE.Camera)console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");else{var e=a.fog;oa="";Z=-1;ea=null;!0===a.autoUpdate&&a.updateMatrixWorld();null===b.parent&&b.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);sa.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);
D(c)&&a.minFilter!==THREE.NearestFilter&&a.minFilter!==THREE.LinearFilter&&(a=c instanceof THREE.WebGLRenderTargetCube?t.TEXTURE_CUBE_MAP:t.TEXTURE_2D,c=T.get(c.texture).__webglTexture,J.bindTexture(a,c),t.generateMipmap(a),J.bindTexture(a,null)));J.setDepthTest(!0);J.setDepthWrite(!0);J.setColorWrite(!0)}};this.setFaceCulling=function(a,b){J.setCullFace(a);J.setFlipSided(b===THREE.FrontFaceDirectionCW)};this.allocTextureUnit=function(){var a=ta;a>=ca.maxTextures&&console.warn("WebGLRenderer: trying to use "+
a+" texture units while this GPU supports only "+ca.maxTextures);ta+=1;return a};this.setTexture2D=function(){var a=!1;return function(b,c){b instanceof THREE.WebGLRenderTarget&&(a||(console.warn("THREE.WebGLRenderer.setTexture2D: don't use render targets as textures. Use their .texture property instead."),a=!0),b=b.texture);var d=b,e=T.get(d);if(0<d.version&&e.__version!==d.version){var g=d.image;if(void 0===g)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined",d);
else if(!1===g.complete)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete",d);else{void 0===e.__webglInit&&(e.__webglInit=!0,d.addEventListener("dispose",f),e.__webglTexture=t.createTexture(),ja.textures++);J.activeTexture(t.TEXTURE0+c);J.bindTexture(t.TEXTURE_2D,e.__webglTexture);t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,d.flipY);t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,d.premultiplyAlpha);t.pixelStorei(t.UNPACK_ALIGNMENT,d.unpackAlignment);var h=w(d.image,ca.maxTextureSize);
a.setMode(t.POINTS);c instanceof THREE.InstancedBufferGeometry?0<c.maxInstancedCount&&a.renderInstances(c,f,n):a.render(f,n)};this.render=function(a,b,c,d){if(!1===b instanceof THREE.Camera)console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");else{var e=a.fog;oa="";pa=-1;ea=null;!0===a.autoUpdate&&a.updateMatrixWorld();null===b.parent&&b.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);ta.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);
D(c)&&a.minFilter!==THREE.NearestFilter&&a.minFilter!==THREE.LinearFilter&&(a=c instanceof THREE.WebGLRenderTargetCube?t.TEXTURE_CUBE_MAP:t.TEXTURE_2D,c=T.get(c.texture).__webglTexture,J.bindTexture(a,c),t.generateMipmap(a),J.bindTexture(a,null)));J.setDepthTest(!0);J.setDepthWrite(!0);J.setColorWrite(!0)}};this.setFaceCulling=function(a,b){J.setCullFace(a);J.setFlipSided(b===THREE.FrontFaceDirectionCW)};this.allocTextureUnit=function(){var a=ua;a>=ca.maxTextures&&console.warn("WebGLRenderer: trying to use "+
a+" texture units while this GPU supports only "+ca.maxTextures);ua+=1;return a};this.setTexture2D=function(){var a=!1;return function(b,c){b instanceof THREE.WebGLRenderTarget&&(a||(console.warn("THREE.WebGLRenderer.setTexture2D: don't use render targets as textures. Use their .texture property instead."),a=!0),b=b.texture);var d=b,e=T.get(d);if(0<d.version&&e.__version!==d.version){var g=d.image;if(void 0===g)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined",d);
else if(!1===g.complete)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete",d);else{void 0===e.__webglInit&&(e.__webglInit=!0,d.addEventListener("dispose",f),e.__webglTexture=t.createTexture(),ia.textures++);J.activeTexture(t.TEXTURE0+c);J.bindTexture(t.TEXTURE_2D,e.__webglTexture);t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,d.flipY);t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,d.premultiplyAlpha);t.pixelStorei(t.UNPACK_ALIGNMENT,d.unpackAlignment);var h=w(d.image,ca.maxTextureSize);
if((d.wrapS!==THREE.ClampToEdgeWrapping||d.wrapT!==THREE.ClampToEdgeWrapping||d.minFilter!==THREE.NearestFilter&&d.minFilter!==THREE.LinearFilter)&&!1===D(h))if(g=h,g instanceof HTMLImageElement||g instanceof HTMLCanvasElement){var k=document.createElement("canvas");k.width=THREE.Math.nearestPowerOfTwo(g.width);k.height=THREE.Math.nearestPowerOfTwo(g.height);k.getContext("2d").drawImage(g,0,0,k.width,k.height);console.warn("THREE.WebGLRenderer: image is not power of two ("+g.width+"x"+g.height+"). Resized to "+
k.width+"x"+k.height,g);h=k}else h=g;var g=D(h),k=G(d.format),m=G(d.type);C(t.TEXTURE_2D,d,g);var l=d.mipmaps;if(d instanceof THREE.DepthTexture){l=t.DEPTH_COMPONENT;if(d.type===THREE.FloatType){if(!Da)throw Error("Float Depth Texture only supported in WebGL2.0");l=t.DEPTH_COMPONENT32F}else Da&&(l=t.DEPTH_COMPONENT16);J.texImage2D(t.TEXTURE_2D,0,l,h.width,h.height,0,k,m,null)}else if(d instanceof THREE.DataTexture)if(0<l.length&&g){for(var n=0,p=l.length;n<p;n++)h=l[n],J.texImage2D(t.TEXTURE_2D,n,
k.width+"x"+k.height,g);h=k}else h=g;var g=D(h),k=G(d.format),m=G(d.type);C(t.TEXTURE_2D,d,g);var l=d.mipmaps;if(d instanceof THREE.DepthTexture){l=t.DEPTH_COMPONENT;if(d.type===THREE.FloatType){if(!Ea)throw Error("Float Depth Texture only supported in WebGL2.0");l=t.DEPTH_COMPONENT32F}else Ea&&(l=t.DEPTH_COMPONENT16);J.texImage2D(t.TEXTURE_2D,0,l,h.width,h.height,0,k,m,null)}else if(d instanceof THREE.DataTexture)if(0<l.length&&g){for(var n=0,p=l.length;n<p;n++)h=l[n],J.texImage2D(t.TEXTURE_2D,n,
k,h.width,h.height,0,k,m,h.data);d.generateMipmaps=!1}else J.texImage2D(t.TEXTURE_2D,0,k,h.width,h.height,0,k,m,h.data);else if(d instanceof THREE.CompressedTexture)for(n=0,p=l.length;n<p;n++)h=l[n],d.format!==THREE.RGBAFormat&&d.format!==THREE.RGBFormat?-1<J.getCompressedTextureFormats().indexOf(k)?J.compressedTexImage2D(t.TEXTURE_2D,n,k,h.width,h.height,0,h.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):J.texImage2D(t.TEXTURE_2D,
n,k,h.width,h.height,0,k,m,h.data);else if(0<l.length&&g){n=0;for(p=l.length;n<p;n++)h=l[n],J.texImage2D(t.TEXTURE_2D,n,k,k,m,h);d.generateMipmaps=!1}else J.texImage2D(t.TEXTURE_2D,0,k,k,m,h);d.generateMipmaps&&g&&t.generateMipmap(t.TEXTURE_2D);e.__version=d.version;if(d.onUpdate)d.onUpdate(d)}}else J.activeTexture(t.TEXTURE0+c),J.bindTexture(t.TEXTURE_2D,e.__webglTexture)}}();this.setTexture=function(){var a=!1;return function(b,c){a||(console.warn("THREE.WebGLRenderer: .setTexture is deprecated, use setTexture2D instead."),
a=!0);W.setTexture2D(b,c)}}();this.setTextureCube=function(){var a=!1;return function(b,c){b instanceof THREE.WebGLRenderTargetCube&&(a||(console.warn("THREE.WebGLRenderer.setTextureCube: don't use cube render targets as textures. Use their .texture property instead."),a=!0),b=b.texture);if(b instanceof THREE.CubeTexture||Array.isArray(b.image)&&6===b.image.length){var d=b,e=T.get(d);if(6===d.image.length)if(0<d.version&&e.__version!==d.version){e.__image__webglTextureCube||(d.addEventListener("dispose",
s=0,x=r.length;s<x;s++)q=r[s],d.format!==THREE.RGBAFormat&&d.format!==THREE.RGBFormat?-1<J.getCompressedTextureFormats().indexOf(n)?J.compressedTexImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+m,s,n,q.width,q.height,0,q.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):J.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+m,s,n,q.width,q.height,0,n,p,q.data);else h?J.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+m,0,n,k[m].width,k[m].height,0,n,p,k[m].data):
a,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+f);a.texture.generateMipmaps&&e&&t.generateMipmap(t.TEXTURE_CUBE_MAP);J.bindTexture(t.TEXTURE_CUBE_MAP,null)}else J.bindTexture(t.TEXTURE_2D,c.__webglTexture),C(t.TEXTURE_2D,a.texture,e),A(b.__webglFramebuffer,a,t.COLOR_ATTACHMENT0,t.TEXTURE_2D),a.texture.generateMipmaps&&e&&t.generateMipmap(t.TEXTURE_2D),J.bindTexture(t.TEXTURE_2D,null);if(a.depthBuffer){b=T.get(a);c=a instanceof THREE.WebGLRenderTargetCube;if(a.depthTexture){if(c)throw Error("target.depthTexture not supported in Cube render targets");
if(a instanceof THREE.WebGLRenderTargetCube)throw Error("Depth Texture with cube render targets is not supported!");t.bindFramebuffer(t.FRAMEBUFFER,b.__webglFramebuffer);if(!(a.depthTexture instanceof THREE.DepthTexture))throw Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");T.get(a.depthTexture).__webglTexture&&a.depthTexture.image.width===a.width&&a.depthTexture.image.height===a.height||(a.depthTexture.image.width=a.width,a.depthTexture.image.height=a.height,a.depthTexture.needsUpdate=
a instanceof THREE.WebGLRenderTargetCube;a?(c=T.get(a),c=b?c.__webglFramebuffer[a.activeCubeFace]:c.__webglFramebuffer,ra.copy(a.scissor),Aa=a.scissorTest,ma.copy(a.viewport)):(c=null,ra.copy(ya).multiplyScalar($),Aa=Ca,ma.copy(na).multiplyScalar($));ga!==c&&(t.bindFramebuffer(t.FRAMEBUFFER,c),ga=c);J.scissor(ra);J.setScissorTest(Aa);J.viewport(ma);b&&(b=T.get(a.texture),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+a.activeCubeFace,b.__webglTexture,a.activeMipMapLevel))};
this.readRenderTargetPixels=function(a,b,c,d,e,f){if(!1===a instanceof THREE.WebGLRenderTarget)console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");else{var g=T.get(a).__webglFramebuffer;if(g){var h=!1;g!==ga&&(t.bindFramebuffer(t.FRAMEBUFFER,g),h=!0);try{var k=a.texture;k.format!==THREE.RGBAFormat&&G(k.format)!==t.getParameter(t.IMPLEMENTATION_COLOR_READ_FORMAT)?console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format."):
k.type===THREE.UnsignedByteType||G(k.type)===t.getParameter(t.IMPLEMENTATION_COLOR_READ_TYPE)||k.type===THREE.FloatType&&V.get("WEBGL_color_buffer_float")||k.type===THREE.HalfFloatType&&V.get("EXT_color_buffer_half_float")?t.checkFramebufferStatus(t.FRAMEBUFFER)===t.FRAMEBUFFER_COMPLETE?0<=b&&b<=a.width-d&&0<=c&&c<=a.height-e&&t.readPixels(b,c,d,e,G(k.format),G(k.type),f):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete."):console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.")}finally{h&&
t.bindFramebuffer(t.FRAMEBUFFER,ga)}}}}};
a instanceof THREE.WebGLRenderTargetCube;a?(c=T.get(a),c=b?c.__webglFramebuffer[a.activeCubeFace]:c.__webglFramebuffer,sa.copy(a.scissor),Ba=a.scissorTest,la.copy(a.viewport)):(c=null,sa.copy(za).multiplyScalar(Z),Ba=Da,la.copy(ma).multiplyScalar(Z));aa!==c&&(t.bindFramebuffer(t.FRAMEBUFFER,c),aa=c);J.scissor(sa);J.setScissorTest(Ba);J.viewport(la);b&&(b=T.get(a.texture),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+a.activeCubeFace,b.__webglTexture,a.activeMipMapLevel))};
this.readRenderTargetPixels=function(a,b,c,d,e,f){if(!1===a instanceof THREE.WebGLRenderTarget)console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");else{var g=T.get(a).__webglFramebuffer;if(g){var h=!1;g!==aa&&(t.bindFramebuffer(t.FRAMEBUFFER,g),h=!0);try{var k=a.texture;k.format!==THREE.RGBAFormat&&G(k.format)!==t.getParameter(t.IMPLEMENTATION_COLOR_READ_FORMAT)?console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format."):
k.type===THREE.UnsignedByteType||G(k.type)===t.getParameter(t.IMPLEMENTATION_COLOR_READ_TYPE)||k.type===THREE.FloatType&&U.get("WEBGL_color_buffer_float")||k.type===THREE.HalfFloatType&&U.get("EXT_color_buffer_half_float")?t.checkFramebufferStatus(t.FRAMEBUFFER)===t.FRAMEBUFFER_COMPLETE?0<=b&&b<=a.width-d&&0<=c&&c<=a.height-e&&t.readPixels(b,c,d,e,G(k.format),G(k.type),f):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete."):console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.")}finally{h&&
k),d.initCatmullRom(l.y,n.y,p.y,g.y,k),e.initCatmullRom(l.z,n.z,p.z,g.z,k));return new THREE.Vector3(c.calc(a),d.calc(a),e.calc(a))})}();THREE.ClosedSplineCurve3=function(a){console.warn("THREE.ClosedSplineCurve3 has been deprecated. Please use THREE.CatmullRomCurve3.");THREE.CatmullRomCurve3.call(this,a);this.type="catmullrom";this.closed=!0};THREE.ClosedSplineCurve3.prototype=Object.create(THREE.CatmullRomCurve3.prototype);