diff --git a/README.md b/README.md index 68001e39..f2d2ac63 100644 --- a/README.md +++ b/README.md @@ -3,13 +3,13 @@ ## A Three.js wrapper for GWT # Maven -Current Version 0.104, implements 0.104 version of three.js +Current Version 0.105, implements 0.105 version of three.js ```xml org.treblereel.gwt three4g - 0.104 + 0.105 ``` # Setup diff --git a/annotations/pom.xml b/annotations/pom.xml index de94fc4c..881a47f0 100644 --- a/annotations/pom.xml +++ b/annotations/pom.xml @@ -5,7 +5,7 @@ org.treblereel.gwt three4g-parent - 0.105-SNAPSHOT + 0.106-SNAPSHOT .. diff --git a/core/pom.xml b/core/pom.xml index 7190a50e..35636a4e 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -5,7 +5,7 @@ org.treblereel.gwt three4g-parent - 0.105-SNAPSHOT + 0.106-SNAPSHOT .. diff --git a/core/src/main/java/org/treblereel/gwt/three4g/cameras/PerspectiveCamera.java b/core/src/main/java/org/treblereel/gwt/three4g/cameras/PerspectiveCamera.java index e913bc55..ae4419e8 100644 --- a/core/src/main/java/org/treblereel/gwt/three4g/cameras/PerspectiveCamera.java +++ b/core/src/main/java/org/treblereel/gwt/three4g/cameras/PerspectiveCamera.java @@ -12,7 +12,6 @@ * See the base @see {@link Camera} class for common properties. * Note that after making changes to most of these poperties you will have to call .updateProjectionMatrix for the changes * to take effect. - * * @author Dmitrii Tikhomirov * Created by treblereel on 12/6/17. */ @@ -25,9 +24,9 @@ public class PerspectiveCamera extends Camera { public float aspect; /** - * bounds + * viewport */ - public Vector4 bounds; + public Vector4 viewport; /** * Camera frustum far plane. Default is 2000. @@ -88,34 +87,34 @@ public PerspectiveCamera() { /** * @param fov — Camera frustum vertical field of view. - * Together these define the camera's viewing frustum. + * Together these define the camera's viewing frustum. */ public PerspectiveCamera(float fov) { } /** - * @param fov — Camera frustum vertical field of view. + * @param fov — Camera frustum vertical field of view. * @param aspect — Camera frustum aspect ratio. - * Together these define the camera's viewing frustum. + * Together these define the camera's viewing frustum. */ public PerspectiveCamera(float fov, float aspect) { } /** - * @param fov — Camera frustum vertical field of view. + * @param fov — Camera frustum vertical field of view. * @param aspect — Camera frustum aspect ratio. - * @param near — Camera frustum near plane. - * Together these define the camera's viewing frustum. + * @param near — Camera frustum near plane. + * Together these define the camera's viewing frustum. */ public PerspectiveCamera(float fov, float aspect, float near) { } /** - * @param fov — Camera frustum vertical field of view. + * @param fov — Camera frustum vertical field of view. * @param aspect — Camera frustum aspect ratio. - * @param near — Camera frustum near plane. - * @param far — Camera frustum far plane. - * Together these define the camera's viewing frustum. + * @param near — Camera frustum near plane. + * @param far — Camera frustum far plane. + * Together these define the camera's viewing frustum. */ public PerspectiveCamera(float fov, float aspect, float near, float far) { } @@ -127,7 +126,6 @@ public PerspectiveCamera(float fov, float aspect, float near, float far) { /** * Returns the current vertical field of view angle in degrees considering .zoom. - * * @return as float value */ public native float getEffectiveFOV(); @@ -135,7 +133,6 @@ public PerspectiveCamera(float fov, float aspect, float near, float far) { /** * Returns the height of the image on the film. If .aspect is less than or equal to one (portrait format), * the result equals .filmGauge. - * * @return as float value */ public native float getFilmHeight(); @@ -143,14 +140,12 @@ public PerspectiveCamera(float fov, float aspect, float near, float far) { /** * Returns the width of the image on the film. If .aspect is greater than or equal to one (landscape format), * the result equals .filmGauge. - * * @return as float value */ public native float getFilmWidth(); /** * Returns the focal length of the current .fov in respect to .filmGauge. - * * @return as float value */ public native float getFocalLength(); @@ -158,7 +153,6 @@ public PerspectiveCamera(float fov, float aspect, float near, float far) { /** * Sets the FOV by focal length in respect to the current .filmGauge. *

- * * @param focalLength By default, the focal length is specified for a 35mm (full frame) camera. */ public native void setFocalLength(float focalLength); @@ -190,13 +184,12 @@ public PerspectiveCamera(float fov, float aspect, float near, float far) { * camera.setViewOffset( fullWidth, fullHeight, w * 1, h * 1, w, h ); * // F * camera.setViewOffset( fullWidth, fullHeight, w * 2, h * 1, w, h ); Note there is no reason monitors have to be the same size or in a grid. - * - * @param fullWidth — full width of multiview setup + * @param fullWidth — full width of multiview setup * @param fullHeight — full height of multiview setup - * @param x — horizontal offset of subcamera - * @param y — vertical offset of subcamera - * @param width — width of subcamera - * @param height — height of subcamera + * @param x — horizontal offset of subcamera + * @param y — vertical offset of subcamera + * @param width — width of subcamera + * @param height — height of subcamera */ public native void setViewOffset(float fullWidth, float fullHeight, float x, float y, float width, float height); @@ -207,7 +200,6 @@ public PerspectiveCamera(float fov, float aspect, float near, float far) { /** * Return camera data in JSON format. - * * @return String */ public native String toJSON(); diff --git a/core/src/main/java/org/treblereel/gwt/three4g/core/BufferAttribute.java b/core/src/main/java/org/treblereel/gwt/three4g/core/BufferAttribute.java index 0c4a19b3..eb30fb60 100644 --- a/core/src/main/java/org/treblereel/gwt/three4g/core/BufferAttribute.java +++ b/core/src/main/java/org/treblereel/gwt/three4g/core/BufferAttribute.java @@ -430,4 +430,11 @@ public BufferAttribute(TypedArray array, int itemSize, boolean normalized) { */ public native T setXYZW(int index, V x, V y, V z, V w); + /** + * Return BufferAttribute data in JSON format. + * + * @return String + */ + public native String toJSON(); + } diff --git a/core/src/main/java/org/treblereel/gwt/three4g/core/InstancedBufferGeometry.java b/core/src/main/java/org/treblereel/gwt/three4g/core/InstancedBufferGeometry.java index df09f2d8..acb6076f 100644 --- a/core/src/main/java/org/treblereel/gwt/three4g/core/InstancedBufferGeometry.java +++ b/core/src/main/java/org/treblereel/gwt/three4g/core/InstancedBufferGeometry.java @@ -21,5 +21,10 @@ public class InstancedBufferGeometry extends BufferGeometry { */ public boolean isInstancedBufferGeometry; - + /** + * Return InstancedBufferGeometry data in JSON format. + * + * @return String + */ + public native String toJSON(); } diff --git a/core/src/main/java/org/treblereel/gwt/three4g/core/Object3D.java b/core/src/main/java/org/treblereel/gwt/three4g/core/Object3D.java index 043bdb75..3f00207a 100644 --- a/core/src/main/java/org/treblereel/gwt/three4g/core/Object3D.java +++ b/core/src/main/java/org/treblereel/gwt/three4g/core/Object3D.java @@ -193,6 +193,13 @@ public Object3D() { */ public native void applyQuaternion(Quaternion quaternion); + /** + * Adds object as a child of this, while maintaining the object's world transform. + * @param object3D an Object3D + * @return this instance of Object3D + */ + public native Object3D attach(Object3D object3D); + /** * Returns a clone of this object and optionally all descendants. * diff --git a/core/src/main/java/org/treblereel/gwt/three4g/math/Matrix4.java b/core/src/main/java/org/treblereel/gwt/three4g/math/Matrix4.java index 1bb58dc8..f25e30a1 100644 --- a/core/src/main/java/org/treblereel/gwt/three4g/math/Matrix4.java +++ b/core/src/main/java/org/treblereel/gwt/three4g/math/Matrix4.java @@ -448,6 +448,27 @@ public Matrix4(){ */ public native Matrix4 setPosition(Vector3 v); + /** + * Sets the position component for this matrix from vector v, without affecting the rest of the matrix - i.e. if the matrix is currently: + * a, b, c, d, + * e, f, g, h, + * i, j, k, l, + * m, n, o, p + * + * This becomes: + * a, b, c, v.x, + * e, f, g, v.y, + * i, j, k, v.z, + * m, n, o, p + * + * @param x float value + * @param y float value + * @param z float value + * @return instance of Matrix4 + */ + public native Matrix4 setPosition(float x, float y, float z); + + /** * Writes the elements of this matrix to an array in column-major format. * diff --git a/core/src/main/java/org/treblereel/gwt/three4g/math/SphericalHarmonics3.java b/core/src/main/java/org/treblereel/gwt/three4g/math/SphericalHarmonics3.java index 4e76a562..cd5b93bb 100644 --- a/core/src/main/java/org/treblereel/gwt/three4g/math/SphericalHarmonics3.java +++ b/core/src/main/java/org/treblereel/gwt/three4g/math/SphericalHarmonics3.java @@ -1,10 +1,13 @@ package org.treblereel.gwt.three4g.math; +import jsinterop.annotations.JsType; + /** * Represents a third-order spherical harmonics (SH). Light probes use this class to encode lighting information. * @author Dmitrii Tikhomirov * Created by treblereel 6/28/20 */ +@JsType(isNative = true, namespace = "THREE") public class SphericalHarmonics3 { /** @@ -91,14 +94,14 @@ public class SphericalHarmonics3 { /** * Returns an array with the coefficients, or copies them into the provided array. The coefficients are represented as numbers. - * @return + * @return instance of Vector3[] */ public native Vector3[] toArray(); /** * Returns an array with the coefficients, or copies them into the provided array. The coefficients are represented as numbers. * @param array - (optional) The target array. - * @return + * @return instance of Vector3[] */ public native Vector3[] toArray(Vector3[] array); @@ -106,7 +109,7 @@ public class SphericalHarmonics3 { * Returns an array with the coefficients, or copies them into the provided array. The coefficients are represented as numbers. * @param array - (optional) The target array. * @param offset - (optional) The array offset. - * @return + * @return instance of Vector3[] */ public native Vector3[] toArray(Vector3[] array, int offset); diff --git a/core/src/main/java/org/treblereel/gwt/three4g/math/Triangle.java b/core/src/main/java/org/treblereel/gwt/three4g/math/Triangle.java index 999da2be..29373307 100644 --- a/core/src/main/java/org/treblereel/gwt/three4g/math/Triangle.java +++ b/core/src/main/java/org/treblereel/gwt/three4g/math/Triangle.java @@ -4,7 +4,6 @@ /** * A geometric triangle as defined by three Vector3s representing its three corners. - * * @author Dmitrii Tikhomirov * Created by treblereel on 5/30/18. */ @@ -28,7 +27,6 @@ public class Triangle { /** * Creates a new Triangle. - * * @param a - the first corner of the triangle. Default is a Vector3 at (0, 0, 0). * @param b - the second corner of the triangle. Default is a Vector3 at (0, 0, 0). * @param c - the final corner of the triangle. Default is a Vector3 at (0, 0, 0). @@ -37,13 +35,15 @@ public Triangle(Vector3 a, Vector3 b, Vector3 c) { } + public native static boolean isFrontFacing(Vector3 a, Vector3 b, Vector3 c, Vector3 direction); + /** * @return Returns a new triangle with the same a, b and c properties as this one. */ public native Triangle clone(); /** - * @param point - Vector3 + * @param point - Vector3 * @param target — the result will be copied into this Vector3. * @return Returns the closest point on the triangle to point. */ @@ -57,7 +57,6 @@ public Triangle(Vector3 a, Vector3 b, Vector3 c) { /** * Copies the values of the passed triangles's a, b and c properties to this triangle. - * * @param triangle instance of Triangle * @return instance of Triangle */ @@ -75,7 +74,7 @@ public Triangle(Vector3 a, Vector3 b, Vector3 c) { public native float getArea(); /** - * @param point - Vector3 + * @param point - Vector3 * @param target — the result will be copied into this Vector3. * @return Return a barycentric coordinate from the given vector. */ @@ -115,12 +114,13 @@ public Triangle(Vector3 a, Vector3 b, Vector3 c) { /** * Sets the triangle's vectors to the vectors in the array. - * * @param points - Array of Vector3s - * @param i0 - Integer index - * @param i1 - Integer index - * @param i2 - Integer index + * @param i0 - Integer index + * @param i1 - Integer index + * @param i2 - Integer index * @return instance of Triangle */ public native Triangle setFromPointsAndIndices(Vector3[] points, int i0, int i1, int i2); + + public native boolean isFrontFacing(Vector3 direction); } diff --git a/core/src/main/java/org/treblereel/gwt/three4g/renderers/WebGLRenderer.java b/core/src/main/java/org/treblereel/gwt/three4g/renderers/WebGLRenderer.java index e1412314..2b8a9872 100644 --- a/core/src/main/java/org/treblereel/gwt/three4g/renderers/WebGLRenderer.java +++ b/core/src/main/java/org/treblereel/gwt/three4g/renderers/WebGLRenderer.java @@ -499,6 +499,21 @@ public final double getHeight() { * @param buffer instance of Uint8Array */ public native void readRenderTargetPixels(WebGLRenderTarget renderTarget, float x, float y, float width, float height, Uint8Array buffer); + /** + * Reads the pixel data from the renderTarget into the buffer you pass in. Buffer should be a Javascript Uint8Array + * instantiated with new Uint8Array( renderTargetWidth * renderTargetWidth * 4 ) to account for size and color information. + * This is a wrapper around gl.readPixels. + * See the interactive / cubes / gpu example. + * @param renderTarget instance of WebGLRenderTarget + * @param x as float + * @param y as float + * @param width as float + * @param height as float + * @param buffer instance of Uint8Array + * @param readRenderTargetPixels as int + */ + public native void readRenderTargetPixels(WebGLRenderTarget renderTarget, float x, float y, float width, float height, Uint8Array buffer, int readRenderTargetPixels); + /** * Render a scene using a camera. diff --git a/core/src/main/java/org/treblereel/gwt/three4g/renderers/parameters/WebGLRendererParameters.java b/core/src/main/java/org/treblereel/gwt/three4g/renderers/parameters/WebGLRendererParameters.java index 4b6d6766..2f8b7dc5 100644 --- a/core/src/main/java/org/treblereel/gwt/three4g/renderers/parameters/WebGLRendererParameters.java +++ b/core/src/main/java/org/treblereel/gwt/three4g/renderers/parameters/WebGLRendererParameters.java @@ -23,5 +23,6 @@ public class WebGLRendererParameters { public String powerPreference; // Can be "high-performance", "low-power" or "default" public boolean depth; public boolean logarithmicDepthBuffer; + public boolean failIfMajorPerformanceCaveat; } diff --git a/core/src/main/java/org/treblereel/gwt/three4g/renderers/webvr/WebXRManager.java b/core/src/main/java/org/treblereel/gwt/three4g/renderers/webvr/WebXRManager.java index b688d238..b52219fc 100644 --- a/core/src/main/java/org/treblereel/gwt/three4g/renderers/webvr/WebXRManager.java +++ b/core/src/main/java/org/treblereel/gwt/three4g/renderers/webvr/WebXRManager.java @@ -21,7 +21,7 @@ public class WebXRManager { public boolean isPresenting; - public String frameOfReferenceType; + public String referenceSpaceType; public WebXRManager(WebGLRenderer renderer){ diff --git a/core/src/main/resources/org/treblereel/gwt/three4g/resources/js/three.js b/core/src/main/resources/org/treblereel/gwt/three4g/resources/js/three.js index 1e35bfec..0119ed6d 100644 --- a/core/src/main/resources/org/treblereel/gwt/three4g/resources/js/three.js +++ b/core/src/main/resources/org/treblereel/gwt/three4g/resources/js/three.js @@ -185,7 +185,7 @@ } ); - var REVISION = '104'; + var REVISION = '105'; var MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2 }; var CullFaceNone = 0; var CullFaceBack = 1; @@ -5589,13 +5589,23 @@ }, - setPosition: function ( v ) { + setPosition: function ( x, y, z ) { var te = this.elements; - te[ 12 ] = v.x; - te[ 13 ] = v.y; - te[ 14 ] = v.z; + if ( x.isVector3 ) { + + te[ 12 ] = x.x; + te[ 13 ] = x.y; + te[ 14 ] = x.z; + + } else { + + te[ 12 ] = x; + te[ 13 ] = y; + te[ 14 ] = z; + + } return this; @@ -6018,7 +6028,7 @@ var beginnormal_vertex = "vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif"; - var bsdfs = "vec2 integrateSpecularBRDF( const in float dotNV, const in float roughness ) {\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\treturn vec2( -1.04, 1.04 ) * a004 + r.zw;\n}\nfloat punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif( cutoffDistance > 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n#else\n\tif( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t}\n\treturn 1.0;\n#endif\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNL = saturate( dot( geometry.normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\nvec3 BRDF_Specular_GGX_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\treturn specularColor * brdf.x + brdf.y;\n}\nvoid BRDF_Specular_Multiscattering_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tvec3 F = F_Schlick( specularColor, dotNV );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\tvec3 FssEss = F * brdf.x + brdf.y;\n\tfloat Ess = brdf.x + brdf.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}"; + var bsdfs = "vec2 integrateSpecularBRDF( const in float dotNV, const in float roughness ) {\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\treturn vec2( -1.04, 1.04 ) * a004 + r.zw;\n}\nfloat punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif( cutoffDistance > 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n#else\n\tif( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t}\n\treturn 1.0;\n#endif\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nvec3 F_Schlick_RoughnessDependent( const in vec3 F0, const in float dotNV, const in float roughness ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotNV - 6.98316 ) * dotNV );\n\tvec3 Fr = max( vec3( 1.0 - roughness ), F0 ) - F0;\n\treturn Fr * fresnel + F0;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNL = saturate( dot( geometry.normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\nvec3 BRDF_Specular_GGX_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\treturn specularColor * brdf.x + brdf.y;\n}\nvoid BRDF_Specular_Multiscattering_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tvec3 F = F_Schlick_RoughnessDependent( specularColor, dotNV, roughness );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\tvec3 FssEss = F * brdf.x + brdf.y;\n\tfloat Ess = brdf.x + brdf.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}"; var bumpmap_pars_fragment = "#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\t\tfDet *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif"; @@ -6090,7 +6100,7 @@ var lights_physical_fragment = "PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 );\n#ifdef STANDARD\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.clearCoat = saturate( clearCoat );\tmaterial.clearCoatRoughness = clamp( clearCoatRoughness, 0.04, 1.0 );\n#endif"; - var lights_physical_pars_fragment = "struct PhysicalMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n\t#ifndef STANDARD\n\t\tfloat clearCoat;\n\t\tfloat clearCoatRoughness;\n\t#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearCoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.specularRoughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifndef STANDARD\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.directSpecular += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry, material.specularColor, material.specularRoughness );\n\treflectedLight.directDiffuse += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\t#ifndef STANDARD\n\t\treflectedLight.directSpecular += irradiance * material.clearCoat * BRDF_Specular_GGX( directLight, geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifndef ENVMAP_TYPE_CUBE_UV\n\t\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\t#endif\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearCoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifndef STANDARD\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\tfloat dotNL = dotNV;\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\tfloat clearCoatInv = 1.0 - clearCoatDHR;\n\t#if defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec3 singleScattering = vec3( 0.0 );\n\t\tvec3 multiScattering = vec3( 0.0 );\n\t\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\t\tBRDF_Specular_Multiscattering_Environment( geometry, material.specularColor, material.specularRoughness, singleScattering, multiScattering );\n\t\tvec3 diffuse = material.diffuseColor;\n\t\treflectedLight.indirectSpecular += clearCoatInv * radiance * singleScattering;\n\t\treflectedLight.indirectDiffuse += multiScattering * cosineWeightedIrradiance;\n\t\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n\t#else\n\t\treflectedLight.indirectSpecular += clearCoatInv * radiance * BRDF_Specular_GGX_Environment( geometry, material.specularColor, material.specularRoughness );\n\t#endif\n\t#ifndef STANDARD\n\t\treflectedLight.indirectSpecular += clearCoatRadiance * material.clearCoat * BRDF_Specular_GGX_Environment( geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\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\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}"; + var lights_physical_pars_fragment = "struct PhysicalMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n\t#ifndef STANDARD\n\t\tfloat clearCoat;\n\t\tfloat clearCoatRoughness;\n\t#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearCoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.specularRoughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifndef STANDARD\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.directSpecular += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry, material.specularColor, material.specularRoughness );\n\treflectedLight.directDiffuse += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\t#ifndef STANDARD\n\t\treflectedLight.directSpecular += irradiance * material.clearCoat * BRDF_Specular_GGX( directLight, geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifndef ENVMAP_TYPE_CUBE_UV\n\t\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\t#endif\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearCoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifndef STANDARD\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\tfloat dotNL = dotNV;\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\tfloat clearCoatInv = 1.0 - clearCoatDHR;\n\t#if defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec3 singleScattering = vec3( 0.0 );\n\t\tvec3 multiScattering = vec3( 0.0 );\n\t\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\t\tBRDF_Specular_Multiscattering_Environment( geometry, material.specularColor, material.specularRoughness, singleScattering, multiScattering );\n\t\tvec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\n\t\treflectedLight.indirectSpecular += clearCoatInv * radiance * singleScattering;\n\t\treflectedLight.indirectDiffuse += multiScattering * cosineWeightedIrradiance;\n\t\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n\t#else\n\t\treflectedLight.indirectSpecular += clearCoatInv * radiance * BRDF_Specular_GGX_Environment( geometry, material.specularColor, material.specularRoughness );\n\t#endif\n\t#ifndef STANDARD\n\t\treflectedLight.indirectSpecular += clearCoatRadiance * material.clearCoat * BRDF_Specular_GGX_Environment( geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\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\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}"; var lights_fragment_begin = "\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = normalize( vViewPosition );\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( pointLight.shadow, directLight.visible ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( spotLight.shadow, directLight.visible ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( directionalLight.shadow, directLight.visible ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearCoatRadiance = vec3( 0.0 );\n#endif"; @@ -8586,6 +8596,38 @@ }, + attach: function () { + + // adds object as a child of this, while maintaining the object's world transform + + var m = new Matrix4(); + + return function attach( object ) { + + this.updateWorldMatrix( true, false ); + + m.getInverse( this.matrixWorld ); + + if ( object.parent !== null ) { + + object.parent.updateWorldMatrix( true, false ); + + m.multiply( object.parent.matrixWorld ); + + } + + object.applyMatrix( m ); + + object.updateWorldMatrix( false, false ); + + this.add( object ); + + return this; + + }; + + }(), + getObjectById: function ( id ) { return this.getObjectByProperty( 'id', id ); @@ -9267,7 +9309,7 @@ if ( uvs2 !== undefined ) this.faceVertexUvs[ 1 ] = []; - for ( var i = 0, j = 0; i < positions.length; i += 3, j += 2 ) { + for ( var i = 0; i < positions.length; i += 3 ) { scope.vertices.push( new Vector3().fromArray( positions, i ) ); @@ -10786,6 +10828,17 @@ return new this.constructor( this.array, this.itemSize ).copy( this ); + }, + + toJSON: function () { + + return { + itemSize: this.itemSize, + type: this.array.constructor.name, + array: Array.prototype.slice.call( this.array ), + normalized: this.normalized + }; + } } ); @@ -12224,12 +12277,7 @@ var attribute = attributes[ key ]; - var attributeData = { - itemSize: attribute.itemSize, - type: attribute.array.constructor.name, - array: Array.prototype.slice.call( attribute.array ), - normalized: attribute.normalized - }; + var attributeData = attribute.toJSON(); if ( attribute.name !== '' ) attributeData.name = attribute.name; @@ -12250,12 +12298,7 @@ var attribute = attributeArray[ i ]; - var attributeData = { - itemSize: attribute.itemSize, - type: attribute.array.constructor.name, - array: Array.prototype.slice.call( attribute.array ), - normalized: attribute.normalized - }; + var attributeData = attribute.toJSON(); if ( attribute.name !== '' ) attributeData.name = attribute.name; @@ -14003,6 +14046,23 @@ }; + }(), + + isFrontFacing: function () { + + var v0 = new Vector3(); + var v1 = new Vector3(); + + return function isFrontFacing( a, b, c, direction ) { + + v0.subVectors( c, b ); + v1.subVectors( a, b ); + + // strictly front facing + return ( v0.cross( v1 ).dot( direction ) < 0 ) ? true : false; + + }; + }() } ); @@ -14099,15 +14159,21 @@ }, + getUV: function ( point, uv1, uv2, uv3, target ) { + + return Triangle.getUV( point, this.a, this.b, this.c, uv1, uv2, uv3, target ); + + }, + containsPoint: function ( point ) { return Triangle.containsPoint( point, this.a, this.b, this.c ); }, - getUV: function ( point, uv1, uv2, uv3, result ) { + isFrontFacing: function ( direction ) { - return Triangle.getUV( point, this.a, this.b, this.c, uv1, uv2, uv3, result ); + return Triangle.isFrontFacing( this.a, this.b, this.c, direction ); }, @@ -16116,7 +16182,7 @@ // Single scalar - function setValue1f( gl, v ) { + function setValueV1f( gl, v ) { var cache = this.cache; @@ -16128,21 +16194,9 @@ } - function setValue1i( gl, v ) { - - var cache = this.cache; - - if ( cache[ 0 ] === v ) return; - - gl.uniform1i( this.addr, v ); - - cache[ 0 ] = v; - - } - // Single float vector (from flat array or THREE.VectorN) - function setValue2fv( gl, v ) { + function setValueV2f( gl, v ) { var cache = this.cache; @@ -16169,7 +16223,7 @@ } - function setValue3fv( gl, v ) { + function setValueV3f( gl, v ) { var cache = this.cache; @@ -16209,7 +16263,7 @@ } - function setValue4fv( gl, v ) { + function setValueV4f( gl, v ) { var cache = this.cache; @@ -16240,7 +16294,7 @@ // Single matrix (from flat array or MatrixN) - function setValue2fm( gl, v ) { + function setValueM2( gl, v ) { var cache = this.cache; var elements = v.elements; @@ -16267,7 +16321,7 @@ } - function setValue3fm( gl, v ) { + function setValueM3( gl, v ) { var cache = this.cache; var elements = v.elements; @@ -16294,7 +16348,7 @@ } - function setValue4fm( gl, v ) { + function setValueM4( gl, v ) { var cache = this.cache; var elements = v.elements; @@ -16389,7 +16443,19 @@ // Integer / Boolean vectors or arrays thereof (always flat arrays) - function setValue2iv( gl, v ) { + function setValueV1i( gl, v ) { + + var cache = this.cache; + + if ( cache[ 0 ] === v ) return; + + gl.uniform1i( this.addr, v ); + + cache[ 0 ] = v; + + } + + function setValueV2i( gl, v ) { var cache = this.cache; @@ -16401,7 +16467,7 @@ } - function setValue3iv( gl, v ) { + function setValueV3i( gl, v ) { var cache = this.cache; @@ -16413,7 +16479,7 @@ } - function setValue4iv( gl, v ) { + function setValueV4i( gl, v ) { var cache = this.cache; @@ -16431,151 +16497,123 @@ switch ( type ) { - case 0x1406: return setValue1f; // FLOAT - case 0x8b50: return setValue2fv; // _VEC2 - case 0x8b51: return setValue3fv; // _VEC3 - case 0x8b52: return setValue4fv; // _VEC4 + case 0x1406: return setValueV1f; // FLOAT + case 0x8b50: return setValueV2f; // _VEC2 + case 0x8b51: return setValueV3f; // _VEC3 + case 0x8b52: return setValueV4f; // _VEC4 - case 0x8b5a: return setValue2fm; // _MAT2 - case 0x8b5b: return setValue3fm; // _MAT3 - case 0x8b5c: return setValue4fm; // _MAT4 + case 0x8b5a: return setValueM2; // _MAT2 + case 0x8b5b: return setValueM3; // _MAT3 + case 0x8b5c: return setValueM4; // _MAT4 case 0x8b5e: case 0x8d66: return setValueT1; // SAMPLER_2D, SAMPLER_EXTERNAL_OES case 0x8b5f: return setValueT3D1; // SAMPLER_3D case 0x8b60: return setValueT6; // SAMPLER_CUBE case 0x8DC1: return setValueT2DArray1; // SAMPLER_2D_ARRAY - case 0x1404: case 0x8b56: return setValue1i; // INT, BOOL - case 0x8b53: case 0x8b57: return setValue2iv; // _VEC2 - case 0x8b54: case 0x8b58: return setValue3iv; // _VEC3 - case 0x8b55: case 0x8b59: return setValue4iv; // _VEC4 + case 0x1404: case 0x8b56: return setValueV1i; // INT, BOOL + case 0x8b53: case 0x8b57: return setValueV2i; // _VEC2 + case 0x8b54: case 0x8b58: return setValueV3i; // _VEC3 + case 0x8b55: case 0x8b59: return setValueV4i; // _VEC4 } } // Array of scalars + function setValueV1fArray( gl, v ) { - function setValue1fv( gl, v ) { + gl.uniform1fv( this.addr, v ); - var cache = this.cache; + } - if ( arraysEqual( cache, v ) ) return; + // Integer / Boolean vectors or arrays thereof (always flat arrays) + function setValueV1iArray( gl, v ) { - gl.uniform1fv( this.addr, v ); + gl.uniform1iv( this.addr, v ); - copyArray( cache, v ); + } + + function setValueV2iArray( gl, v ) { + + gl.uniform2iv( this.addr, v ); } - function setValue1iv( gl, v ) { - var cache = this.cache; + function setValueV3iArray( gl, v ) { - if ( arraysEqual( cache, v ) ) return; + gl.uniform3iv( this.addr, v ); - gl.uniform1iv( this.addr, v ); + } - copyArray( cache, v ); + function setValueV4iArray( gl, v ) { + + gl.uniform4iv( this.addr, v ); } + // Array of vectors (flat or from THREE classes) - function setValueV2a( gl, v ) { + function setValueV2fArray( gl, v ) { - var cache = this.cache; var data = flatten( v, this.size, 2 ); - if ( arraysEqual( cache, data ) ) return; - gl.uniform2fv( this.addr, data ); - this.updateCache( data ); - } - function setValueV3a( gl, v ) { + function setValueV3fArray( gl, v ) { - var cache = this.cache; var data = flatten( v, this.size, 3 ); - if ( arraysEqual( cache, data ) ) return; - gl.uniform3fv( this.addr, data ); - this.updateCache( data ); - } - function setValueV4a( gl, v ) { + function setValueV4fArray( gl, v ) { - var cache = this.cache; var data = flatten( v, this.size, 4 ); - if ( arraysEqual( cache, data ) ) return; - gl.uniform4fv( this.addr, data ); - this.updateCache( data ); - } // Array of matrices (flat or from THREE clases) - function setValueM2a( gl, v ) { + function setValueM2Array( gl, v ) { - var cache = this.cache; var data = flatten( v, this.size, 4 ); - if ( arraysEqual( cache, data ) ) return; - gl.uniformMatrix2fv( this.addr, false, data ); - this.updateCache( data ); - } - function setValueM3a( gl, v ) { + function setValueM3Array( gl, v ) { - var cache = this.cache; var data = flatten( v, this.size, 9 ); - if ( arraysEqual( cache, data ) ) return; - gl.uniformMatrix3fv( this.addr, false, data ); - this.updateCache( data ); - } - function setValueM4a( gl, v ) { + function setValueM4Array( gl, v ) { - var cache = this.cache; var data = flatten( v, this.size, 16 ); - if ( arraysEqual( cache, data ) ) return; - gl.uniformMatrix4fv( this.addr, false, data ); - this.updateCache( data ); - } // Array of textures (2D / Cube) - function setValueT1a( gl, v, textures ) { + function setValueT1Array( gl, v, textures ) { - var cache = this.cache; var n = v.length; var units = allocTexUnits( textures, n ); - if ( arraysEqual( cache, units ) === false ) { - - gl.uniform1iv( this.addr, units ); - copyArray( cache, units ); - - } + gl.uniform1iv( this.addr, units ); for ( var i = 0; i !== n; ++ i ) { @@ -16585,19 +16623,13 @@ } - function setValueT6a( gl, v, textures ) { + function setValueT6Array( gl, v, textures ) { - var cache = this.cache; var n = v.length; var units = allocTexUnits( textures, n ); - if ( arraysEqual( cache, units ) === false ) { - - gl.uniform1iv( this.addr, units ); - copyArray( cache, units ); - - } + gl.uniform1iv( this.addr, units ); for ( var i = 0; i !== n; ++ i ) { @@ -16613,22 +16645,22 @@ switch ( type ) { - case 0x1406: return setValue1fv; // FLOAT - case 0x8b50: return setValueV2a; // _VEC2 - case 0x8b51: return setValueV3a; // _VEC3 - case 0x8b52: return setValueV4a; // _VEC4 + case 0x1406: return setValueV1fArray; // FLOAT + case 0x8b50: return setValueV2fArray; // _VEC2 + case 0x8b51: return setValueV3fArray; // _VEC3 + case 0x8b52: return setValueV4fArray; // _VEC4 - case 0x8b5a: return setValueM2a; // _MAT2 - case 0x8b5b: return setValueM3a; // _MAT3 - case 0x8b5c: return setValueM4a; // _MAT4 + case 0x8b5a: return setValueM2Array; // _MAT2 + case 0x8b5b: return setValueM3Array; // _MAT3 + case 0x8b5c: return setValueM4Array; // _MAT4 - case 0x8b5e: return setValueT1a; // SAMPLER_2D - case 0x8b60: return setValueT6a; // SAMPLER_CUBE + case 0x8b5e: return setValueT1Array; // SAMPLER_2D + case 0x8b60: return setValueT6Array; // SAMPLER_CUBE - case 0x1404: case 0x8b56: return setValue1iv; // INT, BOOL - case 0x8b53: case 0x8b57: return setValue2iv; // _VEC2 - case 0x8b54: case 0x8b58: return setValue3iv; // _VEC3 - case 0x8b55: case 0x8b59: return setValue4iv; // _VEC4 + case 0x1404: case 0x8b56: return setValueV1iArray; // INT, BOOL + case 0x8b53: case 0x8b57: return setValueV2iArray; // _VEC2 + case 0x8b54: case 0x8b58: return setValueV3iArray; // _VEC3 + case 0x8b55: case 0x8b59: return setValueV4iArray; // _VEC4 } @@ -18912,6 +18944,8 @@ if ( lights.length === 0 ) return; var currentRenderTarget = _renderer.getRenderTarget(); + var activeCubeFace = _renderer.getActiveCubeFace(); + var activeMipMapLevel = _renderer.getActiveMipMapLevel(); var _state = _renderer.state; @@ -19069,7 +19103,7 @@ scope.needsUpdate = false; - _renderer.setRenderTarget( currentRenderTarget ); + _renderer.setRenderTarget( currentRenderTarget, activeCubeFace, activeMipMapLevel ); }; @@ -21971,6 +22005,7 @@ function WebVRManager( renderer ) { + var renderWidth, renderHeight; var scope = this; var device = null; @@ -21984,7 +22019,7 @@ var framebufferScaleFactor = 1.0; - var frameOfReferenceType = 'stage'; + var referenceSpaceType = 'local-floor'; if ( typeof window !== 'undefined' && 'VRFrameData' in window ) { @@ -21998,11 +22033,11 @@ var tempPosition = new Vector3(); var cameraL = new PerspectiveCamera(); - cameraL.bounds = new Vector4( 0.0, 0.0, 0.5, 1.0 ); + cameraL.viewport = new Vector4(); cameraL.layers.enable( 1 ); var cameraR = new PerspectiveCamera(); - cameraR.bounds = new Vector4( 0.5, 0.0, 0.5, 1.0 ); + cameraR.viewport = new Vector4(); cameraR.layers.enable( 2 ); var cameraVR = new ArrayCamera( [ cameraL, cameraR ] ); @@ -22024,13 +22059,16 @@ if ( isPresenting() ) { var eyeParameters = device.getEyeParameters( 'left' ); - var renderWidth = eyeParameters.renderWidth * framebufferScaleFactor; - var renderHeight = eyeParameters.renderHeight * framebufferScaleFactor; + renderWidth = 2 * eyeParameters.renderWidth * framebufferScaleFactor; + renderHeight = eyeParameters.renderHeight * framebufferScaleFactor; currentPixelRatio = renderer.getPixelRatio(); renderer.getSize( currentSize ); - renderer.setDrawingBufferSize( renderWidth * 2, renderHeight, 1 ); + renderer.setDrawingBufferSize( renderWidth, renderHeight, 1 ); + + cameraL.viewport.set( 0, 0, renderWidth / 2, renderHeight ); + cameraR.viewport.set( renderWidth / 2, 0, renderWidth / 2, renderHeight ); animation.start(); @@ -22105,6 +22143,8 @@ var buttonId = gamepad.id === 'Daydream Controller' ? 0 : 1; + if ( triggers[ i ] === undefined ) triggers[ i ] = false; + if ( triggers[ i ] !== gamepad.buttons[ buttonId ].pressed ) { triggers[ i ] = gamepad.buttons[ buttonId ].pressed; @@ -22132,6 +22172,16 @@ } + function updateViewportFromBounds( viewport, bounds ) { + + if ( bounds !== null && bounds.length === 4 ) { + + viewport.set( bounds[ 0 ] * renderWidth, bounds[ 1 ] * renderHeight, bounds[ 2 ] * renderWidth, bounds[ 3 ] * renderHeight ); + + } + + } + // this.enabled = false; @@ -22174,9 +22224,9 @@ }; - this.setFrameOfReferenceType = function ( value ) { + this.setReferenceSpaceType = function ( value ) { - frameOfReferenceType = value; + referenceSpaceType = value; }; @@ -22188,7 +22238,7 @@ this.getCamera = function ( camera ) { - var userHeight = frameOfReferenceType === 'stage' ? 1.6 : 0; + var userHeight = referenceSpaceType === 'local-floor' ? 1.6 : 0; if ( isPresenting() === false ) { @@ -22206,7 +22256,7 @@ // - if ( frameOfReferenceType === 'stage' ) { + if ( referenceSpaceType === 'local-floor' ) { var stageParameters = device.stageParameters; @@ -22263,7 +22313,7 @@ standingMatrixInverse.getInverse( standingMatrix ); - if ( frameOfReferenceType === 'stage' ) { + if ( referenceSpaceType === 'local-floor' ) { cameraL.matrixWorldInverse.multiply( standingMatrixInverse ); cameraR.matrixWorldInverse.multiply( standingMatrixInverse ); @@ -22299,17 +22349,8 @@ var layer = layers[ 0 ]; - if ( layer.leftBounds !== null && layer.leftBounds.length === 4 ) { - - cameraL.bounds.fromArray( layer.leftBounds ); - - } - - if ( layer.rightBounds !== null && layer.rightBounds.length === 4 ) { - - cameraR.bounds.fromArray( layer.rightBounds ); - - } + updateViewportFromBounds( cameraL.viewport, layer.leftBounds ); + updateViewportFromBounds( cameraR.viewport, layer.rightBounds ); } @@ -22355,6 +22396,14 @@ }; + // DEPRECATED + + this.setFrameOfReferenceType = function () { + + console.warn( 'THREE.WebVRManager: setFrameOfReferenceType() has been deprecated.' ); + + }; + } /** @@ -22365,13 +22414,10 @@ var gl = renderer.context; - var device = null; var session = null; - var framebufferScaleFactor = 1.0; - - var frameOfReference = null; - var frameOfReferenceType = 'stage'; + var referenceSpace = null; + var referenceSpaceType = 'local-floor'; var pose = null; @@ -22380,7 +22426,7 @@ function isPresenting() { - return session !== null && frameOfReference !== null; + return session !== null && referenceSpace !== null; } @@ -22420,25 +22466,19 @@ }; - this.getDevice = function () { - - return device; - - }; + // - this.setDevice = function ( value ) { + function onSessionEvent( event ) { - if ( value !== undefined ) device = value; - if ( value instanceof XRDevice ) gl.setCompatibleXRDevice( value ); + for ( var i = 0; i < controllers.length; i ++ ) { - }; + if ( inputSources[ i ] === event.inputSource ) { - // + controllers[ i ].dispatchEvent( { type: event.type } ); - function onSessionEvent( event ) { + } - var controller = controllers[ inputSources.indexOf( event.inputSource ) ]; - if ( controller ) controller.dispatchEvent( { type: event.type } ); + } } @@ -22450,15 +22490,22 @@ } - this.setFramebufferScaleFactor = function ( value ) { + function onRequestReferenceSpace( value ) { - framebufferScaleFactor = value; + referenceSpace = value; + + animation.setContext( session ); + animation.start(); + + } + + this.setFramebufferScaleFactor = function ( value ) { }; - this.setFrameOfReferenceType = function ( value ) { + this.setReferenceSpaceType = function ( value ) { - frameOfReferenceType = value; + referenceSpaceType = value; }; @@ -22473,25 +22520,17 @@ session.addEventListener( 'selectend', onSessionEvent ); session.addEventListener( 'end', onSessionEnd ); - session.baseLayer = new XRWebGLLayer( session, gl, { framebufferScaleFactor: framebufferScaleFactor } ); - session.requestFrameOfReference( frameOfReferenceType ).then( function ( value ) { - - frameOfReference = value; - - renderer.setFramebuffer( session.baseLayer.framebuffer ); + session.updateRenderState( { baseLayer: new XRWebGLLayer( session, gl ) } ); - animation.setContext( session ); - animation.start(); - - } ); + session.requestReferenceSpace( referenceSpaceType ).then( onRequestReferenceSpace ); // - inputSources = session.getInputSources(); + inputSources = session.inputSources; session.addEventListener( 'inputsourceschange', function () { - inputSources = session.getInputSources(); + inputSources = session.inputSources; console.log( inputSources ); for ( var i = 0; i < controllers.length; i ++ ) { @@ -22568,18 +22607,20 @@ function onAnimationFrame( time, frame ) { - pose = frame.getDevicePose( frameOfReference ); + pose = frame.getViewerPose( referenceSpace ); if ( pose !== null ) { - var layer = session.baseLayer; - var views = frame.views; + var views = pose.views; + var baseLayer = session.renderState.baseLayer; + + renderer.setFramebuffer( baseLayer.framebuffer ); for ( var i = 0; i < views.length; i ++ ) { var view = views[ i ]; - var viewport = layer.getViewport( view ); - var viewMatrix = pose.getViewMatrix( view ); + var viewport = baseLayer.getViewport( view ); + var viewMatrix = view.transform.inverse.matrix; var camera = cameraVR.cameras[ i ]; camera.matrix.fromArray( viewMatrix ).getInverse( camera.matrix ); @@ -22606,22 +22647,11 @@ if ( inputSource ) { - var inputPose = frame.getInputPose( inputSource, frameOfReference ); + var inputPose = frame.getPose( inputSource.targetRaySpace, referenceSpace ); if ( inputPose !== null ) { - if ( 'targetRay' in inputPose ) { - - controller.matrix.elements = inputPose.targetRay.transformMatrix; - - } else if ( 'pointerMatrix' in inputPose ) { - - // DEPRECATED - - controller.matrix.elements = inputPose.pointerMatrix; - - } - + controller.matrix.fromArray( inputPose.transform.matrix ); controller.matrix.decompose( controller.position, controller.rotation, controller.scale ); controller.visible = true; @@ -22659,6 +22689,24 @@ }; + this.getDevice = function () { + + console.warn( 'THREE.WebXRManager: getDevice() has been deprecated.' ); + + }; + + this.setDevice = function () { + + console.warn( 'THREE.WebXRManager: setDevice() has been deprecated.' ); + + }; + + this.setFrameOfReferenceType = function () { + + console.warn( 'THREE.WebXRManager: setFrameOfReferenceType() has been deprecated.' ); + + }; + this.submitFrame = function () {}; } @@ -22686,7 +22734,8 @@ _antialias = parameters.antialias !== undefined ? parameters.antialias : false, _premultipliedAlpha = parameters.premultipliedAlpha !== undefined ? parameters.premultipliedAlpha : true, _preserveDrawingBuffer = parameters.preserveDrawingBuffer !== undefined ? parameters.preserveDrawingBuffer : false, - _powerPreference = parameters.powerPreference !== undefined ? parameters.powerPreference : 'default'; + _powerPreference = parameters.powerPreference !== undefined ? parameters.powerPreference : 'default', + _failIfMajorPerformanceCaveat = parameters.failIfMajorPerformanceCaveat !== undefined ? parameters.failIfMajorPerformanceCaveat : false; var currentRenderList = null; var currentRenderState = null; @@ -22703,7 +22752,7 @@ * Enables error checking and reporting when shader programs are being compiled * @type {boolean} */ - checkShaderErrors: false + checkShaderErrors: true }; // clearing @@ -22753,6 +22802,8 @@ _framebuffer = null, + _currentActiveCubeFace = 0, + _currentActiveMipmapLevel = 0, _currentRenderTarget = null, _currentFramebuffer = null, _currentMaterialId = - 1, @@ -22818,7 +22869,9 @@ antialias: _antialias, premultipliedAlpha: _premultipliedAlpha, preserveDrawingBuffer: _preserveDrawingBuffer, - powerPreference: _powerPreference + powerPreference: _powerPreference, + failIfMajorPerformanceCaveat: _failIfMajorPerformanceCaveat, + xrCompatible: true }; // event listeners must be registered before WebGL context is created, see #12753 @@ -22927,7 +22980,7 @@ // vr - var vr = ( typeof navigator !== 'undefined' && 'xr' in navigator ) ? new WebXRManager( _this ) : new WebVRManager( _this ); + var vr = ( typeof navigator !== 'undefined' && 'xr' in navigator && 'supportsSession' in navigator.xr ) ? new WebXRManager( _this ) : new WebVRManager( _this ); this.vr = vr; @@ -23998,22 +24051,7 @@ if ( object.layers.test( camera2.layers ) ) { - if ( 'viewport' in camera2 ) { // XR - - state.viewport( _currentViewport.copy( camera2.viewport ) ); - - } else { - - var bounds = camera2.bounds; - - var x = bounds.x * _width; - var y = bounds.y * _height; - var width = bounds.z * _width; - var height = bounds.w * _height; - - state.viewport( _currentViewport.set( x, y, width, height ).multiplyScalar( _pixelRatio ) ); - - } + state.viewport( _currentViewport.copy( camera2.viewport ) ); currentRenderState.setupLights( camera2 ); @@ -25043,13 +25081,26 @@ } // - this.setFramebuffer = function ( value ) { + if ( _framebuffer !== value ) _gl.bindFramebuffer( 36160, value ); + _framebuffer = value; }; + this.getActiveCubeFace = function () { + + return _currentActiveCubeFace; + + }; + + this.getActiveMipMapLevel = function () { + + return _currentActiveMipmapLevel; + + }; + this.getRenderTarget = function () { return _currentRenderTarget; @@ -25059,6 +25110,8 @@ this.setRenderTarget = function ( renderTarget, activeCubeFace, activeMipMapLevel ) { _currentRenderTarget = renderTarget; + _currentActiveCubeFace = activeCubeFace; + _currentActiveMipmapLevel = activeMipMapLevel; if ( renderTarget && properties.get( renderTarget ).__webglFramebuffer === undefined ) { @@ -25120,7 +25173,7 @@ }; - this.readRenderTargetPixels = function ( renderTarget, x, y, width, height, buffer ) { + this.readRenderTargetPixels = function ( renderTarget, x, y, width, height, buffer, activeCubeFaceIndex ) { if ( ! ( renderTarget && renderTarget.isWebGLRenderTarget ) ) { @@ -25131,6 +25184,12 @@ var framebuffer = properties.get( renderTarget ).__webglFramebuffer; + if ( renderTarget.isWebGLRenderTargetCube && activeCubeFaceIndex !== undefined ) { + + framebuffer = framebuffer[ activeCubeFaceIndex ]; + + } + if ( framebuffer ) { var restore = false; @@ -25228,6 +25287,12 @@ }; + /* + if ( typeof __THREE_DEVTOOLS__ !== undefined ) { + __THREE_DEVTOOLS__.dispatchEvent( { type: 'renderer', value: this } ); + } + */ + } /** @@ -25321,6 +25386,12 @@ this.autoUpdate = true; // checked by the renderer + /* + if ( typeof __THREE_DEVTOOLS__ !== undefined ) { + __THREE_DEVTOOLS__.dispatchEvent( { type: 'scene', value: this } ); + } + */ + } Scene.prototype = Object.assign( Object.create( Object3D.prototype ), { @@ -30343,7 +30414,7 @@ thetaStart = thetaStart !== undefined ? thetaStart : 0; thetaLength = thetaLength !== undefined ? thetaLength : Math.PI; - var thetaEnd = thetaStart + thetaLength; + var thetaEnd = Math.min( thetaStart + thetaLength, Math.PI ); var ix, iy; @@ -30370,7 +30441,17 @@ // special case for the poles - var uOffset = ( iy == 0 ) ? 0.5 / widthSegments : ( ( iy == heightSegments ) ? - 0.5 / widthSegments : 0 ); + var uOffset = 0; + + if ( iy == 0 && thetaStart == 0 ) { + + uOffset = 0.5 / widthSegments; + + } else if ( iy == heightSegments && thetaEnd == Math.PI ) { + + uOffset = - 0.5 / widthSegments; + + } for ( ix = 0; ix <= widthSegments; ix ++ ) { @@ -38035,8 +38116,17 @@ } - // Merges multi-byte utf-8 characters. - return decodeURIComponent( escape( s ) ); + try { + + // merges multi-byte utf-8 characters. + + return decodeURIComponent( escape( s ) ); + + } catch ( e ) { // see #16358 + + return s; + + } }, @@ -38052,6 +38142,107 @@ }; + /** + * @author benaadams / https://twitter.com/ben_a_adams + */ + + function InstancedBufferGeometry() { + + BufferGeometry.call( this ); + + this.type = 'InstancedBufferGeometry'; + this.maxInstancedCount = undefined; + + } + + InstancedBufferGeometry.prototype = Object.assign( Object.create( BufferGeometry.prototype ), { + + constructor: InstancedBufferGeometry, + + isInstancedBufferGeometry: true, + + copy: function ( source ) { + + BufferGeometry.prototype.copy.call( this, source ); + + this.maxInstancedCount = source.maxInstancedCount; + + return this; + + }, + + clone: function () { + + return new this.constructor().copy( this ); + + }, + + toJSON: function () { + + var data = BufferGeometry.prototype.toJSON.call( this ); + + data.maxInstancedCount = this.maxInstancedCount; + + data.isInstancedBufferGeometry = true; + + return data; + + } + + } ); + + /** + * @author benaadams / https://twitter.com/ben_a_adams + */ + + function InstancedBufferAttribute( array, itemSize, normalized, meshPerAttribute ) { + + if ( typeof ( normalized ) === 'number' ) { + + meshPerAttribute = normalized; + + normalized = false; + + console.error( 'THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.' ); + + } + + BufferAttribute.call( this, array, itemSize, normalized ); + + this.meshPerAttribute = meshPerAttribute || 1; + + } + + InstancedBufferAttribute.prototype = Object.assign( Object.create( BufferAttribute.prototype ), { + + constructor: InstancedBufferAttribute, + + isInstancedBufferAttribute: true, + + copy: function ( source ) { + + BufferAttribute.prototype.copy.call( this, source ); + + this.meshPerAttribute = source.meshPerAttribute; + + return this; + + }, + + toJSON: function () { + + var data = BufferAttribute.prototype.toJSON.call( this ); + + data.meshPerAttribute = this.meshPerAttribute; + + data.isInstancedBufferAttribute = true; + + return data; + + } + + } ); + /** * @author mrdoob / http://mrdoob.com/ */ @@ -38080,7 +38271,7 @@ parse: function ( json ) { - var geometry = new BufferGeometry(); + var geometry = json.isInstancedBufferGeometry ? new InstancedBufferGeometry() : new BufferGeometry(); var index = json.data.index; @@ -38097,8 +38288,8 @@ var attribute = attributes[ key ]; var typedArray = new TYPED_ARRAYS[ attribute.type ]( attribute.array ); - - var bufferAttribute = new BufferAttribute( typedArray, attribute.itemSize, attribute.normalized ); + var bufferAttributeConstr = attribute.isInstancedBufferAttribute ? InstancedBufferAttribute : BufferAttribute; + var bufferAttribute = new bufferAttributeConstr( typedArray, attribute.itemSize, attribute.normalized ); if ( attribute.name !== undefined ) bufferAttribute.name = attribute.name; geometry.addAttribute( key, bufferAttribute ); @@ -38566,6 +38757,7 @@ break; case 'BufferGeometry': + case 'InstancedBufferGeometry': geometry = bufferGeometryLoader.parse( data ); @@ -41269,6 +41461,7 @@ Audio.call( this, listener ); this.panner = this.context.createPanner(); + this.panner.panningModel = 'HRTF'; this.panner.connect( this.gain ); } @@ -43243,11 +43436,19 @@ time = 0; - } else break handle_stop; + } else { + + this.time = time; + + break handle_stop; + + } if ( this.clampWhenFinished ) this.paused = true; else this.enabled = false; + this.time = time; + this._mixer.dispatchEvent( { type: 'finished', action: this, direction: deltaTime < 0 ? - 1 : 1 @@ -43299,6 +43500,8 @@ time = deltaTime > 0 ? duration : 0; + this.time = time; + this._mixer.dispatchEvent( { type: 'finished', action: this, direction: deltaTime > 0 ? 1 : - 1 @@ -43323,26 +43526,30 @@ this._loopCount = loopCount; + this.time = time; + this._mixer.dispatchEvent( { type: 'loop', action: this, loopDelta: loopDelta } ); } + } else { + + this.time = time; + } if ( pingPong && ( loopCount & 1 ) === 1 ) { // invert time for the "pong round" - this.time = time; return duration - time; } } - this.time = time; return time; }, @@ -44185,43 +44392,6 @@ }; - /** - * @author benaadams / https://twitter.com/ben_a_adams - */ - - function InstancedBufferGeometry() { - - BufferGeometry.call( this ); - - this.type = 'InstancedBufferGeometry'; - this.maxInstancedCount = undefined; - - } - - InstancedBufferGeometry.prototype = Object.assign( Object.create( BufferGeometry.prototype ), { - - constructor: InstancedBufferGeometry, - - isInstancedBufferGeometry: true, - - copy: function ( source ) { - - BufferGeometry.prototype.copy.call( this, source ); - - this.maxInstancedCount = source.maxInstancedCount; - - return this; - - }, - - clone: function () { - - return new this.constructor().copy( this ); - - } - - } ); - /** * @author benaadams / https://twitter.com/ben_a_adams */ @@ -44252,46 +44422,6 @@ } ); - /** - * @author benaadams / https://twitter.com/ben_a_adams - */ - - function InstancedBufferAttribute( array, itemSize, normalized, meshPerAttribute ) { - - if ( typeof ( normalized ) === 'number' ) { - - meshPerAttribute = normalized; - - normalized = false; - - console.error( 'THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.' ); - - } - - BufferAttribute.call( this, array, itemSize, normalized ); - - this.meshPerAttribute = meshPerAttribute || 1; - - } - - InstancedBufferAttribute.prototype = Object.assign( Object.create( BufferAttribute.prototype ), { - - constructor: InstancedBufferAttribute, - - isInstancedBufferAttribute: true, - - copy: function ( source ) { - - BufferAttribute.prototype.copy.call( this, source ); - - this.meshPerAttribute = source.meshPerAttribute; - - return this; - - } - - } ); - /** * @author mrdoob / http://mrdoob.com/ * @author bhouston / http://clara.io/ @@ -48559,34 +48689,6 @@ // - function Projector() { - - console.error( 'THREE.Projector has been moved to /examples/js/renderers/Projector.js.' ); - - this.projectVector = function ( vector, camera ) { - - console.warn( 'THREE.Projector: .projectVector() is now vector.project().' ); - vector.project( camera ); - - }; - - this.unprojectVector = function ( vector, camera ) { - - console.warn( 'THREE.Projector: .unprojectVector() is now vector.unproject().' ); - vector.unproject( camera ); - - }; - - this.pickingRay = function () { - - console.error( 'THREE.Projector: .pickingRay() is now raycaster.setFromCamera().' ); - - }; - - } - - // - function CanvasRenderer() { console.error( 'THREE.CanvasRenderer has been removed' ); @@ -48633,345 +48735,290 @@ } - exports.WebGLMultisampleRenderTarget = WebGLMultisampleRenderTarget; - exports.WebGLRenderTargetCube = WebGLRenderTargetCube; - exports.WebGLRenderTarget = WebGLRenderTarget; - exports.WebGLRenderer = WebGLRenderer; - exports.ShaderLib = ShaderLib; - exports.UniformsLib = UniformsLib; - exports.UniformsUtils = UniformsUtils; - exports.ShaderChunk = ShaderChunk; - exports.FogExp2 = FogExp2; - exports.Fog = Fog; - exports.Scene = Scene; - exports.Sprite = Sprite; - exports.LOD = LOD; - exports.SkinnedMesh = SkinnedMesh; - exports.Skeleton = Skeleton; - exports.Bone = Bone; - exports.Mesh = Mesh; - exports.LineSegments = LineSegments; - exports.LineLoop = LineLoop; - exports.Line = Line; - exports.Points = Points; - exports.Group = Group; - exports.VideoTexture = VideoTexture; - exports.DataTexture = DataTexture; - exports.DataTexture2DArray = DataTexture2DArray; - exports.DataTexture3D = DataTexture3D; - exports.CompressedTexture = CompressedTexture; - exports.CubeTexture = CubeTexture; - exports.CanvasTexture = CanvasTexture; - exports.DepthTexture = DepthTexture; - exports.Texture = Texture; - exports.AnimationLoader = AnimationLoader; - exports.CompressedTextureLoader = CompressedTextureLoader; - exports.DataTextureLoader = DataTextureLoader; - exports.CubeTextureLoader = CubeTextureLoader; - exports.TextureLoader = TextureLoader; - exports.ObjectLoader = ObjectLoader; - exports.MaterialLoader = MaterialLoader; - exports.BufferGeometryLoader = BufferGeometryLoader; - exports.DefaultLoadingManager = DefaultLoadingManager; - exports.LoadingManager = LoadingManager; - exports.ImageLoader = ImageLoader; - exports.ImageBitmapLoader = ImageBitmapLoader; - exports.FontLoader = FontLoader; - exports.FileLoader = FileLoader; - exports.Loader = Loader; - exports.LoaderUtils = LoaderUtils; - exports.Cache = Cache; - exports.AudioLoader = AudioLoader; - exports.SpotLightShadow = SpotLightShadow; - exports.SpotLight = SpotLight; - exports.PointLight = PointLight; - exports.RectAreaLight = RectAreaLight; - exports.HemisphereLight = HemisphereLight; - exports.HemisphereLightProbe = HemisphereLightProbe; - exports.DirectionalLightShadow = DirectionalLightShadow; - exports.DirectionalLight = DirectionalLight; + exports.ACESFilmicToneMapping = ACESFilmicToneMapping; + exports.AddEquation = AddEquation; + exports.AddOperation = AddOperation; + exports.AdditiveBlending = AdditiveBlending; + exports.AlphaFormat = AlphaFormat; + exports.AlwaysDepth = AlwaysDepth; exports.AmbientLight = AmbientLight; exports.AmbientLightProbe = AmbientLightProbe; - exports.LightShadow = LightShadow; - exports.Light = Light; - exports.LightProbe = LightProbe; - exports.StereoCamera = StereoCamera; - exports.PerspectiveCamera = PerspectiveCamera; - exports.OrthographicCamera = OrthographicCamera; - exports.CubeCamera = CubeCamera; + exports.AnimationClip = AnimationClip; + exports.AnimationLoader = AnimationLoader; + exports.AnimationMixer = AnimationMixer; + exports.AnimationObjectGroup = AnimationObjectGroup; + exports.AnimationUtils = AnimationUtils; + exports.ArcCurve = ArcCurve; exports.ArrayCamera = ArrayCamera; - exports.Camera = Camera; - exports.AudioListener = AudioListener; - exports.PositionalAudio = PositionalAudio; - exports.AudioContext = AudioContext; - exports.AudioAnalyser = AudioAnalyser; + exports.ArrowHelper = ArrowHelper; exports.Audio = Audio; - exports.VectorKeyframeTrack = VectorKeyframeTrack; - exports.StringKeyframeTrack = StringKeyframeTrack; - exports.QuaternionKeyframeTrack = QuaternionKeyframeTrack; - exports.NumberKeyframeTrack = NumberKeyframeTrack; - exports.ColorKeyframeTrack = ColorKeyframeTrack; + exports.AudioAnalyser = AudioAnalyser; + exports.AudioContext = AudioContext; + exports.AudioListener = AudioListener; + exports.AudioLoader = AudioLoader; + exports.AxesHelper = AxesHelper; + exports.AxisHelper = AxisHelper; + exports.BackSide = BackSide; + exports.BasicDepthPacking = BasicDepthPacking; + exports.BasicShadowMap = BasicShadowMap; + exports.BinaryTextureLoader = BinaryTextureLoader; + exports.Bone = Bone; exports.BooleanKeyframeTrack = BooleanKeyframeTrack; - exports.PropertyMixer = PropertyMixer; - exports.PropertyBinding = PropertyBinding; - exports.KeyframeTrack = KeyframeTrack; - exports.AnimationUtils = AnimationUtils; - exports.AnimationObjectGroup = AnimationObjectGroup; - exports.AnimationMixer = AnimationMixer; - exports.AnimationClip = AnimationClip; - exports.Uniform = Uniform; - exports.InstancedBufferGeometry = InstancedBufferGeometry; - exports.BufferGeometry = BufferGeometry; - exports.Geometry = Geometry; - exports.InterleavedBufferAttribute = InterleavedBufferAttribute; - exports.InstancedInterleavedBuffer = InstancedInterleavedBuffer; - exports.InterleavedBuffer = InterleavedBuffer; - exports.InstancedBufferAttribute = InstancedBufferAttribute; - exports.Face3 = Face3; - exports.Object3D = Object3D; - exports.Raycaster = Raycaster; - exports.Layers = Layers; - exports.EventDispatcher = EventDispatcher; - exports.Clock = Clock; - exports.QuaternionLinearInterpolant = QuaternionLinearInterpolant; - exports.LinearInterpolant = LinearInterpolant; - exports.DiscreteInterpolant = DiscreteInterpolant; - exports.CubicInterpolant = CubicInterpolant; - exports.Interpolant = Interpolant; - exports.Triangle = Triangle; - exports.Math = _Math; - exports.Spherical = Spherical; - exports.Cylindrical = Cylindrical; - exports.Plane = Plane; - exports.Frustum = Frustum; - exports.Sphere = Sphere; - exports.Ray = Ray; - exports.Matrix4 = Matrix4; - exports.Matrix3 = Matrix3; - exports.Box3 = Box3; + exports.BoundingBoxHelper = BoundingBoxHelper; exports.Box2 = Box2; - exports.Line3 = Line3; - exports.Euler = Euler; - exports.Vector4 = Vector4; - exports.Vector3 = Vector3; - exports.Vector2 = Vector2; - exports.Quaternion = Quaternion; - exports.Color = Color; - exports.SphericalHarmonics3 = SphericalHarmonics3; - exports.ImmediateRenderObject = ImmediateRenderObject; - exports.VertexNormalsHelper = VertexNormalsHelper; - exports.SpotLightHelper = SpotLightHelper; - exports.SkeletonHelper = SkeletonHelper; - exports.PointLightHelper = PointLightHelper; - exports.RectAreaLightHelper = RectAreaLightHelper; - exports.HemisphereLightHelper = HemisphereLightHelper; - exports.LightProbeHelper = LightProbeHelper; - exports.GridHelper = GridHelper; - exports.PolarGridHelper = PolarGridHelper; - exports.PositionalAudioHelper = PositionalAudioHelper; - exports.FaceNormalsHelper = FaceNormalsHelper; - exports.DirectionalLightHelper = DirectionalLightHelper; - exports.CameraHelper = CameraHelper; - exports.BoxHelper = BoxHelper; + exports.Box3 = Box3; exports.Box3Helper = Box3Helper; - exports.PlaneHelper = PlaneHelper; - exports.ArrowHelper = ArrowHelper; - exports.AxesHelper = AxesHelper; - exports.Shape = Shape; - exports.Path = Path; - exports.ShapePath = ShapePath; - exports.Font = Font; - exports.CurvePath = CurvePath; - exports.Curve = Curve; - exports.ImageUtils = ImageUtils; - exports.ShapeUtils = ShapeUtils; - exports.WebGLUtils = WebGLUtils; - exports.WireframeGeometry = WireframeGeometry; - exports.ParametricGeometry = ParametricGeometry; - exports.ParametricBufferGeometry = ParametricBufferGeometry; - exports.TetrahedronGeometry = TetrahedronGeometry; - exports.TetrahedronBufferGeometry = TetrahedronBufferGeometry; - exports.OctahedronGeometry = OctahedronGeometry; - exports.OctahedronBufferGeometry = OctahedronBufferGeometry; - exports.IcosahedronGeometry = IcosahedronGeometry; - exports.IcosahedronBufferGeometry = IcosahedronBufferGeometry; - exports.DodecahedronGeometry = DodecahedronGeometry; - exports.DodecahedronBufferGeometry = DodecahedronBufferGeometry; - exports.PolyhedronGeometry = PolyhedronGeometry; - exports.PolyhedronBufferGeometry = PolyhedronBufferGeometry; - exports.TubeGeometry = TubeGeometry; - exports.TubeBufferGeometry = TubeBufferGeometry; - exports.TorusKnotGeometry = TorusKnotGeometry; - exports.TorusKnotBufferGeometry = TorusKnotBufferGeometry; - exports.TorusGeometry = TorusGeometry; - exports.TorusBufferGeometry = TorusBufferGeometry; - exports.TextGeometry = TextGeometry; - exports.TextBufferGeometry = TextBufferGeometry; - exports.SphereGeometry = SphereGeometry; - exports.SphereBufferGeometry = SphereBufferGeometry; - exports.RingGeometry = RingGeometry; - exports.RingBufferGeometry = RingBufferGeometry; - exports.PlaneGeometry = PlaneGeometry; - exports.PlaneBufferGeometry = PlaneBufferGeometry; - exports.LatheGeometry = LatheGeometry; - exports.LatheBufferGeometry = LatheBufferGeometry; - exports.ShapeGeometry = ShapeGeometry; - exports.ShapeBufferGeometry = ShapeBufferGeometry; - exports.ExtrudeGeometry = ExtrudeGeometry; - exports.ExtrudeBufferGeometry = ExtrudeBufferGeometry; - exports.EdgesGeometry = EdgesGeometry; - exports.ConeGeometry = ConeGeometry; - exports.ConeBufferGeometry = ConeBufferGeometry; - exports.CylinderGeometry = CylinderGeometry; - exports.CylinderBufferGeometry = CylinderBufferGeometry; - exports.CircleGeometry = CircleGeometry; - exports.CircleBufferGeometry = CircleBufferGeometry; - exports.BoxGeometry = BoxGeometry; - exports.CubeGeometry = BoxGeometry; exports.BoxBufferGeometry = BoxBufferGeometry; - exports.ShadowMaterial = ShadowMaterial; - exports.SpriteMaterial = SpriteMaterial; - exports.RawShaderMaterial = RawShaderMaterial; - exports.ShaderMaterial = ShaderMaterial; - exports.PointsMaterial = PointsMaterial; - exports.MeshPhysicalMaterial = MeshPhysicalMaterial; - exports.MeshStandardMaterial = MeshStandardMaterial; - exports.MeshPhongMaterial = MeshPhongMaterial; - exports.MeshToonMaterial = MeshToonMaterial; - exports.MeshNormalMaterial = MeshNormalMaterial; - exports.MeshLambertMaterial = MeshLambertMaterial; - exports.MeshDepthMaterial = MeshDepthMaterial; - exports.MeshDistanceMaterial = MeshDistanceMaterial; - exports.MeshBasicMaterial = MeshBasicMaterial; - exports.MeshMatcapMaterial = MeshMatcapMaterial; - exports.LineDashedMaterial = LineDashedMaterial; - exports.LineBasicMaterial = LineBasicMaterial; - exports.Material = Material; - exports.Float64BufferAttribute = Float64BufferAttribute; - exports.Float32BufferAttribute = Float32BufferAttribute; - exports.Uint32BufferAttribute = Uint32BufferAttribute; - exports.Int32BufferAttribute = Int32BufferAttribute; - exports.Uint16BufferAttribute = Uint16BufferAttribute; - exports.Int16BufferAttribute = Int16BufferAttribute; - exports.Uint8ClampedBufferAttribute = Uint8ClampedBufferAttribute; - exports.Uint8BufferAttribute = Uint8BufferAttribute; - exports.Int8BufferAttribute = Int8BufferAttribute; + exports.BoxGeometry = BoxGeometry; + exports.BoxHelper = BoxHelper; exports.BufferAttribute = BufferAttribute; - exports.ArcCurve = ArcCurve; + exports.BufferGeometry = BufferGeometry; + exports.BufferGeometryLoader = BufferGeometryLoader; + exports.ByteType = ByteType; + exports.Cache = Cache; + exports.Camera = Camera; + exports.CameraHelper = CameraHelper; + exports.CanvasRenderer = CanvasRenderer; + exports.CanvasTexture = CanvasTexture; exports.CatmullRomCurve3 = CatmullRomCurve3; + exports.CineonToneMapping = CineonToneMapping; + exports.CircleBufferGeometry = CircleBufferGeometry; + exports.CircleGeometry = CircleGeometry; + exports.ClampToEdgeWrapping = ClampToEdgeWrapping; + exports.Clock = Clock; + exports.ClosedSplineCurve3 = ClosedSplineCurve3; + exports.Color = Color; + exports.ColorKeyframeTrack = ColorKeyframeTrack; + exports.CompressedTexture = CompressedTexture; + exports.CompressedTextureLoader = CompressedTextureLoader; + exports.ConeBufferGeometry = ConeBufferGeometry; + exports.ConeGeometry = ConeGeometry; + exports.CubeCamera = CubeCamera; + exports.CubeGeometry = BoxGeometry; + exports.CubeReflectionMapping = CubeReflectionMapping; + exports.CubeRefractionMapping = CubeRefractionMapping; + exports.CubeTexture = CubeTexture; + exports.CubeTextureLoader = CubeTextureLoader; + exports.CubeUVReflectionMapping = CubeUVReflectionMapping; + exports.CubeUVRefractionMapping = CubeUVRefractionMapping; exports.CubicBezierCurve = CubicBezierCurve; exports.CubicBezierCurve3 = CubicBezierCurve3; - exports.EllipseCurve = EllipseCurve; - exports.LineCurve = LineCurve; - exports.LineCurve3 = LineCurve3; - exports.QuadraticBezierCurve = QuadraticBezierCurve; - exports.QuadraticBezierCurve3 = QuadraticBezierCurve3; - exports.SplineCurve = SplineCurve; - exports.REVISION = REVISION; - exports.MOUSE = MOUSE; - exports.CullFaceNone = CullFaceNone; + exports.CubicInterpolant = CubicInterpolant; exports.CullFaceBack = CullFaceBack; exports.CullFaceFront = CullFaceFront; exports.CullFaceFrontBack = CullFaceFrontBack; - exports.FrontFaceDirectionCW = FrontFaceDirectionCW; - exports.FrontFaceDirectionCCW = FrontFaceDirectionCCW; - exports.BasicShadowMap = BasicShadowMap; - exports.PCFShadowMap = PCFShadowMap; - exports.PCFSoftShadowMap = PCFSoftShadowMap; - exports.FrontSide = FrontSide; - exports.BackSide = BackSide; - exports.DoubleSide = DoubleSide; - exports.FlatShading = FlatShading; - exports.SmoothShading = SmoothShading; - exports.NoColors = NoColors; - exports.FaceColors = FaceColors; - exports.VertexColors = VertexColors; - exports.NoBlending = NoBlending; - exports.NormalBlending = NormalBlending; - exports.AdditiveBlending = AdditiveBlending; - exports.SubtractiveBlending = SubtractiveBlending; - exports.MultiplyBlending = MultiplyBlending; + exports.CullFaceNone = CullFaceNone; + exports.Curve = Curve; + exports.CurvePath = CurvePath; exports.CustomBlending = CustomBlending; - exports.AddEquation = AddEquation; - exports.SubtractEquation = SubtractEquation; - exports.ReverseSubtractEquation = ReverseSubtractEquation; - exports.MinEquation = MinEquation; - exports.MaxEquation = MaxEquation; - exports.ZeroFactor = ZeroFactor; - exports.OneFactor = OneFactor; - exports.SrcColorFactor = SrcColorFactor; - exports.OneMinusSrcColorFactor = OneMinusSrcColorFactor; - exports.SrcAlphaFactor = SrcAlphaFactor; - exports.OneMinusSrcAlphaFactor = OneMinusSrcAlphaFactor; + exports.CylinderBufferGeometry = CylinderBufferGeometry; + exports.CylinderGeometry = CylinderGeometry; + exports.Cylindrical = Cylindrical; + exports.DataTexture = DataTexture; + exports.DataTexture2DArray = DataTexture2DArray; + exports.DataTexture3D = DataTexture3D; + exports.DataTextureLoader = DataTextureLoader; + exports.DefaultLoadingManager = DefaultLoadingManager; + exports.DepthFormat = DepthFormat; + exports.DepthStencilFormat = DepthStencilFormat; + exports.DepthTexture = DepthTexture; + exports.DirectionalLight = DirectionalLight; + exports.DirectionalLightHelper = DirectionalLightHelper; + exports.DirectionalLightShadow = DirectionalLightShadow; + exports.DiscreteInterpolant = DiscreteInterpolant; + exports.DodecahedronBufferGeometry = DodecahedronBufferGeometry; + exports.DodecahedronGeometry = DodecahedronGeometry; + exports.DoubleSide = DoubleSide; exports.DstAlphaFactor = DstAlphaFactor; - exports.OneMinusDstAlphaFactor = OneMinusDstAlphaFactor; exports.DstColorFactor = DstColorFactor; - exports.OneMinusDstColorFactor = OneMinusDstColorFactor; - exports.SrcAlphaSaturateFactor = SrcAlphaSaturateFactor; - exports.NeverDepth = NeverDepth; - exports.AlwaysDepth = AlwaysDepth; - exports.LessDepth = LessDepth; - exports.LessEqualDepth = LessEqualDepth; + exports.DynamicBufferAttribute = DynamicBufferAttribute; + exports.EdgesGeometry = EdgesGeometry; + exports.EdgesHelper = EdgesHelper; + exports.EllipseCurve = EllipseCurve; exports.EqualDepth = EqualDepth; - exports.GreaterEqualDepth = GreaterEqualDepth; - exports.GreaterDepth = GreaterDepth; - exports.NotEqualDepth = NotEqualDepth; - exports.MultiplyOperation = MultiplyOperation; - exports.MixOperation = MixOperation; - exports.AddOperation = AddOperation; - exports.NoToneMapping = NoToneMapping; - exports.LinearToneMapping = LinearToneMapping; - exports.ReinhardToneMapping = ReinhardToneMapping; - exports.Uncharted2ToneMapping = Uncharted2ToneMapping; - exports.CineonToneMapping = CineonToneMapping; - exports.ACESFilmicToneMapping = ACESFilmicToneMapping; - exports.UVMapping = UVMapping; - exports.CubeReflectionMapping = CubeReflectionMapping; - exports.CubeRefractionMapping = CubeRefractionMapping; exports.EquirectangularReflectionMapping = EquirectangularReflectionMapping; exports.EquirectangularRefractionMapping = EquirectangularRefractionMapping; - exports.SphericalReflectionMapping = SphericalReflectionMapping; - exports.CubeUVReflectionMapping = CubeUVReflectionMapping; - exports.CubeUVRefractionMapping = CubeUVRefractionMapping; - exports.RepeatWrapping = RepeatWrapping; - exports.ClampToEdgeWrapping = ClampToEdgeWrapping; + exports.Euler = Euler; + exports.EventDispatcher = EventDispatcher; + exports.ExtrudeBufferGeometry = ExtrudeBufferGeometry; + exports.ExtrudeGeometry = ExtrudeGeometry; + exports.Face3 = Face3; + exports.Face4 = Face4; + exports.FaceColors = FaceColors; + exports.FaceNormalsHelper = FaceNormalsHelper; + exports.FileLoader = FileLoader; + exports.FlatShading = FlatShading; + exports.Float32Attribute = Float32Attribute; + exports.Float32BufferAttribute = Float32BufferAttribute; + exports.Float64Attribute = Float64Attribute; + exports.Float64BufferAttribute = Float64BufferAttribute; + exports.FloatType = FloatType; + exports.Fog = Fog; + exports.FogExp2 = FogExp2; + exports.Font = Font; + exports.FontLoader = FontLoader; + exports.FrontFaceDirectionCCW = FrontFaceDirectionCCW; + exports.FrontFaceDirectionCW = FrontFaceDirectionCW; + exports.FrontSide = FrontSide; + exports.Frustum = Frustum; + exports.GammaEncoding = GammaEncoding; + exports.Geometry = Geometry; + exports.GeometryUtils = GeometryUtils; + exports.GreaterDepth = GreaterDepth; + exports.GreaterEqualDepth = GreaterEqualDepth; + exports.GridHelper = GridHelper; + exports.Group = Group; + exports.HalfFloatType = HalfFloatType; + exports.HemisphereLight = HemisphereLight; + exports.HemisphereLightHelper = HemisphereLightHelper; + exports.HemisphereLightProbe = HemisphereLightProbe; + exports.IcosahedronBufferGeometry = IcosahedronBufferGeometry; + exports.IcosahedronGeometry = IcosahedronGeometry; + exports.ImageBitmapLoader = ImageBitmapLoader; + exports.ImageLoader = ImageLoader; + exports.ImageUtils = ImageUtils; + exports.ImmediateRenderObject = ImmediateRenderObject; + exports.InstancedBufferAttribute = InstancedBufferAttribute; + exports.InstancedBufferGeometry = InstancedBufferGeometry; + exports.InstancedInterleavedBuffer = InstancedInterleavedBuffer; + exports.Int16Attribute = Int16Attribute; + exports.Int16BufferAttribute = Int16BufferAttribute; + exports.Int32Attribute = Int32Attribute; + exports.Int32BufferAttribute = Int32BufferAttribute; + exports.Int8Attribute = Int8Attribute; + exports.Int8BufferAttribute = Int8BufferAttribute; + exports.IntType = IntType; + exports.InterleavedBuffer = InterleavedBuffer; + exports.InterleavedBufferAttribute = InterleavedBufferAttribute; + exports.Interpolant = Interpolant; + exports.InterpolateDiscrete = InterpolateDiscrete; + exports.InterpolateLinear = InterpolateLinear; + exports.InterpolateSmooth = InterpolateSmooth; + exports.JSONLoader = JSONLoader; + exports.KeyframeTrack = KeyframeTrack; + exports.LOD = LOD; + exports.LatheBufferGeometry = LatheBufferGeometry; + exports.LatheGeometry = LatheGeometry; + exports.Layers = Layers; + exports.LensFlare = LensFlare; + exports.LessDepth = LessDepth; + exports.LessEqualDepth = LessEqualDepth; + exports.Light = Light; + exports.LightProbe = LightProbe; + exports.LightProbeHelper = LightProbeHelper; + exports.LightShadow = LightShadow; + exports.Line = Line; + exports.Line3 = Line3; + exports.LineBasicMaterial = LineBasicMaterial; + exports.LineCurve = LineCurve; + exports.LineCurve3 = LineCurve3; + exports.LineDashedMaterial = LineDashedMaterial; + exports.LineLoop = LineLoop; + exports.LinePieces = LinePieces; + exports.LineSegments = LineSegments; + exports.LineStrip = LineStrip; + exports.LinearEncoding = LinearEncoding; + exports.LinearFilter = LinearFilter; + exports.LinearInterpolant = LinearInterpolant; + exports.LinearMipMapLinearFilter = LinearMipMapLinearFilter; + exports.LinearMipMapNearestFilter = LinearMipMapNearestFilter; + exports.LinearToneMapping = LinearToneMapping; + exports.Loader = Loader; + exports.LoaderUtils = LoaderUtils; + exports.LoadingManager = LoadingManager; + exports.LogLuvEncoding = LogLuvEncoding; + exports.LoopOnce = LoopOnce; + exports.LoopPingPong = LoopPingPong; + exports.LoopRepeat = LoopRepeat; + exports.LuminanceAlphaFormat = LuminanceAlphaFormat; + exports.LuminanceFormat = LuminanceFormat; + exports.MOUSE = MOUSE; + exports.Material = Material; + exports.MaterialLoader = MaterialLoader; + exports.Math = _Math; + exports.Matrix3 = Matrix3; + exports.Matrix4 = Matrix4; + exports.MaxEquation = MaxEquation; + exports.Mesh = Mesh; + exports.MeshBasicMaterial = MeshBasicMaterial; + exports.MeshDepthMaterial = MeshDepthMaterial; + exports.MeshDistanceMaterial = MeshDistanceMaterial; + exports.MeshFaceMaterial = MeshFaceMaterial; + exports.MeshLambertMaterial = MeshLambertMaterial; + exports.MeshMatcapMaterial = MeshMatcapMaterial; + exports.MeshNormalMaterial = MeshNormalMaterial; + exports.MeshPhongMaterial = MeshPhongMaterial; + exports.MeshPhysicalMaterial = MeshPhysicalMaterial; + exports.MeshStandardMaterial = MeshStandardMaterial; + exports.MeshToonMaterial = MeshToonMaterial; + exports.MinEquation = MinEquation; exports.MirroredRepeatWrapping = MirroredRepeatWrapping; + exports.MixOperation = MixOperation; + exports.MultiMaterial = MultiMaterial; + exports.MultiplyBlending = MultiplyBlending; + exports.MultiplyOperation = MultiplyOperation; exports.NearestFilter = NearestFilter; - exports.NearestMipMapNearestFilter = NearestMipMapNearestFilter; exports.NearestMipMapLinearFilter = NearestMipMapLinearFilter; - exports.LinearFilter = LinearFilter; - exports.LinearMipMapNearestFilter = LinearMipMapNearestFilter; - exports.LinearMipMapLinearFilter = LinearMipMapLinearFilter; - exports.UnsignedByteType = UnsignedByteType; - exports.ByteType = ByteType; - exports.ShortType = ShortType; - exports.UnsignedShortType = UnsignedShortType; - exports.IntType = IntType; - exports.UnsignedIntType = UnsignedIntType; - exports.FloatType = FloatType; - exports.HalfFloatType = HalfFloatType; - exports.UnsignedShort4444Type = UnsignedShort4444Type; - exports.UnsignedShort5551Type = UnsignedShort5551Type; - exports.UnsignedShort565Type = UnsignedShort565Type; - exports.UnsignedInt248Type = UnsignedInt248Type; - exports.AlphaFormat = AlphaFormat; - exports.RGBFormat = RGBFormat; + exports.NearestMipMapNearestFilter = NearestMipMapNearestFilter; + exports.NeverDepth = NeverDepth; + exports.NoBlending = NoBlending; + exports.NoColors = NoColors; + exports.NoToneMapping = NoToneMapping; + exports.NormalBlending = NormalBlending; + exports.NotEqualDepth = NotEqualDepth; + exports.NumberKeyframeTrack = NumberKeyframeTrack; + exports.Object3D = Object3D; + exports.ObjectLoader = ObjectLoader; + exports.ObjectSpaceNormalMap = ObjectSpaceNormalMap; + exports.OctahedronBufferGeometry = OctahedronBufferGeometry; + exports.OctahedronGeometry = OctahedronGeometry; + exports.OneFactor = OneFactor; + exports.OneMinusDstAlphaFactor = OneMinusDstAlphaFactor; + exports.OneMinusDstColorFactor = OneMinusDstColorFactor; + exports.OneMinusSrcAlphaFactor = OneMinusSrcAlphaFactor; + exports.OneMinusSrcColorFactor = OneMinusSrcColorFactor; + exports.OrthographicCamera = OrthographicCamera; + exports.PCFShadowMap = PCFShadowMap; + exports.PCFSoftShadowMap = PCFSoftShadowMap; + exports.ParametricBufferGeometry = ParametricBufferGeometry; + exports.ParametricGeometry = ParametricGeometry; + exports.Particle = Particle; + exports.ParticleBasicMaterial = ParticleBasicMaterial; + exports.ParticleSystem = ParticleSystem; + exports.ParticleSystemMaterial = ParticleSystemMaterial; + exports.Path = Path; + exports.PerspectiveCamera = PerspectiveCamera; + exports.Plane = Plane; + exports.PlaneBufferGeometry = PlaneBufferGeometry; + exports.PlaneGeometry = PlaneGeometry; + exports.PlaneHelper = PlaneHelper; + exports.PointCloud = PointCloud; + exports.PointCloudMaterial = PointCloudMaterial; + exports.PointLight = PointLight; + exports.PointLightHelper = PointLightHelper; + exports.Points = Points; + exports.PointsMaterial = PointsMaterial; + exports.PolarGridHelper = PolarGridHelper; + exports.PolyhedronBufferGeometry = PolyhedronBufferGeometry; + exports.PolyhedronGeometry = PolyhedronGeometry; + exports.PositionalAudio = PositionalAudio; + exports.PositionalAudioHelper = PositionalAudioHelper; + exports.PropertyBinding = PropertyBinding; + exports.PropertyMixer = PropertyMixer; + exports.QuadraticBezierCurve = QuadraticBezierCurve; + exports.QuadraticBezierCurve3 = QuadraticBezierCurve3; + exports.Quaternion = Quaternion; + exports.QuaternionKeyframeTrack = QuaternionKeyframeTrack; + exports.QuaternionLinearInterpolant = QuaternionLinearInterpolant; + exports.REVISION = REVISION; + exports.RGBADepthPacking = RGBADepthPacking; exports.RGBAFormat = RGBAFormat; - exports.LuminanceFormat = LuminanceFormat; - exports.LuminanceAlphaFormat = LuminanceAlphaFormat; - exports.RGBEFormat = RGBEFormat; - exports.DepthFormat = DepthFormat; - exports.DepthStencilFormat = DepthStencilFormat; - exports.RedFormat = RedFormat; - exports.RGB_S3TC_DXT1_Format = RGB_S3TC_DXT1_Format; - exports.RGBA_S3TC_DXT1_Format = RGBA_S3TC_DXT1_Format; - exports.RGBA_S3TC_DXT3_Format = RGBA_S3TC_DXT3_Format; - exports.RGBA_S3TC_DXT5_Format = RGBA_S3TC_DXT5_Format; - exports.RGB_PVRTC_4BPPV1_Format = RGB_PVRTC_4BPPV1_Format; - exports.RGB_PVRTC_2BPPV1_Format = RGB_PVRTC_2BPPV1_Format; - exports.RGBA_PVRTC_4BPPV1_Format = RGBA_PVRTC_4BPPV1_Format; - exports.RGBA_PVRTC_2BPPV1_Format = RGBA_PVRTC_2BPPV1_Format; - exports.RGB_ETC1_Format = RGB_ETC1_Format; + exports.RGBA_ASTC_10x10_Format = RGBA_ASTC_10x10_Format; + exports.RGBA_ASTC_10x5_Format = RGBA_ASTC_10x5_Format; + exports.RGBA_ASTC_10x6_Format = RGBA_ASTC_10x6_Format; + exports.RGBA_ASTC_10x8_Format = RGBA_ASTC_10x8_Format; + exports.RGBA_ASTC_12x10_Format = RGBA_ASTC_12x10_Format; + exports.RGBA_ASTC_12x12_Format = RGBA_ASTC_12x12_Format; exports.RGBA_ASTC_4x4_Format = RGBA_ASTC_4x4_Format; exports.RGBA_ASTC_5x4_Format = RGBA_ASTC_5x4_Format; exports.RGBA_ASTC_5x5_Format = RGBA_ASTC_5x5_Format; @@ -48980,73 +49027,127 @@ exports.RGBA_ASTC_8x5_Format = RGBA_ASTC_8x5_Format; exports.RGBA_ASTC_8x6_Format = RGBA_ASTC_8x6_Format; exports.RGBA_ASTC_8x8_Format = RGBA_ASTC_8x8_Format; - exports.RGBA_ASTC_10x5_Format = RGBA_ASTC_10x5_Format; - exports.RGBA_ASTC_10x6_Format = RGBA_ASTC_10x6_Format; - exports.RGBA_ASTC_10x8_Format = RGBA_ASTC_10x8_Format; - exports.RGBA_ASTC_10x10_Format = RGBA_ASTC_10x10_Format; - exports.RGBA_ASTC_12x10_Format = RGBA_ASTC_12x10_Format; - exports.RGBA_ASTC_12x12_Format = RGBA_ASTC_12x12_Format; - exports.LoopOnce = LoopOnce; - exports.LoopRepeat = LoopRepeat; - exports.LoopPingPong = LoopPingPong; - exports.InterpolateDiscrete = InterpolateDiscrete; - exports.InterpolateLinear = InterpolateLinear; - exports.InterpolateSmooth = InterpolateSmooth; - exports.ZeroCurvatureEnding = ZeroCurvatureEnding; - exports.ZeroSlopeEnding = ZeroSlopeEnding; - exports.WrapAroundEnding = WrapAroundEnding; - exports.TrianglesDrawMode = TrianglesDrawMode; - exports.TriangleStripDrawMode = TriangleStripDrawMode; - exports.TriangleFanDrawMode = TriangleFanDrawMode; - exports.LinearEncoding = LinearEncoding; - exports.sRGBEncoding = sRGBEncoding; - exports.GammaEncoding = GammaEncoding; + exports.RGBA_PVRTC_2BPPV1_Format = RGBA_PVRTC_2BPPV1_Format; + exports.RGBA_PVRTC_4BPPV1_Format = RGBA_PVRTC_4BPPV1_Format; + exports.RGBA_S3TC_DXT1_Format = RGBA_S3TC_DXT1_Format; + exports.RGBA_S3TC_DXT3_Format = RGBA_S3TC_DXT3_Format; + exports.RGBA_S3TC_DXT5_Format = RGBA_S3TC_DXT5_Format; + exports.RGBDEncoding = RGBDEncoding; exports.RGBEEncoding = RGBEEncoding; - exports.LogLuvEncoding = LogLuvEncoding; - exports.RGBM7Encoding = RGBM7Encoding; + exports.RGBEFormat = RGBEFormat; + exports.RGBFormat = RGBFormat; exports.RGBM16Encoding = RGBM16Encoding; - exports.RGBDEncoding = RGBDEncoding; - exports.BasicDepthPacking = BasicDepthPacking; - exports.RGBADepthPacking = RGBADepthPacking; + exports.RGBM7Encoding = RGBM7Encoding; + exports.RGB_ETC1_Format = RGB_ETC1_Format; + exports.RGB_PVRTC_2BPPV1_Format = RGB_PVRTC_2BPPV1_Format; + exports.RGB_PVRTC_4BPPV1_Format = RGB_PVRTC_4BPPV1_Format; + exports.RGB_S3TC_DXT1_Format = RGB_S3TC_DXT1_Format; + exports.RawShaderMaterial = RawShaderMaterial; + exports.Ray = Ray; + exports.Raycaster = Raycaster; + exports.RectAreaLight = RectAreaLight; + exports.RectAreaLightHelper = RectAreaLightHelper; + exports.RedFormat = RedFormat; + exports.ReinhardToneMapping = ReinhardToneMapping; + exports.RepeatWrapping = RepeatWrapping; + exports.ReverseSubtractEquation = ReverseSubtractEquation; + exports.RingBufferGeometry = RingBufferGeometry; + exports.RingGeometry = RingGeometry; + exports.Scene = Scene; + exports.SceneUtils = SceneUtils; + exports.ShaderChunk = ShaderChunk; + exports.ShaderLib = ShaderLib; + exports.ShaderMaterial = ShaderMaterial; + exports.ShadowMaterial = ShadowMaterial; + exports.Shape = Shape; + exports.ShapeBufferGeometry = ShapeBufferGeometry; + exports.ShapeGeometry = ShapeGeometry; + exports.ShapePath = ShapePath; + exports.ShapeUtils = ShapeUtils; + exports.ShortType = ShortType; + exports.Skeleton = Skeleton; + exports.SkeletonHelper = SkeletonHelper; + exports.SkinnedMesh = SkinnedMesh; + exports.SmoothShading = SmoothShading; + exports.Sphere = Sphere; + exports.SphereBufferGeometry = SphereBufferGeometry; + exports.SphereGeometry = SphereGeometry; + exports.Spherical = Spherical; + exports.SphericalHarmonics3 = SphericalHarmonics3; + exports.SphericalReflectionMapping = SphericalReflectionMapping; + exports.Spline = Spline; + exports.SplineCurve = SplineCurve; + exports.SplineCurve3 = SplineCurve3; + exports.SpotLight = SpotLight; + exports.SpotLightHelper = SpotLightHelper; + exports.SpotLightShadow = SpotLightShadow; + exports.Sprite = Sprite; + exports.SpriteMaterial = SpriteMaterial; + exports.SrcAlphaFactor = SrcAlphaFactor; + exports.SrcAlphaSaturateFactor = SrcAlphaSaturateFactor; + exports.SrcColorFactor = SrcColorFactor; + exports.StereoCamera = StereoCamera; + exports.StringKeyframeTrack = StringKeyframeTrack; + exports.SubtractEquation = SubtractEquation; + exports.SubtractiveBlending = SubtractiveBlending; exports.TangentSpaceNormalMap = TangentSpaceNormalMap; - exports.ObjectSpaceNormalMap = ObjectSpaceNormalMap; - exports.Face4 = Face4; - exports.LineStrip = LineStrip; - exports.LinePieces = LinePieces; - exports.MeshFaceMaterial = MeshFaceMaterial; - exports.MultiMaterial = MultiMaterial; - exports.PointCloud = PointCloud; - exports.Particle = Particle; - exports.ParticleSystem = ParticleSystem; - exports.PointCloudMaterial = PointCloudMaterial; - exports.ParticleBasicMaterial = ParticleBasicMaterial; - exports.ParticleSystemMaterial = ParticleSystemMaterial; - exports.Vertex = Vertex; - exports.DynamicBufferAttribute = DynamicBufferAttribute; - exports.Int8Attribute = Int8Attribute; - exports.Uint8Attribute = Uint8Attribute; - exports.Uint8ClampedAttribute = Uint8ClampedAttribute; - exports.Int16Attribute = Int16Attribute; + exports.TetrahedronBufferGeometry = TetrahedronBufferGeometry; + exports.TetrahedronGeometry = TetrahedronGeometry; + exports.TextBufferGeometry = TextBufferGeometry; + exports.TextGeometry = TextGeometry; + exports.Texture = Texture; + exports.TextureLoader = TextureLoader; + exports.TorusBufferGeometry = TorusBufferGeometry; + exports.TorusGeometry = TorusGeometry; + exports.TorusKnotBufferGeometry = TorusKnotBufferGeometry; + exports.TorusKnotGeometry = TorusKnotGeometry; + exports.Triangle = Triangle; + exports.TriangleFanDrawMode = TriangleFanDrawMode; + exports.TriangleStripDrawMode = TriangleStripDrawMode; + exports.TrianglesDrawMode = TrianglesDrawMode; + exports.TubeBufferGeometry = TubeBufferGeometry; + exports.TubeGeometry = TubeGeometry; + exports.UVMapping = UVMapping; exports.Uint16Attribute = Uint16Attribute; - exports.Int32Attribute = Int32Attribute; + exports.Uint16BufferAttribute = Uint16BufferAttribute; exports.Uint32Attribute = Uint32Attribute; - exports.Float32Attribute = Float32Attribute; - exports.Float64Attribute = Float64Attribute; - exports.ClosedSplineCurve3 = ClosedSplineCurve3; - exports.SplineCurve3 = SplineCurve3; - exports.Spline = Spline; - exports.AxisHelper = AxisHelper; - exports.BoundingBoxHelper = BoundingBoxHelper; - exports.EdgesHelper = EdgesHelper; + exports.Uint32BufferAttribute = Uint32BufferAttribute; + exports.Uint8Attribute = Uint8Attribute; + exports.Uint8BufferAttribute = Uint8BufferAttribute; + exports.Uint8ClampedAttribute = Uint8ClampedAttribute; + exports.Uint8ClampedBufferAttribute = Uint8ClampedBufferAttribute; + exports.Uncharted2ToneMapping = Uncharted2ToneMapping; + exports.Uniform = Uniform; + exports.UniformsLib = UniformsLib; + exports.UniformsUtils = UniformsUtils; + exports.UnsignedByteType = UnsignedByteType; + exports.UnsignedInt248Type = UnsignedInt248Type; + exports.UnsignedIntType = UnsignedIntType; + exports.UnsignedShort4444Type = UnsignedShort4444Type; + exports.UnsignedShort5551Type = UnsignedShort5551Type; + exports.UnsignedShort565Type = UnsignedShort565Type; + exports.UnsignedShortType = UnsignedShortType; + exports.Vector2 = Vector2; + exports.Vector3 = Vector3; + exports.Vector4 = Vector4; + exports.VectorKeyframeTrack = VectorKeyframeTrack; + exports.Vertex = Vertex; + exports.VertexColors = VertexColors; + exports.VertexNormalsHelper = VertexNormalsHelper; + exports.VideoTexture = VideoTexture; + exports.WebGLMultisampleRenderTarget = WebGLMultisampleRenderTarget; + exports.WebGLRenderTarget = WebGLRenderTarget; + exports.WebGLRenderTargetCube = WebGLRenderTargetCube; + exports.WebGLRenderer = WebGLRenderer; + exports.WebGLUtils = WebGLUtils; + exports.WireframeGeometry = WireframeGeometry; exports.WireframeHelper = WireframeHelper; + exports.WrapAroundEnding = WrapAroundEnding; exports.XHRLoader = XHRLoader; - exports.BinaryTextureLoader = BinaryTextureLoader; - exports.GeometryUtils = GeometryUtils; - exports.Projector = Projector; - exports.CanvasRenderer = CanvasRenderer; - exports.JSONLoader = JSONLoader; - exports.SceneUtils = SceneUtils; - exports.LensFlare = LensFlare; + exports.ZeroCurvatureEnding = ZeroCurvatureEnding; + exports.ZeroFactor = ZeroFactor; + exports.ZeroSlopeEnding = ZeroSlopeEnding; + exports.sRGBEncoding = sRGBEncoding; Object.defineProperty(exports, '__esModule', { value: true }); diff --git a/core/src/main/resources/org/treblereel/gwt/three4g/resources/js/three.min.js b/core/src/main/resources/org/treblereel/gwt/three4g/resources/js/three.min.js index 2e58a927..0123525b 100644 --- a/core/src/main/resources/org/treblereel/gwt/three4g/resources/js/three.min.js +++ b/core/src/main/resources/org/treblereel/gwt/three4g/resources/js/three.min.js @@ -1,328 +1,329 @@ // threejs.org/license -(function(k,ta){"object"===typeof exports&&"undefined"!==typeof module?ta(exports):"function"===typeof define&&define.amd?define(["exports"],ta):(k=k||self,ta(k.THREE={}))})(this,function(k){function ta(){}function C(a,b){this.x=a||0;this.y=b||0}function ma(a,b,c,d){this._x=a||0;this._y=b||0;this._z=c||0;this._w=void 0!==d?d:1}function n(a,b,c){this.x=a||0;this.y=b||0;this.z=c||0}function na(){this.elements=[1,0,0,0,1,0,0,0,1];0b&&(b=a[c]);return b}function B(){Object.defineProperty(this,"id",{value:bg+=2});this.uuid=O.generateUUID();this.name="";this.type="BufferGeometry";this.index=null;this.attributes={};this.morphAttributes={};this.groups=[];this.boundingSphere=this.boundingBox=null;this.drawRange={start:0,count:Infinity};this.userData={}} -function Tb(a,b,c,d,e,f){K.call(this);this.type="BoxGeometry";this.parameters={width:a,height:b,depth:c,widthSegments:d,heightSegments:e,depthSegments:f};this.fromBufferGeometry(new wb(a,b,c,d,e,f));this.mergeVertices()}function wb(a,b,c,d,e,f){function g(a,b,c,d,e,f,g,k,ua,pa,I){var r=f/ua,u=g/pa,w=f/2,y=g/2,z=k/2;g=ua+1;var G=pa+1,ha=f=0,S,x,F=new n;for(x=0;xb&&(b=a[c]);return b}function E(){Object.defineProperty(this,"id",{value:ag+=2});this.uuid=P.generateUUID();this.name="";this.type="BufferGeometry";this.index=null;this.attributes={};this.morphAttributes={};this.groups=[];this.boundingSphere=this.boundingBox=null;this.drawRange={start:0,count:Infinity};this.userData={}} +function Ub(a,b,c,d,e,f){Q.call(this);this.type="BoxGeometry";this.parameters={width:a,height:b,depth:c,widthSegments:d,heightSegments:e,depthSegments:f};this.fromBufferGeometry(new wb(a,b,c,d,e,f));this.mergeVertices()}function wb(a,b,c,d,e,f){function g(a,b,c,d,e,f,g,l,xa,Fa,F){var r=f/xa,u=g/Fa,w=f/2,x=g/2,y=l/2;g=xa+1;var z=Fa+1,ma=f=0,R,G,A=new n;for(G=0;Gm;m++){if(p=d[m])if(h=p[0],l=p[1]){q&&e.addAttribute("morphTarget"+m, -q[h]);f&&e.addAttribute("morphNormal"+m,f[h]);c[m]=l;continue}c[m]=0}g.getUniforms().setValue(a,"morphTargetInfluences",c)}}}function ng(a,b){var c={};return{update:function(d){var e=b.render.frame,f=d.geometry,g=a.get(d,f);c[g.id]!==e&&(f.isGeometry&&g.updateFromObject(d),a.update(g),c[g.id]=e);return g},dispose:function(){c={}}}}function cb(a,b,c,d,e,f,g,h,l,m){a=void 0!==a?a:[];Y.call(this,a,void 0!==b?b:301,c,d,e,f,void 0!==g?g:1022,h,l,m);this.flipY=!1}function Ub(a,b,c,d){Y.call(this,null); -this.image={data:a,width:b,height:c,depth:d};this.minFilter=this.magFilter=1003;this.wrapR=1001;this.flipY=this.generateMipmaps=!1}function Vb(a,b,c,d){Y.call(this,null);this.image={data:a,width:b,height:c,depth:d};this.minFilter=this.magFilter=1003;this.wrapR=1001;this.flipY=this.generateMipmaps=!1}function Wb(a,b,c){var d=a[0];if(0>=d||0/gm,function(a,c){a=R[c];if(void 0===a)throw Error("Can not resolve #include <"+c+">");return ie(a)})}function of(a){return a.replace(/#pragma unroll_loop[\s]+?for \( int i = (\d+); i < (\d+); i \+\+ \) \{([\s\S]+?)(?=\})\}/g, -function(a,c,d,e){a="";for(c=parseInt(c);cm;m++){if(p=d[m])if(h=p[0],k=p[1]){q&&e.addAttribute("morphTarget"+m, +q[h]);f&&e.addAttribute("morphNormal"+m,f[h]);c[m]=k;continue}c[m]=0}g.getUniforms().setValue(a,"morphTargetInfluences",c)}}}function mg(a,b){var c={};return{update:function(d){var e=b.render.frame,f=d.geometry,g=a.get(d,f);c[g.id]!==e&&(f.isGeometry&&g.updateFromObject(d),a.update(g),c[g.id]=e);return g},dispose:function(){c={}}}}function cb(a,b,c,d,e,f,g,h,k,m){a=void 0!==a?a:[];X.call(this,a,void 0!==b?b:301,c,d,e,f,void 0!==g?g:1022,h,k,m);this.flipY=!1}function Vb(a,b,c,d){X.call(this,null); +this.image={data:a,width:b,height:c,depth:d};this.minFilter=this.magFilter=1003;this.wrapR=1001;this.flipY=this.generateMipmaps=!1}function Wb(a,b,c,d){X.call(this,null);this.image={data:a,width:b,height:c,depth:d};this.minFilter=this.magFilter=1003;this.wrapR=1001;this.flipY=this.generateMipmaps=!1}function Xb(a,b,c){var d=a[0];if(0>=d||0/gm, +function(a,c){a=U[c];if(void 0===a)throw Error("Can not resolve #include <"+c+">");return me(a)})}function nf(a){return a.replace(/#pragma unroll_loop[\s]+?for \( int i = (\d+); i < (\d+); i \+\+ \) \{([\s\S]+?)(?=\})\}/g,function(a,c,d,e){a="";for(c=parseInt(c);cc;c++)b.probe.push(new n);var d=new n,e=new P,f=new P;return{setup:function(c,h,l){for(var g=0,q=0,p=0,v=0;9>v;v++)b.probe[v].set(0,0,0);var k=0,r=0,u=0,n=0,z=0;l=l.matrixWorldInverse;v=0;for(var x=c.length;vpa;pa++)b.probe[pa].addScaledVector(y.sh.coefficients[pa], -G);else if(y.isDirectionalLight){var I=a.get(y);I.color.copy(y.color).multiplyScalar(y.intensity);I.direction.setFromMatrixPosition(y.matrixWorld);d.setFromMatrixPosition(y.target.matrixWorld);I.direction.sub(d);I.direction.transformDirection(l);if(I.shadow=y.castShadow)G=y.shadow,I.shadowBias=G.bias,I.shadowRadius=G.radius,I.shadowMapSize=G.mapSize;b.directionalShadowMap[k]=pa;b.directionalShadowMatrix[k]=y.shadow.matrix;b.directional[k]=I;k++}else if(y.isSpotLight){I=a.get(y);I.position.setFromMatrixPosition(y.matrixWorld); -I.position.applyMatrix4(l);I.color.copy(F).multiplyScalar(G);I.distance=ua;I.direction.setFromMatrixPosition(y.matrixWorld);d.setFromMatrixPosition(y.target.matrixWorld);I.direction.sub(d);I.direction.transformDirection(l);I.coneCos=Math.cos(y.angle);I.penumbraCos=Math.cos(y.angle*(1-y.penumbra));I.decay=y.decay;if(I.shadow=y.castShadow)G=y.shadow,I.shadowBias=G.bias,I.shadowRadius=G.radius,I.shadowMapSize=G.mapSize;b.spotShadowMap[u]=pa;b.spotShadowMatrix[u]=y.shadow.matrix;b.spot[u]=I;u++}else if(y.isRectAreaLight)I= -a.get(y),I.color.copy(F).multiplyScalar(G),I.position.setFromMatrixPosition(y.matrixWorld),I.position.applyMatrix4(l),f.identity(),e.copy(y.matrixWorld),e.premultiply(l),f.extractRotation(e),I.halfWidth.set(.5*y.width,0,0),I.halfHeight.set(0,.5*y.height,0),I.halfWidth.applyMatrix4(f),I.halfHeight.applyMatrix4(f),b.rectArea[n]=I,n++;else if(y.isPointLight){I=a.get(y);I.position.setFromMatrixPosition(y.matrixWorld);I.position.applyMatrix4(l);I.color.copy(y.color).multiplyScalar(y.intensity);I.distance= -y.distance;I.decay=y.decay;if(I.shadow=y.castShadow)G=y.shadow,I.shadowBias=G.bias,I.shadowRadius=G.radius,I.shadowMapSize=G.mapSize,I.shadowCameraNear=G.camera.near,I.shadowCameraFar=G.camera.far;b.pointShadowMap[r]=pa;b.pointShadowMatrix[r]=y.shadow.matrix;b.point[r]=I;r++}else y.isHemisphereLight&&(I=a.get(y),I.direction.setFromMatrixPosition(y.matrixWorld),I.direction.transformDirection(l),I.direction.normalize(),I.skyColor.copy(y.color).multiplyScalar(G),I.groundColor.copy(y.groundColor).multiplyScalar(G), -b.hemi[z]=I,z++)}b.ambient[0]=g;b.ambient[1]=q;b.ambient[2]=p;b.directional.length=k;b.spot.length=u;b.rectArea.length=n;b.point.length=r;b.hemi.length=z;b.hash.stateID=b.id;b.hash.directionalLength=k;b.hash.pointLength=r;b.hash.spotLength=u;b.hash.rectAreaLength=n;b.hash.hemiLength=z;b.hash.shadowsLength=h.length},state:b}}function qf(){var a=new bh,b=[],c=[];return{init:function(){b.length=0;c.length=0},state:{lightsArray:b,shadowsArray:c,lights:a},setupLights:function(d){a.setup(b,c,d)},pushLight:function(a){b.push(a)}, -pushShadow:function(a){c.push(a)}}}function dh(){function a(c){c=c.target;c.removeEventListener("dispose",a);delete b[c.id]}var b={};return{get:function(c,d){if(void 0===b[c.id]){var e=new qf;b[c.id]={};b[c.id][d.id]=e;c.addEventListener("dispose",a)}else void 0===b[c.id][d.id]?(e=new qf,b[c.id][d.id]=e):e=b[c.id][d.id];return e},dispose:function(){b={}}}}function jb(a){Q.call(this);this.type="MeshDepthMaterial";this.depthPacking=3200;this.morphTargets=this.skinning=!1;this.displacementMap=this.alphaMap= -this.map=null;this.displacementScale=1;this.displacementBias=0;this.wireframe=!1;this.wireframeLinewidth=1;this.lights=this.fog=!1;this.setValues(a)}function kb(a){Q.call(this);this.type="MeshDistanceMaterial";this.referencePosition=new n;this.nearDistance=1;this.farDistance=1E3;this.morphTargets=this.skinning=!1;this.displacementMap=this.alphaMap=this.map=null;this.displacementScale=1;this.displacementBias=0;this.lights=this.fog=!1;this.setValues(a)}function rf(a,b,c){function d(b,c,d,e,f,g){var h= -b.geometry;var l=p;var m=b.customDepthMaterial;d&&(l=v,m=b.customDistanceMaterial);m?l=m:(m=!1,c.morphTargets&&(h&&h.isBufferGeometry?m=h.morphAttributes&&h.morphAttributes.position&&0d||a.height>d)e=d/Math.max(a.width,a.height);if(1>e||!0===b){if("undefined"!==typeof HTMLImageElement&&a instanceof HTMLImageElement||"undefined"!== -typeof HTMLCanvasElement&&a instanceof HTMLCanvasElement||"undefined"!==typeof ImageBitmap&&a instanceof ImageBitmap)return d=b?O.floorPowerOfTwo:Math.floor,b=d(e*a.width),e=d(e*a.height),void 0===E&&(E=h(b,e)),c=c?h(b,e):E,c.width=b,c.height=e,c.getContext("2d").drawImage(a,0,0,b,e),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+a.width+"x"+a.height+") to ("+b+"x"+e+")."),c;"data"in a&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+a.width+"x"+a.height+ -").")}return a}function m(a){return O.isPowerOfTwo(a.width)&&O.isPowerOfTwo(a.height)}function q(a,b){return a.generateMipmaps&&b&&1003!==a.minFilter&&1006!==a.minFilter}function p(b,c,e,f){a.generateMipmap(b);d.get(c).__maxMipLevel=Math.log(Math.max(e,f))*Math.LOG2E}function v(a,c){if(!e.isWebGL2)return a;var d=a;6403===a&&(5126===c&&(d=33326),5131===c&&(d=33325),5121===c&&(d=33321));6407===a&&(5126===c&&(d=34837),5131===c&&(d=34843),5121===c&&(d=32849));6408===a&&(5126===c&&(d=34836),5131===c&& -(d=34842),5121===c&&(d=32856));33325===d||33326===d||34842===d||34836===d?b.get("EXT_color_buffer_float"):(34843===d||34837===d)&&console.warn("THREE.WebGLRenderer: Floating point textures with RGB format not supported. Please use RGBA instead.");return d}function k(a){return 1003===a||1004===a||1005===a?9728:9729}function r(b){b=b.target;b.removeEventListener("dispose",r);var c=d.get(b);void 0!==c.__webglInit&&(a.deleteTexture(c.__webglTexture),d.remove(b));b.isVideoTexture&&delete C[b.id];g.memory.textures--} -function u(b){b=b.target;b.removeEventListener("dispose",u);var c=d.get(b),e=d.get(b.texture);if(b){void 0!==e.__webglTexture&&a.deleteTexture(e.__webglTexture);b.depthTexture&&b.depthTexture.dispose();if(b.isWebGLRenderTargetCube)for(e=0;6>e;e++)a.deleteFramebuffer(c.__webglFramebuffer[e]),c.__webglDepthbuffer&&a.deleteRenderbuffer(c.__webglDepthbuffer[e]);else a.deleteFramebuffer(c.__webglFramebuffer),c.__webglDepthbuffer&&a.deleteRenderbuffer(c.__webglDepthbuffer);d.remove(b.texture);d.remove(b)}g.memory.textures--} -function n(a,b){var e=d.get(a);if(a.isVideoTexture){var f=a.id,h=g.render.frame;C[f]!==h&&(C[f]=h,a.update())}if(0r;r++)t[r]=g||k?k?b.image[r].image:b.image[r]:l(b.image[r],!1,!0,e.maxCubemapSize);var u=t[0],n=m(u)||e.isWebGL2,w=f.convert(b.format),x=f.convert(b.type),G=v(w,x);y(34067,b,n);for(r=0;6>r;r++)if(g)for(var S,ha=t[r].mipmaps,z=0,ua=ha.length;z=e.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+a+" texture units while this GPU supports only "+e.maxTextures);B+=1;return a};this.resetTextureUnits=function(){B=0};this.setTexture2D=n;this.setTexture2DArray=function(a,b){var e=d.get(a);0r;r++)h.__webglFramebuffer[r]=a.createFramebuffer();else if(h.__webglFramebuffer=a.createFramebuffer(),r)if(e.isWebGL2){h.__webglMultisampledFramebuffer=a.createFramebuffer();h.__webglColorRenderbuffer=a.createRenderbuffer();a.bindRenderbuffer(36161,h.__webglColorRenderbuffer);r=f.convert(b.texture.format);var w=f.convert(b.texture.type);r=v(r,w);w=I(b);a.renderbufferStorageMultisample(36161,w,r,b.width,b.height);a.bindFramebuffer(36160,h.__webglMultisampledFramebuffer); -a.framebufferRenderbuffer(36160,36064,36161,h.__webglColorRenderbuffer);a.bindRenderbuffer(36161,null);b.depthBuffer&&(h.__webglDepthRenderbuffer=a.createRenderbuffer(),pa(h.__webglDepthRenderbuffer,b,!0));a.bindFramebuffer(36160,null)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");if(k){c.bindTexture(34067,l.__webglTexture);y(34067,b.texture,t);for(r=0;6>r;r++)ua(h.__webglFramebuffer[r],b,36064,34069+r);q(b.texture,t)&&p(34067,b.texture,b.width, -b.height);c.bindTexture(34067,null)}else c.bindTexture(3553,l.__webglTexture),y(3553,b.texture,t),ua(h.__webglFramebuffer,b,36064,3553),q(b.texture,t)&&p(3553,b.texture,b.width,b.height),c.bindTexture(3553,null);if(b.depthBuffer){h=d.get(b);l=!0===b.isWebGLRenderTargetCube;if(b.depthTexture){if(l)throw Error("target.depthTexture not supported in Cube render targets");if(b&&b.isWebGLRenderTargetCube)throw Error("Depth Texture with cube render targets is not supported");a.bindFramebuffer(36160,h.__webglFramebuffer); -if(!b.depthTexture||!b.depthTexture.isDepthTexture)throw Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");d.get(b.depthTexture).__webglTexture&&b.depthTexture.image.width===b.width&&b.depthTexture.image.height===b.height||(b.depthTexture.image.width=b.width,b.depthTexture.image.height=b.height,b.depthTexture.needsUpdate=!0);n(b.depthTexture,0);h=d.get(b.depthTexture).__webglTexture;if(1026===b.depthTexture.format)a.framebufferTexture2D(36160,36096,3553,h,0);else if(1027=== -b.depthTexture.format)a.framebufferTexture2D(36160,33306,3553,h,0);else throw Error("Unknown depthTexture format");}else if(l)for(h.__webglDepthbuffer=[],l=0;6>l;l++)a.bindFramebuffer(36160,h.__webglFramebuffer[l]),h.__webglDepthbuffer[l]=a.createRenderbuffer(),pa(h.__webglDepthbuffer[l],b);else a.bindFramebuffer(36160,h.__webglFramebuffer),h.__webglDepthbuffer=a.createRenderbuffer(),pa(h.__webglDepthbuffer,b);a.bindFramebuffer(36160,null)}};this.updateRenderTargetMipmap=function(a){var b=a.texture, -f=m(a)||e.isWebGL2;if(q(b,f)){f=a.isWebGLRenderTargetCube?34067:3553;var g=d.get(b).__webglTexture;c.bindTexture(f,g);p(f,b,a.width,a.height);c.bindTexture(f,null)}};this.updateMultisampleRenderTarget=function(b){if(b.isWebGLMultisampleRenderTarget)if(e.isWebGL2){var c=d.get(b);a.bindFramebuffer(36008,c.__webglMultisampledFramebuffer);a.bindFramebuffer(36009,c.__webglFramebuffer);c=b.width;var f=b.height,g=16384;b.depthBuffer&&(g|=256);b.stencilBuffer&&(g|=1024);a.blitFramebuffer(0,0,c,f,0,0,c,f, -g,9728)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")};this.safeSetTexture2D=function(a,b){a&&a.isWebGLRenderTarget&&(!1===J&&(console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),J=!0),a=a.texture);n(a,b)};this.safeSetTextureCube=function(a,b){a&&a.isWebGLRenderTargetCube&&(!1===A&&(console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."), -A=!0),a=a.texture);a&&a.isCubeTexture||Array.isArray(a.image)&&6===a.image.length?z(a,b):x(a,b)}}function tf(a,b,c){return{convert:function(a){if(1E3===a)return 10497;if(1001===a)return 33071;if(1002===a)return 33648;if(1003===a)return 9728;if(1004===a)return 9984;if(1005===a)return 9986;if(1006===a)return 9729;if(1007===a)return 9985;if(1008===a)return 9987;if(1009===a)return 5121;if(1017===a)return 32819;if(1018===a)return 32820;if(1019===a)return 33635;if(1010===a)return 5120;if(1011===a)return 5122; -if(1012===a)return 5123;if(1013===a)return 5124;if(1014===a)return 5125;if(1015===a)return 5126;if(1016===a){if(c.isWebGL2)return 5131;var d=b.get("OES_texture_half_float");if(null!==d)return d.HALF_FLOAT_OES}if(1021===a)return 6406;if(1022===a)return 6407;if(1023===a)return 6408;if(1024===a)return 6409;if(1025===a)return 6410;if(1026===a)return 6402;if(1027===a)return 34041;if(1028===a)return 6403;if(100===a)return 32774;if(101===a)return 32778;if(102===a)return 32779;if(200===a)return 0;if(201=== -a)return 1;if(202===a)return 768;if(203===a)return 769;if(204===a)return 770;if(205===a)return 771;if(206===a)return 772;if(207===a)return 773;if(208===a)return 774;if(209===a)return 775;if(210===a)return 776;if(33776===a||33777===a||33778===a||33779===a)if(d=b.get("WEBGL_compressed_texture_s3tc"),null!==d){if(33776===a)return d.COMPRESSED_RGB_S3TC_DXT1_EXT;if(33777===a)return d.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(33778===a)return d.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(33779===a)return d.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(35840=== -a||35841===a||35842===a||35843===a)if(d=b.get("WEBGL_compressed_texture_pvrtc"),null!==d){if(35840===a)return d.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(35841===a)return d.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(35842===a)return d.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(35843===a)return d.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(36196===a&&(d=b.get("WEBGL_compressed_texture_etc1"),null!==d))return d.COMPRESSED_RGB_ETC1_WEBGL;if(37808===a||37809===a||37810===a||37811===a||37812===a||37813===a||37814===a||37815===a||37816=== -a||37817===a||37818===a||37819===a||37820===a||37821===a)if(d=b.get("WEBGL_compressed_texture_astc"),null!==d)return a;if(103===a||104===a){if(c.isWebGL2){if(103===a)return 32775;if(104===a)return 32776}d=b.get("EXT_blend_minmax");if(null!==d){if(103===a)return d.MIN_EXT;if(104===a)return d.MAX_EXT}}if(1020===a){if(c.isWebGL2)return 34042;d=b.get("WEBGL_depth_texture");if(null!==d)return d.UNSIGNED_INT_24_8_WEBGL}return 0}}}function Xb(){D.call(this);this.type="Group"}function Xa(){D.call(this);this.type= -"Camera";this.matrixWorldInverse=new P;this.projectionMatrix=new P;this.projectionMatrixInverse=new P}function ca(a,b,c,d){Xa.call(this);this.type="PerspectiveCamera";this.fov=void 0!==a?a:50;this.zoom=1;this.near=void 0!==c?c:.1;this.far=void 0!==d?d:2E3;this.focus=10;this.aspect=void 0!==b?b:1;this.view=null;this.filmGauge=35;this.filmOffset=0;this.updateProjectionMatrix()}function Jc(a){ca.call(this);this.cameras=a||[]}function uf(a,b,c){vf.setFromMatrixPosition(b.matrixWorld);wf.setFromMatrixPosition(c.matrixWorld); -var d=vf.distanceTo(wf),e=b.projectionMatrix.elements,f=c.projectionMatrix.elements,g=e[14]/(e[10]-1);c=e[14]/(e[10]+1);var h=(e[9]+1)/e[5],l=(e[9]-1)/e[5],m=(e[8]-1)/e[0],q=(f[8]+1)/f[0];e=g*m;f=g*q;q=d/(-m+q);m=q*-m;b.matrixWorld.decompose(a.position,a.quaternion,a.scale);a.translateX(m);a.translateZ(q);a.matrixWorld.compose(a.position,a.quaternion,a.scale);a.matrixWorldInverse.getInverse(a.matrixWorld);b=g+q;g=c+q;a.projectionMatrix.makePerspective(e-m,f+(d-m),h*c/g*b,l*c/g*b,b,g)}function xf(a){function b(){return null!== -e&&!0===e.isPresenting}function c(){if(b()){var c=e.getEyeParameters("left"),f=c.renderWidth*q;c=c.renderHeight*q;y=a.getPixelRatio();a.getSize(x);a.setDrawingBufferSize(2*f,c,1);G.start()}else d.enabled&&a.setDrawingBufferSize(x.width,x.height,y),G.stop()}var d=this,e=null,f=null,g=null,h=[],l=new P,m=new P,q=1,p="stage";"undefined"!==typeof window&&"VRFrameData"in window&&(f=new window.VRFrameData,window.addEventListener("vrdisplaypresentchange",c,!1));var k=new P,t=new ma,r=new n,u=new ca;u.bounds= -new W(0,0,.5,1);u.layers.enable(1);var w=new ca;w.bounds=new W(.5,0,.5,1);w.layers.enable(2);var z=new Jc([u,w]);z.layers.enable(1);z.layers.enable(2);var x=new C,y,F=[];this.enabled=!1;this.getController=function(a){var b=h[a];void 0===b&&(b=new Xb,b.matrixAutoUpdate=!1,b.visible=!1,h[a]=b);return b};this.getDevice=function(){return e};this.setDevice=function(a){void 0!==a&&(e=a);G.setContext(a)};this.setFramebufferScaleFactor=function(a){q=a};this.setFrameOfReferenceType=function(a){p=a};this.setPoseTarget= -function(a){void 0!==a&&(g=a)};this.getCamera=function(a){var c="stage"===p?1.6:0;if(!1===b())return a.position.set(0,c,0),a.rotation.set(0,0,0),a;e.depthNear=a.near;e.depthFar=a.far;e.getFrameData(f);if("stage"===p){var d=e.stageParameters;d?l.fromArray(d.sittingToStandingTransform):l.makeTranslation(0,c,0)}c=f.pose;d=null!==g?g:a;d.matrix.copy(l);d.matrix.decompose(d.position,d.quaternion,d.scale);null!==c.orientation&&(t.fromArray(c.orientation),d.quaternion.multiply(t));null!==c.position&&(t.setFromRotationMatrix(l), -r.fromArray(c.position),r.applyQuaternion(t),d.position.add(r));d.updateMatrixWorld();u.near=a.near;w.near=a.near;u.far=a.far;w.far=a.far;u.matrixWorldInverse.fromArray(f.leftViewMatrix);w.matrixWorldInverse.fromArray(f.rightViewMatrix);m.getInverse(l);"stage"===p&&(u.matrixWorldInverse.multiply(m),w.matrixWorldInverse.multiply(m));a=d.parent;null!==a&&(k.getInverse(a.matrixWorld),u.matrixWorldInverse.multiply(k),w.matrixWorldInverse.multiply(k));u.matrixWorld.getInverse(u.matrixWorldInverse);w.matrixWorld.getInverse(w.matrixWorldInverse); -u.projectionMatrix.fromArray(f.leftProjectionMatrix);w.projectionMatrix.fromArray(f.rightProjectionMatrix);uf(z,u,w);a=e.getLayers();a.length&&(a=a[0],null!==a.leftBounds&&4===a.leftBounds.length&&u.bounds.fromArray(a.leftBounds),null!==a.rightBounds&&4===a.rightBounds.length&&w.bounds.fromArray(a.rightBounds));a:for(a=0;af.matrixWorld.determinant();aa.setMaterial(e,h);var l=k(a,c,e,f),m=!1;if(b!==d.id||H!==l.id||xb!==(!0===e.wireframe))b=d.id,H=l.id,xb=!0===e.wireframe,m=!0;f.morphTargetInfluences&&(va.update(f,d,e,l),m=!0);h=d.index;var q=d.attributes.position;c=1;!0===e.wireframe&&(h=sa.getWireframeAttribute(d),c=2);a=xa;if(null!==h){var p=qa.get(h);a=ya;a.setIndex(p)}if(m){if(d&& -d.isInstancedBufferGeometry&&!Aa.isWebGL2&&null===ja.get("ANGLE_instanced_arrays"))console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");else{aa.initAttributes();m=d.attributes;l=l.getAttributes();var v=e.defaultAttributeValues;for(F in l){var r=l[F];if(0<=r){var t=m[F];if(void 0!==t){var n=t.normalized,u=t.itemSize,w=qa.get(t);if(void 0!==w){var x=w.buffer,y=w.type;w=w.bytesPerElement;if(t.isInterleavedBufferAttribute){var z= -t.data,G=z.stride;t=t.offset;z&&z.isInstancedInterleavedBuffer?(aa.enableAttributeAndDivisor(r,z.meshPerAttribute),void 0===d.maxInstancedCount&&(d.maxInstancedCount=z.meshPerAttribute*z.count)):aa.enableAttribute(r);N.bindBuffer(34962,x);N.vertexAttribPointer(r,u,y,n,G*w,t*w)}else t.isInstancedBufferAttribute?(aa.enableAttributeAndDivisor(r,t.meshPerAttribute),void 0===d.maxInstancedCount&&(d.maxInstancedCount=t.meshPerAttribute*t.count)):aa.enableAttribute(r),N.bindBuffer(34962,x),N.vertexAttribPointer(r, -u,y,n,0,0)}}else if(void 0!==v&&(n=v[F],void 0!==n))switch(n.length){case 2:N.vertexAttrib2fv(r,n);break;case 3:N.vertexAttrib3fv(r,n);break;case 4:N.vertexAttrib4fv(r,n);break;default:N.vertexAttrib1fv(r,n)}}}aa.disableUnusedAttributes()}null!==h&&N.bindBuffer(34963,p.buffer)}p=Infinity;null!==h?p=h.count:void 0!==q&&(p=q.count);h=d.drawRange.start*c;q=null!==g?g.start*c:0;var F=Math.max(h,q);g=Math.max(0,Math.min(p,h+d.drawRange.count*c,q+(null!==g?g.count*c:Infinity))-1-F+1);if(0!==g){if(f.isMesh)if(!0=== -e.wireframe)aa.setLineWidth(e.wireframeLinewidth*(null===Q?X:1)),a.setMode(1);else switch(f.drawMode){case 0:a.setMode(4);break;case 1:a.setMode(5);break;case 2:a.setMode(6)}else f.isLine?(e=e.linewidth,void 0===e&&(e=1),aa.setLineWidth(e*(null===Q?X:1)),f.isLineSegments?a.setMode(1):f.isLineLoop?a.setMode(2):a.setMode(3)):f.isPoints?a.setMode(0):f.isSprite&&a.setMode(4);d&&d.isInstancedBufferGeometry?0c;c++){var p=q[h[c]];var k=q[h[(c+1)%3]];f[0]=Math.min(p,k);f[1]=Math.max(p,k);p=f[0]+","+f[1];void 0===g[p]&&(g[p]={index1:f[0],index2:f[1]})}}for(p in g)m=g[p],h=a.vertices[m.index1],b.push(h.x,h.y,h.z),h=a.vertices[m.index2],b.push(h.x,h.y,h.z)}else if(a&&a.isBufferGeometry)if(h=new n,null!==a.index){l= -a.attributes.position;q=a.index;var t=a.groups;0===t.length&&(t=[{start:0,count:q.count,materialIndex:0}]);a=0;for(e=t.length;ac;c++)p=q.getX(m+c),k=q.getX(m+(c+1)%3),f[0]=Math.min(p,k),f[1]=Math.max(p,k),p=f[0]+","+f[1],void 0===g[p]&&(g[p]={index1:f[0],index2:f[1]});for(p in g)m=g[p],h.fromBufferAttribute(l,m.index1),b.push(h.x,h.y,h.z),h.fromBufferAttribute(l,m.index2),b.push(h.x,h.y,h.z)}else for(l=a.attributes.position,m=0,d= -l.count/3;mc;c++)g=3*m+c,h.fromBufferAttribute(l,g),b.push(h.x,h.y,h.z),g=3*m+(c+1)%3,h.fromBufferAttribute(l,g),b.push(h.x,h.y,h.z);this.addAttribute("position",new E(b,3))}function Qc(a,b,c){K.call(this);this.type="ParametricGeometry";this.parameters={func:a,slices:b,stacks:c};this.fromBufferGeometry(new bc(a,b,c));this.mergeVertices()}function bc(a,b,c){B.call(this);this.type="ParametricBufferGeometry";this.parameters={func:a,slices:b,stacks:c};var d=[],e=[],f=[],g=[],h=new n, -l=new n,m=new n,q=new n,p=new n,k,t;3>a.length&&console.error("THREE.ParametricGeometry: Function must now modify a Vector3 as third parameter.");var r=b+1;for(k=0;k<=c;k++){var u=k/c;for(t=0;t<=b;t++){var w=t/b;a(w,u,l);e.push(l.x,l.y,l.z);0<=w-1E-5?(a(w-1E-5,u,m),q.subVectors(l,m)):(a(w+1E-5,u,m),q.subVectors(m,l));0<=u-1E-5?(a(w,u-1E-5,m),p.subVectors(l,m)):(a(w,u+1E-5,m),p.subVectors(m,l));h.crossVectors(q,p).normalize();f.push(h.x,h.y,h.z);g.push(w,u)}}for(k=0;kd&&1===a.x&&(l[b]=a.x-1);0===c.x&&0===c.z&&(l[b]=d/2/Math.PI+.5)}B.call(this);this.type="PolyhedronBufferGeometry";this.parameters={vertices:a,indices:b,radius:c,detail:d};c=c||1;d=d||0;var h=[],l=[];(function(a){for(var c=new n,d=new n,g=new n,h=0;he&&(.2>b&&(l[a+0]+=1),.2>c&&(l[a+2]+=1),.2>d&&(l[a+4]+=1))})();this.addAttribute("position", -new E(h,3));this.addAttribute("normal",new E(h.slice(),3));this.addAttribute("uv",new E(l,2));0===d?this.computeVertexNormals():this.normalizeNormals()}function Sc(a,b){K.call(this);this.type="TetrahedronGeometry";this.parameters={radius:a,detail:b};this.fromBufferGeometry(new cc(a,b));this.mergeVertices()}function cc(a,b){la.call(this,[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],a,b);this.type="TetrahedronBufferGeometry";this.parameters={radius:a,detail:b}}function Tc(a,b){K.call(this); -this.type="OctahedronGeometry";this.parameters={radius:a,detail:b};this.fromBufferGeometry(new Bb(a,b));this.mergeVertices()}function Bb(a,b){la.call(this,[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],a,b);this.type="OctahedronBufferGeometry";this.parameters={radius:a,detail:b}}function Uc(a,b){K.call(this);this.type="IcosahedronGeometry";this.parameters={radius:a,detail:b};this.fromBufferGeometry(new dc(a,b));this.mergeVertices()}function dc(a,b){var c= -(1+Math.sqrt(5))/2;la.call(this,[-1,c,0,1,c,0,-1,-c,0,1,-c,0,0,-1,c,0,1,c,0,-1,-c,0,1,-c,c,0,-1,c,0,1,-c,0,-1,-c,0,1],[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],a,b);this.type="IcosahedronBufferGeometry";this.parameters={radius:a,detail:b}}function Vc(a,b){K.call(this);this.type="DodecahedronGeometry";this.parameters={radius:a,detail:b};this.fromBufferGeometry(new ec(a,b));this.mergeVertices()}function ec(a,b){var c= -(1+Math.sqrt(5))/2,d=1/c;la.call(this,[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-d,-c,0,-d,c,0,d,-c,0,d,c,-d,-c,0,-d,c,0,d,-c,0,d,c,0,-c,0,-d,c,0,-d,-c,0,d,c,0,d],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],a,b);this.type="DodecahedronBufferGeometry";this.parameters= -{radius:a,detail:b}}function Wc(a,b,c,d,e,f){K.call(this);this.type="TubeGeometry";this.parameters={path:a,tubularSegments:b,radius:c,radialSegments:d,closed:e};void 0!==f&&console.warn("THREE.TubeGeometry: taper has been removed.");a=new Cb(a,b,c,d,e);this.tangents=a.tangents;this.normals=a.normals;this.binormals=a.binormals;this.fromBufferGeometry(a);this.mergeVertices()}function Cb(a,b,c,d,e){function f(e){q=a.getPointAt(e/b,q);var f=g.normals[e];e=g.binormals[e];for(k=0;k<=d;k++){var m=k/d*Math.PI* -2,p=Math.sin(m);m=-Math.cos(m);l.x=m*f.x+p*e.x;l.y=m*f.y+p*e.y;l.z=m*f.z+p*e.z;l.normalize();r.push(l.x,l.y,l.z);h.x=q.x+c*l.x;h.y=q.y+c*l.y;h.z=q.z+c*l.z;t.push(h.x,h.y,h.z)}}B.call(this);this.type="TubeBufferGeometry";this.parameters={path:a,tubularSegments:b,radius:c,radialSegments:d,closed:e};b=b||64;c=c||1;d=d||8;e=e||!1;var g=a.computeFrenetFrames(b,e);this.tangents=g.tangents;this.normals=g.normals;this.binormals=g.binormals;var h=new n,l=new n,m=new C,q=new n,p,k,t=[],r=[],u=[],w=[];for(p= -0;p=b;e-=d)f=Af(e,a[e],a[e+1],f);f&&Db(f,f.next)&&(Zc(f),f=f.next);return f}function $c(a,b){if(!a)return a; -b||(b=a);do{var c=!1;if(a.steiner||!Db(a,a.next)&&0!==va(a.prev,a,a.next))a=a.next;else{Zc(a);a=b=a.prev;if(a===a.next)break;c=!0}}while(c||a!==b);return b}function ad(a,b,c,d,e,f,g){if(a){if(!g&&f){var h=a,l=h;do null===l.z&&(l.z=me(l.x,l.y,d,e,f)),l.prevZ=l.prev,l=l.nextZ=l.next;while(l!==h);l.prevZ.nextZ=null;l.prevZ=null;h=l;var m,q,p,k,t=1;do{l=h;var r=h=null;for(q=0;l;){q++;var n=l;for(m=p=0;mp.x?q.x>t.x?q.x:t.x:p.x>t.x?p.x:t.x,y=q.y>p.y?q.y>t.y?q.y:t.y:p.y>t.y?p.y:t.y;m=me(q.x=m;){if(w!==r.prev&&w!==r.next&&Fd(q.x,q.y,p.x,p.y,t.x,t.y,w.x,w.y)&&0<=va(w.prev,w,w.next)){r=!1;break a}w=w.prevZ}r=!0}}else a:if(r=a,q=r.prev,p=r,t=r.next,0<=va(q,p,t))r=!1;else{for(m=r.next.next;m!==r.prev;){if(Fd(q.x,q.y,p.x,p.y,t.x,t.y,m.x,m.y)&&0<=va(m.prev,m,m.next)){r=!1;break a}m=m.next}r=!0}if(r)b.push(l.i/c),b.push(a.i/c),b.push(n.i/c),Zc(a),h=a=n.next;else if(a=n,a===h){if(!g)ad($c(a),b,c,d,e,f,1);else if(1===g){g=b;h=c;l=a;do n=l.prev, -r=l.next.next,!Db(n,r)&&Bf(n,l,l.next,r)&&bd(n,r)&&bd(r,n)&&(g.push(n.i/h),g.push(l.i/h),g.push(r.i/h),Zc(l),Zc(l.next),l=a=r),l=l.next;while(l!==a);a=l;ad(a,b,c,d,e,f,2)}else if(2===g)a:{g=a;do{for(h=g.next.next;h!==g.prev;){if(l=g.i!==h.i){l=g;n=h;if(r=l.next.i!==n.i&&l.prev.i!==n.i){b:{r=l;do{if(r.i!==l.i&&r.next.i!==l.i&&r.i!==n.i&&r.next.i!==n.i&&Bf(r,r.next,l,n)){r=!0;break b}r=r.next}while(r!==l);r=!1}r=!r}if(r=r&&bd(l,n)&&bd(n,l)){r=l;q=!1;p=(l.x+n.x)/2;n=(l.y+n.y)/2;do r.y>n!==r.next.y>n&& -r.next.y!==r.y&&p<(r.next.x-r.x)*(n-r.y)/(r.next.y-r.y)+r.x&&(q=!q),r=r.next;while(r!==l);r=q}l=r}if(l){a=Cf(g,h);g=$c(g,g.next);a=$c(a,a.next);ad(g,b,c,d,e,f);ad(a,b,c,d,e,f);break a}h=h.next}g=g.next}while(g!==a)}break}}}}function hh(a,b){return a.x-b.x}function ih(a,b){var c=b,d=a.x,e=a.y,f=-Infinity;do{if(e<=c.y&&e>=c.next.y&&c.next.y!==c.y){var g=c.x+(e-c.y)*(c.next.x-c.x)/(c.next.y-c.y);if(g<=d&&g>f){f=g;if(g===d){if(e===c.y)return c;if(e===c.next.y)return c.next}var h=c.x=c.x&&c.x>=g&&d!==c.x&&Fd(eh.x)&&bd(c,a)&&(h=c,m=q)}c=c.next}return h}function me(a,b,c,d,e){a=32767*(a-c)*e;b=32767*(b-d)*e;a=(a|a<<8)&16711935;a=(a|a<<4)&252645135;a=(a|a<<2)&858993459;b=(b|b<<8)&16711935;b=(b|b<<4)&252645135;b=(b|b<<2)&858993459;return(a|a<<1)&1431655765|((b|b<<1)&1431655765)<<1}function jh(a){var b= -a,c=a;do b.xva(a.prev,a,a.next)?0<=va(a,b,a.next)&&0<=va(a,a.prev,b):0>va(a,b,a.prev)|| -0>va(a,a.next,b)}function Cf(a,b){var c=new ne(a.i,a.x,a.y),d=new ne(b.i,b.x,b.y),e=a.next,f=b.prev;a.next=b;b.prev=a;c.next=e;e.prev=c;d.next=c;c.prev=d;f.next=d;d.prev=f;return d}function Af(a,b,c,d){a=new ne(a,b,c);d?(a.next=d.next,a.prev=d,d.next.prev=a,d.next=a):(a.prev=a,a.next=a);return a}function Zc(a){a.next.prev=a.prev;a.prev.next=a.next;a.prevZ&&(a.prevZ.nextZ=a.nextZ);a.nextZ&&(a.nextZ.prevZ=a.prevZ)}function ne(a,b,c){this.i=a;this.x=b;this.y=c;this.nextZ=this.prevZ=this.z=this.next= -this.prev=null;this.steiner=!1}function Df(a){var b=a.length;2Number.EPSILON){var l=Math.sqrt(h),m=Math.sqrt(f*f+g*g);h=b.x-e/l;b=b.y+d/l;g=((c.x-g/m-h)*g-(c.y+f/m-b)*f)/(d*g-e*f);f=h+d*g-a.x;d=b+e*g-a.y;e=f*f+d*d;if(2>=e)return new C(f,d);e=Math.sqrt(e/2)}else a=!1,d>Number.EPSILON?f>Number.EPSILON&&(a=!0):d<-Number.EPSILON?f<-Number.EPSILON&&(a=!0):Math.sign(e)===Math.sign(g)&&(a=!0),a?(f=-e,e=Math.sqrt(h)):(f=d,d=e,e=Math.sqrt(h/2));return new C(f/e,d/e)}function h(a,b){for(L=a.length;0<= ---L;){var c=L;var f=L-1;0>f&&(f=a.length-1);var g,h=x+2*I;for(g=0;gq;q++){var k=m[f[q]];var n=m[f[(q+1)%3]];d[0]=Math.min(k,n);d[1]=Math.max(k,n);k=d[0]+","+d[1];void 0=== -e[k]?e[k]={index1:d[0],index2:d[1],face1:h,face2:void 0}:e[k].face2=h}for(k in e)if(d=e[k],void 0===d.face2||g[d.face1].normal.dot(g[d.face2].normal)<=b)f=a[d.index1],c.push(f.x,f.y,f.z),f=a[d.index2],c.push(f.x,f.y,f.z);this.addAttribute("position",new E(c,3))}function Hb(a,b,c,d,e,f,g,h){K.call(this);this.type="CylinderGeometry";this.parameters={radiusTop:a,radiusBottom:b,height:c,radialSegments:d,heightSegments:e,openEnded:f,thetaStart:g,thetaLength:h};this.fromBufferGeometry(new eb(a,b,c,d,e, -f,g,h));this.mergeVertices()}function eb(a,b,c,d,e,f,g,h){function l(c){var e,f=new C,l=new n,p=0,u=!0===c?a:b,x=!0===c?1:-1;var B=r;for(e=1;e<=d;e++)k.push(0,w*x,0),v.push(0,x,0),t.push(.5,.5),r++;var D=r;for(e=0;e<=d;e++){var A=e/d*h+g,E=Math.cos(A);A=Math.sin(A);l.x=u*A;l.y=w*x;l.z=u*E;k.push(l.x,l.y,l.z);v.push(0,x,0);f.x=.5*E+.5;f.y=.5*A*x+.5;t.push(f.x,f.y);r++}for(e=0;ethis.duration&&this.resetDuration()}function lh(a){switch(a.toLowerCase()){case "scalar":case "double":case "float":case "number":case "integer":return nc;case "vector":case "vector2":case "vector3":case "vector4":return oc;case "color":return Jd;case "quaternion":return kd;case "bool":case "boolean":return Id;case "string":return Ld}throw Error("THREE.KeyframeTrack: Unsupported typeName: "+a);}function mh(a){if(void 0===a.type)throw Error("THREE.KeyframeTrack: track type undefined, can not parse"); -var b=lh(a.type);if(void 0===a.times){var c=[],d=[];ba.flattenJSON(a.keys,c,d,"value");a.times=c;a.values=d}return void 0!==b.parse?b.parse(a):new b(a.name,a.times,a.values,a.interpolation)}function oe(a,b,c){var d=this,e=!1,f=0,g=0,h=void 0;this.onStart=void 0;this.onLoad=a;this.onProgress=b;this.onError=c;this.itemStart=function(a){g++;if(!1===e&&void 0!==d.onStart)d.onStart(a,f,g);e=!0};this.itemEnd=function(a){f++;if(void 0!==d.onProgress)d.onProgress(a,f,g);if(f===g&&(e=!1,void 0!==d.onLoad))d.onLoad()}; -this.itemError=function(a){if(void 0!==d.onError)d.onError(a)};this.resolveURL=function(a){return h?h(a):a};this.setURLModifier=function(a){h=a;return this}}function Ka(a){this.manager=void 0!==a?a:za}function Hf(a){this.manager=void 0!==a?a:za}function If(a){this.manager=void 0!==a?a:za;this._parser=null}function pe(a){this.manager=void 0!==a?a:za;this._parser=null}function ld(a){this.manager=void 0!==a?a:za}function qe(a){this.manager=void 0!==a?a:za}function Md(a){this.manager=void 0!==a?a:za} -function M(){this.type="Curve";this.arcLengthDivisions=200}function Ea(a,b,c,d,e,f,g,h){M.call(this);this.type="EllipseCurve";this.aX=a||0;this.aY=b||0;this.xRadius=c||1;this.yRadius=d||1;this.aStartAngle=e||0;this.aEndAngle=f||2*Math.PI;this.aClockwise=g||!1;this.aRotation=h||0}function pc(a,b,c,d,e,f){Ea.call(this,a,b,c,c,d,e,f);this.type="ArcCurve"}function re(){var a=0,b=0,c=0,d=0;return{initCatmullRom:function(e,f,g,h,l){e=l*(g-e);h=l*(h-f);a=f;b=e;c=-3*f+3*g-2*e-h;d=2*f-2*g+e+h},initNonuniformCatmullRom:function(e, -f,g,h,l,m,q){e=((f-e)/l-(g-e)/(l+m)+(g-f)/m)*m;h=((g-f)/m-(h-f)/(m+q)+(h-g)/q)*m;a=f;b=e;c=-3*f+3*g-2*e-h;d=2*f-2*g+e+h},calc:function(e){var f=e*e;return a+b*e+c*f+d*f*e}}}function oa(a,b,c,d){M.call(this);this.type="CatmullRomCurve3";this.points=a||[];this.closed=b||!1;this.curveType=c||"centripetal";this.tension=d||.5}function Jf(a,b,c,d,e){b=.5*(d-b);e=.5*(e-c);var f=a*a;return(2*c-2*d+b+e)*a*f+(-3*c+3*d-2*b-e)*f+b*a+c}function md(a,b,c,d){var e=1-a;return e*e*b+2*(1-a)*a*c+a*a*d}function nd(a, -b,c,d,e){var f=1-a,g=1-a;return f*f*f*b+3*g*g*a*c+3*(1-a)*a*a*d+a*a*a*e}function La(a,b,c,d){M.call(this);this.type="CubicBezierCurve";this.v0=a||new C;this.v1=b||new C;this.v2=c||new C;this.v3=d||new C}function $a(a,b,c,d){M.call(this);this.type="CubicBezierCurve3";this.v0=a||new n;this.v1=b||new n;this.v2=c||new n;this.v3=d||new n}function wa(a,b){M.call(this);this.type="LineCurve";this.v1=a||new C;this.v2=b||new C}function Ma(a,b){M.call(this);this.type="LineCurve3";this.v1=a||new n;this.v2=b|| -new n}function Na(a,b,c){M.call(this);this.type="QuadraticBezierCurve";this.v0=a||new C;this.v1=b||new C;this.v2=c||new C}function ab(a,b,c){M.call(this);this.type="QuadraticBezierCurve3";this.v0=a||new n;this.v1=b||new n;this.v2=c||new n}function Oa(a){M.call(this);this.type="SplineCurve";this.points=a||[]}function fb(){M.call(this);this.type="CurvePath";this.curves=[];this.autoClose=!1}function Pa(a){fb.call(this);this.type="Path";this.currentPoint=new C;a&&this.setFromPoints(a)}function pb(a){Pa.call(this, -a);this.uuid=O.generateUUID();this.type="Shape";this.holes=[]}function T(a,b){D.call(this);this.type="Light";this.color=new A(a);this.intensity=void 0!==b?b:1;this.receiveShadow=void 0}function Nd(a,b,c){T.call(this,a,c);this.type="HemisphereLight";this.castShadow=void 0;this.position.copy(D.DefaultUp);this.updateMatrix();this.groundColor=new A(b)}function Pb(a){this.camera=a;this.bias=0;this.radius=1;this.mapSize=new C(512,512);this.map=null;this.matrix=new P}function Od(){Pb.call(this,new ca(50, -1,.5,500))}function Pd(a,b,c,d,e,f){T.call(this,a,b);this.type="SpotLight";this.position.copy(D.DefaultUp);this.updateMatrix();this.target=new D;Object.defineProperty(this,"power",{get:function(){return this.intensity*Math.PI},set:function(a){this.intensity=a/Math.PI}});this.distance=void 0!==c?c:0;this.angle=void 0!==d?d:Math.PI/3;this.penumbra=void 0!==e?e:0;this.decay=void 0!==f?f:1;this.shadow=new Od}function Qd(a,b,c,d){T.call(this,a,b);this.type="PointLight";Object.defineProperty(this,"power", -{get:function(){return 4*this.intensity*Math.PI},set:function(a){this.intensity=a/(4*Math.PI)}});this.distance=void 0!==c?c:0;this.decay=void 0!==d?d:1;this.shadow=new Pb(new ca(90,1,.5,500))}function od(a,b,c,d,e,f){Xa.call(this);this.type="OrthographicCamera";this.zoom=1;this.view=null;this.left=void 0!==a?a:-1;this.right=void 0!==b?b:1;this.top=void 0!==c?c:1;this.bottom=void 0!==d?d:-1;this.near=void 0!==e?e:.1;this.far=void 0!==f?f:2E3;this.updateProjectionMatrix()}function Rd(){Pb.call(this, -new od(-5,5,5,-5,.5,500))}function Sd(a,b){T.call(this,a,b);this.type="DirectionalLight";this.position.copy(D.DefaultUp);this.updateMatrix();this.target=new D;this.shadow=new Rd}function Td(a,b){T.call(this,a,b);this.type="AmbientLight";this.castShadow=void 0}function Ud(a,b,c,d){T.call(this,a,b);this.type="RectAreaLight";this.width=void 0!==c?c:10;this.height=void 0!==d?d:10}function Vd(a){this.manager=void 0!==a?a:za;this.textures={}}function se(a){this.manager=void 0!==a?a:za}function te(a){this.manager= -void 0!==a?a:za;this.resourcePath=""}function ue(a){"undefined"===typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported.");"undefined"===typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported.");this.manager=void 0!==a?a:za;this.options=void 0}function ve(){this.type="ShapePath";this.color=new A;this.subPaths=[];this.currentPath=null}function we(a){this.type="Font";this.data=a}function Kf(a){this.manager=void 0!==a?a:za}function pd(){} -function xe(a){this.manager=void 0!==a?a:za}function Wd(){this.coefficients=[];for(var a=0;9>a;a++)this.coefficients.push(new n)}function Qa(a,b){T.call(this,void 0,b);this.sh=void 0!==a?a:new Wd}function ye(a,b,c){Qa.call(this,void 0,c);a=(new A).set(a);c=(new A).set(b);b=new n(a.r,a.g,a.b);a=new n(c.r,c.g,c.b);c=Math.sqrt(Math.PI);var d=c*Math.sqrt(.75);this.sh.coefficients[0].copy(b).add(a).multiplyScalar(c);this.sh.coefficients[1].copy(b).sub(a).multiplyScalar(d)}function ze(a,b){Qa.call(this, -void 0,b);a=(new A).set(a);this.sh.coefficients[0].set(a.r,a.g,a.b).multiplyScalar(2*Math.sqrt(Math.PI))}function Lf(){this.type="StereoCamera";this.aspect=1;this.eyeSep=.064;this.cameraL=new ca;this.cameraL.layers.enable(1);this.cameraL.matrixAutoUpdate=!1;this.cameraR=new ca;this.cameraR.layers.enable(2);this.cameraR.matrixAutoUpdate=!1}function qd(a,b,c,d){D.call(this);this.type="CubeCamera";var e=new ca(90,1,a,b);e.up.set(0,-1,0);e.lookAt(new n(1,0,0));this.add(e);var f=new ca(90,1,a,b);f.up.set(0, --1,0);f.lookAt(new n(-1,0,0));this.add(f);var g=new ca(90,1,a,b);g.up.set(0,0,1);g.lookAt(new n(0,1,0));this.add(g);var h=new ca(90,1,a,b);h.up.set(0,0,-1);h.lookAt(new n(0,-1,0));this.add(h);var l=new ca(90,1,a,b);l.up.set(0,-1,0);l.lookAt(new n(0,0,1));this.add(l);var m=new ca(90,1,a,b);m.up.set(0,-1,0);m.lookAt(new n(0,0,-1));this.add(m);d=d||{format:1022,magFilter:1006,minFilter:1006};this.renderTarget=new rb(c,c,d);this.renderTarget.texture.name="CubeCamera";this.update=function(a,b){null=== -this.parent&&this.updateMatrixWorld();var c=a.getRenderTarget(),d=this.renderTarget,q=d.texture.generateMipmaps;d.texture.generateMipmaps=!1;a.setRenderTarget(d,0);a.render(b,e);a.setRenderTarget(d,1);a.render(b,f);a.setRenderTarget(d,2);a.render(b,g);a.setRenderTarget(d,3);a.render(b,h);a.setRenderTarget(d,4);a.render(b,l);d.texture.generateMipmaps=q;a.setRenderTarget(d,5);a.render(b,m);a.setRenderTarget(c)};this.clear=function(a,b,c,d){for(var e=a.getRenderTarget(),f=this.renderTarget,g=0;6>g;g++)a.setRenderTarget(f, -g),a.clear(b,c,d);a.setRenderTarget(e)}}function Ae(a){this.autoStart=void 0!==a?a:!0;this.elapsedTime=this.oldTime=this.startTime=0;this.running=!1}function Be(){D.call(this);this.type="AudioListener";this.context=Ce.getContext();this.gain=this.context.createGain();this.gain.connect(this.context.destination);this.filter=null;this.timeDelta=0}function qc(a){D.call(this);this.type="Audio";this.listener=a;this.context=a.context;this.gain=this.context.createGain();this.gain.connect(a.getInput());this.autoplay= -!1;this.buffer=null;this.detune=0;this.loop=!1;this.offset=this.startTime=0;this.playbackRate=1;this.isPlaying=!1;this.hasPlaybackControl=!0;this.sourceType="empty";this.filters=[]}function De(a){qc.call(this,a);this.panner=this.context.createPanner();this.panner.connect(this.gain)}function Ee(a,b){this.analyser=a.context.createAnalyser();this.analyser.fftSize=void 0!==b?b:2048;this.data=new Uint8Array(this.analyser.frequencyBinCount);a.getOutput().connect(this.analyser)}function Fe(a,b,c){this.binding= -a;this.valueSize=c;a=Float64Array;switch(b){case "quaternion":b=this._slerp;break;case "string":case "bool":a=Array;b=this._select;break;default:b=this._lerp}this.buffer=new a(4*c);this._mixBufferRegion=b;this.referenceCount=this.useCount=this.cumulativeWeight=0}function Mf(a,b,c){c=c||ia.parseTrackName(b);this._targetGroup=a;this._bindings=a.subscribe_(b,c)}function ia(a,b,c){this.path=b;this.parsedPath=c||ia.parseTrackName(b);this.node=ia.findNode(a,this.parsedPath.nodeName)||a;this.rootNode=a} -function Nf(){this.uuid=O.generateUUID();this._objects=Array.prototype.slice.call(arguments);this.nCachedObjects_=0;var a={};this._indicesByUUID=a;for(var b=0,c=arguments.length;b!==c;++b)a[arguments[b].uuid]=b;this._paths=[];this._parsedPaths=[];this._bindings=[];this._bindingsIndicesByPath={};var d=this;this.stats={objects:{get total(){return d._objects.length},get inUse(){return this.total-d.nCachedObjects_}},get bindingsPerObject(){return d._bindings.length}}}function Of(a,b,c){this._mixer=a; -this._clip=b;this._localRoot=c||null;a=b.tracks;b=a.length;c=Array(b);for(var d={endingStart:2400,endingEnd:2400},e=0;e!==b;++e){var f=a[e].createInterpolant(null);c[e]=f;f.settings=d}this._interpolantSettings=d;this._interpolants=c;this._propertyBindings=Array(b);this._weightInterpolant=this._timeScaleInterpolant=this._byClipCacheIndex=this._cacheIndex=null;this.loop=2201;this._loopCount=-1;this._startTime=null;this.time=0;this._effectiveWeight=this.weight=this._effectiveTimeScale=this.timeScale= -1;this.repetitions=Infinity;this.paused=!1;this.enabled=!0;this.clampWhenFinished=!1;this.zeroSlopeAtEnd=this.zeroSlopeAtStart=!0}function Ge(a){this._root=a;this._initMemoryManager();this.time=this._accuIndex=0;this.timeScale=1}function Xd(a,b){"string"===typeof a&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),a=b);this.value=a}function He(){B.call(this);this.type="InstancedBufferGeometry";this.maxInstancedCount=void 0}function Ie(a,b,c){Ab.call(this,a,b);this.meshPerAttribute= -c||1}function Je(a,b,c,d){"number"===typeof c&&(d=c,c=!1,console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument."));H.call(this,a,b,c);this.meshPerAttribute=d||1}function Pf(a,b,c,d){this.ray=new zb(a,b);this.near=c||0;this.far=d||Infinity;this.params={Mesh:{},Line:{},LOD:{},Points:{threshold:1},Sprite:{}};Object.defineProperties(this.params,{PointCloud:{get:function(){console.warn("THREE.Raycaster: params.PointCloud has been renamed to params.Points."); -return this.Points}}})}function Qf(a,b){return a.distance-b.distance}function Ke(a,b,c,d){if(!1!==a.visible&&(a.raycast(b,c),!0===d)){a=a.children;d=0;for(var e=a.length;dc;c++,d++){var e=c/32*Math.PI*2,f=d/32*Math.PI*2;b.push(Math.cos(e),Math.sin(e),1,Math.cos(f),Math.sin(f),1)}a.addAttribute("position",new E(b,3));b=new U({fog:!1});this.cone=new V(a,b);this.add(this.cone);this.update()}function Tf(a){var b=[];a&&a.isBone&&b.push(a);for(var c= -0;cc;c++)b.probe.push(new n);var d=new n,e=new O,f=new O;return{setup:function(c,h,k){for(var g=0,q=0,p=0,v=0;9>v;v++)b.probe[v].set(0,0,0);var l=0,r=0,u=0,n=0,z=0;k=k.matrixWorldInverse;v=0;for(var y=c.length;vFa;Fa++)b.probe[Fa].addScaledVector(x.sh.coefficients[Fa], +G);else if(x.isDirectionalLight){var F=a.get(x);F.color.copy(x.color).multiplyScalar(x.intensity);F.direction.setFromMatrixPosition(x.matrixWorld);d.setFromMatrixPosition(x.target.matrixWorld);F.direction.sub(d);F.direction.transformDirection(k);if(F.shadow=x.castShadow)G=x.shadow,F.shadowBias=G.bias,F.shadowRadius=G.radius,F.shadowMapSize=G.mapSize;b.directionalShadowMap[l]=Fa;b.directionalShadowMatrix[l]=x.shadow.matrix;b.directional[l]=F;l++}else if(x.isSpotLight){F=a.get(x);F.position.setFromMatrixPosition(x.matrixWorld); +F.position.applyMatrix4(k);F.color.copy(A).multiplyScalar(G);F.distance=xa;F.direction.setFromMatrixPosition(x.matrixWorld);d.setFromMatrixPosition(x.target.matrixWorld);F.direction.sub(d);F.direction.transformDirection(k);F.coneCos=Math.cos(x.angle);F.penumbraCos=Math.cos(x.angle*(1-x.penumbra));F.decay=x.decay;if(F.shadow=x.castShadow)G=x.shadow,F.shadowBias=G.bias,F.shadowRadius=G.radius,F.shadowMapSize=G.mapSize;b.spotShadowMap[u]=Fa;b.spotShadowMatrix[u]=x.shadow.matrix;b.spot[u]=F;u++}else if(x.isRectAreaLight)F= +a.get(x),F.color.copy(A).multiplyScalar(G),F.position.setFromMatrixPosition(x.matrixWorld),F.position.applyMatrix4(k),f.identity(),e.copy(x.matrixWorld),e.premultiply(k),f.extractRotation(e),F.halfWidth.set(.5*x.width,0,0),F.halfHeight.set(0,.5*x.height,0),F.halfWidth.applyMatrix4(f),F.halfHeight.applyMatrix4(f),b.rectArea[n]=F,n++;else if(x.isPointLight){F=a.get(x);F.position.setFromMatrixPosition(x.matrixWorld);F.position.applyMatrix4(k);F.color.copy(x.color).multiplyScalar(x.intensity);F.distance= +x.distance;F.decay=x.decay;if(F.shadow=x.castShadow)G=x.shadow,F.shadowBias=G.bias,F.shadowRadius=G.radius,F.shadowMapSize=G.mapSize,F.shadowCameraNear=G.camera.near,F.shadowCameraFar=G.camera.far;b.pointShadowMap[r]=Fa;b.pointShadowMatrix[r]=x.shadow.matrix;b.point[r]=F;r++}else x.isHemisphereLight&&(F=a.get(x),F.direction.setFromMatrixPosition(x.matrixWorld),F.direction.transformDirection(k),F.direction.normalize(),F.skyColor.copy(x.color).multiplyScalar(G),F.groundColor.copy(x.groundColor).multiplyScalar(G), +b.hemi[z]=F,z++)}b.ambient[0]=g;b.ambient[1]=q;b.ambient[2]=p;b.directional.length=l;b.spot.length=u;b.rectArea.length=n;b.point.length=r;b.hemi.length=z;b.hash.stateID=b.id;b.hash.directionalLength=l;b.hash.pointLength=r;b.hash.spotLength=u;b.hash.rectAreaLength=n;b.hash.hemiLength=z;b.hash.shadowsLength=h.length},state:b}}function pf(){var a=new gh,b=[],c=[];return{init:function(){b.length=0;c.length=0},state:{lightsArray:b,shadowsArray:c,lights:a},setupLights:function(d){a.setup(b,c,d)},pushLight:function(a){b.push(a)}, +pushShadow:function(a){c.push(a)}}}function ih(){function a(c){c=c.target;c.removeEventListener("dispose",a);delete b[c.id]}var b={};return{get:function(c,d){if(void 0===b[c.id]){var e=new pf;b[c.id]={};b[c.id][d.id]=e;c.addEventListener("dispose",a)}else void 0===b[c.id][d.id]?(e=new pf,b[c.id][d.id]=e):e=b[c.id][d.id];return e},dispose:function(){b={}}}}function kb(a){L.call(this);this.type="MeshDepthMaterial";this.depthPacking=3200;this.morphTargets=this.skinning=!1;this.displacementMap=this.alphaMap= +this.map=null;this.displacementScale=1;this.displacementBias=0;this.wireframe=!1;this.wireframeLinewidth=1;this.lights=this.fog=!1;this.setValues(a)}function lb(a){L.call(this);this.type="MeshDistanceMaterial";this.referencePosition=new n;this.nearDistance=1;this.farDistance=1E3;this.morphTargets=this.skinning=!1;this.displacementMap=this.alphaMap=this.map=null;this.displacementScale=1;this.displacementBias=0;this.lights=this.fog=!1;this.setValues(a)}function qf(a,b,c){function d(b,c,d,e,f,g){var h= +b.geometry;var k=p;var m=b.customDepthMaterial;d&&(k=v,m=b.customDistanceMaterial);m?k=m:(m=!1,c.morphTargets&&(h&&h.isBufferGeometry?m=h.morphAttributes&&h.morphAttributes.position&&0d||a.height>d)e=d/Math.max(a.width,a.height);if(1>e||!0===b){if("undefined"!==typeof HTMLImageElement&&a instanceof +HTMLImageElement||"undefined"!==typeof HTMLCanvasElement&&a instanceof HTMLCanvasElement||"undefined"!==typeof ImageBitmap&&a instanceof ImageBitmap)return d=b?P.floorPowerOfTwo:Math.floor,b=d(e*a.width),e=d(e*a.height),void 0===xb&&(xb=h(b,e)),c=c?h(b,e):xb,c.width=b,c.height=e,c.getContext("2d").drawImage(a,0,0,b,e),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+a.width+"x"+a.height+") to ("+b+"x"+e+")."),c;"data"in a&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+ +a.width+"x"+a.height+").")}return a}function m(a){return P.isPowerOfTwo(a.width)&&P.isPowerOfTwo(a.height)}function q(a,b){return a.generateMipmaps&&b&&1003!==a.minFilter&&1006!==a.minFilter}function p(b,c,e,f){a.generateMipmap(b);d.get(c).__maxMipLevel=Math.log(Math.max(e,f))*Math.LOG2E}function v(a,c){if(!e.isWebGL2)return a;var d=a;6403===a&&(5126===c&&(d=33326),5131===c&&(d=33325),5121===c&&(d=33321));6407===a&&(5126===c&&(d=34837),5131===c&&(d=34843),5121===c&&(d=32849));6408===a&&(5126===c&& +(d=34836),5131===c&&(d=34842),5121===c&&(d=32856));33325===d||33326===d||34842===d||34836===d?b.get("EXT_color_buffer_float"):(34843===d||34837===d)&&console.warn("THREE.WebGLRenderer: Floating point textures with RGB format not supported. Please use RGBA instead.");return d}function l(a){return 1003===a||1004===a||1005===a?9728:9729}function r(b){b=b.target;b.removeEventListener("dispose",r);var c=d.get(b);void 0!==c.__webglInit&&(a.deleteTexture(c.__webglTexture),d.remove(b));b.isVideoTexture&& +delete ib[b.id];g.memory.textures--}function u(b){b=b.target;b.removeEventListener("dispose",u);var c=d.get(b),e=d.get(b.texture);if(b){void 0!==e.__webglTexture&&a.deleteTexture(e.__webglTexture);b.depthTexture&&b.depthTexture.dispose();if(b.isWebGLRenderTargetCube)for(e=0;6>e;e++)a.deleteFramebuffer(c.__webglFramebuffer[e]),c.__webglDepthbuffer&&a.deleteRenderbuffer(c.__webglDepthbuffer[e]);else a.deleteFramebuffer(c.__webglFramebuffer),c.__webglDepthbuffer&&a.deleteRenderbuffer(c.__webglDepthbuffer); +d.remove(b.texture);d.remove(b)}g.memory.textures--}function n(a,b){var e=d.get(a);if(a.isVideoTexture){var f=a.id,h=g.render.frame;ib[f]!==h&&(ib[f]=h,a.update())}if(0t;t++)r[t]=g||l?l?b.image[t].image:b.image[t]:k(b.image[t],!1,!0,e.maxCubemapSize);var u=r[0],n=m(u)||e.isWebGL2,w=f.convert(b.format),y=f.convert(b.type),G=v(w,y);x(34067,b,n);for(t=0;6>t;t++)if(g)for(var R,z=r[t].mipmaps, +ma=0,F=z.length;ma=e.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+a+" texture units while this GPU supports only "+e.maxTextures);Y+=1; +return a};this.resetTextureUnits=function(){Y=0};this.setTexture2D=n;this.setTexture2DArray=function(a,b){var e=d.get(a);0r;r++)h.__webglFramebuffer[r]=a.createFramebuffer();else if(h.__webglFramebuffer=a.createFramebuffer(),r)if(e.isWebGL2){h.__webglMultisampledFramebuffer=a.createFramebuffer();h.__webglColorRenderbuffer=a.createRenderbuffer();a.bindRenderbuffer(36161,h.__webglColorRenderbuffer);r= +f.convert(b.texture.format);var w=f.convert(b.texture.type);r=v(r,w);w=F(b);a.renderbufferStorageMultisample(36161,w,r,b.width,b.height);a.bindFramebuffer(36160,h.__webglMultisampledFramebuffer);a.framebufferRenderbuffer(36160,36064,36161,h.__webglColorRenderbuffer);a.bindRenderbuffer(36161,null);b.depthBuffer&&(h.__webglDepthRenderbuffer=a.createRenderbuffer(),D(h.__webglDepthRenderbuffer,b,!0));a.bindFramebuffer(36160,null)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2."); +if(l){c.bindTexture(34067,k.__webglTexture);x(34067,b.texture,t);for(r=0;6>r;r++)xa(h.__webglFramebuffer[r],b,36064,34069+r);q(b.texture,t)&&p(34067,b.texture,b.width,b.height);c.bindTexture(34067,null)}else c.bindTexture(3553,k.__webglTexture),x(3553,b.texture,t),xa(h.__webglFramebuffer,b,36064,3553),q(b.texture,t)&&p(3553,b.texture,b.width,b.height),c.bindTexture(3553,null);if(b.depthBuffer){h=d.get(b);k=!0===b.isWebGLRenderTargetCube;if(b.depthTexture){if(k)throw Error("target.depthTexture not supported in Cube render targets"); +if(b&&b.isWebGLRenderTargetCube)throw Error("Depth Texture with cube render targets is not supported");a.bindFramebuffer(36160,h.__webglFramebuffer);if(!b.depthTexture||!b.depthTexture.isDepthTexture)throw Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");d.get(b.depthTexture).__webglTexture&&b.depthTexture.image.width===b.width&&b.depthTexture.image.height===b.height||(b.depthTexture.image.width=b.width,b.depthTexture.image.height=b.height,b.depthTexture.needsUpdate=!0); +n(b.depthTexture,0);h=d.get(b.depthTexture).__webglTexture;if(1026===b.depthTexture.format)a.framebufferTexture2D(36160,36096,3553,h,0);else if(1027===b.depthTexture.format)a.framebufferTexture2D(36160,33306,3553,h,0);else throw Error("Unknown depthTexture format");}else if(k)for(h.__webglDepthbuffer=[],k=0;6>k;k++)a.bindFramebuffer(36160,h.__webglFramebuffer[k]),h.__webglDepthbuffer[k]=a.createRenderbuffer(),D(h.__webglDepthbuffer[k],b);else a.bindFramebuffer(36160,h.__webglFramebuffer),h.__webglDepthbuffer= +a.createRenderbuffer(),D(h.__webglDepthbuffer,b);a.bindFramebuffer(36160,null)}};this.updateRenderTargetMipmap=function(a){var b=a.texture,f=m(a)||e.isWebGL2;if(q(b,f)){f=a.isWebGLRenderTargetCube?34067:3553;var g=d.get(b).__webglTexture;c.bindTexture(f,g);p(f,b,a.width,a.height);c.bindTexture(f,null)}};this.updateMultisampleRenderTarget=function(b){if(b.isWebGLMultisampleRenderTarget)if(e.isWebGL2){var c=d.get(b);a.bindFramebuffer(36008,c.__webglMultisampledFramebuffer);a.bindFramebuffer(36009,c.__webglFramebuffer); +c=b.width;var f=b.height,g=16384;b.depthBuffer&&(g|=256);b.stencilBuffer&&(g|=1024);a.blitFramebuffer(0,0,c,f,0,0,c,f,g,9728)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")};this.safeSetTexture2D=function(a,b){a&&a.isWebGLRenderTarget&&(!1===C&&(console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),C=!0),a=a.texture);n(a,b)};this.safeSetTextureCube=function(a,b){a&&a.isWebGLRenderTargetCube&& +(!1===H&&(console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."),H=!0),a=a.texture);a&&a.isCubeTexture||Array.isArray(a.image)&&6===a.image.length?z(a,b):y(a,b)}}function sf(a,b,c){return{convert:function(a){if(1E3===a)return 10497;if(1001===a)return 33071;if(1002===a)return 33648;if(1003===a)return 9728;if(1004===a)return 9984;if(1005===a)return 9986;if(1006===a)return 9729;if(1007===a)return 9985;if(1008===a)return 9987; +if(1009===a)return 5121;if(1017===a)return 32819;if(1018===a)return 32820;if(1019===a)return 33635;if(1010===a)return 5120;if(1011===a)return 5122;if(1012===a)return 5123;if(1013===a)return 5124;if(1014===a)return 5125;if(1015===a)return 5126;if(1016===a){if(c.isWebGL2)return 5131;var d=b.get("OES_texture_half_float");if(null!==d)return d.HALF_FLOAT_OES}if(1021===a)return 6406;if(1022===a)return 6407;if(1023===a)return 6408;if(1024===a)return 6409;if(1025===a)return 6410;if(1026===a)return 6402;if(1027=== +a)return 34041;if(1028===a)return 6403;if(100===a)return 32774;if(101===a)return 32778;if(102===a)return 32779;if(200===a)return 0;if(201===a)return 1;if(202===a)return 768;if(203===a)return 769;if(204===a)return 770;if(205===a)return 771;if(206===a)return 772;if(207===a)return 773;if(208===a)return 774;if(209===a)return 775;if(210===a)return 776;if(33776===a||33777===a||33778===a||33779===a)if(d=b.get("WEBGL_compressed_texture_s3tc"),null!==d){if(33776===a)return d.COMPRESSED_RGB_S3TC_DXT1_EXT;if(33777=== +a)return d.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(33778===a)return d.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(33779===a)return d.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(35840===a||35841===a||35842===a||35843===a)if(d=b.get("WEBGL_compressed_texture_pvrtc"),null!==d){if(35840===a)return d.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(35841===a)return d.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(35842===a)return d.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(35843===a)return d.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(36196===a&&(d=b.get("WEBGL_compressed_texture_etc1"), +null!==d))return d.COMPRESSED_RGB_ETC1_WEBGL;if(37808===a||37809===a||37810===a||37811===a||37812===a||37813===a||37814===a||37815===a||37816===a||37817===a||37818===a||37819===a||37820===a||37821===a)if(d=b.get("WEBGL_compressed_texture_astc"),null!==d)return a;if(103===a||104===a){if(c.isWebGL2){if(103===a)return 32775;if(104===a)return 32776}d=b.get("EXT_blend_minmax");if(null!==d){if(103===a)return d.MIN_EXT;if(104===a)return d.MAX_EXT}}if(1020===a){if(c.isWebGL2)return 34042;d=b.get("WEBGL_depth_texture"); +if(null!==d)return d.UNSIGNED_INT_24_8_WEBGL}return 0}}}function Yb(){H.call(this);this.type="Group"}function Xa(){H.call(this);this.type="Camera";this.matrixWorldInverse=new O;this.projectionMatrix=new O;this.projectionMatrixInverse=new O}function ja(a,b,c,d){Xa.call(this);this.type="PerspectiveCamera";this.fov=void 0!==a?a:50;this.zoom=1;this.near=void 0!==c?c:.1;this.far=void 0!==d?d:2E3;this.focus=10;this.aspect=void 0!==b?b:1;this.view=null;this.filmGauge=35;this.filmOffset=0;this.updateProjectionMatrix()} +function Lc(a){ja.call(this);this.cameras=a||[]}function tf(a,b,c){uf.setFromMatrixPosition(b.matrixWorld);vf.setFromMatrixPosition(c.matrixWorld);var d=uf.distanceTo(vf),e=b.projectionMatrix.elements,f=c.projectionMatrix.elements,g=e[14]/(e[10]-1);c=e[14]/(e[10]+1);var h=(e[9]+1)/e[5],k=(e[9]-1)/e[5],m=(e[8]-1)/e[0],q=(f[8]+1)/f[0];e=g*m;f=g*q;q=d/(-m+q);m=q*-m;b.matrixWorld.decompose(a.position,a.quaternion,a.scale);a.translateX(m);a.translateZ(q);a.matrixWorld.compose(a.position,a.quaternion,a.scale); +a.matrixWorldInverse.getInverse(a.matrixWorld);b=g+q;g=c+q;a.projectionMatrix.makePerspective(e-m,f+(d-m),h*c/g*b,k*c/g*b,b,g)}function wf(a){function b(){return null!==h&&!0===h.isPresenting}function c(){if(b()){var c=h.getEyeParameters("left");e=2*c.renderWidth*l;f=c.renderHeight*l;xa=a.getPixelRatio();a.getSize(G);a.setDrawingBufferSize(e,f,1);y.viewport.set(0,0,e/2,f);x.viewport.set(e/2,0,e/2,f);F.start()}else g.enabled&&a.setDrawingBufferSize(G.width,G.height,xa),F.stop()}function d(a,b){null!== +b&&4===b.length&&a.set(b[0]*e,b[1]*f,b[2]*e,b[3]*f)}var e,f,g=this,h=null,k=null,m=null,q=[],p=new O,v=new O,l=1,r="local-floor";"undefined"!==typeof window&&"VRFrameData"in window&&(k=new window.VRFrameData,window.addEventListener("vrdisplaypresentchange",c,!1));var u=new O,w=new ea,z=new n,y=new ja;y.viewport=new ba;y.layers.enable(1);var x=new ja;x.viewport=new ba;x.layers.enable(2);var A=new Lc([y,x]);A.layers.enable(1);A.layers.enable(2);var G=new D,xa,C=[];this.enabled=!1;this.getController= +function(a){var b=q[a];void 0===b&&(b=new Yb,b.matrixAutoUpdate=!1,b.visible=!1,q[a]=b);return b};this.getDevice=function(){return h};this.setDevice=function(a){void 0!==a&&(h=a);F.setContext(a)};this.setFramebufferScaleFactor=function(a){l=a};this.setReferenceSpaceType=function(a){r=a};this.setPoseTarget=function(a){void 0!==a&&(m=a)};this.getCamera=function(a){var c="local-floor"===r?1.6:0;if(!1===b())return a.position.set(0,c,0),a.rotation.set(0,0,0),a;h.depthNear=a.near;h.depthFar=a.far;h.getFrameData(k); +if("local-floor"===r){var e=h.stageParameters;e?p.fromArray(e.sittingToStandingTransform):p.makeTranslation(0,c,0)}c=k.pose;e=null!==m?m:a;e.matrix.copy(p);e.matrix.decompose(e.position,e.quaternion,e.scale);null!==c.orientation&&(w.fromArray(c.orientation),e.quaternion.multiply(w));null!==c.position&&(w.setFromRotationMatrix(p),z.fromArray(c.position),z.applyQuaternion(w),e.position.add(z));e.updateMatrixWorld();y.near=a.near;x.near=a.near;y.far=a.far;x.far=a.far;y.matrixWorldInverse.fromArray(k.leftViewMatrix); +x.matrixWorldInverse.fromArray(k.rightViewMatrix);v.getInverse(p);"local-floor"===r&&(y.matrixWorldInverse.multiply(v),x.matrixWorldInverse.multiply(v));a=e.parent;null!==a&&(u.getInverse(a.matrixWorld),y.matrixWorldInverse.multiply(u),x.matrixWorldInverse.multiply(u));y.matrixWorld.getInverse(y.matrixWorldInverse);x.matrixWorld.getInverse(x.matrixWorldInverse);y.projectionMatrix.fromArray(k.leftProjectionMatrix);x.projectionMatrix.fromArray(k.rightProjectionMatrix);tf(A,y,x);a=h.getLayers();a.length&& +(a=a[0],d(y.viewport,a.leftBounds),d(x.viewport,a.rightBounds));a:for(a=0;af.matrixWorld.determinant();da.setMaterial(e,h);var k=l(a,c,e,f),m=!1;if(b!==d.id||I!==k.id||U!==(!0===e.wireframe))b=d.id,I=k.id,U=!0===e.wireframe,m=!0;f.morphTargetInfluences&&(za.update(f,d,e,k),m=!0);h=d.index;var q=d.attributes.position;c=1;!0===e.wireframe&&(h=va.getWireframeAttribute(d), +c=2);a=Ba;if(null!==h){var p=ua.get(h);a=Ca;a.setIndex(p)}if(m){if(d&&d.isInstancedBufferGeometry&&!Ea.isWebGL2&&null===la.get("ANGLE_instanced_arrays"))console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");else{da.initAttributes();m=d.attributes;k=k.getAttributes();var v=e.defaultAttributeValues;for(A in k){var r=k[A];if(0<=r){var t=m[A];if(void 0!==t){var u=t.normalized,n=t.itemSize,w=ua.get(t); +if(void 0!==w){var x=w.buffer,y=w.type;w=w.bytesPerElement;if(t.isInterleavedBufferAttribute){var G=t.data,z=G.stride;t=t.offset;G&&G.isInstancedInterleavedBuffer?(da.enableAttributeAndDivisor(r,G.meshPerAttribute),void 0===d.maxInstancedCount&&(d.maxInstancedCount=G.meshPerAttribute*G.count)):da.enableAttribute(r);M.bindBuffer(34962,x);M.vertexAttribPointer(r,n,y,u,z*w,t*w)}else t.isInstancedBufferAttribute?(da.enableAttributeAndDivisor(r,t.meshPerAttribute),void 0===d.maxInstancedCount&&(d.maxInstancedCount= +t.meshPerAttribute*t.count)):da.enableAttribute(r),M.bindBuffer(34962,x),M.vertexAttribPointer(r,n,y,u,0,0)}}else if(void 0!==v&&(u=v[A],void 0!==u))switch(u.length){case 2:M.vertexAttrib2fv(r,u);break;case 3:M.vertexAttrib3fv(r,u);break;case 4:M.vertexAttrib4fv(r,u);break;default:M.vertexAttrib1fv(r,u)}}}da.disableUnusedAttributes()}null!==h&&M.bindBuffer(34963,p.buffer)}p=Infinity;null!==h?p=h.count:void 0!==q&&(p=q.count);h=d.drawRange.start*c;q=null!==g?g.start*c:0;var A=Math.max(h,q);g=Math.max(0, +Math.min(p,h+d.drawRange.count*c,q+(null!==g?g.count*c:Infinity))-1-A+1);if(0!==g){if(f.isMesh)if(!0===e.wireframe)da.setLineWidth(e.wireframeLinewidth*(null===L?ca:1)),a.setMode(1);else switch(f.drawMode){case 0:a.setMode(4);break;case 1:a.setMode(5);break;case 2:a.setMode(6)}else f.isLine?(e=e.linewidth,void 0===e&&(e=1),da.setLineWidth(e*(null===L?ca:1)),f.isLineSegments?a.setMode(1):f.isLineLoop?a.setMode(2):a.setMode(3)):f.isPoints?a.setMode(0):f.isSprite&&a.setMode(4);d&&d.isInstancedBufferGeometry? +0c;c++){var p=q[h[c]];var l=q[h[(c+1)%3]];f[0]=Math.min(p,l);f[1]=Math.max(p,l);p=f[0]+ +","+f[1];void 0===g[p]&&(g[p]={index1:f[0],index2:f[1]})}}for(p in g)m=g[p],h=a.vertices[m.index1],b.push(h.x,h.y,h.z),h=a.vertices[m.index2],b.push(h.x,h.y,h.z)}else if(a&&a.isBufferGeometry)if(h=new n,null!==a.index){k=a.attributes.position;q=a.index;var t=a.groups;0===t.length&&(t=[{start:0,count:q.count,materialIndex:0}]);a=0;for(e=t.length;ac;c++)p=q.getX(m+c),l=q.getX(m+(c+1)%3),f[0]=Math.min(p,l),f[1]=Math.max(p,l),p=f[0]+","+ +f[1],void 0===g[p]&&(g[p]={index1:f[0],index2:f[1]});for(p in g)m=g[p],h.fromBufferAttribute(k,m.index1),b.push(h.x,h.y,h.z),h.fromBufferAttribute(k,m.index2),b.push(h.x,h.y,h.z)}else for(k=a.attributes.position,m=0,d=k.count/3;mc;c++)g=3*m+c,h.fromBufferAttribute(k,g),b.push(h.x,h.y,h.z),g=3*m+(c+1)%3,h.fromBufferAttribute(k,g),b.push(h.x,h.y,h.z);this.addAttribute("position",new C(b,3))}function Sc(a,b,c){Q.call(this);this.type="ParametricGeometry";this.parameters={func:a,slices:b, +stacks:c};this.fromBufferGeometry(new cc(a,b,c));this.mergeVertices()}function cc(a,b,c){E.call(this);this.type="ParametricBufferGeometry";this.parameters={func:a,slices:b,stacks:c};var d=[],e=[],f=[],g=[],h=new n,k=new n,m=new n,q=new n,p=new n,l,t;3>a.length&&console.error("THREE.ParametricGeometry: Function must now modify a Vector3 as third parameter.");var r=b+1;for(l=0;l<=c;l++){var u=l/c;for(t=0;t<=b;t++){var w=t/b;a(w,u,k);e.push(k.x,k.y,k.z);0<=w-1E-5?(a(w-1E-5,u,m),q.subVectors(k,m)):(a(w+ +1E-5,u,m),q.subVectors(m,k));0<=u-1E-5?(a(w,u-1E-5,m),p.subVectors(k,m)):(a(w,u+1E-5,m),p.subVectors(m,k));h.crossVectors(q,p).normalize();f.push(h.x,h.y,h.z);g.push(w,u)}}for(l=0;ld&&1===a.x&&(k[b]=a.x-1);0===c.x&&0===c.z&&(k[b]=d/2/Math.PI+.5)}E.call(this);this.type="PolyhedronBufferGeometry";this.parameters={vertices:a,indices:b,radius:c,detail:d};c=c||1;d=d||0;var h=[],k=[];(function(a){for(var c=new n,d=new n,g=new n,h=0;he&&(.2>b&&(k[a+0]+=1),.2>c&&(k[a+2]+=1),.2>d&&(k[a+4]+=1))})();this.addAttribute("position",new C(h,3));this.addAttribute("normal",new C(h.slice(),3));this.addAttribute("uv",new C(k,2));0===d?this.computeVertexNormals():this.normalizeNormals()}function Uc(a,b){Q.call(this);this.type="TetrahedronGeometry";this.parameters={radius:a,detail:b};this.fromBufferGeometry(new dc(a,b));this.mergeVertices()} +function dc(a,b){oa.call(this,[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],a,b);this.type="TetrahedronBufferGeometry";this.parameters={radius:a,detail:b}}function Vc(a,b){Q.call(this);this.type="OctahedronGeometry";this.parameters={radius:a,detail:b};this.fromBufferGeometry(new Cb(a,b));this.mergeVertices()}function Cb(a,b){oa.call(this,[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],a,b);this.type="OctahedronBufferGeometry";this.parameters= +{radius:a,detail:b}}function Wc(a,b){Q.call(this);this.type="IcosahedronGeometry";this.parameters={radius:a,detail:b};this.fromBufferGeometry(new ec(a,b));this.mergeVertices()}function ec(a,b){var c=(1+Math.sqrt(5))/2;oa.call(this,[-1,c,0,1,c,0,-1,-c,0,1,-c,0,0,-1,c,0,1,c,0,-1,-c,0,1,-c,c,0,-1,c,0,1,-c,0,-1,-c,0,1],[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],a,b);this.type="IcosahedronBufferGeometry";this.parameters= +{radius:a,detail:b}}function Xc(a,b){Q.call(this);this.type="DodecahedronGeometry";this.parameters={radius:a,detail:b};this.fromBufferGeometry(new fc(a,b));this.mergeVertices()}function fc(a,b){var c=(1+Math.sqrt(5))/2,d=1/c;oa.call(this,[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-d,-c,0,-d,c,0,d,-c,0,d,c,-d,-c,0,-d,c,0,d,-c,0,d,c,0,-c,0,-d,c,0,-d,-c,0,d,c,0,d],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2, +6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],a,b);this.type="DodecahedronBufferGeometry";this.parameters={radius:a,detail:b}}function Yc(a,b,c,d,e,f){Q.call(this);this.type="TubeGeometry";this.parameters={path:a,tubularSegments:b,radius:c,radialSegments:d,closed:e};void 0!==f&&console.warn("THREE.TubeGeometry: taper has been removed.");a=new Db(a,b,c,d,e);this.tangents=a.tangents;this.normals= +a.normals;this.binormals=a.binormals;this.fromBufferGeometry(a);this.mergeVertices()}function Db(a,b,c,d,e){function f(e){q=a.getPointAt(e/b,q);var f=g.normals[e];e=g.binormals[e];for(l=0;l<=d;l++){var m=l/d*Math.PI*2,p=Math.sin(m);m=-Math.cos(m);k.x=m*f.x+p*e.x;k.y=m*f.y+p*e.y;k.z=m*f.z+p*e.z;k.normalize();r.push(k.x,k.y,k.z);h.x=q.x+c*k.x;h.y=q.y+c*k.y;h.z=q.z+c*k.z;t.push(h.x,h.y,h.z)}}E.call(this);this.type="TubeBufferGeometry";this.parameters={path:a,tubularSegments:b,radius:c,radialSegments:d, +closed:e};b=b||64;c=c||1;d=d||8;e=e||!1;var g=a.computeFrenetFrames(b,e);this.tangents=g.tangents;this.normals=g.normals;this.binormals=g.binormals;var h=new n,k=new n,m=new D,q=new n,p,l,t=[],r=[],u=[],w=[];for(p=0;p=b;e-=d)f=zf(e,a[e],a[e+1],f);f&&Eb(f,f.next)&&(ad(f),f=f.next);return f}function bd(a,b){if(!a)return a;b||(b=a);do{var c=!1;if(a.steiner||!Eb(a,a.next)&&0!==qa(a.prev,a,a.next))a=a.next;else{ad(a);a=b=a.prev;if(a===a.next)break;c=!0}}while(c||a!==b);return b}function cd(a,b,c,d,e,f,g){if(a){if(!g&&f){var h=a,k=h;do null===k.z&&(k.z=qe(k.x,k.y,d,e,f)),k.prevZ=k.prev,k=k.nextZ= +k.next;while(k!==h);k.prevZ.nextZ=null;k.prevZ=null;h=k;var m,q,p,l,t=1;do{k=h;var r=h=null;for(q=0;k;){q++;var n=k;for(m=p=0;mp.x?q.x>t.x?q.x:t.x:p.x>t.x?p.x:t.x,x=q.y>p.y?q.y>t.y?q.y:t.y:p.y> +t.y?p.y:t.y;m=qe(q.x=m;){if(w!==r.prev&&w!==r.next&&Id(q.x,q.y,p.x,p.y,t.x,t.y,w.x,w.y)&&0<=qa(w.prev,w,w.next)){r=!1;break a}w=w.prevZ}r=!0}}else a:if(r=a,q=r.prev,p=r,t=r.next,0<=qa(q,p,t))r=!1;else{for(m=r.next.next;m!==r.prev;){if(Id(q.x,q.y, +p.x,p.y,t.x,t.y,m.x,m.y)&&0<=qa(m.prev,m,m.next)){r=!1;break a}m=m.next}r=!0}if(r)b.push(k.i/c),b.push(a.i/c),b.push(n.i/c),ad(a),h=a=n.next;else if(a=n,a===h){if(!g)cd(bd(a),b,c,d,e,f,1);else if(1===g){g=b;h=c;k=a;do n=k.prev,r=k.next.next,!Eb(n,r)&&Af(n,k,k.next,r)&&dd(n,r)&&dd(r,n)&&(g.push(n.i/h),g.push(k.i/h),g.push(r.i/h),ad(k),ad(k.next),k=a=r),k=k.next;while(k!==a);a=k;cd(a,b,c,d,e,f,2)}else if(2===g)a:{g=a;do{for(h=g.next.next;h!==g.prev;){if(k=g.i!==h.i){k=g;n=h;if(r=k.next.i!==n.i&&k.prev.i!== +n.i){b:{r=k;do{if(r.i!==k.i&&r.next.i!==k.i&&r.i!==n.i&&r.next.i!==n.i&&Af(r,r.next,k,n)){r=!0;break b}r=r.next}while(r!==k);r=!1}r=!r}if(r=r&&dd(k,n)&&dd(n,k)){r=k;q=!1;p=(k.x+n.x)/2;n=(k.y+n.y)/2;do r.y>n!==r.next.y>n&&r.next.y!==r.y&&p<(r.next.x-r.x)*(n-r.y)/(r.next.y-r.y)+r.x&&(q=!q),r=r.next;while(r!==k);r=q}k=r}if(k){a=Bf(g,h);g=bd(g,g.next);a=bd(a,a.next);cd(g,b,c,d,e,f);cd(a,b,c,d,e,f);break a}h=h.next}g=g.next}while(g!==a)}break}}}}function mh(a,b){return a.x-b.x}function nh(a,b){var c=b, +d=a.x,e=a.y,f=-Infinity;do{if(e<=c.y&&e>=c.next.y&&c.next.y!==c.y){var g=c.x+(e-c.y)*(c.next.x-c.x)/(c.next.y-c.y);if(g<=d&&g>f){f=g;if(g===d){if(e===c.y)return c;if(e===c.next.y)return c.next}var h=c.x=c.x&&c.x>=g&&d!==c.x&&Id(eh.x)&&dd(c,a)&&(h=c,m=q)}c=c.next}return h}function qe(a, +b,c,d,e){a=32767*(a-c)*e;b=32767*(b-d)*e;a=(a|a<<8)&16711935;a=(a|a<<4)&252645135;a=(a|a<<2)&858993459;b=(b|b<<8)&16711935;b=(b|b<<4)&252645135;b=(b|b<<2)&858993459;return(a|a<<1)&1431655765|((b|b<<1)&1431655765)<<1}function oh(a){var b=a,c=a;do b.xqa(a.prev,a,a.next)?0<=qa(a,b,a.next)&&0<=qa(a,a.prev,b):0>qa(a,b,a.prev)||0>qa(a,a.next,b)}function Bf(a,b){var c=new re(a.i,a.x,a.y),d=new re(b.i,b.x,b.y),e=a.next,f=b.prev;a.next=b;b.prev=a;c.next=e;e.prev=c;d.next=c;c.prev=d;f.next=d;d.prev=f;return d}function zf(a,b,c,d){a=new re(a,b,c);d?(a.next=d.next,a.prev=d,d.next.prev=a,d.next=a): +(a.prev=a,a.next=a);return a}function ad(a){a.next.prev=a.prev;a.prev.next=a.next;a.prevZ&&(a.prevZ.nextZ=a.nextZ);a.nextZ&&(a.nextZ.prevZ=a.prevZ)}function re(a,b,c){this.i=a;this.x=b;this.y=c;this.nextZ=this.prevZ=this.z=this.next=this.prev=null;this.steiner=!1}function Cf(a){var b=a.length;2Number.EPSILON){var k=Math.sqrt(h),m=Math.sqrt(f*f+g*g);h=b.x-e/k;b=b.y+d/k;g=((c.x-g/m-h)*g-(c.y+f/m-b)*f)/(d*g-e*f);f=h+d*g-a.x;d=b+e*g-a.y;e=f*f+d*d;if(2>=e)return new D(f,d);e=Math.sqrt(e/2)}else a=!1,d>Number.EPSILON? +f>Number.EPSILON&&(a=!0):d<-Number.EPSILON?f<-Number.EPSILON&&(a=!0):Math.sign(e)===Math.sign(g)&&(a=!0),a?(f=-e,e=Math.sqrt(h)):(f=d,d=e,e=Math.sqrt(h/2));return new D(f/e,d/e)}function h(a,b){for(K=a.length;0<=--K;){var c=K;var f=K-1;0>f&&(f=a.length-1);var g,h=y+2*F;for(g=0;gq;q++){var l=m[f[q]];var n=m[f[(q+1)%3]];d[0]=Math.min(l,n);d[1]=Math.max(l,n);l=d[0]+","+d[1];void 0===e[l]?e[l]={index1:d[0],index2:d[1],face1:h,face2:void 0}:e[l].face2=h}for(l in e)if(d=e[l],void 0===d.face2||g[d.face1].normal.dot(g[d.face2].normal)<=b)f=a[d.index1],c.push(f.x,f.y,f.z),f=a[d.index2],c.push(f.x,f.y,f.z);this.addAttribute("position",new C(c,3))}function Ib(a,b,c,d, +e,f,g,h){Q.call(this);this.type="CylinderGeometry";this.parameters={radiusTop:a,radiusBottom:b,height:c,radialSegments:d,heightSegments:e,openEnded:f,thetaStart:g,thetaLength:h};this.fromBufferGeometry(new eb(a,b,c,d,e,f,g,h));this.mergeVertices()}function eb(a,b,c,d,e,f,g,h){function k(c){var e,f=new D,k=new n,p=0,u=!0===c?a:b,y=!0===c?1:-1;var C=r;for(e=1;e<=d;e++)l.push(0,w*y,0),v.push(0,y,0),t.push(.5,.5),r++;var E=r;for(e=0;e<=d;e++){var B=e/d*h+g,H=Math.cos(B);B=Math.sin(B);k.x=u*B;k.y=w*y; +k.z=u*H;l.push(k.x,k.y,k.z);v.push(0,y,0);f.x=.5*H+.5;f.y=.5*B*y+.5;t.push(f.x,f.y);r++}for(e=0;ethis.duration&&this.resetDuration()}function qh(a){switch(a.toLowerCase()){case "scalar":case "double":case "float":case "number":case "integer":return oc;case "vector":case "vector2":case "vector3":case "vector4":return pc; +case "color":return Md;case "quaternion":return md;case "bool":case "boolean":return Ld;case "string":return Od}throw Error("THREE.KeyframeTrack: Unsupported typeName: "+a);}function rh(a){if(void 0===a.type)throw Error("THREE.KeyframeTrack: track type undefined, can not parse");var b=qh(a.type);if(void 0===a.times){var c=[],d=[];ra.flattenJSON(a.keys,c,d,"value");a.times=c;a.values=d}return void 0!==b.parse?b.parse(a):new b(a.name,a.times,a.values,a.interpolation)}function se(a,b,c){var d=this,e= +!1,f=0,g=0,h=void 0;this.onStart=void 0;this.onLoad=a;this.onProgress=b;this.onError=c;this.itemStart=function(a){g++;if(!1===e&&void 0!==d.onStart)d.onStart(a,f,g);e=!0};this.itemEnd=function(a){f++;if(void 0!==d.onProgress)d.onProgress(a,f,g);if(f===g&&(e=!1,void 0!==d.onLoad))d.onLoad()};this.itemError=function(a){if(void 0!==d.onError)d.onError(a)};this.resolveURL=function(a){return h?h(a):a};this.setURLModifier=function(a){h=a;return this}}function La(a){this.manager=void 0!==a?a:za}function Gf(a){this.manager= +void 0!==a?a:za}function Hf(a){this.manager=void 0!==a?a:za;this._parser=null}function te(a){this.manager=void 0!==a?a:za;this._parser=null}function nd(a){this.manager=void 0!==a?a:za}function ue(a){this.manager=void 0!==a?a:za}function Pd(a){this.manager=void 0!==a?a:za}function N(){this.type="Curve";this.arcLengthDivisions=200}function Aa(a,b,c,d,e,f,g,h){N.call(this);this.type="EllipseCurve";this.aX=a||0;this.aY=b||0;this.xRadius=c||1;this.yRadius=d||1;this.aStartAngle=e||0;this.aEndAngle=f||2* +Math.PI;this.aClockwise=g||!1;this.aRotation=h||0}function qc(a,b,c,d,e,f){Aa.call(this,a,b,c,c,d,e,f);this.type="ArcCurve"}function ve(){var a=0,b=0,c=0,d=0;return{initCatmullRom:function(e,f,g,h,k){e=k*(g-e);h=k*(h-f);a=f;b=e;c=-3*f+3*g-2*e-h;d=2*f-2*g+e+h},initNonuniformCatmullRom:function(e,f,g,h,k,m,q){e=((f-e)/k-(g-e)/(k+m)+(g-f)/m)*m;h=((g-f)/m-(h-f)/(m+q)+(h-g)/q)*m;a=f;b=e;c=-3*f+3*g-2*e-h;d=2*f-2*g+e+h},calc:function(e){var f=e*e;return a+b*e+c*f+d*f*e}}}function ua(a,b,c,d){N.call(this); +this.type="CatmullRomCurve3";this.points=a||[];this.closed=b||!1;this.curveType=c||"centripetal";this.tension=d||.5}function If(a,b,c,d,e){b=.5*(d-b);e=.5*(e-c);var f=a*a;return(2*c-2*d+b+e)*a*f+(-3*c+3*d-2*b-e)*f+b*a+c}function od(a,b,c,d){var e=1-a;return e*e*b+2*(1-a)*a*c+a*a*d}function pd(a,b,c,d,e){var f=1-a,g=1-a;return f*f*f*b+3*g*g*a*c+3*(1-a)*a*a*d+a*a*a*e}function Ma(a,b,c,d){N.call(this);this.type="CubicBezierCurve";this.v0=a||new D;this.v1=b||new D;this.v2=c||new D;this.v3=d||new D}function $a(a, +b,c,d){N.call(this);this.type="CubicBezierCurve3";this.v0=a||new n;this.v1=b||new n;this.v2=c||new n;this.v3=d||new n}function Ba(a,b){N.call(this);this.type="LineCurve";this.v1=a||new D;this.v2=b||new D}function Na(a,b){N.call(this);this.type="LineCurve3";this.v1=a||new n;this.v2=b||new n}function Oa(a,b,c){N.call(this);this.type="QuadraticBezierCurve";this.v0=a||new D;this.v1=b||new D;this.v2=c||new D}function ab(a,b,c){N.call(this);this.type="QuadraticBezierCurve3";this.v0=a||new n;this.v1=b|| +new n;this.v2=c||new n}function Pa(a){N.call(this);this.type="SplineCurve";this.points=a||[]}function fb(){N.call(this);this.type="CurvePath";this.curves=[];this.autoClose=!1}function Qa(a){fb.call(this);this.type="Path";this.currentPoint=new D;a&&this.setFromPoints(a)}function pb(a){Qa.call(this,a);this.uuid=P.generateUUID();this.type="Shape";this.holes=[]}function aa(a,b){H.call(this);this.type="Light";this.color=new B(a);this.intensity=void 0!==b?b:1;this.receiveShadow=void 0}function Qd(a,b,c){aa.call(this, +a,c);this.type="HemisphereLight";this.castShadow=void 0;this.position.copy(H.DefaultUp);this.updateMatrix();this.groundColor=new B(b)}function Qb(a){this.camera=a;this.bias=0;this.radius=1;this.mapSize=new D(512,512);this.map=null;this.matrix=new O}function Rd(){Qb.call(this,new ja(50,1,.5,500))}function Sd(a,b,c,d,e,f){aa.call(this,a,b);this.type="SpotLight";this.position.copy(H.DefaultUp);this.updateMatrix();this.target=new H;Object.defineProperty(this,"power",{get:function(){return this.intensity* +Math.PI},set:function(a){this.intensity=a/Math.PI}});this.distance=void 0!==c?c:0;this.angle=void 0!==d?d:Math.PI/3;this.penumbra=void 0!==e?e:0;this.decay=void 0!==f?f:1;this.shadow=new Rd}function Td(a,b,c,d){aa.call(this,a,b);this.type="PointLight";Object.defineProperty(this,"power",{get:function(){return 4*this.intensity*Math.PI},set:function(a){this.intensity=a/(4*Math.PI)}});this.distance=void 0!==c?c:0;this.decay=void 0!==d?d:1;this.shadow=new Qb(new ja(90,1,.5,500))}function qd(a,b,c,d,e, +f){Xa.call(this);this.type="OrthographicCamera";this.zoom=1;this.view=null;this.left=void 0!==a?a:-1;this.right=void 0!==b?b:1;this.top=void 0!==c?c:1;this.bottom=void 0!==d?d:-1;this.near=void 0!==e?e:.1;this.far=void 0!==f?f:2E3;this.updateProjectionMatrix()}function Ud(){Qb.call(this,new qd(-5,5,5,-5,.5,500))}function Vd(a,b){aa.call(this,a,b);this.type="DirectionalLight";this.position.copy(H.DefaultUp);this.updateMatrix();this.target=new H;this.shadow=new Ud}function Wd(a,b){aa.call(this,a,b); +this.type="AmbientLight";this.castShadow=void 0}function Xd(a,b,c,d){aa.call(this,a,b);this.type="RectAreaLight";this.width=void 0!==c?c:10;this.height=void 0!==d?d:10}function Yd(a){this.manager=void 0!==a?a:za;this.textures={}}function Zd(){E.call(this);this.type="InstancedBufferGeometry";this.maxInstancedCount=void 0}function $d(a,b,c,d){"number"===typeof c&&(d=c,c=!1,console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument."));I.call(this,a,b, +c);this.meshPerAttribute=d||1}function we(a){this.manager=void 0!==a?a:za}function xe(a){this.manager=void 0!==a?a:za;this.resourcePath=""}function ye(a){"undefined"===typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported.");"undefined"===typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported.");this.manager=void 0!==a?a:za;this.options=void 0}function ze(){this.type="ShapePath";this.color=new B;this.subPaths=[];this.currentPath=null} +function Ae(a){this.type="Font";this.data=a}function Jf(a){this.manager=void 0!==a?a:za}function rd(){}function Be(a){this.manager=void 0!==a?a:za}function ae(){this.coefficients=[];for(var a=0;9>a;a++)this.coefficients.push(new n)}function Ra(a,b){aa.call(this,void 0,b);this.sh=void 0!==a?a:new ae}function Ce(a,b,c){Ra.call(this,void 0,c);a=(new B).set(a);c=(new B).set(b);b=new n(a.r,a.g,a.b);a=new n(c.r,c.g,c.b);c=Math.sqrt(Math.PI);var d=c*Math.sqrt(.75);this.sh.coefficients[0].copy(b).add(a).multiplyScalar(c); +this.sh.coefficients[1].copy(b).sub(a).multiplyScalar(d)}function De(a,b){Ra.call(this,void 0,b);a=(new B).set(a);this.sh.coefficients[0].set(a.r,a.g,a.b).multiplyScalar(2*Math.sqrt(Math.PI))}function Kf(){this.type="StereoCamera";this.aspect=1;this.eyeSep=.064;this.cameraL=new ja;this.cameraL.layers.enable(1);this.cameraL.matrixAutoUpdate=!1;this.cameraR=new ja;this.cameraR.layers.enable(2);this.cameraR.matrixAutoUpdate=!1}function sd(a,b,c,d){H.call(this);this.type="CubeCamera";var e=new ja(90, +1,a,b);e.up.set(0,-1,0);e.lookAt(new n(1,0,0));this.add(e);var f=new ja(90,1,a,b);f.up.set(0,-1,0);f.lookAt(new n(-1,0,0));this.add(f);var g=new ja(90,1,a,b);g.up.set(0,0,1);g.lookAt(new n(0,1,0));this.add(g);var h=new ja(90,1,a,b);h.up.set(0,0,-1);h.lookAt(new n(0,-1,0));this.add(h);var k=new ja(90,1,a,b);k.up.set(0,-1,0);k.lookAt(new n(0,0,1));this.add(k);var m=new ja(90,1,a,b);m.up.set(0,-1,0);m.lookAt(new n(0,0,-1));this.add(m);d=d||{format:1022,magFilter:1006,minFilter:1006};this.renderTarget= +new rb(c,c,d);this.renderTarget.texture.name="CubeCamera";this.update=function(a,b){null===this.parent&&this.updateMatrixWorld();var c=a.getRenderTarget(),d=this.renderTarget,q=d.texture.generateMipmaps;d.texture.generateMipmaps=!1;a.setRenderTarget(d,0);a.render(b,e);a.setRenderTarget(d,1);a.render(b,f);a.setRenderTarget(d,2);a.render(b,g);a.setRenderTarget(d,3);a.render(b,h);a.setRenderTarget(d,4);a.render(b,k);d.texture.generateMipmaps=q;a.setRenderTarget(d,5);a.render(b,m);a.setRenderTarget(c)}; +this.clear=function(a,b,c,d){for(var e=a.getRenderTarget(),f=this.renderTarget,g=0;6>g;g++)a.setRenderTarget(f,g),a.clear(b,c,d);a.setRenderTarget(e)}}function Ee(a){this.autoStart=void 0!==a?a:!0;this.elapsedTime=this.oldTime=this.startTime=0;this.running=!1}function Fe(){H.call(this);this.type="AudioListener";this.context=Ge.getContext();this.gain=this.context.createGain();this.gain.connect(this.context.destination);this.filter=null;this.timeDelta=0}function rc(a){H.call(this);this.type="Audio"; +this.listener=a;this.context=a.context;this.gain=this.context.createGain();this.gain.connect(a.getInput());this.autoplay=!1;this.buffer=null;this.detune=0;this.loop=!1;this.offset=this.startTime=0;this.playbackRate=1;this.isPlaying=!1;this.hasPlaybackControl=!0;this.sourceType="empty";this.filters=[]}function He(a){rc.call(this,a);this.panner=this.context.createPanner();this.panner.panningModel="HRTF";this.panner.connect(this.gain)}function Ie(a,b){this.analyser=a.context.createAnalyser();this.analyser.fftSize= +void 0!==b?b:2048;this.data=new Uint8Array(this.analyser.frequencyBinCount);a.getOutput().connect(this.analyser)}function Je(a,b,c){this.binding=a;this.valueSize=c;a=Float64Array;switch(b){case "quaternion":b=this._slerp;break;case "string":case "bool":a=Array;b=this._select;break;default:b=this._lerp}this.buffer=new a(4*c);this._mixBufferRegion=b;this.referenceCount=this.useCount=this.cumulativeWeight=0}function Lf(a,b,c){c=c||va.parseTrackName(b);this._targetGroup=a;this._bindings=a.subscribe_(b, +c)}function va(a,b,c){this.path=b;this.parsedPath=c||va.parseTrackName(b);this.node=va.findNode(a,this.parsedPath.nodeName)||a;this.rootNode=a}function Mf(){this.uuid=P.generateUUID();this._objects=Array.prototype.slice.call(arguments);this.nCachedObjects_=0;var a={};this._indicesByUUID=a;for(var b=0,c=arguments.length;b!==c;++b)a[arguments[b].uuid]=b;this._paths=[];this._parsedPaths=[];this._bindings=[];this._bindingsIndicesByPath={};var d=this;this.stats={objects:{get total(){return d._objects.length}, +get inUse(){return this.total-d.nCachedObjects_}},get bindingsPerObject(){return d._bindings.length}}}function Nf(a,b,c){this._mixer=a;this._clip=b;this._localRoot=c||null;a=b.tracks;b=a.length;c=Array(b);for(var d={endingStart:2400,endingEnd:2400},e=0;e!==b;++e){var f=a[e].createInterpolant(null);c[e]=f;f.settings=d}this._interpolantSettings=d;this._interpolants=c;this._propertyBindings=Array(b);this._weightInterpolant=this._timeScaleInterpolant=this._byClipCacheIndex=this._cacheIndex=null;this.loop= +2201;this._loopCount=-1;this._startTime=null;this.time=0;this._effectiveWeight=this.weight=this._effectiveTimeScale=this.timeScale=1;this.repetitions=Infinity;this.paused=!1;this.enabled=!0;this.clampWhenFinished=!1;this.zeroSlopeAtEnd=this.zeroSlopeAtStart=!0}function Ke(a){this._root=a;this._initMemoryManager();this.time=this._accuIndex=0;this.timeScale=1}function be(a,b){"string"===typeof a&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),a=b);this.value=a}function Le(a,b,c){Bb.call(this, +a,b);this.meshPerAttribute=c||1}function Of(a,b,c,d){this.ray=new Ab(a,b);this.near=c||0;this.far=d||Infinity;this.params={Mesh:{},Line:{},LOD:{},Points:{threshold:1},Sprite:{}};Object.defineProperties(this.params,{PointCloud:{get:function(){console.warn("THREE.Raycaster: params.PointCloud has been renamed to params.Points.");return this.Points}}})}function Pf(a,b){return a.distance-b.distance}function Me(a,b,c,d){if(!1!==a.visible&&(a.raycast(b,c),!0===d)){a=a.children;d=0;for(var e=a.length;dc;c++,d++){var e=c/32*Math.PI*2,f=d/32*Math.PI*2;b.push(Math.cos(e),Math.sin(e),1,Math.cos(f),Math.sin(f),1)}a.addAttribute("position",new C(b,3));b=new V({fog:!1});this.cone=new S(a,b);this.add(this.cone);this.update()}function Sf(a){var b=[];a&&a.isBone&&b.push(a);for(var c=0;ca?-1:0b;b++)a[b]=(16>b?"0":"")+b.toString(16); +a)throw new TypeError("Cannot convert undefined or null to object");for(var b=Object(a),c=1;cb;b++)a[b]=(16>b?"0":"")+b.toString(16); return function(){var b=4294967295*Math.random()|0,d=4294967295*Math.random()|0,e=4294967295*Math.random()|0,f=4294967295*Math.random()|0;return(a[b&255]+a[b>>8&255]+a[b>>16&255]+a[b>>24&255]+"-"+a[d&255]+a[d>>8&255]+"-"+a[d>>16&15|64]+a[d>>24&255]+"-"+a[e&63|128]+a[e>>8&255]+"-"+a[e>>16&255]+a[e>>24&255]+a[f&255]+a[f>>8&255]+a[f>>16&255]+a[f>>24&255]).toUpperCase()}}(),clamp:function(a,b,c){return Math.max(b,Math.min(c,a))},euclideanModulo:function(a,b){return(a%b+b)%b},mapLinear:function(a,b,c, -d,e){return d+(a-b)*(e-d)/(c-b)},lerp:function(a,b,c){return(1-c)*a+c*b},smoothstep:function(a,b,c){if(a<=b)return 0;if(a>=c)return 1;a=(a-b)/(c-b);return a*a*(3-2*a)},smootherstep:function(a,b,c){if(a<=b)return 0;if(a>=c)return 1;a=(a-b)/(c-b);return a*a*a*(a*(6*a-15)+10)},randInt:function(a,b){return a+Math.floor(Math.random()*(b-a+1))},randFloat:function(a,b){return a+Math.random()*(b-a)},randFloatSpread:function(a){return a*(.5-Math.random())},degToRad:function(a){return a*O.DEG2RAD},radToDeg:function(a){return a* -O.RAD2DEG},isPowerOfTwo:function(a){return 0===(a&a-1)&&0!==a},ceilPowerOfTwo:function(a){return Math.pow(2,Math.ceil(Math.log(a)/Math.LN2))},floorPowerOfTwo:function(a){return Math.pow(2,Math.floor(Math.log(a)/Math.LN2))}};Object.defineProperties(C.prototype,{width:{get:function(){return this.x},set:function(a){this.x=a}},height:{get:function(){return this.y},set:function(a){this.y=a}}});Object.assign(C.prototype,{isVector2:!0,set:function(a,b){this.x=a;this.y=b;return this},setScalar:function(a){this.y= +d,e){return d+(a-b)*(e-d)/(c-b)},lerp:function(a,b,c){return(1-c)*a+c*b},smoothstep:function(a,b,c){if(a<=b)return 0;if(a>=c)return 1;a=(a-b)/(c-b);return a*a*(3-2*a)},smootherstep:function(a,b,c){if(a<=b)return 0;if(a>=c)return 1;a=(a-b)/(c-b);return a*a*a*(a*(6*a-15)+10)},randInt:function(a,b){return a+Math.floor(Math.random()*(b-a+1))},randFloat:function(a,b){return a+Math.random()*(b-a)},randFloatSpread:function(a){return a*(.5-Math.random())},degToRad:function(a){return a*P.DEG2RAD},radToDeg:function(a){return a* +P.RAD2DEG},isPowerOfTwo:function(a){return 0===(a&a-1)&&0!==a},ceilPowerOfTwo:function(a){return Math.pow(2,Math.ceil(Math.log(a)/Math.LN2))},floorPowerOfTwo:function(a){return Math.pow(2,Math.floor(Math.log(a)/Math.LN2))}};Object.defineProperties(D.prototype,{width:{get:function(){return this.x},set:function(a){this.x=a}},height:{get:function(){return this.y},set:function(a){this.y=a}}});Object.assign(D.prototype,{isVector2:!0,set:function(a,b){this.x=a;this.y=b;return this},setScalar:function(a){this.y= this.x=a;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setComponent:function(a,b){switch(a){case 0:this.x=b;break;case 1:this.y=b;break;default:throw Error("index is out of range: "+a);}return this},getComponent:function(a){switch(a){case 0:return this.x;case 1:return this.y;default:throw Error("index is out of range: "+a);}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(a){this.x=a.x;this.y=a.y;return this},add:function(a, b){if(void 0!==b)return console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(a,b);this.x+=a.x;this.y+=a.y;return this},addScalar:function(a){this.x+=a;this.y+=a;return this},addVectors:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},addScaledVector:function(a,b){this.x+=a.x*b;this.y+=a.y*b;return this},sub:function(a,b){if(void 0!==b)return console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."), this.subVectors(a,b);this.x-=a.x;this.y-=a.y;return this},subScalar:function(a){this.x-=a;this.y-=a;return this},subVectors:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this},multiply:function(a){this.x*=a.x;this.y*=a.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},divide:function(a){this.x/=a.x;this.y/=a.y;return this},divideScalar:function(a){return this.multiplyScalar(1/a)},applyMatrix3:function(a){var b=this.x,c=this.y;a=a.elements;this.x=a[0]*b+a[3]*c+a[6];this.y= @@ -330,13 +331,13 @@ a[1]*b+a[4]*c+a[7];return this},min:function(a){this.x=Math.min(this.x,a.x);this 1).multiplyScalar(Math.max(a,Math.min(b,c)))},floor:function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);return this},ceil:function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);return this},round:function(){this.x=Math.round(this.x);this.y=Math.round(this.y);return this},roundToZero:function(){this.x=0>this.x?Math.ceil(this.x):Math.floor(this.x);this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y);return this},negate:function(){this.x=-this.x;this.y=-this.y;return this},dot:function(a){return this.x* a.x+this.y*a.y},cross:function(a){return this.x*a.y-this.y*a.x},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length()||1)},angle:function(){var a=Math.atan2(this.y,this.x);0>a&&(a+=2*Math.PI);return a},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b= this.x-a.x;a=this.y-a.y;return b*b+a*a},manhattanDistanceTo:function(a){return Math.abs(this.x-a.x)+Math.abs(this.y-a.y)},setLength:function(a){return this.normalize().multiplyScalar(a)},lerp:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;return this},lerpVectors:function(a,b,c){return this.subVectors(b,a).multiplyScalar(c).add(a)},equals:function(a){return a.x===this.x&&a.y===this.y},fromArray:function(a,b){void 0===b&&(b=0);this.x=a[b];this.y=a[b+1];return this},toArray:function(a, -b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this.x;a[b+1]=this.y;return a},fromBufferAttribute:function(a,b,c){void 0!==c&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute().");this.x=a.getX(b);this.y=a.getY(b);return this},rotateAround:function(a,b){var c=Math.cos(b);b=Math.sin(b);var d=this.x-a.x,e=this.y-a.y;this.x=d*c-e*b+a.x;this.y=d*b+e*c+a.y;return this}});Object.assign(ma,{slerp:function(a,b,c,d){return c.copy(a).slerp(b,d)},slerpFlat:function(a,b,c,d,e,f,g){var h= -c[d+0],l=c[d+1],m=c[d+2];c=c[d+3];d=e[f+0];var k=e[f+1],p=e[f+2];e=e[f+3];if(c!==e||h!==d||l!==k||m!==p){f=1-g;var n=h*d+l*k+m*p+c*e,t=0<=n?1:-1,r=1-n*n;r>Number.EPSILON&&(r=Math.sqrt(r),n=Math.atan2(r,n*t),f=Math.sin(f*n)/r,g=Math.sin(g*n)/r);t*=g;h=h*f+d*t;l=l*f+k*t;m=m*f+p*t;c=c*f+e*t;f===1-g&&(g=1/Math.sqrt(h*h+l*l+m*m+c*c),h*=g,l*=g,m*=g,c*=g)}a[b]=h;a[b+1]=l;a[b+2]=m;a[b+3]=c}});Object.defineProperties(ma.prototype,{x:{get:function(){return this._x},set:function(a){this._x=a;this.onChangeCallback()}}, -y:{get:function(){return this._y},set:function(a){this._y=a;this.onChangeCallback()}},z:{get:function(){return this._z},set:function(a){this._z=a;this.onChangeCallback()}},w:{get:function(){return this._w},set:function(a){this._w=a;this.onChangeCallback()}}});Object.assign(ma.prototype,{isQuaternion:!0,set:function(a,b,c,d){this._x=a;this._y=b;this._z=c;this._w=d;this.onChangeCallback();return this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(a){this._x= -a.x;this._y=a.y;this._z=a.z;this._w=a.w;this.onChangeCallback();return this},setFromEuler:function(a,b){if(!a||!a.isEuler)throw Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var c=a._x,d=a._y,e=a._z;a=a.order;var f=Math.cos,g=Math.sin,h=f(c/2),l=f(d/2);f=f(e/2);c=g(c/2);d=g(d/2);e=g(e/2);"XYZ"===a?(this._x=c*l*f+h*d*e,this._y=h*d*f-c*l*e,this._z=h*l*e+c*d*f,this._w=h*l*f-c*d*e):"YXZ"===a?(this._x=c*l*f+h*d*e,this._y=h*d*f-c*l*e,this._z=h* -l*e-c*d*f,this._w=h*l*f+c*d*e):"ZXY"===a?(this._x=c*l*f-h*d*e,this._y=h*d*f+c*l*e,this._z=h*l*e+c*d*f,this._w=h*l*f-c*d*e):"ZYX"===a?(this._x=c*l*f-h*d*e,this._y=h*d*f+c*l*e,this._z=h*l*e-c*d*f,this._w=h*l*f+c*d*e):"YZX"===a?(this._x=c*l*f+h*d*e,this._y=h*d*f+c*l*e,this._z=h*l*e-c*d*f,this._w=h*l*f-c*d*e):"XZY"===a&&(this._x=c*l*f-h*d*e,this._y=h*d*f-c*l*e,this._z=h*l*e+c*d*f,this._w=h*l*f+c*d*e);if(!1!==b)this.onChangeCallback();return this},setFromAxisAngle:function(a,b){b/=2;var c=Math.sin(b); -this._x=a.x*c;this._y=a.y*c;this._z=a.z*c;this._w=Math.cos(b);this.onChangeCallback();return this},setFromRotationMatrix:function(a){var b=a.elements,c=b[0];a=b[4];var d=b[8],e=b[1],f=b[5],g=b[9],h=b[2],l=b[6];b=b[10];var m=c+f+b;0f&&c>b?(c=2*Math.sqrt(1+c-f-b),this._w=(l-g)/c,this._x=.25*c,this._y=(a+e)/c,this._z=(d+h)/c):f>b?(c=2*Math.sqrt(1+f-c-b),this._w=(d-h)/c,this._x=(a+e)/c,this._y=.25*c,this._z=(g+l)/ -c):(c=2*Math.sqrt(1+b-c-f),this._w=(e-a)/c,this._x=(d+h)/c,this._y=(g+l)/c,this._z=.25*c);this.onChangeCallback();return this},setFromUnitVectors:function(a,b){var c=a.dot(b)+1;1E-6>c?(c=0,Math.abs(a.x)>Math.abs(a.z)?(this._x=-a.y,this._y=a.x,this._z=0):(this._x=0,this._y=-a.z,this._z=a.y)):(this._x=a.y*b.z-a.z*b.y,this._y=a.z*b.x-a.x*b.z,this._z=a.x*b.y-a.y*b.x);this._w=c;return this.normalize()},angleTo:function(a){return 2*Math.acos(Math.abs(O.clamp(this.dot(a),-1,1)))},rotateTowards:function(a, +b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this.x;a[b+1]=this.y;return a},fromBufferAttribute:function(a,b,c){void 0!==c&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute().");this.x=a.getX(b);this.y=a.getY(b);return this},rotateAround:function(a,b){var c=Math.cos(b);b=Math.sin(b);var d=this.x-a.x,e=this.y-a.y;this.x=d*c-e*b+a.x;this.y=d*b+e*c+a.y;return this}});Object.assign(ea,{slerp:function(a,b,c,d){return c.copy(a).slerp(b,d)},slerpFlat:function(a,b,c,d,e,f,g){var h= +c[d+0],k=c[d+1],m=c[d+2];c=c[d+3];d=e[f+0];var l=e[f+1],p=e[f+2];e=e[f+3];if(c!==e||h!==d||k!==l||m!==p){f=1-g;var n=h*d+k*l+m*p+c*e,t=0<=n?1:-1,r=1-n*n;r>Number.EPSILON&&(r=Math.sqrt(r),n=Math.atan2(r,n*t),f=Math.sin(f*n)/r,g=Math.sin(g*n)/r);t*=g;h=h*f+d*t;k=k*f+l*t;m=m*f+p*t;c=c*f+e*t;f===1-g&&(g=1/Math.sqrt(h*h+k*k+m*m+c*c),h*=g,k*=g,m*=g,c*=g)}a[b]=h;a[b+1]=k;a[b+2]=m;a[b+3]=c}});Object.defineProperties(ea.prototype,{x:{get:function(){return this._x},set:function(a){this._x=a;this.onChangeCallback()}}, +y:{get:function(){return this._y},set:function(a){this._y=a;this.onChangeCallback()}},z:{get:function(){return this._z},set:function(a){this._z=a;this.onChangeCallback()}},w:{get:function(){return this._w},set:function(a){this._w=a;this.onChangeCallback()}}});Object.assign(ea.prototype,{isQuaternion:!0,set:function(a,b,c,d){this._x=a;this._y=b;this._z=c;this._w=d;this.onChangeCallback();return this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(a){this._x= +a.x;this._y=a.y;this._z=a.z;this._w=a.w;this.onChangeCallback();return this},setFromEuler:function(a,b){if(!a||!a.isEuler)throw Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var c=a._x,d=a._y,e=a._z;a=a.order;var f=Math.cos,g=Math.sin,h=f(c/2),k=f(d/2);f=f(e/2);c=g(c/2);d=g(d/2);e=g(e/2);"XYZ"===a?(this._x=c*k*f+h*d*e,this._y=h*d*f-c*k*e,this._z=h*k*e+c*d*f,this._w=h*k*f-c*d*e):"YXZ"===a?(this._x=c*k*f+h*d*e,this._y=h*d*f-c*k*e,this._z=h* +k*e-c*d*f,this._w=h*k*f+c*d*e):"ZXY"===a?(this._x=c*k*f-h*d*e,this._y=h*d*f+c*k*e,this._z=h*k*e+c*d*f,this._w=h*k*f-c*d*e):"ZYX"===a?(this._x=c*k*f-h*d*e,this._y=h*d*f+c*k*e,this._z=h*k*e-c*d*f,this._w=h*k*f+c*d*e):"YZX"===a?(this._x=c*k*f+h*d*e,this._y=h*d*f+c*k*e,this._z=h*k*e-c*d*f,this._w=h*k*f-c*d*e):"XZY"===a&&(this._x=c*k*f-h*d*e,this._y=h*d*f-c*k*e,this._z=h*k*e+c*d*f,this._w=h*k*f+c*d*e);if(!1!==b)this.onChangeCallback();return this},setFromAxisAngle:function(a,b){b/=2;var c=Math.sin(b); +this._x=a.x*c;this._y=a.y*c;this._z=a.z*c;this._w=Math.cos(b);this.onChangeCallback();return this},setFromRotationMatrix:function(a){var b=a.elements,c=b[0];a=b[4];var d=b[8],e=b[1],f=b[5],g=b[9],h=b[2],k=b[6];b=b[10];var m=c+f+b;0f&&c>b?(c=2*Math.sqrt(1+c-f-b),this._w=(k-g)/c,this._x=.25*c,this._y=(a+e)/c,this._z=(d+h)/c):f>b?(c=2*Math.sqrt(1+f-c-b),this._w=(d-h)/c,this._x=(a+e)/c,this._y=.25*c,this._z=(g+k)/ +c):(c=2*Math.sqrt(1+b-c-f),this._w=(e-a)/c,this._x=(d+h)/c,this._y=(g+k)/c,this._z=.25*c);this.onChangeCallback();return this},setFromUnitVectors:function(a,b){var c=a.dot(b)+1;1E-6>c?(c=0,Math.abs(a.x)>Math.abs(a.z)?(this._x=-a.y,this._y=a.x,this._z=0):(this._x=0,this._y=-a.z,this._z=a.y)):(this._x=a.y*b.z-a.z*b.y,this._y=a.z*b.x-a.x*b.z,this._z=a.x*b.y-a.y*b.x);this._w=c;return this.normalize()},angleTo:function(a){return 2*Math.acos(Math.abs(P.clamp(this.dot(a),-1,1)))},rotateTowards:function(a, b){var c=this.angleTo(a);if(0===c)return this;this.slerp(a,Math.min(1,b/c));return this},inverse:function(){return this.conjugate()},conjugate:function(){this._x*=-1;this._y*=-1;this._z*=-1;this.onChangeCallback();return this},dot:function(a){return this._x*a._x+this._y*a._y+this._z*a._z+this._w*a._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var a= this.length();0===a?(this._z=this._y=this._x=0,this._w=1):(a=1/a,this._x*=a,this._y*=a,this._z*=a,this._w*=a);this.onChangeCallback();return this},multiply:function(a,b){return void 0!==b?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(a,b)):this.multiplyQuaternions(this,a)},premultiply:function(a){return this.multiplyQuaternions(a,this)},multiplyQuaternions:function(a,b){var c=a._x,d=a._y,e=a._z;a=a._w; var f=b._x,g=b._y,h=b._z;b=b._w;this._x=c*b+a*f+d*h-e*g;this._y=d*b+a*g+e*f-c*h;this._z=e*b+a*h+c*g-d*f;this._w=a*b-c*f-d*g-e*h;this.onChangeCallback();return this},slerp:function(a,b){if(0===b)return this;if(1===b)return this.copy(a);var c=this._x,d=this._y,e=this._z,f=this._w,g=f*a._w+c*a._x+d*a._y+e*a._z;0>g?(this._w=-a._w,this._x=-a._x,this._y=-a._y,this._z=-a._z,g=-g):this.copy(a);if(1<=g)return this._w=f,this._x=c,this._y=d,this._z=e,this;a=1-g*g;if(a<=Number.EPSILON)return g=1-b,this._w=g* @@ -345,86 +346,86 @@ return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=thi setComponent:function(a,b){switch(a){case 0:this.x=b;break;case 1:this.y=b;break;case 2:this.z=b;break;default:throw Error("index is out of range: "+a);}return this},getComponent:function(a){switch(a){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error("index is out of range: "+a);}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},add:function(a,b){if(void 0!==b)return console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."), this.addVectors(a,b);this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},addVectors:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;return this},addScaledVector:function(a,b){this.x+=a.x*b;this.y+=a.y*b;this.z+=a.z*b;return this},sub:function(a,b){if(void 0!==b)return console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(a,b);this.x-=a.x;this.y-=a.y;this.z-=a.z; return this},subScalar:function(a){this.x-=a;this.y-=a;this.z-=a;return this},subVectors:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},multiply:function(a,b){if(void 0!==b)return console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(a,b);this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;return this},multiplyVectors:function(a,b){this.x=a.x* -b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},applyEuler:function(){var a=new ma;return function(b){b&&b.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order.");return this.applyQuaternion(a.setFromEuler(b))}}(),applyAxisAngle:function(){var a=new ma;return function(b,c){return this.applyQuaternion(a.setFromAxisAngle(b,c))}}(),applyMatrix3:function(a){var b=this.x,c=this.y,d=this.z;a=a.elements;this.x=a[0]*b+a[3]*c+a[6]*d;this.y=a[1]* -b+a[4]*c+a[7]*d;this.z=a[2]*b+a[5]*c+a[8]*d;return this},applyMatrix4:function(a){var b=this.x,c=this.y,d=this.z;a=a.elements;var e=1/(a[3]*b+a[7]*c+a[11]*d+a[15]);this.x=(a[0]*b+a[4]*c+a[8]*d+a[12])*e;this.y=(a[1]*b+a[5]*c+a[9]*d+a[13])*e;this.z=(a[2]*b+a[6]*c+a[10]*d+a[14])*e;return this},applyQuaternion:function(a){var b=this.x,c=this.y,d=this.z,e=a.x,f=a.y,g=a.z;a=a.w;var h=a*b+f*d-g*c,l=a*c+g*b-e*d,m=a*d+e*c-f*b;b=-e*b-f*c-g*d;this.x=h*a+b*-e+l*-g-m*-f;this.y=l*a+b*-f+m*-e-h*-g;this.z=m*a+b* --g+h*-f-l*-e;return this},project:function(a){return this.applyMatrix4(a.matrixWorldInverse).applyMatrix4(a.projectionMatrix)},unproject:function(a){return this.applyMatrix4(a.projectionMatrixInverse).applyMatrix4(a.matrixWorld)},transformDirection:function(a){var b=this.x,c=this.y,d=this.z;a=a.elements;this.x=a[0]*b+a[4]*c+a[8]*d;this.y=a[1]*b+a[5]*c+a[9]*d;this.z=a[2]*b+a[6]*c+a[10]*d;return this.normalize()},divide:function(a){this.x/=a.x;this.y/=a.y;this.z/=a.z;return this},divideScalar:function(a){return this.multiplyScalar(1/ +b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},applyEuler:function(){var a=new ea;return function(b){b&&b.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order.");return this.applyQuaternion(a.setFromEuler(b))}}(),applyAxisAngle:function(){var a=new ea;return function(b,c){return this.applyQuaternion(a.setFromAxisAngle(b,c))}}(),applyMatrix3:function(a){var b=this.x,c=this.y,d=this.z;a=a.elements;this.x=a[0]*b+a[3]*c+a[6]*d;this.y=a[1]* +b+a[4]*c+a[7]*d;this.z=a[2]*b+a[5]*c+a[8]*d;return this},applyMatrix4:function(a){var b=this.x,c=this.y,d=this.z;a=a.elements;var e=1/(a[3]*b+a[7]*c+a[11]*d+a[15]);this.x=(a[0]*b+a[4]*c+a[8]*d+a[12])*e;this.y=(a[1]*b+a[5]*c+a[9]*d+a[13])*e;this.z=(a[2]*b+a[6]*c+a[10]*d+a[14])*e;return this},applyQuaternion:function(a){var b=this.x,c=this.y,d=this.z,e=a.x,f=a.y,g=a.z;a=a.w;var h=a*b+f*d-g*c,k=a*c+g*b-e*d,m=a*d+e*c-f*b;b=-e*b-f*c-g*d;this.x=h*a+b*-e+k*-g-m*-f;this.y=k*a+b*-f+m*-e-h*-g;this.z=m*a+b* +-g+h*-f-k*-e;return this},project:function(a){return this.applyMatrix4(a.matrixWorldInverse).applyMatrix4(a.projectionMatrix)},unproject:function(a){return this.applyMatrix4(a.projectionMatrixInverse).applyMatrix4(a.matrixWorld)},transformDirection:function(a){var b=this.x,c=this.y,d=this.z;a=a.elements;this.x=a[0]*b+a[4]*c+a[8]*d;this.y=a[1]*b+a[5]*c+a[9]*d;this.z=a[2]*b+a[6]*c+a[10]*d;return this.normalize()},divide:function(a){this.x/=a.x;this.y/=a.y;this.z/=a.z;return this},divideScalar:function(a){return this.multiplyScalar(1/ a)},min:function(a){this.x=Math.min(this.x,a.x);this.y=Math.min(this.y,a.y);this.z=Math.min(this.z,a.z);return this},max:function(a){this.x=Math.max(this.x,a.x);this.y=Math.max(this.y,a.y);this.z=Math.max(this.z,a.z);return this},clamp:function(a,b){this.x=Math.max(a.x,Math.min(b.x,this.x));this.y=Math.max(a.y,Math.min(b.y,this.y));this.z=Math.max(a.z,Math.min(b.z,this.z));return this},clampScalar:function(a,b){this.x=Math.max(a,Math.min(b,this.x));this.y=Math.max(a,Math.min(b,this.y));this.z=Math.max(a, Math.min(b,this.z));return this},clampLength:function(a,b){var c=this.length();return this.divideScalar(c||1).multiplyScalar(Math.max(a,Math.min(b,c)))},floor:function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);this.z=Math.floor(this.z);return this},ceil:function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);this.z=Math.ceil(this.z);return this},round:function(){this.x=Math.round(this.x);this.y=Math.round(this.y);this.z=Math.round(this.z);return this},roundToZero:function(){this.x= 0>this.x?Math.ceil(this.x):Math.floor(this.x);this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y);this.z=0>this.z?Math.ceil(this.z):Math.floor(this.z);return this},negate:function(){this.x=-this.x;this.y=-this.y;this.z=-this.z;return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+ Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(a){return this.normalize().multiplyScalar(a)},lerp:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;return this},lerpVectors:function(a,b,c){return this.subVectors(b,a).multiplyScalar(c).add(a)},cross:function(a,b){return void 0!==b?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(a,b)):this.crossVectors(this, a)},crossVectors:function(a,b){var c=a.x,d=a.y;a=a.z;var e=b.x,f=b.y;b=b.z;this.x=d*b-a*f;this.y=a*e-c*b;this.z=c*f-d*e;return this},projectOnVector:function(a){var b=a.dot(this)/a.lengthSq();return this.copy(a).multiplyScalar(b)},projectOnPlane:function(){var a=new n;return function(b){a.copy(this).projectOnVector(b);return this.sub(a)}}(),reflect:function(){var a=new n;return function(b){return this.sub(a.copy(b).multiplyScalar(2*this.dot(b)))}}(),angleTo:function(a){a=this.dot(a)/Math.sqrt(this.lengthSq()* -a.lengthSq());return Math.acos(O.clamp(a,-1,1))},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x,c=this.y-a.y;a=this.z-a.z;return b*b+c*c+a*a},manhattanDistanceTo:function(a){return Math.abs(this.x-a.x)+Math.abs(this.y-a.y)+Math.abs(this.z-a.z)},setFromSpherical:function(a){return this.setFromSphericalCoords(a.radius,a.phi,a.theta)},setFromSphericalCoords:function(a,b,c){var d=Math.sin(b)*a;this.x=d*Math.sin(c);this.y=Math.cos(b)* +a.lengthSq());return Math.acos(P.clamp(a,-1,1))},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x,c=this.y-a.y;a=this.z-a.z;return b*b+c*c+a*a},manhattanDistanceTo:function(a){return Math.abs(this.x-a.x)+Math.abs(this.y-a.y)+Math.abs(this.z-a.z)},setFromSpherical:function(a){return this.setFromSphericalCoords(a.radius,a.phi,a.theta)},setFromSphericalCoords:function(a,b,c){var d=Math.sin(b)*a;this.x=d*Math.sin(c);this.y=Math.cos(b)* a;this.z=d*Math.cos(c);return this},setFromCylindrical:function(a){return this.setFromCylindricalCoords(a.radius,a.theta,a.y)},setFromCylindricalCoords:function(a,b,c){this.x=a*Math.sin(b);this.y=c;this.z=a*Math.cos(b);return this},setFromMatrixPosition:function(a){a=a.elements;this.x=a[12];this.y=a[13];this.z=a[14];return this},setFromMatrixScale:function(a){var b=this.setFromMatrixColumn(a,0).length(),c=this.setFromMatrixColumn(a,1).length();a=this.setFromMatrixColumn(a,2).length();this.x=b;this.y= c;this.z=a;return this},setFromMatrixColumn:function(a,b){return this.fromArray(a.elements,4*b)},equals:function(a){return a.x===this.x&&a.y===this.y&&a.z===this.z},fromArray:function(a,b){void 0===b&&(b=0);this.x=a[b];this.y=a[b+1];this.z=a[b+2];return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this.x;a[b+1]=this.y;a[b+2]=this.z;return a},fromBufferAttribute:function(a,b,c){void 0!==c&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."); -this.x=a.getX(b);this.y=a.getY(b);this.z=a.getZ(b);return this}});Object.assign(na.prototype,{isMatrix3:!0,set:function(a,b,c,d,e,f,g,h,l){var m=this.elements;m[0]=a;m[1]=d;m[2]=g;m[3]=b;m[4]=e;m[5]=h;m[6]=c;m[7]=f;m[8]=l;return this},identity:function(){this.set(1,0,0,0,1,0,0,0,1);return this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(a){var b=this.elements;a=a.elements;b[0]=a[0];b[1]=a[1];b[2]=a[2];b[3]=a[3];b[4]=a[4];b[5]=a[5];b[6]=a[6];b[7]=a[7];b[8]= +this.x=a.getX(b);this.y=a.getY(b);this.z=a.getZ(b);return this}});Object.assign(ia.prototype,{isMatrix3:!0,set:function(a,b,c,d,e,f,g,h,k){var m=this.elements;m[0]=a;m[1]=d;m[2]=g;m[3]=b;m[4]=e;m[5]=h;m[6]=c;m[7]=f;m[8]=k;return this},identity:function(){this.set(1,0,0,0,1,0,0,0,1);return this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(a){var b=this.elements;a=a.elements;b[0]=a[0];b[1]=a[1];b[2]=a[2];b[3]=a[3];b[4]=a[4];b[5]=a[5];b[6]=a[6];b[7]=a[7];b[8]= a[8];return this},setFromMatrix4:function(a){a=a.elements;this.set(a[0],a[4],a[8],a[1],a[5],a[9],a[2],a[6],a[10]);return this},applyToBufferAttribute:function(){var a=new n;return function(b){for(var c=0,d=b.count;cc;c++)if(b[c]!==a[c])return!1;return!0},fromArray:function(a,b){void 0===b&&(b=0);for(var c=0;9>c;c++)this.elements[c]=a[c+b];return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);var c=this.elements;a[b]=c[0];a[b+1]=c[1];a[b+2]=c[2];a[b+3]=c[3];a[b+4]=c[4];a[b+5]=c[5];a[b+6]=c[6];a[b+7]=c[7];a[b+8]=c[8]; -return a}});var zc,qb={getDataURL:function(a){if("undefined"==typeof HTMLCanvasElement)return a.src;if(!(a instanceof HTMLCanvasElement)){void 0===zc&&(zc=document.createElementNS("http://www.w3.org/1999/xhtml","canvas"));zc.width=a.width;zc.height=a.height;var b=zc.getContext("2d");a instanceof ImageData?b.putImageData(a,0,0):b.drawImage(a,0,0,a.width,a.height);a=zc}return 2048a.x||1a.x?0:1;break;case 1002:a.x=1===Math.abs(Math.floor(a.x)%2)?Math.ceil(a.x)-a.x:a.x-Math.floor(a.x)}if(0>a.y||1a.y?0:1;break;case 1002:a.y=1===Math.abs(Math.floor(a.y)%2)?Math.ceil(a.y)-a.y:a.y-Math.floor(a.y)}this.flipY&&(a.y=1-a.y);return a}});Object.defineProperty(Y.prototype,"needsUpdate",{set:function(a){!0===a&&this.version++}});Object.assign(W.prototype,{isVector4:!0,set:function(a, +if(void 0!==this.image){var d=this.image;void 0===d.uuid&&(d.uuid=P.generateUUID());if(!b&&void 0===a.images[d.uuid]){if(Array.isArray(d)){var e=[];for(var f=0,g=d.length;fa.x||1a.x?0:1;break;case 1002:a.x=1===Math.abs(Math.floor(a.x)%2)?Math.ceil(a.x)-a.x:a.x-Math.floor(a.x)}if(0>a.y||1a.y?0:1;break;case 1002:a.y=1===Math.abs(Math.floor(a.y)%2)?Math.ceil(a.y)-a.y:a.y-Math.floor(a.y)}this.flipY&&(a.y=1-a.y);return a}});Object.defineProperty(X.prototype,"needsUpdate",{set:function(a){!0===a&&this.version++}});Object.assign(ba.prototype,{isVector4:!0,set:function(a, b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},setScalar:function(a){this.w=this.z=this.y=this.x=a;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setZ:function(a){this.z=a;return this},setW:function(a){this.w=a;return this},setComponent:function(a,b){switch(a){case 0:this.x=b;break;case 1:this.y=b;break;case 2:this.z=b;break;case 3:this.w=b;break;default:throw Error("index is out of range: "+a);}return this},getComponent:function(a){switch(a){case 0:return this.x; case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error("index is out of range: "+a);}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=void 0!==a.w?a.w:1;return this},add:function(a,b){if(void 0!==b)return console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(a,b);this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this}, addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;this.w+=a;return this},addVectors:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},addScaledVector:function(a,b){this.x+=a.x*b;this.y+=a.y*b;this.z+=a.z*b;this.w+=a.w*b;return this},sub:function(a,b){if(void 0!==b)return console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(a,b);this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;return this},subScalar:function(a){this.x-= a;this.y-=a;this.z-=a;this.w-=a;return this},subVectors:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;this.w=a.w-b.w;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},applyMatrix4:function(a){var b=this.x,c=this.y,d=this.z,e=this.w;a=a.elements;this.x=a[0]*b+a[4]*c+a[8]*d+a[12]*e;this.y=a[1]*b+a[5]*c+a[9]*d+a[13]*e;this.z=a[2]*b+a[6]*c+a[10]*d+a[14]*e;this.w=a[3]*b+a[7]*c+a[11]*d+a[15]*e;return this},divideScalar:function(a){return this.multiplyScalar(1/ -a)},setAxisAngleFromQuaternion:function(a){this.w=2*Math.acos(a.w);var b=Math.sqrt(1-a.w*a.w);1E-4>b?(this.x=1,this.z=this.y=0):(this.x=a.x/b,this.y=a.y/b,this.z=a.z/b);return this},setAxisAngleFromRotationMatrix:function(a){a=a.elements;var b=a[0];var c=a[4];var d=a[8],e=a[1],f=a[5],g=a[9];var h=a[2];var l=a[6];var m=a[10];if(.01>Math.abs(c-e)&&.01>Math.abs(d-h)&&.01>Math.abs(g-l)){if(.1>Math.abs(c+e)&&.1>Math.abs(d+h)&&.1>Math.abs(g+l)&&.1>Math.abs(b+f+m-3))return this.set(1,0,0,0),this;a=Math.PI; -b=(b+1)/2;f=(f+1)/2;m=(m+1)/2;c=(c+e)/4;d=(d+h)/4;g=(g+l)/4;b>f&&b>m?.01>b?(l=0,c=h=.707106781):(l=Math.sqrt(b),h=c/l,c=d/l):f>m?.01>f?(l=.707106781,h=0,c=.707106781):(h=Math.sqrt(f),l=c/h,c=g/h):.01>m?(h=l=.707106781,c=0):(c=Math.sqrt(m),l=d/c,h=g/c);this.set(l,h,c,a);return this}a=Math.sqrt((l-g)*(l-g)+(d-h)*(d-h)+(e-c)*(e-c));.001>Math.abs(a)&&(a=1);this.x=(l-g)/a;this.y=(d-h)/a;this.z=(e-c)/a;this.w=Math.acos((b+f+m-1)/2);return this},min:function(a){this.x=Math.min(this.x,a.x);this.y=Math.min(this.y, -a.y);this.z=Math.min(this.z,a.z);this.w=Math.min(this.w,a.w);return this},max:function(a){this.x=Math.max(this.x,a.x);this.y=Math.max(this.y,a.y);this.z=Math.max(this.z,a.z);this.w=Math.max(this.w,a.w);return this},clamp:function(a,b){this.x=Math.max(a.x,Math.min(b.x,this.x));this.y=Math.max(a.y,Math.min(b.y,this.y));this.z=Math.max(a.z,Math.min(b.z,this.z));this.w=Math.max(a.w,Math.min(b.w,this.w));return this},clampScalar:function(){var a,b;return function(c,d){void 0===a&&(a=new W,b=new W);a.set(c, +a)},setAxisAngleFromQuaternion:function(a){this.w=2*Math.acos(a.w);var b=Math.sqrt(1-a.w*a.w);1E-4>b?(this.x=1,this.z=this.y=0):(this.x=a.x/b,this.y=a.y/b,this.z=a.z/b);return this},setAxisAngleFromRotationMatrix:function(a){a=a.elements;var b=a[0];var c=a[4];var d=a[8],e=a[1],f=a[5],g=a[9];var h=a[2];var k=a[6];var m=a[10];if(.01>Math.abs(c-e)&&.01>Math.abs(d-h)&&.01>Math.abs(g-k)){if(.1>Math.abs(c+e)&&.1>Math.abs(d+h)&&.1>Math.abs(g+k)&&.1>Math.abs(b+f+m-3))return this.set(1,0,0,0),this;a=Math.PI; +b=(b+1)/2;f=(f+1)/2;m=(m+1)/2;c=(c+e)/4;d=(d+h)/4;g=(g+k)/4;b>f&&b>m?.01>b?(k=0,c=h=.707106781):(k=Math.sqrt(b),h=c/k,c=d/k):f>m?.01>f?(k=.707106781,h=0,c=.707106781):(h=Math.sqrt(f),k=c/h,c=g/h):.01>m?(h=k=.707106781,c=0):(c=Math.sqrt(m),k=d/c,h=g/c);this.set(k,h,c,a);return this}a=Math.sqrt((k-g)*(k-g)+(d-h)*(d-h)+(e-c)*(e-c));.001>Math.abs(a)&&(a=1);this.x=(k-g)/a;this.y=(d-h)/a;this.z=(e-c)/a;this.w=Math.acos((b+f+m-1)/2);return this},min:function(a){this.x=Math.min(this.x,a.x);this.y=Math.min(this.y, +a.y);this.z=Math.min(this.z,a.z);this.w=Math.min(this.w,a.w);return this},max:function(a){this.x=Math.max(this.x,a.x);this.y=Math.max(this.y,a.y);this.z=Math.max(this.z,a.z);this.w=Math.max(this.w,a.w);return this},clamp:function(a,b){this.x=Math.max(a.x,Math.min(b.x,this.x));this.y=Math.max(a.y,Math.min(b.y,this.y));this.z=Math.max(a.z,Math.min(b.z,this.z));this.w=Math.max(a.w,Math.min(b.w,this.w));return this},clampScalar:function(){var a,b;return function(c,d){void 0===a&&(a=new ba,b=new ba);a.set(c, c,c,c);b.set(d,d,d,d);return this.clamp(a,b)}}(),clampLength:function(a,b){var c=this.length();return this.divideScalar(c||1).multiplyScalar(Math.max(a,Math.min(b,c)))},floor:function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);this.z=Math.floor(this.z);this.w=Math.floor(this.w);return this},ceil:function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);this.z=Math.ceil(this.z);this.w=Math.ceil(this.w);return this},round:function(){this.x=Math.round(this.x);this.y=Math.round(this.y); this.z=Math.round(this.z);this.w=Math.round(this.w);return this},roundToZero:function(){this.x=0>this.x?Math.ceil(this.x):Math.floor(this.x);this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y);this.z=0>this.z?Math.ceil(this.z):Math.floor(this.z);this.w=0>this.w?Math.ceil(this.w):Math.floor(this.w);return this},negate:function(){this.x=-this.x;this.y=-this.y;this.z=-this.z;this.w=-this.w;return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w},lengthSq:function(){return this.x* this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(a){return this.normalize().multiplyScalar(a)},lerp:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b;return this},lerpVectors:function(a, b,c){return this.subVectors(b,a).multiplyScalar(c).add(a)},equals:function(a){return a.x===this.x&&a.y===this.y&&a.z===this.z&&a.w===this.w},fromArray:function(a,b){void 0===b&&(b=0);this.x=a[b];this.y=a[b+1];this.z=a[b+2];this.w=a[b+3];return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this.x;a[b+1]=this.y;a[b+2]=this.z;a[b+3]=this.w;return a},fromBufferAttribute:function(a,b,c){void 0!==c&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."); -this.x=a.getX(b);this.y=a.getY(b);this.z=a.getZ(b);this.w=a.getW(b);return this}});Sa.prototype=Object.assign(Object.create(ta.prototype),{constructor:Sa,isWebGLRenderTarget:!0,setSize:function(a,b){if(this.width!==a||this.height!==b)this.width=a,this.height=b,this.dispose();this.viewport.set(0,0,a,b);this.scissor.set(0,0,a,b)},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.width=a.width;this.height=a.height;this.viewport.copy(a.viewport);this.texture=a.texture.clone(); -this.depthBuffer=a.depthBuffer;this.stencilBuffer=a.stencilBuffer;this.depthTexture=a.depthTexture;return this},dispose:function(){this.dispatchEvent({type:"dispose"})}});ce.prototype=Object.assign(Object.create(Sa.prototype),{constructor:ce,isWebGLMultisampleRenderTarget:!0,copy:function(a){Sa.prototype.copy.call(this,a);this.samples=a.samples;return this}});rb.prototype=Object.create(Sa.prototype);rb.prototype.constructor=rb;rb.prototype.isWebGLRenderTargetCube=!0;sb.prototype=Object.create(Y.prototype); -sb.prototype.constructor=sb;sb.prototype.isDataTexture=!0;Object.assign(Ga.prototype,{isBox3:!0,set:function(a,b){this.min.copy(a);this.max.copy(b);return this},setFromArray:function(a){for(var b=Infinity,c=Infinity,d=Infinity,e=-Infinity,f=-Infinity,g=-Infinity,h=0,l=a.length;he&&(e=m);k>f&&(f=k);p>g&&(g=p)}this.min.set(b,c,d);this.max.set(e,f,g);return this},setFromBufferAttribute:function(a){for(var b=Infinity,c=Infinity, -d=Infinity,e=-Infinity,f=-Infinity,g=-Infinity,h=0,l=a.count;he&&(e=m);k>f&&(f=k);p>g&&(g=p)}this.min.set(b,c,d);this.max.set(e,f,g);return this},setFromPoints:function(a){this.makeEmpty();for(var b=0,c=a.length;be&&(e=m);l>f&&(f=l);p>g&&(g=p)}this.min.set(b,c,d);this.max.set(e,f,g);return this},setFromBufferAttribute:function(a){for(var b=Infinity,c=Infinity, +d=Infinity,e=-Infinity,f=-Infinity,g=-Infinity,h=0,k=a.count;he&&(e=m);l>f&&(f=l);p>g&&(g=p)}this.min.set(b,c,d);this.max.set(e,f,g);return this},setFromPoints:function(a){this.makeEmpty();for(var b=0,c=a.length;bthis.max.x||a.ythis.max.y|| a.zthis.max.z?!1:!0},containsBox:function(a){return this.min.x<=a.min.x&&a.max.x<=this.max.x&&this.min.y<=a.min.y&&a.max.y<=this.max.y&&this.min.z<=a.min.z&&a.max.z<=this.max.z},getParameter:function(a,b){void 0===b&&(console.warn("THREE.Box3: .getParameter() target is now required"),b=new n);return b.set((a.x-this.min.x)/(this.max.x-this.min.x),(a.y-this.min.y)/(this.max.y-this.min.y),(a.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(a){return a.max.xthis.max.x||a.max.ythis.max.y||a.max.zthis.max.z?!1:!0},intersectsSphere:function(){var a=new n;return function(b){this.clampPoint(b.center,a);return a.distanceToSquared(b.center)<=b.radius*b.radius}}(),intersectsPlane:function(a){if(0=-a.constant},intersectsTriangle:function(){function a(a){var e;var f=0;for(e=a.length-3;f<=e;f+=3){h.fromArray(a,f);var g=m.x*Math.abs(h.x)+m.y*Math.abs(h.y)+m.z*Math.abs(h.z),l=b.dot(h),k=c.dot(h),q=d.dot(h);if(Math.max(-Math.max(l,k,q),Math.min(l,k,q))>g)return!1}return!0}var b=new n,c=new n,d=new n,e=new n,f=new n,g=new n,h=new n, -l=new n,m=new n,k=new n;return function(h){if(this.isEmpty())return!1;this.getCenter(l);m.subVectors(this.max,l);b.subVectors(h.a,l);c.subVectors(h.b,l);d.subVectors(h.c,l);e.subVectors(c,b);f.subVectors(d,c);g.subVectors(b,d);h=[0,-e.z,e.y,0,-f.z,f.y,0,-g.z,g.y,e.z,0,-e.x,f.z,0,-f.x,g.z,0,-g.x,-e.y,e.x,0,-f.y,f.x,0,-g.y,g.x,0];if(!a(h))return!1;h=[1,0,0,0,1,0,0,0,1];if(!a(h))return!1;k.crossVectors(e,f);h=[k.x,k.y,k.z];return a(h)}}(),clampPoint:function(a,b){void 0===b&&(console.warn("THREE.Box3: .clampPoint() target is now required"), +a.normal.y*this.min.y);0=-a.constant},intersectsTriangle:function(){function a(a){var e;var f=0;for(e=a.length-3;f<=e;f+=3){h.fromArray(a,f);var g=m.x*Math.abs(h.x)+m.y*Math.abs(h.y)+m.z*Math.abs(h.z),k=b.dot(h),l=c.dot(h),q=d.dot(h);if(Math.max(-Math.max(k,l,q),Math.min(k,l,q))>g)return!1}return!0}var b=new n,c=new n,d=new n,e=new n,f=new n,g=new n,h=new n, +k=new n,m=new n,l=new n;return function(h){if(this.isEmpty())return!1;this.getCenter(k);m.subVectors(this.max,k);b.subVectors(h.a,k);c.subVectors(h.b,k);d.subVectors(h.c,k);e.subVectors(c,b);f.subVectors(d,c);g.subVectors(b,d);h=[0,-e.z,e.y,0,-f.z,f.y,0,-g.z,g.y,e.z,0,-e.x,f.z,0,-f.x,g.z,0,-g.x,-e.y,e.x,0,-f.y,f.x,0,-g.y,g.x,0];if(!a(h))return!1;h=[1,0,0,0,1,0,0,0,1];if(!a(h))return!1;l.crossVectors(e,f);h=[l.x,l.y,l.z];return a(h)}}(),clampPoint:function(a,b){void 0===b&&(console.warn("THREE.Box3: .clampPoint() target is now required"), b=new n);return b.copy(a).clamp(this.min,this.max)},distanceToPoint:function(){var a=new n;return function(b){return a.copy(b).clamp(this.min,this.max).sub(b).length()}}(),getBoundingSphere:function(){var a=new n;return function(b){void 0===b&&console.error("THREE.Box3: .getBoundingSphere() target is now required");this.getCenter(b.center);b.radius=.5*this.getSize(a).length();return b}}(),intersect:function(a){this.min.max(a.min);this.max.min(a.max);this.isEmpty()&&this.makeEmpty();return this},union:function(a){this.min.min(a.min); this.max.max(a.max);return this},applyMatrix4:function(){var a=[new n,new n,new n,new n,new n,new n,new n,new n];return function(b){if(this.isEmpty())return this;a[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(b);a[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(b);a[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(b);a[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(b);a[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(b);a[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(b); -a[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(b);a[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(b);this.setFromPoints(a);return this}}(),translate:function(a){this.min.add(a);this.max.add(a);return this},equals:function(a){return a.min.equals(this.min)&&a.max.equals(this.max)}});Object.assign(Ta.prototype,{set:function(a,b){this.center.copy(a);this.radius=b;return this},setFromPoints:function(){var a=new Ga;return function(b,c){var d=this.center;void 0!==c?d.copy(c):a.setFromPoints(b).getCenter(d); +a[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(b);a[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(b);this.setFromPoints(a);return this}}(),translate:function(a){this.min.add(a);this.max.add(a);return this},equals:function(a){return a.min.equals(this.min)&&a.max.equals(this.max)}});Object.assign(Ua.prototype,{set:function(a,b){this.center.copy(a);this.radius=b;return this},setFromPoints:function(){var a=new Ha;return function(b,c){var d=this.center;void 0!==c?d.copy(c):a.setFromPoints(b).getCenter(d); for(var e=c=0,f=b.length;e=this.radius},containsPoint:function(a){return a.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(a){return a.distanceTo(this.center)-this.radius},intersectsSphere:function(a){var b=this.radius+ a.radius;return a.center.distanceToSquared(this.center)<=b*b},intersectsBox:function(a){return a.intersectsSphere(this)},intersectsPlane:function(a){return Math.abs(a.distanceToPoint(this.center))<=this.radius},clampPoint:function(a,b){var c=this.center.distanceToSquared(a);void 0===b&&(console.warn("THREE.Sphere: .clampPoint() target is now required"),b=new n);b.copy(a);c>this.radius*this.radius&&(b.sub(this.center).normalize(),b.multiplyScalar(this.radius).add(this.center));return b},getBoundingBox:function(a){void 0=== -a&&(console.warn("THREE.Sphere: .getBoundingBox() target is now required"),a=new Ga);a.set(this.center,this.center);a.expandByScalar(this.radius);return a},applyMatrix4:function(a){this.center.applyMatrix4(a);this.radius*=a.getMaxScaleOnAxis();return this},translate:function(a){this.center.add(a);return this},equals:function(a){return a.center.equals(this.center)&&a.radius===this.radius}});Object.assign(Ua.prototype,{set:function(a,b){this.normal.copy(a);this.constant=b;return this},setComponents:function(a, +a&&(console.warn("THREE.Sphere: .getBoundingBox() target is now required"),a=new Ha);a.set(this.center,this.center);a.expandByScalar(this.radius);return a},applyMatrix4:function(a){this.center.applyMatrix4(a);this.radius*=a.getMaxScaleOnAxis();return this},translate:function(a){this.center.add(a);return this},equals:function(a){return a.center.equals(this.center)&&a.radius===this.radius}});Object.assign(Va.prototype,{set:function(a,b){this.normal.copy(a);this.constant=b;return this},setComponents:function(a, b,c,d){this.normal.set(a,b,c);this.constant=d;return this},setFromNormalAndCoplanarPoint:function(a,b){this.normal.copy(a);this.constant=-b.dot(this.normal);return this},setFromCoplanarPoints:function(){var a=new n,b=new n;return function(c,d,e){d=a.subVectors(e,d).cross(b.subVectors(c,d)).normalize();this.setFromNormalAndCoplanarPoint(d,c);return this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.normal.copy(a.normal);this.constant=a.constant;return this},normalize:function(){var a= 1/this.normal.length();this.normal.multiplyScalar(a);this.constant*=a;return this},negate:function(){this.constant*=-1;this.normal.negate();return this},distanceToPoint:function(a){return this.normal.dot(a)+this.constant},distanceToSphere:function(a){return this.distanceToPoint(a.center)-a.radius},projectPoint:function(a,b){void 0===b&&(console.warn("THREE.Plane: .projectPoint() target is now required"),b=new n);return b.copy(this.normal).multiplyScalar(-this.distanceToPoint(a)).add(a)},intersectLine:function(){var a= new n;return function(b,c){void 0===c&&(console.warn("THREE.Plane: .intersectLine() target is now required"),c=new n);var d=b.delta(a),e=this.normal.dot(d);if(0===e){if(0===this.distanceToPoint(b.start))return c.copy(b.start)}else if(e=-(b.start.dot(this.normal)+this.constant)/e,!(0>e||1b&&0a&&0c;c++)b[c].copy(a.planes[c]);return this},setFromMatrix:function(a){var b=this.planes,c=a.elements;a=c[0];var d=c[1],e=c[2],f=c[3],g=c[4], -h=c[5],l=c[6],m=c[7],k=c[8],p=c[9],n=c[10],t=c[11],r=c[12],u=c[13],w=c[14];c=c[15];b[0].setComponents(f-a,m-g,t-k,c-r).normalize();b[1].setComponents(f+a,m+g,t+k,c+r).normalize();b[2].setComponents(f+d,m+h,t+p,c+u).normalize();b[3].setComponents(f-d,m-h,t-p,c-u).normalize();b[4].setComponents(f-e,m-l,t-n,c-w).normalize();b[5].setComponents(f+e,m+l,t+n,c+w).normalize();return this},intersectsObject:function(){var a=new Ta;return function(b){var c=b.geometry;null===c.boundingSphere&&c.computeBoundingSphere(); -a.copy(c.boundingSphere).applyMatrix4(b.matrixWorld);return this.intersectsSphere(a)}}(),intersectsSprite:function(){var a=new Ta;return function(b){a.center.set(0,0,0);a.radius=.7071067811865476;a.applyMatrix4(b.matrixWorld);return this.intersectsSphere(a)}}(),intersectsSphere:function(a){var b=this.planes,c=a.center;a=-a.radius;for(var d=0;6>d;d++)if(b[d].distanceToPoint(c)d;d++){var e=c[d]; -a.x=0e.distanceToPoint(a))return!1}return!0}}(),containsPoint:function(a){for(var b=this.planes,c=0;6>c;c++)if(0>b[c].distanceToPoint(a))return!1;return!0}});Object.assign(P.prototype,{isMatrix4:!0,set:function(a,b,c,d,e,f,g,h,l,m,k,p,n,t,r,u){var q=this.elements;q[0]=a;q[4]=b;q[8]=c;q[12]=d;q[1]=e;q[5]=f;q[9]=g;q[13]=h;q[2]=l;q[6]=m;q[10]=k;q[14]=p;q[3]=n;q[7]=t;q[11]=r;q[15]=u;return this},identity:function(){this.set(1, -0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},clone:function(){return(new P).fromArray(this.elements)},copy:function(a){var b=this.elements;a=a.elements;b[0]=a[0];b[1]=a[1];b[2]=a[2];b[3]=a[3];b[4]=a[4];b[5]=a[5];b[6]=a[6];b[7]=a[7];b[8]=a[8];b[9]=a[9];b[10]=a[10];b[11]=a[11];b[12]=a[12];b[13]=a[13];b[14]=a[14];b[15]=a[15];return this},copyPosition:function(a){var b=this.elements;a=a.elements;b[12]=a[12];b[13]=a[13];b[14]=a[14];return this},extractBasis:function(a,b,c){a.setFromMatrixColumn(this,0); +intersectsSphere:function(a){return a.intersectsPlane(this)},coplanarPoint:function(a){void 0===a&&(console.warn("THREE.Plane: .coplanarPoint() target is now required"),a=new n);return a.copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(){var a=new n,b=new ia;return function(c,d){d=d||b.getNormalMatrix(c);c=this.coplanarPoint(a).applyMatrix4(c);d=this.normal.applyMatrix3(d).normalize();this.constant=-c.dot(d);return this}}(),translate:function(a){this.constant-=a.dot(this.normal); +return this},equals:function(a){return a.normal.equals(this.normal)&&a.constant===this.constant}});Object.assign(Ad.prototype,{set:function(a,b,c,d,e,f){var g=this.planes;g[0].copy(a);g[1].copy(b);g[2].copy(c);g[3].copy(d);g[4].copy(e);g[5].copy(f);return this},clone:function(){return(new this.constructor).copy(this)},copy:function(a){for(var b=this.planes,c=0;6>c;c++)b[c].copy(a.planes[c]);return this},setFromMatrix:function(a){var b=this.planes,c=a.elements;a=c[0];var d=c[1],e=c[2],f=c[3],g=c[4], +h=c[5],k=c[6],m=c[7],l=c[8],p=c[9],n=c[10],t=c[11],r=c[12],u=c[13],w=c[14];c=c[15];b[0].setComponents(f-a,m-g,t-l,c-r).normalize();b[1].setComponents(f+a,m+g,t+l,c+r).normalize();b[2].setComponents(f+d,m+h,t+p,c+u).normalize();b[3].setComponents(f-d,m-h,t-p,c-u).normalize();b[4].setComponents(f-e,m-k,t-n,c-w).normalize();b[5].setComponents(f+e,m+k,t+n,c+w).normalize();return this},intersectsObject:function(){var a=new Ua;return function(b){var c=b.geometry;null===c.boundingSphere&&c.computeBoundingSphere(); +a.copy(c.boundingSphere).applyMatrix4(b.matrixWorld);return this.intersectsSphere(a)}}(),intersectsSprite:function(){var a=new Ua;return function(b){a.center.set(0,0,0);a.radius=.7071067811865476;a.applyMatrix4(b.matrixWorld);return this.intersectsSphere(a)}}(),intersectsSphere:function(a){var b=this.planes,c=a.center;a=-a.radius;for(var d=0;6>d;d++)if(b[d].distanceToPoint(c)d;d++){var e=c[d]; +a.x=0e.distanceToPoint(a))return!1}return!0}}(),containsPoint:function(a){for(var b=this.planes,c=0;6>c;c++)if(0>b[c].distanceToPoint(a))return!1;return!0}});Object.assign(O.prototype,{isMatrix4:!0,set:function(a,b,c,d,e,f,g,h,k,m,l,p,n,t,r,u){var q=this.elements;q[0]=a;q[4]=b;q[8]=c;q[12]=d;q[1]=e;q[5]=f;q[9]=g;q[13]=h;q[2]=k;q[6]=m;q[10]=l;q[14]=p;q[3]=n;q[7]=t;q[11]=r;q[15]=u;return this},identity:function(){this.set(1, +0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},clone:function(){return(new O).fromArray(this.elements)},copy:function(a){var b=this.elements;a=a.elements;b[0]=a[0];b[1]=a[1];b[2]=a[2];b[3]=a[3];b[4]=a[4];b[5]=a[5];b[6]=a[6];b[7]=a[7];b[8]=a[8];b[9]=a[9];b[10]=a[10];b[11]=a[11];b[12]=a[12];b[13]=a[13];b[14]=a[14];b[15]=a[15];return this},copyPosition:function(a){var b=this.elements;a=a.elements;b[12]=a[12];b[13]=a[13];b[14]=a[14];return this},extractBasis:function(a,b,c){a.setFromMatrixColumn(this,0); b.setFromMatrixColumn(this,1);c.setFromMatrixColumn(this,2);return this},makeBasis:function(a,b,c){this.set(a.x,b.x,c.x,0,a.y,b.y,c.y,0,a.z,b.z,c.z,0,0,0,0,1);return this},extractRotation:function(){var a=new n;return function(b){var c=this.elements,d=b.elements,e=1/a.setFromMatrixColumn(b,0).length(),f=1/a.setFromMatrixColumn(b,1).length();b=1/a.setFromMatrixColumn(b,2).length();c[0]=d[0]*e;c[1]=d[1]*e;c[2]=d[2]*e;c[3]=0;c[4]=d[4]*f;c[5]=d[5]*f;c[6]=d[6]*f;c[7]=0;c[8]=d[8]*b;c[9]=d[9]*b;c[10]=d[10]* -b;c[11]=0;c[12]=0;c[13]=0;c[14]=0;c[15]=1;return this}}(),makeRotationFromEuler:function(a){a&&a.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var b=this.elements,c=a.x,d=a.y,e=a.z,f=Math.cos(c);c=Math.sin(c);var g=Math.cos(d);d=Math.sin(d);var h=Math.cos(e);e=Math.sin(e);if("XYZ"===a.order){a=f*h;var l=f*e,m=c*h,k=c*e;b[0]=g*h;b[4]=-g*e;b[8]=d;b[1]=l+m*d;b[5]=a-k*d;b[9]=-c*g;b[2]=k-a*d;b[6]=m+l*d;b[10]=f*g}else"YXZ"=== -a.order?(a=g*h,l=g*e,m=d*h,k=d*e,b[0]=a+k*c,b[4]=m*c-l,b[8]=f*d,b[1]=f*e,b[5]=f*h,b[9]=-c,b[2]=l*c-m,b[6]=k+a*c,b[10]=f*g):"ZXY"===a.order?(a=g*h,l=g*e,m=d*h,k=d*e,b[0]=a-k*c,b[4]=-f*e,b[8]=m+l*c,b[1]=l+m*c,b[5]=f*h,b[9]=k-a*c,b[2]=-f*d,b[6]=c,b[10]=f*g):"ZYX"===a.order?(a=f*h,l=f*e,m=c*h,k=c*e,b[0]=g*h,b[4]=m*d-l,b[8]=a*d+k,b[1]=g*e,b[5]=k*d+a,b[9]=l*d-m,b[2]=-d,b[6]=c*g,b[10]=f*g):"YZX"===a.order?(a=f*g,l=f*d,m=c*g,k=c*d,b[0]=g*h,b[4]=k-a*e,b[8]=m*e+l,b[1]=e,b[5]=f*h,b[9]=-c*h,b[2]=-d*h,b[6]=l* -e+m,b[10]=a-k*e):"XZY"===a.order&&(a=f*g,l=f*d,m=c*g,k=c*d,b[0]=g*h,b[4]=-e,b[8]=d*h,b[1]=a*e+k,b[5]=f*h,b[9]=l*e-m,b[2]=m*e-l,b[6]=c*h,b[10]=k*e+a);b[3]=0;b[7]=0;b[11]=0;b[12]=0;b[13]=0;b[14]=0;b[15]=1;return this},makeRotationFromQuaternion:function(){var a=new n(0,0,0),b=new n(1,1,1);return function(c){return this.compose(a,c,b)}}(),lookAt:function(){var a=new n,b=new n,c=new n;return function(d,e,f){var g=this.elements;c.subVectors(d,e);0===c.lengthSq()&&(c.z=1);c.normalize();a.crossVectors(f, +b;c[11]=0;c[12]=0;c[13]=0;c[14]=0;c[15]=1;return this}}(),makeRotationFromEuler:function(a){a&&a.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var b=this.elements,c=a.x,d=a.y,e=a.z,f=Math.cos(c);c=Math.sin(c);var g=Math.cos(d);d=Math.sin(d);var h=Math.cos(e);e=Math.sin(e);if("XYZ"===a.order){a=f*h;var k=f*e,m=c*h,l=c*e;b[0]=g*h;b[4]=-g*e;b[8]=d;b[1]=k+m*d;b[5]=a-l*d;b[9]=-c*g;b[2]=l-a*d;b[6]=m+k*d;b[10]=f*g}else"YXZ"=== +a.order?(a=g*h,k=g*e,m=d*h,l=d*e,b[0]=a+l*c,b[4]=m*c-k,b[8]=f*d,b[1]=f*e,b[5]=f*h,b[9]=-c,b[2]=k*c-m,b[6]=l+a*c,b[10]=f*g):"ZXY"===a.order?(a=g*h,k=g*e,m=d*h,l=d*e,b[0]=a-l*c,b[4]=-f*e,b[8]=m+k*c,b[1]=k+m*c,b[5]=f*h,b[9]=l-a*c,b[2]=-f*d,b[6]=c,b[10]=f*g):"ZYX"===a.order?(a=f*h,k=f*e,m=c*h,l=c*e,b[0]=g*h,b[4]=m*d-k,b[8]=a*d+l,b[1]=g*e,b[5]=l*d+a,b[9]=k*d-m,b[2]=-d,b[6]=c*g,b[10]=f*g):"YZX"===a.order?(a=f*g,k=f*d,m=c*g,l=c*d,b[0]=g*h,b[4]=l-a*e,b[8]=m*e+k,b[1]=e,b[5]=f*h,b[9]=-c*h,b[2]=-d*h,b[6]=k* +e+m,b[10]=a-l*e):"XZY"===a.order&&(a=f*g,k=f*d,m=c*g,l=c*d,b[0]=g*h,b[4]=-e,b[8]=d*h,b[1]=a*e+l,b[5]=f*h,b[9]=k*e-m,b[2]=m*e-k,b[6]=c*h,b[10]=l*e+a);b[3]=0;b[7]=0;b[11]=0;b[12]=0;b[13]=0;b[14]=0;b[15]=1;return this},makeRotationFromQuaternion:function(){var a=new n(0,0,0),b=new n(1,1,1);return function(c){return this.compose(a,c,b)}}(),lookAt:function(){var a=new n,b=new n,c=new n;return function(d,e,f){var g=this.elements;c.subVectors(d,e);0===c.lengthSq()&&(c.z=1);c.normalize();a.crossVectors(f, c);0===a.lengthSq()&&(1===Math.abs(f.z)?c.x+=1E-4:c.z+=1E-4,c.normalize(),a.crossVectors(f,c));a.normalize();b.crossVectors(c,a);g[0]=a.x;g[4]=b.x;g[8]=c.x;g[1]=a.y;g[5]=b.y;g[9]=c.y;g[2]=a.z;g[6]=b.z;g[10]=c.z;return this}}(),multiply:function(a,b){return void 0!==b?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(a,b)):this.multiplyMatrices(this,a)},premultiply:function(a){return this.multiplyMatrices(a,this)}, -multiplyMatrices:function(a,b){var c=a.elements,d=b.elements;b=this.elements;a=c[0];var e=c[4],f=c[8],g=c[12],h=c[1],l=c[5],m=c[9],k=c[13],p=c[2],n=c[6],t=c[10],r=c[14],u=c[3],w=c[7],z=c[11];c=c[15];var x=d[0],y=d[4],F=d[8],G=d[12],C=d[1],B=d[5],I=d[9],A=d[13],D=d[2],E=d[6],H=d[10],J=d[14],K=d[3],M=d[7],S=d[11];d=d[15];b[0]=a*x+e*C+f*D+g*K;b[4]=a*y+e*B+f*E+g*M;b[8]=a*F+e*I+f*H+g*S;b[12]=a*G+e*A+f*J+g*d;b[1]=h*x+l*C+m*D+k*K;b[5]=h*y+l*B+m*E+k*M;b[9]=h*F+l*I+m*H+k*S;b[13]=h*G+l*A+m*J+k*d;b[2]=p*x+n* -C+t*D+r*K;b[6]=p*y+n*B+t*E+r*M;b[10]=p*F+n*I+t*H+r*S;b[14]=p*G+n*A+t*J+r*d;b[3]=u*x+w*C+z*D+c*K;b[7]=u*y+w*B+z*E+c*M;b[11]=u*F+w*I+z*H+c*S;b[15]=u*G+w*A+z*J+c*d;return this},multiplyScalar:function(a){var b=this.elements;b[0]*=a;b[4]*=a;b[8]*=a;b[12]*=a;b[1]*=a;b[5]*=a;b[9]*=a;b[13]*=a;b[2]*=a;b[6]*=a;b[10]*=a;b[14]*=a;b[3]*=a;b[7]*=a;b[11]*=a;b[15]*=a;return this},applyToBufferAttribute:function(){var a=new n;return function(b){for(var c=0,d=b.count;cthis.determinant()&& -(g=-g);c.x=f[12];c.y=f[13];c.z=f[14];b.copy(this);c=1/g;f=1/h;var m=1/l;b.elements[0]*=c;b.elements[1]*=c;b.elements[2]*=c;b.elements[4]*=f;b.elements[5]*=f;b.elements[6]*=f;b.elements[8]*=m;b.elements[9]*=m;b.elements[10]*=m;d.setFromRotationMatrix(b);e.x=g;e.y=h;e.z=l;return this}}(),makePerspective:function(a,b,c,d,e,f){void 0===f&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");var g=this.elements;g[0]=2*e/(b-a);g[4]=0;g[8]= -(b+a)/(b-a);g[12]=0;g[1]=0;g[5]=2*e/(c-d);g[9]=(c+d)/(c-d);g[13]=0;g[2]=0;g[6]=0;g[10]=-(f+e)/(f-e);g[14]=-2*f*e/(f-e);g[3]=0;g[7]=0;g[11]=-1;g[15]=0;return this},makeOrthographic:function(a,b,c,d,e,f){var g=this.elements,h=1/(b-a),l=1/(c-d),m=1/(f-e);g[0]=2*h;g[4]=0;g[8]=0;g[12]=-((b+a)*h);g[1]=0;g[5]=2*l;g[9]=0;g[13]=-((c+d)*l);g[2]=0;g[6]=0;g[10]=-2*m;g[14]=-((f+e)*m);g[3]=0;g[7]=0;g[11]=0;g[15]=1;return this},equals:function(a){var b=this.elements;a=a.elements;for(var c=0;16>c;c++)if(b[c]!==a[c])return!1; -return!0},fromArray:function(a,b){void 0===b&&(b=0);for(var c=0;16>c;c++)this.elements[c]=a[c+b];return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);var c=this.elements;a[b]=c[0];a[b+1]=c[1];a[b+2]=c[2];a[b+3]=c[3];a[b+4]=c[4];a[b+5]=c[5];a[b+6]=c[6];a[b+7]=c[7];a[b+8]=c[8];a[b+9]=c[9];a[b+10]=c[10];a[b+11]=c[11];a[b+12]=c[12];a[b+13]=c[13];a[b+14]=c[14];a[b+15]=c[15];return a}});var R={alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif", +multiplyMatrices:function(a,b){var c=a.elements,d=b.elements;b=this.elements;a=c[0];var e=c[4],f=c[8],g=c[12],h=c[1],k=c[5],m=c[9],l=c[13],p=c[2],n=c[6],t=c[10],r=c[14],u=c[3],w=c[7],z=c[11];c=c[15];var y=d[0],x=d[4],A=d[8],G=d[12],D=d[1],C=d[5],F=d[9],B=d[13],E=d[2],H=d[6],I=d[10],J=d[14],L=d[3],N=d[7],R=d[11];d=d[15];b[0]=a*y+e*D+f*E+g*L;b[4]=a*x+e*C+f*H+g*N;b[8]=a*A+e*F+f*I+g*R;b[12]=a*G+e*B+f*J+g*d;b[1]=h*y+k*D+m*E+l*L;b[5]=h*x+k*C+m*H+l*N;b[9]=h*A+k*F+m*I+l*R;b[13]=h*G+k*B+m*J+l*d;b[2]=p*y+n* +D+t*E+r*L;b[6]=p*x+n*C+t*H+r*N;b[10]=p*A+n*F+t*I+r*R;b[14]=p*G+n*B+t*J+r*d;b[3]=u*y+w*D+z*E+c*L;b[7]=u*x+w*C+z*H+c*N;b[11]=u*A+w*F+z*I+c*R;b[15]=u*G+w*B+z*J+c*d;return this},multiplyScalar:function(a){var b=this.elements;b[0]*=a;b[4]*=a;b[8]*=a;b[12]*=a;b[1]*=a;b[5]*=a;b[9]*=a;b[13]*=a;b[2]*=a;b[6]*=a;b[10]*=a;b[14]*=a;b[3]*=a;b[7]*=a;b[11]*=a;b[15]*=a;return this},applyToBufferAttribute:function(){var a=new n;return function(b){for(var c=0,d=b.count;cthis.determinant()&&(g=-g);c.x=f[12];c.y=f[13];c.z=f[14];b.copy(this);c=1/g;f=1/h;var m=1/k;b.elements[0]*=c;b.elements[1]*=c;b.elements[2]*=c;b.elements[4]*=f;b.elements[5]*=f;b.elements[6]*=f;b.elements[8]*=m;b.elements[9]*=m;b.elements[10]*=m;d.setFromRotationMatrix(b);e.x=g;e.y=h;e.z=k;return this}}(),makePerspective:function(a,b,c,d,e,f){void 0===f&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs."); +var g=this.elements;g[0]=2*e/(b-a);g[4]=0;g[8]=(b+a)/(b-a);g[12]=0;g[1]=0;g[5]=2*e/(c-d);g[9]=(c+d)/(c-d);g[13]=0;g[2]=0;g[6]=0;g[10]=-(f+e)/(f-e);g[14]=-2*f*e/(f-e);g[3]=0;g[7]=0;g[11]=-1;g[15]=0;return this},makeOrthographic:function(a,b,c,d,e,f){var g=this.elements,h=1/(b-a),k=1/(c-d),m=1/(f-e);g[0]=2*h;g[4]=0;g[8]=0;g[12]=-((b+a)*h);g[1]=0;g[5]=2*k;g[9]=0;g[13]=-((c+d)*k);g[2]=0;g[6]=0;g[10]=-2*m;g[14]=-((f+e)*m);g[3]=0;g[7]=0;g[11]=0;g[15]=1;return this},equals:function(a){var b=this.elements; +a=a.elements;for(var c=0;16>c;c++)if(b[c]!==a[c])return!1;return!0},fromArray:function(a,b){void 0===b&&(b=0);for(var c=0;16>c;c++)this.elements[c]=a[c+b];return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);var c=this.elements;a[b]=c[0];a[b+1]=c[1];a[b+2]=c[2];a[b+3]=c[3];a[b+4]=c[4];a[b+5]=c[5];a[b+6]=c[6];a[b+7]=c[7];a[b+8]=c[8];a[b+9]=c[9];a[b+10]=c[10];a[b+11]=c[11];a[b+12]=c[12];a[b+13]=c[13];a[b+14]=c[14];a[b+15]=c[15];return a}});var U={alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif", alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef ALPHATEST\n\tif ( diffuseColor.a < ALPHATEST ) discard;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( PHYSICAL )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\n\t#endif\n#endif", -aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",begin_vertex:"vec3 transformed = vec3( position );",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"vec2 integrateSpecularBRDF( const in float dotNV, const in float roughness ) {\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\treturn vec2( -1.04, 1.04 ) * a004 + r.zw;\n}\nfloat punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif( cutoffDistance > 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n#else\n\tif( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t}\n\treturn 1.0;\n#endif\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNL = saturate( dot( geometry.normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\nvec3 BRDF_Specular_GGX_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\treturn specularColor * brdf.x + brdf.y;\n}\nvoid BRDF_Specular_Multiscattering_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tvec3 F = F_Schlick( specularColor, dotNV );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\tvec3 FssEss = F * brdf.x + brdf.y;\n\tfloat Ess = brdf.x + brdf.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}", +aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",begin_vertex:"vec3 transformed = vec3( position );",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"vec2 integrateSpecularBRDF( const in float dotNV, const in float roughness ) {\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\treturn vec2( -1.04, 1.04 ) * a004 + r.zw;\n}\nfloat punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif( cutoffDistance > 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n#else\n\tif( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t}\n\treturn 1.0;\n#endif\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nvec3 F_Schlick_RoughnessDependent( const in vec3 F0, const in float dotNV, const in float roughness ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotNV - 6.98316 ) * dotNV );\n\tvec3 Fr = max( vec3( 1.0 - roughness ), F0 ) - F0;\n\treturn Fr * fresnel + F0;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNL = saturate( dot( geometry.normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\nvec3 BRDF_Specular_GGX_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\treturn specularColor * brdf.x + brdf.y;\n}\nvoid BRDF_Specular_Multiscattering_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tvec3 F = F_Schlick_RoughnessDependent( specularColor, dotNV, roughness );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\tvec3 FssEss = F * brdf.x + brdf.y;\n\tfloat Ess = brdf.x + brdf.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}", bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\t\tfDet *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif", clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vViewPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vViewPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\tif ( clipped ) discard;\n\t#endif\n#endif", clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\t#if ! defined( PHYSICAL ) && ! defined( PHONG ) && ! defined( MATCAP )\n\t\tvarying vec3 vViewPosition;\n\t#endif\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG ) && ! defined( MATCAP )\n\tvarying vec3 vViewPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG ) && ! defined( MATCAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif", @@ -442,7 +443,7 @@ lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tun lights_pars_begin:"uniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in GeometricContext geometry ) {\n\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t\tfloat shadowCameraNear;\n\t\tfloat shadowCameraFar;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tdirectLight.color = pointLight.color;\n\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\tdirectLight.visible = ( directLight.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( angleCos > spotLight.coneCos ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif", lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifdef TOON\n\t\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\t#else\n\t\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\t\tvec3 irradiance = dotNL * directLight.color;\n\t#endif\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)", lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 );\n#ifdef STANDARD\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.clearCoat = saturate( clearCoat );\tmaterial.clearCoatRoughness = clamp( clearCoatRoughness, 0.04, 1.0 );\n#endif", -lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n\t#ifndef STANDARD\n\t\tfloat clearCoat;\n\t\tfloat clearCoatRoughness;\n\t#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearCoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.specularRoughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifndef STANDARD\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.directSpecular += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry, material.specularColor, material.specularRoughness );\n\treflectedLight.directDiffuse += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\t#ifndef STANDARD\n\t\treflectedLight.directSpecular += irradiance * material.clearCoat * BRDF_Specular_GGX( directLight, geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifndef ENVMAP_TYPE_CUBE_UV\n\t\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\t#endif\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearCoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifndef STANDARD\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\tfloat dotNL = dotNV;\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\tfloat clearCoatInv = 1.0 - clearCoatDHR;\n\t#if defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec3 singleScattering = vec3( 0.0 );\n\t\tvec3 multiScattering = vec3( 0.0 );\n\t\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\t\tBRDF_Specular_Multiscattering_Environment( geometry, material.specularColor, material.specularRoughness, singleScattering, multiScattering );\n\t\tvec3 diffuse = material.diffuseColor;\n\t\treflectedLight.indirectSpecular += clearCoatInv * radiance * singleScattering;\n\t\treflectedLight.indirectDiffuse += multiScattering * cosineWeightedIrradiance;\n\t\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n\t#else\n\t\treflectedLight.indirectSpecular += clearCoatInv * radiance * BRDF_Specular_GGX_Environment( geometry, material.specularColor, material.specularRoughness );\n\t#endif\n\t#ifndef STANDARD\n\t\treflectedLight.indirectSpecular += clearCoatRadiance * material.clearCoat * BRDF_Specular_GGX_Environment( geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\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\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}", +lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n\t#ifndef STANDARD\n\t\tfloat clearCoat;\n\t\tfloat clearCoatRoughness;\n\t#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearCoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.specularRoughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifndef STANDARD\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.directSpecular += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry, material.specularColor, material.specularRoughness );\n\treflectedLight.directDiffuse += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\t#ifndef STANDARD\n\t\treflectedLight.directSpecular += irradiance * material.clearCoat * BRDF_Specular_GGX( directLight, geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifndef ENVMAP_TYPE_CUBE_UV\n\t\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\t#endif\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearCoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifndef STANDARD\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\tfloat dotNL = dotNV;\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\tfloat clearCoatInv = 1.0 - clearCoatDHR;\n\t#if defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec3 singleScattering = vec3( 0.0 );\n\t\tvec3 multiScattering = vec3( 0.0 );\n\t\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\t\tBRDF_Specular_Multiscattering_Environment( geometry, material.specularColor, material.specularRoughness, singleScattering, multiScattering );\n\t\tvec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\n\t\treflectedLight.indirectSpecular += clearCoatInv * radiance * singleScattering;\n\t\treflectedLight.indirectDiffuse += multiScattering * cosineWeightedIrradiance;\n\t\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n\t#else\n\t\treflectedLight.indirectSpecular += clearCoatInv * radiance * BRDF_Specular_GGX_Environment( geometry, material.specularColor, material.specularRoughness );\n\t#endif\n\t#ifndef STANDARD\n\t\treflectedLight.indirectSpecular += clearCoatRadiance * material.clearCoat * BRDF_Specular_GGX_Environment( geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\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\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}", lights_fragment_begin:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = normalize( vViewPosition );\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( pointLight.shadow, directLight.visible ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( spotLight.shadow, directLight.visible ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( directionalLight.shadow, directLight.visible ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearCoatRadiance = vec3( 0.0 );\n#endif", lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec3 lightMapIrradiance = texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( PHYSICAL ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tirradiance += getLightProbeIndirectIrradiance( geometry, maxMipLevel );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getLightProbeIndirectRadiance( geometry, Material_BlinnShininessExponent( material ), maxMipLevel );\n\t#ifndef STANDARD\n\t\tclearCoatRadiance += getLightProbeIndirectRadiance( geometry, Material_ClearCoat_BlinnShininessExponent( material ), maxMipLevel );\n\t#endif\n#endif", lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, irradiance, clearCoatRadiance, geometry, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n#endif", @@ -490,496 +491,496 @@ points_vert:"uniform float size;\nuniform float scale;\n#include \n#incl shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include \n}",shadow_vert:"#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}", sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n}", sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include \n\t#include \n\t#include \n}"}, -nh={clone:Rb,merge:ya},oh={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, +sh={clone:Sb,merge:wa},th={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643, darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055, grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184, lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130, palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780, -teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Object.assign(A.prototype,{isColor:!0,r:1,g:1,b:1,set:function(a){a&&a.isColor?this.copy(a):"number"===typeof a?this.setHex(a):"string"===typeof a&&this.setStyle(a);return this},setScalar:function(a){this.b=this.g=this.r=a;return this},setHex:function(a){a=Math.floor(a);this.r=(a>>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255; -return this},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;return this},setHSL:function(){function a(a,c,d){0>d&&(d+=1);1d?c:d<2/3?a+6*(c-a)*(2/3-d):a}return function(b,c,d){b=O.euclideanModulo(b,1);c=O.clamp(c,0,1);d=O.clamp(d,0,1);0===c?this.r=this.g=this.b=d:(c=.5>=d?d*(1+c):d+c-d*c,d=2*d-c,this.r=a(d,c,b+1/3),this.g=a(d,c,b),this.b=a(d,c,b-1/3));return this}}(),setStyle:function(a){function b(b){void 0!==b&&1>parseFloat(b)&&console.warn("THREE.Color: Alpha component of "+ +teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Object.assign(B.prototype,{isColor:!0,r:1,g:1,b:1,set:function(a){a&&a.isColor?this.copy(a):"number"===typeof a?this.setHex(a):"string"===typeof a&&this.setStyle(a);return this},setScalar:function(a){this.b=this.g=this.r=a;return this},setHex:function(a){a=Math.floor(a);this.r=(a>>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255; +return this},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;return this},setHSL:function(){function a(a,c,d){0>d&&(d+=1);1d?c:d<2/3?a+6*(c-a)*(2/3-d):a}return function(b,c,d){b=P.euclideanModulo(b,1);c=P.clamp(c,0,1);d=P.clamp(d,0,1);0===c?this.r=this.g=this.b=d:(c=.5>=d?d*(1+c):d+c-d*c,d=2*d-c,this.r=a(d,c,b+1/3),this.g=a(d,c,b),this.b=a(d,c,b-1/3));return this}}(),setStyle:function(a){function b(b){void 0!==b&&1>parseFloat(b)&&console.warn("THREE.Color: Alpha component of "+ a+" will be ignored.")}var c;if(c=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(a)){var d=c[2];switch(c[1]){case "rgb":case "rgba":if(c=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(d))return this.r=Math.min(255,parseInt(c[1],10))/255,this.g=Math.min(255,parseInt(c[2],10))/255,this.b=Math.min(255,parseInt(c[3],10))/255,b(c[5]),this;if(c=/^(\d+)%\s*,\s*(\d+)%\s*,\s*(\d+)%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(d))return this.r=Math.min(100,parseInt(c[1],10))/100,this.g=Math.min(100,parseInt(c[2], 10))/100,this.b=Math.min(100,parseInt(c[3],10))/100,b(c[5]),this;break;case "hsl":case "hsla":if(c=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)%\s*,\s*(\d+)%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(d)){d=parseFloat(c[1])/360;var e=parseInt(c[2],10)/100,f=parseInt(c[3],10)/100;b(c[5]);return this.setHSL(d,e,f)}}}else if(c=/^#([A-Fa-f0-9]+)$/.exec(a)){c=c[1];d=c.length;if(3===d)return this.r=parseInt(c.charAt(0)+c.charAt(0),16)/255,this.g=parseInt(c.charAt(1)+c.charAt(1),16)/255,this.b=parseInt(c.charAt(2)+c.charAt(2), -16)/255,this;if(6===d)return this.r=parseInt(c.charAt(0)+c.charAt(1),16)/255,this.g=parseInt(c.charAt(2)+c.charAt(3),16)/255,this.b=parseInt(c.charAt(4)+c.charAt(5),16)/255,this}a&&0a?.0773993808*a:Math.pow(.9478672986*a+.0521327014,2.4)}return function(b){this.r=a(b.r);this.g=a(b.g);this.b= a(b.b);return this}}(),copyLinearToSRGB:function(){function a(a){return.0031308>a?12.92*a:1.055*Math.pow(a,.41666)-.055}return function(b){this.r=a(b.r);this.g=a(b.g);this.b=a(b.b);return this}}(),convertSRGBToLinear:function(){this.copySRGBToLinear(this);return this},convertLinearToSRGB:function(){this.copyLinearToSRGB(this);return 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(a){void 0=== -a&&(console.warn("THREE.Color: .getHSL() target is now required"),a={h:0,s:0,l:0});var b=this.r,c=this.g,d=this.b,e=Math.max(b,c,d),f=Math.min(b,c,d),g,h=(f+e)/2;if(f===e)f=g=0;else{var l=e-f;f=.5>=h?l/(e+f):l/(2-e-f);switch(e){case b:g=(c-d)/l+(c=h?k/(e+f):k/(2-e-f);switch(e){case b:g=(c-d)/k+(cMath.abs(g)?(this._x=Math.atan2(-m,e),this._z=Math.atan2(-f,a)):(this._x=Math.atan2(p,l),this._z=0)):"YXZ"===b?(this._x=Math.asin(-d(m,-1,1)),.99999>Math.abs(m)?(this._y=Math.atan2(g,e),this._z=Math.atan2(h,l)):(this._y=Math.atan2(-k,a),this._z=0)):"ZXY"===b?(this._x=Math.asin(d(p,-1,1)),.99999>Math.abs(p)?(this._y=Math.atan2(-k,e),this._z=Math.atan2(-f,l)):(this._y=0,this._z=Math.atan2(h,a))):"ZYX"===b?(this._y=Math.asin(-d(k, --1,1)),.99999>Math.abs(k)?(this._x=Math.atan2(p,e),this._z=Math.atan2(h,a)):(this._x=0,this._z=Math.atan2(-f,l))):"YZX"===b?(this._z=Math.asin(d(h,-1,1)),.99999>Math.abs(h)?(this._x=Math.atan2(-m,l),this._y=Math.atan2(-k,a)):(this._x=0,this._y=Math.atan2(g,e))):"XZY"===b?(this._z=Math.asin(-d(f,-1,1)),.99999>Math.abs(f)?(this._x=Math.atan2(p,l),this._y=Math.atan2(g,a)):(this._x=Math.atan2(-m,e),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+b);this._order= -b;if(!1!==c)this.onChangeCallback();return this},setFromQuaternion:function(){var a=new P;return function(b,c,d){a.makeRotationFromQuaternion(b);return this.setFromRotationMatrix(a,c,d)}}(),setFromVector3:function(a,b){return this.set(a.x,a.y,a.z,b||this._order)},reorder:function(){var a=new ma;return function(b){a.setFromEuler(this);return this.setFromQuaternion(a,b)}}(),equals:function(a){return a._x===this._x&&a._y===this._y&&a._z===this._z&&a._order===this._order},fromArray:function(a){this._x= -a[0];this._y=a[1];this._z=a[2];void 0!==a[3]&&(this._order=a[3]);this.onChangeCallback();return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this._x;a[b+1]=this._y;a[b+2]=this._z;a[b+3]=this._order;return a},toVector3:function(a){return a?a.set(this._x,this._y,this._z):new n(this._x,this._y,this._z)},onChange:function(a){this.onChangeCallback=a;return this},onChangeCallback:function(){}});Object.assign(ee.prototype,{set:function(a){this.mask=1<Math.abs(g)?(this._x=Math.atan2(-m,e),this._z=Math.atan2(-f,a)):(this._x=Math.atan2(p,k),this._z=0)):"YXZ"===b?(this._x=Math.asin(-d(m,-1,1)),.99999>Math.abs(m)?(this._y=Math.atan2(g,e),this._z=Math.atan2(h,k)):(this._y=Math.atan2(-l,a),this._z=0)):"ZXY"===b?(this._x=Math.asin(d(p,-1,1)),.99999>Math.abs(p)?(this._y=Math.atan2(-l,e),this._z=Math.atan2(-f,k)):(this._y=0,this._z=Math.atan2(h,a))):"ZYX"===b?(this._y=Math.asin(-d(l, +-1,1)),.99999>Math.abs(l)?(this._x=Math.atan2(p,e),this._z=Math.atan2(h,a)):(this._x=0,this._z=Math.atan2(-f,k))):"YZX"===b?(this._z=Math.asin(d(h,-1,1)),.99999>Math.abs(h)?(this._x=Math.atan2(-m,k),this._y=Math.atan2(-l,a)):(this._x=0,this._y=Math.atan2(g,e))):"XZY"===b?(this._z=Math.asin(-d(f,-1,1)),.99999>Math.abs(f)?(this._x=Math.atan2(p,k),this._y=Math.atan2(g,a)):(this._x=Math.atan2(-m,e),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+b);this._order= +b;if(!1!==c)this.onChangeCallback();return this},setFromQuaternion:function(){var a=new O;return function(b,c,d){a.makeRotationFromQuaternion(b);return this.setFromRotationMatrix(a,c,d)}}(),setFromVector3:function(a,b){return this.set(a.x,a.y,a.z,b||this._order)},reorder:function(){var a=new ea;return function(b){a.setFromEuler(this);return this.setFromQuaternion(a,b)}}(),equals:function(a){return a._x===this._x&&a._y===this._y&&a._z===this._z&&a._order===this._order},fromArray:function(a){this._x= +a[0];this._y=a[1];this._z=a[2];void 0!==a[3]&&(this._order=a[3]);this.onChangeCallback();return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this._x;a[b+1]=this._y;a[b+2]=this._z;a[b+3]=this._order;return a},toVector3:function(a){return a?a.set(this._x,this._y,this._z):new n(this._x,this._y,this._z)},onChange:function(a){this.onChangeCallback=a;return this},onChangeCallback:function(){}});Object.assign(je.prototype,{set:function(a){this.mask=1<g;g++)if(d[g]===d[(g+1)%3]){a.push(f);break}for(f=a.length-1;0<=f;f--)for(d=a[f],this.faces.splice(d,1),c=0,e=this.faceVertexUvs.length;cg;g++)if(d[g]===d[(g+1)%3]){a.push(f);break}for(f=a.length-1;0<=f;f--)for(d=a[f],this.faces.splice(d,1),c=0,e=this.faceVertexUvs.length;cthis.opacity&&(d.opacity=this.opacity);!0===this.transparent&&(d.transparent=this.transparent);d.depthFunc=this.depthFunc;d.depthTest=this.depthTest;d.depthWrite=this.depthWrite;0!==this.rotation&&(d.rotation=this.rotation);!0===this.polygonOffset&&(d.polygonOffset=!0);0!==this.polygonOffsetFactor&&(d.polygonOffsetFactor=this.polygonOffsetFactor);0!==this.polygonOffsetUnits&& -(d.polygonOffsetUnits=this.polygonOffsetUnits);1!==this.linewidth&&(d.linewidth=this.linewidth);void 0!==this.dashSize&&(d.dashSize=this.dashSize);void 0!==this.gapSize&&(d.gapSize=this.gapSize);void 0!==this.scale&&(d.scale=this.scale);!0===this.dithering&&(d.dithering=!0);0a?b.copy(this.origin):b.copy(this.direction).multiplyScalar(a).add(this.origin)},distanceToPoint:function(a){return Math.sqrt(this.distanceSqToPoint(a))},distanceSqToPoint:function(){var a=new n;return function(b){var c=a.subVectors(b,this.origin).dot(this.direction);if(0>c)return this.origin.distanceToSquared(b);a.copy(this.direction).multiplyScalar(c).add(this.origin);return a.distanceToSquared(b)}}(),distanceSqToSegment:function(){var a= -new n,b=new n,c=new n;return function(d,e,f,g){a.copy(d).add(e).multiplyScalar(.5);b.copy(e).sub(d).normalize();c.copy(this.origin).sub(a);var h=.5*d.distanceTo(e),l=-this.direction.dot(b),m=c.dot(this.direction),k=-c.dot(b),p=c.lengthSq(),n=Math.abs(1-l*l);if(0=-t?e<=t?(h=1/n,d*=h,e*=h,l=d*(d+l*e+2*m)+e*(l*d+e+2*k)+p):(e=h,d=Math.max(0,-(l*e+m)),l=-d*d+e*(e+2*k)+p):(e=-h,d=Math.max(0,-(l*e+m)),l=-d*d+e*(e+2*k)+p):e<=-t?(d=Math.max(0,-(-l*h+m)),e=0b)return null; -b=Math.sqrt(b-e);e=d-b;d+=b;return 0>e&&0>d?null:0>e?this.at(d,c):this.at(e,c)}}(),intersectsSphere:function(a){return this.distanceSqToPoint(a.center)<=a.radius*a.radius},distanceToPlane:function(a){var b=a.normal.dot(this.direction);if(0===b)return 0===a.distanceToPoint(this.origin)?0:null;a=-(this.origin.dot(a.normal)+a.constant)/b;return 0<=a?a:null},intersectPlane:function(a,b){a=this.distanceToPlane(a);return null===a?null:this.at(a,b)},intersectsPlane:function(a){var b=a.distanceToPoint(this.origin); -return 0===b||0>a.normal.dot(this.direction)*b?!0:!1},intersectBox:function(a,b){var c=1/this.direction.x;var d=1/this.direction.y;var e=1/this.direction.z,f=this.origin;if(0<=c){var g=(a.min.x-f.x)*c;c*=a.max.x-f.x}else g=(a.max.x-f.x)*c,c*=a.min.x-f.x;if(0<=d){var h=(a.min.y-f.y)*d;d*=a.max.y-f.y}else h=(a.max.y-f.y)*d,d*=a.min.y-f.y;if(g>d||h>c)return null;if(h>g||g!==g)g=h;if(da||h>c)return null; -if(h>g||g!==g)g=h;if(ac?null:this.at(0<=g?g:c,b)},intersectsBox:function(){var a=new n;return function(b){return null!==this.intersectBox(b,a)}}(),intersectTriangle:function(){var a=new n,b=new n,c=new n,d=new n;return function(e,f,g,h,l){b.subVectors(f,e);c.subVectors(g,e);d.crossVectors(b,c);f=this.direction.dot(d);if(0f)h=-1,f=-f;else return null;a.subVectors(this.origin,e);e=h*this.direction.dot(c.crossVectors(a,c));if(0>e)return null; -g=h*this.direction.dot(b.cross(a));if(0>g||e+g>f)return null;e=-h*a.dot(d);return 0>e?null:this.at(e/f,l)}}(),applyMatrix4:function(a){this.origin.applyMatrix4(a);this.direction.transformDirection(a);return this},equals:function(a){return a.origin.equals(this.origin)&&a.direction.equals(this.direction)}});Object.assign(ra,{getNormal:function(){var a=new n;return function(b,c,d,e){void 0===e&&(console.warn("THREE.Triangle: .getNormal() target is now required"),e=new n);e.subVectors(d,c);a.subVectors(b, -c);e.cross(a);b=e.lengthSq();return 0=a.x+a.y}}(),getUV:function(){var a=new n;return function(b,c,d,e,f,g,h,l){this.getBarycoord(b,c,d,e,a);l.set(0,0);l.addScaledVector(f,a.x);l.addScaledVector(g,a.y);l.addScaledVector(h,a.z);return l}}()});Object.assign(ra.prototype,{set:function(a,b,c){this.a.copy(a);this.b.copy(b);this.c.copy(c);return this},setFromPointsAndIndices:function(a,b,c,d){this.a.copy(a[b]);this.b.copy(a[c]);this.c.copy(a[d]);return this}, -clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.a.copy(a.a);this.b.copy(a.b);this.c.copy(a.c);return this},getArea:function(){var a=new n,b=new n;return function(){a.subVectors(this.c,this.b);b.subVectors(this.a,this.b);return.5*a.cross(b).length()}}(),getMidpoint:function(a){void 0===a&&(console.warn("THREE.Triangle: .getMidpoint() target is now required"),a=new n);return a.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},getNormal:function(a){return ra.getNormal(this.a, -this.b,this.c,a)},getPlane:function(a){void 0===a&&(console.warn("THREE.Triangle: .getPlane() target is now required"),a=new n);return a.setFromCoplanarPoints(this.a,this.b,this.c)},getBarycoord:function(a,b){return ra.getBarycoord(a,this.a,this.b,this.c,b)},containsPoint:function(a){return ra.containsPoint(a,this.a,this.b,this.c)},getUV:function(a,b,c,d,e){return ra.getUV(a,this.a,this.b,this.c,b,c,d,e)},intersectsBox:function(a){return a.intersectsTriangle(this)},closestPointToPoint:function(){var a= -new n,b=new n,c=new n,d=new n,e=new n,f=new n;return function(g,h){void 0===h&&(console.warn("THREE.Triangle: .closestPointToPoint() target is now required"),h=new n);var l=this.a,m=this.b,k=this.c;a.subVectors(m,l);b.subVectors(k,l);d.subVectors(g,l);var p=a.dot(d),v=b.dot(d);if(0>=p&&0>=v)return h.copy(l);e.subVectors(g,m);var t=a.dot(e),r=b.dot(e);if(0<=t&&r<=t)return h.copy(m);var u=p*r-t*v;if(0>=u&&0<=p&&0>=t)return m=p/(p-t),h.copy(l).addScaledVector(a,m);f.subVectors(g,k);g=a.dot(f);var w= -b.dot(f);if(0<=w&&g<=w)return h.copy(k);p=g*v-p*w;if(0>=p&&0<=v&&0>=w)return u=v/(v-w),h.copy(l).addScaledVector(b,u);v=t*w-g*r;if(0>=v&&0<=r-t&&0<=g-w)return c.subVectors(k,m),u=(r-t)/(r-t+(g-w)),h.copy(m).addScaledVector(c,u);k=1/(v+p+u);m=p*k;u*=k;return h.copy(l).addScaledVector(a,m).addScaledVector(b,u)}}(),equals:function(a){return a.a.equals(this.a)&&a.b.equals(this.b)&&a.c.equals(this.c)}});Ca.prototype=Object.create(Q.prototype);Ca.prototype.constructor=Ca;Ca.prototype.isMeshBasicMaterial= -!0;Ca.prototype.copy=function(a){Q.prototype.copy.call(this,a);this.color.copy(a.color);this.map=a.map;this.lightMap=a.lightMap;this.lightMapIntensity=a.lightMapIntensity;this.aoMap=a.aoMap;this.aoMapIntensity=a.aoMapIntensity;this.specularMap=a.specularMap;this.alphaMap=a.alphaMap;this.envMap=a.envMap;this.combine=a.combine;this.reflectivity=a.reflectivity;this.refractionRatio=a.refractionRatio;this.wireframe=a.wireframe;this.wireframeLinewidth=a.wireframeLinewidth;this.wireframeLinecap=a.wireframeLinecap; -this.wireframeLinejoin=a.wireframeLinejoin;this.skinning=a.skinning;this.morphTargets=a.morphTargets;return this};qa.prototype=Object.assign(Object.create(D.prototype),{constructor:qa,isMesh:!0,setDrawMode:function(a){this.drawMode=a},copy:function(a){D.prototype.copy.call(this,a);this.drawMode=a.drawMode;void 0!==a.morphTargetInfluences&&(this.morphTargetInfluences=a.morphTargetInfluences.slice());void 0!==a.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},a.morphTargetDictionary)); +array:Array.prototype.slice.call(b.array)});var c=this.attributes;for(m in c){b=c[m];var d=b.toJSON();""!==b.name&&(d.name=b.name);a.data.attributes[m]=d}c={};var e=!1;for(m in this.morphAttributes){for(var f=this.morphAttributes[m],g=[],h=0,k=f.length;hthis.opacity&&(d.opacity=this.opacity);!0===this.transparent&& +(d.transparent=this.transparent);d.depthFunc=this.depthFunc;d.depthTest=this.depthTest;d.depthWrite=this.depthWrite;0!==this.rotation&&(d.rotation=this.rotation);!0===this.polygonOffset&&(d.polygonOffset=!0);0!==this.polygonOffsetFactor&&(d.polygonOffsetFactor=this.polygonOffsetFactor);0!==this.polygonOffsetUnits&&(d.polygonOffsetUnits=this.polygonOffsetUnits);1!==this.linewidth&&(d.linewidth=this.linewidth);void 0!==this.dashSize&&(d.dashSize=this.dashSize);void 0!==this.gapSize&&(d.gapSize=this.gapSize); +void 0!==this.scale&&(d.scale=this.scale);!0===this.dithering&&(d.dithering=!0);0a?b.copy(this.origin):b.copy(this.direction).multiplyScalar(a).add(this.origin)}, +distanceToPoint:function(a){return Math.sqrt(this.distanceSqToPoint(a))},distanceSqToPoint:function(){var a=new n;return function(b){var c=a.subVectors(b,this.origin).dot(this.direction);if(0>c)return this.origin.distanceToSquared(b);a.copy(this.direction).multiplyScalar(c).add(this.origin);return a.distanceToSquared(b)}}(),distanceSqToSegment:function(){var a=new n,b=new n,c=new n;return function(d,e,f,g){a.copy(d).add(e).multiplyScalar(.5);b.copy(e).sub(d).normalize();c.copy(this.origin).sub(a); +var h=.5*d.distanceTo(e),k=-this.direction.dot(b),m=c.dot(this.direction),l=-c.dot(b),p=c.lengthSq(),n=Math.abs(1-k*k);if(0=-t?e<=t?(h=1/n,d*=h,e*=h,k=d*(d+k*e+2*m)+e*(k*d+e+2*l)+p):(e=h,d=Math.max(0,-(k*e+m)),k=-d*d+e*(e+2*l)+p):(e=-h,d=Math.max(0,-(k*e+m)),k=-d*d+e*(e+2*l)+p):e<=-t?(d=Math.max(0,-(-k*h+m)),e=0b)return null;b=Math.sqrt(b-e);e=d-b;d+=b;return 0>e&&0>d?null:0>e?this.at(d,c):this.at(e,c)}}(),intersectsSphere:function(a){return this.distanceSqToPoint(a.center)<= +a.radius*a.radius},distanceToPlane:function(a){var b=a.normal.dot(this.direction);if(0===b)return 0===a.distanceToPoint(this.origin)?0:null;a=-(this.origin.dot(a.normal)+a.constant)/b;return 0<=a?a:null},intersectPlane:function(a,b){a=this.distanceToPlane(a);return null===a?null:this.at(a,b)},intersectsPlane:function(a){var b=a.distanceToPoint(this.origin);return 0===b||0>a.normal.dot(this.direction)*b?!0:!1},intersectBox:function(a,b){var c=1/this.direction.x;var d=1/this.direction.y;var e=1/this.direction.z, +f=this.origin;if(0<=c){var g=(a.min.x-f.x)*c;c*=a.max.x-f.x}else g=(a.max.x-f.x)*c,c*=a.min.x-f.x;if(0<=d){var h=(a.min.y-f.y)*d;d*=a.max.y-f.y}else h=(a.max.y-f.y)*d,d*=a.min.y-f.y;if(g>d||h>c)return null;if(h>g||g!==g)g=h;if(da||h>c)return null;if(h>g||g!==g)g=h;if(ac?null:this.at(0<=g?g:c,b)},intersectsBox:function(){var a=new n;return function(b){return null!==this.intersectBox(b, +a)}}(),intersectTriangle:function(){var a=new n,b=new n,c=new n,d=new n;return function(e,f,g,h,k){b.subVectors(f,e);c.subVectors(g,e);d.crossVectors(b,c);f=this.direction.dot(d);if(0f)h=-1,f=-f;else return null;a.subVectors(this.origin,e);e=h*this.direction.dot(c.crossVectors(a,c));if(0>e)return null;g=h*this.direction.dot(b.cross(a));if(0>g||e+g>f)return null;e=-h*a.dot(d);return 0>e?null:this.at(e/f,k)}}(),applyMatrix4:function(a){this.origin.applyMatrix4(a); +this.direction.transformDirection(a);return this},equals:function(a){return a.origin.equals(this.origin)&&a.direction.equals(this.direction)}});Object.assign(ta,{getNormal:function(){var a=new n;return function(b,c,d,e){void 0===e&&(console.warn("THREE.Triangle: .getNormal() target is now required"),e=new n);e.subVectors(d,c);a.subVectors(b,c);e.cross(a);b=e.lengthSq();return 0=a.x+a.y}}(),getUV:function(){var a=new n;return function(b,c,d, +e,f,g,h,k){this.getBarycoord(b,c,d,e,a);k.set(0,0);k.addScaledVector(f,a.x);k.addScaledVector(g,a.y);k.addScaledVector(h,a.z);return k}}(),isFrontFacing:function(){var a=new n,b=new n;return function(c,d,e,f){a.subVectors(e,d);b.subVectors(c,d);return 0>a.cross(b).dot(f)?!0:!1}}()});Object.assign(ta.prototype,{set:function(a,b,c){this.a.copy(a);this.b.copy(b);this.c.copy(c);return this},setFromPointsAndIndices:function(a,b,c,d){this.a.copy(a[b]);this.b.copy(a[c]);this.c.copy(a[d]);return this},clone:function(){return(new this.constructor).copy(this)}, +copy:function(a){this.a.copy(a.a);this.b.copy(a.b);this.c.copy(a.c);return this},getArea:function(){var a=new n,b=new n;return function(){a.subVectors(this.c,this.b);b.subVectors(this.a,this.b);return.5*a.cross(b).length()}}(),getMidpoint:function(a){void 0===a&&(console.warn("THREE.Triangle: .getMidpoint() target is now required"),a=new n);return a.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},getNormal:function(a){return ta.getNormal(this.a,this.b,this.c,a)},getPlane:function(a){void 0=== +a&&(console.warn("THREE.Triangle: .getPlane() target is now required"),a=new n);return a.setFromCoplanarPoints(this.a,this.b,this.c)},getBarycoord:function(a,b){return ta.getBarycoord(a,this.a,this.b,this.c,b)},getUV:function(a,b,c,d,e){return ta.getUV(a,this.a,this.b,this.c,b,c,d,e)},containsPoint:function(a){return ta.containsPoint(a,this.a,this.b,this.c)},isFrontFacing:function(a){return ta.isFrontFacing(this.a,this.b,this.c,a)},intersectsBox:function(a){return a.intersectsTriangle(this)},closestPointToPoint:function(){var a= +new n,b=new n,c=new n,d=new n,e=new n,f=new n;return function(g,h){void 0===h&&(console.warn("THREE.Triangle: .closestPointToPoint() target is now required"),h=new n);var k=this.a,m=this.b,l=this.c;a.subVectors(m,k);b.subVectors(l,k);d.subVectors(g,k);var p=a.dot(d),v=b.dot(d);if(0>=p&&0>=v)return h.copy(k);e.subVectors(g,m);var t=a.dot(e),r=b.dot(e);if(0<=t&&r<=t)return h.copy(m);var u=p*r-t*v;if(0>=u&&0<=p&&0>=t)return m=p/(p-t),h.copy(k).addScaledVector(a,m);f.subVectors(g,l);g=a.dot(f);var w= +b.dot(f);if(0<=w&&g<=w)return h.copy(l);p=g*v-p*w;if(0>=p&&0<=v&&0>=w)return u=v/(v-w),h.copy(k).addScaledVector(b,u);v=t*w-g*r;if(0>=v&&0<=r-t&&0<=g-w)return c.subVectors(l,m),u=(r-t)/(r-t+(g-w)),h.copy(m).addScaledVector(c,u);l=1/(v+p+u);m=p*l;u*=l;return h.copy(k).addScaledVector(a,m).addScaledVector(b,u)}}(),equals:function(a){return a.a.equals(this.a)&&a.b.equals(this.b)&&a.c.equals(this.c)}});ka.prototype=Object.create(L.prototype);ka.prototype.constructor=ka;ka.prototype.isMeshBasicMaterial= +!0;ka.prototype.copy=function(a){L.prototype.copy.call(this,a);this.color.copy(a.color);this.map=a.map;this.lightMap=a.lightMap;this.lightMapIntensity=a.lightMapIntensity;this.aoMap=a.aoMap;this.aoMapIntensity=a.aoMapIntensity;this.specularMap=a.specularMap;this.alphaMap=a.alphaMap;this.envMap=a.envMap;this.combine=a.combine;this.reflectivity=a.reflectivity;this.refractionRatio=a.refractionRatio;this.wireframe=a.wireframe;this.wireframeLinewidth=a.wireframeLinewidth;this.wireframeLinecap=a.wireframeLinecap; +this.wireframeLinejoin=a.wireframeLinejoin;this.skinning=a.skinning;this.morphTargets=a.morphTargets;return this};ha.prototype=Object.assign(Object.create(H.prototype),{constructor:ha,isMesh:!0,setDrawMode:function(a){this.drawMode=a},copy:function(a){H.prototype.copy.call(this,a);this.drawMode=a.drawMode;void 0!==a.morphTargetInfluences&&(this.morphTargetInfluences=a.morphTargetInfluences.slice());void 0!==a.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},a.morphTargetDictionary)); return this},updateMorphTargets:function(){var a=this.geometry;if(a.isBufferGeometry){a=a.morphAttributes;var b=Object.keys(a);if(0c.far?null:{distance:b,point:x.clone(),object:a}}function b(b,c,d,e,q,n,x,B,A,D){f.fromBufferAttribute(q,B);g.fromBufferAttribute(q,A);h.fromBufferAttribute(q,D);q=b.morphTargetInfluences;if(c.morphTargets&&n&&q){p.set(0,0,0);v.set(0,0,0);t.set(0,0,0);for(var y= -0,G=n.length;yc.far?null:{distance:b,point:y.clone(),object:a}}function b(b,c,d,e,q,n,y,C,B,E){f.fromBufferAttribute(q,C);g.fromBufferAttribute(q,B);h.fromBufferAttribute(q,E);q=b.morphTargetInfluences;if(c.morphTargets&&n&&q){p.set(0,0,0);v.set(0,0,0);t.set(0,0,0);for(var x= +0,G=n.length;xe.far||f.push({distance:r,point:b.clone(),uv:ra.getUV(b,h,l,m,k,p,v,new C),face:null,object:this})}}(),clone:function(){return(new this.constructor(this.material)).copy(this)}, -copy:function(a){D.prototype.copy.call(this,a);void 0!==a.center&&this.center.copy(a.center);return this}});Mc.prototype=Object.assign(Object.create(D.prototype),{constructor:Mc,isLOD:!0,copy:function(a){D.prototype.copy.call(this,a,!1);a=a.levels;for(var b=0,c=a.length;be.far||f.push({distance:r,point:b.clone(),uv:ta.getUV(b,h,k,m,l,p,v,new D),face:null,object:this})}}(),clone:function(){return(new this.constructor(this.material)).copy(this)}, +copy:function(a){H.prototype.copy.call(this,a);void 0!==a.center&&this.center.copy(a.center);return this}});Oc.prototype=Object.assign(Object.create(H.prototype),{constructor:Oc,isLOD:!0,copy:function(a){H.prototype.copy.call(this,a,!1);a=a.levels;for(var b=0,c=a.length;b=d[e].distance)d[e-1].object.visible=!1,d[e].object.visible=!0;else break;for(;ef||(k.applyMatrix4(this.matrixWorld),u=d.ray.origin.distanceTo(k),ud.far|| -e.push({distance:u,point:h.clone().applyMatrix4(this.matrixWorld),index:g,face:null,faceIndex:null,object:this}))}}else for(g=0,r=t.length/3-1;gf||(k.applyMatrix4(this.matrixWorld),u=d.ray.origin.distanceTo(k),ud.far||e.push({distance:u,point:h.clone().applyMatrix4(this.matrixWorld),index:g,face:null,faceIndex:null,object:this}))}else if(g.isGeometry)for(l=g.vertices,m=l.length,g=0;gf||(k.applyMatrix4(this.matrixWorld),u=d.ray.origin.distanceTo(k),ud.far||e.push({distance:u,point:h.clone().applyMatrix4(this.matrixWorld),index:g,face:null,faceIndex:null,object:this}))}}}(),clone:function(){return(new this.constructor(this.geometry,this.material)).copy(this)}});V.prototype=Object.assign(Object.create(ka.prototype),{constructor:V,isLineSegments:!0,computeLineDistances:function(){var a=new n,b=new n;return function(){var c=this.geometry;if(c.isBufferGeometry)if(null=== -c.index){for(var d=c.attributes.position,e=[],f=0,g=d.count;fd.far||e.push({distance:a,distanceToRay:Math.sqrt(f),point:p.clone(),index:c,face:null,object:g}))}var g=this,h=this.geometry,l=this.matrixWorld,m=d.params.Points.threshold;null===h.boundingSphere&&h.computeBoundingSphere();c.copy(h.boundingSphere);c.applyMatrix4(l);c.radius+=m;if(!1!==d.ray.intersectsSphere(c)){a.getInverse(l); -b.copy(d.ray).applyMatrix4(a);m/=(this.scale.x+this.scale.y+this.scale.z)/3;var k=m*m;m=new n;var p=new n;if(h.isBufferGeometry){var v=h.index;h=h.attributes.position.array;if(null!==v){var t=v.array;v=0;for(var r=t.length;v=a.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}});$b.prototype=Object.create(Y.prototype);$b.prototype.constructor=$b;$b.prototype.isCompressedTexture=!0;Oc.prototype=Object.create(Y.prototype);Oc.prototype.constructor=Oc;Oc.prototype.isCanvasTexture=!0;Pc.prototype=Object.create(Y.prototype);Pc.prototype.constructor=Pc;Pc.prototype.isDepthTexture=!0;ac.prototype=Object.create(B.prototype);ac.prototype.constructor=ac;Qc.prototype= -Object.create(K.prototype);Qc.prototype.constructor=Qc;bc.prototype=Object.create(B.prototype);bc.prototype.constructor=bc;Rc.prototype=Object.create(K.prototype);Rc.prototype.constructor=Rc;la.prototype=Object.create(B.prototype);la.prototype.constructor=la;Sc.prototype=Object.create(K.prototype);Sc.prototype.constructor=Sc;cc.prototype=Object.create(la.prototype);cc.prototype.constructor=cc;Tc.prototype=Object.create(K.prototype);Tc.prototype.constructor=Tc;Bb.prototype=Object.create(la.prototype); -Bb.prototype.constructor=Bb;Uc.prototype=Object.create(K.prototype);Uc.prototype.constructor=Uc;dc.prototype=Object.create(la.prototype);dc.prototype.constructor=dc;Vc.prototype=Object.create(K.prototype);Vc.prototype.constructor=Vc;ec.prototype=Object.create(la.prototype);ec.prototype.constructor=ec;Wc.prototype=Object.create(K.prototype);Wc.prototype.constructor=Wc;Cb.prototype=Object.create(B.prototype);Cb.prototype.constructor=Cb;Cb.prototype.toJSON=function(){var a=B.prototype.toJSON.call(this); -a.path=this.parameters.path.toJSON();return a};Xc.prototype=Object.create(K.prototype);Xc.prototype.constructor=Xc;fc.prototype=Object.create(B.prototype);fc.prototype.constructor=fc;Yc.prototype=Object.create(K.prototype);Yc.prototype.constructor=Yc;gc.prototype=Object.create(B.prototype);gc.prototype.constructor=gc;var ph={triangulate:function(a,b,c){c=c||2;var d=b&&b.length,e=d?b[0]*c:a.length,f=zf(a,0,e,c,!0),g=[];if(!f)return g;var h;if(d){var l=c;d=[];var m;var k=0;for(m=b.length;k80*c){var t=h=a[0];var r=d=a[1];for(l=c;lh&&(h=k),b>d&&(d=b);h=Math.max(h-t,d-r);h=0!==h?1/h:0}ad(f,g,c,t,r,h);return g}},db={area:function(a){for(var b=a.length,c=0,d=b-1,e=0;e -db.area(a)},triangulateShape:function(a,b){var c=[],d=[],e=[];Df(a);Ef(c,a);var f=a.length;b.forEach(Df);for(a=0;aMath.abs(g-l)?[new C(a,1-c),new C(h,1-d), -new C(m,1-e),new C(p,1-b)]:[new C(g,1-c),new C(l,1-d),new C(k,1-e),new C(n,1-b)]}};cd.prototype=Object.create(K.prototype);cd.prototype.constructor=cd;hc.prototype=Object.create(Ya.prototype);hc.prototype.constructor=hc;dd.prototype=Object.create(K.prototype);dd.prototype.constructor=dd;ob.prototype=Object.create(B.prototype);ob.prototype.constructor=ob;ed.prototype=Object.create(K.prototype);ed.prototype.constructor=ed;ic.prototype=Object.create(B.prototype);ic.prototype.constructor=ic;fd.prototype= -Object.create(K.prototype);fd.prototype.constructor=fd;jc.prototype=Object.create(B.prototype);jc.prototype.constructor=jc;Fb.prototype=Object.create(K.prototype);Fb.prototype.constructor=Fb;Fb.prototype.toJSON=function(){var a=K.prototype.toJSON.call(this);return Gf(this.parameters.shapes,a)};Gb.prototype=Object.create(B.prototype);Gb.prototype.constructor=Gb;Gb.prototype.toJSON=function(){var a=B.prototype.toJSON.call(this);return Gf(this.parameters.shapes,a)};kc.prototype=Object.create(B.prototype); -kc.prototype.constructor=kc;Hb.prototype=Object.create(K.prototype);Hb.prototype.constructor=Hb;eb.prototype=Object.create(B.prototype);eb.prototype.constructor=eb;gd.prototype=Object.create(Hb.prototype);gd.prototype.constructor=gd;hd.prototype=Object.create(eb.prototype);hd.prototype.constructor=hd;id.prototype=Object.create(K.prototype);id.prototype.constructor=id;lc.prototype=Object.create(B.prototype);lc.prototype.constructor=lc;var xa=Object.freeze({WireframeGeometry:ac,ParametricGeometry:Qc, -ParametricBufferGeometry:bc,TetrahedronGeometry:Sc,TetrahedronBufferGeometry:cc,OctahedronGeometry:Tc,OctahedronBufferGeometry:Bb,IcosahedronGeometry:Uc,IcosahedronBufferGeometry:dc,DodecahedronGeometry:Vc,DodecahedronBufferGeometry:ec,PolyhedronGeometry:Rc,PolyhedronBufferGeometry:la,TubeGeometry:Wc,TubeBufferGeometry:Cb,TorusKnotGeometry:Xc,TorusKnotBufferGeometry:fc,TorusGeometry:Yc,TorusBufferGeometry:gc,TextGeometry:cd,TextBufferGeometry:hc,SphereGeometry:dd,SphereBufferGeometry:ob,RingGeometry:ed, -RingBufferGeometry:ic,PlaneGeometry:Gc,PlaneBufferGeometry:yb,LatheGeometry:fd,LatheBufferGeometry:jc,ShapeGeometry:Fb,ShapeBufferGeometry:Gb,ExtrudeGeometry:Eb,ExtrudeBufferGeometry:Ya,EdgesGeometry:kc,ConeGeometry:gd,ConeBufferGeometry:hd,CylinderGeometry:Hb,CylinderBufferGeometry:eb,CircleGeometry:id,CircleBufferGeometry:lc,BoxGeometry:Tb,BoxBufferGeometry:wb});Ib.prototype=Object.create(Q.prototype);Ib.prototype.constructor=Ib;Ib.prototype.isShadowMaterial=!0;Ib.prototype.copy=function(a){Q.prototype.copy.call(this, -a);this.color.copy(a.color);return this};mc.prototype=Object.create(ea.prototype);mc.prototype.constructor=mc;mc.prototype.isRawShaderMaterial=!0;Za.prototype=Object.create(Q.prototype);Za.prototype.constructor=Za;Za.prototype.isMeshStandardMaterial=!0;Za.prototype.copy=function(a){Q.prototype.copy.call(this,a);this.defines={STANDARD:""};this.color.copy(a.color);this.roughness=a.roughness;this.metalness=a.metalness;this.map=a.map;this.lightMap=a.lightMap;this.lightMapIntensity=a.lightMapIntensity; -this.aoMap=a.aoMap;this.aoMapIntensity=a.aoMapIntensity;this.emissive.copy(a.emissive);this.emissiveMap=a.emissiveMap;this.emissiveIntensity=a.emissiveIntensity;this.bumpMap=a.bumpMap;this.bumpScale=a.bumpScale;this.normalMap=a.normalMap;this.normalMapType=a.normalMapType;this.normalScale.copy(a.normalScale);this.displacementMap=a.displacementMap;this.displacementScale=a.displacementScale;this.displacementBias=a.displacementBias;this.roughnessMap=a.roughnessMap;this.metalnessMap=a.metalnessMap;this.alphaMap= -a.alphaMap;this.envMap=a.envMap;this.envMapIntensity=a.envMapIntensity;this.refractionRatio=a.refractionRatio;this.wireframe=a.wireframe;this.wireframeLinewidth=a.wireframeLinewidth;this.wireframeLinecap=a.wireframeLinecap;this.wireframeLinejoin=a.wireframeLinejoin;this.skinning=a.skinning;this.morphTargets=a.morphTargets;this.morphNormals=a.morphNormals;return this};Jb.prototype=Object.create(Za.prototype);Jb.prototype.constructor=Jb;Jb.prototype.isMeshPhysicalMaterial=!0;Jb.prototype.copy=function(a){Za.prototype.copy.call(this, -a);this.defines={PHYSICAL:""};this.reflectivity=a.reflectivity;this.clearCoat=a.clearCoat;this.clearCoatRoughness=a.clearCoatRoughness;return this};Ja.prototype=Object.create(Q.prototype);Ja.prototype.constructor=Ja;Ja.prototype.isMeshPhongMaterial=!0;Ja.prototype.copy=function(a){Q.prototype.copy.call(this,a);this.color.copy(a.color);this.specular.copy(a.specular);this.shininess=a.shininess;this.map=a.map;this.lightMap=a.lightMap;this.lightMapIntensity=a.lightMapIntensity;this.aoMap=a.aoMap;this.aoMapIntensity= -a.aoMapIntensity;this.emissive.copy(a.emissive);this.emissiveMap=a.emissiveMap;this.emissiveIntensity=a.emissiveIntensity;this.bumpMap=a.bumpMap;this.bumpScale=a.bumpScale;this.normalMap=a.normalMap;this.normalMapType=a.normalMapType;this.normalScale.copy(a.normalScale);this.displacementMap=a.displacementMap;this.displacementScale=a.displacementScale;this.displacementBias=a.displacementBias;this.specularMap=a.specularMap;this.alphaMap=a.alphaMap;this.envMap=a.envMap;this.combine=a.combine;this.reflectivity= -a.reflectivity;this.refractionRatio=a.refractionRatio;this.wireframe=a.wireframe;this.wireframeLinewidth=a.wireframeLinewidth;this.wireframeLinecap=a.wireframeLinecap;this.wireframeLinejoin=a.wireframeLinejoin;this.skinning=a.skinning;this.morphTargets=a.morphTargets;this.morphNormals=a.morphNormals;return this};Kb.prototype=Object.create(Ja.prototype);Kb.prototype.constructor=Kb;Kb.prototype.isMeshToonMaterial=!0;Kb.prototype.copy=function(a){Ja.prototype.copy.call(this,a);this.gradientMap=a.gradientMap; -return this};Lb.prototype=Object.create(Q.prototype);Lb.prototype.constructor=Lb;Lb.prototype.isMeshNormalMaterial=!0;Lb.prototype.copy=function(a){Q.prototype.copy.call(this,a);this.bumpMap=a.bumpMap;this.bumpScale=a.bumpScale;this.normalMap=a.normalMap;this.normalMapType=a.normalMapType;this.normalScale.copy(a.normalScale);this.displacementMap=a.displacementMap;this.displacementScale=a.displacementScale;this.displacementBias=a.displacementBias;this.wireframe=a.wireframe;this.wireframeLinewidth= -a.wireframeLinewidth;this.skinning=a.skinning;this.morphTargets=a.morphTargets;this.morphNormals=a.morphNormals;return this};Mb.prototype=Object.create(Q.prototype);Mb.prototype.constructor=Mb;Mb.prototype.isMeshLambertMaterial=!0;Mb.prototype.copy=function(a){Q.prototype.copy.call(this,a);this.color.copy(a.color);this.map=a.map;this.lightMap=a.lightMap;this.lightMapIntensity=a.lightMapIntensity;this.aoMap=a.aoMap;this.aoMapIntensity=a.aoMapIntensity;this.emissive.copy(a.emissive);this.emissiveMap= -a.emissiveMap;this.emissiveIntensity=a.emissiveIntensity;this.specularMap=a.specularMap;this.alphaMap=a.alphaMap;this.envMap=a.envMap;this.combine=a.combine;this.reflectivity=a.reflectivity;this.refractionRatio=a.refractionRatio;this.wireframe=a.wireframe;this.wireframeLinewidth=a.wireframeLinewidth;this.wireframeLinecap=a.wireframeLinecap;this.wireframeLinejoin=a.wireframeLinejoin;this.skinning=a.skinning;this.morphTargets=a.morphTargets;this.morphNormals=a.morphNormals;return this};Nb.prototype= -Object.create(Q.prototype);Nb.prototype.constructor=Nb;Nb.prototype.isMeshMatcapMaterial=!0;Nb.prototype.copy=function(a){Q.prototype.copy.call(this,a);this.defines={MATCAP:""};this.color.copy(a.color);this.matcap=a.matcap;this.map=a.map;this.bumpMap=a.bumpMap;this.bumpScale=a.bumpScale;this.normalMap=a.normalMap;this.normalMapType=a.normalMapType;this.normalScale.copy(a.normalScale);this.displacementMap=a.displacementMap;this.displacementScale=a.displacementScale;this.displacementBias=a.displacementBias; -this.alphaMap=a.alphaMap;this.skinning=a.skinning;this.morphTargets=a.morphTargets;this.morphNormals=a.morphNormals;return this};Ob.prototype=Object.create(U.prototype);Ob.prototype.constructor=Ob;Ob.prototype.isLineDashedMaterial=!0;Ob.prototype.copy=function(a){U.prototype.copy.call(this,a);this.scale=a.scale;this.dashSize=a.dashSize;this.gapSize=a.gapSize;return this};var qh=Object.freeze({ShadowMaterial:Ib,SpriteMaterial:nb,RawShaderMaterial:mc,ShaderMaterial:ea,PointsMaterial:Ia,MeshPhysicalMaterial:Jb, -MeshStandardMaterial:Za,MeshPhongMaterial:Ja,MeshToonMaterial:Kb,MeshNormalMaterial:Lb,MeshLambertMaterial:Mb,MeshDepthMaterial:jb,MeshDistanceMaterial:kb,MeshBasicMaterial:Ca,MeshMatcapMaterial:Nb,LineDashedMaterial:Ob,LineBasicMaterial:U,Material:Q}),ba={arraySlice:function(a,b,c){return ba.isTypedArray(a)?new a.constructor(a.subarray(b,void 0!==c?c:a.length)):a.slice(b,c)},convertArray:function(a,b,c){return!a||!c&&a.constructor===b?a:"number"===typeof b.BYTES_PER_ELEMENT?new b(a):Array.prototype.slice.call(a)}, -isTypedArray:function(a){return ArrayBuffer.isView(a)&&!(a instanceof DataView)},getKeyframeOrder:function(a){for(var b=a.length,c=Array(b),d=0;d!==b;++d)c[d]=d;c.sort(function(b,c){return a[b]-a[c]});return c},sortedArray:function(a,b,c){for(var d=a.length,e=new a.constructor(d),f=0,g=0;g!==d;++f)for(var h=c[f]*b,l=0;l!==b;++l)e[g++]=a[h+l];return e},flattenJSON:function(a,b,c,d){for(var e=1,f=a[0];void 0!==f&&void 0===f[d];)f=a[e++];if(void 0!==f){var g=f[d];if(void 0!==g)if(Array.isArray(g)){do g= -f[d],void 0!==g&&(b.push(f.time),c.push.apply(c,g)),f=a[e++];while(void 0!==f)}else if(void 0!==g.toArray){do g=f[d],void 0!==g&&(b.push(f.time),g.toArray(c,c.length)),f=a[e++];while(void 0!==f)}else{do g=f[d],void 0!==g&&(b.push(f.time),c.push(g)),f=a[e++];while(void 0!==f)}}}};Object.assign(Da.prototype,{evaluate:function(a){var b=this.parameterPositions,c=this._cachedIndex,d=b[c],e=b[c-1];a:{b:{c:{d:if(!(a=e)break a;else{f=b[1];a=e)break b}d=c;c=0}}for(;c>>1,ab;)--f;++f;if(0!==e||f!==d)e>=f&&(f=Math.max(f,1),e=f-1),a=this.getValueSize(),this.times=ba.arraySlice(c,e,f),this.values=ba.arraySlice(this.values,e*a,f*a);return this},validate:function(){var a=!0,b=this.getValueSize();0!==b-Math.floor(b)&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),a=!1);var c=this.times;b=this.values;var d=c.length;0===d&&(console.error("THREE.KeyframeTrack: Track is empty.", -this),a=!1);for(var e=null,f=0;f!==d;f++){var g=c[f];if("number"===typeof g&&isNaN(g)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,f,g);a=!1;break}if(null!==e&&e>g){console.error("THREE.KeyframeTrack: Out of order keys.",this,f,g,e);a=!1;break}e=g}if(void 0!==b&&ba.isTypedArray(b))for(f=0,c=b.length;f!==c;++f)if(d=b[f],isNaN(d)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,f,d);a=!1;break}return a},optimize:function(){for(var a=this.times,b=this.values, -c=this.getValueSize(),d=2302===this.getInterpolation(),e=1,f=a.length-1,g=1;g=d[e].distance)d[e-1].object.visible=!1,d[e].object.visible=!0;else break;for(;ef||(l.applyMatrix4(this.matrixWorld), +u=d.ray.origin.distanceTo(l),ud.far||e.push({distance:u,point:h.clone().applyMatrix4(this.matrixWorld),index:g,face:null,faceIndex:null,object:this}))}}else for(g=0,r=t.length/3-1;gf||(l.applyMatrix4(this.matrixWorld),u=d.ray.origin.distanceTo(l),ud.far||e.push({distance:u,point:h.clone().applyMatrix4(this.matrixWorld),index:g,face:null,faceIndex:null,object:this}))}else if(g.isGeometry)for(k= +g.vertices,m=k.length,g=0;gf||(l.applyMatrix4(this.matrixWorld),u=d.ray.origin.distanceTo(l),ud.far||e.push({distance:u,point:h.clone().applyMatrix4(this.matrixWorld),index:g,face:null,faceIndex:null,object:this}))}}}(),clone:function(){return(new this.constructor(this.geometry,this.material)).copy(this)}});S.prototype=Object.assign(Object.create(T.prototype),{constructor:S,isLineSegments:!0,computeLineDistances:function(){var a=new n, +b=new n;return function(){var c=this.geometry;if(c.isBufferGeometry)if(null===c.index){for(var d=c.attributes.position,e=[],f=0,g=d.count;fd.far||e.push({distance:a,distanceToRay:Math.sqrt(f),point:p.clone(),index:c,face:null,object:g}))}var g=this,h=this.geometry,k=this.matrixWorld,m=d.params.Points.threshold;null===h.boundingSphere&&h.computeBoundingSphere();c.copy(h.boundingSphere);c.applyMatrix4(k); +c.radius+=m;if(!1!==d.ray.intersectsSphere(c)){a.getInverse(k);b.copy(d.ray).applyMatrix4(a);m/=(this.scale.x+this.scale.y+this.scale.z)/3;var l=m*m;m=new n;var p=new n;if(h.isBufferGeometry){var v=h.index;h=h.attributes.position.array;if(null!==v){var t=v.array;v=0;for(var r=t.length;v=a.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}});ac.prototype=Object.create(X.prototype);ac.prototype.constructor=ac;ac.prototype.isCompressedTexture=!0;Qc.prototype=Object.create(X.prototype);Qc.prototype.constructor=Qc;Qc.prototype.isCanvasTexture=!0;Rc.prototype=Object.create(X.prototype);Rc.prototype.constructor=Rc;Rc.prototype.isDepthTexture= +!0;bc.prototype=Object.create(E.prototype);bc.prototype.constructor=bc;Sc.prototype=Object.create(Q.prototype);Sc.prototype.constructor=Sc;cc.prototype=Object.create(E.prototype);cc.prototype.constructor=cc;Tc.prototype=Object.create(Q.prototype);Tc.prototype.constructor=Tc;oa.prototype=Object.create(E.prototype);oa.prototype.constructor=oa;Uc.prototype=Object.create(Q.prototype);Uc.prototype.constructor=Uc;dc.prototype=Object.create(oa.prototype);dc.prototype.constructor=dc;Vc.prototype=Object.create(Q.prototype); +Vc.prototype.constructor=Vc;Cb.prototype=Object.create(oa.prototype);Cb.prototype.constructor=Cb;Wc.prototype=Object.create(Q.prototype);Wc.prototype.constructor=Wc;ec.prototype=Object.create(oa.prototype);ec.prototype.constructor=ec;Xc.prototype=Object.create(Q.prototype);Xc.prototype.constructor=Xc;fc.prototype=Object.create(oa.prototype);fc.prototype.constructor=fc;Yc.prototype=Object.create(Q.prototype);Yc.prototype.constructor=Yc;Db.prototype=Object.create(E.prototype);Db.prototype.constructor= +Db;Db.prototype.toJSON=function(){var a=E.prototype.toJSON.call(this);a.path=this.parameters.path.toJSON();return a};Zc.prototype=Object.create(Q.prototype);Zc.prototype.constructor=Zc;gc.prototype=Object.create(E.prototype);gc.prototype.constructor=gc;$c.prototype=Object.create(Q.prototype);$c.prototype.constructor=$c;hc.prototype=Object.create(E.prototype);hc.prototype.constructor=hc;var uh={triangulate:function(a,b,c){c=c||2;var d=b&&b.length,e=d?b[0]*c:a.length,f=yf(a,0,e,c,!0),g=[];if(!f)return g; +var h;if(d){var k=c;d=[];var m;var l=0;for(m=b.length;l80*c){var t=h=a[0];var r=d=a[1];for(k=c;kh&&(h=l),b>d&&(d=b);h=Math.max(h-t,d-r);h=0!==h?1/h:0}cd(f,g,c,t,r,h);return g}},db={area:function(a){for(var b=a.length,c=0,d=b-1,e=0;edb.area(a)},triangulateShape:function(a,b){var c=[],d=[],e=[];Cf(a);Df(c,a);var f=a.length;b.forEach(Cf);for(a=0;aMath.abs(g-k)?[new D(a,1-c),new D(h,1-d),new D(m,1-e),new D(p,1-b)]:[new D(g,1-c),new D(k,1-d),new D(l,1-e),new D(n,1-b)]}};ed.prototype=Object.create(Q.prototype);ed.prototype.constructor=ed;ic.prototype=Object.create(Ya.prototype);ic.prototype.constructor=ic;fd.prototype=Object.create(Q.prototype);fd.prototype.constructor=fd;ob.prototype=Object.create(E.prototype);ob.prototype.constructor=ob;gd.prototype=Object.create(Q.prototype);gd.prototype.constructor=gd;jc.prototype= +Object.create(E.prototype);jc.prototype.constructor=jc;hd.prototype=Object.create(Q.prototype);hd.prototype.constructor=hd;kc.prototype=Object.create(E.prototype);kc.prototype.constructor=kc;Gb.prototype=Object.create(Q.prototype);Gb.prototype.constructor=Gb;Gb.prototype.toJSON=function(){var a=Q.prototype.toJSON.call(this);return Ff(this.parameters.shapes,a)};Hb.prototype=Object.create(E.prototype);Hb.prototype.constructor=Hb;Hb.prototype.toJSON=function(){var a=E.prototype.toJSON.call(this);return Ff(this.parameters.shapes, +a)};lc.prototype=Object.create(E.prototype);lc.prototype.constructor=lc;Ib.prototype=Object.create(Q.prototype);Ib.prototype.constructor=Ib;eb.prototype=Object.create(E.prototype);eb.prototype.constructor=eb;id.prototype=Object.create(Ib.prototype);id.prototype.constructor=id;jd.prototype=Object.create(eb.prototype);jd.prototype.constructor=jd;kd.prototype=Object.create(Q.prototype);kd.prototype.constructor=kd;mc.prototype=Object.create(E.prototype);mc.prototype.constructor=mc;var pa=Object.freeze({WireframeGeometry:bc, +ParametricGeometry:Sc,ParametricBufferGeometry:cc,TetrahedronGeometry:Uc,TetrahedronBufferGeometry:dc,OctahedronGeometry:Vc,OctahedronBufferGeometry:Cb,IcosahedronGeometry:Wc,IcosahedronBufferGeometry:ec,DodecahedronGeometry:Xc,DodecahedronBufferGeometry:fc,PolyhedronGeometry:Tc,PolyhedronBufferGeometry:oa,TubeGeometry:Yc,TubeBufferGeometry:Db,TorusKnotGeometry:Zc,TorusKnotBufferGeometry:gc,TorusGeometry:$c,TorusBufferGeometry:hc,TextGeometry:ed,TextBufferGeometry:ic,SphereGeometry:fd,SphereBufferGeometry:ob, +RingGeometry:gd,RingBufferGeometry:jc,PlaneGeometry:Ic,PlaneBufferGeometry:zb,LatheGeometry:hd,LatheBufferGeometry:kc,ShapeGeometry:Gb,ShapeBufferGeometry:Hb,ExtrudeGeometry:Fb,ExtrudeBufferGeometry:Ya,EdgesGeometry:lc,ConeGeometry:id,ConeBufferGeometry:jd,CylinderGeometry:Ib,CylinderBufferGeometry:eb,CircleGeometry:kd,CircleBufferGeometry:mc,BoxGeometry:Ub,BoxBufferGeometry:wb});Jb.prototype=Object.create(L.prototype);Jb.prototype.constructor=Jb;Jb.prototype.isShadowMaterial=!0;Jb.prototype.copy= +function(a){L.prototype.copy.call(this,a);this.color.copy(a.color);return this};nc.prototype=Object.create(sa.prototype);nc.prototype.constructor=nc;nc.prototype.isRawShaderMaterial=!0;Za.prototype=Object.create(L.prototype);Za.prototype.constructor=Za;Za.prototype.isMeshStandardMaterial=!0;Za.prototype.copy=function(a){L.prototype.copy.call(this,a);this.defines={STANDARD:""};this.color.copy(a.color);this.roughness=a.roughness;this.metalness=a.metalness;this.map=a.map;this.lightMap=a.lightMap;this.lightMapIntensity= +a.lightMapIntensity;this.aoMap=a.aoMap;this.aoMapIntensity=a.aoMapIntensity;this.emissive.copy(a.emissive);this.emissiveMap=a.emissiveMap;this.emissiveIntensity=a.emissiveIntensity;this.bumpMap=a.bumpMap;this.bumpScale=a.bumpScale;this.normalMap=a.normalMap;this.normalMapType=a.normalMapType;this.normalScale.copy(a.normalScale);this.displacementMap=a.displacementMap;this.displacementScale=a.displacementScale;this.displacementBias=a.displacementBias;this.roughnessMap=a.roughnessMap;this.metalnessMap= +a.metalnessMap;this.alphaMap=a.alphaMap;this.envMap=a.envMap;this.envMapIntensity=a.envMapIntensity;this.refractionRatio=a.refractionRatio;this.wireframe=a.wireframe;this.wireframeLinewidth=a.wireframeLinewidth;this.wireframeLinecap=a.wireframeLinecap;this.wireframeLinejoin=a.wireframeLinejoin;this.skinning=a.skinning;this.morphTargets=a.morphTargets;this.morphNormals=a.morphNormals;return this};Kb.prototype=Object.create(Za.prototype);Kb.prototype.constructor=Kb;Kb.prototype.isMeshPhysicalMaterial= +!0;Kb.prototype.copy=function(a){Za.prototype.copy.call(this,a);this.defines={PHYSICAL:""};this.reflectivity=a.reflectivity;this.clearCoat=a.clearCoat;this.clearCoatRoughness=a.clearCoatRoughness;return this};Ka.prototype=Object.create(L.prototype);Ka.prototype.constructor=Ka;Ka.prototype.isMeshPhongMaterial=!0;Ka.prototype.copy=function(a){L.prototype.copy.call(this,a);this.color.copy(a.color);this.specular.copy(a.specular);this.shininess=a.shininess;this.map=a.map;this.lightMap=a.lightMap;this.lightMapIntensity= +a.lightMapIntensity;this.aoMap=a.aoMap;this.aoMapIntensity=a.aoMapIntensity;this.emissive.copy(a.emissive);this.emissiveMap=a.emissiveMap;this.emissiveIntensity=a.emissiveIntensity;this.bumpMap=a.bumpMap;this.bumpScale=a.bumpScale;this.normalMap=a.normalMap;this.normalMapType=a.normalMapType;this.normalScale.copy(a.normalScale);this.displacementMap=a.displacementMap;this.displacementScale=a.displacementScale;this.displacementBias=a.displacementBias;this.specularMap=a.specularMap;this.alphaMap=a.alphaMap; +this.envMap=a.envMap;this.combine=a.combine;this.reflectivity=a.reflectivity;this.refractionRatio=a.refractionRatio;this.wireframe=a.wireframe;this.wireframeLinewidth=a.wireframeLinewidth;this.wireframeLinecap=a.wireframeLinecap;this.wireframeLinejoin=a.wireframeLinejoin;this.skinning=a.skinning;this.morphTargets=a.morphTargets;this.morphNormals=a.morphNormals;return this};Lb.prototype=Object.create(Ka.prototype);Lb.prototype.constructor=Lb;Lb.prototype.isMeshToonMaterial=!0;Lb.prototype.copy=function(a){Ka.prototype.copy.call(this, +a);this.gradientMap=a.gradientMap;return this};Mb.prototype=Object.create(L.prototype);Mb.prototype.constructor=Mb;Mb.prototype.isMeshNormalMaterial=!0;Mb.prototype.copy=function(a){L.prototype.copy.call(this,a);this.bumpMap=a.bumpMap;this.bumpScale=a.bumpScale;this.normalMap=a.normalMap;this.normalMapType=a.normalMapType;this.normalScale.copy(a.normalScale);this.displacementMap=a.displacementMap;this.displacementScale=a.displacementScale;this.displacementBias=a.displacementBias;this.wireframe=a.wireframe; +this.wireframeLinewidth=a.wireframeLinewidth;this.skinning=a.skinning;this.morphTargets=a.morphTargets;this.morphNormals=a.morphNormals;return this};Nb.prototype=Object.create(L.prototype);Nb.prototype.constructor=Nb;Nb.prototype.isMeshLambertMaterial=!0;Nb.prototype.copy=function(a){L.prototype.copy.call(this,a);this.color.copy(a.color);this.map=a.map;this.lightMap=a.lightMap;this.lightMapIntensity=a.lightMapIntensity;this.aoMap=a.aoMap;this.aoMapIntensity=a.aoMapIntensity;this.emissive.copy(a.emissive); +this.emissiveMap=a.emissiveMap;this.emissiveIntensity=a.emissiveIntensity;this.specularMap=a.specularMap;this.alphaMap=a.alphaMap;this.envMap=a.envMap;this.combine=a.combine;this.reflectivity=a.reflectivity;this.refractionRatio=a.refractionRatio;this.wireframe=a.wireframe;this.wireframeLinewidth=a.wireframeLinewidth;this.wireframeLinecap=a.wireframeLinecap;this.wireframeLinejoin=a.wireframeLinejoin;this.skinning=a.skinning;this.morphTargets=a.morphTargets;this.morphNormals=a.morphNormals;return this}; +Ob.prototype=Object.create(L.prototype);Ob.prototype.constructor=Ob;Ob.prototype.isMeshMatcapMaterial=!0;Ob.prototype.copy=function(a){L.prototype.copy.call(this,a);this.defines={MATCAP:""};this.color.copy(a.color);this.matcap=a.matcap;this.map=a.map;this.bumpMap=a.bumpMap;this.bumpScale=a.bumpScale;this.normalMap=a.normalMap;this.normalMapType=a.normalMapType;this.normalScale.copy(a.normalScale);this.displacementMap=a.displacementMap;this.displacementScale=a.displacementScale;this.displacementBias= +a.displacementBias;this.alphaMap=a.alphaMap;this.skinning=a.skinning;this.morphTargets=a.morphTargets;this.morphNormals=a.morphNormals;return this};Pb.prototype=Object.create(V.prototype);Pb.prototype.constructor=Pb;Pb.prototype.isLineDashedMaterial=!0;Pb.prototype.copy=function(a){V.prototype.copy.call(this,a);this.scale=a.scale;this.dashSize=a.dashSize;this.gapSize=a.gapSize;return this};var vh=Object.freeze({ShadowMaterial:Jb,SpriteMaterial:nb,RawShaderMaterial:nc,ShaderMaterial:sa,PointsMaterial:Ja, +MeshPhysicalMaterial:Kb,MeshStandardMaterial:Za,MeshPhongMaterial:Ka,MeshToonMaterial:Lb,MeshNormalMaterial:Mb,MeshLambertMaterial:Nb,MeshDepthMaterial:kb,MeshDistanceMaterial:lb,MeshBasicMaterial:ka,MeshMatcapMaterial:Ob,LineDashedMaterial:Pb,LineBasicMaterial:V,Material:L}),ra={arraySlice:function(a,b,c){return ra.isTypedArray(a)?new a.constructor(a.subarray(b,void 0!==c?c:a.length)):a.slice(b,c)},convertArray:function(a,b,c){return!a||!c&&a.constructor===b?a:"number"===typeof b.BYTES_PER_ELEMENT? +new b(a):Array.prototype.slice.call(a)},isTypedArray:function(a){return ArrayBuffer.isView(a)&&!(a instanceof DataView)},getKeyframeOrder:function(a){for(var b=a.length,c=Array(b),d=0;d!==b;++d)c[d]=d;c.sort(function(b,c){return a[b]-a[c]});return c},sortedArray:function(a,b,c){for(var d=a.length,e=new a.constructor(d),f=0,g=0;g!==d;++f)for(var h=c[f]*b,k=0;k!==b;++k)e[g++]=a[h+k];return e},flattenJSON:function(a,b,c,d){for(var e=1,f=a[0];void 0!==f&&void 0===f[d];)f=a[e++];if(void 0!==f){var g=f[d]; +if(void 0!==g)if(Array.isArray(g)){do g=f[d],void 0!==g&&(b.push(f.time),c.push.apply(c,g)),f=a[e++];while(void 0!==f)}else if(void 0!==g.toArray){do g=f[d],void 0!==g&&(b.push(f.time),g.toArray(c,c.length)),f=a[e++];while(void 0!==f)}else{do g=f[d],void 0!==g&&(b.push(f.time),c.push(g)),f=a[e++];while(void 0!==f)}}}};Object.assign(Da.prototype,{evaluate:function(a){var b=this.parameterPositions,c=this._cachedIndex,d=b[c],e=b[c-1];a:{b:{c:{d:if(!(a=e)break a;else{f=b[1];a=e)break b}d=c;c=0}}for(;c>>1,ab;)--f;++f;if(0!==e||f!==d)e>=f&&(f=Math.max(f,1),e=f-1),a=this.getValueSize(),this.times=ra.arraySlice(c,e,f),this.values=ra.arraySlice(this.values,e*a,f*a);return this},validate:function(){var a=!0,b=this.getValueSize();0!==b-Math.floor(b)&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),a=!1);var c=this.times;b=this.values;var d=c.length;0===d&&(console.error("THREE.KeyframeTrack: Track is empty.", +this),a=!1);for(var e=null,f=0;f!==d;f++){var g=c[f];if("number"===typeof g&&isNaN(g)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,f,g);a=!1;break}if(null!==e&&e>g){console.error("THREE.KeyframeTrack: Out of order keys.",this,f,g,e);a=!1;break}e=g}if(void 0!==b&&ra.isTypedArray(b))for(f=0,c=b.length;f!==c;++f)if(d=b[f],isNaN(d)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,f,d);a=!1;break}return a},optimize:function(){for(var a=this.times,b=this.values, +c=this.getValueSize(),d=2302===this.getInterpolation(),e=1,f=a.length-1,g=1;gg)e=a+1;else if(0b&&(b=0);1Number.EPSILON&&(g.normalize(),c=Math.acos(O.clamp(d[l-1].dot(d[l]),-1,1)),e[l].applyMatrix4(h.makeRotationAxis(g,c))),f[l].crossVectors(d[l],e[l]);if(!0===b)for(c=Math.acos(O.clamp(e[0].dot(e[a]),-1,1)),c/=a,0d;)d+=c;for(;d>c;)d-=c;de&&(e=1);1E-4>d&&(d=e);1E-4>l&&(l=e);Pe.initNonuniformCatmullRom(f.x,g.x,h.x,c.x,d,e,l);Qe.initNonuniformCatmullRom(f.y,g.y,h.y,c.y,d,e,l);Re.initNonuniformCatmullRom(f.z,g.z,h.z,c.z,d,e,l)}else"catmullrom"===this.curveType&&(Pe.initCatmullRom(f.x,g.x,h.x,c.x,this.tension),Qe.initCatmullRom(f.y,g.y,h.y,c.y,this.tension),Re.initCatmullRom(f.z,g.z,h.z,c.z,this.tension));b.set(Pe.calc(a), -Qe.calc(a),Re.calc(a));return b};oa.prototype.copy=function(a){M.prototype.copy.call(this,a);this.points=[];for(var b=0,c=a.points.length;bc.length-2?c.length-1:a+1];c=c[a>c.length-3?c.length-1:a+2];b.set(Jf(d,e.x,f.x,g.x,c.x),Jf(d,e.y,f.y,g.y,c.y));return b};Oa.prototype.copy=function(a){M.prototype.copy.call(this,a);this.points=[];for(var b=0,c=a.points.length;b=b)return b=c[a]-b,a=this.curves[a],c=a.getLength(),a.getPointAt(0===c?0:1-b/c);a++}return null},getLength:function(){var a=this.getCurveLengths(); +a-1E-4;a+=1E-4;0>b&&(b=0);1Number.EPSILON&&(g.normalize(),c=Math.acos(P.clamp(d[k-1].dot(d[k]),-1,1)),e[k].applyMatrix4(h.makeRotationAxis(g,c))),f[k].crossVectors(d[k],e[k]);if(!0===b)for(c=Math.acos(P.clamp(e[0].dot(e[a]),-1,1)),c/=a,0d;)d+=c;for(;d>c;)d-=c;de&&(e=1);1E-4>d&&(d=e);1E-4>k&&(k=e);Re.initNonuniformCatmullRom(f.x,g.x,h.x,c.x,d,e,k);Se.initNonuniformCatmullRom(f.y,g.y,h.y,c.y,d,e,k);Te.initNonuniformCatmullRom(f.z,g.z,h.z,c.z,d,e,k)}else"catmullrom"===this.curveType&&(Re.initCatmullRom(f.x,g.x,h.x,c.x,this.tension),Se.initCatmullRom(f.y,g.y,h.y,c.y,this.tension),Te.initCatmullRom(f.z,g.z,h.z,c.z,this.tension));b.set(Re.calc(a), +Se.calc(a),Te.calc(a));return b};ua.prototype.copy=function(a){N.prototype.copy.call(this,a);this.points=[];for(var b=0,c=a.points.length;bc.length-2?c.length-1:a+1];c=c[a>c.length-3?c.length-1:a+2];b.set(If(d,e.x,f.x,g.x,c.x),If(d,e.y,f.y,g.y,c.y));return b};Pa.prototype.copy=function(a){N.prototype.copy.call(this,a);this.points=[];for(var b=0,c=a.points.length;b=b)return b=c[a]-b,a=this.curves[a],c=a.getLength(),a.getPointAt(0===c?0:1-b/c);a++}return null},getLength:function(){var a=this.getCurveLengths(); return a[a.length-1]},updateArcLengths:function(){this.needsUpdate=!0;this.cacheLengths=null;this.getCurveLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var a=[],b=0,c=0,d=this.curves.length;cNumber.EPSILON){if(0>k&&(g=b[f],l=-l,h=b[e],k=-k),!(a.yh.y))if(a.y===g.y){if(a.x===g.x)return!0}else{e=k*(a.x-g.x)-l*(a.y-g.y);if(0===e)return!0;0>e||(d=!d)}}else if(a.y===g.y&&(h.x<=a.x&&a.x<=g.x||g.x<=a.x&&a.x<=h.x))return!0}return d}var e=db.isClockWise,f=this.subPaths;if(0===f.length)return[];if(!0===b)return c(f);b=[];if(1===f.length){var g=f[0];var h=new pb;h.curves=g.curves; -b.push(h);return b}var l=!e(f[0].getPoints());l=a?!l:l;h=[];var k=[],n=[],p=0;k[p]=void 0;n[p]=[];for(var v=0,t=f.length;vk.opacity&&(k.transparent=!0);d.setTextures(l);return d.parse(k)}}()});var be,Ce={getContext:function(){void 0===be&&(be=new (window.AudioContext||window.webkitAudioContext));return be},setContext:function(a){be=a}};Object.assign(xe.prototype,{load:function(a,b,c,d){var e=new Ka(this.manager);e.setResponseType("arraybuffer");e.setPath(this.path);e.load(a,function(a){a=a.slice(0);Ce.getContext().decodeAudioData(a,function(a){b(a)})},c,d)},setPath:function(a){this.path=a; -return this}});Object.assign(Wd.prototype,{isSphericalHarmonics3:!0,set:function(a){for(var b=0;9>b;b++)this.coefficients[b].copy(a[b]);return this},zero:function(){for(var a=0;9>a;a++)this.coefficients[a].set(0,0,0);return this},getAt:function(a,b){var c=a.x,d=a.y;a=a.z;var e=this.coefficients;b=.282095*e[0];b+=.488603*e[1]*d;b+=.488603*e[2]*a;b+=.488603*e[3]*c;b+=1.092548*e[4]*c*d;b+=1.092548*e[5]*d*a;b+=.315392*e[6]*(3*a*a-1);b+=1.092548*e[7]*c*a;return b+=.546274*e[8]*(c*c-d*d)},getIrradianceAt:function(a, -b){var c=a.x,d=a.y;a=a.z;var e=this.coefficients;b=.886227*e[0];b+=1.023328*e[1]*d;b+=1.023328*e[2]*a;b+=1.023328*e[3]*c;b+=.858086*e[4]*c*d;b+=.858086*e[5]*d*a;b+=e[6]*(.743125*a*a-.247708);b+=.858086*e[7]*c*a;return b+=.429043*e[8]*(c*c-d*d)},add:function(a){for(var b=0;9>b;b++)this.coefficients[b].add(a.coefficients[b]);return this},scale:function(a){for(var b=0;9>b;b++)this.coefficients[b].multiplyScalar(a);return this},lerp:function(a,b){for(var c=0;9>c;c++)this.coefficients[c].lerp(a.coefficients[c], -b);return this},equals:function(a){for(var b=0;9>b;b++)if(!this.coefficients[b].equals(a.coefficients[b]))return!1;return!0},copy:function(a){return this.set(a.coefficients)},clone:function(){return(new this.constructor).copy(this)},fromArray:function(a){for(var b=this.coefficients,c=0;9>c;c++)b[c].fromArray(a,3*c);return this},toArray:function(){for(var a=[],b=this.coefficients,c=0;9>c;c++)b[c].toArray(a,3*c);return a}});Object.assign(Wd,{getBasisAt:function(a,b){var c=a.x,d=a.y;a=a.z;b[0]=.282095; -b[1]=.488603*d;b[2]=.488603*a;b[3]=.488603*c;b[4]=1.092548*c*d;b[5]=1.092548*d*a;b[6]=.315392*(3*a*a-1);b[7]=1.092548*c*a;b[8]=.546274*(c*c-d*d)}});Qa.prototype=Object.assign(Object.create(T.prototype),{constructor:Qa,isLightProbe:!0,copy:function(a){T.prototype.copy.call(this,a);this.sh.copy(a.sh);this.intensity=a.intensity;return this},toJSON:function(a){return T.prototype.toJSON.call(this,a)}});ye.prototype=Object.assign(Object.create(Qa.prototype),{constructor:ye,isHemisphereLightProbe:!0,copy:function(a){Qa.prototype.copy.call(this, -a);return this},toJSON:function(a){return Qa.prototype.toJSON.call(this,a)}});ze.prototype=Object.assign(Object.create(Qa.prototype),{constructor:ze,isAmbientLightProbe:!0,copy:function(a){Qa.prototype.copy.call(this,a);return this},toJSON:function(a){return Qa.prototype.toJSON.call(this,a)}});Object.assign(Lf.prototype,{update:function(){var a,b,c,d,e,f,g,h,l=new P,k=new P;return function(m){if(a!==this||b!==m.focus||c!==m.fov||d!==m.aspect*this.aspect||e!==m.near||f!==m.far||g!==m.zoom||h!==this.eyeSep){a= -this;b=m.focus;c=m.fov;d=m.aspect*this.aspect;e=m.near;f=m.far;g=m.zoom;var n=m.projectionMatrix.clone();h=this.eyeSep/2;var q=h*e/b,t=e*Math.tan(O.DEG2RAD*c*.5)/g;k.elements[12]=-h;l.elements[12]=h;var r=-t*d+q;var u=t*d+q;n.elements[0]=2*e/(u-r);n.elements[8]=(u+r)/(u-r);this.cameraL.projectionMatrix.copy(n);r=-t*d-q;u=t*d-q;n.elements[0]=2*e/(u-r);n.elements[8]=(u+r)/(u-r);this.cameraR.projectionMatrix.copy(n)}this.cameraL.matrixWorld.copy(m.matrixWorld).multiply(k);this.cameraR.matrixWorld.copy(m.matrixWorld).multiply(l)}}()}); -qd.prototype=Object.create(D.prototype);qd.prototype.constructor=qd;Object.assign(Ae.prototype,{start:function(){this.oldTime=this.startTime=("undefined"===typeof performance?Date:performance).now();this.elapsedTime=0;this.running=!0},stop:function(){this.getElapsedTime();this.autoStart=this.running=!1},getElapsedTime:function(){this.getDelta();return this.elapsedTime},getDelta:function(){var a=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){var b=("undefined"===typeof performance? -Date:performance).now();a=(b-this.oldTime)/1E3;this.oldTime=b;this.elapsedTime+=a}return a}});Be.prototype=Object.assign(Object.create(D.prototype),{constructor:Be,getInput:function(){return this.gain},removeFilter:function(){null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null);return this},getFilter:function(){return this.filter},setFilter:function(a){null!==this.filter?(this.gain.disconnect(this.filter), -this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination);this.filter=a;this.gain.connect(this.filter);this.filter.connect(this.context.destination);return this},getMasterVolume:function(){return this.gain.gain.value},setMasterVolume:function(a){this.gain.gain.setTargetAtTime(a,this.context.currentTime,.01);return this},updateMatrixWorld:function(){var a=new n,b=new ma,c=new n,d=new n,e=new Ae;return function(f){D.prototype.updateMatrixWorld.call(this,f);f=this.context.listener; -var g=this.up;this.timeDelta=e.getDelta();this.matrixWorld.decompose(a,b,c);d.set(0,0,-1).applyQuaternion(b);if(f.positionX){var h=this.context.currentTime+this.timeDelta;f.positionX.linearRampToValueAtTime(a.x,h);f.positionY.linearRampToValueAtTime(a.y,h);f.positionZ.linearRampToValueAtTime(a.z,h);f.forwardX.linearRampToValueAtTime(d.x,h);f.forwardY.linearRampToValueAtTime(d.y,h);f.forwardZ.linearRampToValueAtTime(d.z,h);f.upX.linearRampToValueAtTime(g.x,h);f.upY.linearRampToValueAtTime(g.y,h);f.upZ.linearRampToValueAtTime(g.z, -h)}else f.setPosition(a.x,a.y,a.z),f.setOrientation(d.x,d.y,d.z,g.x,g.y,g.z)}}()});qc.prototype=Object.assign(Object.create(D.prototype),{constructor:qc,getOutput:function(){return this.gain},setNodeSource:function(a){this.hasPlaybackControl=!1;this.sourceType="audioNode";this.source=a;this.connect();return this},setMediaElementSource:function(a){this.hasPlaybackControl=!1;this.sourceType="mediaNode";this.source=this.context.createMediaElementSource(a);this.connect();return this},setBuffer:function(a){this.buffer= -a;this.sourceType="buffer";this.autoplay&&this.play();return this},play:function(){if(!0===this.isPlaying)console.warn("THREE.Audio: Audio is already playing.");else if(!1===this.hasPlaybackControl)console.warn("THREE.Audio: this Audio has no playback control.");else{var a=this.context.createBufferSource();a.buffer=this.buffer;a.loop=this.loop;a.onended=this.onEnded.bind(this);this.startTime=this.context.currentTime;a.start(this.startTime,this.offset);this.isPlaying=!0;this.source=a;this.setDetune(this.detune); -this.setPlaybackRate(this.playbackRate);return this.connect()}},pause:function(){if(!1===this.hasPlaybackControl)console.warn("THREE.Audio: this Audio has no playback control.");else return!0===this.isPlaying&&(this.source.stop(),this.source.onended=null,this.offset+=(this.context.currentTime-this.startTime)*this.playbackRate,this.isPlaying=!1),this},stop:function(){if(!1===this.hasPlaybackControl)console.warn("THREE.Audio: this Audio has no playback control.");else return this.source.stop(),this.source.onended= -null,this.offset=0,this.isPlaying=!1,this},connect:function(){if(0d&&this._mixBufferRegion(c,a,3*b,1-d,b);d=b;for(var f=b+b;d!==f;++d)if(c[d]!==c[d+b]){e.setValue(c,a);break}}, -saveOriginalState:function(){var a=this.buffer,b=this.valueSize,c=3*b;this.binding.getValue(a,c);for(var d=b;d!==c;++d)a[d]=a[c+d%b];this.cumulativeWeight=0},restoreOriginalState:function(){this.binding.setValue(this.buffer,3*this.valueSize)},_select:function(a,b,c,d,e){if(.5<=d)for(d=0;d!==e;++d)a[b+d]=a[c+d]},_slerp:function(a,b,c,d){ma.slerpFlat(a,b,a,b,a,c,d)},_lerp:function(a,b,c,d,e){for(var f=1-d,g=0;g!==e;++g){var h=b+g;a[h]=a[h]*f+a[c+g]*d}}});Object.assign(Mf.prototype,{getValue:function(a, -b){this.bind();var c=this._bindings[this._targetGroup.nCachedObjects_];void 0!==c&&c.getValue(a,b)},setValue:function(a,b){for(var c=this._bindings,d=this._targetGroup.nCachedObjects_,e=c.length;d!==e;++d)c[d].setValue(a,b)},bind:function(){for(var a=this._bindings,b=this._targetGroup.nCachedObjects_,c=a.length;b!==c;++b)a[b].bind()},unbind:function(){for(var a=this._bindings,b=this._targetGroup.nCachedObjects_,c=a.length;b!==c;++b)a[b].unbind()}});Object.assign(ia,{Composite:Mf,create:function(a, -b,c){return a&&a.isAnimationObjectGroup?new ia.Composite(a,b,c):new ia(a,b,c)},sanitizeNodeName:function(){var a=/[\[\]\.:\/]/g;return function(b){return b.replace(/\s/g,"_").replace(a,"")}}(),parseTrackName:function(){var a="[^"+"\\[\\]\\.:\\/".replace("\\.","")+"]",b=/((?:WC+[\/:])*)/.source.replace("WC","[^\\[\\]\\.:\\/]");a=/(WCOD+)?/.source.replace("WCOD",a);var c=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC","[^\\[\\]\\.:\\/]"),d=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC","[^\\[\\]\\.:\\/]"), -e=new RegExp("^"+b+a+c+d+"$"),f=["material","materials","bones"];return function(a){var b=e.exec(a);if(!b)throw Error("PropertyBinding: Cannot parse trackName: "+a);b={nodeName:b[2],objectName:b[3],objectIndex:b[4],propertyName:b[5],propertyIndex:b[6]};var c=b.nodeName&&b.nodeName.lastIndexOf(".");if(void 0!==c&&-1!==c){var d=b.nodeName.substring(c+1);-1!==f.indexOf(d)&&(b.nodeName=b.nodeName.substring(0,c),b.objectName=d)}if(null===b.propertyName||0===b.propertyName.length)throw Error("PropertyBinding: can not parse propertyName from trackName: "+ -a);return b}}(),findNode:function(a,b){if(!b||""===b||"root"===b||"."===b||-1===b||b===a.name||b===a.uuid)return a;if(a.skeleton){var c=a.skeleton.getBoneByName(b);if(void 0!==c)return c}if(a.children){var d=function(a){for(var c=0;c=b){var n=b++,p=a[n];c[p.uuid]=k;a[k]=p;c[l]=n;a[n]=h;h=0;for(l=e;h!==l;++h){p=d[h];var v=p[k];p[k]=p[n];p[n]=v}}}this.nCachedObjects_=b},uncache:function(){for(var a=this._objects,b=a.length,c=this.nCachedObjects_,d=this._indicesByUUID,e=this._bindings,f=e.length,g=0,h=arguments.length;g!==h;++g){var l= -arguments[g].uuid,k=d[l];if(void 0!==k)if(delete d[l],kb||0===c)return;this._startTime=null;b*=c}b*=this._updateTimeScale(a);c=this._updateTime(b);a=this._updateWeight(a);if(0c.parameterPositions[1]&&(this.stopFading(),0===d&&(this.enabled=!1))}}return this._effectiveWeight=b},_updateTimeScale:function(a){var b=0;if(!this.paused){b=this.timeScale;var c=this._timeScaleInterpolant;if(null!==c){var d=c.evaluate(a)[0];b*=d;a>c.parameterPositions[1]&&(this.stopWarping(),0===b?this.paused=!0:this.timeScale=b)}}return this._effectiveTimeScale=b},_updateTime:function(a){var b=this.time+a,c=this._clip.duration,d=this.loop,e=this._loopCount,f=2202===d;if(0===a)return-1=== -e?b:f&&1===(e&1)?c-b:b;if(2200===d)a:{if(-1===e&&(this._loopCount=0,this._setEndings(!0,!0,!1)),b>=c)b=c;else if(0>b)b=0;else break a;this.clampWhenFinished?this.paused=!0:this.enabled=!1;this._mixer.dispatchEvent({type:"finished",action:this,direction:0>a?-1:1})}else{-1===e&&(0<=a?(e=0,this._setEndings(!0,0===this.repetitions,f)):this._setEndings(0===this.repetitions,!0,f));if(b>=c||0>b){d=Math.floor(b/c);b-=c*d;e+=Math.abs(d);var g=this.repetitions-e;0>=g?(this.clampWhenFinished?this.paused=!0: -this.enabled=!1,b=0a,this._setEndings(a,!a,f)):this._setEndings(!1,!1,f),this._loopCount=e,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:d}))}if(f&&1===(e&1))return this.time=b,c-b}return this.time=b},_setEndings:function(a,b,c){var d=this._interpolantSettings;c?(d.endingStart=2401,d.endingEnd=2401):(d.endingStart=a?this.zeroSlopeAtStart?2401:2400:2402,d.endingEnd=b?this.zeroSlopeAtEnd?2401: -2400:2402)},_scheduleFading:function(a,b,c){var d=this._mixer,e=d.time,f=this._weightInterpolant;null===f&&(this._weightInterpolant=f=d._lendControlInterpolant());d=f.parameterPositions;f=f.sampleValues;d[0]=e;f[0]=b;d[1]=e+a;f[1]=c;return this}});Ge.prototype=Object.assign(Object.create(ta.prototype),{constructor:Ge,_bindAction:function(a,b){var c=a._localRoot||this._root,d=a._clip.tracks,e=d.length,f=a._propertyBindings;a=a._interpolants;var g=c.uuid,h=this._bindingsByRootAndName,k=h[g];void 0=== -k&&(k={},h[g]=k);for(h=0;h!==e;++h){var m=d[h],n=m.name,p=k[n];if(void 0===p){p=f[h];if(void 0!==p){null===p._cacheIndex&&(++p.referenceCount,this._addInactiveBinding(p,g,n));continue}p=new Fe(ia.create(c,n,b&&b._propertyBindings[h].binding.parsedPath),m.ValueTypeName,m.getValueSize());++p.referenceCount;this._addInactiveBinding(p,g,n)}f[h]=p;a[h].resultBuffer=p.buffer}},_activateAction:function(a){if(!this._isActiveAction(a)){if(null===a._cacheIndex){var b=(a._localRoot||this._root).uuid,c=a._clip.uuid, -d=this._actionsByClip[c];this._bindAction(a,d&&d.knownActions[0]);this._addInactiveAction(a,c,b)}b=a._propertyBindings;c=0;for(d=b.length;c!==d;++c){var e=b[c];0===e.useCount++&&(this._lendBinding(e),e.saveOriginalState())}this._lendAction(a)}},_deactivateAction:function(a){if(this._isActiveAction(a)){for(var b=a._propertyBindings,c=0,d=b.length;c!==d;++c){var e=b[c];0===--e.useCount&&(e.restoreOriginalState(),this._takeBackBinding(e))}this._takeBackAction(a)}},_initMemoryManager:function(){this._actions= -[];this._nActiveActions=0;this._actionsByClip={};this._bindings=[];this._nActiveBindings=0;this._bindingsByRootAndName={};this._controlInterpolants=[];this._nActiveControlInterpolants=0;var a=this;this.stats={actions:{get total(){return a._actions.length},get inUse(){return a._nActiveActions}},bindings:{get total(){return a._bindings.length},get inUse(){return a._nActiveBindings}},controlInterpolants:{get total(){return a._controlInterpolants.length},get inUse(){return a._nActiveControlInterpolants}}}}, -_isActiveAction:function(a){a=a._cacheIndex;return null!==a&&athis.max.x||a.ythis.max.y?!1:!0},containsBox:function(a){return this.min.x<=a.min.x&&a.max.x<=this.max.x&&this.min.y<=a.min.y&&a.max.y<=this.max.y},getParameter:function(a,b){void 0===b&&(console.warn("THREE.Box2: .getParameter() target is now required"),b=new C);return b.set((a.x-this.min.x)/(this.max.x-this.min.x),(a.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(a){return a.max.xthis.max.x||a.max.ythis.max.y?!1:!0}, -clampPoint:function(a,b){void 0===b&&(console.warn("THREE.Box2: .clampPoint() target is now required"),b=new C);return b.copy(a).clamp(this.min,this.max)},distanceToPoint:function(){var a=new C;return function(b){return a.copy(b).clamp(this.min,this.max).sub(b).length()}}(),intersect:function(a){this.min.max(a.min);this.max.min(a.max);return this},union:function(a){this.min.min(a.min);this.max.max(a.max);return this},translate:function(a){this.min.add(a);this.max.add(a);return this},equals:function(a){return a.min.equals(this.min)&& -a.max.equals(this.max)}});Object.assign(Me.prototype,{set:function(a,b){this.start.copy(a);this.end.copy(b);return this},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.start.copy(a.start);this.end.copy(a.end);return this},getCenter:function(a){void 0===a&&(console.warn("THREE.Line3: .getCenter() target is now required"),a=new n);return a.addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(a){void 0===a&&(console.warn("THREE.Line3: .delta() target is now required"), -a=new n);return a.subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(a,b){void 0===b&&(console.warn("THREE.Line3: .at() target is now required"),b=new n);return this.delta(b).multiplyScalar(a).add(this.start)},closestPointToPointParameter:function(){var a=new n,b=new n;return function(c,d){a.subVectors(c,this.start);b.subVectors(this.end,this.start);c=b.dot(b);c=b.dot(a)/c;d&& -(c=O.clamp(c,0,1));return c}}(),closestPointToPoint:function(a,b,c){a=this.closestPointToPointParameter(a,b);void 0===c&&(console.warn("THREE.Line3: .closestPointToPoint() target is now required"),c=new n);return this.delta(c).multiplyScalar(a).add(this.start)},applyMatrix4:function(a){this.start.applyMatrix4(a);this.end.applyMatrix4(a);return this},equals:function(a){return a.start.equals(this.start)&&a.end.equals(this.end)}});rd.prototype=Object.create(D.prototype);rd.prototype.constructor=rd;rd.prototype.isImmediateRenderObject= -!0;sd.prototype=Object.create(V.prototype);sd.prototype.constructor=sd;sd.prototype.update=function(){var a=new n,b=new n,c=new na;return function(){var d=["a","b","c"];this.object.updateMatrixWorld(!0);c.getNormalMatrix(this.object.matrixWorld);var e=this.object.matrixWorld,f=this.geometry.attributes.position,g=this.object.geometry;if(g&&g.isGeometry)for(var h=g.vertices,k=g.faces,m=g=0,n=k.length;mMath.abs(b)&&(b=1E-8);this.scale.set(.5*this.size,.5*this.size,b);this.children[0].material.side=0>b?1:0;this.lookAt(this.plane.normal);D.prototype.updateMatrixWorld.call(this, -a)};var $d,Ne;hb.prototype=Object.create(D.prototype);hb.prototype.constructor=hb;hb.prototype.setDirection=function(){var a=new n,b;return function(c){.99999c.y?this.quaternion.set(1,0,0,0):(a.set(c.z,0,-c.x).normalize(),b=Math.acos(c.y),this.quaternion.setFromAxisAngle(a,b))}}();hb.prototype.setLength=function(a,b,c){void 0===b&&(b=.2*a);void 0===c&&(c=.2*b);this.line.scale.set(1,Math.max(0,a-b),1);this.line.updateMatrix();this.cone.scale.set(c,b,c);this.cone.position.y= -a;this.cone.updateMatrix()};hb.prototype.setColor=function(a){this.line.material.color.copy(a);this.cone.material.color.copy(a)};hb.prototype.copy=function(a){D.prototype.copy.call(this,a,!1);this.line.copy(a.line);this.cone.copy(a.cone);return this};hb.prototype.clone=function(){return(new this.constructor).copy(this)};xd.prototype=Object.create(V.prototype);xd.prototype.constructor=xd;M.create=function(a,b){console.log("THREE.Curve.create() has been deprecated");a.prototype=Object.create(M.prototype); -a.prototype.constructor=a;a.prototype.getPoint=b;return a};Object.assign(fb.prototype,{createPointsGeometry:function(a){console.warn("THREE.CurvePath: .createPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");a=this.getPoints(a);return this.createGeometry(a)},createSpacedPointsGeometry:function(a){console.warn("THREE.CurvePath: .createSpacedPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");a=this.getSpacedPoints(a); -return this.createGeometry(a)},createGeometry:function(a){console.warn("THREE.CurvePath: .createGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");for(var b=new K,c=0,d=a.length;cNumber.EPSILON){if(0>l&&(g=b[f],k=-k,h=b[e],l=-l),!(a.yh.y))if(a.y===g.y){if(a.x===g.x)return!0}else{e= +l*(a.x-g.x)-k*(a.y-g.y);if(0===e)return!0;0>e||(d=!d)}}else if(a.y===g.y&&(h.x<=a.x&&a.x<=g.x||g.x<=a.x&&a.x<=h.x))return!0}return d}var e=db.isClockWise,f=this.subPaths;if(0===f.length)return[];if(!0===b)return c(f);b=[];if(1===f.length){var g=f[0];var h=new pb;h.curves=g.curves;b.push(h);return b}var k=!e(f[0].getPoints());k=a?!k:k;h=[];var l=[],n=[],p=0;l[p]=void 0;n[p]=[];for(var v=0,t=f.length;vl.opacity&&(l.transparent=!0);d.setTextures(k);return d.parse(l)}}()});var ge,Ge={getContext:function(){void 0===ge&&(ge=new (window.AudioContext||window.webkitAudioContext));return ge},setContext:function(a){ge=a}};Object.assign(Be.prototype, +{load:function(a,b,c,d){var e=new La(this.manager);e.setResponseType("arraybuffer");e.setPath(this.path);e.load(a,function(a){a=a.slice(0);Ge.getContext().decodeAudioData(a,function(a){b(a)})},c,d)},setPath:function(a){this.path=a;return this}});Object.assign(ae.prototype,{isSphericalHarmonics3:!0,set:function(a){for(var b=0;9>b;b++)this.coefficients[b].copy(a[b]);return this},zero:function(){for(var a=0;9>a;a++)this.coefficients[a].set(0,0,0);return this},getAt:function(a,b){var c=a.x,d=a.y;a=a.z; +var e=this.coefficients;b=.282095*e[0];b+=.488603*e[1]*d;b+=.488603*e[2]*a;b+=.488603*e[3]*c;b+=1.092548*e[4]*c*d;b+=1.092548*e[5]*d*a;b+=.315392*e[6]*(3*a*a-1);b+=1.092548*e[7]*c*a;return b+=.546274*e[8]*(c*c-d*d)},getIrradianceAt:function(a,b){var c=a.x,d=a.y;a=a.z;var e=this.coefficients;b=.886227*e[0];b+=1.023328*e[1]*d;b+=1.023328*e[2]*a;b+=1.023328*e[3]*c;b+=.858086*e[4]*c*d;b+=.858086*e[5]*d*a;b+=e[6]*(.743125*a*a-.247708);b+=.858086*e[7]*c*a;return b+=.429043*e[8]*(c*c-d*d)},add:function(a){for(var b= +0;9>b;b++)this.coefficients[b].add(a.coefficients[b]);return this},scale:function(a){for(var b=0;9>b;b++)this.coefficients[b].multiplyScalar(a);return this},lerp:function(a,b){for(var c=0;9>c;c++)this.coefficients[c].lerp(a.coefficients[c],b);return this},equals:function(a){for(var b=0;9>b;b++)if(!this.coefficients[b].equals(a.coefficients[b]))return!1;return!0},copy:function(a){return this.set(a.coefficients)},clone:function(){return(new this.constructor).copy(this)},fromArray:function(a){for(var b= +this.coefficients,c=0;9>c;c++)b[c].fromArray(a,3*c);return this},toArray:function(){for(var a=[],b=this.coefficients,c=0;9>c;c++)b[c].toArray(a,3*c);return a}});Object.assign(ae,{getBasisAt:function(a,b){var c=a.x,d=a.y;a=a.z;b[0]=.282095;b[1]=.488603*d;b[2]=.488603*a;b[3]=.488603*c;b[4]=1.092548*c*d;b[5]=1.092548*d*a;b[6]=.315392*(3*a*a-1);b[7]=1.092548*c*a;b[8]=.546274*(c*c-d*d)}});Ra.prototype=Object.assign(Object.create(aa.prototype),{constructor:Ra,isLightProbe:!0,copy:function(a){aa.prototype.copy.call(this, +a);this.sh.copy(a.sh);this.intensity=a.intensity;return this},toJSON:function(a){return aa.prototype.toJSON.call(this,a)}});Ce.prototype=Object.assign(Object.create(Ra.prototype),{constructor:Ce,isHemisphereLightProbe:!0,copy:function(a){Ra.prototype.copy.call(this,a);return this},toJSON:function(a){return Ra.prototype.toJSON.call(this,a)}});De.prototype=Object.assign(Object.create(Ra.prototype),{constructor:De,isAmbientLightProbe:!0,copy:function(a){Ra.prototype.copy.call(this,a);return this},toJSON:function(a){return Ra.prototype.toJSON.call(this, +a)}});Object.assign(Kf.prototype,{update:function(){var a,b,c,d,e,f,g,h,k=new O,l=new O;return function(m){if(a!==this||b!==m.focus||c!==m.fov||d!==m.aspect*this.aspect||e!==m.near||f!==m.far||g!==m.zoom||h!==this.eyeSep){a=this;b=m.focus;c=m.fov;d=m.aspect*this.aspect;e=m.near;f=m.far;g=m.zoom;var p=m.projectionMatrix.clone();h=this.eyeSep/2;var n=h*e/b,q=e*Math.tan(P.DEG2RAD*c*.5)/g;l.elements[12]=-h;k.elements[12]=h;var r=-q*d+n;var u=q*d+n;p.elements[0]=2*e/(u-r);p.elements[8]=(u+r)/(u-r);this.cameraL.projectionMatrix.copy(p); +r=-q*d-n;u=q*d-n;p.elements[0]=2*e/(u-r);p.elements[8]=(u+r)/(u-r);this.cameraR.projectionMatrix.copy(p)}this.cameraL.matrixWorld.copy(m.matrixWorld).multiply(l);this.cameraR.matrixWorld.copy(m.matrixWorld).multiply(k)}}()});sd.prototype=Object.create(H.prototype);sd.prototype.constructor=sd;Object.assign(Ee.prototype,{start:function(){this.oldTime=this.startTime=("undefined"===typeof performance?Date:performance).now();this.elapsedTime=0;this.running=!0},stop:function(){this.getElapsedTime();this.autoStart= +this.running=!1},getElapsedTime:function(){this.getDelta();return this.elapsedTime},getDelta:function(){var a=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){var b=("undefined"===typeof performance?Date:performance).now();a=(b-this.oldTime)/1E3;this.oldTime=b;this.elapsedTime+=a}return a}});Fe.prototype=Object.assign(Object.create(H.prototype),{constructor:Fe,getInput:function(){return this.gain},removeFilter:function(){null!==this.filter&&(this.gain.disconnect(this.filter), +this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null);return this},getFilter:function(){return this.filter},setFilter:function(a){null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination);this.filter=a;this.gain.connect(this.filter);this.filter.connect(this.context.destination);return this},getMasterVolume:function(){return this.gain.gain.value},setMasterVolume:function(a){this.gain.gain.setTargetAtTime(a, +this.context.currentTime,.01);return this},updateMatrixWorld:function(){var a=new n,b=new ea,c=new n,d=new n,e=new Ee;return function(f){H.prototype.updateMatrixWorld.call(this,f);f=this.context.listener;var g=this.up;this.timeDelta=e.getDelta();this.matrixWorld.decompose(a,b,c);d.set(0,0,-1).applyQuaternion(b);if(f.positionX){var h=this.context.currentTime+this.timeDelta;f.positionX.linearRampToValueAtTime(a.x,h);f.positionY.linearRampToValueAtTime(a.y,h);f.positionZ.linearRampToValueAtTime(a.z, +h);f.forwardX.linearRampToValueAtTime(d.x,h);f.forwardY.linearRampToValueAtTime(d.y,h);f.forwardZ.linearRampToValueAtTime(d.z,h);f.upX.linearRampToValueAtTime(g.x,h);f.upY.linearRampToValueAtTime(g.y,h);f.upZ.linearRampToValueAtTime(g.z,h)}else f.setPosition(a.x,a.y,a.z),f.setOrientation(d.x,d.y,d.z,g.x,g.y,g.z)}}()});rc.prototype=Object.assign(Object.create(H.prototype),{constructor:rc,getOutput:function(){return this.gain},setNodeSource:function(a){this.hasPlaybackControl=!1;this.sourceType="audioNode"; +this.source=a;this.connect();return this},setMediaElementSource:function(a){this.hasPlaybackControl=!1;this.sourceType="mediaNode";this.source=this.context.createMediaElementSource(a);this.connect();return this},setBuffer:function(a){this.buffer=a;this.sourceType="buffer";this.autoplay&&this.play();return this},play:function(){if(!0===this.isPlaying)console.warn("THREE.Audio: Audio is already playing.");else if(!1===this.hasPlaybackControl)console.warn("THREE.Audio: this Audio has no playback control."); +else{var a=this.context.createBufferSource();a.buffer=this.buffer;a.loop=this.loop;a.onended=this.onEnded.bind(this);this.startTime=this.context.currentTime;a.start(this.startTime,this.offset);this.isPlaying=!0;this.source=a;this.setDetune(this.detune);this.setPlaybackRate(this.playbackRate);return this.connect()}},pause:function(){if(!1===this.hasPlaybackControl)console.warn("THREE.Audio: this Audio has no playback control.");else return!0===this.isPlaying&&(this.source.stop(),this.source.onended= +null,this.offset+=(this.context.currentTime-this.startTime)*this.playbackRate,this.isPlaying=!1),this},stop:function(){if(!1===this.hasPlaybackControl)console.warn("THREE.Audio: this Audio has no playback control.");else return this.source.stop(),this.source.onended=null,this.offset=0,this.isPlaying=!1,this},connect:function(){if(0d&&this._mixBufferRegion(c,a,3*b,1-d,b);d=b;for(var f=b+b;d!==f;++d)if(c[d]!==c[d+b]){e.setValue(c,a);break}},saveOriginalState:function(){var a=this.buffer,b=this.valueSize,c=3*b;this.binding.getValue(a,c);for(var d=b;d!==c;++d)a[d]=a[c+d%b];this.cumulativeWeight=0},restoreOriginalState:function(){this.binding.setValue(this.buffer,3*this.valueSize)},_select:function(a, +b,c,d,e){if(.5<=d)for(d=0;d!==e;++d)a[b+d]=a[c+d]},_slerp:function(a,b,c,d){ea.slerpFlat(a,b,a,b,a,c,d)},_lerp:function(a,b,c,d,e){for(var f=1-d,g=0;g!==e;++g){var h=b+g;a[h]=a[h]*f+a[c+g]*d}}});Object.assign(Lf.prototype,{getValue:function(a,b){this.bind();var c=this._bindings[this._targetGroup.nCachedObjects_];void 0!==c&&c.getValue(a,b)},setValue:function(a,b){for(var c=this._bindings,d=this._targetGroup.nCachedObjects_,e=c.length;d!==e;++d)c[d].setValue(a,b)},bind:function(){for(var a=this._bindings, +b=this._targetGroup.nCachedObjects_,c=a.length;b!==c;++b)a[b].bind()},unbind:function(){for(var a=this._bindings,b=this._targetGroup.nCachedObjects_,c=a.length;b!==c;++b)a[b].unbind()}});Object.assign(va,{Composite:Lf,create:function(a,b,c){return a&&a.isAnimationObjectGroup?new va.Composite(a,b,c):new va(a,b,c)},sanitizeNodeName:function(){var a=/[\[\]\.:\/]/g;return function(b){return b.replace(/\s/g,"_").replace(a,"")}}(),parseTrackName:function(){var a="[^"+"\\[\\]\\.:\\/".replace("\\.","")+"]", +b=/((?:WC+[\/:])*)/.source.replace("WC","[^\\[\\]\\.:\\/]");a=/(WCOD+)?/.source.replace("WCOD",a);var c=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC","[^\\[\\]\\.:\\/]"),d=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC","[^\\[\\]\\.:\\/]"),e=new RegExp("^"+b+a+c+d+"$"),f=["material","materials","bones"];return function(a){var b=e.exec(a);if(!b)throw Error("PropertyBinding: Cannot parse trackName: "+a);b={nodeName:b[2],objectName:b[3],objectIndex:b[4],propertyName:b[5],propertyIndex:b[6]};var c=b.nodeName&& +b.nodeName.lastIndexOf(".");if(void 0!==c&&-1!==c){var d=b.nodeName.substring(c+1);-1!==f.indexOf(d)&&(b.nodeName=b.nodeName.substring(0,c),b.objectName=d)}if(null===b.propertyName||0===b.propertyName.length)throw Error("PropertyBinding: can not parse propertyName from trackName: "+a);return b}}(),findNode:function(a,b){if(!b||""===b||"root"===b||"."===b||-1===b||b===a.name||b===a.uuid)return a;if(a.skeleton){var c=a.skeleton.getBoneByName(b);if(void 0!==c)return c}if(a.children){var d=function(a){for(var c= +0;c=b){var n=b++,p=a[n];c[p.uuid]=l;a[l]=p;c[k]=n;a[n]=h;h=0;for(k=e;h!==k;++h){p=d[h];var v=p[l];p[l]=p[n];p[n]=v}}}this.nCachedObjects_=b},uncache:function(){for(var a=this._objects,b=a.length,c=this.nCachedObjects_,d=this._indicesByUUID,e=this._bindings,f=e.length,g=0,h=arguments.length;g!==h;++g){var k=arguments[g].uuid,l=d[k];if(void 0!==l)if(delete d[k],lb||0===c)return;this._startTime=null;b*=c}b*=this._updateTimeScale(a);c=this._updateTime(b);a=this._updateWeight(a);if(0c.parameterPositions[1]&&(this.stopFading(),0===d&&(this.enabled=!1))}}return this._effectiveWeight=b},_updateTimeScale:function(a){var b=0;if(!this.paused){b=this.timeScale;var c=this._timeScaleInterpolant;if(null!==c){var d=c.evaluate(a)[0]; +b*=d;a>c.parameterPositions[1]&&(this.stopWarping(),0===b?this.paused=!0:this.timeScale=b)}}return this._effectiveTimeScale=b},_updateTime:function(a){var b=this.time+a,c=this._clip.duration,d=this.loop,e=this._loopCount,f=2202===d;if(0===a)return-1===e?b:f&&1===(e&1)?c-b:b;if(2200===d)a:{if(-1===e&&(this._loopCount=0,this._setEndings(!0,!0,!1)),b>=c)b=c;else if(0>b)b=0;else{this.time=b;break a}this.clampWhenFinished?this.paused=!0:this.enabled=!1;this.time=b;this._mixer.dispatchEvent({type:"finished", +action:this,direction:0>a?-1:1})}else{-1===e&&(0<=a?(e=0,this._setEndings(!0,0===this.repetitions,f)):this._setEndings(0===this.repetitions,!0,f));if(b>=c||0>b){d=Math.floor(b/c);b-=c*d;e+=Math.abs(d);var g=this.repetitions-e;0>=g?(this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=b=0a,this._setEndings(a,!a,f)):this._setEndings(!1,!1,f),this._loopCount=e,this.time=b,this._mixer.dispatchEvent({type:"loop", +action:this,loopDelta:d}))}else this.time=b;if(f&&1===(e&1))return c-b}return b},_setEndings:function(a,b,c){var d=this._interpolantSettings;c?(d.endingStart=2401,d.endingEnd=2401):(d.endingStart=a?this.zeroSlopeAtStart?2401:2400:2402,d.endingEnd=b?this.zeroSlopeAtEnd?2401:2400:2402)},_scheduleFading:function(a,b,c){var d=this._mixer,e=d.time,f=this._weightInterpolant;null===f&&(this._weightInterpolant=f=d._lendControlInterpolant());d=f.parameterPositions;f=f.sampleValues;d[0]=e;f[0]=b;d[1]=e+a;f[1]= +c;return this}});Ke.prototype=Object.assign(Object.create(Ca.prototype),{constructor:Ke,_bindAction:function(a,b){var c=a._localRoot||this._root,d=a._clip.tracks,e=d.length,f=a._propertyBindings;a=a._interpolants;var g=c.uuid,h=this._bindingsByRootAndName,k=h[g];void 0===k&&(k={},h[g]=k);for(h=0;h!==e;++h){var l=d[h],n=l.name,p=k[n];if(void 0===p){p=f[h];if(void 0!==p){null===p._cacheIndex&&(++p.referenceCount,this._addInactiveBinding(p,g,n));continue}p=new Je(va.create(c,n,b&&b._propertyBindings[h].binding.parsedPath), +l.ValueTypeName,l.getValueSize());++p.referenceCount;this._addInactiveBinding(p,g,n)}f[h]=p;a[h].resultBuffer=p.buffer}},_activateAction:function(a){if(!this._isActiveAction(a)){if(null===a._cacheIndex){var b=(a._localRoot||this._root).uuid,c=a._clip.uuid,d=this._actionsByClip[c];this._bindAction(a,d&&d.knownActions[0]);this._addInactiveAction(a,c,b)}b=a._propertyBindings;c=0;for(d=b.length;c!==d;++c){var e=b[c];0===e.useCount++&&(this._lendBinding(e),e.saveOriginalState())}this._lendAction(a)}}, +_deactivateAction:function(a){if(this._isActiveAction(a)){for(var b=a._propertyBindings,c=0,d=b.length;c!==d;++c){var e=b[c];0===--e.useCount&&(e.restoreOriginalState(),this._takeBackBinding(e))}this._takeBackAction(a)}},_initMemoryManager:function(){this._actions=[];this._nActiveActions=0;this._actionsByClip={};this._bindings=[];this._nActiveBindings=0;this._bindingsByRootAndName={};this._controlInterpolants=[];this._nActiveControlInterpolants=0;var a=this;this.stats={actions:{get total(){return a._actions.length}, +get inUse(){return a._nActiveActions}},bindings:{get total(){return a._bindings.length},get inUse(){return a._nActiveBindings}},controlInterpolants:{get total(){return a._controlInterpolants.length},get inUse(){return a._nActiveControlInterpolants}}}},_isActiveAction:function(a){a=a._cacheIndex;return null!==a&&athis.max.x||a.ythis.max.y?!1:!0},containsBox:function(a){return this.min.x<=a.min.x&&a.max.x<=this.max.x&&this.min.y<=a.min.y&&a.max.y<=this.max.y},getParameter:function(a,b){void 0===b&&(console.warn("THREE.Box2: .getParameter() target is now required"), +b=new D);return b.set((a.x-this.min.x)/(this.max.x-this.min.x),(a.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(a){return a.max.xthis.max.x||a.max.ythis.max.y?!1:!0},clampPoint:function(a,b){void 0===b&&(console.warn("THREE.Box2: .clampPoint() target is now required"),b=new D);return b.copy(a).clamp(this.min,this.max)},distanceToPoint:function(){var a=new D;return function(b){return a.copy(b).clamp(this.min,this.max).sub(b).length()}}(),intersect:function(a){this.min.max(a.min); +this.max.min(a.max);return this},union:function(a){this.min.min(a.min);this.max.max(a.max);return this},translate:function(a){this.min.add(a);this.max.add(a);return this},equals:function(a){return a.min.equals(this.min)&&a.max.equals(this.max)}});Object.assign(Oe.prototype,{set:function(a,b){this.start.copy(a);this.end.copy(b);return this},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.start.copy(a.start);this.end.copy(a.end);return this},getCenter:function(a){void 0=== +a&&(console.warn("THREE.Line3: .getCenter() target is now required"),a=new n);return a.addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(a){void 0===a&&(console.warn("THREE.Line3: .delta() target is now required"),a=new n);return a.subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(a,b){void 0===b&&(console.warn("THREE.Line3: .at() target is now required"),b= +new n);return this.delta(b).multiplyScalar(a).add(this.start)},closestPointToPointParameter:function(){var a=new n,b=new n;return function(c,d){a.subVectors(c,this.start);b.subVectors(this.end,this.start);c=b.dot(b);c=b.dot(a)/c;d&&(c=P.clamp(c,0,1));return c}}(),closestPointToPoint:function(a,b,c){a=this.closestPointToPointParameter(a,b);void 0===c&&(console.warn("THREE.Line3: .closestPointToPoint() target is now required"),c=new n);return this.delta(c).multiplyScalar(a).add(this.start)},applyMatrix4:function(a){this.start.applyMatrix4(a); +this.end.applyMatrix4(a);return this},equals:function(a){return a.start.equals(this.start)&&a.end.equals(this.end)}});td.prototype=Object.create(H.prototype);td.prototype.constructor=td;td.prototype.isImmediateRenderObject=!0;ud.prototype=Object.create(S.prototype);ud.prototype.constructor=ud;ud.prototype.update=function(){var a=new n,b=new n,c=new ia;return function(){var d=["a","b","c"];this.object.updateMatrixWorld(!0);c.getNormalMatrix(this.object.matrixWorld);var e=this.object.matrixWorld,f= +this.geometry.attributes.position,g=this.object.geometry;if(g&&g.isGeometry)for(var h=g.vertices,k=g.faces,l=g=0,n=k.length;lMath.abs(b)&&(b=1E-8);this.scale.set(.5*this.size,.5*this.size,b);this.children[0].material.side=0>b?1:0;this.lookAt(this.plane.normal);H.prototype.updateMatrixWorld.call(this,a)};var ee,Pe;hb.prototype=Object.create(H.prototype);hb.prototype.constructor=hb;hb.prototype.setDirection=function(){var a=new n,b;return function(c){.99999c.y?this.quaternion.set(1, +0,0,0):(a.set(c.z,0,-c.x).normalize(),b=Math.acos(c.y),this.quaternion.setFromAxisAngle(a,b))}}();hb.prototype.setLength=function(a,b,c){void 0===b&&(b=.2*a);void 0===c&&(c=.2*b);this.line.scale.set(1,Math.max(0,a-b),1);this.line.updateMatrix();this.cone.scale.set(c,b,c);this.cone.position.y=a;this.cone.updateMatrix()};hb.prototype.setColor=function(a){this.line.material.color.copy(a);this.cone.material.color.copy(a)};hb.prototype.copy=function(a){H.prototype.copy.call(this,a,!1);this.line.copy(a.line); +this.cone.copy(a.cone);return this};hb.prototype.clone=function(){return(new this.constructor).copy(this)};zd.prototype=Object.create(S.prototype);zd.prototype.constructor=zd;N.create=function(a,b){console.log("THREE.Curve.create() has been deprecated");a.prototype=Object.create(N.prototype);a.prototype.constructor=a;a.prototype.getPoint=b;return a};Object.assign(fb.prototype,{createPointsGeometry:function(a){console.warn("THREE.CurvePath: .createPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead."); +a=this.getPoints(a);return this.createGeometry(a)},createSpacedPointsGeometry:function(a){console.warn("THREE.CurvePath: .createSpacedPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");a=this.getSpacedPoints(a);return this.createGeometry(a)},createGeometry:function(a){console.warn("THREE.CurvePath: .createGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");for(var b=new Q,c=0,d=a.length;corg.treblereel.gwt.three4g three4g-demo - 0.104 + 0.106-SNAPSHOT war THREE4G:DEMO @@ -15,7 +15,7 @@ 1.5.11 1.1.0 UTF-8 - 0.104 + 0.106-SNAPSHOT diff --git a/demo/src/main/java/org/treblereel/gwt/three4g/demo/client/api/ImprovedNoise.java b/demo/src/main/java/org/treblereel/gwt/three4g/demo/client/api/ImprovedNoise.java index 67e36e89..30890b3e 100644 --- a/demo/src/main/java/org/treblereel/gwt/three4g/demo/client/api/ImprovedNoise.java +++ b/demo/src/main/java/org/treblereel/gwt/three4g/demo/client/api/ImprovedNoise.java @@ -1,13 +1,12 @@ package org.treblereel.gwt.three4g.demo.client.api; -import jsinterop.annotations.JsPackage; import jsinterop.annotations.JsType; /** * @author Dmitrii Tikhomirov * Created by treblereel on 6/28/18. */ -@JsType(isNative = true, namespace = JsPackage.GLOBAL) +@JsType(isNative = true, namespace = "THREE") public class ImprovedNoise { public native int noise(double i, double i1, double z); } diff --git a/demo/src/main/java/org/treblereel/gwt/three4g/demo/client/local/examples/camera/WebglCameraArray.java b/demo/src/main/java/org/treblereel/gwt/three4g/demo/client/local/examples/camera/WebglCameraArray.java index 60b858fd..c7b1a326 100644 --- a/demo/src/main/java/org/treblereel/gwt/three4g/demo/client/local/examples/camera/WebglCameraArray.java +++ b/demo/src/main/java/org/treblereel/gwt/three4g/demo/client/local/examples/camera/WebglCameraArray.java @@ -1,8 +1,9 @@ package org.treblereel.gwt.three4g.demo.client.local.examples.camera; -import com.google.gwt.animation.client.AnimationScheduler; import java.util.ArrayList; import java.util.List; + +import com.google.gwt.animation.client.AnimationScheduler; import org.treblereel.gwt.three4g.cameras.ArrayCamera; import org.treblereel.gwt.three4g.cameras.OrthographicCamera; import org.treblereel.gwt.three4g.cameras.PerspectiveCamera; @@ -26,20 +27,22 @@ */ public class WebglCameraArray extends Attachable { - public static final String name = "camera / array"; private Mesh mesh; + private float AMOUNT = 6; + + private double WIDTH = (window.innerWidth / AMOUNT) * window.devicePixelRatio; + private double HEIGHT = (window.innerHeight / AMOUNT) * window.devicePixelRatio; public WebglCameraArray() { scene = new Scene(); - float AMOUNT = 6; float SIZE = 1 / AMOUNT; List cameras = new ArrayList<>(); for (int y = 0; y < AMOUNT; y++) { for (int x = 0; x < AMOUNT; x++) { PerspectiveCamera subcamera = new PerspectiveCamera(40f, aspect, 0.1f, 10f); - subcamera.bounds = new Vector4(x / AMOUNT, y / AMOUNT, SIZE, SIZE); + subcamera.viewport = new Vector4((float) Math.floor(x * WIDTH), (float) Math.floor(y * HEIGHT), (float) Math.ceil(WIDTH), (float) Math.ceil(HEIGHT)); subcamera.position.x = (x / AMOUNT) - 0.5f; subcamera.position.y = 0.5f - (y / AMOUNT); subcamera.position.z = 1.5f; diff --git a/demo/src/main/java/org/treblereel/gwt/three4g/demo/client/local/examples/loaders/WebglLoaderDraco.java b/demo/src/main/java/org/treblereel/gwt/three4g/demo/client/local/examples/loaders/WebglLoaderDraco.java index 3c5c95d6..5a5ca139 100644 --- a/demo/src/main/java/org/treblereel/gwt/three4g/demo/client/local/examples/loaders/WebglLoaderDraco.java +++ b/demo/src/main/java/org/treblereel/gwt/three4g/demo/client/local/examples/loaders/WebglLoaderDraco.java @@ -20,7 +20,6 @@ import org.treblereel.gwt.three4g.materials.parameters.MeshPhongMaterialParameters; import org.treblereel.gwt.three4g.math.Color; import org.treblereel.gwt.three4g.math.Vector3; -import org.treblereel.gwt.three4g.objects.Group; import org.treblereel.gwt.three4g.objects.Mesh; import org.treblereel.gwt.three4g.renderers.WebGLRenderer; import org.treblereel.gwt.three4g.renderers.parameters.WebGLRendererParameters; @@ -40,6 +39,7 @@ public class WebglLoaderDraco extends Attachable { public WebglLoaderDraco() { + DRACOLoaderDecoderConfig config = new DRACOLoaderDecoderConfig(); config.type = "js"; diff --git a/demo/src/main/java/org/treblereel/gwt/three4g/demo/client/local/examples/loaders/WebglLoaderObj2.java b/demo/src/main/java/org/treblereel/gwt/three4g/demo/client/local/examples/loaders/WebglLoaderObj2.java index d02f5887..17a8fb2b 100644 --- a/demo/src/main/java/org/treblereel/gwt/three4g/demo/client/local/examples/loaders/WebglLoaderObj2.java +++ b/demo/src/main/java/org/treblereel/gwt/three4g/demo/client/local/examples/loaders/WebglLoaderObj2.java @@ -9,8 +9,10 @@ import org.treblereel.gwt.three4g.core.PropertyHolder; import org.treblereel.gwt.three4g.demo.client.local.AppSetup; import org.treblereel.gwt.three4g.demo.client.local.Attachable; +import org.treblereel.gwt.three4g.demo.client.local.utils.JSON; import org.treblereel.gwt.three4g.demo.client.local.utils.StatsProducer; import org.treblereel.gwt.three4g.extensions.controls.TrackballControls; +import org.treblereel.gwt.three4g.extensions.loaders.MTLLoader; import org.treblereel.gwt.three4g.extensions.loaders.OBJLoader2; import org.treblereel.gwt.three4g.helpers.GridHelper; import org.treblereel.gwt.three4g.lights.AmbientLight; @@ -42,7 +44,6 @@ public WebglLoaderObj2() { initContent(); container.appendChild(renderer.domElement); - } private void initGL() { @@ -80,7 +81,7 @@ private void initContent() { String modelName = "female02"; - OBJLoader2 objLoader = new OBJLoader2(); + OBJLoader2 objLoader2 = new OBJLoader2(); OnLoadCallback callbackOnLoad = new OnLoadCallback() { @Override public void onLoad(PropertyHolder event) { @@ -90,17 +91,23 @@ public void onLoad(PropertyHolder event) { } }; - OnLoadCallback onLoadMtl = new OnLoadCallback() { - + OnLoadCallback onLoadMtl = new OnLoadCallback() { @Override - public void onLoad(Material[] materials) { - objLoader.setModelName(modelName); - objLoader.setMaterials(materials); - objLoader.setLogging(true, true); - objLoader.load("models/obj/female02/female02.obj", callbackOnLoad, null, null, null, false); + public void onLoad(Object object) { + + DomGlobal.console.log("1 " + JSON.stringify(object)); + objLoader2.setModelName(modelName); + objLoader2.setLogging(true, true); + objLoader2.setMaterials(addMaterialsFromMtlLoader(object)); + objLoader2.load("models/obj/female02/female02.obj", callbackOnLoad, null, null, null); + } }; - objLoader.loadMtl("models/obj/female02/female02.mtl", null, onLoadMtl); + + MTLLoader mtlLoader = new MTLLoader(); + mtlLoader.load( "models/obj/female02/female02.mtl", onLoadMtl ); + + //objLoader2.loadMtl("models/obj/female02/female02.mtl", null, onLoadMtl); } private void resetCamera() { @@ -109,6 +116,15 @@ private void resetCamera() { this.updateCamera(); } + private Material[] addMaterialsFromMtlLoader(Object materialCreator) { + if (materialCreator instanceof MTLLoader.MaterialCreator) { + + ((MTLLoader.MaterialCreator) materialCreator).preload(); + return ((MTLLoader.MaterialCreator) materialCreator).materials; + } + return null; + } + private void updateCamera() { camera.aspect = aspect; camera.lookAt(this.cameraTarget); @@ -125,8 +141,6 @@ protected void doAttachScene() { @Override protected void doAttachInfo() { AppSetup.infoDiv.show().setHrefToInfo("http://threejs.org").setTextContentToInfo("three.js").setInnetHtml(" - OBJLoader2 direct loader test"); - - } private void animate() { @@ -136,9 +150,7 @@ private void animate() { trackballControls.update(); renderer.render(scene, camera); animate(); - } }); } - } \ No newline at end of file diff --git a/demo/src/main/java/org/treblereel/gwt/three4g/demo/client/local/examples/material/EffectComposer.java b/demo/src/main/java/org/treblereel/gwt/three4g/demo/client/local/examples/material/EffectComposer.java index 250990fe..4d23d92c 100644 --- a/demo/src/main/java/org/treblereel/gwt/three4g/demo/client/local/examples/material/EffectComposer.java +++ b/demo/src/main/java/org/treblereel/gwt/three4g/demo/client/local/examples/material/EffectComposer.java @@ -6,6 +6,8 @@ import org.treblereel.gwt.three4g.renderers.WebGLRenderer; /** + * Used to implement post-processing effects in three.js. The class manages a chain of post-processing passes to produce the final visual result. Post-processing passes are executed in order of their addition/insertion. The last pass is automatically rendered to screen. + * * @author Dmitrii Tikhomirov * Created by treblereel on 6/25/18. */ @@ -14,7 +16,17 @@ public class EffectComposer { public PropertyHolder renderTarget1; - public EffectComposer(WebGLRenderer renderer, WebGLRenderTarget webGLRenderTarget) { + /** + * @param renderer -- The renderer used to render the scene. + */ + public EffectComposer(WebGLRenderer renderer) { + } + + /** + * @param renderer -- The renderer used to render the scene. + * @param renderTarget -- (optional) A preconfigured render target internally used by EffectComposer. + */ + public EffectComposer(WebGLRenderer renderer, WebGLRenderTarget renderTarget) { } public native void addPass(ShaderPass effectBeckmann); diff --git a/demo/src/main/resources/org/treblereel/gwt/three4g/demo/client/local/resources/js/ImprovedNoise.js b/demo/src/main/resources/org/treblereel/gwt/three4g/demo/client/local/resources/js/ImprovedNoise.js index 35db4269..607474a6 100644 --- a/demo/src/main/resources/org/treblereel/gwt/three4g/demo/client/local/resources/js/ImprovedNoise.js +++ b/demo/src/main/resources/org/treblereel/gwt/three4g/demo/client/local/resources/js/ImprovedNoise.js @@ -1,49 +1,49 @@ // http://mrl.nyu.edu/~perlin/noise/ -var ImprovedNoise = function () { +THREE.ImprovedNoise = function () { - var p = [ 151,160,137,91,90,15,131,13,201,95,96,53,194,233,7,225,140,36,103,30,69,142,8,99,37,240,21,10, - 23,190,6,148,247,120,234,75,0,26,197,62,94,252,219,203,117,35,11,32,57,177,33,88,237,149,56,87, - 174,20,125,136,171,168,68,175,74,165,71,134,139,48,27,166,77,146,158,231,83,111,229,122,60,211, - 133,230,220,105,92,41,55,46,245,40,244,102,143,54,65,25,63,161,1,216,80,73,209,76,132,187,208, - 89,18,169,200,196,135,130,116,188,159,86,164,100,109,198,173,186,3,64,52,217,226,250,124,123,5, - 202,38,147,118,126,255,82,85,212,207,206,59,227,47,16,58,17,182,189,28,42,223,183,170,213,119, - 248,152,2,44,154,163,70,221,153,101,155,167,43,172,9,129,22,39,253,19,98,108,110,79,113,224,232, - 178,185,112,104,218,246,97,228,251,34,242,193,238,210,144,12,191,179,162,241,81,51,145,235,249, - 14,239,107,49,192,214,31,181,199,106,157,184,84,204,176,115,121,50,45,127,4,150,254,138,236,205, - 93,222,114,67,29,24,72,243,141,128,195,78,66,215,61,156,180 ]; + var p = [ 151, 160, 137, 91, 90, 15, 131, 13, 201, 95, 96, 53, 194, 233, 7, 225, 140, 36, 103, 30, 69, 142, 8, 99, 37, 240, 21, 10, + 23, 190, 6, 148, 247, 120, 234, 75, 0, 26, 197, 62, 94, 252, 219, 203, 117, 35, 11, 32, 57, 177, 33, 88, 237, 149, 56, 87, + 174, 20, 125, 136, 171, 168, 68, 175, 74, 165, 71, 134, 139, 48, 27, 166, 77, 146, 158, 231, 83, 111, 229, 122, 60, 211, + 133, 230, 220, 105, 92, 41, 55, 46, 245, 40, 244, 102, 143, 54, 65, 25, 63, 161, 1, 216, 80, 73, 209, 76, 132, 187, 208, + 89, 18, 169, 200, 196, 135, 130, 116, 188, 159, 86, 164, 100, 109, 198, 173, 186, 3, 64, 52, 217, 226, 250, 124, 123, 5, + 202, 38, 147, 118, 126, 255, 82, 85, 212, 207, 206, 59, 227, 47, 16, 58, 17, 182, 189, 28, 42, 223, 183, 170, 213, 119, + 248, 152, 2, 44, 154, 163, 70, 221, 153, 101, 155, 167, 43, 172, 9, 129, 22, 39, 253, 19, 98, 108, 110, 79, 113, 224, 232, + 178, 185, 112, 104, 218, 246, 97, 228, 251, 34, 242, 193, 238, 210, 144, 12, 191, 179, 162, 241, 81, 51, 145, 235, 249, + 14, 239, 107, 49, 192, 214, 31, 181, 199, 106, 157, 184, 84, 204, 176, 115, 121, 50, 45, 127, 4, 150, 254, 138, 236, 205, + 93, 222, 114, 67, 29, 24, 72, 243, 141, 128, 195, 78, 66, 215, 61, 156, 180 ]; - for (var i = 0; i < 256 ; i ++) { + for ( var i = 0; i < 256; i ++ ) { - p[256 + i] = p[i]; + p[ 256 + i ] = p[ i ]; } - function fade(t) { + function fade( t ) { - return t * t * t * (t * (t * 6 - 15) + 10); + return t * t * t * ( t * ( t * 6 - 15 ) + 10 ); } - function lerp(t, a, b) { + function lerp( t, a, b ) { - return a + t * (b - a); + return a + t * ( b - a ); } - function grad(hash, x, y, z) { + function grad( hash, x, y, z ) { var h = hash & 15; var u = h < 8 ? x : y, v = h < 4 ? y : h == 12 || h == 14 ? x : z; - return ((h&1) == 0 ? u : -u) + ((h&2) == 0 ? v : -v); + return ( ( h & 1 ) == 0 ? u : - u ) + ( ( h & 2 ) == 0 ? v : - v ); } return { - noise: function (x, y, z) { + noise: function ( x, y, z ) { - var floorX = Math.floor(x), floorY = Math.floor(y), floorZ = Math.floor(z); + var floorX = Math.floor( x ), floorY = Math.floor( y ), floorZ = Math.floor( z ); var X = floorX & 255, Y = floorY & 255, Z = floorZ & 255; @@ -53,19 +53,20 @@ var ImprovedNoise = function () { var xMinus1 = x - 1, yMinus1 = y - 1, zMinus1 = z - 1; - var u = fade(x), v = fade(y), w = fade(z); + var u = fade( x ), v = fade( y ), w = fade( z ); - var A = p[X] + Y, AA = p[A] + Z, AB = p[A + 1] + Z, B = p[X + 1] + Y, BA = p[B] + Z, BB = p[B + 1] + Z; + var A = p[ X ] + Y, AA = p[ A ] + Z, AB = p[ A + 1 ] + Z, B = p[ X + 1 ] + Y, BA = p[ B ] + Z, BB = p[ B + 1 ] + Z; - return lerp(w, lerp(v, lerp(u, grad(p[AA], x, y, z), - grad(p[BA], xMinus1, y, z)), - lerp(u, grad(p[AB], x, yMinus1, z), - grad(p[BB], xMinus1, yMinus1, z))), - lerp(v, lerp(u, grad(p[AA + 1], x, y, zMinus1), - grad(p[BA + 1], xMinus1, y, z - 1)), - lerp(u, grad(p[AB + 1], x, yMinus1, zMinus1), - grad(p[BB + 1], xMinus1, yMinus1, zMinus1)))); + return lerp( w, lerp( v, lerp( u, grad( p[ AA ], x, y, z ), + grad( p[ BA ], xMinus1, y, z ) ), + lerp( u, grad( p[ AB ], x, yMinus1, z ), + grad( p[ BB ], xMinus1, yMinus1, z ) ) ), + lerp( v, lerp( u, grad( p[ AA + 1 ], x, y, zMinus1 ), + grad( p[ BA + 1 ], xMinus1, y, z - 1 ) ), + lerp( u, grad( p[ AB + 1 ], x, yMinus1, zMinus1 ), + grad( p[ BB + 1 ], xMinus1, yMinus1, zMinus1 ) ) ) ); } - } + }; + }; diff --git a/extensions/pom.xml b/extensions/pom.xml index 2f58f0ec..c4532a9f 100644 --- a/extensions/pom.xml +++ b/extensions/pom.xml @@ -5,7 +5,7 @@ org.treblereel.gwt three4g-parent - 0.105-SNAPSHOT + 0.106-SNAPSHOT .. diff --git a/extensions/src/main/java/org/treblereel/gwt/three4g/extensions/loaders/MTLLoader.java b/extensions/src/main/java/org/treblereel/gwt/three4g/extensions/loaders/MTLLoader.java index 76ea8ab9..144f5739 100644 --- a/extensions/src/main/java/org/treblereel/gwt/three4g/extensions/loaders/MTLLoader.java +++ b/extensions/src/main/java/org/treblereel/gwt/three4g/extensions/loaders/MTLLoader.java @@ -6,6 +6,7 @@ import org.treblereel.gwt.three4g.core.PropertyHolder; import org.treblereel.gwt.three4g.loaders.AbstractLoader; import org.treblereel.gwt.three4g.loaders.managers.LoadingManager; +import org.treblereel.gwt.three4g.materials.Material; /** * A loader for loading an .mtl resource, used internaly by OBJLoader. The Material Template Library @@ -59,6 +60,8 @@ public static class MaterialOptions { @JsType(isNative = true, namespace = "THREE.MTLLoader") public static class MaterialCreator extends PropertyHolder { + public Material[] materials; + public MaterialCreator(String baseUrl, MaterialOptions materialOptions) {} public native void preload(); diff --git a/extensions/src/main/java/org/treblereel/gwt/three4g/extensions/quickhull/QuickHull.java b/extensions/src/main/java/org/treblereel/gwt/three4g/extensions/quickhull/ConvexHull.java similarity index 78% rename from extensions/src/main/java/org/treblereel/gwt/three4g/extensions/quickhull/QuickHull.java rename to extensions/src/main/java/org/treblereel/gwt/three4g/extensions/quickhull/ConvexHull.java index 3a3609b3..29b5aa2a 100644 --- a/extensions/src/main/java/org/treblereel/gwt/three4g/extensions/quickhull/QuickHull.java +++ b/extensions/src/main/java/org/treblereel/gwt/three4g/extensions/quickhull/ConvexHull.java @@ -7,14 +7,14 @@ import org.treblereel.gwt.three4g.math.Vector3; /** - * General information about the Quickhull algorithm: Dirk Gregorius. March 2014, Game Developers Conference: Implementing QuickHull. + * General information about the Quickhull algorithm: Dirk Gregorius. March 2014, Game Developers Conference: Implementing ConvexHull. * * @author Dmitrii Tikhomirov * Created by treblereel on 5/25/18. */ -@Three4gElement(paths = "js/quickhull/QuickHull.js") +@Three4gElement(paths = "js/math/ConvexHull.js") @JsType(isNative = true, namespace = "THREE") -public class QuickHull { +public class ConvexHull { /** * The epsilon value that is used for internal comparative operations. The calculation of this value depends on the size of the geometry. Default is -1. @@ -47,7 +47,7 @@ public class QuickHull { public VertexNode[] vertices; - public QuickHull() { + public ConvexHull() { } @@ -55,43 +55,43 @@ public QuickHull() { * Computes to convex hull for the given array of points. * * @param points - Array of Vector3s that the resulting convex hull will contain. - * @return instance of QuickHull + * @return instance of ConvexHull */ - public native QuickHull setFromPoints(Vector3[] points); + public native ConvexHull setFromPoints(Vector3[] points); /** * Computes the convex hull of an Object3D (including its children), accounting for the world transforms of both the object and its childrens. * * @param object - Object3D to compute the convex hull of. - * @return instance of QuickHull + * @return instance of ConvexHull */ - public native QuickHull setFromObject(Object3D object); + public native ConvexHull setFromObject(Object3D object); /** * Makes this convex hull empty. * - * @return instance of QuickHull + * @return instance of ConvexHull */ - public native QuickHull makeEmpty(); + public native ConvexHull makeEmpty(); /** * Adds a vertex to the 'assigned' list of vertices and assigns it to the given face. * * @param vertex - The vetex to add. * @param face - The target face. - * @return instance of QuickHull + * @return instance of ConvexHull */ - public native QuickHull addVertexToFace(VertexNode vertex, Face face); + public native ConvexHull addVertexToFace(VertexNode vertex, Face face); /** * Removes a vertex from the 'assigned' list of vertices and from the given face. It also makes sure that the link from 'face' to the first vertex it sees in 'assigned' is linked correctly after the removal. * * @param vertex - The vetex to remove. * @param face - The target face. - * @return instance of QuickHull + * @return instance of ConvexHull */ - public native QuickHull removeVertexFromFace(VertexNode vertex, Face face); + public native ConvexHull removeVertexFromFace(VertexNode vertex, Face face); /** * Removes all the visible vertices that a given face is able to see which are stored in the 'assigned' vertext list. @@ -110,17 +110,17 @@ public QuickHull() { * * @param face - The given face. * @param absorbingFace - An optional face that tries to absorb the vertices of the first face. - * @return instance of QuickHull + * @return instance of ConvexHull */ - public native QuickHull deleteFaceVertices(Face face, Face absorbingFace); + public native ConvexHull deleteFaceVertices(Face face, Face absorbingFace); /** * Reassigns as many vertices as possible from the unassigned list to the new faces. * * @param newFaces - An array of new faces. - * @return instance of QuickHull + * @return instance of ConvexHull */ - public native QuickHull resolveUnassignedPoints(Face[] newFaces); + public native ConvexHull resolveUnassignedPoints(Face[] newFaces); /** @@ -133,16 +133,16 @@ public QuickHull() { /** * Computes the initial simplex assigning to its faces all the points that are candidates to form part of the hull. * - * @return instance of QuickHull + * @return instance of ConvexHull */ - public native QuickHull computeInitialHull(); + public native ConvexHull computeInitialHull(); /** * Removes inactive (e.g. deleted) faces from the internal face list. * - * @return instance of QuickHull + * @return instance of ConvexHull */ - public native QuickHull reindexFaces(); + public native ConvexHull reindexFaces(); /** * Finds the next vertex to create faces with the current hull. @@ -162,27 +162,27 @@ public QuickHull() { * @param crossEdge - The edge used to jump to the current face. * @param face - The current face being tested. * @param horizon - The edges that form part of the horizon in CCW order. - * @return instance of QuickHull + * @return instance of ConvexHull */ - public native QuickHull computeHorizon(Vector3 eyePoint, HalfEdge crossEdge, Face face, VertexNode[] horizon); + public native ConvexHull computeHorizon(Vector3 eyePoint, HalfEdge crossEdge, Face face, VertexNode[] horizon); /** * Creates a face with the vertices 'eyeVertex.point', 'horizonEdge.tail' and 'horizonEdge.head' in CCW order. All the half edges are created in CCW order thus the face is always pointing outside the hull * * @param eyeVertex - The vertex that is added to the hull. * @param horizonEdge - A single edge of the horizon. - * @return instance of QuickHull + * @return instance of ConvexHull */ - public native QuickHull addAdjoiningFace(VertexNode eyeVertex, HalfEdge horizonEdge); + public native ConvexHull addAdjoiningFace(VertexNode eyeVertex, HalfEdge horizonEdge); /** * Adds 'horizon.length' faces to the hull, each face will be linked with the horizon opposite face and the face on the left/right. * * @param eyeVertex - The vertex that is added to the hull. * @param horizonEdge - An array of half-edges that form the horizon. - * @return instance of QuickHull + * @return instance of ConvexHull */ - public native QuickHull addNewFaces(VertexNode eyeVertex, HalfEdge[] horizonEdge); + public native ConvexHull addNewFaces(VertexNode eyeVertex, HalfEdge[] horizonEdge); /** * Adds a vertex to the hull with the following algorithm @@ -193,23 +193,23 @@ public QuickHull() { * The vertices removed from all the visible faces are assigned to the new faces if possible. * * @param eyeVertex - The vertex that is added to the hull. - * @return instance of QuickHull + * @return instance of ConvexHull */ - public native QuickHull addVertexToHull(VertexNode eyeVertex); + public native ConvexHull addVertexToHull(VertexNode eyeVertex); /** * Cleans up internal properties after computing the convex hull. * - * @return instance of QuickHull + * @return instance of ConvexHull */ - public native QuickHull cleanup(); + public native ConvexHull cleanup(); /** * Starts the execution of the quick hull algorithm. * - * @return instance of QuickHull + * @return instance of ConvexHull */ - public native QuickHull compute(); + public native ConvexHull compute(); public native boolean containsPoint(Ray ray, Vector3 target); } diff --git a/extensions/src/main/java/org/treblereel/gwt/three4g/extensions/quickhull/Face.java b/extensions/src/main/java/org/treblereel/gwt/three4g/extensions/quickhull/Face.java index 20c29a12..1daffce9 100644 --- a/extensions/src/main/java/org/treblereel/gwt/three4g/extensions/quickhull/Face.java +++ b/extensions/src/main/java/org/treblereel/gwt/three4g/extensions/quickhull/Face.java @@ -10,7 +10,7 @@ * @author Dmitrii Tikhomirov * Created by treblereel on 5/25/18. */ -@Three4gElement(paths = "js/quickhull/QuickHull.js") +@Three4gElement(paths = "js/quickhull/ConvexHull.js") @JsType(isNative = true, namespace = "THREE") public class Face { diff --git a/extensions/src/main/java/org/treblereel/gwt/three4g/extensions/quickhull/HalfEdge.java b/extensions/src/main/java/org/treblereel/gwt/three4g/extensions/quickhull/HalfEdge.java index cdfb0af1..2bd717c6 100644 --- a/extensions/src/main/java/org/treblereel/gwt/three4g/extensions/quickhull/HalfEdge.java +++ b/extensions/src/main/java/org/treblereel/gwt/three4g/extensions/quickhull/HalfEdge.java @@ -9,7 +9,7 @@ * @author Dmitrii Tikhomirov * Created by treblereel on 5/25/18. */ -@Three4gElement(paths = "js/quickhull/QuickHull.js") +@Three4gElement(paths = "js/quickhull/ConvexHull.js") @JsType(isNative = true, namespace = "THREE") public class HalfEdge { diff --git a/extensions/src/main/java/org/treblereel/gwt/three4g/extensions/quickhull/VertexList.java b/extensions/src/main/java/org/treblereel/gwt/three4g/extensions/quickhull/VertexList.java index 0ac19cc2..d432f5b3 100644 --- a/extensions/src/main/java/org/treblereel/gwt/three4g/extensions/quickhull/VertexList.java +++ b/extensions/src/main/java/org/treblereel/gwt/three4g/extensions/quickhull/VertexList.java @@ -9,7 +9,7 @@ * @author Dmitrii Tikhomirov * Created by treblereel on 5/25/18. */ -@Three4gElement(paths = "js/quickhull/QuickHull.js") +@Three4gElement(paths = "js/quickhull/ConvexHull.js") @JsType(isNative = true, namespace = "THREE") public class VertexList { diff --git a/extensions/src/main/java/org/treblereel/gwt/three4g/extensions/quickhull/VertexNode.java b/extensions/src/main/java/org/treblereel/gwt/three4g/extensions/quickhull/VertexNode.java index dc989337..49373775 100644 --- a/extensions/src/main/java/org/treblereel/gwt/three4g/extensions/quickhull/VertexNode.java +++ b/extensions/src/main/java/org/treblereel/gwt/three4g/extensions/quickhull/VertexNode.java @@ -10,7 +10,7 @@ * @author Dmitrii Tikhomirov * Created by treblereel on 5/25/18. */ -@Three4gElement(paths = "js/quickhull/QuickHull.js") +@Three4gElement(paths = "js/quickhull/ConvexHull.js") @JsType(isNative = true, namespace = "THREE") public class VertexNode { diff --git a/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/cameras/CinematicCamera.js b/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/cameras/CinematicCamera.js index 6aa37043..d679baa0 100644 --- a/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/cameras/CinematicCamera.js +++ b/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/cameras/CinematicCamera.js @@ -186,14 +186,14 @@ THREE.CinematicCamera.prototype.renderCinematic = function ( scene, renderer ) { scene.overrideMaterial = null; renderer.setRenderTarget( this.postprocessing.rtTextureColor ); renderer.clear(); - renderer.render( scene, camera ); + renderer.render( scene, this ); // Render depth into texture scene.overrideMaterial = this.materialDepth; renderer.setRenderTarget( this.postprocessing.rtTextureDepth ); renderer.clear(); - renderer.render( scene, camera ); + renderer.render( scene, this ); // Render bokeh composite diff --git a/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/controls/DragControls.js b/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/controls/DragControls.js index a461d855..a872e19a 100644 --- a/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/controls/DragControls.js +++ b/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/controls/DragControls.js @@ -21,7 +21,7 @@ THREE.DragControls = function ( _objects, _camera, _domElement ) { var _intersection = new THREE.Vector3(); var _worldPosition = new THREE.Vector3(); var _inverseMatrix = new THREE.Matrix4(); - + var _selected = null, _hovered = null; // diff --git a/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/controls/PointerLockControls.js b/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/controls/PointerLockControls.js index 56d579ac..b048e291 100644 --- a/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/controls/PointerLockControls.js +++ b/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/controls/PointerLockControls.js @@ -5,11 +5,19 @@ THREE.PointerLockControls = function ( camera, domElement ) { - var scope = this; - this.domElement = domElement || document.body; this.isLocked = false; + // + // internals + // + + var scope = this; + + var changeEvent = { type: 'change' }; + var lockEvent = { type: 'lock' }; + var unlockEvent = { type: 'unlock' }; + var euler = new THREE.Euler( 0, 0, 0, 'YXZ' ); var PI_2 = Math.PI / 2; @@ -30,19 +38,21 @@ THREE.PointerLockControls = function ( camera, domElement ) { camera.quaternion.setFromEuler( euler ); + scope.dispatchEvent( changeEvent ); + } function onPointerlockChange() { if ( document.pointerLockElement === scope.domElement ) { - scope.dispatchEvent( { type: 'lock' } ); + scope.dispatchEvent( lockEvent ); scope.isLocked = true; } else { - scope.dispatchEvent( { type: 'unlock' } ); + scope.dispatchEvent( unlockEvent ); scope.isLocked = false; diff --git a/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/controls/TrackballControls.js b/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/controls/TrackballControls.js index 9810114f..14beb3b0 100644 --- a/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/controls/TrackballControls.js +++ b/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/controls/TrackballControls.js @@ -492,7 +492,7 @@ THREE.TrackballControls = function ( object, domElement ) { function touchstart( event ) { if ( _this.enabled === false ) return; - + event.preventDefault(); switch ( event.touches.length ) { diff --git a/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/effects/OutlineEffect.js b/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/effects/OutlineEffect.js index b5eee2d7..fe06cd93 100644 --- a/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/effects/OutlineEffect.js +++ b/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/effects/OutlineEffect.js @@ -108,8 +108,6 @@ THREE.OutlineEffect = function ( renderer, parameters ) { var vertexShaderChunk = [ - "#include ", - "uniform float outlineThickness;", "vec4 calculateOutline( vec4 pos, vec3 objectNormal, vec4 skinned ) {", @@ -175,7 +173,6 @@ THREE.OutlineEffect = function ( renderer, parameters ) { var shaderID = shaderIDs[ originalMaterial.type ]; var originalUniforms, originalVertexShader; - var outlineParameters = originalMaterial.userData.outlineParameters; if ( shaderID !== undefined ) { @@ -212,15 +209,15 @@ THREE.OutlineEffect = function ( renderer, parameters ) { var uniforms = Object.assign( {}, originalUniforms, uniformsChunk ); var vertexShader = originalVertexShader - // put vertexShaderChunk right before "void main() {...}" - .replace( /void\s+main\s*\(\s*\)/, vertexShaderChunk + '\nvoid main()' ) - // put vertexShaderChunk2 the end of "void main() {...}" - // Note: here assums originalVertexShader ends with "}" of "void main() {...}" - .replace( /\}\s*$/, vertexShaderChunk2 + '\n}' ) - // remove any light related lines - // Note: here is very sensitive to originalVertexShader - // TODO: consider safer way - .replace( /#include\s+<[\w_]*light[\w_]*>/g, '' ); + // put vertexShaderChunk right before "void main() {...}" + .replace( /void\s+main\s*\(\s*\)/, vertexShaderChunk + '\nvoid main()' ) + // put vertexShaderChunk2 the end of "void main() {...}" + // Note: here assums originalVertexShader ends with "}" of "void main() {...}" + .replace( /\}\s*$/, vertexShaderChunk2 + '\n}' ) + // remove any light related lines + // Note: here is very sensitive to originalVertexShader + // TODO: consider safer way + .replace( /#include\s+<[\w_]*light[\w_]*>/g, '' ); var defines = {}; @@ -322,7 +319,7 @@ THREE.OutlineEffect = function ( renderer, parameters ) { } - function onBeforeRender( renderer, scene, camera, geometry, material, group ) { + function onBeforeRender( renderer, scene, camera, geometry, material ) { var originalMaterial = originalMaterials[ material.uuid ]; @@ -418,7 +415,7 @@ THREE.OutlineEffect = function ( renderer, parameters ) { if ( cache[ key ].used === false ) { - cache[ key ].count++; + cache[ key ].count ++; if ( cache[ key ].keepAlive === false && cache[ key ].count > removeThresholdCount ) { @@ -439,7 +436,7 @@ THREE.OutlineEffect = function ( renderer, parameters ) { this.render = function ( scene, camera ) { - var renderTarget = null; + var renderTarget; var forceClear = false; if ( arguments[ 2 ] !== undefined ) { @@ -456,7 +453,7 @@ THREE.OutlineEffect = function ( renderer, parameters ) { } - renderer.setRenderTarget( renderTarget ); + if ( renderTarget !== undefined ) renderer.setRenderTarget( renderTarget ); if ( forceClear ) renderer.clear(); diff --git a/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/exporters/GLTFExporter.js b/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/exporters/GLTFExporter.js index e3b3ff59..7f4dae17 100644 --- a/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/exporters/GLTFExporter.js +++ b/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/exporters/GLTFExporter.js @@ -1740,7 +1740,12 @@ THREE.GLTFExporter.prototype = { } else { - object.updateMatrix(); + if ( object.matrixAutoUpdate ) { + + object.updateMatrix(); + + } + if ( ! equalArray( object.matrix.elements, [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ] ) ) { gltfNode.matrix = object.matrix.elements; diff --git a/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/geometries/BoxLineGeometry.js b/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/geometries/BoxLineGeometry.js index 4c7ed506..dfc9e147 100644 --- a/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/geometries/BoxLineGeometry.js +++ b/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/geometries/BoxLineGeometry.js @@ -28,10 +28,10 @@ THREE.BoxLineGeometry = function ( width, height, depth, widthSegments, heightSe for ( var i = 0; i <= widthSegments; i ++ ) { - vertices.push( x, - heightHalf, - depthHalf, x, heightHalf, - depthHalf ); - vertices.push( x, heightHalf, - depthHalf, x, heightHalf, depthHalf ); - vertices.push( x, heightHalf, depthHalf, x, - heightHalf, depthHalf ); - vertices.push( x, - heightHalf, depthHalf, x, - heightHalf, - depthHalf ); + vertices.push( x, - heightHalf, - depthHalf, x, heightHalf, - depthHalf ); + vertices.push( x, heightHalf, - depthHalf, x, heightHalf, depthHalf ); + vertices.push( x, heightHalf, depthHalf, x, - heightHalf, depthHalf ); + vertices.push( x, - heightHalf, depthHalf, x, - heightHalf, - depthHalf ); x += segmentWidth; @@ -39,10 +39,10 @@ THREE.BoxLineGeometry = function ( width, height, depth, widthSegments, heightSe for ( var i = 0; i <= heightSegments; i ++ ) { - vertices.push( - widthHalf, y, - depthHalf, widthHalf, y, - depthHalf ); - vertices.push( widthHalf, y, - depthHalf, widthHalf, y, depthHalf ); - vertices.push( widthHalf, y, depthHalf, - widthHalf, y, depthHalf ); - vertices.push( - widthHalf, y, depthHalf, - widthHalf, y, - depthHalf ); + vertices.push( - widthHalf, y, - depthHalf, widthHalf, y, - depthHalf ); + vertices.push( widthHalf, y, - depthHalf, widthHalf, y, depthHalf ); + vertices.push( widthHalf, y, depthHalf, - widthHalf, y, depthHalf ); + vertices.push( - widthHalf, y, depthHalf, - widthHalf, y, - depthHalf ); y += segmentHeight; @@ -50,10 +50,10 @@ THREE.BoxLineGeometry = function ( width, height, depth, widthSegments, heightSe for ( var i = 0; i <= depthSegments; i ++ ) { - vertices.push( - widthHalf, - heightHalf, z, - widthHalf, heightHalf, z ); - vertices.push( - widthHalf, heightHalf, z, widthHalf, heightHalf, z ); - vertices.push( widthHalf, heightHalf, z, widthHalf, - heightHalf, z ); - vertices.push( widthHalf, - heightHalf, z, - widthHalf, - heightHalf, z ); + vertices.push( - widthHalf, - heightHalf, z, - widthHalf, heightHalf, z ); + vertices.push( - widthHalf, heightHalf, z, widthHalf, heightHalf, z ); + vertices.push( widthHalf, heightHalf, z, widthHalf, - heightHalf, z ); + vertices.push( widthHalf, - heightHalf, z, - widthHalf, - heightHalf, z ); z += segmentDepth; @@ -61,7 +61,7 @@ THREE.BoxLineGeometry = function ( width, height, depth, widthSegments, heightSe this.addAttribute( 'position', new THREE.Float32BufferAttribute( vertices, 3 ) ); -} +}; THREE.BoxLineGeometry.prototype = Object.create( THREE.BufferGeometry.prototype ); THREE.BoxLineGeometry.prototype.constructor = THREE.BoxLineGeometry; diff --git a/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/geometries/ConvexGeometry.js b/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/geometries/ConvexGeometry.js index 296f03e7..392bcf86 100644 --- a/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/geometries/ConvexGeometry.js +++ b/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/geometries/ConvexGeometry.js @@ -2,80 +2,69 @@ * @author Mugen87 / https://github.com/Mugen87 */ -( function () { +// ConvexGeometry - // ConvexGeometry +THREE.ConvexGeometry = function ( points ) { - function ConvexGeometry( points ) { + THREE.Geometry.call( this ); - THREE.Geometry.call( this ); + this.fromBufferGeometry( new THREE.ConvexBufferGeometry( points ) ); + this.mergeVertices(); - this.fromBufferGeometry( new ConvexBufferGeometry( points ) ); - this.mergeVertices(); +}; - } - - ConvexGeometry.prototype = Object.create( THREE.Geometry.prototype ); - ConvexGeometry.prototype.constructor = ConvexGeometry; - - // ConvexBufferGeometry - - function ConvexBufferGeometry( points ) { +THREE.ConvexGeometry.prototype = Object.create( THREE.Geometry.prototype ); +THREE.ConvexGeometry.prototype.constructor = THREE.ConvexGeometry; - THREE.BufferGeometry.call( this ); +// ConvexBufferGeometry - // buffers +THREE.ConvexBufferGeometry = function ( points ) { - var vertices = []; - var normals = []; + THREE.BufferGeometry.call( this ); - // execute QuickHull + // buffers - if ( THREE.QuickHull === undefined ) { + var vertices = []; + var normals = []; - console.error( 'THREE.ConvexBufferGeometry: ConvexBufferGeometry relies on THREE.QuickHull' ); + if ( THREE.ConvexHull === undefined ) { - } + console.error( 'THREE.ConvexBufferGeometry: ConvexBufferGeometry relies on THREE.ConvexHull' ); - var quickHull = new THREE.QuickHull().setFromPoints( points ); - - // generate vertices and normals - - var faces = quickHull.faces; + } - for ( var i = 0; i < faces.length; i ++ ) { + var convexHull = new THREE.ConvexHull().setFromPoints( points ); - var face = faces[ i ]; - var edge = face.edge; + // generate vertices and normals - // we move along a doubly-connected edge list to access all face points (see HalfEdge docs) + var faces = convexHull.faces; - do { + for ( var i = 0; i < faces.length; i ++ ) { - var point = edge.head().point; + var face = faces[ i ]; + var edge = face.edge; - vertices.push( point.x, point.y, point.z ); - normals.push( face.normal.x, face.normal.y, face.normal.z ); + // we move along a doubly-connected edge list to access all face points (see HalfEdge docs) - edge = edge.next; + do { - } while ( edge !== face.edge ); + var point = edge.head().point; - } + vertices.push( point.x, point.y, point.z ); + normals.push( face.normal.x, face.normal.y, face.normal.z ); - // build geometry + edge = edge.next; - this.addAttribute( 'position', new THREE.Float32BufferAttribute( vertices, 3 ) ); - this.addAttribute( 'normal', new THREE.Float32BufferAttribute( normals, 3 ) ); + } while ( edge !== face.edge ); } - ConvexBufferGeometry.prototype = Object.create( THREE.BufferGeometry.prototype ); - ConvexBufferGeometry.prototype.constructor = ConvexBufferGeometry; + // build geometry - // export + this.addAttribute( 'position', new THREE.Float32BufferAttribute( vertices, 3 ) ); + this.addAttribute( 'normal', new THREE.Float32BufferAttribute( normals, 3 ) ); - THREE.ConvexGeometry = ConvexGeometry; - THREE.ConvexBufferGeometry = ConvexBufferGeometry; +}; -} )(); +THREE.ConvexBufferGeometry.prototype = Object.create( THREE.BufferGeometry.prototype ); +THREE.ConvexBufferGeometry.prototype.constructor = THREE.ConvexBufferGeometry; diff --git a/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/geometries/DecalGeometry.js b/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/geometries/DecalGeometry.js index 09d1e99a..1e88ccfd 100644 --- a/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/geometries/DecalGeometry.js +++ b/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/geometries/DecalGeometry.js @@ -16,342 +16,334 @@ * */ -( function () { +THREE.DecalGeometry = function ( mesh, position, orientation, size ) { - function DecalGeometry( mesh, position, orientation, size ) { + THREE.BufferGeometry.call( this ); - THREE.BufferGeometry.call( this ); + // buffers - // buffers + var vertices = []; + var normals = []; + var uvs = []; - var vertices = []; - var normals = []; - var uvs = []; + // helpers - // helpers + var plane = new THREE.Vector3(); - var plane = new THREE.Vector3(); + // this matrix represents the transformation of the decal projector - // this matrix represents the transformation of the decal projector + var projectorMatrix = new THREE.Matrix4(); + projectorMatrix.makeRotationFromEuler( orientation ); + projectorMatrix.setPosition( position ); - var projectorMatrix = new THREE.Matrix4(); - projectorMatrix.makeRotationFromEuler( orientation ); - projectorMatrix.setPosition( position ); + var projectorMatrixInverse = new THREE.Matrix4().getInverse( projectorMatrix ); - var projectorMatrixInverse = new THREE.Matrix4().getInverse( projectorMatrix ); + // generate buffers - // generate buffers + generate(); - generate(); + // build geometry - // build geometry + this.addAttribute( 'position', new THREE.Float32BufferAttribute( vertices, 3 ) ); + this.addAttribute( 'normal', new THREE.Float32BufferAttribute( normals, 3 ) ); + this.addAttribute( 'uv', new THREE.Float32BufferAttribute( uvs, 2 ) ); - this.addAttribute( 'position', new THREE.Float32BufferAttribute( vertices, 3 ) ); - this.addAttribute( 'normal', new THREE.Float32BufferAttribute( normals, 3 ) ); - this.addAttribute( 'uv', new THREE.Float32BufferAttribute( uvs, 2 ) ); + function generate() { - function generate() { + var i; + var geometry = new THREE.BufferGeometry(); + var decalVertices = []; - var i; - var geometry = new THREE.BufferGeometry(); - var decalVertices = []; + var vertex = new THREE.Vector3(); + var normal = new THREE.Vector3(); - var vertex = new THREE.Vector3(); - var normal = new THREE.Vector3(); + // handle different geometry types - // handle different geometry types + if ( mesh.geometry.isGeometry ) { - if ( mesh.geometry.isGeometry ) { + geometry.fromGeometry( mesh.geometry ); - geometry.fromGeometry( mesh.geometry ); + } else { - } else { + geometry.copy( mesh.geometry ); - geometry.copy( mesh.geometry ); - - } + } - var positionAttribute = geometry.attributes.position; - var normalAttribute = geometry.attributes.normal; + var positionAttribute = geometry.attributes.position; + var normalAttribute = geometry.attributes.normal; - // first, create an array of 'DecalVertex' objects - // three consecutive 'DecalVertex' objects represent a single face - // - // this data structure will be later used to perform the clipping + // first, create an array of 'DecalVertex' objects + // three consecutive 'DecalVertex' objects represent a single face + // + // this data structure will be later used to perform the clipping - if ( geometry.index !== null ) { + if ( geometry.index !== null ) { - // indexed BufferGeometry + // indexed BufferGeometry - var index = geometry.index; + var index = geometry.index; - for ( i = 0; i < index.count; i ++ ) { + for ( i = 0; i < index.count; i ++ ) { - vertex.fromBufferAttribute( positionAttribute, index.getX( i ) ); - normal.fromBufferAttribute( normalAttribute, index.getX( i ) ); + vertex.fromBufferAttribute( positionAttribute, index.getX( i ) ); + normal.fromBufferAttribute( normalAttribute, index.getX( i ) ); - pushDecalVertex( decalVertices, vertex, normal ); + pushDecalVertex( decalVertices, vertex, normal ); - } - - } else { + } - // non-indexed BufferGeometry + } else { - for ( i = 0; i < positionAttribute.count; i ++ ) { + // non-indexed BufferGeometry - vertex.fromBufferAttribute( positionAttribute, i ); - normal.fromBufferAttribute( normalAttribute, i ); + for ( i = 0; i < positionAttribute.count; i ++ ) { - pushDecalVertex( decalVertices, vertex, normal ); + vertex.fromBufferAttribute( positionAttribute, i ); + normal.fromBufferAttribute( normalAttribute, i ); - } + pushDecalVertex( decalVertices, vertex, normal ); } - // second, clip the geometry so that it doesn't extend out from the projector - - decalVertices = clipGeometry( decalVertices, plane.set( 1, 0, 0 ) ); - decalVertices = clipGeometry( decalVertices, plane.set( - 1, 0, 0 ) ); - decalVertices = clipGeometry( decalVertices, plane.set( 0, 1, 0 ) ); - decalVertices = clipGeometry( decalVertices, plane.set( 0, - 1, 0 ) ); - decalVertices = clipGeometry( decalVertices, plane.set( 0, 0, 1 ) ); - decalVertices = clipGeometry( decalVertices, plane.set( 0, 0, - 1 ) ); - - // third, generate final vertices, normals and uvs - - for ( i = 0; i < decalVertices.length; i ++ ) { - - var decalVertex = decalVertices[ i ]; - - // create texture coordinates (we are still in projector space) + } - uvs.push( - 0.5 + ( decalVertex.position.x / size.x ), - 0.5 + ( decalVertex.position.y / size.y ) - ); + // second, clip the geometry so that it doesn't extend out from the projector - // transform the vertex back to world space + decalVertices = clipGeometry( decalVertices, plane.set( 1, 0, 0 ) ); + decalVertices = clipGeometry( decalVertices, plane.set( - 1, 0, 0 ) ); + decalVertices = clipGeometry( decalVertices, plane.set( 0, 1, 0 ) ); + decalVertices = clipGeometry( decalVertices, plane.set( 0, - 1, 0 ) ); + decalVertices = clipGeometry( decalVertices, plane.set( 0, 0, 1 ) ); + decalVertices = clipGeometry( decalVertices, plane.set( 0, 0, - 1 ) ); - decalVertex.position.applyMatrix4( projectorMatrix ); + // third, generate final vertices, normals and uvs - // now create vertex and normal buffer data + for ( i = 0; i < decalVertices.length; i ++ ) { - vertices.push( decalVertex.position.x, decalVertex.position.y, decalVertex.position.z ); - normals.push( decalVertex.normal.x, decalVertex.normal.y, decalVertex.normal.z ); + var decalVertex = decalVertices[ i ]; - } + // create texture coordinates (we are still in projector space) - } + uvs.push( + 0.5 + ( decalVertex.position.x / size.x ), + 0.5 + ( decalVertex.position.y / size.y ) + ); - function pushDecalVertex( decalVertices, vertex, normal ) { + // transform the vertex back to world space - // transform the vertex to world space, then to projector space + decalVertex.position.applyMatrix4( projectorMatrix ); - vertex.applyMatrix4( mesh.matrixWorld ); - vertex.applyMatrix4( projectorMatrixInverse ); + // now create vertex and normal buffer data - decalVertices.push( new DecalVertex( vertex.clone(), normal.clone() ) ); + vertices.push( decalVertex.position.x, decalVertex.position.y, decalVertex.position.z ); + normals.push( decalVertex.normal.x, decalVertex.normal.y, decalVertex.normal.z ); } - function clipGeometry( inVertices, plane ) { + } - var outVertices = []; + function pushDecalVertex( decalVertices, vertex, normal ) { - var s = 0.5 * Math.abs( size.dot( plane ) ); + // transform the vertex to world space, then to projector space - // a single iteration clips one face, - // which consists of three consecutive 'DecalVertex' objects + vertex.applyMatrix4( mesh.matrixWorld ); + vertex.applyMatrix4( projectorMatrixInverse ); - for ( var i = 0; i < inVertices.length; i += 3 ) { + decalVertices.push( new THREE.DecalVertex( vertex.clone(), normal.clone() ) ); - var v1Out, v2Out, v3Out, total = 0; - var nV1, nV2, nV3, nV4; + } - var d1 = inVertices[ i + 0 ].position.dot( plane ) - s; - var d2 = inVertices[ i + 1 ].position.dot( plane ) - s; - var d3 = inVertices[ i + 2 ].position.dot( plane ) - s; + function clipGeometry( inVertices, plane ) { - v1Out = d1 > 0; - v2Out = d2 > 0; - v3Out = d3 > 0; + var outVertices = []; - // calculate, how many vertices of the face lie outside of the clipping plane + var s = 0.5 * Math.abs( size.dot( plane ) ); - total = ( v1Out ? 1 : 0 ) + ( v2Out ? 1 : 0 ) + ( v3Out ? 1 : 0 ); + // a single iteration clips one face, + // which consists of three consecutive 'DecalVertex' objects - switch ( total ) { + for ( var i = 0; i < inVertices.length; i += 3 ) { - case 0: { + var v1Out, v2Out, v3Out, total = 0; + var nV1, nV2, nV3, nV4; - // the entire face lies inside of the plane, no clipping needed + var d1 = inVertices[ i + 0 ].position.dot( plane ) - s; + var d2 = inVertices[ i + 1 ].position.dot( plane ) - s; + var d3 = inVertices[ i + 2 ].position.dot( plane ) - s; - outVertices.push( inVertices[ i ] ); - outVertices.push( inVertices[ i + 1 ] ); - outVertices.push( inVertices[ i + 2 ] ); - break; + v1Out = d1 > 0; + v2Out = d2 > 0; + v3Out = d3 > 0; - } + // calculate, how many vertices of the face lie outside of the clipping plane - case 1: { + total = ( v1Out ? 1 : 0 ) + ( v2Out ? 1 : 0 ) + ( v3Out ? 1 : 0 ); - // one vertex lies outside of the plane, perform clipping + switch ( total ) { - if ( v1Out ) { + case 0: { - nV1 = inVertices[ i + 1 ]; - nV2 = inVertices[ i + 2 ]; - nV3 = clip( inVertices[ i ], nV1, plane, s ); - nV4 = clip( inVertices[ i ], nV2, plane, s ); + // the entire face lies inside of the plane, no clipping needed - } + outVertices.push( inVertices[ i ] ); + outVertices.push( inVertices[ i + 1 ] ); + outVertices.push( inVertices[ i + 2 ] ); + break; - if ( v2Out ) { + } - nV1 = inVertices[ i ]; - nV2 = inVertices[ i + 2 ]; - nV3 = clip( inVertices[ i + 1 ], nV1, plane, s ); - nV4 = clip( inVertices[ i + 1 ], nV2, plane, s ); + case 1: { - outVertices.push( nV3 ); - outVertices.push( nV2.clone() ); - outVertices.push( nV1.clone() ); + // one vertex lies outside of the plane, perform clipping - outVertices.push( nV2.clone() ); - outVertices.push( nV3.clone() ); - outVertices.push( nV4 ); - break; + if ( v1Out ) { - } + nV1 = inVertices[ i + 1 ]; + nV2 = inVertices[ i + 2 ]; + nV3 = clip( inVertices[ i ], nV1, plane, s ); + nV4 = clip( inVertices[ i ], nV2, plane, s ); - if ( v3Out ) { + } - nV1 = inVertices[ i ]; - nV2 = inVertices[ i + 1 ]; - nV3 = clip( inVertices[ i + 2 ], nV1, plane, s ); - nV4 = clip( inVertices[ i + 2 ], nV2, plane, s ); + if ( v2Out ) { - } + nV1 = inVertices[ i ]; + nV2 = inVertices[ i + 2 ]; + nV3 = clip( inVertices[ i + 1 ], nV1, plane, s ); + nV4 = clip( inVertices[ i + 1 ], nV2, plane, s ); - outVertices.push( nV1.clone() ); - outVertices.push( nV2.clone() ); outVertices.push( nV3 ); - - outVertices.push( nV4 ); - outVertices.push( nV3.clone() ); outVertices.push( nV2.clone() ); + outVertices.push( nV1.clone() ); + outVertices.push( nV2.clone() ); + outVertices.push( nV3.clone() ); + outVertices.push( nV4 ); break; } - case 2: { + if ( v3Out ) { - // two vertices lies outside of the plane, perform clipping + nV1 = inVertices[ i ]; + nV2 = inVertices[ i + 1 ]; + nV3 = clip( inVertices[ i + 2 ], nV1, plane, s ); + nV4 = clip( inVertices[ i + 2 ], nV2, plane, s ); - if ( ! v1Out ) { - - nV1 = inVertices[ i ].clone(); - nV2 = clip( nV1, inVertices[ i + 1 ], plane, s ); - nV3 = clip( nV1, inVertices[ i + 2 ], plane, s ); - outVertices.push( nV1 ); - outVertices.push( nV2 ); - outVertices.push( nV3 ); + } - } + outVertices.push( nV1.clone() ); + outVertices.push( nV2.clone() ); + outVertices.push( nV3 ); - if ( ! v2Out ) { + outVertices.push( nV4 ); + outVertices.push( nV3.clone() ); + outVertices.push( nV2.clone() ); - nV1 = inVertices[ i + 1 ].clone(); - nV2 = clip( nV1, inVertices[ i + 2 ], plane, s ); - nV3 = clip( nV1, inVertices[ i ], plane, s ); - outVertices.push( nV1 ); - outVertices.push( nV2 ); - outVertices.push( nV3 ); + break; - } + } - if ( ! v3Out ) { + case 2: { - nV1 = inVertices[ i + 2 ].clone(); - nV2 = clip( nV1, inVertices[ i ], plane, s ); - nV3 = clip( nV1, inVertices[ i + 1 ], plane, s ); - outVertices.push( nV1 ); - outVertices.push( nV2 ); - outVertices.push( nV3 ); + // two vertices lies outside of the plane, perform clipping - } + if ( ! v1Out ) { - break; + nV1 = inVertices[ i ].clone(); + nV2 = clip( nV1, inVertices[ i + 1 ], plane, s ); + nV3 = clip( nV1, inVertices[ i + 2 ], plane, s ); + outVertices.push( nV1 ); + outVertices.push( nV2 ); + outVertices.push( nV3 ); } - case 3: { + if ( ! v2Out ) { - // the entire face lies outside of the plane, so let's discard the corresponding vertices - - break; + nV1 = inVertices[ i + 1 ].clone(); + nV2 = clip( nV1, inVertices[ i + 2 ], plane, s ); + nV3 = clip( nV1, inVertices[ i ], plane, s ); + outVertices.push( nV1 ); + outVertices.push( nV2 ); + outVertices.push( nV3 ); } - } + if ( ! v3Out ) { - } + nV1 = inVertices[ i + 2 ].clone(); + nV2 = clip( nV1, inVertices[ i ], plane, s ); + nV3 = clip( nV1, inVertices[ i + 1 ], plane, s ); + outVertices.push( nV1 ); + outVertices.push( nV2 ); + outVertices.push( nV3 ); - return outVertices; + } - } + break; - function clip( v0, v1, p, s ) { + } - var d0 = v0.position.dot( p ) - s; - var d1 = v1.position.dot( p ) - s; + case 3: { - var s0 = d0 / ( d0 - d1 ); + // the entire face lies outside of the plane, so let's discard the corresponding vertices - var v = new DecalVertex( - new THREE.Vector3( - v0.position.x + s0 * ( v1.position.x - v0.position.x ), - v0.position.y + s0 * ( v1.position.y - v0.position.y ), - v0.position.z + s0 * ( v1.position.z - v0.position.z ) - ), - new THREE.Vector3( - v0.normal.x + s0 * ( v1.normal.x - v0.normal.x ), - v0.normal.y + s0 * ( v1.normal.y - v0.normal.y ), - v0.normal.z + s0 * ( v1.normal.z - v0.normal.z ) - ) - ); + break; - // need to clip more values (texture coordinates)? do it this way: - // intersectpoint.value = a.value + s * ( b.value - a.value ); + } - return v; + } } + return outVertices; + } - DecalGeometry.prototype = Object.create( THREE.BufferGeometry.prototype ); - DecalGeometry.prototype.constructor = DecalGeometry; + function clip( v0, v1, p, s ) { + + var d0 = v0.position.dot( p ) - s; + var d1 = v1.position.dot( p ) - s; + + var s0 = d0 / ( d0 - d1 ); - // helper + var v = new THREE.DecalVertex( + new THREE.Vector3( + v0.position.x + s0 * ( v1.position.x - v0.position.x ), + v0.position.y + s0 * ( v1.position.y - v0.position.y ), + v0.position.z + s0 * ( v1.position.z - v0.position.z ) + ), + new THREE.Vector3( + v0.normal.x + s0 * ( v1.normal.x - v0.normal.x ), + v0.normal.y + s0 * ( v1.normal.y - v0.normal.y ), + v0.normal.z + s0 * ( v1.normal.z - v0.normal.z ) + ) + ); - function DecalVertex( position, normal ) { + // need to clip more values (texture coordinates)? do it this way: + // intersectpoint.value = a.value + s * ( b.value - a.value ); - this.position = position; - this.normal = normal; + return v; } - DecalVertex.prototype.clone = function () { +}; + +THREE.DecalGeometry.prototype = Object.create( THREE.BufferGeometry.prototype ); +THREE.DecalGeometry.prototype.constructor = THREE.DecalGeometry; + +// helper + +THREE.DecalVertex = function ( position, normal ) { - return new DecalVertex( this.position.clone(), this.normal.clone() ); + this.position = position; + this.normal = normal; - }; +}; - // export +THREE.DecalVertex.prototype.clone = function () { - THREE.DecalGeometry = DecalGeometry; + return new this.constructor( this.position.clone(), this.normal.clone() ); -} )(); +}; diff --git a/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/loaders/3MFLoader.js b/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/loaders/3MFLoader.js index 31ce4066..7d9caeb4 100644 --- a/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/loaders/3MFLoader.js +++ b/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/loaders/3MFLoader.js @@ -1,5 +1,17 @@ /** * @author technohippy / https://github.com/technohippy + * @author Mugen87 / https://github.com/Mugen87 + * + * 3D Manufacturing Format (3MF) specification: https://3mf.io/specification/ + * + * The following features from the core specification are supported: + * + * - 3D Models + * - Object Resources (Meshes and Components) + * - Material Resources (Base Materials) + * + * 3MF Materials and Properties Extension (e.g. textures) are not yet supported. + * */ THREE.ThreeMFLoader = function ( manager ) { @@ -63,7 +75,7 @@ THREE.ThreeMFLoader.prototype = { if ( e instanceof ReferenceError ) { - console.error( 'THREE.ThreeMFLoader: jszip missing and file is compressed.' ); + console.error( 'THREE.3MFLoader: jszip missing and file is compressed.' ); return null; } @@ -72,7 +84,7 @@ THREE.ThreeMFLoader.prototype = { for ( file in zip.files ) { - if ( file.match( /\.rels$/ ) ) { + if ( file.match( /\_rels\/.rels$/ ) ) { relsName = file; @@ -110,7 +122,7 @@ THREE.ThreeMFLoader.prototype = { if ( xmlData.documentElement.nodeName.toLowerCase() !== 'model' ) { - console.error( 'THREE.ThreeMFLoader: Error loading 3MF - no 3MF document found: ', modelPart ); + console.error( 'THREE.3MFLoader: Error loading 3MF - no 3MF document found: ', modelPart ); } @@ -206,9 +218,38 @@ THREE.ThreeMFLoader.prototype = { } function parseBasematerialsNode( basematerialsNode ) { + + var basematerialsData = { + id: basematerialsNode.getAttribute( 'id' ), // required + basematerials: [] + }; + + var basematerialNodes = basematerialsNode.querySelectorAll( 'base' ); + + for ( var i = 0; i < basematerialNodes.length; i ++ ) { + + var basematerialNode = basematerialNodes[ i ]; + var basematerialData = parseBasematerialNode( basematerialNode ); + basematerialsData.basematerials.push( basematerialData ); + + } + + return basematerialsData; + } - function parseMeshNode( meshNode, extensions ) { + function parseBasematerialNode( basematerialNode ) { + + var basematerialData = {}; + + basematerialData[ 'name' ] = basematerialNode.getAttribute( 'name' ); // required + basematerialData[ 'displaycolor' ] = basematerialNode.getAttribute( 'displaycolor' ); // required + + return basematerialData; + + } + + function parseMeshNode( meshNode ) { var meshData = {}; @@ -300,6 +341,59 @@ THREE.ThreeMFLoader.prototype = { function parseComponentsNode( componentsNode ) { + var components = []; + + var componentNodes = componentsNode.querySelectorAll( 'component' ); + + for ( var i = 0; i < componentNodes.length; i ++ ) { + + var componentNode = componentNodes[ i ]; + var componentData = parseComponentNode( componentNode ); + components.push( componentData ); + + } + + return components; + + } + + function parseComponentNode( componentNode ) { + + var componentData = {}; + + componentData[ 'objectId' ] = componentNode.getAttribute( 'objectid' ); // required + + var transform = componentNode.getAttribute( 'transform' ); + + if ( transform ) { + + componentData[ 'transform' ] = parseTransform( transform ); + + } + + return componentData; + + } + + function parseTransform( transform ) { + + var t = []; + transform.split( ' ' ).forEach( function ( s ) { + + t.push( parseFloat( s ) ); + + } ); + + var matrix = new THREE.Matrix4(); + matrix.set( + t[ 0 ], t[ 3 ], t[ 6 ], t[ 9 ], + t[ 1 ], t[ 4 ], t[ 7 ], t[ 10 ], + t[ 2 ], t[ 5 ], t[ 8 ], t[ 11 ], + 0.0, 0.0, 0.0, 1.0 + ); + + return matrix; + } function parseObjectNode( objectNode ) { @@ -383,7 +477,7 @@ THREE.ThreeMFLoader.prototype = { if ( basematerialsNode ) { - resourcesData[ 'basematerial' ] = parseBasematerialsNode( basematerialsNode ); + resourcesData[ 'basematerials' ] = parseBasematerialsNode( basematerialsNode ); } @@ -411,25 +505,13 @@ THREE.ThreeMFLoader.prototype = { var itemNode = itemNodes[ i ]; var buildItem = { - objectid: itemNode.getAttribute( 'objectid' ) + objectId: itemNode.getAttribute( 'objectid' ) }; var transform = itemNode.getAttribute( 'transform' ); if ( transform ) { - var t = []; - transform.split( ' ' ).forEach( function ( s ) { - - t.push( parseFloat( s ) ); - - } ); - var mat4 = new THREE.Matrix4(); - buildItem[ 'transform' ] = mat4.set( - t[ 0 ], t[ 3 ], t[ 6 ], t[ 9 ], - t[ 1 ], t[ 4 ], t[ 7 ], t[ 10 ], - t[ 2 ], t[ 5 ], t[ 8 ], t[ 11 ], - 0.0, 0.0, 0.0, 1.0 - ); + buildItem[ 'transform' ] = parseTransform( transform ); } @@ -472,40 +554,176 @@ THREE.ThreeMFLoader.prototype = { } - function buildMesh( meshData, data3mf ) { + function buildMesh( meshData, objects, modelData, objectData ) { + + // geometry var geometry = new THREE.BufferGeometry(); geometry.setIndex( new THREE.BufferAttribute( meshData[ 'triangles' ], 1 ) ); geometry.addAttribute( 'position', new THREE.BufferAttribute( meshData[ 'vertices' ], 3 ) ); - if ( meshData[ 'colors' ] ) { + // groups + + var basematerialsData = modelData[ 'resources' ][ 'basematerials' ]; + var triangleProperties = meshData[ 'triangleProperties' ]; + + var start = 0; + var count = 0; + var currentMaterialIndex = - 1; - geometry.addAttribute( 'color', new THREE.BufferAttribute( meshData[ 'colors' ], 3 ) ); + for ( var i = 0, l = triangleProperties.length; i < l; i ++ ) { + + var triangleProperty = triangleProperties[ i ]; + var pid = triangleProperty.pid; + + // only proceed if the triangle refers to a basematerials definition + + if ( basematerialsData && ( basematerialsData.id === pid ) ) { + + if ( currentMaterialIndex === - 1 ) currentMaterialIndex = triangleProperty.p1; + + if ( currentMaterialIndex === triangleProperty.p1 ) { + + count += 3; // primitves per triangle + + } else { + + geometry.addGroup( start, count, currentMaterialIndex ); + + start += count; + count = 3; + currentMaterialIndex = triangleProperty.p1; + + } + + } } + if ( geometry.groups.length > 0 ) mergeGroups( geometry ); + geometry.computeBoundingSphere(); - var materialOpts = { - flatShading: true - }; + // material - if ( meshData[ 'colors' ] && 0 < meshData[ 'colors' ].length ) { + var material; - materialOpts[ 'vertexColors' ] = THREE.VertexColors; + // add material if an object-level definition is present - } else { + if ( basematerialsData && ( basematerialsData.id === objectData.pid ) ) { + + var materialIndex = objectData.pindex; + var basematerialData = basematerialsData.basematerials[ materialIndex ]; - materialOpts[ 'color' ] = 0xaaaaff; + material = getBuild( basematerialData, objects, modelData, objectData, buildBasematerial ); } - var material = new THREE.MeshPhongMaterial( materialOpts ); + // add/overwrite material if definitions on triangles are present + + if ( geometry.groups.length > 0 ) { + + var groups = geometry.groups; + material = []; + + for ( var i = 0, l = groups.length; i < l; i ++ ) { + + var group = groups[ i ]; + var basematerialData = basematerialsData.basematerials[ group.materialIndex ]; + + material.push( getBuild( basematerialData, objects, modelData, objectData, buildBasematerial ) ); + + } + + } + + // default material + + if ( material === undefined ) material = new THREE.MeshPhongMaterial( { color: 0xaaaaff, flatShading: true } ); + return new THREE.Mesh( geometry, material ); } - function applyExtensions( extensions, meshData, modelXml, data3mf ) { + function mergeGroups( geometry ) { + + // sort by material index + + var groups = geometry.groups.sort( function ( a, b ) { + + if ( a.materialIndex !== b.materialIndex ) return a.materialIndex - b.materialIndex; + + return a.start - b.start; + + } ); + + // reorganize index buffer + + var index = geometry.index; + + var itemSize = index.itemSize; + var srcArray = index.array; + + var targetOffset = 0; + + var targetArray = new srcArray.constructor( srcArray.length ); + + for ( var i = 0; i < groups.length; i ++ ) { + + var group = groups[ i ]; + + var groupLength = group.count * itemSize; + var groupStart = group.start * itemSize; + + var sub = srcArray.subarray( groupStart, groupStart + groupLength ); + + targetArray.set( sub, targetOffset ); + + targetOffset += groupLength; + + } + + srcArray.set( targetArray ); + + // update groups + + var start = 0; + + for ( i = 0; i < groups.length; i ++ ) { + + group = groups[ i ]; + + group.start = start; + start += group.count; + + } + + // merge groups + + var lastGroup = groups[ 0 ]; + + geometry.groups = [ lastGroup ]; + + for ( i = 1; i < groups.length; i ++ ) { + + group = groups[ i ]; + + if ( lastGroup.materialIndex === group.materialIndex ) { + + lastGroup.count += group.count; + + } else { + + lastGroup = group; + geometry.groups.push( lastGroup ); + + } + + } + + } + + function applyExtensions( extensions, meshData, modelXml ) { if ( ! extensions ) { @@ -543,38 +761,131 @@ THREE.ThreeMFLoader.prototype = { } - function buildMeshes( data3mf ) { + function getBuild( data, objects, modelData, objectData, builder ) { + + if ( data.build !== undefined ) return data.build; + + data.build = builder( data, objects, modelData, objectData ); + + return data.build; + + } + + function buildBasematerial( materialData ) { + + var material = new THREE.MeshPhongMaterial( { flatShading: true } ); + + material.name = materialData.name; + + // displaycolor MUST be specified with a value of a 6 or 8 digit hexadecimal number, e.g. "#RRGGBB" or "#RRGGBBAA" + + var displaycolor = materialData.displaycolor; + + var color = displaycolor.substring( 0, 7 ); + material.color.setStyle( color ); + material.color.convertSRGBToLinear(); // displaycolor is in sRGB + + // process alpha if set + + if ( displaycolor.length === 9 ) { + + material.opacity = parseInt( displaycolor.charAt( 7 ) + displaycolor.charAt( 8 ), 16 ) / 255; + + } + + return material; + + } + + function buildComposite( compositeData, objects, modelData ) { + + var composite = new THREE.Group(); + + for ( var j = 0; j < compositeData.length; j ++ ) { + + var component = compositeData[ j ]; + var build = objects[ component.objectId ]; + + if ( build === undefined ) { + + buildObject( component.objectId, objects, modelData ); + build = objects[ component.objectId ]; + + } + + var object3D = build.clone(); + + // apply component transfrom + + var transform = component.transform; + + if ( transform ) { + + object3D.applyMatrix( transform ); + + } + + composite.add( object3D ); + + } + + return composite; + + } + + function buildObject( objectId, objects, modelData ) { + + var objectData = modelData[ 'resources' ][ 'object' ][ objectId ]; + + if ( objectData[ 'mesh' ] ) { + + var meshData = objectData[ 'mesh' ]; + + var extensions = modelData[ 'extensions' ]; + var modelXml = modelData[ 'xml' ]; + + applyExtensions( extensions, meshData, modelXml ); + + objects[ objectData.id ] = getBuild( meshData, objects, modelData, objectData, buildMesh ); + + } else { + + var compositeData = objectData[ 'components' ]; + + objects[ objectData.id ] = getBuild( compositeData, objects, modelData, objectData, buildComposite ); + + } + + } + + function buildObjects( data3mf ) { var modelsData = data3mf.model; - var meshes = {}; + var objects = {}; var modelsKeys = Object.keys( modelsData ); for ( var i = 0; i < modelsKeys.length; i ++ ) { var modelsKey = modelsKeys[ i ]; var modelData = modelsData[ modelsKey ]; - var modelXml = modelData[ 'xml' ]; - var extensions = modelData[ 'extensions' ]; var objectIds = Object.keys( modelData[ 'resources' ][ 'object' ] ); for ( var j = 0; j < objectIds.length; j ++ ) { var objectId = objectIds[ j ]; - var objectData = modelData[ 'resources' ][ 'object' ][ objectId ]; - var meshData = objectData[ 'mesh' ]; - applyExtensions( extensions, meshData, modelXml, data3mf ); - meshes[ objectId ] = buildMesh( meshData, data3mf ); + + buildObject( objectId, objects, modelData ); } } - return meshes; + return objects; } - function build( meshes, refs, data3mf ) { + function build( objects, refs, data3mf ) { var group = new THREE.Group(); var buildData = data3mf.model[ refs[ 'target' ].substring( 1 ) ][ 'build' ]; @@ -582,15 +893,19 @@ THREE.ThreeMFLoader.prototype = { for ( var i = 0; i < buildData.length; i ++ ) { var buildItem = buildData[ i ]; - var mesh = meshes[ buildItem[ 'objectid' ] ]; + var object3D = objects[ buildItem[ 'objectId' ] ]; + + // apply transform - if ( buildItem[ 'transform' ] ) { + var transform = buildItem[ 'transform' ]; + + if ( transform ) { - mesh.geometry.applyMatrix( buildItem[ 'transform' ] ); + object3D.applyMatrix( transform ); } - group.add( mesh ); + group.add( object3D ); } @@ -599,9 +914,9 @@ THREE.ThreeMFLoader.prototype = { } var data3mf = loadDocument( data ); - var meshes = buildMeshes( data3mf ); + var objects = buildObjects( data3mf ); - return build( meshes, data3mf[ 'rels' ], data3mf ); + return build( objects, data3mf[ 'rels' ], data3mf ); }, diff --git a/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/loaders/AssimpLoader.js b/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/loaders/AssimpLoader.js index 8d401b31..7d305b5e 100644 --- a/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/loaders/AssimpLoader.js +++ b/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/loaders/AssimpLoader.js @@ -359,7 +359,7 @@ THREE.AssimpLoader.prototype = { var ASSBIN_MESH_HAS_COLOR_BASE = 0x10000; var AI_MAX_NUMBER_OF_COLOR_SETS = 1; var AI_MAX_NUMBER_OF_TEXTURECOORDS = 4; - var aiLightSource_UNDEFINED = 0x0; + //var aiLightSource_UNDEFINED = 0x0; //! A directional light source has a well-defined direction //! but is infinitely far away. That's quite a good //! approximation for sun light. @@ -367,7 +367,7 @@ THREE.AssimpLoader.prototype = { //! A point light source has a well-defined position //! in space but no direction - it emits light in all //! directions. A normal bulb is a point light. - var aiLightSource_POINT = 0x2; + //var aiLightSource_POINT = 0x2; //! A spot light source emits light in a specific //! angle. It has a position and a direction it is pointing to. //! A good example for a spot light is a light spot in @@ -378,49 +378,49 @@ THREE.AssimpLoader.prototype = { //! Typically, there's at most one ambient light in a scene. //! This light type doesn't have a valid position, direction, or //! other properties, just a color. - var aiLightSource_AMBIENT = 0x4; + //var aiLightSource_AMBIENT = 0x4; /** Flat shading. Shading is done on per-face base, * diffuse only. Also known as 'faceted shading'. */ - var aiShadingMode_Flat = 0x1; + //var aiShadingMode_Flat = 0x1; /** Simple Gouraud shading. */ - var aiShadingMode_Gouraud = 0x2; + //var aiShadingMode_Gouraud = 0x2; /** Phong-Shading - */ - var aiShadingMode_Phong = 0x3; + //var aiShadingMode_Phong = 0x3; /** Phong-Blinn-Shading */ - var aiShadingMode_Blinn = 0x4; + //var aiShadingMode_Blinn = 0x4; /** Toon-Shading per pixel * * Also known as 'comic' shader. */ - var aiShadingMode_Toon = 0x5; + //var aiShadingMode_Toon = 0x5; /** OrenNayar-Shading per pixel * * Extension to standard Lambertian shading, taking the * roughness of the material into account */ - var aiShadingMode_OrenNayar = 0x6; + //var aiShadingMode_OrenNayar = 0x6; /** Minnaert-Shading per pixel * * Extension to standard Lambertian shading, taking the * "darkness" of the material into account */ - var aiShadingMode_Minnaert = 0x7; + //var aiShadingMode_Minnaert = 0x7; /** CookTorrance-Shading per pixel * * Special shader for metallic surfaces. */ - var aiShadingMode_CookTorrance = 0x8; + //var aiShadingMode_CookTorrance = 0x8; /** No shading at all. Constant light influence of 1.0. */ - var aiShadingMode_NoShading = 0x9; + //var aiShadingMode_NoShading = 0x9; /** Fresnel shading */ - var aiShadingMode_Fresnel = 0xa; - var aiTextureType_NONE = 0x0; + //var aiShadingMode_Fresnel = 0xa; + //var aiTextureType_NONE = 0x0; /** The texture is combined with the result of the diffuse * lighting equation. */ @@ -428,21 +428,21 @@ THREE.AssimpLoader.prototype = { /** The texture is combined with the result of the specular * lighting equation. */ - var aiTextureType_SPECULAR = 0x2; + //var aiTextureType_SPECULAR = 0x2; /** The texture is combined with the result of the ambient * lighting equation. */ - var aiTextureType_AMBIENT = 0x3; + //var aiTextureType_AMBIENT = 0x3; /** The texture is added to the result of the lighting * calculation. It isn't influenced by incoming light. */ - var aiTextureType_EMISSIVE = 0x4; + //var aiTextureType_EMISSIVE = 0x4; /** The texture is a height map. * * By convention, higher gray-scale values stand for * higher elevations from the base height. */ - var aiTextureType_HEIGHT = 0x5; + //var aiTextureType_HEIGHT = 0x5; /** The texture is a (tangent space) normal-map. * * Again, there are several conventions for tangent-space @@ -457,7 +457,7 @@ THREE.AssimpLoader.prototype = { * function defined to map the linear color values in the * texture to a suitable exponent. Have fun. */ - var aiTextureType_SHININESS = 0x7; + //var aiTextureType_SHININESS = 0x7; /** The texture defines per-pixel opacity. * * Usually 'white' means opaque and 'black' means @@ -469,7 +469,7 @@ THREE.AssimpLoader.prototype = { * The exact purpose and format is application-dependent. * Higher color values stand for higher vertex displacements. */ - var aiTextureType_DISPLACEMENT = 0x9; + //var aiTextureType_DISPLACEMENT = 0x9; /** Lightmap texture (aka Ambient Occlusion) * * Both 'Lightmaps' and dedicated 'ambient occlusion maps' are @@ -483,14 +483,14 @@ THREE.AssimpLoader.prototype = { * Contains the color of a perfect mirror reflection. * Rarely used, almost never for real-time applications. */ - var aiTextureType_REFLECTION = 0xB; + //var aiTextureType_REFLECTION = 0xB; /** Unknown texture * * A texture reference that does not match any of the definitions * above is considered to be 'unknown'. It is still imported, * but is excluded from any further postprocessing. */ - var aiTextureType_UNKNOWN = 0xC; + //var aiTextureType_UNKNOWN = 0xC; var BONESPERVERT = 4; function ASSBIN_MESH_HAS_TEXCOORD( n ) { @@ -634,7 +634,7 @@ THREE.AssimpLoader.prototype = { ]; this.mFaces = []; this.mBones = []; - this.hookupSkeletons = function ( scene, threeScene ) { + this.hookupSkeletons = function ( scene ) { if ( this.mBones.length == 0 ) return; @@ -668,7 +668,6 @@ THREE.AssimpLoader.prototype = { var skeletonRoot = scene.findNode( this.mBones[ i ].mName ); if ( ! skeletonRoot ) return; var threeSkeletonRoot = skeletonRoot.toTHREE( scene ); - var threeSkeletonRootParent = threeSkeletonRoot.parent; var threeSkeletonRootBone = cloneTreeToBones( threeSkeletonRoot, scene ); this.threeNode.add( threeSkeletonRootBone ); var bone = findMatchingBone( threeSkeletonRootBone, this.mBones[ i ].mName ); @@ -773,8 +772,10 @@ THREE.AssimpLoader.prototype = { mesh = new THREE.Mesh( geometry, mat ); if ( this.mBones.length > 0 ) { + mesh = new THREE.SkinnedMesh( geometry, mat ); mesh.normalizeSkinWeights(); + } this.threeNode = mesh; @@ -806,46 +807,6 @@ THREE.AssimpLoader.prototype = { } - function aiVector2D() { - - this.x = 0; - this.y = 0; - this.toTHREE = function () { - - return new THREE.Vector2( this.x, this.y ); - - }; - - } - - function aiVector4D() { - - this.w = 0; - this.x = 0; - this.y = 0; - this.z = 0; - this.toTHREE = function () { - - return new THREE.Vector4( this.w, this.x, this.y, this.z ); - - }; - - } - - function aiColor4D() { - - this.r = 0; - this.g = 0; - this.b = 0; - this.a = 0; - this.toTHREE = function () { - - return new THREE.Color( this.r, this.g, this.b, this.a ); - - }; - - } - function aiColor3D() { this.r = 0; @@ -854,7 +815,7 @@ THREE.AssimpLoader.prototype = { this.a = 0; this.toTHREE = function () { - return new THREE.Color( this.r, this.g, this.b, 1 ); + return new THREE.Color( this.r, this.g, this.b ); }; @@ -1063,9 +1024,8 @@ THREE.AssimpLoader.prototype = { this.mNumAllocated = 0; this.mNumProperties = 0; this.mProperties = []; - this.toTHREE = function ( scene ) { + this.toTHREE = function () { - var name = this.mProperties[ 0 ].dataAsString(); var mat = new THREE.MeshPhongMaterial(); for ( var i = 0; i < this.mProperties.length; i ++ ) { @@ -1236,7 +1196,7 @@ THREE.AssimpLoader.prototype = { }; - this.toTHREE = function ( o, tps ) { + this.toTHREE = function ( o ) { this.sortKeys(); var length = this.getLength(); @@ -1402,7 +1362,7 @@ THREE.AssimpLoader.prototype = { var o = this.mRootNode.toTHREE( this ); for ( var i in this.mMeshes ) - this.mMeshes[ i ].hookupSkeletons( this, o ); + this.mMeshes[ i ].hookupSkeletons( this ); if ( this.mAnimations.length > 0 ) { @@ -1504,26 +1464,6 @@ THREE.AssimpLoader.prototype = { } - function Read_aiVector2D( stream ) { - - var v = new aiVector2D(); - v.x = readFloat( stream ); - v.y = readFloat( stream ); - return v; - - } - - function Read_aiVector4D( stream ) { - - var v = new aiVector4D(); - v.w = readFloat( stream ); - v.x = readFloat( stream ); - v.y = readFloat( stream ); - v.z = readFloat( stream ); - return v; - - } - function Read_aiColor3D( stream ) { var c = new aiColor3D(); @@ -1534,17 +1474,6 @@ THREE.AssimpLoader.prototype = { } - function Read_aiColor4D( stream ) { - - var c = new aiColor4D(); - c.r = readFloat( stream ); - c.g = readFloat( stream ); - c.b = readFloat( stream ); - c.a = readFloat( stream ); - return c; - - } - function Read_aiQuaternion( stream ) { var v = new aiQuaternion(); @@ -1610,42 +1539,12 @@ THREE.AssimpLoader.prototype = { } - function ReadArray( stream, data, size ) { - - for ( var i = 0; i < size; i ++ ) data[ i ] = Read( stream ); - - } - - function ReadArray_aiVector2D( stream, data, size ) { - - for ( var i = 0; i < size; i ++ ) data[ i ] = Read_aiVector2D( stream ); - - } - - function ReadArray_aiVector3D( stream, data, size ) { - - for ( var i = 0; i < size; i ++ ) data[ i ] = Read_aiVector3D( stream ); - - } - - function ReadArray_aiVector4D( stream, data, size ) { - - for ( var i = 0; i < size; i ++ ) data[ i ] = Read_aiVector4D( stream ); - - } - function ReadArray_aiVertexWeight( stream, data, size ) { for ( var i = 0; i < size; i ++ ) data[ i ] = Read_aiVertexWeight( stream ); } - function ReadArray_aiColor4D( stream, data, size ) { - - for ( var i = 0; i < size; i ++ ) data[ i ] = Read_aiColor4D( stream ); - - } - function ReadArray_aiVectorKey( stream, data, size ) { for ( var i = 0; i < size; i ++ ) data[ i ] = Read_aiVectorKey( stream ); @@ -1853,7 +1752,7 @@ THREE.AssimpLoader.prototype = { } else { - // else write as usual + // else write as usual mesh.mTextureCoords[ n ] = []; //note that assbin always writes 3d texcoords @@ -1884,8 +1783,6 @@ THREE.AssimpLoader.prototype = { // if there are less than 2^16 vertices, we can simply use 16 bit integers ... mesh.mFaces = []; - - var indexCounter = 0; mesh.mIndexArray = []; for ( var i = 0; i < mesh.mNumFaces; ++ i ) { diff --git a/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/loaders/ColladaLoader.js b/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/loaders/ColladaLoader.js index 0bf7214a..f3cb9d44 100644 --- a/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/loaders/ColladaLoader.js +++ b/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/loaders/ColladaLoader.js @@ -3814,6 +3814,35 @@ THREE.ColladaLoader.prototype = { } + // convert the parser error element into text with each child elements text + // separated by new lines. + + function parserErrorToText( parserError ) { + + var result = ''; + var stack = [ parserError ]; + + while ( stack.length ) { + + var node = stack.shift(); + + if ( node.nodeType === Node.TEXT_NODE ) { + + result += node.textContent; + + } else { + + result += '\n'; + stack.push.apply( stack, node.childNodes ); + + } + + } + + return result.trim(); + + } + if ( text.length === 0 ) { return { scene: new THREE.Scene() }; @@ -3824,6 +3853,30 @@ THREE.ColladaLoader.prototype = { var collada = getElementsByTagName( xml, 'COLLADA' )[ 0 ]; + var parserError = xml.getElementsByTagName( 'parsererror' )[ 0 ]; + if ( parserError !== undefined ) { + + // Chrome will return parser error with a div in it + + var errorElement = getElementsByTagName( parserError, 'div' )[ 0 ]; + var errorText; + + if ( errorElement ) { + + errorText = errorElement.textContent; + + } else { + + errorText = parserErrorToText( parserError ); + + } + + console.error( 'THREE.ColladaLoader: Failed to parse collada file.\n', errorText ); + + return null; + + } + // metadata var version = collada.getAttribute( 'version' ); diff --git a/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/loaders/GLTFLoader.js b/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/loaders/GLTFLoader.js index 3722c3b2..b39fa42c 100644 --- a/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/loaders/GLTFLoader.js +++ b/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/loaders/GLTFLoader.js @@ -841,7 +841,8 @@ THREE.GLTFLoader = ( function () { for ( var i = 0, il = params.length; i < il; i ++ ) { - target[ params[ i ] ] = source[ params[ i ] ]; + var value = source[ params[ i ] ]; + target[ params[ i ] ] = ( value && value.isColor ) ? value.clone() : value; } @@ -1299,7 +1300,7 @@ THREE.GLTFLoader = ( function () { if ( typeof gltfDef.extras === 'object' ) { - object.userData = gltfDef.extras; + Object.assign( object.userData, gltfDef.extras ); } else { @@ -2996,6 +2997,7 @@ THREE.GLTFLoader = ( function () { if ( nodeDef.name !== undefined ) { + node.userData.name = nodeDef.name; node.name = THREE.PropertyBinding.sanitizeNodeName( nodeDef.name ); } diff --git a/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/loaders/LDrawLoader.js b/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/loaders/LDrawLoader.js index b6322e47..cd58a25c 100644 --- a/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/loaders/LDrawLoader.js +++ b/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/loaders/LDrawLoader.js @@ -7,6 +7,279 @@ THREE.LDrawLoader = ( function () { + var conditionalLineVertShader = /* glsl */` + attribute vec3 control0; + attribute vec3 control1; + attribute vec3 direction; + varying float discardFlag; + + #include + #include + #include + #include + #include + void main() { + #include + + vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 ); + gl_Position = projectionMatrix * mvPosition; + + // Transform the line segment ends and control points into camera clip space + vec4 c0 = projectionMatrix * modelViewMatrix * vec4( control0, 1.0 ); + vec4 c1 = projectionMatrix * modelViewMatrix * vec4( control1, 1.0 ); + vec4 p0 = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); + vec4 p1 = projectionMatrix * modelViewMatrix * vec4( position + direction, 1.0 ); + + c0.xy /= c0.w; + c1.xy /= c1.w; + p0.xy /= p0.w; + p1.xy /= p1.w; + + // Get the direction of the segment and an orthogonal vector + vec2 dir = p1.xy - p0.xy; + vec2 norm = vec2( -dir.y, dir.x ); + + // Get control point directions from the line + vec2 c0dir = c0.xy - p1.xy; + vec2 c1dir = c1.xy - p1.xy; + + // If the vectors to the controls points are pointed in different directions away + // from the line segment then the line should not be drawn. + float d0 = dot( normalize( norm ), normalize( c0dir ) ); + float d1 = dot( normalize( norm ), normalize( c1dir ) ); + discardFlag = float( sign( d0 ) != sign( d1 ) ); + + #include + #include + #include + } + `; + + var conditionalLineFragShader = /* glsl */` + uniform vec3 diffuse; + uniform float opacity; + varying float discardFlag; + + #include + #include + #include + #include + #include + void main() { + + if ( discardFlag > 0.5 ) discard; + + #include + vec3 outgoingLight = vec3( 0.0 ); + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + #include + outgoingLight = diffuseColor.rgb; // simple shader + gl_FragColor = vec4( outgoingLight, diffuseColor.a ); + #include + #include + #include + #include + } + `; + + + + var tempVec0 = new THREE.Vector3(); + var tempVec1 = new THREE.Vector3(); + function smoothNormals( triangles, lineSegments ) { + + function hashVertex( v ) { + + // NOTE: 1e2 is pretty coarse but was chosen because it allows edges + // to be smoothed as expected (see minifig arms). The errors between edges + // could be due to matrix multiplication. + var x = ~ ~ ( v.x * 1e2 ); + var y = ~ ~ ( v.y * 1e2 ); + var z = ~ ~ ( v.z * 1e2 ); + return `${ x },${ y },${ z }`; + + } + + function hashEdge( v0, v1 ) { + + return `${ hashVertex( v0 ) }_${ hashVertex( v1 ) }`; + + } + + var hardEdges = new Set(); + var halfEdgeList = {}; + var fullHalfEdgeList = {}; + var normals = []; + + // Save the list of hard edges by hash + for ( var i = 0, l = lineSegments.length; i < l; i ++ ) { + + var ls = lineSegments[ i ]; + var v0 = ls.v0; + var v1 = ls.v1; + hardEdges.add( hashEdge( v0, v1 ) ); + hardEdges.add( hashEdge( v1, v0 ) ); + + } + + // track the half edges associated with each triangle + for ( var i = 0, l = triangles.length; i < l; i ++ ) { + + var tri = triangles[ i ]; + for ( var i2 = 0, l2 = 3; i2 < l2; i2 ++ ) { + + var index = i2; + var next = ( i2 + 1 ) % 3; + var v0 = tri[ `v${ index }` ]; + var v1 = tri[ `v${ next }` ]; + var hash = hashEdge( v0, v1 ); + + // don't add the triangle if the edge is supposed to be hard + if ( hardEdges.has( hash ) ) continue; + halfEdgeList[ hash ] = tri; + fullHalfEdgeList[ hash ] = tri; + + } + + } + + // NOTE: Some of the normals wind up being skewed in an unexpected way because + // quads provide more "influence" to some vertex normals than a triangle due to + // the fact that a quad is made up of two triangles and all triangles are weighted + // equally. To fix this quads could be tracked separately so their vertex normals + // are weighted appropriately or we could try only adding a normal direction + // once per normal. + + // Iterate until we've tried to connect all triangles to share normals + while ( true ) { + + // Stop if there are no more triangles left + var halfEdges = Object.keys( halfEdgeList ); + if ( halfEdges.length === 0 ) break; + + // Exhaustively find all connected triangles + var i = 0; + var queue = [ fullHalfEdgeList[ halfEdges[ 0 ] ] ]; + while ( i < queue.length ) { + + // initialize all vertex normals in this triangle + var tri = queue[ i ]; + i ++; + + var faceNormal = tri.faceNormal; + if ( tri.n0 === null ) { + + tri.n0 = faceNormal.clone(); + normals.push( tri.n0 ); + + } + + if ( tri.n1 === null ) { + + tri.n1 = faceNormal.clone(); + normals.push( tri.n1 ); + + } + + if ( tri.n2 === null ) { + + tri.n2 = faceNormal.clone(); + normals.push( tri.n2 ); + + } + + // Check if any edge is connected to another triangle edge + for ( var i2 = 0, l2 = 3; i2 < l2; i2 ++ ) { + + var index = i2; + var next = ( i2 + 1 ) % 3; + var v0 = tri[ `v${ index }` ]; + var v1 = tri[ `v${ next }` ]; + + // delete this triangle from the list so it won't be found again + var hash = hashEdge( v0, v1 ); + delete halfEdgeList[ hash ]; + + var reverseHash = hashEdge( v1, v0 ); + var otherTri = fullHalfEdgeList[ reverseHash ]; + if ( otherTri ) { + + // NOTE: If the angle between triangles is > 67.5 degrees then assume it's + // hard edge. There are some cases where the line segments do not line up exactly + // with or span multiple triangle edges (see Lunar Vehicle wheels). + if ( Math.abs( otherTri.faceNormal.dot( tri.faceNormal ) ) < 0.25 ) { + + continue; + + } + + // if this triangle has already been traversed then it won't be in + // the halfEdgeList. If it has not then add it to the queue and delete + // it so it won't be found again. + if ( reverseHash in halfEdgeList ) { + + queue.push( otherTri ); + delete halfEdgeList[ reverseHash ]; + + } + + // Find the matching edge in this triangle and copy the normal vector over + for ( var i3 = 0, l3 = 3; i3 < l3; i3 ++ ) { + + var otherIndex = i3; + var otherNext = ( i3 + 1 ) % 3; + var otherV0 = otherTri[ `v${ otherIndex }` ]; + var otherV1 = otherTri[ `v${ otherNext }` ]; + + var otherHash = hashEdge( otherV0, otherV1 ); + if ( otherHash === reverseHash ) { + + if ( otherTri[ `n${ otherIndex }` ] === null ) { + + var norm = tri[ `n${ next }` ]; + otherTri[ `n${ otherIndex }` ] = norm; + norm.add( otherTri.faceNormal ); + + } + + if ( otherTri[ `n${ otherNext }` ] === null ) { + + var norm = tri[ `n${ index }` ]; + otherTri[ `n${ otherNext }` ] = norm; + norm.add( otherTri.faceNormal ); + + } + + break; + + } + + } + + } + + } + + } + + } + + // The normals of each face have been added up so now we average them by normalizing the vector. + for ( var i = 0, l = normals.length; i < l; i ++ ) { + + normals[ i ].normalize(); + + } + + } + + function isPrimitiveType( type ) { + + return /primitive/i.test( type ) || type === 'Subpart'; + + } + function LineParser( line, lineNumber ) { this.line = line; @@ -111,7 +384,7 @@ THREE.LDrawLoader = ( function () { } - function createObject( elements, elementSize ) { + function createObject( elements, elementSize, isConditionalSegments ) { // Creates a THREE.LineSegments (elementSize = 2) or a THREE.Mesh (elementSize = 3 ) // With per face / segment material, implemented with mesh groups and materials array @@ -119,11 +392,11 @@ THREE.LDrawLoader = ( function () { // Sort the triangles or line segments by colour code to make later the mesh groups elements.sort( sortByMaterial ); - var vertices = []; + var positions = []; + var normals = []; var materials = []; var bufferGeometry = new THREE.BufferGeometry(); - bufferGeometry.clearGroups(); var prevMaterial = null; var index0 = 0; var numGroupVerts = 0; @@ -134,10 +407,17 @@ THREE.LDrawLoader = ( function () { var v0 = elem.v0; var v1 = elem.v1; // Note that LDraw coordinate system is rotated 180 deg. in the X axis w.r.t. Three.js's one - vertices.push( v0.x, v0.y, v0.z, v1.x, v1.y, v1.z ); + positions.push( v0.x, v0.y, v0.z, v1.x, v1.y, v1.z ); if ( elementSize === 3 ) { - vertices.push( elem.v2.x, elem.v2.y, elem.v2.z ); + positions.push( elem.v2.x, elem.v2.y, elem.v2.z ); + + var n0 = elem.n0 || elem.faceNormal; + var n1 = elem.n1 || elem.faceNormal; + var n2 = elem.n2 || elem.faceNormal; + normals.push( n0.x, n0.y, n0.z ); + normals.push( n1.x, n1.y, n1.z ); + normals.push( n2.x, n2.y, n2.z ); } @@ -169,7 +449,13 @@ THREE.LDrawLoader = ( function () { } - bufferGeometry.addAttribute( 'position', new THREE.Float32BufferAttribute( vertices, 3 ) ); + bufferGeometry.addAttribute( 'position', new THREE.Float32BufferAttribute( positions, 3 ) ); + + if ( elementSize === 3 ) { + + bufferGeometry.addAttribute( 'normal', new THREE.Float32BufferAttribute( normals, 3 ) ); + + } var object3d = null; @@ -179,12 +465,54 @@ THREE.LDrawLoader = ( function () { } else if ( elementSize === 3 ) { - bufferGeometry.computeVertexNormals(); - object3d = new THREE.Mesh( bufferGeometry, materials ); } + if ( isConditionalSegments ) { + + object3d.isConditionalLine = true; + + var controlArray0 = new Float32Array( elements.length * 3 * 2 ); + var controlArray1 = new Float32Array( elements.length * 3 * 2 ); + var directionArray = new Float32Array( elements.length * 3 * 2 ); + for ( var i = 0, l = elements.length; i < l; i ++ ) { + + var os = elements[ i ]; + var c0 = os.c0; + var c1 = os.c1; + var v0 = os.v0; + var v1 = os.v1; + var index = i * 3 * 2; + controlArray0[ index + 0 ] = c0.x; + controlArray0[ index + 1 ] = c0.y; + controlArray0[ index + 2 ] = c0.z; + controlArray0[ index + 3 ] = c0.x; + controlArray0[ index + 4 ] = c0.y; + controlArray0[ index + 5 ] = c0.z; + + controlArray1[ index + 0 ] = c1.x; + controlArray1[ index + 1 ] = c1.y; + controlArray1[ index + 2 ] = c1.z; + controlArray1[ index + 3 ] = c1.x; + controlArray1[ index + 4 ] = c1.y; + controlArray1[ index + 5 ] = c1.z; + + directionArray[ index + 0 ] = v1.x - v0.x; + directionArray[ index + 1 ] = v1.y - v0.y; + directionArray[ index + 2 ] = v1.z - v0.z; + directionArray[ index + 3 ] = v1.x - v0.x; + directionArray[ index + 4 ] = v1.y - v0.y; + directionArray[ index + 5 ] = v1.z - v0.z; + + } + + bufferGeometry.addAttribute( 'control0', new THREE.BufferAttribute( controlArray0, 3, false ) ); + bufferGeometry.addAttribute( 'control1', new THREE.BufferAttribute( controlArray1, 3, false ) ); + bufferGeometry.addAttribute( 'direction', new THREE.BufferAttribute( directionArray, 3, false ) ); + + } + return object3d; } @@ -223,10 +551,8 @@ THREE.LDrawLoader = ( function () { // If not (the default), only one object which contains all the merged primitives will be created. this.separateObjects = false; - // Current merged object and primitives - this.currentGroupObject = null; - this.currentTriangles = null; - this.currentLineSegments = null; + // If this flag is set to true the vertex normals will be smoothed. + this.smoothNormals = true; } @@ -278,6 +604,15 @@ THREE.LDrawLoader = ( function () { var parentParseScope = scope.getParentParseScope(); + // Set current matrix + if ( subobject ) { + + parseScope.currentMatrix.multiplyMatrices( parentParseScope.currentMatrix, subobject.matrix ); + parseScope.matrix.copy( subobject.matrix ); + parseScope.inverted = subobject.inverted; + + } + // Add to cache var currentFileName = parentParseScope.currentFileName; if ( currentFileName !== null ) { @@ -292,21 +627,12 @@ THREE.LDrawLoader = ( function () { } - parseScope.inverted = subobject !== undefined ? subobject.inverted : false; // Parse the object (returns a THREE.Group) - var objGroup = scope.parse( text ); - - // Load subobjects - parseScope.subobjects = objGroup.userData.subobjects; - parseScope.numSubobjects = parseScope.subobjects.length; - parseScope.subobjectIndex = 0; - + scope.parse( text ); var finishedCount = 0; onSubobjectFinish(); - return objGroup; - function onSubobjectFinish() { finishedCount ++; @@ -337,18 +663,100 @@ THREE.LDrawLoader = ( function () { function finalizeObject() { - if ( ! scope.separateObjects && ! parentParseScope.isFromParse ) { + if ( scope.smoothNormals && parseScope.type === 'Part' ) { + + smoothNormals( parseScope.triangles, parseScope.lineSegments ); + + } + + var isRoot = ! parentParseScope.isFromParse; + if ( scope.separateObjects && ! isPrimitiveType( parseScope.type ) || isRoot ) { + + + const objGroup = parseScope.groupObject; + if ( parseScope.triangles.length > 0 ) { + + objGroup.add( createObject( parseScope.triangles, 3 ) ); + + } + + if ( parseScope.lineSegments.length > 0 ) { + + objGroup.add( createObject( parseScope.lineSegments, 2 ) ); + + } + + if ( parseScope.conditionalSegments.length > 0 ) { + + objGroup.add( createObject( parseScope.conditionalSegments, 2, true ) ); + + } + + if ( parentParseScope.groupObject ) { + + objGroup.name = parseScope.fileName; + objGroup.userData.category = parseScope.category; + objGroup.userData.keywords = parseScope.keywords; + parseScope.matrix.decompose( objGroup.position, objGroup.quaternion, objGroup.scale ); + + parentParseScope.groupObject.add( objGroup ); + + } + + } else { + + var separateObjects = scope.separateObjects; + var parentLineSegments = parentParseScope.lineSegments; + var parentConditionalSegments = parentParseScope.conditionalSegments; + var parentTriangles = parentParseScope.triangles; + + var lineSegments = parseScope.lineSegments; + var conditionalSegments = parseScope.conditionalSegments; + var triangles = parseScope.triangles; + + for ( var i = 0, l = lineSegments.length; i < l; i ++ ) { + + var ls = lineSegments[ i ]; + if ( separateObjects ) { + + ls.v0.applyMatrix4( parseScope.matrix ); + ls.v1.applyMatrix4( parseScope.matrix ); - // We are finalizing the root object and merging primitives is activated, so create the entire Mesh and LineSegments objects now - if ( scope.currentLineSegments.length > 0 ) { + } + parentLineSegments.push( ls ); + + } + + for ( var i = 0, l = conditionalSegments.length; i < l; i ++ ) { - objGroup.add( createObject( scope.currentLineSegments, 2 ) ); + var os = conditionalSegments[ i ]; + if ( separateObjects ) { + + os.v0.applyMatrix4( parseScope.matrix ); + os.v1.applyMatrix4( parseScope.matrix ); + os.c0.applyMatrix4( parseScope.matrix ); + os.c1.applyMatrix4( parseScope.matrix ); + + } + parentConditionalSegments.push( os ); } - if ( scope.currentTriangles.length > 0 ) { + for ( var i = 0, l = triangles.length; i < l; i ++ ) { + + var tri = triangles[ i ]; + if ( separateObjects ) { - objGroup.add( createObject( scope.currentTriangles, 3 ) ); + tri.v0 = tri.v0.clone().applyMatrix4( parseScope.matrix ); + tri.v1 = tri.v1.clone().applyMatrix4( parseScope.matrix ); + tri.v2 = tri.v2.clone().applyMatrix4( parseScope.matrix ); + + tempVec0.subVectors( tri.v1, tri.v0 ); + tempVec1.subVectors( tri.v2, tri.v1 ); + tri.faceNormal.crossVectors( tempVec0, tempVec1 ).normalize(); + + } + parentTriangles.push( tri ); } @@ -358,7 +766,7 @@ THREE.LDrawLoader = ( function () { if ( onProcessed ) { - onProcessed( objGroup ); + onProcessed( parseScope.groupObject ); } @@ -370,12 +778,6 @@ THREE.LDrawLoader = ( function () { parseScope.mainEdgeColourCode = subobject.material.userData.edgeMaterial.userData.code; parseScope.currentFileName = subobject.originalFileName; - if ( ! scope.separateObjects ) { - - // Set current matrix - parseScope.currentMatrix.multiplyMatrices( parentParseScope.currentMatrix, subobject.matrix ); - - } // If subobject was cached previously, use the cached one var cached = scope.subobjectCache[ subobject.originalFileName.toLowerCase() ]; @@ -485,22 +887,6 @@ THREE.LDrawLoader = ( function () { } - // Add the subobject just loaded - addSubobject( subobject, subobjectGroup ); - - } - - function addSubobject( subobject, subobjectGroup ) { - - if ( scope.separateObjects ) { - - subobjectGroup.name = subobject.fileName; - objGroup.add( subobjectGroup ); - subobjectGroup.matrix.copy( subobject.matrix ); - subobjectGroup.matrixAutoUpdate = false; - - } - scope.fileMap[ subobject.originalFileName ] = subobject.url; } @@ -536,8 +922,6 @@ THREE.LDrawLoader = ( function () { this.materials = materials; - this.currentGroupObject = null; - return this; }, @@ -568,9 +952,6 @@ THREE.LDrawLoader = ( function () { } var topParseScope = this.getCurrentParseScope(); - - var parentParseScope = this.getParentParseScope(); - var newParseScope = { lib: matLib, @@ -581,15 +962,22 @@ THREE.LDrawLoader = ( function () { numSubobjects: 0, subobjectIndex: 0, inverted: false, + category: null, + keywords: null, // Current subobject currentFileName: null, mainColourCode: topParseScope ? topParseScope.mainColourCode : '16', mainEdgeColourCode: topParseScope ? topParseScope.mainEdgeColourCode : '24', currentMatrix: new THREE.Matrix4(), + matrix: new THREE.Matrix4(), // If false, it is a root material scope previous to parse - isFromParse: true + isFromParse: true, + + triangles: null, + lineSegments: null, + conditionalSegments: null, }; this.parseScopesStack.push( newParseScope ); @@ -835,29 +1223,20 @@ THREE.LDrawLoader = ( function () { switch ( finishType ) { case LDrawLoader.FINISH_TYPE_DEFAULT: + + material = new THREE.MeshStandardMaterial( { color: colour, roughness: 0.3, envMapIntensity: 0.3, metalness: 0 } ); + break; + case LDrawLoader.FINISH_TYPE_PEARLESCENT: + // Try to imitate pearlescency by setting the specular to the complementary of the color, and low shininess var specular = new THREE.Color( colour ); - var shininess = 35; var hsl = specular.getHSL( { h: 0, s: 0, l: 0 } ); - - if ( finishType === LDrawLoader.FINISH_TYPE_DEFAULT ) { - - // Default plastic material with shiny specular - hsl.l = Math.min( 1, hsl.l + ( 1 - hsl.l ) * 0.12 ); - - } else { - - // Try to imitate pearlescency by setting the specular to the complementary of the color, and low shininess - hsl.h = ( hsl.h + 0.5 ) % 1; - hsl.l = Math.min( 1, hsl.l + ( 1 - hsl.l ) * 0.7 ); - shininess = 10; - - } - + hsl.h = ( hsl.h + 0.5 ) % 1; + hsl.l = Math.min( 1, hsl.l + ( 1 - hsl.l ) * 0.7 ); specular.setHSL( hsl.h, hsl.s, hsl.l ); - material = new THREE.MeshPhongMaterial( { color: colour, specular: specular, shininess: shininess, reflectivity: 0.3 } ); + material = new THREE.MeshPhongMaterial( { color: colour, specular: specular, shininess: 10, reflectivity: 0.3 } ); break; case LDrawLoader.FINISH_TYPE_CHROME: @@ -868,8 +1247,8 @@ THREE.LDrawLoader = ( function () { case LDrawLoader.FINISH_TYPE_RUBBER: - // Rubber is best simulated with Lambert - material = new THREE.MeshLambertMaterial( { color: colour } ); + // Rubber finish + material = new THREE.MeshStandardMaterial( { color: colour, roughness: 0.9, metalness: 0 } ); canHaveEnvMap = false; break; @@ -892,7 +1271,12 @@ THREE.LDrawLoader = ( function () { } material.transparent = isTransparent; + material.premultipliedAlpha = true; material.opacity = alpha; + material.depthWrite = ! isTransparent; + + material.polygonOffset = true; + material.polygonOffsetFactor = 1; material.userData.canHaveEnvMap = canHaveEnvMap; @@ -905,11 +1289,33 @@ THREE.LDrawLoader = ( function () { if ( ! edgeMaterial ) { // This is the material used for edges - edgeMaterial = new THREE.LineBasicMaterial( { color: edgeColour } ); + edgeMaterial = new THREE.LineBasicMaterial( { + color: edgeColour, + transparent: isTransparent, + opacity: alpha, + depthWrite: ! isTransparent + } ); edgeMaterial.userData.code = code; edgeMaterial.name = name + " - Edge"; edgeMaterial.userData.canHaveEnvMap = false; + // This is the material used for conditional edges + edgeMaterial.userData.conditionalEdgeMaterial = new THREE.ShaderMaterial( { + vertexShader: conditionalLineVertShader, + fragmentShader: conditionalLineFragShader, + uniforms: { + diffuse: { + value: new THREE.Color( edgeColour ) + }, + opacity: { + value: alpha + } + }, + transparent: isTransparent, + depthWrite: ! isTransparent + } ); + edgeMaterial.userData.conditionalEdgeMaterial.userData.canHaveEnvMap = false; + } material.userData.code = code; @@ -941,26 +1347,7 @@ THREE.LDrawLoader = ( function () { // Parse result variables var triangles; var lineSegments; - - if ( this.separateObjects ) { - - triangles = []; - lineSegments = []; - - } else { - - if ( this.currentGroupObject === null ) { - - this.currentGroupObject = new THREE.Group(); - this.currentTriangles = []; - this.currentLineSegments = []; - - } - - triangles = this.currentTriangles; - lineSegments = this.currentLineSegments; - - } + var conditionalSegments; var subobjects = []; @@ -982,6 +1369,12 @@ THREE.LDrawLoader = ( function () { var currentEmbeddedFileName = null; var currentEmbeddedText = null; + var bfcCertified = false; + var bfcCCW = true; + var bfcInverted = false; + var bfcCull = true; + var type = ''; + var scope = this; function parseColourCode( lineParser, forEdge ) { @@ -1018,7 +1411,7 @@ THREE.LDrawLoader = ( function () { if ( ! scope.separateObjects ) { - v.applyMatrix4( parentParseScope.currentMatrix ); + v.applyMatrix4( currentParseScope.currentMatrix ); } @@ -1026,11 +1419,6 @@ THREE.LDrawLoader = ( function () { } - var bfcCertified = false; - var bfcCCW = true; - var bfcInverted = false; - var bfcCull = true; - // Parse all line commands for ( lineIndex = 0; lineIndex < numLines; lineIndex ++ ) { @@ -1085,6 +1473,45 @@ THREE.LDrawLoader = ( function () { switch ( meta ) { + case '!LDRAW_ORG': + + type = lp.getToken(); + + if ( ! parsingEmbeddedFiles ) { + + currentParseScope.triangles = []; + currentParseScope.lineSegments = []; + currentParseScope.conditionalSegments = []; + currentParseScope.type = type; + + var isRoot = ! parentParseScope.isFromParse; + if ( isRoot || scope.separateObjects && ! isPrimitiveType( type ) ) { + + currentParseScope.groupObject = new THREE.Group(); + + } + + // If the scale of the object is negated then the triangle winding order + // needs to be flipped. + var matrix = currentParseScope.matrix; + if ( + matrix.determinant() < 0 && ( + scope.separateObjects && isPrimitiveType( type ) || + ! scope.separateObjects + ) ) { + + currentParseScope.inverted = ! currentParseScope.inverted; + + } + + triangles = currentParseScope.triangles; + lineSegments = currentParseScope.lineSegments; + conditionalSegments = currentParseScope.conditionalSegments; + + } + + break; + case '!COLOUR': var material = this.parseColourMetaDirective( lp ); @@ -1246,14 +1673,6 @@ THREE.LDrawLoader = ( function () { } - // If the scale of the object is negated then the triangle winding order - // needs to be flipped. - if ( scope.separateObjects === false && matrix.determinant() < 0 ) { - - bfcInverted = ! bfcInverted; - - } - subobjects.push( { material: material, matrix: matrix, @@ -1274,12 +1693,32 @@ THREE.LDrawLoader = ( function () { var material = parseColourCode( lp, true ); - lineSegments.push( { + var segment = { material: material.userData.edgeMaterial, colourCode: material.userData.code, v0: parseVector( lp ), v1: parseVector( lp ) - } ); + }; + + lineSegments.push( segment ); + + break; + + // Line type 5: Conditional Line segment + case '5': + + var material = parseColourCode( lp, true ); + + var segment = { + material: material.userData.edgeMaterial.userData.conditionalEdgeMaterial, + colourCode: material.userData.code, + v0: parseVector( lp ), + v1: parseVector( lp ), + c0: parseVector( lp ), + c1: parseVector( lp ) + }; + + conditionalSegments.push( segment ); break; @@ -1291,7 +1730,7 @@ THREE.LDrawLoader = ( function () { var inverted = currentParseScope.inverted; var ccw = bfcCCW !== inverted; var doubleSided = ! bfcCertified || ! bfcCull; - var v0, v1, v2; + var v0, v1, v2, faceNormal; if ( ccw === true ) { @@ -1307,12 +1746,22 @@ THREE.LDrawLoader = ( function () { } + tempVec0.subVectors( v1, v0 ); + tempVec1.subVectors( v2, v1 ); + faceNormal = new THREE.Vector3() + .crossVectors( tempVec0, tempVec1 ) + .normalize(); + triangles.push( { material: material, colourCode: material.userData.code, v0: v0, v1: v1, - v2: v2 + v2: v2, + faceNormal: faceNormal, + n0: null, + n1: null, + n2: null } ); if ( doubleSided === true ) { @@ -1322,7 +1771,11 @@ THREE.LDrawLoader = ( function () { colourCode: material.userData.code, v0: v0, v1: v2, - v2: v1 + v2: v1, + faceNormal: faceNormal, + n0: null, + n1: null, + n2: null } ); } @@ -1337,7 +1790,7 @@ THREE.LDrawLoader = ( function () { var inverted = currentParseScope.inverted; var ccw = bfcCCW !== inverted; var doubleSided = ! bfcCertified || ! bfcCull; - var v0, v1, v2, v3; + var v0, v1, v2, v3, faceNormal; if ( ccw === true ) { @@ -1355,12 +1808,22 @@ THREE.LDrawLoader = ( function () { } + tempVec0.subVectors( v1, v0 ); + tempVec1.subVectors( v2, v1 ); + faceNormal = new THREE.Vector3() + .crossVectors( tempVec0, tempVec1 ) + .normalize(); + triangles.push( { material: material, colourCode: material.userData.code, v0: v0, v1: v1, - v2: v2 + v2: v2, + faceNormal: faceNormal, + n0: null, + n1: null, + n2: null } ); triangles.push( { @@ -1368,7 +1831,11 @@ THREE.LDrawLoader = ( function () { colourCode: material.userData.code, v0: v0, v1: v2, - v2: v3 + v2: v3, + faceNormal: faceNormal, + n0: null, + n1: null, + n2: null } ); if ( doubleSided === true ) { @@ -1378,7 +1845,11 @@ THREE.LDrawLoader = ( function () { colourCode: material.userData.code, v0: v0, v1: v2, - v2: v1 + v2: v1, + faceNormal: faceNormal, + n0: null, + n1: null, + n2: null } ); triangles.push( { @@ -1386,18 +1857,17 @@ THREE.LDrawLoader = ( function () { colourCode: material.userData.code, v0: v0, v1: v3, - v2: v2 + v2: v2, + faceNormal: faceNormal, + n0: null, + n1: null, + n2: null } ); } break; - // Line type 5: Optional line - case '5': - // Line type 5 is not implemented - break; - default: throw 'LDrawLoader: Unknown line type "' + lineType + '"' + lp.getLineNumberString() + '.'; break; @@ -1412,40 +1882,11 @@ THREE.LDrawLoader = ( function () { } - // - - var groupObject = null; - - if ( this.separateObjects ) { - - groupObject = new THREE.Group(); - - if ( lineSegments.length > 0 ) { - - groupObject.add( createObject( lineSegments, 2 ) ); - - - } - - if ( triangles.length > 0 ) { - - groupObject.add( createObject( triangles, 3 ) ); - - } - - } else { - - groupObject = this.currentGroupObject; - - } - - groupObject.userData.category = category; - groupObject.userData.keywords = keywords; - groupObject.userData.subobjects = subobjects; - - //console.timeEnd( 'LDrawLoader' ); - - return groupObject; + currentParseScope.category = category; + currentParseScope.keywords = keywords; + currentParseScope.subobjects = subobjects; + currentParseScope.numSubobjects = subobjects.length; + currentParseScope.subobjectIndex = 0; } diff --git a/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/loaders/LoaderSupport.js b/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/loaders/LoaderSupport.js index aed6f4c5..f40b1f88 100644 --- a/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/loaders/LoaderSupport.js +++ b/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/loaders/LoaderSupport.js @@ -347,7 +347,6 @@ THREE.LoaderSupport.PrepData.prototype = { * @class */ THREE.LoaderSupport.MeshBuilder = function() { - console.info( 'Using THREE.LoaderSupport.MeshBuilder version: ' + THREE.LoaderSupport.MeshBuilder.LOADER_MESH_BUILDER_VERSION ); this.validator = THREE.LoaderSupport.Validator; this.logging = { @@ -356,9 +355,11 @@ THREE.LoaderSupport.MeshBuilder = function() { }; this.callbacks = new THREE.LoaderSupport.Callbacks(); - this.materials = []; + this.materials = {}; }; -THREE.LoaderSupport.MeshBuilder.LOADER_MESH_BUILDER_VERSION = '1.3.0'; +THREE.LoaderSupport.MeshBuilder.LOADER_MESH_BUILDER_VERSION = '1.3.1'; +console.info( 'Using THREE.LoaderSupport.MeshBuilder version: ' + THREE.LoaderSupport.MeshBuilder.LOADER_MESH_BUILDER_VERSION ); + THREE.LoaderSupport.MeshBuilder.prototype = { @@ -715,7 +716,6 @@ THREE.LoaderSupport.MeshBuilder.prototype = { * @class */ THREE.LoaderSupport.WorkerSupport = function () { - console.info( 'Using THREE.LoaderSupport.WorkerSupport version: ' + THREE.LoaderSupport.WorkerSupport.WORKER_SUPPORT_VERSION ); this.logging = { enabled: true, debug: false @@ -726,6 +726,8 @@ THREE.LoaderSupport.WorkerSupport = function () { }; THREE.LoaderSupport.WorkerSupport.WORKER_SUPPORT_VERSION = '2.3.0'; +console.info( 'Using THREE.LoaderSupport.WorkerSupport version: ' + THREE.LoaderSupport.WorkerSupport.WORKER_SUPPORT_VERSION ); + THREE.LoaderSupport.WorkerSupport.prototype = { @@ -1285,10 +1287,10 @@ THREE.LoaderSupport.WorkerRunnerRefImpl.prototype = { var self = this.getParentScope(); var callbacks = { - callbackMeshBuilder: function ( payload ) { + callbackOnAssetAvailable: function ( payload ) { self.postMessage( payload ); }, - callbackProgress: function ( text ) { + callbackOnProgress: function ( text ) { if ( payload.logging.enabled && payload.logging.debug ) console.debug( 'WorkerRunner: progress: ' + text ); } }; @@ -1304,7 +1306,7 @@ THREE.LoaderSupport.WorkerRunnerRefImpl.prototype = { if ( payload.logging.enabled ) console.log( 'WorkerRunner: Run complete!' ); - callbacks.callbackMeshBuilder( { + callbacks.callbackOnAssetAvailable( { cmd: 'complete', msg: 'WorkerRunner completed run.' } ); @@ -1414,7 +1416,6 @@ THREE.LoaderSupport.WorkerSupport.NodeLoaderWorker.prototype.initWorker = functi * @param {string} classDef Class definition to be used for construction */ THREE.LoaderSupport.WorkerDirector = function ( classDef ) { - console.info( 'Using THREE.LoaderSupport.WorkerDirector version: ' + THREE.LoaderSupport.WorkerDirector.LOADER_WORKER_DIRECTOR_VERSION ); this.logging = { enabled: true, debug: false @@ -1443,6 +1444,8 @@ THREE.LoaderSupport.WorkerDirector = function ( classDef ) { THREE.LoaderSupport.WorkerDirector.LOADER_WORKER_DIRECTOR_VERSION = '2.3.0'; THREE.LoaderSupport.WorkerDirector.MAX_WEB_WORKER = 16; THREE.LoaderSupport.WorkerDirector.MAX_QUEUE_SIZE = 2048; +console.info( 'Using THREE.LoaderSupport.WorkerDirector version: ' + THREE.LoaderSupport.WorkerDirector.LOADER_WORKER_DIRECTOR_VERSION ); + THREE.LoaderSupport.WorkerDirector.prototype = { diff --git a/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/loaders/MTLLoader.js b/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/loaders/MTLLoader.js index 50de5b93..4e7d9159 100644 --- a/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/loaders/MTLLoader.js +++ b/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/loaders/MTLLoader.js @@ -14,6 +14,8 @@ THREE.MTLLoader.prototype = { constructor: THREE.MTLLoader, + crossOrigin: 'anonymous', + /** * Loads and parses a MTL asset from a URL. * @@ -149,7 +151,7 @@ THREE.MTLLoader.prototype = { } else { - if ( key === 'ka' || key === 'kd' || key === 'ks' || key ==='ke' ) { + if ( key === 'ka' || key === 'kd' || key === 'ks' || key === 'ke' ) { var ss = value.split( delimiter_pattern, 3 ); info[ key ] = [ parseFloat( ss[ 0 ] ), parseFloat( ss[ 1 ] ), parseFloat( ss[ 2 ] ) ]; diff --git a/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/loaders/OBJLoader2.js b/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/loaders/OBJLoader2.js index 7d3d21a5..1f979e50 100644 --- a/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/loaders/OBJLoader2.js +++ b/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/loaders/OBJLoader2.js @@ -17,8 +17,6 @@ if ( THREE.LoaderSupport === undefined ) console.error( '"THREE.LoaderSupport" i */ THREE.OBJLoader2 = function ( manager ) { - console.info( 'Using THREE.OBJLoader2 version: ' + THREE.OBJLoader2.OBJLOADER2_VERSION ); - this.manager = THREE.LoaderSupport.Validator.verifyInput( manager, THREE.DefaultLoadingManager ); this.logging = { enabled: true, @@ -40,8 +38,9 @@ THREE.OBJLoader2 = function ( manager ) { this.workerSupport = new THREE.LoaderSupport.WorkerSupport(); this.terminateWorkerOnLoad = true; }; +THREE.OBJLoader2.OBJLOADER2_VERSION = '2.5.1'; +console.info( 'Using THREE.OBJLoader2 version: ' + THREE.OBJLoader2.OBJLOADER2_VERSION ); -THREE.OBJLoader2.OBJLOADER2_VERSION = '2.5.0'; THREE.OBJLoader2.prototype = { @@ -174,19 +173,12 @@ THREE.OBJLoader2.prototype = { if ( this.logging.enabled && this.logging.debug ) console.debug( content ); }, - _onError: function ( event ) { - var output = 'Error occurred while downloading!'; - - if ( event.currentTarget && event.currentTarget.statusText !== null ) { + _onError: function ( errorMessage ) { + if ( this.logging.enabled && this.logging.debug ) { - output += '\nurl: ' + event.currentTarget.responseURL + '\nstatus: ' + event.currentTarget.statusText; + console.log( errorMessage ); } - this.onProgress( 'error', output, -1 ); - this._throwError( output ); - }, - - _throwError: function ( errorMessage ) { if ( THREE.LoaderSupport.Validator.isValid( this.callbacks.onReportError ) ) { this.callbacks.onReportError( errorMessage ); @@ -216,9 +208,18 @@ THREE.OBJLoader2.prototype = { _loadObj: function ( resource, onLoad, onProgress, onError, onMeshAlter, useAsync ) { var scope = this; if ( ! THREE.LoaderSupport.Validator.isValid( onError ) ) { + onError = function ( event ) { - scope._onError( event ); - } + + var errorMessage = event; + if ( event.currentTarget && event.currentTarget.statusText !== null ) { + + errorMessage = 'Error occurred while downloading!\nurl: ' + event.currentTarget.responseURL + '\nstatus: ' + event.currentTarget.statusText; + + } + scope._onError( errorMessage ); + + }; } // fast-fail @@ -339,10 +340,9 @@ THREE.OBJLoader2.prototype = { */ parse: function ( content ) { // fast-fail in case of illegal data - if ( ! THREE.LoaderSupport.Validator.isValid( content ) ) { + if ( content === null || content === undefined ) { - console.warn( 'Provided content is not a valid ArrayBuffer or String.' ); - return this.loaderRootNode; + throw 'Provided content is not a valid ArrayBuffer or String. Unable to continue parsing'; } if ( this.logging.enabled ) console.time( 'OBJLoader2 parse: ' + this.modelName ); @@ -366,11 +366,15 @@ THREE.OBJLoader2.prototype = { scope.loaderRootNode.add( mesh ); } }; - parser.setCallbackMeshBuilder( onMeshLoaded ); + parser.setCallbackOnAssetAvailable( onMeshLoaded ); var onProgressScoped = function ( text, numericalValue ) { scope.onProgress( 'progressParse', text, numericalValue ); }; - parser.setCallbackProgress( onProgressScoped ); + parser.setCallbackOnProgress( onProgressScoped ); + var onErrorScoped = function ( message ) { + scope._onError( message ); + }; + parser.setCallbackOnError( onErrorScoped ); if ( content instanceof ArrayBuffer || content instanceof Uint8Array ) { @@ -384,7 +388,7 @@ THREE.OBJLoader2.prototype = { } else { - this._throwError( 'Provided content was neither of type String nor Uint8Array! Aborting...' ); + this._onError( 'Provided content was neither of type String nor Uint8Array! Aborting...' ); } if ( this.logging.enabled ) console.timeEnd( 'OBJLoader2 parse: ' + this.modelName ); @@ -414,10 +418,9 @@ THREE.OBJLoader2.prototype = { if ( measureTime && scope.logging.enabled ) console.timeEnd( 'OBJLoader2 parseAsync: ' + scope.modelName ); }; // fast-fail in case of illegal data - if ( ! THREE.LoaderSupport.Validator.isValid( content ) ) { + if ( content === null || content === undefined ) { - console.warn( 'Provided content is not a valid ArrayBuffer.' ); - scopedOnLoad() + throw 'Provided content is not a valid ArrayBuffer or String. Unable to continue parsing'; } else { @@ -441,7 +444,6 @@ THREE.OBJLoader2.prototype = { workerCode += ' * This code was constructed by OBJLoader2 buildCode.\n'; workerCode += ' */\n\n'; workerCode += 'THREE = { LoaderSupport: {}, OBJLoader2: {} };\n\n'; - workerCode += codeSerializer.serializeObject( 'THREE.LoaderSupport.Validator', THREE.LoaderSupport.Validator ); workerCode += codeSerializer.serializeClass( 'THREE.OBJLoader2.Parser', THREE.OBJLoader2.Parser ); return workerCode; @@ -503,7 +505,7 @@ THREE.OBJLoader2.prototype = { if ( THREE.MTLLoader === undefined ) console.error( '"THREE.MTLLoader" is not available. "THREE.OBJLoader2" requires it for loading MTL files.' ); if ( THREE.LoaderSupport.Validator.isValid( resource ) && this.logging.enabled ) console.time( 'Loading MTL: ' + resource.name ); - var materials = []; + var materials = {}; var scope = this; var processMaterials = function ( materialCreator ) { var materialCreatorMaterials = []; @@ -548,7 +550,7 @@ THREE.OBJLoader2.prototype = { } else { - this._throwError( 'Unable to parse mtl as it it seems to be neither a String, an Array or an ArrayBuffer!' ); + scope._onError( 'Unable to parse mtl as it it seems to be neither a String, an Array or an ArrayBuffer!' ); } } @@ -597,8 +599,11 @@ THREE.OBJLoader2.prototype = { * @class */ THREE.OBJLoader2.Parser = function () { - this.callbackProgress = null; - this.callbackMeshBuilder = null; + this.callbacks = { + onProgress: null, + onAssetAvailable: null, + onError: null + }; this.contentRef = null; this.legacyMode = false; @@ -696,29 +701,61 @@ THREE.OBJLoader2.Parser.prototype = { }, setMaterials: function ( materials ) { - this.materials = THREE.LoaderSupport.Validator.verifyInput( materials, this.materials ); - this.materials = THREE.LoaderSupport.Validator.verifyInput( this.materials, {} ); + if ( materials === undefined || materials === null ) return; + + for ( var materialName in materials ) { + if ( materials.hasOwnProperty( materialName ) ) { + + this.materials[ materialName ] = materials[ materialName ]; + + } + } }, - setCallbackMeshBuilder: function ( callbackMeshBuilder ) { - if ( ! THREE.LoaderSupport.Validator.isValid( callbackMeshBuilder ) ) { + setCallbackOnAssetAvailable: function ( onAssetAvailable ) { + if ( onAssetAvailable !== null && onAssetAvailable !== undefined ) { - this._throwError( 'Unable to run as no "MeshBuilder" callback is set.' ); + this.callbacks.onAssetAvailable = onAssetAvailable; } - this.callbackMeshBuilder = callbackMeshBuilder; }, - setCallbackProgress: function ( callbackProgress ) { - this.callbackProgress = callbackProgress; + setCallbackOnProgress: function ( onProgress ) { + if ( onProgress !== null && onProgress !== undefined ) { + + this.callbacks.onProgress = onProgress; + + } + }, + + setCallbackOnError: function ( onError ) { + if ( onError !== null && onError !== undefined ) { + + this.callbacks.onError = onError; + + } }, + setLogging: function ( enabled, debug ) { this.logging.enabled = enabled === true; this.logging.debug = debug === true; }, configure: function () { + if ( this.callbacks.onAssetAvailable === null ) { + + var errorMessage = 'Unable to run as no callback for building meshes is set.'; + if ( this.callbacks.onError !== null ) { + + this.callbacks.onError( errorMessage ); + + } else { + + throw errorMessage; + } + + } this.pushSmoothingGroup( 1 ); if ( this.logging.enabled ) { @@ -731,9 +768,16 @@ THREE.OBJLoader2.Parser.prototype = { + '\n\tmaterialPerSmoothingGroup: ' + this.materialPerSmoothingGroup + '\n\tuseOAsMesh: ' + this.useOAsMesh + '\n\tuseIndices: ' + this.useIndices - + '\n\tdisregardNormals: ' + this.disregardNormals - + '\n\tcallbackMeshBuilderName: ' + this.callbackMeshBuilder.name - + '\n\tcallbackProgressName: ' + this.callbackProgress.name; + + '\n\tdisregardNormals: ' + this.disregardNormals; + if ( this.callbacks.onProgress !== null ) { + printedConfig += '\n\tcallbacks.onProgress: ' + this.callbacks.onProgress.name; + } + if ( this.callbacks.onAssetAvailable !== null ) { + printedConfig += '\n\tcallbacks.onAssetAvailable: ' + this.callbacks.onAssetAvailable.name; + } + if ( this.callbacks.onError !== null ) { + printedConfig += '\n\tcallbacks.onError: ' + this.callbacks.onError.name; + } console.info( printedConfig ); } }, @@ -1042,7 +1086,7 @@ THREE.OBJLoader2.Parser.prototype = { var index = this.rawMesh.activeMtlName + '|' + this.rawMesh.smoothingGroup.normalized; this.rawMesh.subGroupInUse = this.rawMesh.subGroups[ index ]; - if ( ! THREE.LoaderSupport.Validator.isValid( this.rawMesh.subGroupInUse ) ) { + if ( this.rawMesh.subGroupInUse === undefined || this.rawMesh.subGroupInUse === null ) { this.rawMesh.subGroupInUse = { index: index, @@ -1110,17 +1154,17 @@ THREE.OBJLoader2.Parser.prototype = { var mappingName = faceIndexV + ( faceIndexU ? '_' + faceIndexU : '_n' ) + ( faceIndexN ? '_' + faceIndexN : '_n' ); var indicesPointer = this.rawMesh.subGroupInUse.indexMappings[ mappingName ]; - if ( THREE.LoaderSupport.Validator.isValid( indicesPointer ) ) { - - this.rawMesh.counts.doubleIndicesCount++; - - } else { + if ( indicesPointer === undefined || indicesPointer === null ) { indicesPointer = this.rawMesh.subGroupInUse.vertices.length / 3; updateSubGroupInUse(); this.rawMesh.subGroupInUse.indexMappings[ mappingName ] = indicesPointer; this.rawMesh.subGroupInUse.indexMappingsCount++; + } else { + + this.rawMesh.counts.doubleIndicesCount++; + } this.rawMesh.subGroupInUse.indices.push( indicesPointer ); @@ -1202,11 +1246,12 @@ THREE.OBJLoader2.Parser.prototype = { processCompletedMesh: function () { var result = this.finalizeRawMesh(); - if ( THREE.LoaderSupport.Validator.isValid( result ) ) { + var haveMesh = result !== null; + if ( haveMesh ) { - if ( this.colors.length > 0 && this.colors.length !== this.vertices.length ) { + if ( this.colors.length > 0 && this.colors.length !== this.vertices.length && this.callbacks.onError !== null ) { - this._throwError( 'Vertex Colors were detected, but vertex count and color count do not match!' ); + this.callbacks.onError( 'Vertex Colors were detected, but vertex count and color count do not match!' ); } if ( this.logging.enabled && this.logging.debug ) console.debug( this.createRawMeshReport( this.inputObjectCount ) ); @@ -1214,14 +1259,17 @@ THREE.OBJLoader2.Parser.prototype = { this.buildMesh( result ); var progressBytesPercent = this.globalCounts.currentByte / this.globalCounts.totalBytes; - this.callbackProgress( 'Completed [o: ' + this.rawMesh.objectName + ' g:' + this.rawMesh.groupName + '] Total progress: ' + ( progressBytesPercent * 100 ).toFixed( 2 ) + '%', progressBytesPercent ); + if ( this.callbacks.onProgress !== null ) { + + this.callbacks.onProgress( 'Completed [o: ' + this.rawMesh.objectName + ' g:' + this.rawMesh.groupName + + '] Total progress: ' + ( progressBytesPercent * 100 ).toFixed( 2 ) + '%', progressBytesPercent ); + + } this.resetRawMesh(); return true; - } else { - - return false; } + return haveMesh; }, /** @@ -1241,7 +1289,7 @@ THREE.OBJLoader2.Parser.prototype = { var colorFA = ( result.absoluteColorCount > 0 ) ? new Float32Array( result.absoluteColorCount ) : null; var normalFA = ( result.absoluteNormalCount > 0 ) ? new Float32Array( result.absoluteNormalCount ) : null; var uvFA = ( result.absoluteUvCount > 0 ) ? new Float32Array( result.absoluteUvCount ) : null; - var haveVertexColors = THREE.LoaderSupport.Validator.isValid( colorFA ); + var haveVertexColors = colorFA !== null; var meshOutputGroup; var materialNames = []; @@ -1283,25 +1331,20 @@ THREE.OBJLoader2.Parser.prototype = { material = this.materials[ materialName ]; // both original and derived names do not lead to an existing material => need to use a default material - if ( ! THREE.LoaderSupport.Validator.isValid( materialOrg ) && ! THREE.LoaderSupport.Validator.isValid( material ) ) { - - var defaultMaterialName = haveVertexColors ? 'defaultVertexColorMaterial' : 'defaultMaterial'; - materialOrg = this.materials[ defaultMaterialName ]; - if ( this.logging.enabled ) console.warn( 'object_group "' + meshOutputGroup.objectName + '_' + - meshOutputGroup.groupName + '" was defined with unresolvable material "' + - materialNameOrg + '"! Assigning "' + defaultMaterialName + '".' ); - materialNameOrg = defaultMaterialName; + if ( ( materialOrg === undefined || materialOrg === null ) && ( material === undefined || material === null ) ) { - // if names are identical then there is no need for later manipulation - if ( materialNameOrg === materialName ) { + materialName = haveVertexColors ? 'defaultVertexColorMaterial' : 'defaultMaterial'; + material = this.materials[ materialName ]; + if ( this.logging.enabled ) { - material = materialOrg; - materialName = defaultMaterialName; + console.info( 'object_group "' + meshOutputGroup.objectName + '_' + + meshOutputGroup.groupName + '" was defined with unresolvable material "' + + materialNameOrg + '"! Assigning "' + materialName + '".' ); } } - if ( ! THREE.LoaderSupport.Validator.isValid( material ) ) { + if ( material === undefined || material === null ) { var materialCloneInstructions = { materialNameOrg: materialNameOrg, @@ -1317,7 +1360,7 @@ THREE.OBJLoader2.Parser.prototype = { materialCloneInstructions: materialCloneInstructions } }; - this.callbackMeshBuilder( payload ); + this.callbacks.onAssetAvailable( payload ); // fake entry for async; sync Parser always works on material references (Builder update directly visible here) if ( this.useAsync ) this.materials[ materialName ] = materialCloneInstructions; @@ -1382,7 +1425,7 @@ THREE.OBJLoader2.Parser.prototype = { } if ( this.logging.enabled && this.logging.debug ) { - var materialIndexLine = THREE.LoaderSupport.Validator.isValid( selectedMaterialIndex ) ? '\n\t\tmaterialIndex: ' + selectedMaterialIndex : ''; + var materialIndexLine = ( selectedMaterialIndex === undefined || selectedMaterialIndex === null ) ? '' : '\n\t\tmaterialIndex: ' + selectedMaterialIndex; var createdReport = '\tOutput Object no.: ' + this.outputObjectCount + '\n\t\tgroupName: ' + meshOutputGroup.groupName + '\n\t\tIndex: ' + meshOutputGroup.index + @@ -1402,7 +1445,7 @@ THREE.OBJLoader2.Parser.prototype = { } this.outputObjectCount++; - this.callbackMeshBuilder( + this.callbacks.onAssetAvailable( { cmd: 'meshData', progress: { @@ -1427,10 +1470,10 @@ THREE.OBJLoader2.Parser.prototype = { geometryType: this.rawMesh.faceType < 4 ? 0 : ( this.rawMesh.faceType === 6 ) ? 2 : 1 }, [ vertexFA.buffer ], - THREE.LoaderSupport.Validator.isValid( indexUA ) ? [ indexUA.buffer ] : null, - THREE.LoaderSupport.Validator.isValid( colorFA ) ? [ colorFA.buffer ] : null, - THREE.LoaderSupport.Validator.isValid( normalFA ) ? [ normalFA.buffer ] : null, - THREE.LoaderSupport.Validator.isValid( uvFA ) ? [ uvFA.buffer ] : null + indexUA !== null ? [ indexUA.buffer ] : null, + colorFA !== null ? [ colorFA.buffer ] : null, + normalFA !== null ? [ normalFA.buffer ] : null, + uvFA !== null ? [ uvFA.buffer ] : null ); }, diff --git a/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/loaders/PCDLoader.js b/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/loaders/PCDLoader.js index 19d22e92..fe5e554a 100644 --- a/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/loaders/PCDLoader.js +++ b/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/loaders/PCDLoader.js @@ -169,7 +169,7 @@ THREE.PCDLoader.prototype = { } - var textData = THREE.LoaderUtils.decodeText( data ); + var textData = THREE.LoaderUtils.decodeText( new Uint8Array( data ) ); // parse header (always ascii format) diff --git a/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/loaders/RGBELoader.js b/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/loaders/RGBELoader.js index 85cdcc1f..ee9c0e5f 100644 --- a/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/loaders/RGBELoader.js +++ b/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/loaders/RGBELoader.js @@ -5,7 +5,7 @@ // https://github.com/mrdoob/three.js/issues/5552 // http://en.wikipedia.org/wiki/RGBE_image_format -THREE.HDRLoader = THREE.RGBELoader = function ( manager ) { +THREE.RGBELoader = function ( manager ) { this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager; this.type = THREE.UnsignedByteType; @@ -316,8 +316,7 @@ THREE.RGBELoader.prototype._parser = function ( buffer ) { } ; - var byteArray = new Uint8Array( buffer ), - byteLength = byteArray.byteLength; + var byteArray = new Uint8Array( buffer ); byteArray.pos = 0; var rgbe_header_info = RGBE_ReadHeader( byteArray ); @@ -392,5 +391,3 @@ THREE.RGBELoader.prototype.setType = function ( value ) { return this; }; - - diff --git a/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/loaders/SVGLoader.js b/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/loaders/SVGLoader.js index a8e8a425..22bab360 100644 --- a/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/loaders/SVGLoader.js +++ b/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/loaders/SVGLoader.js @@ -56,37 +56,37 @@ THREE.SVGLoader.prototype = { case 'path': style = parseStyle( node, style ); - if ( node.hasAttribute( 'd' ) ) path = parsePathNode( node, style ); + if ( node.hasAttribute( 'd' ) ) path = parsePathNode( node ); break; case 'rect': style = parseStyle( node, style ); - path = parseRectNode( node, style ); + path = parseRectNode( node ); break; case 'polygon': style = parseStyle( node, style ); - path = parsePolygonNode( node, style ); + path = parsePolygonNode( node ); break; case 'polyline': style = parseStyle( node, style ); - path = parsePolylineNode( node, style ); + path = parsePolylineNode( node ); break; case 'circle': style = parseStyle( node, style ); - path = parseCircleNode( node, style ); + path = parseCircleNode( node ); break; case 'ellipse': style = parseStyle( node, style ); - path = parseEllipseNode( node, style ); + path = parseEllipseNode( node ); break; case 'line': style = parseStyle( node, style ); - path = parseLineNode( node, style ); + path = parseLineNode( node ); break; default: @@ -136,7 +136,7 @@ THREE.SVGLoader.prototype = { } - function parsePathNode( node, style ) { + function parsePathNode( node ) { var path = new THREE.ShapePath(); @@ -161,8 +161,10 @@ THREE.SVGLoader.prototype = { var data = command.substr( 1 ).trim(); if ( isFirstPoint === true ) { + doSetFirstPoint = true; isFirstPoint = false; + } switch ( type ) { @@ -170,56 +172,78 @@ THREE.SVGLoader.prototype = { case 'M': var numbers = parseFloats( data ); for ( var j = 0, jl = numbers.length; j < jl; j += 2 ) { + point.x = numbers[ j + 0 ]; point.y = numbers[ j + 1 ]; control.x = point.x; control.y = point.y; + if ( j === 0 ) { + path.moveTo( point.x, point.y ); + } else { + path.lineTo( point.x, point.y ); + } + if ( j === 0 && doSetFirstPoint === true ) firstPoint.copy( point ); + } break; case 'H': var numbers = parseFloats( data ); + for ( var j = 0, jl = numbers.length; j < jl; j ++ ) { + point.x = numbers[ j ]; control.x = point.x; control.y = point.y; path.lineTo( point.x, point.y ); + if ( j === 0 && doSetFirstPoint === true ) firstPoint.copy( point ); + } break; case 'V': var numbers = parseFloats( data ); + for ( var j = 0, jl = numbers.length; j < jl; j ++ ) { + point.y = numbers[ j ]; control.x = point.x; control.y = point.y; path.lineTo( point.x, point.y ); + if ( j === 0 && doSetFirstPoint === true ) firstPoint.copy( point ); + } break; case 'L': var numbers = parseFloats( data ); + for ( var j = 0, jl = numbers.length; j < jl; j += 2 ) { + point.x = numbers[ j + 0 ]; point.y = numbers[ j + 1 ]; control.x = point.x; control.y = point.y; path.lineTo( point.x, point.y ); + if ( j === 0 && doSetFirstPoint === true ) firstPoint.copy( point ); + } break; case 'C': var numbers = parseFloats( data ); + for ( var j = 0, jl = numbers.length; j < jl; j += 6 ) { + path.bezierCurveTo( numbers[ j + 0 ], numbers[ j + 1 ], @@ -232,13 +256,17 @@ THREE.SVGLoader.prototype = { control.y = numbers[ j + 3 ]; point.x = numbers[ j + 4 ]; point.y = numbers[ j + 5 ]; + if ( j === 0 && doSetFirstPoint === true ) firstPoint.copy( point ); + } break; case 'S': var numbers = parseFloats( data ); + for ( var j = 0, jl = numbers.length; j < jl; j += 4 ) { + path.bezierCurveTo( getReflection( point.x, control.x ), getReflection( point.y, control.y ), @@ -251,13 +279,17 @@ THREE.SVGLoader.prototype = { control.y = numbers[ j + 1 ]; point.x = numbers[ j + 2 ]; point.y = numbers[ j + 3 ]; + if ( j === 0 && doSetFirstPoint === true ) firstPoint.copy( point ); + } break; case 'Q': var numbers = parseFloats( data ); + for ( var j = 0, jl = numbers.length; j < jl; j += 4 ) { + path.quadraticCurveTo( numbers[ j + 0 ], numbers[ j + 1 ], @@ -268,13 +300,17 @@ THREE.SVGLoader.prototype = { control.y = numbers[ j + 1 ]; point.x = numbers[ j + 2 ]; point.y = numbers[ j + 3 ]; + if ( j === 0 && doSetFirstPoint === true ) firstPoint.copy( point ); + } break; case 'T': var numbers = parseFloats( data ); + for ( var j = 0, jl = numbers.length; j < jl; j += 2 ) { + var rx = getReflection( point.x, control.x ); var ry = getReflection( point.y, control.y ); path.quadraticCurveTo( @@ -287,13 +323,17 @@ THREE.SVGLoader.prototype = { control.y = ry; point.x = numbers[ j + 0 ]; point.y = numbers[ j + 1 ]; + if ( j === 0 && doSetFirstPoint === true ) firstPoint.copy( point ); + } break; case 'A': var numbers = parseFloats( data ); + for ( var j = 0, jl = numbers.length; j < jl; j += 7 ) { + var start = point.clone(); point.x = numbers[ j + 5 ]; point.y = numbers[ j + 6 ]; @@ -302,65 +342,88 @@ THREE.SVGLoader.prototype = { parseArcCommand( path, numbers[ j ], numbers[ j + 1 ], numbers[ j + 2 ], numbers[ j + 3 ], numbers[ j + 4 ], start, point ); + if ( j === 0 && doSetFirstPoint === true ) firstPoint.copy( point ); + } break; - // - case 'm': var numbers = parseFloats( data ); + for ( var j = 0, jl = numbers.length; j < jl; j += 2 ) { + point.x += numbers[ j + 0 ]; point.y += numbers[ j + 1 ]; control.x = point.x; control.y = point.y; + if ( j === 0 ) { + path.moveTo( point.x, point.y ); + } else { + path.lineTo( point.x, point.y ); + } + if ( j === 0 && doSetFirstPoint === true ) firstPoint.copy( point ); + } break; case 'h': var numbers = parseFloats( data ); + for ( var j = 0, jl = numbers.length; j < jl; j ++ ) { + point.x += numbers[ j ]; control.x = point.x; control.y = point.y; path.lineTo( point.x, point.y ); + if ( j === 0 && doSetFirstPoint === true ) firstPoint.copy( point ); + } break; case 'v': var numbers = parseFloats( data ); + for ( var j = 0, jl = numbers.length; j < jl; j ++ ) { + point.y += numbers[ j ]; control.x = point.x; control.y = point.y; path.lineTo( point.x, point.y ); + if ( j === 0 && doSetFirstPoint === true ) firstPoint.copy( point ); + } break; case 'l': var numbers = parseFloats( data ); + for ( var j = 0, jl = numbers.length; j < jl; j += 2 ) { + point.x += numbers[ j + 0 ]; point.y += numbers[ j + 1 ]; control.x = point.x; control.y = point.y; path.lineTo( point.x, point.y ); + if ( j === 0 && doSetFirstPoint === true ) firstPoint.copy( point ); + } break; case 'c': var numbers = parseFloats( data ); + for ( var j = 0, jl = numbers.length; j < jl; j += 6 ) { + path.bezierCurveTo( point.x + numbers[ j + 0 ], point.y + numbers[ j + 1 ], @@ -373,13 +436,17 @@ THREE.SVGLoader.prototype = { control.y = point.y + numbers[ j + 3 ]; point.x += numbers[ j + 4 ]; point.y += numbers[ j + 5 ]; + if ( j === 0 && doSetFirstPoint === true ) firstPoint.copy( point ); + } break; case 's': var numbers = parseFloats( data ); + for ( var j = 0, jl = numbers.length; j < jl; j += 4 ) { + path.bezierCurveTo( getReflection( point.x, control.x ), getReflection( point.y, control.y ), @@ -392,13 +459,17 @@ THREE.SVGLoader.prototype = { control.y = point.y + numbers[ j + 1 ]; point.x += numbers[ j + 2 ]; point.y += numbers[ j + 3 ]; + if ( j === 0 && doSetFirstPoint === true ) firstPoint.copy( point ); + } break; case 'q': var numbers = parseFloats( data ); + for ( var j = 0, jl = numbers.length; j < jl; j += 4 ) { + path.quadraticCurveTo( point.x + numbers[ j + 0 ], point.y + numbers[ j + 1 ], @@ -409,13 +480,17 @@ THREE.SVGLoader.prototype = { control.y = point.y + numbers[ j + 1 ]; point.x += numbers[ j + 2 ]; point.y += numbers[ j + 3 ]; + if ( j === 0 && doSetFirstPoint === true ) firstPoint.copy( point ); + } break; case 't': var numbers = parseFloats( data ); + for ( var j = 0, jl = numbers.length; j < jl; j += 2 ) { + var rx = getReflection( point.x, control.x ); var ry = getReflection( point.y, control.y ); path.quadraticCurveTo( @@ -428,13 +503,17 @@ THREE.SVGLoader.prototype = { control.y = ry; point.x = point.x + numbers[ j + 0 ]; point.y = point.y + numbers[ j + 1 ]; + if ( j === 0 && doSetFirstPoint === true ) firstPoint.copy( point ); + } break; case 'a': var numbers = parseFloats( data ); + for ( var j = 0, jl = numbers.length; j < jl; j += 7 ) { + var start = point.clone(); point.x += numbers[ j + 5 ]; point.y += numbers[ j + 6 ]; @@ -443,20 +522,23 @@ THREE.SVGLoader.prototype = { parseArcCommand( path, numbers[ j ], numbers[ j + 1 ], numbers[ j + 2 ], numbers[ j + 3 ], numbers[ j + 4 ], start, point ); + if ( j === 0 && doSetFirstPoint === true ) firstPoint.copy( point ); + } break; - // - case 'Z': case 'z': path.currentPath.autoClose = true; + if ( path.currentPath.curves.length > 0 ) { + // Reset point to beginning of Path point.copy( firstPoint ); path.currentPath.currentPoint.copy( point ); isFirstPoint = true; + } break; @@ -540,8 +622,8 @@ THREE.SVGLoader.prototype = { function svgAngle( ux, uy, vx, vy ) { var dot = ux * vx + uy * vy; - var len = Math.sqrt( ux * ux + uy * uy ) * Math.sqrt( vx * vx + vy * vy ); - var ang = Math.acos( Math.max( -1, Math.min( 1, dot / len ) ) ); // floating point precision, slightly over values appear + var len = Math.sqrt( ux * ux + uy * uy ) * Math.sqrt( vx * vx + vy * vy ); + var ang = Math.acos( Math.max( - 1, Math.min( 1, dot / len ) ) ); // floating point precision, slightly over values appear if ( ( ux * vy - uy * vx ) < 0 ) ang = - ang; return ang; @@ -551,7 +633,7 @@ THREE.SVGLoader.prototype = { * According to https://www.w3.org/TR/SVG/shapes.html#RectElementRXAttribute * rounded corner should be rendered to elliptical arc, but bezier curve does the job well enough */ - function parseRectNode( node, style ) { + function parseRectNode( node ) { var x = parseFloat( node.getAttribute( 'x' ) || 0 ); var y = parseFloat( node.getAttribute( 'y' ) || 0 ); @@ -586,7 +668,7 @@ THREE.SVGLoader.prototype = { } - function parsePolygonNode( node, style ) { + function parsePolygonNode( node ) { function iterator( match, a, b ) { @@ -594,9 +676,13 @@ THREE.SVGLoader.prototype = { var y = parseFloat( b ); if ( index === 0 ) { + path.moveTo( x, y ); + } else { + path.lineTo( x, y ); + } index ++; @@ -609,7 +695,7 @@ THREE.SVGLoader.prototype = { var index = 0; - node.getAttribute( 'points' ).replace(regex, iterator); + node.getAttribute( 'points' ).replace( regex, iterator ); path.currentPath.autoClose = true; @@ -617,7 +703,7 @@ THREE.SVGLoader.prototype = { } - function parsePolylineNode( node, style ) { + function parsePolylineNode( node ) { function iterator( match, a, b ) { @@ -625,9 +711,13 @@ THREE.SVGLoader.prototype = { var y = parseFloat( b ); if ( index === 0 ) { + path.moveTo( x, y ); + } else { + path.lineTo( x, y ); + } index ++; @@ -640,7 +730,7 @@ THREE.SVGLoader.prototype = { var index = 0; - node.getAttribute( 'points' ).replace(regex, iterator); + node.getAttribute( 'points' ).replace( regex, iterator ); path.currentPath.autoClose = false; @@ -648,7 +738,7 @@ THREE.SVGLoader.prototype = { } - function parseCircleNode( node, style ) { + function parseCircleNode( node ) { var x = parseFloat( node.getAttribute( 'cx' ) ); var y = parseFloat( node.getAttribute( 'cy' ) ); @@ -664,7 +754,7 @@ THREE.SVGLoader.prototype = { } - function parseEllipseNode( node, style ) { + function parseEllipseNode( node ) { var x = parseFloat( node.getAttribute( 'cx' ) ); var y = parseFloat( node.getAttribute( 'cy' ) ); @@ -681,7 +771,7 @@ THREE.SVGLoader.prototype = { } - function parseLineNode( node, style ) { + function parseLineNode( node ) { var x1 = parseFloat( node.getAttribute( 'x1' ) ); var y1 = parseFloat( node.getAttribute( 'y1' ) ); @@ -705,7 +795,11 @@ THREE.SVGLoader.prototype = { function addStyle( svgName, jsName, adjustFunction ) { - if ( adjustFunction === undefined ) adjustFunction = function copy( v ) { return v; }; + if ( adjustFunction === undefined ) adjustFunction = function copy( v ) { + + return v; + + }; if ( node.hasAttribute( svgName ) ) style[ jsName ] = adjustFunction( node.getAttribute( svgName ) ); if ( node.style[ svgName ] !== '' ) style[ jsName ] = adjustFunction( node.style[ svgName ] ); @@ -780,7 +874,9 @@ THREE.SVGLoader.prototype = { function getNodeTransform( node ) { if ( ! node.hasAttribute( 'transform' ) ) { + return null; + } var transform = parseNodeTransform( node ); @@ -788,7 +884,9 @@ THREE.SVGLoader.prototype = { if ( transform ) { if ( transformStack.length > 0 ) { + transform.premultiply( transformStack[ transformStack.length - 1 ] ); + } currentTransform.copy( transform ); @@ -864,7 +962,7 @@ THREE.SVGLoader.prototype = { } // Rotate around center (cx, cy) - tempTransform1.identity().translate( -cx, -cy ); + tempTransform1.identity().translate( - cx, - cy ); tempTransform2.identity().rotate( angle ); tempTransform3.multiplyMatrices( tempTransform2, tempTransform1 ); tempTransform1.identity().translate( cx, cy ); @@ -882,7 +980,9 @@ THREE.SVGLoader.prototype = { var scaleY = scaleX; if ( array.length >= 2 ) { + scaleY = array[ 1 ]; + } currentTransform.scale( scaleX, scaleY ); @@ -932,6 +1032,7 @@ THREE.SVGLoader.prototype = { } break; + } } @@ -958,12 +1059,12 @@ THREE.SVGLoader.prototype = { var subPaths = path.subPaths; - for ( var i = 0, n = subPaths.length; i < n; i++ ) { + for ( var i = 0, n = subPaths.length; i < n; i ++ ) { var subPath = subPaths[ i ]; var curves = subPath.curves; - for ( var j = 0; j < curves.length; j++ ) { + for ( var j = 0; j < curves.length; j ++ ) { var curve = curves[ j ]; @@ -988,7 +1089,9 @@ THREE.SVGLoader.prototype = { } else if ( curve.isEllipseCurve ) { if ( isRotated ) { + console.warn( "SVGLoader: Elliptic arc or ellipse rotation or skewing is not implemented." ); + } tempV2.set( curve.aX, curve.aY ); @@ -1008,17 +1111,23 @@ THREE.SVGLoader.prototype = { } function isTransformRotated( m ) { + return m.elements[ 1 ] !== 0 || m.elements[ 3 ] !== 0; + } function getTransformScaleX( m ) { + var te = m.elements; - return Math.sqrt( te[ 0 ] * te[ 0 ] + te[ 1 ] * te[ 1 ] ) + return Math.sqrt( te[ 0 ] * te[ 0 ] + te[ 1 ] * te[ 1 ] ); + } function getTransformScaleY( m ) { + var te = m.elements; - return Math.sqrt( te[ 3 ] * te[ 3 ] + te[ 4 ] * te[ 4 ] ) + return Math.sqrt( te[ 3 ] * te[ 3 ] + te[ 4 ] * te[ 4 ] ); + } // @@ -1038,8 +1147,6 @@ THREE.SVGLoader.prototype = { var currentTransform = new THREE.Matrix3(); - var scope = this; - console.time( 'THREE.SVGLoader: DOMParser' ); var xml = new DOMParser().parseFromString( text, 'image/svg+xml' ); // application/xml @@ -1071,7 +1178,7 @@ THREE.SVGLoader.prototype = { }; -THREE.SVGLoader.getStrokeStyle = function ( width, color, opacity, lineJoin, lineCap, miterLimit ) { +THREE.SVGLoader.getStrokeStyle = function ( width, color, opacity, lineJoin, lineCap, miterLimit ) { // Param width: Stroke width // Param color: As returned by THREE.Color.getStyle() @@ -1136,7 +1243,6 @@ THREE.SVGLoader.pointsToStrokeWithBuffers = function () { var tempV2_5 = new THREE.Vector2(); var tempV2_6 = new THREE.Vector2(); var tempV2_7 = new THREE.Vector2(); - var tempV3_1 = new THREE.Vector3(); var lastPointL = new THREE.Vector2(); var lastPointR = new THREE.Vector2(); var point0L = new THREE.Vector2(); @@ -1147,9 +1253,6 @@ THREE.SVGLoader.pointsToStrokeWithBuffers = function () { var nextPointR = new THREE.Vector2(); var innerPoint = new THREE.Vector2(); var outerPoint = new THREE.Vector2(); - var tempTransform0 = new THREE.Matrix3(); - var tempTransform1 = new THREE.Matrix3(); - var tempTransform2 = new THREE.Matrix3(); return function ( points, style, arcDivisions, minDistance, vertices, normals, uvs, vertexOffset ) { @@ -1160,7 +1263,7 @@ THREE.SVGLoader.pointsToStrokeWithBuffers = function () { // if 'vertices' parameter is undefined no triangles will be generated, but the returned vertices count will still be valid (useful to preallocate the buffers) // 'normals' and 'uvs' buffers are optional - arcLengthDivisions = arcDivisions !== undefined ? arcDivisions : 12; + arcDivisions = arcDivisions !== undefined ? arcDivisions : 12; minDistance = minDistance !== undefined ? minDistance : 0.001; vertexOffset = vertexOffset !== undefined ? vertexOffset : 0; @@ -1210,11 +1313,9 @@ THREE.SVGLoader.pointsToStrokeWithBuffers = function () { // Skip duplicated initial point nextPoint = points[ 1 ]; - } - else nextPoint = undefined; + } else nextPoint = undefined; - } - else { + } else { nextPoint = points[ iPoint + 1 ]; @@ -1250,8 +1351,8 @@ THREE.SVGLoader.pointsToStrokeWithBuffers = function () { } if ( iPoint === 1 ) initialJoinIsOnLeftSide = joinIsOnLeftSide; - tempV2_3.subVectors( nextPoint, currentPoint ) - var maxInnerDistance = tempV2_3.normalize(); + tempV2_3.subVectors( nextPoint, currentPoint ); + tempV2_3.normalize(); var dot = Math.abs( normal1.dot( tempV2_3 ) ); // If path is straight, don't create join @@ -1287,16 +1388,14 @@ THREE.SVGLoader.pointsToStrokeWithBuffers = function () { nextPointR.copy( innerPoint ); currentPointR.copy( innerPoint ); - } - else { + } else { nextPointL.copy( innerPoint ); currentPointL.copy( innerPoint ); } - } - else { + } else { // The segment triangles are generated here if there was overlapping @@ -1324,8 +1423,7 @@ THREE.SVGLoader.pointsToStrokeWithBuffers = function () { makeCircularSector( currentPoint, currentPointL, nextPointL, u1, 0 ); - } - else { + } else { makeCircularSector( currentPoint, nextPointR, currentPointR, u1, 1 ); @@ -1348,8 +1446,7 @@ THREE.SVGLoader.pointsToStrokeWithBuffers = function () { makeSegmentWithBevelJoin( joinIsOnLeftSide, innerSideModified, u1 ); break; - } - else { + } else { // Segment triangles @@ -1374,8 +1471,7 @@ THREE.SVGLoader.pointsToStrokeWithBuffers = function () { addVertex( tempV2_7, u1, 0 ); addVertex( nextPointL, u1, 0 ); - } - else { + } else { tempV2_6.subVectors( outerPoint, currentPointR ).multiplyScalar( miterFraction ).add( currentPointR ); tempV2_7.subVectors( outerPoint, nextPointR ).multiplyScalar( miterFraction ).add( nextPointR ); @@ -1396,8 +1492,7 @@ THREE.SVGLoader.pointsToStrokeWithBuffers = function () { } - } - else { + } else { // Miter join segment triangles @@ -1415,8 +1510,7 @@ THREE.SVGLoader.pointsToStrokeWithBuffers = function () { addVertex( outerPoint, u1, 0 ); addVertex( innerPoint, u1, 1 ); - } - else { + } else { addVertex( lastPointR, u0, 1 ); addVertex( lastPointL, u0, 0 ); @@ -1433,16 +1527,14 @@ THREE.SVGLoader.pointsToStrokeWithBuffers = function () { nextPointL.copy( outerPoint ); - } - else { + } else { nextPointR.copy( outerPoint ); } - } - else { + } else { // Add extra miter join triangles @@ -1456,8 +1548,7 @@ THREE.SVGLoader.pointsToStrokeWithBuffers = function () { addVertex( outerPoint, u1, 0 ); addVertex( nextPointL, u1, 0 ); - } - else { + } else { addVertex( currentPointR, u1, 1 ); addVertex( outerPoint, u1, 1 ); @@ -1479,8 +1570,7 @@ THREE.SVGLoader.pointsToStrokeWithBuffers = function () { } - } - else { + } else { // The segment triangles are generated here when two consecutive points are collinear @@ -1488,8 +1578,7 @@ THREE.SVGLoader.pointsToStrokeWithBuffers = function () { } - } - else { + } else { // The segment triangles are generated here if it is the ending segment @@ -1520,16 +1609,18 @@ THREE.SVGLoader.pointsToStrokeWithBuffers = function () { // Ending line endcap addCapGeometry( currentPoint, currentPointL, currentPointR, joinIsOnLeftSide, false, u1 ); - } - else if ( innerSideModified && vertices ) { + } else if ( innerSideModified && vertices ) { // Modify path first segment vertices to adjust to the segments inner and outer intersections var lastOuter = outerPoint; var lastInner = innerPoint; - if ( initialJoinIsOnLeftSide !== joinIsOnLeftSide) { + + if ( initialJoinIsOnLeftSide !== joinIsOnLeftSide ) { + lastOuter = innerPoint; lastInner = outerPoint; + } if ( joinIsOnLeftSide ) { @@ -1540,10 +1631,10 @@ THREE.SVGLoader.pointsToStrokeWithBuffers = function () { if ( isMiter ) { lastOuter.toArray( vertices, 1 * 3 ); + } - } - else { + } else { lastInner.toArray( vertices, 1 * 3 ); lastInner.toArray( vertices, 3 * 3 ); @@ -1551,6 +1642,7 @@ THREE.SVGLoader.pointsToStrokeWithBuffers = function () { if ( isMiter ) { lastOuter.toArray( vertices, 0 * 3 ); + } } @@ -1615,11 +1707,11 @@ THREE.SVGLoader.pointsToStrokeWithBuffers = function () { var dot = tempV2_1.dot( tempV2_2 ); if ( Math.abs( dot ) < 1 ) angle = Math.abs( Math.acos( dot ) ); - angle /= arcLengthDivisions; + angle /= arcDivisions; tempV2_3.copy( p1 ); - for ( var i = 0, il = arcLengthDivisions - 1; i < il; i++ ) { + for ( var i = 0, il = arcDivisions - 1; i < il; i ++ ) { tempV2_4.copy( tempV2_3 ).rotateAround( center, angle ); @@ -1628,6 +1720,7 @@ THREE.SVGLoader.pointsToStrokeWithBuffers = function () { addVertex( center, u, 0.5 ); tempV2_3.copy( tempV2_4 ); + } addVertex( tempV2_4, u, v ); @@ -1672,8 +1765,7 @@ THREE.SVGLoader.pointsToStrokeWithBuffers = function () { addVertex( nextPointL, u, 0 ); addVertex( innerPoint, u, 0.5 ); - } - else { + } else { // Path segments triangles @@ -1693,8 +1785,7 @@ THREE.SVGLoader.pointsToStrokeWithBuffers = function () { } - } - else { + } else { // Bevel join triangle. The segment triangles are done in the main loop @@ -1704,8 +1795,7 @@ THREE.SVGLoader.pointsToStrokeWithBuffers = function () { addVertex( nextPointL, u, 0 ); addVertex( currentPoint, u, 0.5 ); - } - else { + } else { addVertex( currentPointR, u, 1 ); addVertex( nextPointR, u, 0 ); @@ -1739,8 +1829,7 @@ THREE.SVGLoader.pointsToStrokeWithBuffers = function () { addVertex( nextPointL, u0, 0 ); addVertex( innerPoint, u1, 1 ); - } - else { + } else { addVertex( lastPointR, u0, 1 ); addVertex( lastPointL, u0, 0 ); @@ -1777,8 +1866,7 @@ THREE.SVGLoader.pointsToStrokeWithBuffers = function () { makeCircularSector( center, p2, p1, u, 0.5 ); - } - else { + } else { makeCircularSector( center, p1, p2, u, 0.5 ); @@ -1803,8 +1891,7 @@ THREE.SVGLoader.pointsToStrokeWithBuffers = function () { tempV2_4.toArray( vertices, 0 * 3 ); tempV2_4.toArray( vertices, 3 * 3 ); - } - else { + } else { tempV2_3.toArray( vertices, 1 * 3 ); tempV2_3.toArray( vertices, 3 * 3 ); @@ -1812,8 +1899,7 @@ THREE.SVGLoader.pointsToStrokeWithBuffers = function () { } - } - else { + } else { tempV2_1.subVectors( p2, center ); tempV2_2.set( tempV2_1.y, - tempV2_1.x ); @@ -1830,8 +1916,7 @@ THREE.SVGLoader.pointsToStrokeWithBuffers = function () { tempV2_4.toArray( vertices, vl - 2 * 3 ); tempV2_4.toArray( vertices, vl - 4 * 3 ); - } - else { + } else { tempV2_3.toArray( vertices, vl - 2 * 3 ); tempV2_4.toArray( vertices, vl - 1 * 3 ); @@ -1882,6 +1967,7 @@ THREE.SVGLoader.pointsToStrokeWithBuffers = function () { newPoints.push( points[ i ] ); } + } newPoints.push( points[ points.length - 1 ] ); @@ -1889,6 +1975,7 @@ THREE.SVGLoader.pointsToStrokeWithBuffers = function () { return newPoints; } + }; }(); diff --git a/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/quickhull/QuickHull.js b/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/math/ConvexHull.js similarity index 98% rename from extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/quickhull/QuickHull.js rename to extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/math/ConvexHull.js index d2261592..63ad964a 100644 --- a/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/quickhull/QuickHull.js +++ b/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/math/ConvexHull.js @@ -5,14 +5,14 @@ * */ -( function () { +THREE.ConvexHull = ( function () { var Visible = 0; var Deleted = 1; var v1 = new THREE.Vector3(); - function QuickHull() { + function ConvexHull() { this.tolerance = - 1; @@ -36,19 +36,19 @@ } - Object.assign( QuickHull.prototype, { + Object.assign( ConvexHull.prototype, { setFromPoints: function ( points ) { if ( Array.isArray( points ) !== true ) { - console.error( 'THREE.QuickHull: Points parameter is not an array.' ); + console.error( 'THREE.ConvexHull: Points parameter is not an array.' ); } if ( points.length < 4 ) { - console.error( 'THREE.QuickHull: The algorithm needs at least four points.' ); + console.error( 'THREE.ConvexHull: The algorithm needs at least four points.' ); } @@ -1311,9 +1311,6 @@ } ); - // export - - THREE.QuickHull = QuickHull; - + return ConvexHull; } )(); diff --git a/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/math/Lut.js b/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/math/Lut.js index 29163e29..29b1241e 100644 --- a/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/math/Lut.js +++ b/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/math/Lut.js @@ -10,20 +10,6 @@ THREE.Lut = function ( colormap, numberofcolors ) { }; -var defaultLabelParameters = { - fontsize: 24, - fontface: 'Arial', - title: '', - um: '', - ticks: 0, - decimal: 2, - notation: 'standard' -}; - -var defaultBackgroundColor = { r: 255, g: 100, b: 100, a: 0.8 }; -var defaultBorderColor = { r: 255, g: 0, b: 0, a: 1.0 }; -var defaultBorderThickness = 4; - THREE.Lut.prototype = { constructor: THREE.Lut, @@ -189,7 +175,6 @@ THREE.Lut.prototype = { } }; - THREE.ColorMapKeywords = { "rainbow": [[ 0.0, 0x0000FF ], [ 0.2, 0x00FFFF ], [ 0.5, 0x00FF00 ], [ 0.8, 0xFFFF00 ], [ 1.0, 0xFF0000 ]], diff --git a/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/modifers/SubdivisionModifier.js b/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/modifers/SubdivisionModifier.js index 0ecc2f00..d12ca31f 100644 --- a/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/modifers/SubdivisionModifier.js +++ b/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/modifers/SubdivisionModifier.js @@ -53,7 +53,6 @@ THREE.SubdivisionModifier.prototype.modify = function ( geometry ) { ( function () { // Some constants - var WARNINGS = ! true; // Set to true for development var ABC = [ 'a', 'b', 'c' ]; @@ -215,7 +214,7 @@ THREE.SubdivisionModifier.prototype.modify = function ( geometry ) { if ( connectedFaces != 1 ) { - if ( WARNINGS ) console.warn( 'Subdivision Modifier: Number of connected faces != 2, is: ', connectedFaces, currentEdge ); + // console.warn( 'Subdivision Modifier: Number of connected faces != 2, is: ', connectedFaces, currentEdge ); } @@ -292,7 +291,7 @@ THREE.SubdivisionModifier.prototype.modify = function ( geometry ) { if ( n == 2 ) { - if ( WARNINGS ) console.warn( '2 connecting edges', connectingEdges ); + // console.warn( '2 connecting edges', connectingEdges ); sourceVertexWeight = 3 / 4; connectingVertexWeight = 1 / 8; @@ -301,11 +300,11 @@ THREE.SubdivisionModifier.prototype.modify = function ( geometry ) { } else if ( n == 1 ) { - if ( WARNINGS ) console.warn( 'only 1 connecting edge' ); + // console.warn( 'only 1 connecting edge' ); } else if ( n == 0 ) { - if ( WARNINGS ) console.warn( '0 connecting edges' ); + // console.warn( '0 connecting edges' ); } diff --git a/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/modifers/TessellateModifier.js b/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/modifers/TessellateModifier.js index 7da91e5c..fbcd6e38 100644 --- a/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/modifers/TessellateModifier.js +++ b/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/modifers/TessellateModifier.js @@ -186,7 +186,7 @@ THREE.TessellateModifier.prototype.modify = function ( geometry ) { var uvsTriA = [ uvA.clone(), uvM.clone(), uvC.clone() ]; var uvsTriB = [ uvM.clone(), uvB.clone(), uvC.clone() ]; - // BC + // BC } else if ( edge === 1 ) { @@ -196,7 +196,7 @@ THREE.TessellateModifier.prototype.modify = function ( geometry ) { var uvsTriA = [ uvA.clone(), uvB.clone(), uvM.clone() ]; var uvsTriB = [ uvM.clone(), uvC.clone(), uvA.clone() ]; - // AC + // AC } else { diff --git a/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/objects/Reflector.js b/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/objects/Reflector.js index e7890da4..cbf05c9c 100644 --- a/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/objects/Reflector.js +++ b/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/objects/Reflector.js @@ -28,12 +28,10 @@ THREE.Reflector = function ( geometry, options ) { var rotationMatrix = new THREE.Matrix4(); var lookAtPosition = new THREE.Vector3( 0, 0, - 1 ); var clipPlane = new THREE.Vector4(); - var viewport = new THREE.Vector4(); var view = new THREE.Vector3(); var target = new THREE.Vector3(); var q = new THREE.Vector4(); - var size = new THREE.Vector2(); var textureMatrix = new THREE.Matrix4(); var virtualCamera = new THREE.PerspectiveCamera(); @@ -172,19 +170,9 @@ THREE.Reflector = function ( geometry, options ) { // Restore viewport - var bounds = camera.bounds; + if ( camera.isArrayCamera ) { - if ( bounds !== undefined ) { - - renderer.getSize( size ); - var pixelRatio = renderer.getPixelRatio(); - - viewport.x = bounds.x * size.width * pixelRatio; - viewport.y = bounds.y * size.height * pixelRatio; - viewport.z = bounds.z * size.width * pixelRatio; - viewport.w = bounds.w * size.height * pixelRatio; - - renderer.state.viewport( viewport ); + renderer.state.viewport( camera.viewport ); } @@ -208,17 +196,14 @@ THREE.Reflector.ReflectorShader = { uniforms: { 'color': { - type: 'c', value: null }, 'tDiffuse': { - type: 't', value: null }, 'textureMatrix': { - type: 'm4', value: null } diff --git a/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/objects/Refractor.js b/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/objects/Refractor.js index 1fe0ae47..c81043a4 100644 --- a/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/objects/Refractor.js +++ b/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/objects/Refractor.js @@ -184,53 +184,36 @@ THREE.Refractor = function ( geometry, options ) { // - var render = ( function () { + function render( renderer, scene, camera ) { - var viewport = new THREE.Vector4(); - var size = new THREE.Vector2(); + scope.visible = false; - return function render( renderer, scene, camera ) { + var currentRenderTarget = renderer.getRenderTarget(); + var currentVrEnabled = renderer.vr.enabled; + var currentShadowAutoUpdate = renderer.shadowMap.autoUpdate; - scope.visible = false; + renderer.vr.enabled = false; // avoid camera modification + renderer.shadowMap.autoUpdate = false; // avoid re-computing shadows - var currentRenderTarget = renderer.getRenderTarget(); - var currentVrEnabled = renderer.vr.enabled; - var currentShadowAutoUpdate = renderer.shadowMap.autoUpdate; + renderer.setRenderTarget( renderTarget ); + renderer.clear(); + renderer.render( scene, virtualCamera ); - renderer.vr.enabled = false; // avoid camera modification - renderer.shadowMap.autoUpdate = false; // avoid re-computing shadows + renderer.vr.enabled = currentVrEnabled; + renderer.shadowMap.autoUpdate = currentShadowAutoUpdate; + renderer.setRenderTarget( currentRenderTarget ); - renderer.setRenderTarget( renderTarget ); - renderer.clear(); - renderer.render( scene, virtualCamera ); + // restore viewport - renderer.vr.enabled = currentVrEnabled; - renderer.shadowMap.autoUpdate = currentShadowAutoUpdate; - renderer.setRenderTarget( currentRenderTarget ); + if ( camera.isArrayCamera ) { - // restore viewport + renderer.state.viewport( camera.viewport ); - var bounds = camera.bounds; - - if ( bounds !== undefined ) { - - renderer.getSize( size ); - var pixelRatio = renderer.getPixelRatio(); - - viewport.x = bounds.x * size.width * pixelRatio; - viewport.y = bounds.y * size.height * pixelRatio; - viewport.z = bounds.z * size.width * pixelRatio; - viewport.w = bounds.w * size.height * pixelRatio; - - renderer.state.viewport( viewport ); - - } - - scope.visible = true; + } - }; + scope.visible = true; - } )(); + } // @@ -272,17 +255,14 @@ THREE.Refractor.RefractorShader = { uniforms: { 'color': { - type: 'c', value: null }, 'tDiffuse': { - type: 't', value: null }, 'textureMatrix': { - type: 'm4', value: null } diff --git a/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/renderers/SVGRenderer.js b/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/renderers/SVGRenderer.js index 08e4d721..5d95837d 100644 --- a/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/renderers/SVGRenderer.js +++ b/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/renderers/SVGRenderer.js @@ -57,6 +57,8 @@ THREE.SVGRenderer = function () { this.sortObjects = true; this.sortElements = true; + this.overdraw = 0.5; + this.info = { render: { @@ -227,6 +229,14 @@ THREE.SVGRenderer = function () { _v2.positionScreen.x *= _svgWidthHalf; _v2.positionScreen.y *= - _svgHeightHalf; _v3.positionScreen.x *= _svgWidthHalf; _v3.positionScreen.y *= - _svgHeightHalf; + if ( this.overdraw > 0 ) { + + expand( _v1.positionScreen, _v2.positionScreen, this.overdraw ); + expand( _v2.positionScreen, _v3.positionScreen, this.overdraw ); + expand( _v3.positionScreen, _v1.positionScreen, this.overdraw ); + + } + _elemBox.setFromPoints( [ _v1.positionScreen, _v2.positionScreen, @@ -451,6 +461,24 @@ THREE.SVGRenderer = function () { } + // Hide anti-alias gaps + + function expand( v1, v2, pixels ) { + + var x = v2.x - v1.x, y = v2.y - v1.y, + det = x * x + y * y, idet; + + if ( det === 0 ) return; + + idet = pixels / Math.sqrt( det ); + + x *= idet; y *= idet; + + v2.x += x; v2.y += y; + v1.x -= x; v1.y -= y; + + } + function addPath( style, path ) { if ( _currentStyle === style ) { diff --git a/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/utils/GeometryUtils.js b/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/utils/GeometryUtils.js index 9d7f3ad1..d16426fc 100644 --- a/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/utils/GeometryUtils.js +++ b/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/utils/GeometryUtils.js @@ -295,6 +295,154 @@ THREE.GeometryUtils = { console.warn( 'THREE.GeometryUtils: .center() has been moved to Geometry. Use geometry.center() instead.' ); return geometry.center(); + }, + + /** + * Generates 2D-Coordinates in a very fast way. + * + * @author Dylan Grafmyre + * + * Based on work by: + * @author Thomas Diewald + * @link http://www.openprocessing.org/sketch/15493 + * + * @param center Center of Hilbert curve. + * @param size Total width of Hilbert curve. + * @param iterations Number of subdivisions. + * @param v0 Corner index -X, -Z. + * @param v1 Corner index -X, +Z. + * @param v2 Corner index +X, +Z. + * @param v3 Corner index +X, -Z. + */ + hilbert2D: function ( center, size, iterations, v0, v1, v2, v3 ) { + + // Default Vars + var center = center !== undefined ? center : new THREE.Vector3( 0, 0, 0 ), + size = size !== undefined ? size : 10, + half = size / 2, + iterations = iterations !== undefined ? iterations : 1, + v0 = v0 !== undefined ? v0 : 0, + v1 = v1 !== undefined ? v1 : 1, + v2 = v2 !== undefined ? v2 : 2, + v3 = v3 !== undefined ? v3 : 3 + ; + + var vec_s = [ + new THREE.Vector3( center.x - half, center.y, center.z - half ), + new THREE.Vector3( center.x - half, center.y, center.z + half ), + new THREE.Vector3( center.x + half, center.y, center.z + half ), + new THREE.Vector3( center.x + half, center.y, center.z - half ) + ]; + + var vec = [ + vec_s[ v0 ], + vec_s[ v1 ], + vec_s[ v2 ], + vec_s[ v3 ] + ]; + + // Recurse iterations + if ( 0 <= -- iterations ) { + + var tmp = []; + + Array.prototype.push.apply( tmp, THREE.GeometryUtils.hilbert2D( vec[ 0 ], half, iterations, v0, v3, v2, v1 ) ); + Array.prototype.push.apply( tmp, THREE.GeometryUtils.hilbert2D( vec[ 1 ], half, iterations, v0, v1, v2, v3 ) ); + Array.prototype.push.apply( tmp, THREE.GeometryUtils.hilbert2D( vec[ 2 ], half, iterations, v0, v1, v2, v3 ) ); + Array.prototype.push.apply( tmp, THREE.GeometryUtils.hilbert2D( vec[ 3 ], half, iterations, v2, v1, v0, v3 ) ); + + // Return recursive call + return tmp; + + } + + // Return complete Hilbert Curve. + return vec; + + }, + + /** + * Generates 3D-Coordinates in a very fast way. + * + * @author Dylan Grafmyre + * + * Based on work by: + * @author Thomas Diewald + * @link http://www.openprocessing.org/visuals/?visualID=15599 + * + * @param center Center of Hilbert curve. + * @param size Total width of Hilbert curve. + * @param iterations Number of subdivisions. + * @param v0 Corner index -X, +Y, -Z. + * @param v1 Corner index -X, +Y, +Z. + * @param v2 Corner index -X, -Y, +Z. + * @param v3 Corner index -X, -Y, -Z. + * @param v4 Corner index +X, -Y, -Z. + * @param v5 Corner index +X, -Y, +Z. + * @param v6 Corner index +X, +Y, +Z. + * @param v7 Corner index +X, +Y, -Z. + */ + hilbert3D: function ( center, size, iterations, v0, v1, v2, v3, v4, v5, v6, v7 ) { + + // Default Vars + var center = center !== undefined ? center : new THREE.Vector3( 0, 0, 0 ), + size = size !== undefined ? size : 10, + half = size / 2, + iterations = iterations !== undefined ? iterations : 1, + v0 = v0 !== undefined ? v0 : 0, + v1 = v1 !== undefined ? v1 : 1, + v2 = v2 !== undefined ? v2 : 2, + v3 = v3 !== undefined ? v3 : 3, + v4 = v4 !== undefined ? v4 : 4, + v5 = v5 !== undefined ? v5 : 5, + v6 = v6 !== undefined ? v6 : 6, + v7 = v7 !== undefined ? v7 : 7 + ; + + var vec_s = [ + new THREE.Vector3( center.x - half, center.y + half, center.z - half ), + new THREE.Vector3( center.x - half, center.y + half, center.z + half ), + new THREE.Vector3( center.x - half, center.y - half, center.z + half ), + new THREE.Vector3( center.x - half, center.y - half, center.z - half ), + new THREE.Vector3( center.x + half, center.y - half, center.z - half ), + new THREE.Vector3( center.x + half, center.y - half, center.z + half ), + new THREE.Vector3( center.x + half, center.y + half, center.z + half ), + new THREE.Vector3( center.x + half, center.y + half, center.z - half ) + ]; + + var vec = [ + vec_s[ v0 ], + vec_s[ v1 ], + vec_s[ v2 ], + vec_s[ v3 ], + vec_s[ v4 ], + vec_s[ v5 ], + vec_s[ v6 ], + vec_s[ v7 ] + ]; + + // Recurse iterations + if ( -- iterations >= 0 ) { + + var tmp = []; + + Array.prototype.push.apply( tmp, THREE.GeometryUtils.hilbert3D( vec[ 0 ], half, iterations, v0, v3, v4, v7, v6, v5, v2, v1 ) ); + Array.prototype.push.apply( tmp, THREE.GeometryUtils.hilbert3D( vec[ 1 ], half, iterations, v0, v7, v6, v1, v2, v5, v4, v3 ) ); + Array.prototype.push.apply( tmp, THREE.GeometryUtils.hilbert3D( vec[ 2 ], half, iterations, v0, v7, v6, v1, v2, v5, v4, v3 ) ); + Array.prototype.push.apply( tmp, THREE.GeometryUtils.hilbert3D( vec[ 3 ], half, iterations, v2, v3, v0, v1, v6, v7, v4, v5 ) ); + Array.prototype.push.apply( tmp, THREE.GeometryUtils.hilbert3D( vec[ 4 ], half, iterations, v2, v3, v0, v1, v6, v7, v4, v5 ) ); + Array.prototype.push.apply( tmp, THREE.GeometryUtils.hilbert3D( vec[ 5 ], half, iterations, v4, v3, v2, v5, v6, v1, v0, v7 ) ); + Array.prototype.push.apply( tmp, THREE.GeometryUtils.hilbert3D( vec[ 6 ], half, iterations, v4, v3, v2, v5, v6, v1, v0, v7 ) ); + Array.prototype.push.apply( tmp, THREE.GeometryUtils.hilbert3D( vec[ 7 ], half, iterations, v6, v5, v2, v1, v0, v3, v4, v7 ) ); + + // Return recursive call + return tmp; + + } + + // Return complete Hilbert Curve. + return vec; + } }; diff --git a/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/utils/SceneUtils.js b/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/utils/SceneUtils.js index faaed8a9..2e22b849 100644 --- a/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/utils/SceneUtils.js +++ b/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/utils/SceneUtils.js @@ -20,18 +20,17 @@ THREE.SceneUtils = { detach: function ( child, parent, scene ) { - child.applyMatrix( parent.matrixWorld ); - parent.remove( child ); - scene.add( child ); + console.warn( 'THREE.SceneUtils: detach() has been deprecated. Use scene.attach( child ) instead.' ); + + scene.attach( child ); }, attach: function ( child, scene, parent ) { - child.applyMatrix( new THREE.Matrix4().getInverse( parent.matrixWorld ) ); + console.warn( 'THREE.SceneUtils: attach() has been deprecated. Use parent.attach( child ) instead.' ); - scene.remove( child ); - parent.add( child ); + parent.attach( child ); } diff --git a/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/vr/WebVR.js b/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/vr/WebVR.js index 78fa5c6e..e2c1e2fd 100644 --- a/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/vr/WebVR.js +++ b/extensions/src/main/resources/org/treblereel/gwt/three4g/extensions/resources/js/vr/WebVR.js @@ -9,9 +9,9 @@ var WEBVR = { createButton: function ( renderer, options ) { - if ( options && options.frameOfReferenceType ) { + if ( options && options.referenceSpaceType ) { - renderer.vr.setFrameOfReferenceType( options.frameOfReferenceType ); + renderer.vr.setReferenceSpaceType( options.referenceSpaceType ); } @@ -47,7 +47,7 @@ var WEBVR = { session.addEventListener( 'end', onSessionEnded ); renderer.vr.setSession( session ); - button.textContent = 'EXIT VR'; + button.textContent = 'EXIT XR'; currentSession = session; @@ -58,7 +58,7 @@ var WEBVR = { currentSession.removeEventListener( 'end', onSessionEnded ); renderer.vr.setSession( null ); - button.textContent = 'ENTER VR'; + button.textContent = 'ENTER XR'; currentSession = null; @@ -72,7 +72,7 @@ var WEBVR = { button.style.left = 'calc(50% - 50px)'; button.style.width = '100px'; - button.textContent = 'ENTER VR'; + button.textContent = 'ENTER XR'; button.onmouseenter = function () { button.style.opacity = '1.0'; }; button.onmouseleave = function () { button.style.opacity = '0.5'; }; @@ -81,7 +81,7 @@ var WEBVR = { if ( currentSession === null ) { - device.requestSession( { immersive: true, exclusive: true /* DEPRECATED */ } ).then( onSessionStarted ); + navigator.xr.requestSession( 'immersive-vr' ).then( onSessionStarted ); } else { @@ -91,8 +91,6 @@ var WEBVR = { }; - renderer.vr.setDevice( device ); - } function showVRNotFound() { @@ -131,20 +129,14 @@ var WEBVR = { } - if ( 'xr' in navigator ) { + if ( 'xr' in navigator && 'supportsSession' in navigator.xr ) { var button = document.createElement( 'button' ); button.style.display = 'none'; stylizeElement( button ); - navigator.xr.requestDevice().then( function ( device ) { - - device.supportsSession( { immersive: true, exclusive: true /* DEPRECATED */ } ) - .then( function () { showEnterXR( device ); } ) - .catch( showVRNotFound ); - - } ).catch( showVRNotFound ); + navigator.xr.supportsSession( 'immersive-vr' ).then( showEnterXR ); return button; diff --git a/pom.xml b/pom.xml index c96288d6..55fd78be 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ org.treblereel.gwt three4g-parent - 0.105-SNAPSHOT + 0.106-SNAPSHOT pom three4g-parent diff --git a/processor/pom.xml b/processor/pom.xml index 30f6633e..dd5316cc 100644 --- a/processor/pom.xml +++ b/processor/pom.xml @@ -5,7 +5,7 @@ org.treblereel.gwt three4g-parent - 0.105-SNAPSHOT + 0.106-SNAPSHOT ..