three-stdlib 2.23.3 → 2.23.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. package/README.md +23 -12
  2. package/loaders/3DMLoader.d.ts +1 -2
  3. package/loaders/3MFLoader.d.ts +1 -2
  4. package/loaders/AMFLoader.d.ts +1 -2
  5. package/loaders/AssimpLoader.d.ts +1 -2
  6. package/loaders/BVHLoader.d.ts +1 -2
  7. package/loaders/BasisTextureLoader.d.ts +1 -2
  8. package/loaders/ColladaLoader.d.ts +1 -2
  9. package/loaders/DRACOLoader.d.ts +1 -2
  10. package/loaders/FBXLoader.d.ts +1 -2
  11. package/loaders/FontLoader.cjs +4 -2
  12. package/loaders/FontLoader.d.ts +2 -1
  13. package/loaders/FontLoader.js +4 -2
  14. package/loaders/GCodeLoader.d.ts +1 -2
  15. package/loaders/GLTFLoader.cjs +71 -36
  16. package/loaders/GLTFLoader.d.ts +1 -1
  17. package/loaders/GLTFLoader.js +72 -37
  18. package/loaders/HDRCubeTextureLoader.d.ts +1 -2
  19. package/loaders/KMZLoader.d.ts +1 -2
  20. package/loaders/LDrawLoader.d.ts +1 -2
  21. package/loaders/LUT3dlLoader.d.ts +1 -2
  22. package/loaders/LUTCubeLoader.d.ts +1 -2
  23. package/loaders/LWOLoader.d.ts +1 -2
  24. package/loaders/LottieLoader.d.ts +1 -2
  25. package/loaders/MD2Loader.d.ts +1 -2
  26. package/loaders/MDDLoader.d.ts +1 -2
  27. package/loaders/MMDLoader.d.ts +1 -2
  28. package/loaders/MTLLoader.d.ts +1 -2
  29. package/loaders/NRRDLoader.d.ts +3 -2
  30. package/loaders/OBJLoader.d.ts +1 -2
  31. package/loaders/PCDLoader.d.ts +1 -2
  32. package/loaders/PDBLoader.d.ts +1 -2
  33. package/loaders/PLYLoader.d.ts +1 -2
  34. package/loaders/PRWMLoader.d.ts +1 -2
  35. package/loaders/STLLoader.d.ts +1 -2
  36. package/loaders/SVGLoader.d.ts +1 -2
  37. package/loaders/TDSLoader.d.ts +1 -2
  38. package/loaders/TTFLoader.d.ts +1 -2
  39. package/loaders/TiltLoader.d.ts +1 -2
  40. package/loaders/VOXLoader.d.ts +1 -2
  41. package/loaders/VRMLLoader.d.ts +1 -2
  42. package/loaders/VRMLoader.d.ts +1 -2
  43. package/loaders/VTKLoader.d.ts +1 -2
  44. package/loaders/XLoader.d.ts +1 -2
  45. package/loaders/XYZLoader.d.ts +1 -2
  46. package/package.json +1 -1
  47. package/types/Loader.cjs +0 -26
  48. package/types/Loader.d.ts +0 -4
  49. package/types/Loader.js +0 -9
package/README.md CHANGED
@@ -10,7 +10,9 @@ Stand-alone version of [threejs/examples/jsm](https://github.com/mrdoob/three.js
10
10
 
11
11
  ## Basic usage
12
12
 
13
- npm install three-stdlib
13
+ ```bash
14
+ npm install three-stdlib
15
+ ```
14
16
 
15
17
  ```ts
16
18
  // Export collection
@@ -21,24 +23,33 @@ import { OrbitControls, ... } from 'three-stdlib'
21
23
 
22
24
  ## Problem
23
25
 
24
- `threejs/examples` are usually regarded as something that you copy/paste into your project and adapt to your needs. That's not how people use it, and this has caused numerous issues in the past.
26
+ `three/examples` are usually regarded as something that you copy/paste into your project and adapt to your needs. That's not how people use it, and this has caused numerous issues in the past.
25
27
 
26
28
  ## Solution
27
29
 
28
- - A build system for esm and cjs
29
- - Version managed dependencies
30
+ - A build system for ESM and CJS, compatible with browser, workers, and Node
30
31
  - Class based, optimized for tree-shaking, no globals, exports instead of collections
31
- - Single flatbundle as well as individual transpiles
32
32
  - Typesafety with simple annotation-like types
33
- - CI, tests, linting, formatting (prettier)
33
+ - SemVer and NPM managed dependencies
34
34
 
35
35
  But most importantly, allowing more people that use and rely on these primitives to hold a little stake, and to share the weight of maintaining it.
36
36
 
37
- ## How to contribute
37
+ ## How to Contribute
38
+
39
+ 1. Fork and clone the repo
40
+ 2. Run `yarn install` to install dependencies
41
+ 3. Create a branch for your PR with `git checkout -b pr-type/issue-number-your-branch-name beta
42
+ 4. Let's get cooking! 👨🏻‍🍳🥓
43
+
44
+ ### Commit Guidelines
45
+
46
+ Be sure your commit messages follow this specification: https://conventionalcommits.org/en/v1.0.0-beta.4
47
+
48
+ ## Publishing
38
49
 
39
- If you want to get involved you could do any of the following:
50
+ We use `semantic-release-action` to deploy the package. Because of this only certain commits will trigger the action of creating a release:
40
51
 
41
- - Help to maintain and sync the existing primitives
42
- - Create stories for these examples for our dedicated storybook
43
- - Convert some of the files to Typescript
44
- - Add new examples for the library you think could be helpful for others
52
+ - `chore` will not release a new version
53
+ - `fix:` will create a `0.0.x` version
54
+ - `feat:` will create a `0.x.0` version
55
+ - `BREAKING CHANGE:` will create a `x.0.0` version
@@ -1,5 +1,4 @@
1
- import { LoadingManager, Object3D } from 'three'
2
- import { Loader } from '../types/Loader'
1
+ import { Loader, LoadingManager, Object3D } from 'three'
3
2
 
4
3
  export class Rhino3dmLoader extends Loader {
5
4
  constructor(manager?: LoadingManager)
@@ -1,5 +1,4 @@
1
- import { LoadingManager, Group } from 'three'
2
- import { Loader } from '../types/Loader'
1
+ import { Loader, LoadingManager, Group } from 'three'
3
2
 
4
3
  export class ThreeMFLoader extends Loader {
5
4
  constructor(manager?: LoadingManager)
@@ -1,5 +1,4 @@
1
- import { LoadingManager, Group } from 'three'
2
- import { Loader } from '../types/Loader'
1
+ import { Loader, LoadingManager, Group } from 'three'
3
2
 
4
3
  export class AMFLoader extends Loader {
5
4
  constructor(manager?: LoadingManager)
@@ -1,5 +1,4 @@
1
- import { Object3D, LoadingManager } from 'three'
2
- import { Loader } from '../types/Loader'
1
+ import { Loader, Object3D, LoadingManager } from 'three'
3
2
 
4
3
  export interface Assimp {
5
4
  animation: any
@@ -1,5 +1,4 @@
1
- import { AnimationClip, Skeleton, LoadingManager } from 'three'
2
- import { Loader } from '../types/Loader'
1
+ import { Loader, AnimationClip, Skeleton, LoadingManager } from 'three'
3
2
 
4
3
  export interface BVH {
5
4
  clip: AnimationClip
@@ -1,5 +1,4 @@
1
- import { CompressedTexture, LoadingManager, WebGLRenderer } from 'three'
2
- import { Loader } from '../types/Loader'
1
+ import { Loader, CompressedTexture, LoadingManager, WebGLRenderer } from 'three'
3
2
 
4
3
  export class BasisTextureLoader extends Loader {
5
4
  constructor(manager?: LoadingManager)
@@ -1,5 +1,4 @@
1
- import { LoadingManager, Scene } from 'three'
2
- import { Loader } from '../types/Loader'
1
+ import { Loader, LoadingManager, Scene } from 'three'
3
2
 
4
3
  export interface Collada {
5
4
  kinematics: object
@@ -1,5 +1,4 @@
1
- import { LoadingManager, BufferGeometry } from 'three'
2
- import { Loader } from '../types/Loader'
1
+ import { Loader, LoadingManager, BufferGeometry } from 'three'
3
2
 
4
3
  export class DRACOLoader extends Loader {
5
4
  constructor(manager?: LoadingManager)
@@ -1,5 +1,4 @@
1
- import { Group, LoadingManager } from 'three'
2
- import { Loader } from '../types/Loader'
1
+ import { Loader, Group, LoadingManager } from 'three'
3
2
 
4
3
  export class FBXLoader extends Loader {
5
4
  constructor(manager?: LoadingManager)
@@ -7,8 +7,7 @@ var __publicField = (obj, key, value) => {
7
7
  };
8
8
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
9
9
  const THREE = require("three");
10
- const Loader = require("../types/Loader.cjs");
11
- class FontLoader extends Loader.Loader {
10
+ class FontLoader extends THREE.Loader {
12
11
  constructor(manager) {
13
12
  super(manager);
14
13
  }
@@ -31,6 +30,9 @@ class FontLoader extends Loader.Loader {
31
30
  onError
32
31
  );
33
32
  }
33
+ loadAsync(url, onProgress) {
34
+ return super.loadAsync(url, onProgress);
35
+ }
34
36
  parse(json) {
35
37
  return new Font(json);
36
38
  }
@@ -1,4 +1,4 @@
1
- import { Loader } from '../types/Loader';
1
+ import { Loader } from 'three';
2
2
  import type { LoadingManager, Shape } from 'three';
3
3
  type Options = {
4
4
  lineHeight: number;
@@ -7,6 +7,7 @@ type Options = {
7
7
  export declare class FontLoader extends Loader {
8
8
  constructor(manager?: LoadingManager);
9
9
  load(url: string, onLoad?: (responseFont: Font) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void): void;
10
+ loadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise<Font>;
10
11
  parse(json: FontData): Font;
11
12
  }
12
13
  type Glyph = {
@@ -4,8 +4,7 @@ var __publicField = (obj, key, value) => {
4
4
  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
5
  return value;
6
6
  };
7
- import { FileLoader, ShapePath } from "three";
8
- import { Loader } from "../types/Loader.js";
7
+ import { Loader, FileLoader, ShapePath } from "three";
9
8
  class FontLoader extends Loader {
10
9
  constructor(manager) {
11
10
  super(manager);
@@ -29,6 +28,9 @@ class FontLoader extends Loader {
29
28
  onError
30
29
  );
31
30
  }
31
+ loadAsync(url, onProgress) {
32
+ return super.loadAsync(url, onProgress);
33
+ }
32
34
  parse(json) {
33
35
  return new Font(json);
34
36
  }
@@ -1,5 +1,4 @@
1
- import { Group, LoadingManager } from 'three'
2
- import { Loader } from '../types/Loader'
1
+ import { Loader, Group, LoadingManager } from 'three'
3
2
 
4
3
  export class GCodeLoader extends Loader {
5
4
  constructor(manager?: LoadingManager)
@@ -42,6 +42,9 @@ class GLTFLoader extends THREE.Loader {
42
42
  this.register(function(parser) {
43
43
  return new GLTFMaterialsIridescenceExtension(parser);
44
44
  });
45
+ this.register(function(parser) {
46
+ return new GLTFMaterialsAnisotropyExtension(parser);
47
+ });
45
48
  this.register(function(parser) {
46
49
  return new GLTFLightsExtension(parser);
47
50
  });
@@ -129,10 +132,11 @@ class GLTFLoader extends THREE.Loader {
129
132
  let json;
130
133
  const extensions = {};
131
134
  const plugins = {};
135
+ const textDecoder = new TextDecoder();
132
136
  if (typeof data === "string") {
133
137
  json = JSON.parse(data);
134
138
  } else if (data instanceof ArrayBuffer) {
135
- const magic = THREE.LoaderUtils.decodeText(new Uint8Array(data.slice(0, 4)));
139
+ const magic = textDecoder.decode(new Uint8Array(data, 0, 4));
136
140
  if (magic === BINARY_EXTENSION_HEADER_MAGIC) {
137
141
  try {
138
142
  extensions[EXTENSIONS.KHR_BINARY_GLTF] = new GLTFBinaryExtension(data);
@@ -143,7 +147,7 @@ class GLTFLoader extends THREE.Loader {
143
147
  }
144
148
  json = JSON.parse(extensions[EXTENSIONS.KHR_BINARY_GLTF].content);
145
149
  } else {
146
- json = JSON.parse(THREE.LoaderUtils.decodeText(new Uint8Array(data)));
150
+ json = JSON.parse(textDecoder.decode(data));
147
151
  }
148
152
  } else {
149
153
  json = data;
@@ -229,6 +233,7 @@ const EXTENSIONS = {
229
233
  KHR_MATERIALS_SPECULAR: "KHR_materials_specular",
230
234
  KHR_MATERIALS_TRANSMISSION: "KHR_materials_transmission",
231
235
  KHR_MATERIALS_IRIDESCENCE: "KHR_materials_iridescence",
236
+ KHR_MATERIALS_ANISOTROPY: "KHR_materials_anisotropy",
232
237
  KHR_MATERIALS_UNLIT: "KHR_materials_unlit",
233
238
  KHR_MATERIALS_VOLUME: "KHR_materials_volume",
234
239
  KHR_TEXTURE_BASISU: "KHR_texture_basisu",
@@ -343,7 +348,7 @@ class GLTFMaterialsUnlitExtension {
343
348
  materialParams.opacity = array[3];
344
349
  }
345
350
  if (metallicRoughness.baseColorTexture !== void 0) {
346
- pending.push(parser.assignTexture(materialParams, "map", metallicRoughness.baseColorTexture, 3001));
351
+ pending.push(parser.assignTexture(materialParams, "map", metallicRoughness.baseColorTexture, THREE.SRGBColorSpace));
347
352
  }
348
353
  }
349
354
  return Promise.all(pending);
@@ -485,7 +490,7 @@ class GLTFMaterialsSheenExtension {
485
490
  materialParams.sheenRoughness = extension.sheenRoughnessFactor;
486
491
  }
487
492
  if (extension.sheenColorTexture !== void 0) {
488
- pending.push(parser.assignTexture(materialParams, "sheenColorMap", extension.sheenColorTexture, 3001));
493
+ pending.push(parser.assignTexture(materialParams, "sheenColorMap", extension.sheenColorTexture, THREE.SRGBColorSpace));
489
494
  }
490
495
  if (extension.sheenRoughnessTexture !== void 0) {
491
496
  pending.push(parser.assignTexture(materialParams, "sheenRoughnessMap", extension.sheenRoughnessTexture));
@@ -603,13 +608,44 @@ class GLTFMaterialsSpecularExtension {
603
608
  materialParams.specularColor = new THREE.Color(colorArray[0], colorArray[1], colorArray[2]);
604
609
  if (extension.specularColorTexture !== void 0) {
605
610
  pending.push(
606
- parser.assignTexture(materialParams, "specularColorMap", extension.specularColorTexture, 3001)
607
- // sRGBEncoding
611
+ parser.assignTexture(materialParams, "specularColorMap", extension.specularColorTexture, THREE.SRGBColorSpace)
608
612
  );
609
613
  }
610
614
  return Promise.all(pending);
611
615
  }
612
616
  }
617
+ class GLTFMaterialsAnisotropyExtension {
618
+ constructor(parser) {
619
+ this.parser = parser;
620
+ this.name = EXTENSIONS.KHR_MATERIALS_ANISOTROPY;
621
+ }
622
+ getMaterialType(materialIndex) {
623
+ const parser = this.parser;
624
+ const materialDef = parser.json.materials[materialIndex];
625
+ if (!materialDef.extensions || !materialDef.extensions[this.name])
626
+ return null;
627
+ return THREE.MeshPhysicalMaterial;
628
+ }
629
+ extendMaterialParams(materialIndex, materialParams) {
630
+ const parser = this.parser;
631
+ const materialDef = parser.json.materials[materialIndex];
632
+ if (!materialDef.extensions || !materialDef.extensions[this.name]) {
633
+ return Promise.resolve();
634
+ }
635
+ const pending = [];
636
+ const extension = materialDef.extensions[this.name];
637
+ if (extension.anisotropyStrength !== void 0) {
638
+ materialParams.anisotropy = extension.anisotropyStrength;
639
+ }
640
+ if (extension.anisotropyRotation !== void 0) {
641
+ materialParams.anisotropyRotation = extension.anisotropyRotation;
642
+ }
643
+ if (extension.anisotropyTexture !== void 0) {
644
+ pending.push(parser.assignTexture(materialParams, "anisotropyMap", extension.anisotropyTexture));
645
+ }
646
+ return Promise.all(pending);
647
+ }
648
+ }
613
649
  class GLTFTextureBasisUExtension {
614
650
  constructor(parser) {
615
651
  this.parser = parser;
@@ -854,8 +890,9 @@ class GLTFBinaryExtension {
854
890
  this.content = null;
855
891
  this.body = null;
856
892
  const headerView = new DataView(data, 0, BINARY_EXTENSION_HEADER_LENGTH);
893
+ const textDecoder = new TextDecoder();
857
894
  this.header = {
858
- magic: THREE.LoaderUtils.decodeText(new Uint8Array(data.slice(0, 4))),
895
+ magic: textDecoder.decode(new Uint8Array(data.slice(0, 4))),
859
896
  version: headerView.getUint32(4, true),
860
897
  length: headerView.getUint32(8, true)
861
898
  };
@@ -874,7 +911,7 @@ class GLTFBinaryExtension {
874
911
  chunkIndex += 4;
875
912
  if (chunkType === BINARY_EXTENSION_CHUNK_TYPES.JSON) {
876
913
  const contentArray = new Uint8Array(data, BINARY_EXTENSION_HEADER_LENGTH + chunkIndex, chunkLength);
877
- this.content = THREE.LoaderUtils.decodeText(contentArray);
914
+ this.content = textDecoder.decode(contentArray);
878
915
  } else if (chunkType === BINARY_EXTENSION_CHUNK_TYPES.BIN) {
879
916
  const byteOffset = BINARY_EXTENSION_HEADER_LENGTH + chunkIndex;
880
917
  this.body = data.slice(byteOffset, byteOffset + chunkLength);
@@ -1004,7 +1041,7 @@ class GLTFCubicSplineInterpolant extends THREE.Interpolant {
1004
1041
  return result;
1005
1042
  }
1006
1043
  }
1007
- const _q = /* @__PURE__ */ new THREE.Quaternion();
1044
+ const _q = new THREE.Quaternion();
1008
1045
  class GLTFCubicSplineQuaternionInterpolant extends GLTFCubicSplineInterpolant {
1009
1046
  interpolate_(i1, t0, t, t1) {
1010
1047
  const result = super.interpolate_(i1, t0, t, t1);
@@ -1067,18 +1104,10 @@ const ATTRIBUTES = {
1067
1104
  POSITION: "position",
1068
1105
  NORMAL: "normal",
1069
1106
  TANGENT: "tangent",
1070
- // uv => uv1, 4 uv channels
1071
- // https://github.com/mrdoob/three.js/pull/25943
1072
- // https://github.com/mrdoob/three.js/pull/25788
1073
- ...THREE.REVISION.replace(/\D+/g, "") >= 152 ? {
1074
- TEXCOORD_0: "uv",
1075
- TEXCOORD_1: "uv1",
1076
- TEXCOORD_2: "uv2",
1077
- TEXCOORD_3: "uv3"
1078
- } : {
1079
- TEXCOORD_0: "uv",
1080
- TEXCOORD_1: "uv2"
1081
- },
1107
+ TEXCOORD_0: "uv",
1108
+ TEXCOORD_1: "uv1",
1109
+ TEXCOORD_2: "uv2",
1110
+ TEXCOORD_3: "uv3",
1082
1111
  COLOR_0: "color",
1083
1112
  WEIGHTS_0: "skinWeight",
1084
1113
  JOINTS_0: "skinIndex"
@@ -1205,13 +1234,18 @@ function updateMorphTargets(mesh, meshDef) {
1205
1234
  }
1206
1235
  }
1207
1236
  function createPrimitiveKey(primitiveDef) {
1208
- const dracoExtension = primitiveDef.extensions && primitiveDef.extensions[EXTENSIONS.KHR_DRACO_MESH_COMPRESSION];
1209
1237
  let geometryKey;
1238
+ const dracoExtension = primitiveDef.extensions && primitiveDef.extensions[EXTENSIONS.KHR_DRACO_MESH_COMPRESSION];
1210
1239
  if (dracoExtension) {
1211
1240
  geometryKey = "draco:" + dracoExtension.bufferView + ":" + dracoExtension.indices + ":" + createAttributesKey(dracoExtension.attributes);
1212
1241
  } else {
1213
1242
  geometryKey = primitiveDef.indices + ":" + createAttributesKey(primitiveDef.attributes) + ":" + primitiveDef.mode;
1214
1243
  }
1244
+ if (primitiveDef.targets !== void 0) {
1245
+ for (let i = 0, il = primitiveDef.targets.length; i < il; i++) {
1246
+ geometryKey += ":" + createAttributesKey(primitiveDef.targets[i]);
1247
+ }
1248
+ }
1215
1249
  return geometryKey;
1216
1250
  }
1217
1251
  function createAttributesKey(attributes) {
@@ -1243,7 +1277,7 @@ function getImageURIMimeType(uri) {
1243
1277
  return "image/webp";
1244
1278
  return "image/png";
1245
1279
  }
1246
- const _identityMatrix = /* @__PURE__ */ new THREE.Matrix4();
1280
+ const _identityMatrix = new THREE.Matrix4();
1247
1281
  class GLTFParser {
1248
1282
  constructor(json = {}, options = {}) {
1249
1283
  this.json = json;
@@ -1725,7 +1759,7 @@ class GLTFParser {
1725
1759
  * @param {Object} mapDef
1726
1760
  * @return {Promise<Texture>}
1727
1761
  */
1728
- assignTexture(materialParams, mapName, mapDef, encoding) {
1762
+ assignTexture(materialParams, mapName, mapDef, colorSpace) {
1729
1763
  const parser = this;
1730
1764
  return this.getDependency("texture", mapDef.index).then(function(texture) {
1731
1765
  if (!texture)
@@ -1742,11 +1776,8 @@ class GLTFParser {
1742
1776
  parser.associations.set(texture, gltfReference);
1743
1777
  }
1744
1778
  }
1745
- if (encoding !== void 0) {
1746
- if ("colorSpace" in texture)
1747
- texture.colorSpace = encoding === 3001 ? "srgb" : "srgb-linear";
1748
- else
1749
- texture.encoding = encoding;
1779
+ if (colorSpace !== void 0) {
1780
+ texture.colorSpace = colorSpace;
1750
1781
  }
1751
1782
  materialParams[mapName] = texture;
1752
1783
  return texture;
@@ -1849,7 +1880,7 @@ class GLTFParser {
1849
1880
  materialParams.opacity = array[3];
1850
1881
  }
1851
1882
  if (metallicRoughness.baseColorTexture !== void 0) {
1852
- pending.push(parser.assignTexture(materialParams, "map", metallicRoughness.baseColorTexture, 3001));
1883
+ pending.push(parser.assignTexture(materialParams, "map", metallicRoughness.baseColorTexture, THREE.SRGBColorSpace));
1853
1884
  }
1854
1885
  materialParams.metalness = metallicRoughness.metallicFactor !== void 0 ? metallicRoughness.metallicFactor : 1;
1855
1886
  materialParams.roughness = metallicRoughness.roughnessFactor !== void 0 ? metallicRoughness.roughnessFactor : 1;
@@ -1899,7 +1930,7 @@ class GLTFParser {
1899
1930
  materialParams.emissive = new THREE.Color().fromArray(materialDef.emissiveFactor);
1900
1931
  }
1901
1932
  if (materialDef.emissiveTexture !== void 0 && materialType !== THREE.MeshBasicMaterial) {
1902
- pending.push(parser.assignTexture(materialParams, "emissiveMap", materialDef.emissiveTexture, 3001));
1933
+ pending.push(parser.assignTexture(materialParams, "emissiveMap", materialDef.emissiveTexture, THREE.SRGBColorSpace));
1903
1934
  }
1904
1935
  return Promise.all(pending).then(function() {
1905
1936
  const material = new materialType(materialParams);
@@ -1915,12 +1946,12 @@ class GLTFParser {
1915
1946
  /** When Object3D instances are targeted by animation, they need unique names. */
1916
1947
  createUniqueName(originalName) {
1917
1948
  const sanitizedName = THREE.PropertyBinding.sanitizeNodeName(originalName || "");
1918
- let name = sanitizedName;
1919
- for (let i = 1; this.nodeNamesUsed[name]; ++i) {
1920
- name = sanitizedName + "_" + i;
1949
+ if (sanitizedName in this.nodeNamesUsed) {
1950
+ return sanitizedName + "_" + ++this.nodeNamesUsed[sanitizedName];
1951
+ } else {
1952
+ this.nodeNamesUsed[sanitizedName] = 0;
1953
+ return sanitizedName;
1921
1954
  }
1922
- this.nodeNamesUsed[name] = true;
1923
- return name;
1924
1955
  }
1925
1956
  /**
1926
1957
  * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#geometry
@@ -2023,9 +2054,13 @@ class GLTFParser {
2023
2054
  });
2024
2055
  }
2025
2056
  if (meshes.length === 1) {
2057
+ if (meshDef.extensions)
2058
+ addUnknownExtensionsToUserData(extensions, meshes[0], meshDef);
2026
2059
  return meshes[0];
2027
2060
  }
2028
2061
  const group = new THREE.Group();
2062
+ if (meshDef.extensions)
2063
+ addUnknownExtensionsToUserData(extensions, group, meshDef);
2029
2064
  parser.associations.set(group, { meshes: meshIndex });
2030
2065
  for (let i = 0, il = meshes.length; i < il; i++) {
2031
2066
  group.add(meshes[i]);
@@ -16,8 +16,8 @@ import {
16
16
  FileLoader,
17
17
  ImageBitmapLoader,
18
18
  Skeleton,
19
+ Loader,
19
20
  } from 'three'
20
- import { Loader } from '../types/Loader'
21
21
 
22
22
  import { DRACOLoader } from './DRACOLoader'
23
23
  import { KTX2Loader } from './KTX2Loader'
@@ -1,4 +1,4 @@
1
- import { Loader, LoaderUtils, FileLoader, Color, SpotLight, PointLight, DirectionalLight, MeshBasicMaterial, MeshPhysicalMaterial, Vector2, Matrix4, Vector3, Quaternion, InstancedMesh, Object3D, Interpolant, NearestFilter, LinearFilter, NearestMipmapNearestFilter, LinearMipmapNearestFilter, NearestMipmapLinearFilter, LinearMipmapLinearFilter, ClampToEdgeWrapping, MirroredRepeatWrapping, RepeatWrapping, REVISION, InterpolateLinear, InterpolateDiscrete, MeshStandardMaterial, FrontSide, TextureLoader, ImageBitmapLoader, BufferAttribute, InterleavedBuffer, InterleavedBufferAttribute, Texture, PointsMaterial, Material, LineBasicMaterial, DoubleSide, PropertyBinding, BufferGeometry, SkinnedMesh, Mesh, TriangleStripDrawMode, TriangleFanDrawMode, LineSegments, Line, LineLoop, Points, Group, PerspectiveCamera, MathUtils, OrthographicCamera, Skeleton, VectorKeyframeTrack, QuaternionKeyframeTrack, NumberKeyframeTrack, AnimationClip, Bone, Box3, Sphere } from "three";
1
+ import { Loader, LoaderUtils, FileLoader, Color, SpotLight, PointLight, DirectionalLight, MeshBasicMaterial, SRGBColorSpace, MeshPhysicalMaterial, Vector2, Matrix4, Vector3, Quaternion, InstancedMesh, Object3D, Interpolant, NearestFilter, LinearFilter, NearestMipmapNearestFilter, LinearMipmapNearestFilter, NearestMipmapLinearFilter, LinearMipmapLinearFilter, ClampToEdgeWrapping, MirroredRepeatWrapping, RepeatWrapping, InterpolateLinear, InterpolateDiscrete, MeshStandardMaterial, FrontSide, TextureLoader, ImageBitmapLoader, BufferAttribute, InterleavedBuffer, InterleavedBufferAttribute, Texture, PointsMaterial, Material, LineBasicMaterial, DoubleSide, PropertyBinding, BufferGeometry, SkinnedMesh, Mesh, TriangleStripDrawMode, TriangleFanDrawMode, LineSegments, Line, LineLoop, Points, Group, PerspectiveCamera, MathUtils, OrthographicCamera, Skeleton, VectorKeyframeTrack, QuaternionKeyframeTrack, NumberKeyframeTrack, AnimationClip, Bone, Box3, Sphere } from "three";
2
2
  import { toTrianglesDrawMode } from "../utils/BufferGeometryUtils.js";
3
3
  class GLTFLoader extends Loader {
4
4
  constructor(manager) {
@@ -40,6 +40,9 @@ class GLTFLoader extends Loader {
40
40
  this.register(function(parser) {
41
41
  return new GLTFMaterialsIridescenceExtension(parser);
42
42
  });
43
+ this.register(function(parser) {
44
+ return new GLTFMaterialsAnisotropyExtension(parser);
45
+ });
43
46
  this.register(function(parser) {
44
47
  return new GLTFLightsExtension(parser);
45
48
  });
@@ -127,10 +130,11 @@ class GLTFLoader extends Loader {
127
130
  let json;
128
131
  const extensions = {};
129
132
  const plugins = {};
133
+ const textDecoder = new TextDecoder();
130
134
  if (typeof data === "string") {
131
135
  json = JSON.parse(data);
132
136
  } else if (data instanceof ArrayBuffer) {
133
- const magic = LoaderUtils.decodeText(new Uint8Array(data.slice(0, 4)));
137
+ const magic = textDecoder.decode(new Uint8Array(data, 0, 4));
134
138
  if (magic === BINARY_EXTENSION_HEADER_MAGIC) {
135
139
  try {
136
140
  extensions[EXTENSIONS.KHR_BINARY_GLTF] = new GLTFBinaryExtension(data);
@@ -141,7 +145,7 @@ class GLTFLoader extends Loader {
141
145
  }
142
146
  json = JSON.parse(extensions[EXTENSIONS.KHR_BINARY_GLTF].content);
143
147
  } else {
144
- json = JSON.parse(LoaderUtils.decodeText(new Uint8Array(data)));
148
+ json = JSON.parse(textDecoder.decode(data));
145
149
  }
146
150
  } else {
147
151
  json = data;
@@ -227,6 +231,7 @@ const EXTENSIONS = {
227
231
  KHR_MATERIALS_SPECULAR: "KHR_materials_specular",
228
232
  KHR_MATERIALS_TRANSMISSION: "KHR_materials_transmission",
229
233
  KHR_MATERIALS_IRIDESCENCE: "KHR_materials_iridescence",
234
+ KHR_MATERIALS_ANISOTROPY: "KHR_materials_anisotropy",
230
235
  KHR_MATERIALS_UNLIT: "KHR_materials_unlit",
231
236
  KHR_MATERIALS_VOLUME: "KHR_materials_volume",
232
237
  KHR_TEXTURE_BASISU: "KHR_texture_basisu",
@@ -341,7 +346,7 @@ class GLTFMaterialsUnlitExtension {
341
346
  materialParams.opacity = array[3];
342
347
  }
343
348
  if (metallicRoughness.baseColorTexture !== void 0) {
344
- pending.push(parser.assignTexture(materialParams, "map", metallicRoughness.baseColorTexture, 3001));
349
+ pending.push(parser.assignTexture(materialParams, "map", metallicRoughness.baseColorTexture, SRGBColorSpace));
345
350
  }
346
351
  }
347
352
  return Promise.all(pending);
@@ -483,7 +488,7 @@ class GLTFMaterialsSheenExtension {
483
488
  materialParams.sheenRoughness = extension.sheenRoughnessFactor;
484
489
  }
485
490
  if (extension.sheenColorTexture !== void 0) {
486
- pending.push(parser.assignTexture(materialParams, "sheenColorMap", extension.sheenColorTexture, 3001));
491
+ pending.push(parser.assignTexture(materialParams, "sheenColorMap", extension.sheenColorTexture, SRGBColorSpace));
487
492
  }
488
493
  if (extension.sheenRoughnessTexture !== void 0) {
489
494
  pending.push(parser.assignTexture(materialParams, "sheenRoughnessMap", extension.sheenRoughnessTexture));
@@ -601,13 +606,44 @@ class GLTFMaterialsSpecularExtension {
601
606
  materialParams.specularColor = new Color(colorArray[0], colorArray[1], colorArray[2]);
602
607
  if (extension.specularColorTexture !== void 0) {
603
608
  pending.push(
604
- parser.assignTexture(materialParams, "specularColorMap", extension.specularColorTexture, 3001)
605
- // sRGBEncoding
609
+ parser.assignTexture(materialParams, "specularColorMap", extension.specularColorTexture, SRGBColorSpace)
606
610
  );
607
611
  }
608
612
  return Promise.all(pending);
609
613
  }
610
614
  }
615
+ class GLTFMaterialsAnisotropyExtension {
616
+ constructor(parser) {
617
+ this.parser = parser;
618
+ this.name = EXTENSIONS.KHR_MATERIALS_ANISOTROPY;
619
+ }
620
+ getMaterialType(materialIndex) {
621
+ const parser = this.parser;
622
+ const materialDef = parser.json.materials[materialIndex];
623
+ if (!materialDef.extensions || !materialDef.extensions[this.name])
624
+ return null;
625
+ return MeshPhysicalMaterial;
626
+ }
627
+ extendMaterialParams(materialIndex, materialParams) {
628
+ const parser = this.parser;
629
+ const materialDef = parser.json.materials[materialIndex];
630
+ if (!materialDef.extensions || !materialDef.extensions[this.name]) {
631
+ return Promise.resolve();
632
+ }
633
+ const pending = [];
634
+ const extension = materialDef.extensions[this.name];
635
+ if (extension.anisotropyStrength !== void 0) {
636
+ materialParams.anisotropy = extension.anisotropyStrength;
637
+ }
638
+ if (extension.anisotropyRotation !== void 0) {
639
+ materialParams.anisotropyRotation = extension.anisotropyRotation;
640
+ }
641
+ if (extension.anisotropyTexture !== void 0) {
642
+ pending.push(parser.assignTexture(materialParams, "anisotropyMap", extension.anisotropyTexture));
643
+ }
644
+ return Promise.all(pending);
645
+ }
646
+ }
611
647
  class GLTFTextureBasisUExtension {
612
648
  constructor(parser) {
613
649
  this.parser = parser;
@@ -852,8 +888,9 @@ class GLTFBinaryExtension {
852
888
  this.content = null;
853
889
  this.body = null;
854
890
  const headerView = new DataView(data, 0, BINARY_EXTENSION_HEADER_LENGTH);
891
+ const textDecoder = new TextDecoder();
855
892
  this.header = {
856
- magic: LoaderUtils.decodeText(new Uint8Array(data.slice(0, 4))),
893
+ magic: textDecoder.decode(new Uint8Array(data.slice(0, 4))),
857
894
  version: headerView.getUint32(4, true),
858
895
  length: headerView.getUint32(8, true)
859
896
  };
@@ -872,7 +909,7 @@ class GLTFBinaryExtension {
872
909
  chunkIndex += 4;
873
910
  if (chunkType === BINARY_EXTENSION_CHUNK_TYPES.JSON) {
874
911
  const contentArray = new Uint8Array(data, BINARY_EXTENSION_HEADER_LENGTH + chunkIndex, chunkLength);
875
- this.content = LoaderUtils.decodeText(contentArray);
912
+ this.content = textDecoder.decode(contentArray);
876
913
  } else if (chunkType === BINARY_EXTENSION_CHUNK_TYPES.BIN) {
877
914
  const byteOffset = BINARY_EXTENSION_HEADER_LENGTH + chunkIndex;
878
915
  this.body = data.slice(byteOffset, byteOffset + chunkLength);
@@ -1002,7 +1039,7 @@ class GLTFCubicSplineInterpolant extends Interpolant {
1002
1039
  return result;
1003
1040
  }
1004
1041
  }
1005
- const _q = /* @__PURE__ */ new Quaternion();
1042
+ const _q = new Quaternion();
1006
1043
  class GLTFCubicSplineQuaternionInterpolant extends GLTFCubicSplineInterpolant {
1007
1044
  interpolate_(i1, t0, t, t1) {
1008
1045
  const result = super.interpolate_(i1, t0, t, t1);
@@ -1065,18 +1102,10 @@ const ATTRIBUTES = {
1065
1102
  POSITION: "position",
1066
1103
  NORMAL: "normal",
1067
1104
  TANGENT: "tangent",
1068
- // uv => uv1, 4 uv channels
1069
- // https://github.com/mrdoob/three.js/pull/25943
1070
- // https://github.com/mrdoob/three.js/pull/25788
1071
- ...REVISION.replace(/\D+/g, "") >= 152 ? {
1072
- TEXCOORD_0: "uv",
1073
- TEXCOORD_1: "uv1",
1074
- TEXCOORD_2: "uv2",
1075
- TEXCOORD_3: "uv3"
1076
- } : {
1077
- TEXCOORD_0: "uv",
1078
- TEXCOORD_1: "uv2"
1079
- },
1105
+ TEXCOORD_0: "uv",
1106
+ TEXCOORD_1: "uv1",
1107
+ TEXCOORD_2: "uv2",
1108
+ TEXCOORD_3: "uv3",
1080
1109
  COLOR_0: "color",
1081
1110
  WEIGHTS_0: "skinWeight",
1082
1111
  JOINTS_0: "skinIndex"
@@ -1203,13 +1232,18 @@ function updateMorphTargets(mesh, meshDef) {
1203
1232
  }
1204
1233
  }
1205
1234
  function createPrimitiveKey(primitiveDef) {
1206
- const dracoExtension = primitiveDef.extensions && primitiveDef.extensions[EXTENSIONS.KHR_DRACO_MESH_COMPRESSION];
1207
1235
  let geometryKey;
1236
+ const dracoExtension = primitiveDef.extensions && primitiveDef.extensions[EXTENSIONS.KHR_DRACO_MESH_COMPRESSION];
1208
1237
  if (dracoExtension) {
1209
1238
  geometryKey = "draco:" + dracoExtension.bufferView + ":" + dracoExtension.indices + ":" + createAttributesKey(dracoExtension.attributes);
1210
1239
  } else {
1211
1240
  geometryKey = primitiveDef.indices + ":" + createAttributesKey(primitiveDef.attributes) + ":" + primitiveDef.mode;
1212
1241
  }
1242
+ if (primitiveDef.targets !== void 0) {
1243
+ for (let i = 0, il = primitiveDef.targets.length; i < il; i++) {
1244
+ geometryKey += ":" + createAttributesKey(primitiveDef.targets[i]);
1245
+ }
1246
+ }
1213
1247
  return geometryKey;
1214
1248
  }
1215
1249
  function createAttributesKey(attributes) {
@@ -1241,7 +1275,7 @@ function getImageURIMimeType(uri) {
1241
1275
  return "image/webp";
1242
1276
  return "image/png";
1243
1277
  }
1244
- const _identityMatrix = /* @__PURE__ */ new Matrix4();
1278
+ const _identityMatrix = new Matrix4();
1245
1279
  class GLTFParser {
1246
1280
  constructor(json = {}, options = {}) {
1247
1281
  this.json = json;
@@ -1723,7 +1757,7 @@ class GLTFParser {
1723
1757
  * @param {Object} mapDef
1724
1758
  * @return {Promise<Texture>}
1725
1759
  */
1726
- assignTexture(materialParams, mapName, mapDef, encoding) {
1760
+ assignTexture(materialParams, mapName, mapDef, colorSpace) {
1727
1761
  const parser = this;
1728
1762
  return this.getDependency("texture", mapDef.index).then(function(texture) {
1729
1763
  if (!texture)
@@ -1740,11 +1774,8 @@ class GLTFParser {
1740
1774
  parser.associations.set(texture, gltfReference);
1741
1775
  }
1742
1776
  }
1743
- if (encoding !== void 0) {
1744
- if ("colorSpace" in texture)
1745
- texture.colorSpace = encoding === 3001 ? "srgb" : "srgb-linear";
1746
- else
1747
- texture.encoding = encoding;
1777
+ if (colorSpace !== void 0) {
1778
+ texture.colorSpace = colorSpace;
1748
1779
  }
1749
1780
  materialParams[mapName] = texture;
1750
1781
  return texture;
@@ -1847,7 +1878,7 @@ class GLTFParser {
1847
1878
  materialParams.opacity = array[3];
1848
1879
  }
1849
1880
  if (metallicRoughness.baseColorTexture !== void 0) {
1850
- pending.push(parser.assignTexture(materialParams, "map", metallicRoughness.baseColorTexture, 3001));
1881
+ pending.push(parser.assignTexture(materialParams, "map", metallicRoughness.baseColorTexture, SRGBColorSpace));
1851
1882
  }
1852
1883
  materialParams.metalness = metallicRoughness.metallicFactor !== void 0 ? metallicRoughness.metallicFactor : 1;
1853
1884
  materialParams.roughness = metallicRoughness.roughnessFactor !== void 0 ? metallicRoughness.roughnessFactor : 1;
@@ -1897,7 +1928,7 @@ class GLTFParser {
1897
1928
  materialParams.emissive = new Color().fromArray(materialDef.emissiveFactor);
1898
1929
  }
1899
1930
  if (materialDef.emissiveTexture !== void 0 && materialType !== MeshBasicMaterial) {
1900
- pending.push(parser.assignTexture(materialParams, "emissiveMap", materialDef.emissiveTexture, 3001));
1931
+ pending.push(parser.assignTexture(materialParams, "emissiveMap", materialDef.emissiveTexture, SRGBColorSpace));
1901
1932
  }
1902
1933
  return Promise.all(pending).then(function() {
1903
1934
  const material = new materialType(materialParams);
@@ -1913,12 +1944,12 @@ class GLTFParser {
1913
1944
  /** When Object3D instances are targeted by animation, they need unique names. */
1914
1945
  createUniqueName(originalName) {
1915
1946
  const sanitizedName = PropertyBinding.sanitizeNodeName(originalName || "");
1916
- let name = sanitizedName;
1917
- for (let i = 1; this.nodeNamesUsed[name]; ++i) {
1918
- name = sanitizedName + "_" + i;
1947
+ if (sanitizedName in this.nodeNamesUsed) {
1948
+ return sanitizedName + "_" + ++this.nodeNamesUsed[sanitizedName];
1949
+ } else {
1950
+ this.nodeNamesUsed[sanitizedName] = 0;
1951
+ return sanitizedName;
1919
1952
  }
1920
- this.nodeNamesUsed[name] = true;
1921
- return name;
1922
1953
  }
1923
1954
  /**
1924
1955
  * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#geometry
@@ -2021,9 +2052,13 @@ class GLTFParser {
2021
2052
  });
2022
2053
  }
2023
2054
  if (meshes.length === 1) {
2055
+ if (meshDef.extensions)
2056
+ addUnknownExtensionsToUserData(extensions, meshes[0], meshDef);
2024
2057
  return meshes[0];
2025
2058
  }
2026
2059
  const group = new Group();
2060
+ if (meshDef.extensions)
2061
+ addUnknownExtensionsToUserData(extensions, group, meshDef);
2027
2062
  parser.associations.set(group, { meshes: meshIndex });
2028
2063
  for (let i = 0, il = meshes.length; i < il; i++) {
2029
2064
  group.add(meshes[i]);
@@ -1,5 +1,4 @@
1
- import { CubeTexture, LoadingManager, TextureDataType } from 'three'
2
- import { Loader } from '../types/Loader'
1
+ import { Loader, CubeTexture, LoadingManager, TextureDataType } from 'three'
3
2
 
4
3
  import { RGBELoader } from './RGBELoader'
5
4
 
@@ -1,5 +1,4 @@
1
- import { LoadingManager } from 'three'
2
- import { Loader } from '../types/Loader'
1
+ import { Loader, LoadingManager } from 'three'
3
2
 
4
3
  import { Collada } from './ColladaLoader'
5
4
 
@@ -1,5 +1,4 @@
1
- import { LoadingManager, Group, Material } from 'three'
2
- import { Loader } from '../types/Loader'
1
+ import { Loader, LoadingManager, Group, Material } from 'three'
3
2
 
4
3
  export class LDrawLoader extends Loader {
5
4
  materials: Material[]
@@ -1,5 +1,4 @@
1
- import { LoadingManager, DataTexture, Texture } from 'three'
2
- import { Loader } from '../types/Loader'
1
+ import { Loader, LoadingManager, DataTexture, Texture } from 'three'
3
2
 
4
3
  export interface LUT3dlResult {
5
4
  size: number
@@ -1,5 +1,4 @@
1
- import { LoadingManager, Vector3, DataTexture, Texture } from 'three'
2
- import { Loader } from '../types/Loader'
1
+ import { Loader, LoadingManager, Vector3, DataTexture, Texture } from 'three'
3
2
 
4
3
  export interface LUTCubeResult {
5
4
  title: string
@@ -1,5 +1,4 @@
1
- import { LoadingManager, Material, Object3D } from 'three'
2
- import { Loader } from '../types/Loader'
1
+ import { Loader, LoadingManager, Material, Object3D } from 'three'
3
2
 
4
3
  export interface LWO {
5
4
  materials: Material[]
@@ -1,5 +1,4 @@
1
- import { CanvasTexture, LoadingManager } from 'three'
2
- import { Loader } from '../types/Loader'
1
+ import { Loader, CanvasTexture, LoadingManager } from 'three'
3
2
 
4
3
  export class LottieLoader extends Loader {
5
4
  constructor(manager?: LoadingManager)
@@ -1,5 +1,4 @@
1
- import { BufferGeometry, LoadingManager } from 'three'
2
- import { Loader } from '../types/Loader'
1
+ import { Loader, BufferGeometry, LoadingManager } from 'three'
3
2
 
4
3
  export class MD2Loader extends Loader {
5
4
  constructor(manager?: LoadingManager)
@@ -1,5 +1,4 @@
1
- import { AnimationClip, BufferAttribute, LoadingManager } from 'three'
2
- import { Loader } from '../types/Loader'
1
+ import { Loader, AnimationClip, BufferAttribute, LoadingManager } from 'three'
3
2
 
4
3
  export interface MDD {
5
4
  morphTargets: BufferAttribute[]
@@ -1,5 +1,4 @@
1
- import { Camera, AnimationClip, FileLoader, LoadingManager, SkinnedMesh } from 'three'
2
- import { Loader } from '../types/Loader'
1
+ import { Loader, Camera, AnimationClip, FileLoader, LoadingManager, SkinnedMesh } from 'three'
3
2
 
4
3
  export interface MMDLoaderAnimationObject {
5
4
  animation: AnimationClip
@@ -1,5 +1,4 @@
1
- import { Material, LoadingManager, Mapping, BufferGeometry, Side, Texture, Vector2, Wrapping } from 'three'
2
- import { Loader } from '../types/Loader'
1
+ import { Loader, Material, LoadingManager, Mapping, BufferGeometry, Side, Texture, Vector2, Wrapping } from 'three'
3
2
 
4
3
  export interface MaterialCreatorOptions {
5
4
  /**
@@ -1,8 +1,8 @@
1
- import { LoadingManager } from 'three'
1
+ import { Loader, LoadingManager } from 'three'
2
2
 
3
3
  import { Volume } from '../misc/Volume'
4
4
 
5
- export class NRRDLoader {
5
+ export class NRRDLoader extends Loader {
6
6
  constructor(manager?: LoadingManager)
7
7
  manager: LoadingManager
8
8
  path: string
@@ -15,6 +15,7 @@ export class NRRDLoader {
15
15
  onProgress?: (event: ProgressEvent) => void,
16
16
  onError?: (event: ErrorEvent) => void,
17
17
  ): void
18
+ loadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise<Volume>
18
19
  parse(data: string): Volume
19
20
  parseChars(array: number[], start?: number, end?: number): string
20
21
  setPath(value: string): this
@@ -1,5 +1,4 @@
1
- import { LoadingManager, Group } from 'three'
2
- import { Loader } from '../types/Loader'
1
+ import { Loader, LoadingManager, Group } from 'three'
3
2
  import { MaterialCreator } from './MTLLoader'
4
3
 
5
4
  export class OBJLoader extends Loader {
@@ -1,5 +1,4 @@
1
- import { Points, LoadingManager } from 'three'
2
- import { Loader } from '../types/Loader'
1
+ import { Loader, Points, LoadingManager } from 'three'
3
2
 
4
3
  export class PCDLoader extends Loader {
5
4
  constructor(manager?: LoadingManager)
@@ -1,5 +1,4 @@
1
- import { BufferGeometry, LoadingManager } from 'three'
2
- import { Loader } from '../types/Loader'
1
+ import { Loader, BufferGeometry, LoadingManager } from 'three'
3
2
 
4
3
  export interface PDB {
5
4
  geometryAtoms: BufferGeometry
@@ -1,5 +1,4 @@
1
- import { BufferGeometry, LoadingManager } from 'three'
2
- import { Loader } from '../types/Loader'
1
+ import { Loader, BufferGeometry, LoadingManager } from 'three'
3
2
 
4
3
  export class PLYLoader extends Loader {
5
4
  constructor(manager?: LoadingManager)
@@ -1,5 +1,4 @@
1
- import { BufferGeometry, LoadingManager } from 'three'
2
- import { Loader } from '../types/Loader'
1
+ import { Loader, BufferGeometry, LoadingManager } from 'three'
3
2
 
4
3
  export class PRWMLoader extends Loader {
5
4
  constructor(manager?: LoadingManager)
@@ -1,5 +1,4 @@
1
- import { BufferGeometry, LoadingManager } from 'three'
2
- import { Loader } from '../types/Loader'
1
+ import { Loader, BufferGeometry, LoadingManager } from 'three'
3
2
 
4
3
  export class STLLoader extends Loader {
5
4
  constructor(manager?: LoadingManager)
@@ -1,5 +1,4 @@
1
- import { LoadingManager, ShapePath, BufferGeometry, Vector3, Shape } from 'three'
2
- import { Loader } from '../types/Loader'
1
+ import { Loader, LoadingManager, ShapePath, BufferGeometry, Vector3, Shape } from 'three'
3
2
 
4
3
  export interface SVGResultPaths extends ShapePath {
5
4
  userData?:
@@ -1,5 +1,4 @@
1
- import { Color, Group, LoadingManager, Material, Mesh, Texture } from 'three'
2
- import { Loader } from '../types/Loader'
1
+ import { Loader, Color, Group, LoadingManager, Material, Mesh, Texture } from 'three'
3
2
 
4
3
  export class TDSLoader extends Loader {
5
4
  constructor(manager?: LoadingManager)
@@ -1,5 +1,4 @@
1
- import { LoadingManager } from 'three'
2
- import { Loader } from '../types/Loader'
1
+ import { Loader, LoadingManager } from 'three'
3
2
 
4
3
  export class TTFLoader extends Loader {
5
4
  constructor(manager?: LoadingManager)
@@ -1,5 +1,4 @@
1
- import { LoadingManager, Group } from 'three'
2
- import { Loader } from '../types/Loader'
1
+ import { Loader, LoadingManager, Group } from 'three'
3
2
 
4
3
  export class TiltLoader extends Loader {
5
4
  constructor(manager?: LoadingManager)
@@ -1,5 +1,4 @@
1
- import { Texture, Mesh, LoadingManager } from 'three'
2
- import { Loader } from '../types/Loader'
1
+ import { Loader, Texture, Mesh, LoadingManager } from 'three'
3
2
 
4
3
  export interface Chunk {
5
4
  palette: number[]
@@ -1,5 +1,4 @@
1
- import { Scene, LoadingManager } from 'three'
2
- import { Loader } from '../types/Loader'
1
+ import { Loader, Scene, LoadingManager } from 'three'
3
2
 
4
3
  export class VRMLLoader extends Loader {
5
4
  constructor(manager?: LoadingManager)
@@ -1,5 +1,4 @@
1
- import { LoadingManager } from 'three'
2
- import { Loader } from '../types/Loader'
1
+ import { Loader, LoadingManager } from 'three'
3
2
 
4
3
  import { GLTFLoader, GLTF } from './GLTFLoader'
5
4
  import { DRACOLoader } from './DRACOLoader'
@@ -1,5 +1,4 @@
1
- import { BufferGeometry, LoadingManager } from 'three'
2
- import { Loader } from '../types/Loader'
1
+ import { Loader, BufferGeometry, LoadingManager } from 'three'
3
2
 
4
3
  export class VTKLoader extends Loader {
5
4
  constructor(manager?: LoadingManager)
@@ -1,5 +1,4 @@
1
- import { Mesh, LoadingManager } from 'three'
2
- import { Loader } from '../types/Loader'
1
+ import { Loader, Mesh, LoadingManager } from 'three'
3
2
 
4
3
  export interface XResult {
5
4
  animations: object[]
@@ -1,5 +1,4 @@
1
- import { BufferGeometry, LoadingManager } from 'three'
2
- import { Loader } from '../types/Loader'
1
+ import { Loader, BufferGeometry, LoadingManager } from 'three'
3
2
 
4
3
  export class XYZLoader extends Loader {
5
4
  constructor(manager?: LoadingManager)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "three-stdlib",
3
- "version": "2.23.3",
3
+ "version": "2.23.5",
4
4
  "description": "stand-alone library of threejs examples",
5
5
  "keywords": [
6
6
  "three",
package/types/Loader.cjs DELETED
@@ -1,26 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const THREE = require("three");
4
- function _interopNamespaceDefault(e) {
5
- const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
6
- if (e) {
7
- for (const k in e) {
8
- if (k !== "default") {
9
- const d = Object.getOwnPropertyDescriptor(e, k);
10
- Object.defineProperty(n, k, d.get ? d : {
11
- enumerable: true,
12
- get: () => e[k]
13
- });
14
- }
15
- }
16
- }
17
- n.default = e;
18
- return Object.freeze(n);
19
- }
20
- const THREE__namespace = /* @__PURE__ */ _interopNamespaceDefault(THREE);
21
- class Loader extends THREE__namespace.Loader {
22
- loadAsync(url, onProgress) {
23
- return super.loadAsync(url, onProgress);
24
- }
25
- }
26
- exports.Loader = Loader;
package/types/Loader.d.ts DELETED
@@ -1,4 +0,0 @@
1
- import * as THREE from 'three';
2
- export declare class Loader extends THREE.Loader {
3
- loadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise<any>;
4
- }
package/types/Loader.js DELETED
@@ -1,9 +0,0 @@
1
- import * as THREE from "three";
2
- class Loader extends THREE.Loader {
3
- loadAsync(url, onProgress) {
4
- return super.loadAsync(url, onProgress);
5
- }
6
- }
7
- export {
8
- Loader
9
- };