three-stdlib 2.6.3 → 2.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{Nodes-ec4e1143.js → Nodes-894ac9dc.js} +0 -0
- package/{Nodes-427f68b0.js → Nodes-af575af7.js} +0 -0
- package/controls/ArcballControls.cjs.js +1 -1
- package/controls/ArcballControls.d.ts +161 -0
- package/controls/ArcballControls.js +554 -285
- package/controls/OrbitControls.cjs.js +1 -1
- package/controls/OrbitControls.d.ts +1 -0
- package/controls/OrbitControls.js +13 -2
- package/controls/TransformControls.cjs.js +1 -1
- package/controls/TransformControls.d.ts +2 -1
- package/controls/TransformControls.js +25 -26
- package/geometries/TeapotGeometry.js +2 -2
- package/geometries/TextGeometry.cjs.js +1 -0
- package/geometries/TextGeometry.d.ts +16 -0
- package/geometries/TextGeometry.js +26 -0
- package/index.cjs.js +1 -1
- package/index.d.ts +2 -0
- package/index.js +2 -0
- package/loaders/AMFLoader.js +1 -3
- package/loaders/ColladaLoader.cjs.js +1 -1
- package/loaders/ColladaLoader.js +58 -35
- package/loaders/EXRLoader.cjs.js +1 -1
- package/loaders/EXRLoader.js +197 -262
- package/loaders/FBXLoader.cjs.js +1 -1
- package/loaders/FBXLoader.js +41 -90
- package/loaders/FontLoader.cjs.js +1 -0
- package/loaders/FontLoader.d.ts +32 -0
- package/loaders/FontLoader.js +139 -0
- package/loaders/GLTFLoader.cjs.js +1 -1
- package/loaders/GLTFLoader.js +161 -75
- package/loaders/HDRCubeTextureLoader.cjs.js +1 -1
- package/loaders/HDRCubeTextureLoader.js +2 -2
- package/loaders/NodeMaterialLoader.cjs.js +1 -1
- package/loaders/RGBELoader.cjs.js +1 -1
- package/loaders/RGBELoader.js +10 -9
- package/loaders/RGBMLoader.cjs.js +1 -1
- package/loaders/RGBMLoader.js +181 -257
- package/loaders/STLLoader.js +7 -7
- package/loaders/SVGLoader.cjs.js +1 -1
- package/loaders/SVGLoader.js +46 -30
- package/loaders/VRMLLoader.cjs.js +1 -1
- package/loaders/VRMLLoader.js +2 -1
- package/nodes/accessors/CameraNode.js +12 -12
- package/nodes/accessors/PositionNode.js +3 -3
- package/nodes/accessors/ReflectNode.js +3 -3
- package/nodes/core/FunctionNode.js +3 -3
- package/nodes/core/InputNode.js +3 -3
- package/nodes/core/Node.js +6 -6
- package/nodes/core/TempNode.js +6 -6
- package/nodes/effects/BlurNode.js +3 -3
- package/nodes/math/MathNode.js +3 -3
- package/nodes/utils/VelocityNode.js +6 -6
- package/package.json +2 -2
- package/renderers/nodes/accessors/UVNode.js +1 -3
- package/renderers/nodes/core/AttributeNode.js +1 -3
- package/renderers/nodes/core/Node.js +4 -12
- package/renderers/nodes/core/NodeBuilder.js +6 -18
- package/webxr/ARButton.js +6 -6
- package/webxr/VRButton.js +6 -6
    
        package/loaders/GLTFLoader.js
    CHANGED
    
    | @@ -1,4 +1,4 @@ | |
| 1 | 
            -
            import { Loader, LoaderUtils, FileLoader, Color, SpotLight, PointLight, DirectionalLight, MeshBasicMaterial, MeshPhysicalMaterial, Vector2, sRGBEncoding, TangentSpaceNormalMap, ImageBitmapLoader, TextureLoader, InterleavedBuffer, InterleavedBufferAttribute, BufferAttribute,  | 
| 1 | 
            +
            import { Loader, LoaderUtils, FileLoader, Color, SpotLight, PointLight, DirectionalLight, MeshBasicMaterial, MeshPhysicalMaterial, Vector2, sRGBEncoding, TangentSpaceNormalMap, Quaternion, ImageBitmapLoader, TextureLoader, InterleavedBuffer, InterleavedBufferAttribute, BufferAttribute, LinearFilter, LinearMipmapLinearFilter, RepeatWrapping, PointsMaterial, Material, LineBasicMaterial, MeshStandardMaterial, DoubleSide, RGBFormat, PropertyBinding, BufferGeometry, SkinnedMesh, Mesh, LineSegments, Line, LineLoop, Points, Group, PerspectiveCamera, MathUtils, OrthographicCamera, InterpolateLinear, AnimationClip, Bone, Object3D, Matrix4, Skeleton, TriangleFanDrawMode, NearestFilter, NearestMipmapNearestFilter, LinearMipmapNearestFilter, NearestMipmapLinearFilter, ClampToEdgeWrapping, MirroredRepeatWrapping, InterpolateDiscrete, FrontSide, Texture, TriangleStripDrawMode, VectorKeyframeTrack, QuaternionKeyframeTrack, NumberKeyframeTrack, Box3, Vector3, Sphere, Interpolant } from 'three';
         | 
| 2 2 |  | 
| 3 3 | 
             
            class GLTFLoader extends Loader {
         | 
| 4 4 | 
             
              constructor(manager) {
         | 
| @@ -16,6 +16,9 @@ class GLTFLoader extends Loader { | |
| 16 16 | 
             
                this.register(function (parser) {
         | 
| 17 17 | 
             
                  return new GLTFTextureWebPExtension(parser);
         | 
| 18 18 | 
             
                });
         | 
| 19 | 
            +
                this.register(function (parser) {
         | 
| 20 | 
            +
                  return new GLTFMaterialsSheenExtension(parser);
         | 
| 21 | 
            +
                });
         | 
| 19 22 | 
             
                this.register(function (parser) {
         | 
| 20 23 | 
             
                  return new GLTFMaterialsTransmissionExtension(parser);
         | 
| 21 24 | 
             
                });
         | 
| @@ -207,6 +210,13 @@ class GLTFLoader extends Loader { | |
| 207 210 | 
             
                parser.parse(onLoad, onError);
         | 
| 208 211 | 
             
              }
         | 
| 209 212 |  | 
| 213 | 
            +
              parseAsync(data, path) {
         | 
| 214 | 
            +
                const scope = this;
         | 
| 215 | 
            +
                return new Promise(function (resolve, reject) {
         | 
| 216 | 
            +
                  scope.parse(data, path, resolve, reject);
         | 
| 217 | 
            +
                });
         | 
| 218 | 
            +
              }
         | 
| 219 | 
            +
             | 
| 210 220 | 
             
            }
         | 
| 211 221 | 
             
            /* GLTFREGISTRY */
         | 
| 212 222 |  | 
| @@ -242,6 +252,7 @@ const EXTENSIONS = { | |
| 242 252 | 
             
              KHR_MATERIALS_CLEARCOAT: 'KHR_materials_clearcoat',
         | 
| 243 253 | 
             
              KHR_MATERIALS_IOR: 'KHR_materials_ior',
         | 
| 244 254 | 
             
              KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS: 'KHR_materials_pbrSpecularGlossiness',
         | 
| 255 | 
            +
              KHR_MATERIALS_SHEEN: 'KHR_materials_sheen',
         | 
| 245 256 | 
             
              KHR_MATERIALS_SPECULAR: 'KHR_materials_specular',
         | 
| 246 257 | 
             
              KHR_MATERIALS_TRANSMISSION: 'KHR_materials_transmission',
         | 
| 247 258 | 
             
              KHR_MATERIALS_UNLIT: 'KHR_materials_unlit',
         | 
| @@ -439,15 +450,68 @@ class GLTFMaterialsClearcoatExtension { | |
| 439 450 | 
             
                  pending.push(parser.assignTexture(materialParams, 'clearcoatNormalMap', extension.clearcoatNormalTexture));
         | 
| 440 451 |  | 
| 441 452 | 
             
                  if (extension.clearcoatNormalTexture.scale !== undefined) {
         | 
| 442 | 
            -
                    const scale = extension.clearcoatNormalTexture.scale; | 
| 443 | 
            -
             | 
| 444 | 
            -
                    materialParams.clearcoatNormalScale = new Vector2(scale, -scale);
         | 
| 453 | 
            +
                    const scale = extension.clearcoatNormalTexture.scale;
         | 
| 454 | 
            +
                    materialParams.clearcoatNormalScale = new Vector2(scale, scale);
         | 
| 445 455 | 
             
                  }
         | 
| 446 456 | 
             
                }
         | 
| 447 457 |  | 
| 448 458 | 
             
                return Promise.all(pending);
         | 
| 449 459 | 
             
              }
         | 
| 450 460 |  | 
| 461 | 
            +
            }
         | 
| 462 | 
            +
            /**
         | 
| 463 | 
            +
             * Sheen Materials Extension
         | 
| 464 | 
            +
             *
         | 
| 465 | 
            +
             * Specification: https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_materials_sheen
         | 
| 466 | 
            +
             */
         | 
| 467 | 
            +
             | 
| 468 | 
            +
             | 
| 469 | 
            +
            class GLTFMaterialsSheenExtension {
         | 
| 470 | 
            +
              constructor(parser) {
         | 
| 471 | 
            +
                this.parser = parser;
         | 
| 472 | 
            +
                this.name = EXTENSIONS.KHR_MATERIALS_SHEEN;
         | 
| 473 | 
            +
              }
         | 
| 474 | 
            +
             | 
| 475 | 
            +
              getMaterialType(materialIndex) {
         | 
| 476 | 
            +
                const parser = this.parser;
         | 
| 477 | 
            +
                const materialDef = parser.json.materials[materialIndex];
         | 
| 478 | 
            +
                if (!materialDef.extensions || !materialDef.extensions[this.name]) return null;
         | 
| 479 | 
            +
                return MeshPhysicalMaterial;
         | 
| 480 | 
            +
              }
         | 
| 481 | 
            +
             | 
| 482 | 
            +
              extendMaterialParams(materialIndex, materialParams) {
         | 
| 483 | 
            +
                const parser = this.parser;
         | 
| 484 | 
            +
                const materialDef = parser.json.materials[materialIndex];
         | 
| 485 | 
            +
             | 
| 486 | 
            +
                if (!materialDef.extensions || !materialDef.extensions[this.name]) {
         | 
| 487 | 
            +
                  return Promise.resolve();
         | 
| 488 | 
            +
                }
         | 
| 489 | 
            +
             | 
| 490 | 
            +
                const pending = [];
         | 
| 491 | 
            +
                materialParams.sheenColor = new Color(0, 0, 0);
         | 
| 492 | 
            +
                materialParams.sheenRoughness = 0;
         | 
| 493 | 
            +
                materialParams.sheen = 1;
         | 
| 494 | 
            +
                const extension = materialDef.extensions[this.name];
         | 
| 495 | 
            +
             | 
| 496 | 
            +
                if (extension.sheenColorFactor !== undefined) {
         | 
| 497 | 
            +
                  materialParams.sheenColor.fromArray(extension.sheenColorFactor);
         | 
| 498 | 
            +
                }
         | 
| 499 | 
            +
             | 
| 500 | 
            +
                if (extension.sheenRoughnessFactor !== undefined) {
         | 
| 501 | 
            +
                  materialParams.sheenRoughness = extension.sheenRoughnessFactor;
         | 
| 502 | 
            +
                }
         | 
| 503 | 
            +
             | 
| 504 | 
            +
                if (extension.sheenColorTexture !== undefined) {
         | 
| 505 | 
            +
                  pending.push(parser.assignTexture(materialParams, 'sheenColorMap', extension.sheenColorTexture));
         | 
| 506 | 
            +
                }
         | 
| 507 | 
            +
             | 
| 508 | 
            +
                if (extension.sheenRoughnessTexture !== undefined) {
         | 
| 509 | 
            +
                  pending.push(parser.assignTexture(materialParams, 'sheenRoughnessMap', extension.sheenRoughnessTexture));
         | 
| 510 | 
            +
                }
         | 
| 511 | 
            +
             | 
| 512 | 
            +
                return Promise.all(pending);
         | 
| 513 | 
            +
              }
         | 
| 514 | 
            +
             | 
| 451 515 | 
             
            }
         | 
| 452 516 | 
             
            /**
         | 
| 453 517 | 
             
             * Transmission Materials Extension
         | 
| @@ -531,7 +595,7 @@ class GLTFMaterialsVolumeExtension { | |
| 531 595 |  | 
| 532 596 | 
             
                materialParams.attenuationDistance = extension.attenuationDistance || 0;
         | 
| 533 597 | 
             
                const colorArray = extension.attenuationColor || [1, 1, 1];
         | 
| 534 | 
            -
                materialParams. | 
| 598 | 
            +
                materialParams.attenuationColor = new Color(colorArray[0], colorArray[1], colorArray[2]);
         | 
| 535 599 | 
             
                return Promise.all(pending);
         | 
| 536 600 | 
             
              }
         | 
| 537 601 |  | 
| @@ -607,10 +671,10 @@ class GLTFMaterialsSpecularExtension { | |
| 607 671 | 
             
                }
         | 
| 608 672 |  | 
| 609 673 | 
             
                const colorArray = extension.specularColorFactor || [1, 1, 1];
         | 
| 610 | 
            -
                materialParams. | 
| 674 | 
            +
                materialParams.specularColor = new Color(colorArray[0], colorArray[1], colorArray[2]);
         | 
| 611 675 |  | 
| 612 676 | 
             
                if (extension.specularColorTexture !== undefined) {
         | 
| 613 | 
            -
                  pending.push(parser.assignTexture(materialParams, ' | 
| 677 | 
            +
                  pending.push(parser.assignTexture(materialParams, 'specularColorMap', extension.specularColorTexture).then(function (texture) {
         | 
| 614 678 | 
             
                    texture.encoding = sRGBEncoding;
         | 
| 615 679 | 
             
                  }));
         | 
| 616 680 | 
             
                }
         | 
| @@ -928,7 +992,7 @@ class GLTFTextureTransformExtension { | |
| 928 992 | 
             
            /**
         | 
| 929 993 | 
             
             * Specular-Glossiness Extension
         | 
| 930 994 | 
             
             *
         | 
| 931 | 
            -
             * Specification: https://github.com/KhronosGroup/glTF/tree/ | 
| 995 | 
            +
             * Specification: https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Archived/KHR_materials_pbrSpecularGlossiness
         | 
| 932 996 | 
             
             */
         | 
| 933 997 |  | 
| 934 998 | 
             
            /**
         | 
| @@ -947,7 +1011,7 @@ class GLTFMeshStandardSGMaterial extends MeshStandardMaterial { | |
| 947 1011 | 
             
                const glossinessMapParsFragmentChunk = ['#ifdef USE_GLOSSINESSMAP', '	uniform sampler2D glossinessMap;', '#endif'].join('\n');
         | 
| 948 1012 | 
             
                const specularMapFragmentChunk = ['vec3 specularFactor = specular;', '#ifdef USE_SPECULARMAP', '	vec4 texelSpecular = texture2D( specularMap, vUv );', '	texelSpecular = sRGBToLinear( texelSpecular );', '	// reads channel RGB, compatible with a glTF Specular-Glossiness (RGBA) texture', '	specularFactor *= texelSpecular.rgb;', '#endif'].join('\n');
         | 
| 949 1013 | 
             
                const glossinessMapFragmentChunk = ['float glossinessFactor = glossiness;', '#ifdef USE_GLOSSINESSMAP', '	vec4 texelGlossiness = texture2D( glossinessMap, vUv );', '	// reads channel A, compatible with a glTF Specular-Glossiness (RGBA) texture', '	glossinessFactor *= texelGlossiness.a;', '#endif'].join('\n');
         | 
| 950 | 
            -
                const lightPhysicalFragmentChunk = ['PhysicalMaterial material;', 'material.diffuseColor = diffuseColor.rgb * ( 1. - max( specularFactor.r, max( specularFactor.g, specularFactor.b ) ) );', 'vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );', 'float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );', 'material. | 
| 1014 | 
            +
                const lightPhysicalFragmentChunk = ['PhysicalMaterial material;', 'material.diffuseColor = diffuseColor.rgb * ( 1. - max( specularFactor.r, max( specularFactor.g, specularFactor.b ) ) );', 'vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );', 'float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );', 'material.roughness = max( 1.0 - glossinessFactor, 0.0525 ); // 0.0525 corresponds to the base mip of a 256 cubemap.', 'material.roughness += geometryRoughness;', 'material.roughness = min( material.roughness, 1.0 );', 'material.specularColor = specularFactor;'].join('\n');
         | 
| 951 1015 | 
             
                const uniforms = {
         | 
| 952 1016 | 
             
                  specular: {
         | 
| 953 1017 | 
             
                    value: new Color().setHex(0xffffff)
         | 
| @@ -1196,6 +1260,19 @@ GLTFCubicSplineInterpolant.prototype.interpolate_ = function (i1, t0, t, t1) { | |
| 1196 1260 |  | 
| 1197 1261 | 
             
              return result;
         | 
| 1198 1262 | 
             
            };
         | 
| 1263 | 
            +
             | 
| 1264 | 
            +
            const _q = new Quaternion();
         | 
| 1265 | 
            +
             | 
| 1266 | 
            +
            class GLTFCubicSplineQuaternionInterpolant extends GLTFCubicSplineInterpolant {
         | 
| 1267 | 
            +
              interpolate_(i1, t0, t, t1) {
         | 
| 1268 | 
            +
                const result = super.interpolate_(i1, t0, t, t1);
         | 
| 1269 | 
            +
             | 
| 1270 | 
            +
                _q.fromArray(result).normalize().toArray(result);
         | 
| 1271 | 
            +
             | 
| 1272 | 
            +
                return result;
         | 
| 1273 | 
            +
              }
         | 
| 1274 | 
            +
             | 
| 1275 | 
            +
            }
         | 
| 1199 1276 | 
             
            /*********************************/
         | 
| 1200 1277 |  | 
| 1201 1278 | 
             
            /********** INTERNALS ************/
         | 
| @@ -1284,30 +1361,10 @@ const ALPHA_MODES = { | |
| 1284 1361 | 
             
              MASK: 'MASK',
         | 
| 1285 1362 | 
             
              BLEND: 'BLEND'
         | 
| 1286 1363 | 
             
            };
         | 
| 1287 | 
            -
            /* UTILITY FUNCTIONS */
         | 
| 1288 | 
            -
             | 
| 1289 | 
            -
            function resolveURL(url, path) {
         | 
| 1290 | 
            -
              // Invalid URL
         | 
| 1291 | 
            -
              if (typeof url !== 'string' || url === '') return ''; // Host Relative URL
         | 
| 1292 | 
            -
             | 
| 1293 | 
            -
              if (/^https?:\/\//i.test(path) && /^\//.test(url)) {
         | 
| 1294 | 
            -
                path = path.replace(/(^https?:\/\/[^\/]+).*/i, '$1');
         | 
| 1295 | 
            -
              } // Absolute URL http://,https://,//
         | 
| 1296 | 
            -
             | 
| 1297 | 
            -
             | 
| 1298 | 
            -
              if (/^(https?:)?\/\//i.test(url)) return url; // Data URI
         | 
| 1299 | 
            -
             | 
| 1300 | 
            -
              if (/^data:.*,.*$/i.test(url)) return url; // Blob URL
         | 
| 1301 | 
            -
             | 
| 1302 | 
            -
              if (/^blob:.*$/i.test(url)) return url; // Relative URL
         | 
| 1303 | 
            -
             | 
| 1304 | 
            -
              return path + url;
         | 
| 1305 | 
            -
            }
         | 
| 1306 1364 | 
             
            /**
         | 
| 1307 1365 | 
             
             * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#default-material
         | 
| 1308 1366 | 
             
             */
         | 
| 1309 1367 |  | 
| 1310 | 
            -
             | 
| 1311 1368 | 
             
            function createDefaultMaterial(cache) {
         | 
| 1312 1369 | 
             
              if (cache['DefaultMaterial'] === undefined) {
         | 
| 1313 1370 | 
             
                cache['DefaultMaterial'] = new MeshStandardMaterial({
         | 
| @@ -1504,7 +1561,7 @@ class GLTFParser { | |
| 1504 1561 | 
             
                this.nodeNamesUsed = {}; // Use an ImageBitmapLoader if imageBitmaps are supported. Moves much of the
         | 
| 1505 1562 | 
             
                // expensive work of uploading a texture to the GPU off the main thread.
         | 
| 1506 1563 |  | 
| 1507 | 
            -
                if (typeof createImageBitmap !== 'undefined' && /Firefox/.test(navigator.userAgent) === false) {
         | 
| 1564 | 
            +
                if (typeof createImageBitmap !== 'undefined' && /Firefox|Safari/.test(navigator.userAgent) === false) {
         | 
| 1508 1565 | 
             
                  this.textureLoader = new ImageBitmapLoader(this.options.manager);
         | 
| 1509 1566 | 
             
                } else {
         | 
| 1510 1567 | 
             
                  this.textureLoader = new TextureLoader(this.options.manager);
         | 
| @@ -1627,7 +1684,22 @@ class GLTFParser { | |
| 1627 1684 |  | 
| 1628 1685 | 
             
              _getNodeRef(cache, index, object) {
         | 
| 1629 1686 | 
             
                if (cache.refs[index] <= 1) return object;
         | 
| 1630 | 
            -
                const ref = object.clone();
         | 
| 1687 | 
            +
                const ref = object.clone(); // Propagates mappings to the cloned object, prevents mappings on the
         | 
| 1688 | 
            +
                // original object from being lost.
         | 
| 1689 | 
            +
             | 
| 1690 | 
            +
                const updateMappings = (original, clone) => {
         | 
| 1691 | 
            +
                  const mappings = this.associations.get(original);
         | 
| 1692 | 
            +
             | 
| 1693 | 
            +
                  if (mappings != null) {
         | 
| 1694 | 
            +
                    this.associations.set(clone, mappings);
         | 
| 1695 | 
            +
                  }
         | 
| 1696 | 
            +
             | 
| 1697 | 
            +
                  for (const [i, child] of original.children.entries()) {
         | 
| 1698 | 
            +
                    updateMappings(child, clone.children[i]);
         | 
| 1699 | 
            +
                  }
         | 
| 1700 | 
            +
                };
         | 
| 1701 | 
            +
             | 
| 1702 | 
            +
                updateMappings(object, ref);
         | 
| 1631 1703 | 
             
                ref.name += '_instance_' + cache.uses[index]++;
         | 
| 1632 1704 | 
             
                return ref;
         | 
| 1633 1705 | 
             
              }
         | 
| @@ -1774,7 +1846,7 @@ class GLTFParser { | |
| 1774 1846 |  | 
| 1775 1847 | 
             
                const options = this.options;
         | 
| 1776 1848 | 
             
                return new Promise(function (resolve, reject) {
         | 
| 1777 | 
            -
                  loader.load(resolveURL(bufferDef.uri, options.path), resolve, undefined, function () {
         | 
| 1849 | 
            +
                  loader.load(LoaderUtils.resolveURL(bufferDef.uri, options.path), resolve, undefined, function () {
         | 
| 1778 1850 | 
             
                    reject(new Error('THREE.GLTFLoader: Failed to load buffer "' + bufferDef.uri + '".'));
         | 
| 1779 1851 | 
             
                  });
         | 
| 1780 1852 | 
             
                });
         | 
| @@ -1927,24 +1999,10 @@ class GLTFParser { | |
| 1927 1999 | 
             
                const URL = self.URL || self.webkitURL;
         | 
| 1928 2000 | 
             
                let sourceURI = source.uri || '';
         | 
| 1929 2001 | 
             
                let isObjectURL = false;
         | 
| 1930 | 
            -
                let hasAlpha = true;
         | 
| 1931 | 
            -
                const isJPEG = sourceURI.search(/\.jpe?g($|\?)/i) > 0 || sourceURI.search(/^data\:image\/jpeg/) === 0;
         | 
| 1932 | 
            -
                if (source.mimeType === 'image/jpeg' || isJPEG) hasAlpha = false;
         | 
| 1933 2002 |  | 
| 1934 2003 | 
             
                if (source.bufferView !== undefined) {
         | 
| 1935 2004 | 
             
                  // Load binary image data from bufferView, if provided.
         | 
| 1936 2005 | 
             
                  sourceURI = parser.getDependency('bufferView', source.bufferView).then(function (bufferView) {
         | 
| 1937 | 
            -
                    if (source.mimeType === 'image/png') {
         | 
| 1938 | 
            -
                      // Inspect the PNG 'IHDR' chunk to determine whether the image could have an
         | 
| 1939 | 
            -
                      // alpha channel. This check is conservative — the image could have an alpha
         | 
| 1940 | 
            -
                      // channel with all values == 1, and the indexed type (colorType == 3) only
         | 
| 1941 | 
            -
                      // sometimes contains alpha.
         | 
| 1942 | 
            -
                      //
         | 
| 1943 | 
            -
                      // https://en.wikipedia.org/wiki/Portable_Network_Graphics#File_header
         | 
| 1944 | 
            -
                      const colorType = new DataView(bufferView, 25, 1).getUint8(0, false);
         | 
| 1945 | 
            -
                      hasAlpha = colorType === 6 || colorType === 4 || colorType === 3;
         | 
| 1946 | 
            -
                    }
         | 
| 1947 | 
            -
             | 
| 1948 2006 | 
             
                    isObjectURL = true;
         | 
| 1949 2007 | 
             
                    const blob = new Blob([bufferView], {
         | 
| 1950 2008 | 
             
                      type: source.mimeType
         | 
| @@ -1968,7 +2026,7 @@ class GLTFParser { | |
| 1968 2026 | 
             
                      };
         | 
| 1969 2027 | 
             
                    }
         | 
| 1970 2028 |  | 
| 1971 | 
            -
                    loader.load(resolveURL(sourceURI, options.path), onLoad, undefined, reject);
         | 
| 2029 | 
            +
                    loader.load(LoaderUtils.resolveURL(sourceURI, options.path), onLoad, undefined, reject);
         | 
| 1972 2030 | 
             
                  });
         | 
| 1973 2031 | 
             
                }).then(function (texture) {
         | 
| 1974 2032 | 
             
                  // Clean up resources and configure Texture.
         | 
| @@ -1977,9 +2035,7 @@ class GLTFParser { | |
| 1977 2035 | 
             
                  }
         | 
| 1978 2036 |  | 
| 1979 2037 | 
             
                  texture.flipY = false;
         | 
| 1980 | 
            -
                  if (textureDef.name) texture.name = textureDef.name; | 
| 1981 | 
            -
             | 
| 1982 | 
            -
                  if (!hasAlpha) texture.format = RGBFormat;
         | 
| 2038 | 
            +
                  if (textureDef.name) texture.name = textureDef.name;
         | 
| 1983 2039 | 
             
                  const samplers = json.samplers || {};
         | 
| 1984 2040 | 
             
                  const sampler = samplers[textureDef.sampler] || {};
         | 
| 1985 2041 | 
             
                  texture.magFilter = WEBGL_FILTERS[sampler.magFilter] || LinearFilter;
         | 
| @@ -1987,8 +2043,7 @@ class GLTFParser { | |
| 1987 2043 | 
             
                  texture.wrapS = WEBGL_WRAPPINGS[sampler.wrapS] || RepeatWrapping;
         | 
| 1988 2044 | 
             
                  texture.wrapT = WEBGL_WRAPPINGS[sampler.wrapT] || RepeatWrapping;
         | 
| 1989 2045 | 
             
                  parser.associations.set(texture, {
         | 
| 1990 | 
            -
                     | 
| 1991 | 
            -
                    index: textureIndex
         | 
| 2046 | 
            +
                    textures: textureIndex
         | 
| 1992 2047 | 
             
                  });
         | 
| 1993 2048 | 
             
                  return texture;
         | 
| 1994 2049 | 
             
                }).catch(function () {
         | 
| @@ -2043,7 +2098,7 @@ class GLTFParser { | |
| 2043 2098 | 
             
              assignFinalMaterial(mesh) {
         | 
| 2044 2099 | 
             
                const geometry = mesh.geometry;
         | 
| 2045 2100 | 
             
                let material = mesh.material;
         | 
| 2046 | 
            -
                const  | 
| 2101 | 
            +
                const useDerivativeTangents = geometry.attributes.tangent === undefined;
         | 
| 2047 2102 | 
             
                const useVertexColors = geometry.attributes.color !== undefined;
         | 
| 2048 2103 | 
             
                const useFlatShading = geometry.attributes.normal === undefined;
         | 
| 2049 2104 |  | 
| @@ -2077,10 +2132,10 @@ class GLTFParser { | |
| 2077 2132 | 
             
                } // Clone the material if it will be modified
         | 
| 2078 2133 |  | 
| 2079 2134 |  | 
| 2080 | 
            -
                if ( | 
| 2135 | 
            +
                if (useDerivativeTangents || useVertexColors || useFlatShading) {
         | 
| 2081 2136 | 
             
                  let cacheKey = 'ClonedMaterial:' + material.uuid + ':';
         | 
| 2082 2137 | 
             
                  if (material.isGLTFSpecularGlossinessMaterial) cacheKey += 'specular-glossiness:';
         | 
| 2083 | 
            -
                  if ( | 
| 2138 | 
            +
                  if (useDerivativeTangents) cacheKey += 'derivative-tangents:';
         | 
| 2084 2139 | 
             
                  if (useVertexColors) cacheKey += 'vertex-colors:';
         | 
| 2085 2140 | 
             
                  if (useFlatShading) cacheKey += 'flat-shading:';
         | 
| 2086 2141 | 
             
                  let cachedMaterial = this.cache.get(cacheKey);
         | 
| @@ -2090,7 +2145,7 @@ class GLTFParser { | |
| 2090 2145 | 
             
                    if (useVertexColors) cachedMaterial.vertexColors = true;
         | 
| 2091 2146 | 
             
                    if (useFlatShading) cachedMaterial.flatShading = true;
         | 
| 2092 2147 |  | 
| 2093 | 
            -
                    if ( | 
| 2148 | 
            +
                    if (useDerivativeTangents) {
         | 
| 2094 2149 | 
             
                      // https://github.com/mrdoob/three.js/issues/11438#issuecomment-507003995
         | 
| 2095 2150 | 
             
                      if (cachedMaterial.normalScale) cachedMaterial.normalScale.y *= -1;
         | 
| 2096 2151 | 
             
                      if (cachedMaterial.clearcoatNormalScale) cachedMaterial.clearcoatNormalScale.y *= -1;
         | 
| @@ -2111,9 +2166,7 @@ class GLTFParser { | |
| 2111 2166 | 
             
                mesh.material = material;
         | 
| 2112 2167 | 
             
              }
         | 
| 2113 2168 |  | 
| 2114 | 
            -
              getMaterialType()
         | 
| 2115 | 
            -
              /* materialIndex */
         | 
| 2116 | 
            -
              {
         | 
| 2169 | 
            +
              getMaterialType() {
         | 
| 2117 2170 | 
             
                return MeshStandardMaterial;
         | 
| 2118 2171 | 
             
              }
         | 
| 2119 2172 | 
             
              /**
         | 
| @@ -2185,6 +2238,7 @@ class GLTFParser { | |
| 2185 2238 |  | 
| 2186 2239 | 
             
                  materialParams.depthWrite = false;
         | 
| 2187 2240 | 
             
                } else {
         | 
| 2241 | 
            +
                  materialParams.format = RGBFormat;
         | 
| 2188 2242 | 
             
                  materialParams.transparent = false;
         | 
| 2189 2243 |  | 
| 2190 2244 | 
             
                  if (alphaMode === ALPHA_MODES.MASK) {
         | 
| @@ -2193,12 +2247,12 @@ class GLTFParser { | |
| 2193 2247 | 
             
                }
         | 
| 2194 2248 |  | 
| 2195 2249 | 
             
                if (materialDef.normalTexture !== undefined && materialType !== MeshBasicMaterial) {
         | 
| 2196 | 
            -
                  pending.push(parser.assignTexture(materialParams, 'normalMap', materialDef.normalTexture)); | 
| 2197 | 
            -
             | 
| 2198 | 
            -
                  materialParams.normalScale = new Vector2(1, -1);
         | 
| 2250 | 
            +
                  pending.push(parser.assignTexture(materialParams, 'normalMap', materialDef.normalTexture));
         | 
| 2251 | 
            +
                  materialParams.normalScale = new Vector2(1, 1);
         | 
| 2199 2252 |  | 
| 2200 2253 | 
             
                  if (materialDef.normalTexture.scale !== undefined) {
         | 
| 2201 | 
            -
                     | 
| 2254 | 
            +
                    const scale = materialDef.normalTexture.scale;
         | 
| 2255 | 
            +
                    materialParams.normalScale.set(scale, scale);
         | 
| 2202 2256 | 
             
                  }
         | 
| 2203 2257 | 
             
                }
         | 
| 2204 2258 |  | 
| @@ -2233,8 +2287,7 @@ class GLTFParser { | |
| 2233 2287 | 
             
                  if (material.emissiveMap) material.emissiveMap.encoding = sRGBEncoding;
         | 
| 2234 2288 | 
             
                  assignExtrasToUserData(material, materialDef);
         | 
| 2235 2289 | 
             
                  parser.associations.set(material, {
         | 
| 2236 | 
            -
                     | 
| 2237 | 
            -
                    index: materialIndex
         | 
| 2290 | 
            +
                    materials: materialIndex
         | 
| 2238 2291 | 
             
                  });
         | 
| 2239 2292 | 
             
                  if (materialDef.extensions) addUnknownExtensionsToUserData(extensions, material, materialDef);
         | 
| 2240 2293 | 
             
                  return material;
         | 
| @@ -2379,11 +2432,21 @@ class GLTFParser { | |
| 2379 2432 | 
             
                    meshes.push(mesh);
         | 
| 2380 2433 | 
             
                  }
         | 
| 2381 2434 |  | 
| 2435 | 
            +
                  for (let i = 0, il = meshes.length; i < il; i++) {
         | 
| 2436 | 
            +
                    parser.associations.set(meshes[i], {
         | 
| 2437 | 
            +
                      meshes: meshIndex,
         | 
| 2438 | 
            +
                      primitives: i
         | 
| 2439 | 
            +
                    });
         | 
| 2440 | 
            +
                  }
         | 
| 2441 | 
            +
             | 
| 2382 2442 | 
             
                  if (meshes.length === 1) {
         | 
| 2383 2443 | 
             
                    return meshes[0];
         | 
| 2384 2444 | 
             
                  }
         | 
| 2385 2445 |  | 
| 2386 2446 | 
             
                  const group = new Group();
         | 
| 2447 | 
            +
                  parser.associations.set(group, {
         | 
| 2448 | 
            +
                    meshes: meshIndex
         | 
| 2449 | 
            +
                  });
         | 
| 2387 2450 |  | 
| 2388 2451 | 
             
                  for (let i = 0, il = meshes.length; i < il; i++) {
         | 
| 2389 2452 | 
             
                    group.add(meshes[i]);
         | 
| @@ -2512,9 +2575,8 @@ class GLTFParser { | |
| 2512 2575 | 
             
                    const targetNames = [];
         | 
| 2513 2576 |  | 
| 2514 2577 | 
             
                    if (PATH_PROPERTIES[target.path] === PATH_PROPERTIES.weights) {
         | 
| 2515 | 
            -
                      // Node may be a Group (glTF mesh with several primitives) or a Mesh.
         | 
| 2516 2578 | 
             
                      node.traverse(function (object) {
         | 
| 2517 | 
            -
                        if (object. | 
| 2579 | 
            +
                        if (object.morphTargetInfluences) {
         | 
| 2518 2580 | 
             
                          targetNames.push(object.name ? object.name : object.uuid);
         | 
| 2519 2581 | 
             
                        }
         | 
| 2520 2582 | 
             
                      });
         | 
| @@ -2543,7 +2605,8 @@ class GLTFParser { | |
| 2543 2605 | 
             
                          // A CUBICSPLINE keyframe in glTF has three output values for each input value,
         | 
| 2544 2606 | 
             
                          // representing inTangent, splineVertex, and outTangent. As a result, track.getValueSize()
         | 
| 2545 2607 | 
             
                          // must be divided by three to get the interpolant's sampleSize argument.
         | 
| 2546 | 
            -
                           | 
| 2608 | 
            +
                          const interpolantType = this instanceof QuaternionKeyframeTrack ? GLTFCubicSplineQuaternionInterpolant : GLTFCubicSplineInterpolant;
         | 
| 2609 | 
            +
                          return new interpolantType(this.times, this.values, this.getValueSize() / 3, result);
         | 
| 2547 2610 | 
             
                        }; // Mark as CUBICSPLINE. `track.getInterpolation()` doesn't support custom interpolants.
         | 
| 2548 2611 |  | 
| 2549 2612 |  | 
| @@ -2664,10 +2727,11 @@ class GLTFParser { | |
| 2664 2727 | 
             
                    }
         | 
| 2665 2728 | 
             
                  }
         | 
| 2666 2729 |  | 
| 2667 | 
            -
                  parser.associations. | 
| 2668 | 
            -
                     | 
| 2669 | 
            -
             | 
| 2670 | 
            -
             | 
| 2730 | 
            +
                  if (!parser.associations.has(node)) {
         | 
| 2731 | 
            +
                    parser.associations.set(node, {});
         | 
| 2732 | 
            +
                  }
         | 
| 2733 | 
            +
             | 
| 2734 | 
            +
                  parser.associations.get(node).nodes = nodeIndex;
         | 
| 2671 2735 | 
             
                  return node;
         | 
| 2672 2736 | 
             
                });
         | 
| 2673 2737 | 
             
              }
         | 
| @@ -2693,17 +2757,39 @@ class GLTFParser { | |
| 2693 2757 | 
             
                const pending = [];
         | 
| 2694 2758 |  | 
| 2695 2759 | 
             
                for (let i = 0, il = nodeIds.length; i < il; i++) {
         | 
| 2696 | 
            -
                  pending.push( | 
| 2760 | 
            +
                  pending.push(buildNodeHierarchy(nodeIds[i], scene, json, parser));
         | 
| 2697 2761 | 
             
                }
         | 
| 2698 2762 |  | 
| 2699 2763 | 
             
                return Promise.all(pending).then(function () {
         | 
| 2764 | 
            +
                  // Removes dangling associations, associations that reference a node that
         | 
| 2765 | 
            +
                  // didn't make it into the scene.
         | 
| 2766 | 
            +
                  const reduceAssociations = node => {
         | 
| 2767 | 
            +
                    const reducedAssociations = new Map();
         | 
| 2768 | 
            +
             | 
| 2769 | 
            +
                    for (const [key, value] of parser.associations) {
         | 
| 2770 | 
            +
                      if (key instanceof Material || key instanceof Texture) {
         | 
| 2771 | 
            +
                        reducedAssociations.set(key, value);
         | 
| 2772 | 
            +
                      }
         | 
| 2773 | 
            +
                    }
         | 
| 2774 | 
            +
             | 
| 2775 | 
            +
                    node.traverse(node => {
         | 
| 2776 | 
            +
                      const mappings = parser.associations.get(node);
         | 
| 2777 | 
            +
             | 
| 2778 | 
            +
                      if (mappings != null) {
         | 
| 2779 | 
            +
                        reducedAssociations.set(node, mappings);
         | 
| 2780 | 
            +
                      }
         | 
| 2781 | 
            +
                    });
         | 
| 2782 | 
            +
                    return reducedAssociations;
         | 
| 2783 | 
            +
                  };
         | 
| 2784 | 
            +
             | 
| 2785 | 
            +
                  parser.associations = reduceAssociations(scene);
         | 
| 2700 2786 | 
             
                  return scene;
         | 
| 2701 2787 | 
             
                });
         | 
| 2702 2788 | 
             
              }
         | 
| 2703 2789 |  | 
| 2704 2790 | 
             
            }
         | 
| 2705 2791 |  | 
| 2706 | 
            -
            function  | 
| 2792 | 
            +
            function buildNodeHierarchy(nodeId, parentObject, json, parser) {
         | 
| 2707 2793 | 
             
              const nodeDef = json.nodes[nodeId];
         | 
| 2708 2794 | 
             
              return parser.getDependency('node', nodeId).then(function (node) {
         | 
| 2709 2795 | 
             
                if (nodeDef.skin === undefined) return node; // build skeleton here as well
         | 
| @@ -2755,7 +2841,7 @@ function buildNodeHierachy(nodeId, parentObject, json, parser) { | |
| 2755 2841 |  | 
| 2756 2842 | 
             
                  for (let i = 0, il = children.length; i < il; i++) {
         | 
| 2757 2843 | 
             
                    const child = children[i];
         | 
| 2758 | 
            -
                    pending.push( | 
| 2844 | 
            +
                    pending.push(buildNodeHierarchy(child, node, json, parser));
         | 
| 2759 2845 | 
             
                  }
         | 
| 2760 2846 | 
             
                }
         | 
| 2761 2847 |  | 
| @@ -1 +1 @@ | |
| 1 | 
            -
            "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("three"),t=require("./RGBELoader.cjs.js");class a extends e.Loader{constructor( | 
| 1 | 
            +
            "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("three"),t=require("./RGBELoader.cjs.js");class a extends e.Loader{constructor(a){super(a),this.hdrLoader=new t.RGBELoader,this.type=e.HalfFloatType}load(t,a,r,i){Array.isArray(t)||(console.warn("THREE.HDRCubeTextureLoader signature has changed. Use .setDataType() instead."),this.setDataType(t),t=a,a=r,r=i,i=arguments[4]);const s=new e.CubeTexture;switch(s.type=this.type,s.type){case e.FloatType:case e.HalfFloatType:s.encoding=e.LinearEncoding,s.format=e.RGBFormat,s.minFilter=e.LinearFilter,s.magFilter=e.LinearFilter,s.generateMipmaps=!1}const n=this;let o=0;function d(a,r,i,d){new e.FileLoader(n.manager).setPath(n.path).setResponseType("arraybuffer").setWithCredentials(n.withCredentials).load(t[a],(function(t){o++;const i=n.hdrLoader.parse(t);if(i){if(void 0!==i.data){const t=new e.DataTexture(i.data,i.width,i.height);t.type=s.type,t.encoding=s.encoding,t.format=s.format,t.minFilter=s.minFilter,t.magFilter=s.magFilter,t.generateMipmaps=s.generateMipmaps,s.images[a]=t}6===o&&(s.needsUpdate=!0,r&&r(s))}}),i,d)}for(let e=0;e<t.length;e++)d(e,a,r,i);return s}setDataType(e){return this.type=e,this.hdrLoader.setDataType(e),this}}exports.HDRCubeTextureLoader=a;
         | 
| @@ -1,11 +1,11 @@ | |
| 1 | 
            -
            import { Loader,  | 
| 1 | 
            +
            import { Loader, HalfFloatType, CubeTexture, LinearEncoding, RGBFormat, LinearFilter, FloatType, FileLoader, DataTexture } from 'three';
         | 
| 2 2 | 
             
            import { RGBELoader } from './RGBELoader.js';
         | 
| 3 3 |  | 
| 4 4 | 
             
            class HDRCubeTextureLoader extends Loader {
         | 
| 5 5 | 
             
              constructor(manager) {
         | 
| 6 6 | 
             
                super(manager);
         | 
| 7 7 | 
             
                this.hdrLoader = new RGBELoader();
         | 
| 8 | 
            -
                this.type =  | 
| 8 | 
            +
                this.type = HalfFloatType;
         | 
| 9 9 | 
             
              }
         | 
| 10 10 |  | 
| 11 11 | 
             
              load(urls, onLoad, onProgress, onError) {
         | 
| @@ -1 +1 @@ | |
| 1 | 
            -
            "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("three"),s=require("../Nodes- | 
| 1 | 
            +
            "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("three"),s=require("../Nodes-894ac9dc.js");require("../nodes/core/Node.cjs.js"),require("../nodes/core/TempNode.cjs.js"),require("../nodes/core/InputNode.cjs.js"),require("../nodes/core/ConstNode.cjs.js"),require("../nodes/core/VarNode.cjs.js"),require("../nodes/core/StructNode.cjs.js"),require("../nodes/core/AttributeNode.cjs.js"),require("../nodes/core/FunctionNode.cjs.js"),require("../nodes/core/NodeLib.cjs.js"),require("../nodes/core/ExpressionNode.cjs.js"),require("../nodes/core/FunctionCallNode.cjs.js"),require("../nodes/core/NodeUtils.cjs.js"),require("../nodes/core/NodeFrame.cjs.js"),require("../nodes/core/NodeUniform.cjs.js"),require("../nodes/core/NodeBuilder.cjs.js"),require("../nodes/inputs/Vector2Node.cjs.js"),require("../nodes/inputs/Vector3Node.cjs.js"),require("../nodes/inputs/Vector4Node.cjs.js"),require("../nodes/inputs/TextureNode.cjs.js"),require("../nodes/accessors/UVNode.cjs.js"),require("../nodes/utils/ColorSpaceNode.cjs.js"),require("../nodes/inputs/CubeTextureNode.cjs.js"),require("../nodes/accessors/ReflectNode.cjs.js"),require("../nodes/accessors/PositionNode.cjs.js"),require("../nodes/accessors/NormalNode.cjs.js"),require("../nodes/misc/TextureCubeNode.cjs.js"),require("../nodes/inputs/FloatNode.cjs.js"),require("../nodes/misc/TextureCubeUVNode.cjs.js"),require("../nodes/math/OperatorNode.cjs.js"),require("../nodes/math/MathNode.cjs.js"),require("../nodes/inputs/BoolNode.cjs.js"),require("../nodes/inputs/IntNode.cjs.js"),require("../nodes/inputs/ColorNode.cjs.js"),require("../nodes/inputs/Matrix3Node.cjs.js"),require("../nodes/inputs/Matrix4Node.cjs.js"),require("../nodes/inputs/ScreenNode.cjs.js"),require("../nodes/inputs/ReflectorNode.cjs.js"),require("../nodes/inputs/PropertyNode.cjs.js"),require("../nodes/inputs/RTTNode.cjs.js"),require("../nodes/materials/NodeMaterial.cjs.js"),require("../nodes/materials/nodes/RawNode.cjs.js"),require("../nodes/accessors/ColorsNode.cjs.js"),require("../nodes/accessors/CameraNode.cjs.js"),require("../nodes/accessors/LightNode.cjs.js"),require("../nodes/accessors/ScreenUVNode.cjs.js"),require("../nodes/accessors/ResolutionNode.cjs.js"),require("../nodes/math/CondNode.cjs.js"),require("../nodes/procedural/NoiseNode.cjs.js"),require("../nodes/procedural/CheckerNode.cjs.js"),require("../nodes/misc/NormalMapNode.cjs.js"),require("../nodes/misc/BumpMapNode.cjs.js"),require("../nodes/utils/BypassNode.cjs.js"),require("../nodes/utils/JoinNode.cjs.js"),require("../nodes/utils/SwitchNode.cjs.js"),require("../nodes/utils/TimerNode.cjs.js"),require("../nodes/utils/VelocityNode.cjs.js"),require("../nodes/utils/UVTransformNode.cjs.js"),require("../nodes/utils/MaxMIPLevelNode.cjs.js"),require("../nodes/utils/SpecularMIPLevelNode.cjs.js"),require("../nodes/utils/SubSlotNode.cjs.js"),require("../nodes/effects/BlurNode.cjs.js"),require("../nodes/effects/ColorAdjustmentNode.cjs.js"),require("../nodes/effects/LuminanceNode.cjs.js"),require("../nodes/materials/nodes/BasicNode.cjs.js"),require("../nodes/materials/nodes/SpriteNode.cjs.js"),require("../nodes/materials/nodes/PhongNode.cjs.js"),require("../nodes/materials/nodes/StandardNode.cjs.js"),require("../nodes/materials/nodes/MeshStandardNode.cjs.js"),require("../nodes/materials/BasicNodeMaterial.cjs.js"),require("../nodes/materials/SpriteNodeMaterial.cjs.js"),require("../nodes/materials/PhongNodeMaterial.cjs.js"),require("../nodes/materials/StandardNodeMaterial.cjs.js"),require("../nodes/materials/MeshStandardNodeMaterial.cjs.js"),require("../nodes/postprocessing/NodePostProcessing.cjs.js");class r extends e.Loader{constructor(e,s={}){super(e),this.nodes={},this.materials={},this.passes={},this.names={},this.library=s}load(s,r,o,i){const t=this,d=new e.FileLoader(t.manager);return d.setPath(t.path),d.load(s,(function(e){r(t.parse(JSON.parse(e)))}),o,i),this}getObjectByName(e){return this.names[e]}getObjectById(e){return this.library[e]||this.nodes[e]||this.materials[e]||this.passes[e]||this.names[e]}getNode(e){const s=this.getObjectById(e);return s||console.warn('Node "'+e+'" not found.'),s}resolve(e){switch(typeof e){case"boolean":case"number":return e;case"string":return/^\w{8}-\w{4}-\w{4}-\w{4}-\w{12}$/i.test(e)||this.library[e]?this.getNode(e):e;default:if(Array.isArray(e))for(let s=0;s<e.length;s++)e[s]=this.resolve(e[s]);else for(const s in e)"uuid"!==s&&(e[s]=this.resolve(e[s]))}return e}declare(e){let r,o,i;for(r in e.nodes)o=e.nodes[r],i=new s.Nodes[o.nodeType+"Node"],o.name&&(i.name=o.name,this.names[i.name]=i),this.nodes[r]=i;for(r in e.materials)o=e.materials[r],i=new s.Nodes[o.type],o.name&&(i.name=o.name,this.names[i.name]=i),this.materials[r]=i;for(r in e.passes)o=e.passes[r],i=new s.Nodes[o.type],o.name&&(i.name=o.name,this.names[i.name]=i),this.passes[r]=i;return e.material&&(this.material=this.materials[e.material]),e.pass&&(this.pass=this.passes[e.pass]),e}parse(e){let s;for(s in(e=this.resolve(this.declare(e))).nodes)this.nodes[s].copy(e.nodes[s]);for(s in e.materials)this.materials[s].copy(e.materials[s]);for(s in e.passes)this.passes[s].copy(e.passes[s]);return this.material||this.pass||this}}exports.NodeMaterialLoader=r,exports.NodeMaterialLoaderUtils=class{static replaceUUIDObject(e,s,r,o){if(o=void 0===o||o,"object"==typeof s&&(s=s.uuid),"object"==typeof e){const i=Object.keys(e);for(let t=0;t<i.length;t++){const d=i[t];o&&(e[d]=this.replaceUUIDObject(e[d],s,r)),d===s&&(e[s]=e[d],delete e[d])}}return e===s?r:e}static replaceUUID(e,s,r){return this.replaceUUIDObject(e,s,r,!1),this.replaceUUIDObject(e.nodes,s,r),this.replaceUUIDObject(e.materials,s,r),this.replaceUUIDObject(e.passes,s,r),this.replaceUUIDObject(e.library,s,r,!1),e}};
         | 
| @@ -1 +1 @@ | |
| 1 | 
            -
            "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("three");class t extends e.DataTextureLoader{constructor( | 
| 1 | 
            +
            "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("three");class t extends e.DataTextureLoader{constructor(t){super(t),this.type=e.HalfFloatType}parse(t){const r=function(e,t){switch(e){case 1:console.error("THREE.RGBELoader Read Error: "+(t||""));break;case 2:console.error("THREE.RGBELoader Write Error: "+(t||""));break;case 3:console.error("THREE.RGBELoader Bad File Format: "+(t||""));break;default:case 4:console.error("THREE.RGBELoader: Error: "+(t||""))}return-1},a=function(e,t,r){t=t||1024;let a=e.pos,n=-1,o=0,s="",i=String.fromCharCode.apply(null,new Uint16Array(e.subarray(a,a+128)));for(;0>(n=i.indexOf("\n"))&&o<t&&a<e.byteLength;)s+=i,o+=i.length,a+=128,i+=String.fromCharCode.apply(null,new Uint16Array(e.subarray(a,a+128)));return-1<n&&(!1!==r&&(e.pos+=o+n+1),s+i.slice(0,n))},n=function(e,t,r,a){const n=e[t+3],o=Math.pow(2,n-128)/255;r[a+0]=e[t+0]*o,r[a+1]=e[t+1]*o,r[a+2]=e[t+2]*o},o=function(t,r,a,n){const o=t[r+3],s=Math.pow(2,o-128)/255;a[n+0]=e.DataUtils.toHalfFloat(Math.min(t[r+0]*s,65504)),a[n+1]=e.DataUtils.toHalfFloat(Math.min(t[r+1]*s,65504)),a[n+2]=e.DataUtils.toHalfFloat(Math.min(t[r+2]*s,65504))},s=new Uint8Array(t);s.pos=0;const i=function(e){const t=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,n=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,o=/^\s*FORMAT=(\S+)\s*$/,s=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,i={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0};let l,c;if(e.pos>=e.byteLength||!(l=a(e)))return r(1,"no header found");if(!(c=l.match(/^#\?(\S+)/)))return r(3,"bad initial token");for(i.valid|=1,i.programtype=c[1],i.string+=l+"\n";l=a(e),!1!==l;)if(i.string+=l+"\n","#"!==l.charAt(0)){if((c=l.match(t))&&(i.gamma=parseFloat(c[1],10)),(c=l.match(n))&&(i.exposure=parseFloat(c[1],10)),(c=l.match(o))&&(i.valid|=2,i.format=c[1]),(c=l.match(s))&&(i.valid|=4,i.height=parseInt(c[1],10),i.width=parseInt(c[2],10)),2&i.valid&&4&i.valid)break}else i.comments+=l+"\n";return 2&i.valid?4&i.valid?i:r(3,"missing image size specifier"):r(3,"missing format specifier")}(s);if(-1!==i){const t=i.width,a=i.height,l=function(e,t,a){const n=t;if(n<8||n>32767||2!==e[0]||2!==e[1]||128&e[2])return new Uint8Array(e);if(n!==(e[2]<<8|e[3]))return r(3,"wrong scanline width");const o=new Uint8Array(4*t*a);if(!o.length)return r(4,"unable to allocate buffer space");let s=0,i=0;const l=4*n,c=new Uint8Array(4),f=new Uint8Array(l);let p=a;for(;p>0&&i<e.byteLength;){if(i+4>e.byteLength)return r(1);if(c[0]=e[i++],c[1]=e[i++],c[2]=e[i++],c[3]=e[i++],2!=c[0]||2!=c[1]||(c[2]<<8|c[3])!=n)return r(3,"bad rgbe scanline format");let t,a=0;for(;a<l&&i<e.byteLength;){t=e[i++];const n=t>128;if(n&&(t-=128),0===t||a+t>l)return r(3,"bad scanline data");if(n){const r=e[i++];for(let e=0;e<t;e++)f[a++]=r}else f.set(e.subarray(i,i+t),a),a+=t,i+=t}const d=n;for(let e=0;e<d;e++){let t=0;o[s]=f[e+t],t+=n,o[s+1]=f[e+t],t+=n,o[s+2]=f[e+t],t+=n,o[s+3]=f[e+t],s+=4}p--}return o}(s.subarray(s.pos),t,a);if(-1!==l){let r,s,c,f;switch(this.type){case e.FloatType:f=l.length/4;const t=new Float32Array(3*f);for(let e=0;e<f;e++)n(l,4*e,t,3*e);r=t,s=e.RGBFormat,c=e.FloatType;break;case e.HalfFloatType:f=l.length/4;const a=new Uint16Array(3*f);for(let e=0;e<f;e++)o(l,4*e,a,3*e);r=a,s=e.RGBFormat,c=e.HalfFloatType;break;default:console.error("THREE.RGBELoader: unsupported type: ",this.type)}return{width:t,height:a,data:r,header:i.string,gamma:i.gamma,exposure:i.exposure,format:s,type:c}}}return null}setDataType(e){return this.type=e,this}load(t,r,a,n){return super.load(t,(function(t,a){switch(t.type){case e.FloatType:case e.HalfFloatType:t.encoding=e.LinearEncoding,t.minFilter=e.LinearFilter,t.magFilter=e.LinearFilter,t.generateMipmaps=!1,t.flipY=!0}r&&r(t,a)}),a,n)}}exports.RGBELoader=t;
         | 
    
        package/loaders/RGBELoader.js
    CHANGED
    
    | @@ -5,7 +5,7 @@ import { DataTextureLoader, HalfFloatType, FloatType, DataUtils, RGBFormat, Line | |
| 5 5 | 
             
            class RGBELoader extends DataTextureLoader {
         | 
| 6 6 | 
             
              constructor(manager) {
         | 
| 7 7 | 
             
                super(manager);
         | 
| 8 | 
            -
                this.type =  | 
| 8 | 
            +
                this.type = HalfFloatType;
         | 
| 9 9 | 
             
              } // adapted from http://www.graphics.cornell.edu/~bjw/rgbe.html
         | 
| 10 10 |  | 
| 11 11 |  | 
| @@ -285,10 +285,11 @@ class RGBELoader extends DataTextureLoader { | |
| 285 285 |  | 
| 286 286 | 
             
                const RGBEByteToRGBHalf = function (sourceArray, sourceOffset, destArray, destOffset) {
         | 
| 287 287 | 
             
                  const e = sourceArray[sourceOffset + 3];
         | 
| 288 | 
            -
                  const scale = Math.pow(2.0, e - 128.0) / 255.0;
         | 
| 289 | 
            -
             | 
| 290 | 
            -
                  destArray[destOffset +  | 
| 291 | 
            -
                  destArray[destOffset +  | 
| 288 | 
            +
                  const scale = Math.pow(2.0, e - 128.0) / 255.0; // clamping to 65504, the maximum representable value in float16
         | 
| 289 | 
            +
             | 
| 290 | 
            +
                  destArray[destOffset + 0] = DataUtils.toHalfFloat(Math.min(sourceArray[sourceOffset + 0] * scale, 65504));
         | 
| 291 | 
            +
                  destArray[destOffset + 1] = DataUtils.toHalfFloat(Math.min(sourceArray[sourceOffset + 1] * scale, 65504));
         | 
| 292 | 
            +
                  destArray[destOffset + 2] = DataUtils.toHalfFloat(Math.min(sourceArray[sourceOffset + 2] * scale, 65504));
         | 
| 292 293 | 
             
                };
         | 
| 293 294 |  | 
| 294 295 | 
             
                const byteArray = new Uint8Array(buffer);
         | 
| @@ -306,8 +307,8 @@ class RGBELoader extends DataTextureLoader { | |
| 306 307 |  | 
| 307 308 | 
             
                    switch (this.type) {
         | 
| 308 309 | 
             
                      case FloatType:
         | 
| 309 | 
            -
                        numElements = image_rgba_data.length / 4 | 
| 310 | 
            -
                        const floatArray = new Float32Array(numElements);
         | 
| 310 | 
            +
                        numElements = image_rgba_data.length / 4;
         | 
| 311 | 
            +
                        const floatArray = new Float32Array(numElements * 3);
         | 
| 311 312 |  | 
| 312 313 | 
             
                        for (let j = 0; j < numElements; j++) {
         | 
| 313 314 | 
             
                          RGBEByteToRGBFloat(image_rgba_data, j * 4, floatArray, j * 3);
         | 
| @@ -319,8 +320,8 @@ class RGBELoader extends DataTextureLoader { | |
| 319 320 | 
             
                        break;
         | 
| 320 321 |  | 
| 321 322 | 
             
                      case HalfFloatType:
         | 
| 322 | 
            -
                        numElements = image_rgba_data.length / 4 | 
| 323 | 
            -
                        const halfArray = new Uint16Array(numElements);
         | 
| 323 | 
            +
                        numElements = image_rgba_data.length / 4;
         | 
| 324 | 
            +
                        const halfArray = new Uint16Array(numElements * 3);
         | 
| 324 325 |  | 
| 325 326 | 
             
                        for (let j = 0; j < numElements; j++) {
         | 
| 326 327 | 
             
                          RGBEByteToRGBHalf(image_rgba_data, j * 4, halfArray, j * 3);
         |