@vulfram/gltf-loader 0.22.3-alpha → 0.22.5-alpha

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vulfram/gltf-loader",
3
- "version": "0.22.3-alpha",
3
+ "version": "0.22.5-alpha",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -18,8 +18,8 @@
18
18
  "@vulfram/engine": "^0.0.0"
19
19
  },
20
20
  "devDependencies": {
21
- "@types/bun": "^1.3.10",
22
- "@vulfram/engine": "^0.22.3-alpha"
21
+ "@types/bun": "^1.3.11",
22
+ "@vulfram/engine": "^0.22.5-alpha"
23
23
  },
24
24
  "dependencies": {
25
25
  "@gltf-transform/core": "^4.3.0",
package/src/binary.ts CHANGED
@@ -33,7 +33,7 @@ export function detectFormat(bytes: Uint8Array): GltfSourceFormat {
33
33
 
34
34
  throw new GltfLoaderError(
35
35
  'UNSUPPORTED_FORMAT',
36
- 'Unable to detect glTF format from payload bytes.',
36
+ 'Unable to detect glTF format from payload bytes.'
37
37
  );
38
38
  }
39
39
 
@@ -59,7 +59,7 @@ export function decodeDataUri(uri: string): Uint8Array {
59
59
 
60
60
  /** Normalizes external resource map to Uint8Array values. */
61
61
  export function normalizeResourceMap(
62
- resources?: Record<string, BinaryLike>,
62
+ resources?: Record<string, BinaryLike>
63
63
  ): Record<string, Uint8Array> {
64
64
  if (!resources) return {};
65
65
  const out: Record<string, Uint8Array> = {};
package/src/context.ts CHANGED
@@ -25,8 +25,8 @@ export function createContext(input: GltfLoadInput): LoaderContext {
25
25
  entities: 0,
26
26
  geometries: 0,
27
27
  materials: 0,
28
- textures: 0,
29
- },
28
+ textures: 0
29
+ }
30
30
  };
31
31
  }
32
32
 
@@ -40,7 +40,7 @@ function allocBufferId(): number {
40
40
  export function uploadBytes(
41
41
  _ctx: LoaderContext,
42
42
  usage: 'image-data' | 'vertex-data' | 'index-data',
43
- bytes: Uint8Array,
43
+ bytes: Uint8Array
44
44
  ): number {
45
45
  const bufferId = allocBufferId();
46
46
  uploadBuffer(bufferId, usage, bytes);
package/src/errors.ts CHANGED
@@ -2,7 +2,10 @@ import type { GltfLoaderErrorCode } from './types';
2
2
 
3
3
  /** Loader error with stable error code for callers. */
4
4
  export class GltfLoaderError extends Error {
5
- constructor(public readonly code: GltfLoaderErrorCode, message: string) {
5
+ constructor(
6
+ public readonly code: GltfLoaderErrorCode,
7
+ message: string
8
+ ) {
6
9
  super(message);
7
10
  this.name = 'GltfLoaderError';
8
11
  }
package/src/index.ts CHANGED
@@ -1,8 +1,4 @@
1
- import {
2
- dispose3DGeometry,
3
- dispose3DMaterial,
4
- dispose3DTexture,
5
- } from '@vulfram/engine/world3d';
1
+ import { dispose3DGeometry, dispose3DMaterial, dispose3DTexture } from '@vulfram/engine/world3d';
6
2
  import { createContext } from './context';
7
3
  import { GltfLoaderError } from './errors';
8
4
  import { readDocument } from './parse';
@@ -12,7 +8,7 @@ import type {
12
8
  GltfLoadInput,
13
9
  GltfLoadResult,
14
10
  GltfInstance,
15
- LoadedGltfAsset,
11
+ LoadedGltfAsset
16
12
  } from './types';
17
13
 
18
14
  export type {
@@ -27,7 +23,7 @@ export type {
27
23
  NodeTemplate,
28
24
  SceneTemplate,
29
25
  GltfSourceFormat,
30
- RootTransform,
26
+ RootTransform
31
27
  } from './types';
32
28
  export { GltfLoaderError } from './errors';
33
29
 
@@ -78,7 +74,7 @@ export async function loadGltfAsset(input: GltfLoadInput): Promise<LoadedGltfAss
78
74
  if (disposedAll) {
79
75
  throw new GltfLoaderError(
80
76
  'INVALID_INPUT',
81
- 'Cannot instantiate from a disposed glTF asset. Load it again.',
77
+ 'Cannot instantiate from a disposed glTF asset. Load it again.'
82
78
  );
83
79
  }
84
80
 
@@ -99,11 +95,11 @@ export async function loadGltfAsset(input: GltfLoadInput): Promise<LoadedGltfAss
99
95
  resources: {
100
96
  geometries: [...ctx.createdGeometryIds],
101
97
  materials: [...ctx.createdMaterialIds],
102
- textures: [...ctx.createdTextureIds],
98
+ textures: [...ctx.createdTextureIds]
103
99
  },
104
100
  instantiate,
105
101
  disposeEntities,
106
- disposeAll,
102
+ disposeAll
107
103
  };
108
104
  }
109
105
 
@@ -115,7 +111,7 @@ export async function loadGltfAsset(input: GltfLoadInput): Promise<LoadedGltfAss
115
111
  export async function loadGltfScene(input: GltfLoadInput): Promise<GltfLoadResult> {
116
112
  const asset = await loadGltfAsset(input);
117
113
  const instance = asset.instantiate({
118
- rootTransform: input.rootTransform,
114
+ rootTransform: input.rootTransform
119
115
  });
120
116
 
121
117
  return {
@@ -124,6 +120,6 @@ export async function loadGltfScene(input: GltfLoadInput): Promise<GltfLoadResul
124
120
  geometryCount: asset.resources.geometries.length,
125
121
  materialCount: asset.resources.materials.length,
126
122
  textureCount: asset.resources.textures.length,
127
- warnings: asset.warnings,
123
+ warnings: asset.warnings
128
124
  };
129
125
  }
package/src/parse.ts CHANGED
@@ -5,7 +5,7 @@ import type { GltfLoadInput } from './types';
5
5
 
6
6
  function parseGltfJsonDocument(
7
7
  bytes: Uint8Array,
8
- resources?: Record<string, import('./types').BinaryLike>,
8
+ resources?: Record<string, import('./types').BinaryLike>
9
9
  ): JSONDocument {
10
10
  const decoder = new TextDecoder('utf-8');
11
11
  let json: GLTF.IGLTF;
@@ -26,7 +26,7 @@ function parseGltfJsonDocument(
26
26
  }
27
27
  throw new GltfLoaderError(
28
28
  'MISSING_RESOURCE',
29
- `External resource not provided for URI "${uri}". Provide it in input.resources.`,
29
+ `External resource not provided for URI "${uri}". Provide it in input.resources.`
30
30
  );
31
31
  };
32
32
 
@@ -39,7 +39,7 @@ function parseGltfJsonDocument(
39
39
 
40
40
  return {
41
41
  json,
42
- resources: resourceMap as unknown as { [s: string]: Uint8Array<ArrayBuffer> },
42
+ resources: resourceMap as unknown as { [s: string]: Uint8Array<ArrayBuffer> }
43
43
  };
44
44
  }
45
45