@margoengine/gltf 0.1.0 → 1.0.0

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.
Files changed (83) hide show
  1. package/LICENSE +201 -201
  2. package/NOTICE +4 -4
  3. package/README.md +1754 -1438
  4. package/dist/accessor-CU_1uSZ1.js +1 -0
  5. package/dist/asset-DN3ocEdY.js +4 -0
  6. package/dist/asset-entry.js +1 -1
  7. package/dist/asset.d.ts +76 -0
  8. package/dist/audio.js +1 -1
  9. package/dist/auto.js +1 -1
  10. package/dist/compression-CUOCmjmE.js +1 -0
  11. package/dist/compression.d.ts +6 -0
  12. package/dist/dds.js +1 -1
  13. package/dist/default-materials.d.ts +3 -1
  14. package/dist/default-transmission.d.ts +13 -0
  15. package/dist/extended.js +1 -1
  16. package/dist/group.d.ts +15 -3
  17. package/dist/index.d.ts +11 -0
  18. package/dist/index.js +1 -1
  19. package/dist/{instanced-shader-BebTnbkj.js → instanced-shader-C9ZMazvo.js} +1 -1
  20. package/dist/instancing.js +1 -1
  21. package/dist/lights.js +1 -1
  22. package/dist/material-draw-state-GKiHDb0p.js +1 -0
  23. package/dist/material-draw.js +1 -1
  24. package/dist/meshopt.js +1 -1
  25. package/dist/mipmaps-38NmjDc3.js +21 -0
  26. package/dist/model-C77ATxi1.js +25 -0
  27. package/dist/model-entry.js +1 -1
  28. package/dist/model.d.ts +84 -7
  29. package/dist/native-glass-D85twud0.js +19 -0
  30. package/dist/pack-DdxRO8k6.js +1 -0
  31. package/dist/pbr-instancing.js +1 -1
  32. package/dist/pbr.js +1 -1
  33. package/dist/physics.js +1 -1
  34. package/dist/prepare.js +1 -1
  35. package/dist/progressive-lod.d.ts +13 -0
  36. package/dist/progressive.d.ts +5 -2
  37. package/dist/progressive.js +3 -3
  38. package/dist/quantized.js +1 -1
  39. package/dist/report.js +1 -1
  40. package/dist/scene-data.js +1 -1
  41. package/dist/scene-scope-CZDEkd24.js +2 -2
  42. package/dist/scene.js +3 -3
  43. package/dist/{shader-DPqfUcmp.js → shader-C29RtPAw.js} +43 -39
  44. package/dist/shader.d.ts +24 -0
  45. package/dist/shared/caster.d.ts +159 -152
  46. package/dist/shared/gltf.d.ts +257 -257
  47. package/dist/shared/iridescence.d.ts +2 -2
  48. package/dist/shared/prepared-geometry.d.ts +8 -8
  49. package/dist/soft-mesh.d.ts +39 -1
  50. package/dist/soft-mesh.js +2 -2
  51. package/dist/spec-gloss.js +2 -2
  52. package/dist/splats.js +1 -1
  53. package/dist/src-Btvz5f6i.js +4 -0
  54. package/dist/stream-CrfNNCRd.js +1 -0
  55. package/dist/stream.d.ts +20 -3
  56. package/dist/stroke-width-B2cnYGgn.js +1 -0
  57. package/dist/stroke-width.d.ts +18 -0
  58. package/dist/strokes.d.ts +12 -0
  59. package/dist/strokes.js +1 -0
  60. package/dist/texture-stream-Cu_XpyVO.js +3 -3
  61. package/dist/textured.js +3 -3
  62. package/dist/transmission.d.ts +81 -0
  63. package/dist/transmission.js +66 -0
  64. package/dist/version-B6NE5cJf.js +1 -0
  65. package/dist/vertex-inputs.d.ts +6 -0
  66. package/dist/{unit-light-DvtsuFYP.js → warning-UqjZyyqW.js} +2 -22
  67. package/dist/warning.d.ts +24 -0
  68. package/dist/worker.d.ts +1 -1
  69. package/dist/worker.js +3 -3
  70. package/dist/workers/gltf.js +36 -36
  71. package/dist/workers/progressive.js +1 -1
  72. package/package.json +234 -213
  73. package/dist/accessor-nVsu_f1L.js +0 -1
  74. package/dist/asset-1b8ejkZX.js +0 -4
  75. package/dist/compression-D4IkO5vE.js +0 -1
  76. package/dist/errors-THVaUwlL.js +0 -1
  77. package/dist/material-draw-state-BHeTb1FP.js +0 -1
  78. package/dist/model-iRvuj19h.js +0 -39
  79. package/dist/optimize-7SEzNA23.js +0 -1
  80. package/dist/pack-BVDYuqZe.js +0 -1
  81. package/dist/src-WMRHArDp.js +0 -4
  82. package/dist/stream-C3bKMy1B.js +0 -1
  83. package/dist/version-BmU1nesQ.js +0 -1
package/package.json CHANGED
@@ -1,213 +1,234 @@
1
- {
2
- "name": "@margoengine/gltf",
3
- "version": "0.1.0",
4
- "description": "glTF 2.0 for Margo Engine: a light static loader at the root, metallic-roughness PBR rendering at @margoengine/gltf/pbr.",
5
- "keywords": [
6
- "margoengine",
7
- "webgpu",
8
- "3d",
9
- "gltf",
10
- "glb",
11
- "loader",
12
- "pbr"
13
- ],
14
- "homepage": "https://margoengine.com",
15
- "bugs": {
16
- "url": "https://github.com/scottcampbelldata/margoengine/issues"
17
- },
18
- "repository": {
19
- "type": "git",
20
- "url": "git+https://github.com/scottcampbelldata/margoengine.git",
21
- "directory": "packages/gltf"
22
- },
23
- "license": "Apache-2.0",
24
- "author": "Scott Campbell",
25
- "type": "module",
26
- "publishConfig": {
27
- "access": "public"
28
- },
29
- "scripts": {
30
- "test": "node --test --test-name-pattern=\"glTF loader|GLB,\" ../../tests/modern.test.js && node --test test/*.test.js ../../tests/modern-extensions.test.js ../../tests/modern-gltf*.test.js ../../tests/gltf-draco-limits.test.js ../../tests/deep-render-pbr-resources.test.js ../../examples/package-benchmarks/proofs/package-guard.mjs",
31
- "prepack": "npm --prefix ../.. run build:packages",
32
- "test:gpu": "node ../../scripts/test-gltf-browser.mjs",
33
- "test:shader:browser": "cd ../.. && node packages/gltf/scripts/test-shader-review.js",
34
- "test:extensions:browser": "cd ../.. && node packages/gltf/scripts/test-extensions-browser.js",
35
- "test:gpu:materials": "cd ../.. && node scripts/gltf-pbr-materials-gpu-check.js",
36
- "test:gpu:viewer": "cd ../.. && node scripts/stage-viewer-gpu-check.js && node scripts/stage-viewer-gpu-check.js --compat",
37
- "test:gpu:native-volume": "cd ../.. && node packages/gltf/scripts/test-native-volume.mjs && node packages/gltf/scripts/test-native-volume.mjs --compat",
38
- "test:gpu:spec-gloss": "cd ../.. && node packages/gltf/scripts/test-spec-gloss-browser.mjs && node packages/gltf/scripts/test-spec-gloss-browser.mjs --compat",
39
- "test:gpu:colour-space": "cd ../.. && node packages/gltf/scripts/test-extended-colour-space-browser.mjs && node packages/gltf/scripts/test-extended-colour-space-browser.mjs --compat",
40
- "test:gpu:dds": "cd ../.. && node packages/gltf/scripts/test-dds-browser.mjs && node packages/gltf/scripts/test-dds-browser.mjs --compat",
41
- "test:gpu:mask-mips": "cd ../.. && node packages/gltf/scripts/test-mask-mips-browser.mjs && node packages/gltf/scripts/test-mask-mips-browser.mjs --compat",
42
- "test:gpu:mipmaps": "cd ../.. && node packages/gltf/scripts/test-mipmaps-browser.mjs && node packages/gltf/scripts/test-mipmaps-browser.mjs --compat",
43
- "test:gpu:diffuse-roughness": "cd ../.. && node packages/gltf/scripts/test-diffuse-roughness-browser.mjs && node packages/gltf/scripts/test-diffuse-roughness-browser.mjs --compat",
44
- "test:gpu:parts": "cd ../.. && node packages/gltf/scripts/test-parts-browser.mjs && node packages/gltf/scripts/test-parts-browser.mjs --compat",
45
- "test:gpu:skinned-parts": "cd ../.. && node packages/gltf/scripts/test-skinned-parts-browser.mjs && node packages/gltf/scripts/test-skinned-parts-browser.mjs --compat",
46
- "test:gpu:mask-alpha": "cd ../.. && node packages/gltf/scripts/test-mask-alpha-browser.mjs && node packages/gltf/scripts/test-mask-alpha-browser.mjs --compat",
47
- "test:gpu:base-textures": "cd ../.. && node packages/gltf/scripts/test-base-textures-browser.mjs && node packages/gltf/scripts/test-base-textures-browser.mjs --compat",
48
- "test:browser:audio": "cd ../.. && node packages/gltf/scripts/test-audio-browser.mjs",
49
- "test:gpu:pixel-images": "cd ../.. && node packages/gltf/scripts/test-node-images.mjs && node packages/gltf/scripts/test-pixel-images.mjs && node packages/gltf/scripts/test-pixel-images.mjs --compat",
50
- "test:gpu:compression": "cd ../.. && npm run modern:test:gltf-compression",
51
- "test:gpu:soft-mesh": "cd ../.. && node packages/gltf/scripts/test-soft-mesh-browser.mjs && node packages/gltf/scripts/test-soft-mesh-browser.mjs --compat"
52
- },
53
- "sideEffects": false,
54
- "exports": {
55
- ".": {
56
- "types": "./dist/index.d.ts",
57
- "import": "./dist/index.js"
58
- },
59
- "./auto": {
60
- "types": "./dist/auto.d.ts",
61
- "import": "./dist/auto.js"
62
- },
63
- "./instancing": {
64
- "types": "./dist/instancing.d.ts",
65
- "import": "./dist/instancing.js"
66
- },
67
- "./meshopt": {
68
- "types": "./dist/meshopt.d.ts",
69
- "import": "./dist/meshopt.js"
70
- },
71
- "./quantized": {
72
- "types": "./dist/quantized.d.ts",
73
- "import": "./dist/quantized.js"
74
- },
75
- "./scene-data": {
76
- "types": "./dist/scene-data.d.ts",
77
- "import": "./dist/scene-data.js"
78
- },
79
- "./textured": {
80
- "types": "./dist/textured.d.ts",
81
- "import": "./dist/textured.js"
82
- },
83
- "./pbr": {
84
- "types": "./dist/pbr.d.ts",
85
- "import": "./dist/pbr.js"
86
- },
87
- "./pbr-model": {
88
- "types": "./dist/model-entry.d.ts",
89
- "import": "./dist/model-entry.js"
90
- },
91
- "./asset": {
92
- "types": "./dist/asset-entry.d.ts",
93
- "import": "./dist/asset-entry.js"
94
- },
95
- "./scene": {
96
- "types": "./dist/scene.d.ts",
97
- "import": "./dist/scene.js"
98
- },
99
- "./extended-materials": {
100
- "types": "./dist/extended.d.ts",
101
- "import": "./dist/extended.js"
102
- },
103
- "./pbr-instancing": {
104
- "types": "./dist/pbr-instancing.d.ts",
105
- "import": "./dist/pbr-instancing.js"
106
- },
107
- "./prepare": {
108
- "types": "./dist/prepare.d.ts",
109
- "import": "./dist/prepare.js"
110
- },
111
- "./progressive": {
112
- "types": "./dist/progressive.d.ts",
113
- "import": "./dist/progressive.js"
114
- },
115
- "./splats": {
116
- "types": "./dist/splats.d.ts",
117
- "import": "./dist/splats.js"
118
- },
119
- "./lights": {
120
- "types": "./dist/lights.d.ts",
121
- "import": "./dist/lights.js"
122
- },
123
- "./physics": {
124
- "types": "./dist/physics.d.ts",
125
- "import": "./dist/physics.js"
126
- },
127
- "./soft-mesh": {
128
- "types": "./dist/soft-mesh.d.ts",
129
- "import": "./dist/soft-mesh.js"
130
- },
131
- "./interactivity": {
132
- "types": "./dist/interactivity.d.ts",
133
- "import": "./dist/interactivity.js"
134
- },
135
- "./report": {
136
- "types": "./dist/report.d.ts",
137
- "import": "./dist/report.js"
138
- },
139
- "./metadata": {
140
- "types": "./dist/metadata.d.ts",
141
- "import": "./dist/metadata.js"
142
- },
143
- "./texture-coordinates": {
144
- "types": "./dist/coordinates.d.ts",
145
- "import": "./dist/coordinates.js"
146
- },
147
- "./worker": {
148
- "types": "./dist/worker.d.ts",
149
- "import": "./dist/worker.js"
150
- },
151
- "./material-draw": {
152
- "types": "./dist/material-draw.d.ts",
153
- "import": "./dist/material-draw.js"
154
- },
155
- "./spec-gloss": {
156
- "types": "./dist/spec-gloss.d.ts",
157
- "import": "./dist/spec-gloss.js"
158
- },
159
- "./dds": {
160
- "types": "./dist/dds.d.ts",
161
- "import": "./dist/dds.js"
162
- },
163
- "./audio": {
164
- "types": "./dist/audio.d.ts",
165
- "import": "./dist/audio.js"
166
- }
167
- },
168
- "files": [
169
- "dist",
170
- "NOTICE"
171
- ],
172
- "dependencies": {
173
- "@margoengine/decoders": "^0.1.0",
174
- "@margoengine/math": "^0.1.0"
175
- },
176
- "peerDependencies": {
177
- "@margoengine/core": "^0.1.0",
178
- "@margoengine/clustered": "^0.1.0",
179
- "@margoengine/environment": "^0.1.0",
180
- "@margoengine/geometry": "^0.1.0",
181
- "@margoengine/physics": "^0.1.0",
182
- "@margoengine/splats": "^0.1.0",
183
- "@margoengine/audio": "^0.1.0"
184
- },
185
- "peerDependenciesMeta": {
186
- "@margoengine/clustered": {
187
- "optional": true
188
- },
189
- "@margoengine/environment": {
190
- "optional": true
191
- },
192
- "@margoengine/geometry": {
193
- "optional": true
194
- },
195
- "@margoengine/physics": {
196
- "optional": true
197
- },
198
- "@margoengine/splats": {
199
- "optional": true
200
- },
201
- "@margoengine/audio": {
202
- "optional": true
203
- }
204
- },
205
- "devDependencies": {
206
- "@margoengine/clustered": "^0.1.0",
207
- "@margoengine/environment": "^0.1.0",
208
- "@margoengine/geometry": "^0.1.0",
209
- "@margoengine/physics": "^0.1.0",
210
- "@margoengine/splats": "^0.1.0",
211
- "@margoengine/audio": "^0.1.0"
212
- }
213
- }
1
+ {
2
+ "name": "@margoengine/gltf",
3
+ "version": "1.0.0",
4
+ "description": "glTF 2.0 for Margo Engine: a light static loader at the root, metallic-roughness PBR rendering at @margoengine/gltf/pbr.",
5
+ "keywords": [
6
+ "margoengine",
7
+ "webgpu",
8
+ "3d",
9
+ "gltf",
10
+ "glb",
11
+ "loader",
12
+ "pbr"
13
+ ],
14
+ "homepage": "https://margoengine.com",
15
+ "bugs": {
16
+ "url": "https://github.com/scottcampbelldata/margoengine/issues"
17
+ },
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "git+https://github.com/scottcampbelldata/margoengine.git",
21
+ "directory": "packages/gltf"
22
+ },
23
+ "license": "Apache-2.0",
24
+ "author": "Scott Campbell",
25
+ "type": "module",
26
+ "publishConfig": {
27
+ "access": "public"
28
+ },
29
+ "scripts": {
30
+ "test": "node --test --test-name-pattern=\"glTF loader|GLB,\" ../../tests/modern.test.js && node --test test/*.test.js ../../tests/modern-extensions.test.js ../../tests/modern-gltf*.test.js ../../tests/gltf-draco-limits.test.js ../../tests/deep-render-pbr-resources.test.js ../../examples/package-benchmarks/proofs/package-guard.mjs",
31
+ "prepack": "npm --prefix ../.. run build:packages",
32
+ "test:gpu": "node ../../scripts/test-gltf-browser.mjs",
33
+ "test:shader:browser": "cd ../.. && node packages/gltf/scripts/test-shader-review.js",
34
+ "test:extensions:browser": "cd ../.. && node packages/gltf/scripts/test-extensions-browser.js",
35
+ "test:gpu:materials": "cd ../.. && node scripts/gltf-pbr-materials-gpu-check.js",
36
+ "test:gpu:viewer": "cd ../.. && node scripts/stage-viewer-gpu-check.js && node scripts/stage-viewer-gpu-check.js --compat",
37
+ "test:gpu:native-volume": "cd ../.. && node packages/gltf/scripts/test-native-volume.mjs && node packages/gltf/scripts/test-native-volume.mjs --compat",
38
+ "test:gpu:transmission": "cd ../.. && node packages/gltf/scripts/test-screen-transmission-browser.mjs && node packages/gltf/scripts/test-screen-transmission-browser.mjs --compat",
39
+ "test:gpu:spec-gloss": "cd ../.. && node packages/gltf/scripts/test-spec-gloss-browser.mjs && node packages/gltf/scripts/test-spec-gloss-browser.mjs --compat",
40
+ "test:gpu:colour-space": "cd ../.. && node packages/gltf/scripts/test-extended-colour-space-browser.mjs && node packages/gltf/scripts/test-extended-colour-space-browser.mjs --compat",
41
+ "test:gpu:dds": "cd ../.. && node packages/gltf/scripts/test-dds-browser.mjs && node packages/gltf/scripts/test-dds-browser.mjs --compat",
42
+ "test:gpu:mask-mips": "cd ../.. && node packages/gltf/scripts/test-mask-mips-browser.mjs && node packages/gltf/scripts/test-mask-mips-browser.mjs --compat",
43
+ "test:gpu:mipmaps": "cd ../.. && node packages/gltf/scripts/test-mipmaps-browser.mjs && node packages/gltf/scripts/test-mipmaps-browser.mjs --compat",
44
+ "test:gpu:diffuse-roughness": "cd ../.. && node packages/gltf/scripts/test-diffuse-roughness-browser.mjs && node packages/gltf/scripts/test-diffuse-roughness-browser.mjs --compat",
45
+ "test:gpu:parts": "cd ../.. && node packages/gltf/scripts/test-parts-browser.mjs && node packages/gltf/scripts/test-parts-browser.mjs --compat",
46
+ "test:gpu:skinned-parts": "cd ../.. && node packages/gltf/scripts/test-skinned-parts-browser.mjs && node packages/gltf/scripts/test-skinned-parts-browser.mjs --compat",
47
+ "test:gpu:mask-alpha": "cd ../.. && node packages/gltf/scripts/test-mask-alpha-browser.mjs && node packages/gltf/scripts/test-mask-alpha-browser.mjs --compat",
48
+ "test:gpu:progressive": "cd ../.. && node packages/gltf/scripts/test-progressive-browser.mjs && node packages/gltf/scripts/test-progressive-browser.mjs --compat",
49
+ "test:gpu:base-textures": "cd ../.. && node packages/gltf/scripts/test-base-textures-browser.mjs && node packages/gltf/scripts/test-base-textures-browser.mjs --compat",
50
+ "test:browser:audio": "cd ../.. && node packages/gltf/scripts/test-audio-browser.mjs",
51
+ "test:gpu:pixel-images": "cd ../.. && node packages/gltf/scripts/test-node-images.mjs && node packages/gltf/scripts/test-pixel-images.mjs && node packages/gltf/scripts/test-pixel-images.mjs --compat",
52
+ "test:gpu:compression": "cd ../.. && npm run modern:test:gltf-compression",
53
+ "test:gpu:strokes": "cd ../.. && node packages/gltf/scripts/test-strokes-browser.mjs && node packages/gltf/scripts/test-strokes-browser.mjs --compat",
54
+ "test:gpu:soft-mesh": "cd ../.. && node packages/gltf/scripts/test-soft-mesh-browser.mjs && node packages/gltf/scripts/test-soft-mesh-browser.mjs --compat"
55
+ },
56
+ "sideEffects": false,
57
+ "exports": {
58
+ ".": {
59
+ "types": "./dist/index.d.ts",
60
+ "import": "./dist/index.js"
61
+ },
62
+ "./auto": {
63
+ "types": "./dist/auto.d.ts",
64
+ "import": "./dist/auto.js"
65
+ },
66
+ "./instancing": {
67
+ "types": "./dist/instancing.d.ts",
68
+ "import": "./dist/instancing.js"
69
+ },
70
+ "./meshopt": {
71
+ "types": "./dist/meshopt.d.ts",
72
+ "import": "./dist/meshopt.js"
73
+ },
74
+ "./quantized": {
75
+ "types": "./dist/quantized.d.ts",
76
+ "import": "./dist/quantized.js"
77
+ },
78
+ "./scene-data": {
79
+ "types": "./dist/scene-data.d.ts",
80
+ "import": "./dist/scene-data.js"
81
+ },
82
+ "./textured": {
83
+ "types": "./dist/textured.d.ts",
84
+ "import": "./dist/textured.js"
85
+ },
86
+ "./pbr": {
87
+ "types": "./dist/pbr.d.ts",
88
+ "import": "./dist/pbr.js"
89
+ },
90
+ "./pbr-model": {
91
+ "types": "./dist/model-entry.d.ts",
92
+ "import": "./dist/model-entry.js"
93
+ },
94
+ "./transmission": {
95
+ "types": "./dist/transmission.d.ts",
96
+ "import": "./dist/transmission.js"
97
+ },
98
+ "./asset": {
99
+ "types": "./dist/asset-entry.d.ts",
100
+ "import": "./dist/asset-entry.js"
101
+ },
102
+ "./scene": {
103
+ "types": "./dist/scene.d.ts",
104
+ "import": "./dist/scene.js"
105
+ },
106
+ "./extended-materials": {
107
+ "types": "./dist/extended.d.ts",
108
+ "import": "./dist/extended.js"
109
+ },
110
+ "./pbr-instancing": {
111
+ "types": "./dist/pbr-instancing.d.ts",
112
+ "import": "./dist/pbr-instancing.js"
113
+ },
114
+ "./prepare": {
115
+ "types": "./dist/prepare.d.ts",
116
+ "import": "./dist/prepare.js"
117
+ },
118
+ "./progressive": {
119
+ "types": "./dist/progressive.d.ts",
120
+ "import": "./dist/progressive.js"
121
+ },
122
+ "./splats": {
123
+ "types": "./dist/splats.d.ts",
124
+ "import": "./dist/splats.js"
125
+ },
126
+ "./strokes": {
127
+ "types": "./dist/strokes.d.ts",
128
+ "import": "./dist/strokes.js"
129
+ },
130
+ "./lights": {
131
+ "types": "./dist/lights.d.ts",
132
+ "import": "./dist/lights.js"
133
+ },
134
+ "./physics": {
135
+ "types": "./dist/physics.d.ts",
136
+ "import": "./dist/physics.js"
137
+ },
138
+ "./soft-mesh": {
139
+ "types": "./dist/soft-mesh.d.ts",
140
+ "import": "./dist/soft-mesh.js"
141
+ },
142
+ "./interactivity": {
143
+ "types": "./dist/interactivity.d.ts",
144
+ "import": "./dist/interactivity.js"
145
+ },
146
+ "./report": {
147
+ "types": "./dist/report.d.ts",
148
+ "import": "./dist/report.js"
149
+ },
150
+ "./metadata": {
151
+ "types": "./dist/metadata.d.ts",
152
+ "import": "./dist/metadata.js"
153
+ },
154
+ "./texture-coordinates": {
155
+ "types": "./dist/coordinates.d.ts",
156
+ "import": "./dist/coordinates.js"
157
+ },
158
+ "./worker": {
159
+ "types": "./dist/worker.d.ts",
160
+ "import": "./dist/worker.js"
161
+ },
162
+ "./material-draw": {
163
+ "types": "./dist/material-draw.d.ts",
164
+ "import": "./dist/material-draw.js"
165
+ },
166
+ "./spec-gloss": {
167
+ "types": "./dist/spec-gloss.d.ts",
168
+ "import": "./dist/spec-gloss.js"
169
+ },
170
+ "./dds": {
171
+ "types": "./dist/dds.d.ts",
172
+ "import": "./dist/dds.js"
173
+ },
174
+ "./audio": {
175
+ "types": "./dist/audio.d.ts",
176
+ "import": "./dist/audio.js"
177
+ }
178
+ },
179
+ "files": [
180
+ "dist",
181
+ "NOTICE"
182
+ ],
183
+ "dependencies": {
184
+ "@margoengine/decoders": "^1.0.0",
185
+ "@margoengine/math": "^1.0.0"
186
+ },
187
+ "peerDependencies": {
188
+ "@margoengine/core": "^1.0.0",
189
+ "@margoengine/clustered": "^1.0.0",
190
+ "@margoengine/environment": "^1.0.0",
191
+ "@margoengine/geometry": "^1.0.0",
192
+ "@margoengine/physics": "^1.0.0",
193
+ "@margoengine/splats": "^1.0.0",
194
+ "@margoengine/audio": "^1.0.0",
195
+ "@margoengine/lines": "^1.0.0",
196
+ "@margoengine/points": "^1.0.0"
197
+ },
198
+ "peerDependenciesMeta": {
199
+ "@margoengine/clustered": {
200
+ "optional": true
201
+ },
202
+ "@margoengine/environment": {
203
+ "optional": true
204
+ },
205
+ "@margoengine/geometry": {
206
+ "optional": true
207
+ },
208
+ "@margoengine/physics": {
209
+ "optional": true
210
+ },
211
+ "@margoengine/splats": {
212
+ "optional": true
213
+ },
214
+ "@margoengine/lines": {
215
+ "optional": true
216
+ },
217
+ "@margoengine/points": {
218
+ "optional": true
219
+ },
220
+ "@margoengine/audio": {
221
+ "optional": true
222
+ }
223
+ },
224
+ "devDependencies": {
225
+ "@margoengine/clustered": "^1.0.0",
226
+ "@margoengine/environment": "^1.0.0",
227
+ "@margoengine/geometry": "^1.0.0",
228
+ "@margoengine/physics": "^1.0.0",
229
+ "@margoengine/splats": "^1.0.0",
230
+ "@margoengine/audio": "^1.0.0",
231
+ "@margoengine/lines": "^1.0.0",
232
+ "@margoengine/points": "^1.0.0"
233
+ }
234
+ }
@@ -1 +0,0 @@
1
- import{n as e,t}from"./accessor-DuqjpuxI.js";import{MargoError as n}from"@margoengine/math/errors";var r=(e,t,n=0)=>{if(typeof e!=`number`||!Number.isSafeInteger(e)||e<n)throw TypeError(`Invalid glTF ${t}; the file is not valid glTF 2.0, re-export it and check it with the glTF Validator`);return e},i=(e,t,n)=>{let i=e?.[r(t,n)];if(!i||typeof i!=`object`||Array.isArray(i))throw TypeError(`Missing glTF ${n}; the file is not valid glTF 2.0, re-export it and check it with the glTF Validator`);return i},a=/* @__PURE__ */ new Map([[5120,127],[5121,255],[5122,32767],[5123,65535]]);function o({doc:o,buffers:s},c,l,u,d=!1){let f=i(o.accessors,c,`accessor`);if(f.bufferView===void 0&&!f.sparse){if(!u(f))throw new n(`unsupported`,`Unsupported glTF accessor; use float positions and unsigned integer indices, add @margoengine/gltf/quantized for quantized meshes, or use @margoengine/gltf/pbr`);let e=r(f.count,`accessor count`,1);if(e>1e6)throw new n(`unsupported`,`glTF accessor holds over one million values, the limit of the light loader; use @margoengine/gltf/pbr`);return d?new Uint32Array(e):new Float32Array(e*l)}let p=i(o.bufferViews,f.bufferView,`bufferView`),m=s[r(p.buffer,`buffer reference`)];if(!m||f.sparse||!u(f))throw new n(`unsupported`,`Unsupported glTF accessor; use float positions and unsigned integer indices, add @margoengine/gltf/quantized for quantized meshes, or use @margoengine/gltf/pbr`);let h=t[f.componentType],g=r(f.count,`accessor count`,1),_=r(f.byteOffset??0,`accessor offset`),v=r(p.byteOffset??0,`view offset`),y=r(p.byteLength,`view length`,1),b=r(p.byteStride??h*l,`stride`,h*l);if(g>1e6)throw new n(`unsupported`,`glTF accessor holds over one million values, the limit of the light loader; use @margoengine/gltf/pbr`);if(v+y>m.length||_+(g-1)*b+l*h>y||v%h||_%h||b%h||b>252||d&&p.byteStride!==void 0)throw RangeError(`Invalid glTF accessor bounds/stride; the file is not valid glTF 2.0, re-export it and check it with the glTF Validator`);let x=new DataView(m.buffer,m.byteOffset+v,y),S=d?new Uint32Array(g):new Float32Array(g*l),C=f.normalized?a.get(f.componentType):void 0;for(let t=0;t<g;t++)for(let n=0;n<l;n++){let r=e(x,_+t*b+n*h,f.componentType);S[t*l+n]=C?Math.max(r/C,-1):r}return S}export{r as n,o as r,i as t};
@@ -1,4 +0,0 @@
1
- import{n as e}from"./errors-THVaUwlL.js";import{a as t,c as n,d as r,l as i,o as a,s as o,t as s,u as c}from"./version-BmU1nesQ.js";import{n as l,t as u}from"./limits-_LZ441oV.js";import{n as d,t as f}from"./accessor-DuqjpuxI.js";import"./image-limit-DvFSfR5T.js";var p=262144,m=1024,h=1048576,g=16777216;function _(e=p){if(!Number.isInteger(e)||e<1024||e>1048576)throw RangeError(`maxPartVertices must be an integer from ${m} to ${h} (default ${p})`);return e}function v(e,t,n,r,i){let a=e.length/t,o=1/0,s=1/0,c=1/0,l=-1/0,u=-1/0,d=-1/0;for(let e=0;e<r*i;e+=i){let t=n[e],r=n[e+1],i=n[e+2];t<o&&(o=t),t>l&&(l=t),r<s&&(s=r),r>u&&(u=r),i<c&&(c=i),i>d&&(d=i)}let f=1023.999/(Math.max(l-o,u-s,d-c)||1),p=f,m=f,h=new Uint32Array(a),g=e=>(e=(e|e<<16)&50331903,e=(e|e<<8)&50393103,e=(e|e<<4)&51130563,(e|e<<2)&153391689);for(let r=0,l=0;r<a;r++,l+=t){let a=0,u=0,d=0;for(let r=0;r<t;r++){let t=e[l+r]*i;a+=n[t],u+=n[t+1],d+=n[t+2]}h[r]=(g((a/t-o)*f|0)<<2|g((u/t-s)*p|0)<<1|g((d/t-c)*m|0))>>>0}let _=new Uint32Array(a),v=new Uint32Array(a);for(let e=0;e<a;e++)_[e]=e;let y=/* @__PURE__ */ new Uint32Array(1024);for(let e=0;e<30;e+=10){y.fill(0);for(let t=0;t<a;t++)y[h[t]>>>e&1023]++;for(let e=0,t=0;e<1024;e++){let n=y[e];y[e]=t,t+=n}for(let t=0;t<a;t++){let n=_[t];v[y[h[n]>>>e&1023]++]=n}[_,v]=[v,_]}return _}function y(e,t,n,r,i,a=3){let o=e.length/t,s=i?v(e,t,i,n,a):null,c=new Int32Array(n).fill(-1),l=new Uint32Array(r),u=new Uint32Array(e.length),d=[],f=0,p=0,m=0,h=()=>{d.push({indices:u.slice(p,m),vertexMap:l.slice(0,f)});for(let e=0;e<f;e++)c[l[e]]=-1;f=0,p=m};for(let n=0;n<o;n++){let i=(s?s[n]:n)*t,a=0;for(let n=0;n<t;n++){let t=e[i+n];if(c[t]>=0)continue;let r=!1;for(let a=0;a<n;a++)e[i+a]===t&&(r=!0);r||a++}f+a>r&&h();for(let n=0;n<t;n++){let t=e[i+n];c[t]<0&&(c[t]=f,l[f++]=t),u[m++]=c[t]}}return m>p&&h(),d}function b(e,t,n=!1){let{vertices:r,indices:i,uvs:a}=e,o=r.length/20;if(!(o>t)||!(r instanceof Float32Array)||!(i instanceof Uint32Array)||i.length%3)return[e];if(o>16777216)throw RangeError(`Prepared PBR geometry has more than ${g} vertices; split it into several primitives`);for(let e=0;e<i.length;e++)if(i[e]>=o)throw RangeError(`Invalid prepared PBR geometry; run prepareAsset again`);let s=y(i,3,o,t,n?null:r,20);return s.map(({indices:t,vertexMap:n},i)=>{let o=n.length,c=new Float32Array(o*20),l=a?new Float32Array(o*4):void 0;for(let e=0;e<o;e++)c.set(r.subarray(n[e]*20,n[e]*20+20),e*20),l&&l.set(a.subarray(n[e]*4,n[e]*4+4),e*4);return{...e.interpolatedDirections?{interpolatedDirections:!0}:{},vertices:c,indices:t,...e.topology?{topology:e.topology}:{},...l?{uvs:l}:{},part:{index:i,count:s.length,vertexMap:n}}})}var x=e=>!!e?.extensions&&typeof e.extensions==`object`&&`KHR_gaussian_splatting`in e.extensions,S=e=>!!e.meshes?.some(e=>e?.primitives?.some(x)),C=[`KHR_materials_clearcoat`,`KHR_materials_transmission`,`KHR_materials_ior`,`KHR_materials_dispersion`,`KHR_materials_volume`,`KHR_materials_sheen`,`KHR_materials_specular`,`KHR_materials_iridescence`,`KHR_materials_anisotropy`,`KHR_materials_diffuse_transmission`,`KHR_materials_diffuse_roughness`,`EXT_materials_bump`,`KHR_materials_volume_scatter`];async function ee(e,t={}){return t.dds===void 0&&e.textures?.some(e=>e?.extensions?.MSFT_texture_dds!==void 0)&&(t={...t,dds:(await import(`./dds.js`)).ddsTextures}),t.splats===void 0&&S(e)?t={...t,splats:(await import(`./splats.js`)).gaussianSplats}:t.splats===!1&&(t={...t,splats:void 0}),t.materials===void 0?e.materials?.some(e=>e?.extensions?.KHR_materials_pbrSpecularGlossiness!==void 0)?{...t,materials:(await import(`./spec-gloss.js`)).specGlossMaterials}:(e.materials??[]).some(e=>!!e?.extensions&&typeof e.extensions==`object`&&C.some(t=>t in e.extensions))?{...t,materials:(await import(`./extended.js`)).extendedMaterials}:t:t.materials?t:{...t,materials:void 0}}var w=/* @__PURE__ */ new WeakMap;function T(e){for(let t of e.doc.meshes??[])for(let e of t.primitives??[])if(e.extensions?.KHR_draco_mesh_compression)return!0;return!1}function E(t,n){if(!n.extensions?.KHR_draco_mesh_compression)return;let r=w.get(t)?.get(n);if(!r)throw e(`state`,`Draco geometry requires parseGLTFAsync or loadGLTF`);return r}async function D(e,t){let{decodeImage:n}=await import(
2
- /* @vite-ignore */
3
- /* webpackIgnore: true */
4
- `@margoengine/decoders/image`);return n(e,{signal:t})}var O=e=>!!e.meshes?.some(e=>e?.primitives?.some(e=>e?.extensions?.KHR_draco_mesh_compression))||S(e),te=e=>O(e)||!!e.textures?.some(e=>e?.extensions?.KHR_texture_basisu)||!!e.images?.some(e=>e?.mimeType===`image/ktx2`),k=536870912,A=(e,t)=>/* @__PURE__ */ RangeError(`${e} (${t} bytes; raise the maxDownloadBytes option)`),j=`version https://git-lfs`;function M(t,n){if(!(t.length<23)){for(let e=0;e<23;e++)if(t[e]!==j.charCodeAt(e))return;throw e(`failed`,`${n} is a Git LFS pointer file, not the asset; run git lfs pull and serve the real file; see https://margoengine.com/errors#git-lfs`)}}function N(e=k){if(!Number.isSafeInteger(e)||e<=0)throw RangeError(`maxDownloadBytes must be a positive integer`);return e}var P=/* @__PURE__ */ new Set(/* @__PURE__ */ `KHR_mesh_quantization.KHR_texture_transform.KHR_materials_emissive_strength.KHR_materials_unlit.KHR_lights_punctual.KHR_node_visibility.KHR_materials_clearcoat.KHR_materials_transmission.KHR_materials_ior.KHR_materials_dispersion.KHR_materials_volume.KHR_materials_sheen.KHR_materials_specular.KHR_materials_variants.KHR_node_visibility.EXT_texture_webp.EXT_texture_avif.EXT_mesh_gpu_instancing.VRMC_materials_mtoon.VRMC_node_constraint.EXT_lights_ies.EXT_lights_image_based.KHR_physics_rigid_bodies.KHR_audio_emitter.MSFT_audio_emitter.KHR_interactivity.KHR_node_selectability.KHR_node_hoverability.KHR_implicit_shapes.KHR_xmp_json_ld.KHR_animation_pointer`.split(`.`)),F={KHR_draco_mesh_compression:`draco`,EXT_meshopt_compression:`meshopt`,KHR_meshopt_compression:`meshopt`,KHR_texture_basisu:`ktx2`,MSFT_texture_dds:`dds`,KHR_materials_iridescence:`materials`,KHR_materials_anisotropy:`materials`,KHR_materials_diffuse_transmission:`materials`,KHR_materials_diffuse_roughness:`materials`,EXT_materials_bump:`materials`,KHR_materials_volume_scatter:`materials`,KHR_gaussian_splatting:`splats`,KHR_gaussian_splatting_compression_spz_2:`splats`},I,L=[`EXT_meshopt_compression`,`KHR_meshopt_compression`],R=e=>{let t=e?.extensions;if(t?.EXT_meshopt_compression!==void 0&&t?.KHR_meshopt_compression!==void 0)throw TypeError(`Invalid glTF meshopt extensions; use only EXT or KHR on each buffer or bufferView`);return t?.EXT_meshopt_compression??t?.KHR_meshopt_compression};function z(e,t,n=0){if(typeof e!=`number`||!Number.isSafeInteger(e)||e<n)throw TypeError(`Invalid glTF `+t+`; re-export the file and check it with the glTF Validator`);return e}function B(e,t,n){let r=e?.[z(t,n)];if(!r||typeof r!=`object`||Array.isArray(r))throw TypeError(`Missing glTF `+n+`; re-export the file and check it with the glTF Validator`);return r}function V(e){try{return new TextDecoder(`utf-8`,{fatal:!0}).decode(e)}catch{throw TypeError(`Invalid glTF JSON: not UTF-8; the file is not valid glTF 2.0, re-export it and check it with the glTF Validator`)}}function H(e){let t=typeof e==`string`?e:V(e);for(let e=0,n=0,r=!1;e<t.length;e++){let i=t.charCodeAt(e);if(r)i===92?e++:i===34&&(r=!1);else if(i===34)r=!0;else if(i===91||i===123){if(++n>256)throw TypeError(`Invalid glTF JSON: nested deeper than 256 levels; the file is not valid glTF 2.0, re-export it and check it with the glTF Validator`)}else(i===93||i===125)&&n--}try{return c(t)}catch(e){throw e instanceof SyntaxError?/* @__PURE__ */ TypeError(`Invalid glTF JSON: `+e.message):e}}var U=[`buffers`,`bufferViews`,`accessors`,`meshes`,`nodes`,`scenes`,`materials`,`textures`,`images`];U.push(`samplers`,`skins`,`animations`,`cameras`);var W=e=>e===void 0||Array.isArray(e)&&e.every(e=>!!e&&typeof e==`object`&&!Array.isArray(e));function G(e){if(!e||typeof e!=`object`||!s(e.asset))throw TypeError(`Expected glTF 2.0`);let t=e;for(let e of U)if(!W(t[e]))throw TypeError(`Invalid glTF `+e+`; re-export the file and check it with the glTF Validator`);for(let t of e.meshes??[])if(!W(t.primitives)||!(t.primitives??[]).every(e=>W(e.targets)))throw TypeError(`Invalid glTF primitives; the file is not valid glTF 2.0, re-export it and check it with the glTF Validator`);for(let t of e.animations??[])if(!W(t.samplers)||!W(t.channels))throw TypeError(`Invalid glTF animation; the file is not valid glTF 2.0, re-export it and check it with the glTF Validator`);for(let e of[`extensionsRequired`,`extensionsUsed`])if(t[e]!==void 0&&!Array.isArray(t[e]))throw TypeError(`Invalid glTF `+e+`; re-export the file and check it with the glTF Validator`)}function K(e,t=k){if(typeof e==`string`){if(e.length>t)throw A(`glTF JSON exceeds byte budget`,t);let n=new TextEncoder().encode(e).byteLength;if(n>t)throw A(`glTF JSON exceeds byte budget`,t);return{doc:H(e),sourceBytes:n}}if(!(e instanceof ArrayBuffer)&&!ArrayBuffer.isView(e))return{doc:e,sourceBytes:0};let n=e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength);if(M(n,`The glTF input`),n.length>=4&&!o(n)){if(n.length>t)throw A(`glTF JSON exceeds byte budget`,t);return{...K(V(n),t),sourceBytes:n.byteLength}}if(n.length>t)throw A(`glTF exceeds download budget`,t);let r=a(n);return{doc:H(r[0].data),binary:r[1]?.type===5130562?r[1].data:void 0,sourceBytes:n.byteLength}}function q(e,t=k){let n=/^data:[^;,]+;base64,([A-Za-z0-9+/]*={0,2})$/.exec(e);if(n&&n[1].length>t*4/3+4)throw A(`glTF exceeds download budget`,t);if(!n)throw TypeError(`Invalid glTF data URI; the file is not valid glTF 2.0, re-export it and check it with the glTF Validator`);let r;try{r=atob(n[1])}catch{throw TypeError(`Invalid glTF data URI; the file is not valid glTF 2.0, re-export it and check it with the glTF Validator`)}return Uint8Array.from(r,e=>e.charCodeAt(0))}var J={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT4:16},ne=`EXT_meshopt_compression`,Y=`KHR_draco_mesh_compression`,X=`KHR_texture_basisu`;function Z(e,t=!1){let n=e.extensions,r=n?.[X]!==void 0||!t||n?.MSFT_texture_dds===void 0?X:`MSFT_texture_dds`,i=n?.[r];if(i!==void 0&&(!i||typeof i!=`object`||Array.isArray(i)))throw TypeError(`Invalid glTF ${r}; the file is not valid glTF 2.0, re-export it and check it with the glTF Validator`);return z(i===void 0?e.source:i.source,`image source`)}function re(e,t,n){let r=z(t,`accessor`),i=B(e.accessors,r,`accessor`);if(n&&i.type!==n)throw TypeError(`Invalid glTF accessor type; the file is not valid glTF 2.0, re-export it and check it with the glTF Validator`);let a=typeof i.componentType==`number`?f[i.componentType]:void 0,o=typeof i.type==`string`&&Object.hasOwn(J,i.type)?J[i.type]:void 0,s=z(i.count,`accessor count`,1);if(!a||!o||i.normalized!==void 0&&typeof i.normalized!=`boolean`||i.normalized&&[5125,5126].includes(i.componentType))throw TypeError(`Unsupported glTF accessor ${r} (componentType ${i.componentType}, type ${i.type}${i.normalized?`, normalized`:``}); re-export the model without it, or convert the texture format`);return{index:r,def:i,size:a,width:o,count:s}}var ie={5120:127,5121:255,5122:32767,5123:65535},ae=class{get remainingDecodedBytes(){return this.maxBytes*4-this.decoded}reserveDecodedBytes(e){if(z(e,`decoded byte length`),this.decoded+e>this.maxBytes*4)throw RangeError(`Decoded glTF exceeds byte budget; load a smaller model, or reduce its textures and meshes`);this.decoded+=e}constructor(n,r,i,a={},o=k,s=1e5){this.doc=n,this.hooks=a,this.maxBytes=o,this.maxNodes=s,this.cache=/* @__PURE__ */ new Map,this.viewCache=/* @__PURE__ */ new Map,this.decoded=0,this.partVertices=p,N(o),l(`maxNodes`,s),G(n);let c=(n.extensionsRequired??[]).filter(e=>!P.has(e)&&![Y,ne,`KHR_meshopt_compression`,X].includes(e)&&!a[F[e]]&&!(a.materials&&a.materials.extensions?.includes(e)));if(c.length)throw e(`unsupported`,`Required glTF extensions are unsupported: `+c.map(e=>F[e]?e+` (pass a `+F[e]+` decoder)`:e).join(`, `)+`; pass the listed decoders or re-export the model without them`);u(`Too many glTF nodes`,n.nodes?.length??0,s,`maxNodes`);let d=0;this.buffers=(n.buffers??[]).map((e,a)=>{if(!e||typeof e!=`object`||Array.isArray(e))throw TypeError(`Invalid glTF buffer; the file is not valid glTF 2.0, re-export it and check it with the glTF Validator`);let s=z(e.byteLength,`buffer length`,1),c=R(e)?.fallback;if(c!==void 0&&typeof c!=`boolean`)throw TypeError(`Invalid glTF meshopt fallback; the file is not valid glTF 2.0, re-export it and check it with the glTF Validator`);let l=r[a],u=(!l||l.byteLength===0)&&!e.uri&&(a!==0||!i);if(c===!0||u&&L.some(e=>n.extensionsRequired?.includes(e))){let t=L.find(t=>e.extensions?.[t]!==void 0),r=(n.bufferViews??[]).filter(e=>e?.buffer===a);if(!r.length||r.some(e=>!R(e)||t!==void 0&&!e.extensions?.[t])||n.bufferViews?.some(e=>R(e)?.buffer===a))throw TypeError(`Invalid glTF meshopt fallback references; the file is not valid glTF 2.0, re-export it and check it with the glTF Validator`);return/* @__PURE__ */ new Uint8Array}let f=l?l instanceof ArrayBuffer?new Uint8Array(l):new Uint8Array(l.buffer,l.byteOffset,l.byteLength):e.uri?q(e.uri,o):a===0?i:void 0;if(!f||s>f.length)throw RangeError(`Truncated glTF buffer; download the file again, it is incomplete`);if(a===0&&i&&(l===i||f===i)&&t(i.length,s),d+=f.byteLength,d>o)throw A(`glTF buffers exceed byte budget`,o);return f.subarray(0,s)})}view(t){let n=z(t,`bufferView`),r=B(this.doc.bufferViews,n,`bufferView`),i=z(r.buffer,`buffer reference`),a=this.buffers[i],o=z(r.byteOffset??0,`view offset`),s=z(r.byteLength,`view length`,1),c=z(B(this.doc.buffers,i,`buffer`).byteLength,`buffer length`,1);if(s>c||o>c-s)throw RangeError(`Invalid glTF bufferView bounds; the file is not valid glTF 2.0, re-export it and check it with the glTF Validator`);let l=R(r);if(l!==void 0){let t=this.viewCache.get(n);if(t)return t;if(!l||typeof l!=`object`||Array.isArray(l))throw TypeError(`Invalid glTF meshopt extension; the file is not valid glTF 2.0, re-export it and check it with the glTF Validator`);let i=this.buffers[z(l.buffer,`meshopt buffer reference`)],a=z(l.byteOffset??0,`meshopt offset`),o=z(l.byteLength,`meshopt length`,1),c=z(l.count,`meshopt count`,1),u=z(l.byteStride,`meshopt stride`,1),d=l.mode,f=l.filter??`NONE`;if(!i||o>i.length||a>i.length-o)throw RangeError(`Invalid glTF meshopt source bounds; the file is not valid glTF 2.0, re-export it and check it with the glTF Validator`);if(!Number.isSafeInteger(c*u)||c*u!==s||r.byteStride!==void 0&&r.byteStride!==u)throw RangeError(`Invalid glTF meshopt decoded layout; the file is not valid glTF 2.0, re-export it and check it with the glTF Validator`);if(d===`ATTRIBUTES`?u>256||u%4!=0:![`TRIANGLES`,`INDICES`].includes(d)||![2,4].includes(u)||d===`TRIANGLES`&&c%3!=0)throw TypeError(`Invalid glTF meshopt mode/stride/count; the file is not valid glTF 2.0, re-export it and check it with the glTF Validator`);if(![`NONE`,`OCTAHEDRAL`,`QUATERNION`,`EXPONENTIAL`,`COLOR`].includes(f)||f!==`NONE`&&d!==`ATTRIBUTES`||[`OCTAHEDRAL`,`COLOR`].includes(f)&&![4,8].includes(u)||f===`QUATERNION`&&u!==8||f===`EXPONENTIAL`&&u%4!=0)throw TypeError(`Invalid glTF meshopt filter; the file is not valid glTF 2.0, re-export it and check it with the glTF Validator`);if(this.decoded+s>this.maxBytes*4)throw RangeError(`Decoded glTF exceeds byte budget; load a smaller model, or reduce its textures and meshes`);let p=i.subarray(a,a+o),m;if(this.hooks.meshopt)m=new Uint8Array(s),this.hooks.meshopt.decodeGltfBuffer(m,c,u,p,d,f);else{if(!I)throw e(`state`,`Meshopt geometry requires parseGLTFAsync or loadGLTF, or a meshopt decoder passed in decoders (or asset.decode() first)`);m=I(p,c,u,d,f)}return this.reserveDecodedBytes(m.byteLength),this.viewCache.set(n,m),m}if(!a||o+s>a.length)throw RangeError(`Invalid glTF bufferView bounds; the file is not valid glTF 2.0, re-export it and check it with the glTF Validator`);return a.subarray(o,o+s)}setDecodedAccessor(e,t){let{index:n,width:r,count:i}=re(this.doc,e);if(!(t instanceof Float32Array)||t.length!==i*r)throw RangeError(`Mismatched decoded glTF accessor; the file holds invalid numbers, re-export it and check it with the glTF Validator`);if(t.some(e=>!Number.isFinite(e)))throw RangeError(`Non-finite decoded glTF accessor; the file holds invalid numbers, re-export it and check it with the glTF Validator`);let a=this.cache.get(n);if(a){if(a!==t&&a.some((e,n)=>e!==t[n]))throw TypeError(`Conflicting decoded glTF accessor; the file holds invalid numbers, re-export it and check it with the glTF Validator`)}else this.reserveDecodedBytes(t.byteLength),this.cache.set(n,t)}async prepareMeshopt(){I||this.hooks.meshopt||this.doc.bufferViews?.some(e=>e?.extensions?.EXT_meshopt_compression||e?.extensions?.KHR_meshopt_compression)&&(I=(await import(`@margoengine/decoders/meshopt`)).meshoptDecodeGltfBuffer)}async decode(e){if(await this.prepareMeshopt(),!T(this))return e?.throwIfAborted();let{decompressPrimitives:t}=await import(`./compression-D4IkO5vE.js`),n=this.hooks.draco,r=n?{decode:async(e,t)=>{let r=await n.decode(e,t),i=r.vertexCount??r.positions?.length/3,a=r.attributes&&Object.fromEntries(Object.entries(r.attributes).map(([e,n])=>{let r=n;return[e,{...r,itemSize:r.itemSize??r.array.length/i,componentType:r.componentType??t.componentTypes[e]}]}));return{...r,vertexCount:i,attributes:a,indices:r.indices??(Number.isSafeInteger(i)&&i>=3&&i<=16777216?Uint32Array.from({length:i},(e,t)=>t):void 0)}}}:void 0;await t(this,{signal:e,draco:r})}accessor(t,n,r=!0){let{index:i,def:a,size:o,width:s,count:c}=re(this.doc,t,n),l=this.cache.get(i);if(l)return l;this.reserveDecodedBytes(c*s*4);let u=new Float32Array(c*s),p=(e,t,n,i,c)=>{if(t%o||n%o||t+(i-1)*n+s*o>e.length)throw RangeError(`Invalid glTF accessor bounds/alignment; the file is not valid glTF 2.0, re-export it and check it with the glTF Validator`);let l=new DataView(e.buffer,e.byteOffset,e.byteLength),f=a.componentType,p=a.normalized?ie[f]??1:0;for(let e=0;e<i;e++){let i=(c?c[e]:e)*s;for(let a=0,c=t+e*n;a<s;a++,c+=o){let e=d(l,c,f);if(p&&(e=Math.max(-1,e/p)),r&&!Number.isFinite(Math.fround(e)))throw RangeError(`Non-finite glTF accessor; the file holds invalid numbers, re-export it and check it with the glTF Validator`);u[i+a]=e}}};if(a.bufferView!==void 0){let e=B(this.doc.bufferViews,a.bufferView,`bufferView`),t=z(e.byteStride??o*s,`stride`,o*s);if(t>252||z(e.byteOffset??0,`view offset`)%o)throw RangeError(`Invalid glTF stride/alignment; the file is not valid glTF 2.0, re-export it and check it with the glTF Validator`);p(this.view(a.bufferView),z(a.byteOffset??0,`accessor offset`),t,c)}else{if(this.doc.meshes?.some(e=>e?.primitives?.some(e=>e?.extensions?.[Y]&&(e.indices===i||Object.keys(e.extensions[Y].attributes??{}).some(t=>e.attributes?.[t]===i)))))throw e(`state`,`Draco geometry requires parseGLTFAsync or loadGLTF`);if(a.byteOffset)throw TypeError(`Accessor has no data or invalid offset; the file is not valid glTF 2.0, re-export it and check it with the glTF Validator`)}if(a.sparse){let e=a.sparse,t=z(e.count,`sparse count`,1),n=e.indices,r=e.values,i=f[n?.componentType];if(t>c||![5121,5123,5125].includes(n?.componentType))throw TypeError(`Invalid glTF sparse indices; the file is not valid glTF 2.0, re-export it and check it with the glTF Validator`);let l=this.view(n.bufferView),u=z(n.byteOffset??0,`sparse offset`);if(u%i||u+t*i>l.length||B(this.doc.bufferViews,n.bufferView,`sparse indices`).byteStride!==void 0||B(this.doc.bufferViews,r?.bufferView,`sparse values`).byteStride!==void 0)throw RangeError(`Invalid sparse bounds/stride; the file is not valid glTF 2.0, re-export it and check it with the glTF Validator`);let d=new DataView(l.buffer,l.byteOffset,l.byteLength),m=[],h=-1;for(let e=0;e<t;e++){let t=u+e*i,n=i===1?d.getUint8(t):i===2?d.getUint16(t,!0):d.getUint32(t,!0);if(n<=h||n>=c)throw RangeError(`Invalid sparse index order/bounds; the file is not valid glTF 2.0, re-export it and check it with the glTF Validator`);m.push(n),h=n}p(this.view(r.bufferView),z(r.byteOffset??0,`sparse values offset`),o*s,t,m)}return r&&this.cache.set(i,u),u}};function oe(e){let t=/* @__PURE__ */ new Set;for(let n of e.textures??[])if(n?.extensions?.[X]!==void 0){let r=Z(n),i=B(e.images,r,`KTX2 image`);if(i.mimeType!==void 0&&i.mimeType!==`image/ktx2`||i.bufferView!==void 0&&i.mimeType!==`image/ktx2`)throw TypeError(`KHR_texture_basisu requires image/ktx2`);t.add(r)}for(let n=0;n<(e.images?.length??0);n++)e.images[n]?.mimeType===`image/ktx2`&&t.add(n);return t}function se(e,t=!1){let n=/* @__PURE__ */ new Set,r=/* @__PURE__ */ new Set;for(let i of e.textures??[])i?.extensions?.[X]!==void 0||t&&i?.extensions?.MSFT_texture_dds!==void 0?(r.add(Z(i,t)),Number.isSafeInteger(i.source)&&i.source>=0&&n.add(i.source)):(Number.isSafeInteger(i?.source)&&i.source>=0&&r.add(i.source),!t&&i?.extensions?.MSFT_texture_dds&&n.add(z(i.extensions.MSFT_texture_dds.source,`DDS image`)));for(let e of r)n.delete(e);return n}function ce(e,t,n){if(e.length<80||[171,75,84,88,32,50,48,187,13,10,26,10].some((t,n)=>e[n]!==t))throw TypeError(`Invalid glTF KTX2 header; the file is not valid glTF 2.0, re-export it and check it with the glTF Validator`);let r=new DataView(e.buffer,e.byteOffset,e.byteLength),i=r.getUint32(20,!0),a=r.getUint32(24,!0),o=r.getUint32(40,!0);if(!i||!a||i%4||a%4||i*a>67108864||i>(n?.limits.maxTextureDimension2D??16384)||a>(n?.limits.maxTextureDimension2D??16384)||r.getUint32(28,!0)||r.getUint32(32,!0)||r.getUint32(36,!0)!==1||!o||o>Math.floor(Math.log2(Math.max(i,a)))+1)throw RangeError(`Invalid glTF KTX2 dimensions or mip levels; the file is not valid glTF 2.0, re-export it and check it with the glTF Validator`);let s=0;for(let e=0;e<o;e++)s+=Math.max(1,i>>e)*Math.max(1,a>>e)*4;if(s>t.remainingDecodedBytes)throw RangeError(`glTF KTX2 exceeds decoded byte budget; load a smaller model, or reduce its textures and meshes`);return{width:i,height:a,levels:o}}function le(e,t,n){let r={rgba8:[`rgba8unorm`,1,4],bc7:[`bc7-rgba-unorm`,4,16],"astc-4x4":[`astc-4x4-unorm`,4,16],etc2:[`etc2-rgba8unorm`,4,16]},i=e&&Object.hasOwn(r,e.target)?r[e.target]:void 0,a=typeof e?.format==`string`?e.format.replace(/-srgb$/,``):void 0;if(!i||a!==i[0]||e.width!==t.width||e.height!==t.height||!Array.isArray(e.mipmaps)||e.mipmaps.length!==t.levels||typeof e.srgb!=`boolean`||typeof e.hasAlpha!=`boolean`)throw TypeError(`Invalid transcoded glTF KTX2 image; the file is not valid glTF 2.0, re-export it and check it with the glTF Validator`);let o=0;for(let n=0;n<e.mipmaps.length;n++){let r=e.mipmaps[n],a=Math.max(1,t.width>>n),s=Math.max(1,t.height>>n),c=Math.ceil(a/i[1])*Math.ceil(s/i[1])*i[2];if(!r||r.width!==a||r.height!==s||!(r.data instanceof Uint8Array)||r.data.byteLength!==c||r.byteLength!==c)throw RangeError(`Invalid transcoded glTF KTX2 mip; the file is not valid glTF 2.0, re-export it and check it with the glTF Validator`);o+=c}return n.reserveDecodedBytes(o),{ktx2:e,width:e.width,height:e.height,close(){}}}function ue(t,n){let r=t.hooks.decoderModule;if(!r)throw e(`unsupported`,n===`Draco`?`This file needs the Draco decoder; load it with loadGLTF from @margoengine/gltf/pbr, or pass decoders.decoderModule`:`This file needs the KTX2 decoder; load it with loadGLTF from @margoengine/gltf/pbr, or pass decoders.decoderModule`);return r}function de(e,t){let n=t.ktx2,r;return{async decode(i){t.signal?.throwIfAborted();let a=ce(i,e,t.device);if(!n){let{KTX2Decoder:i}=await ue(e,`KTX2`)();t.signal?.throwIfAborted(),n=r=new i({device:t.device})}let o=await n.transcode(i,{signal:t.signal});return t.signal?.throwIfAborted(),le(o,a,e)},close(){r?.dispose()}}}async function fe(t,n=[],r={}){r.signal?.throwIfAborted();let i=oe(t.doc),a=/* @__PURE__ */ new Set;if(t.hooks.dds)for(let e of t.doc.textures??[])!e.extensions?.KHR_texture_basisu&&e.extensions?.MSFT_texture_dds!==void 0&&a.add(Z(e,!0));if(!i.size&&!a.size)return n;let o=n.slice(),s=de(t,r);try{for(let n of a){if(r.signal?.throwIfAborted(),o[n])continue;let i=B(t.doc.images,n,`DDS image`);if(i.mimeType!==void 0&&i.mimeType!==`image/vnd-ms.dds`||i.bufferView!==void 0&&i.mimeType!==`image/vnd-ms.dds`)throw TypeError(`MSFT_texture_dds requires image/vnd-ms.dds`);let a=i.bufferView===void 0?typeof i.uri==`string`&&i.uri.startsWith(`data:`)?q(i.uri,t.maxBytes):void 0:t.view(i.bufferView);if(!a)throw e(`state`,`External DDS images require loadGLTF`);o[n]=t.hooks.dds.decode(a,r)}for(let n of i){if(o[n]){if(!(`ktx2`in o[n]))throw TypeError(`KHR_texture_basisu requires decoded KTX2 images`);continue}let r=B(t.doc.images,n,`KTX2 image`),i=r.bufferView===void 0?typeof r.uri==`string`&&r.uri.startsWith(`data:`)?q(r.uri,t.maxBytes):void 0:t.view(r.bufferView);if(!i)throw e(`state`,`External KTX2 images require loadGLTF`);o[n]=await s.decode(i)}return o}finally{s.close()}}async function pe(){let{optimizeOverdraw:e,optimizeVertexCache:t}=await import(`./optimize-7SEzNA23.js`);return(n,r,i)=>e(t(n,i),r)}async function me(t,a={},o,s={},c=!1,l=0){let u=`aborted`in a?{signal:a}:a,{signal:d,decoders:f={},buffers:p=[],fetch:m=globalThis.fetch,maxDownloadBytes:h,maxNodes:g,optimize:v,allowedURLs:y,maxPartVertices:b}=u,x=typeof o==`function`?o:void 0,S=typeof o==`function`?void 0:o,C=N(h),w=_(b);d?.throwIfAborted();let T=t===void 0?u.baseURL===void 0?void 0:new URL(u.baseURL,globalThis.location?.href):new URL(t,globalThis.location?.href),E=l,D=async(e,t=!1)=>{if(![`http:`,`https:`].includes(e.protocol))throw TypeError(`glTF URL must use HTTP(S)`);let n=await m(e,{signal:d});t&&n.url?T=new URL(n.url):t||i(n,T??globalThis.location?.href,y,`glTF resource`);let a=await r(n,{maxBytes:C-E,signal:d,label:`glTF download`}).catch(e=>{throw e instanceof RangeError?A(e.message,C):e});return M(a,e.href),E+=a.length,a},O=r=>{if(T===void 0&&t===void 0)throw e(`state`,`glTF URI ${r} needs the file location, which a file in memory does not have; pass the baseURL option to parseGLTFAsync or load the file with loadGLTF`);return n(r,T??globalThis.location?.href,y,`glTF resource`)},{doc:k,binary:j,sourceBytes:P}=K(S??await D(T,!0),C),F=[],I=[];if(S!=null){if(P>C-E)throw A(`glTF exceeds download budget`,C);E+=P}G(k);for(let e=0;e<(k.buffers?.length??0);e++){let t=B(k.buffers,e,`buffer`);if(p[e]){let t=p[e];F[e]=t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}else if(R(t)?.fallback!==!0){if(!t.uri)e===0&&j&&(F[e]=j);else if(typeof t.uri!=`string`)throw TypeError(`Invalid glTF buffer uri; the file is not valid glTF 2.0, re-export it and check it with the glTF Validator`);else if(t.uri.startsWith(`data:`)){let n=q(t.uri,C);if(E+=n.length,E>C)throw A(`glTF exceeds download budget`,C);F[e]=n}else F[e]=await D(O(t.uri))}}let L=new ae(k,F,j,await ee(k,f),C,g),z=L.hooks;if(L.baseURL=T?.href,L.partVertices=w,v&&(L.reorder=await pe()),c&&te(k))return{asset:L,images:I,deferred:!0,baseURL:T?.href,downloadedBytes:E};let V=oe(k),H=se(k,!!z.dds),U=de(L,{...s,ktx2:s.ktx2??z.ktx2,signal:d}),W=0;await L.decode(d);try{d?.throwIfAborted(),await x?.(L),d?.throwIfAborted();let e=[],t=async()=>{let[t,n]=e.shift(),r=await n;if(I[t]=r,W+=r.width*r.height*4,r.width*r.height>67108864||W>C*4)throw RangeError(`glTF images exceed decoded size limit; load a smaller model, or reduce its textures and meshes`);d?.throwIfAborted()};try{for(let n=0;n<(k.images?.length??0);n++){if(H.has(n))continue;let r=B(k.images,n,`image`);if(V.has(n)&&z.textureStream){I[n]=await z.textureStream.open(r.bufferView===void 0?typeof r.uri==`string`&&r.uri.startsWith(`data:`)?{bytes:q(r.uri,C)}:{url:O(r.uri).href}:{bytes:L.view(r.bufferView)},n);continue}let i;if(r.bufferView!==void 0)i=L.view(r.bufferView);else if(typeof r.uri==`string`&&r.uri.startsWith(`data:`)){if(i=q(r.uri,C),E+=i.length,E>C)throw A(`glTF exceeds download budget`,C)}else if(typeof r.uri==`string`)i=await D(O(r.uri));else throw TypeError(`Invalid glTF image; the file is not valid glTF 2.0, re-export it and check it with the glTF Validator`);if(z.dds&&k.textures?.some(e=>!e.extensions?.KHR_texture_basisu&&e.extensions?.MSFT_texture_dds?.source===n)){if(r.mimeType!==void 0&&r.mimeType!==`image/vnd-ms.dds`||r.bufferView!==void 0&&r.mimeType!==`image/vnd-ms.dds`)throw TypeError(`MSFT_texture_dds requires image/vnd-ms.dds`);for(;e.length;)await t();e.push([n,Promise.resolve(z.dds.decode(i,{signal:d}))]),await t()}else if(V.has(n)){for(;e.length;)await t();e.push([n,U.decode(i)]),await t()}else{let a=ge(i,r.mimeType,n,d);a.catch(()=>{}),e.push([n,a]),e.length>=he&&await t()}}for(;e.length;)await t()}finally{for(let[,t]of e.splice(0))t.then(e=>$([e]),()=>{})}return{asset:L,images:I}}catch(e){throw $(I),e}finally{U.close()}}var he=8;async function ge(e,t,n,r){r?.throwIfAborted();try{if(typeof createImageBitmap!=`function`)return await D(e,r);let n=e.buffer instanceof ArrayBuffer?e:new Uint8Array(e);return await createImageBitmap(new Blob([n],{type:t}),{colorSpaceConversion:`none`,premultiplyAlpha:`none`})}catch(e){throw r?.throwIfAborted(),TypeError(`glTF image ${n} could not be decoded (${e instanceof Error?e.message:e}); check the file`)}}var Q=/* @__PURE__ */ new WeakMap;function _e(e){for(let t of e)t&&Q.set(t,(Q.get(t)??0)+1)}function $(e){for(let t of e){if(!t)continue;let e=Q.get(t);e?Q.set(t,e-1):`close`in t&&t.close?.()}}export{_ as A,E as C,x as D,ee as E,b as M,p as O,se as S,T,A as _,G as a,_e as b,K as c,ue as d,N as f,me as g,z as h,O as i,y as j,g as k,ge as l,B as m,k as n,$ as o,q as p,te as r,J as s,ae as t,fe as u,H as v,w,pe as x,M as y};
@@ -1 +0,0 @@
1
- import{n as e}from"./errors-THVaUwlL.js";import{d as t,h as n,k as r,m as i,w as a}from"./asset-1b8ejkZX.js";var o=3*r,s={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT4:16},c={POSITION:`positions`,NORMAL:`normals`,TEXCOORD_0:`uvs`,COLOR_0:`colors`},l={5120:127,5121:255,5122:32767,5123:65535};async function u(u,{signal:d,draco:f}={}){d?.throwIfAborted();let p,m=a.get(u)??/* @__PURE__ */ new Map;a.set(u,m);try{for(let a of u.doc.meshes??[])for(let h of a.primitives??[]){let a=h.extensions?.KHR_draco_mesh_compression;if(!a||m.has(h))continue;if((h.mode??4)!==4)throw e(`unsupported`,`PBR requires triangle primitives; re-export the mesh with mode 4 (TRIANGLES)`);if(!a.attributes||typeof a.attributes!=`object`||Array.isArray(a.attributes))throw TypeError(`Invalid glTF Draco attributes; the file is not valid glTF 2.0, re-export it and check it with the glTF Validator`);let g={},_={},v={},y=i(u.doc.accessors,h.attributes?.POSITION,`Draco POSITION`),b=n(y.count,`Draco vertex count`,3);if(b>16777216)throw e(`unsupported`,`glTF primitive has more than ${r} vertices, the most one primitive may hold; split the mesh into several primitives`);if(y.type!==`VEC3`)throw RangeError(`Invalid glTF Draco POSITION size; the file is not valid glTF 2.0, re-export it and check it with the glTF Validator`);let x=0;for(let[e,t]of Object.entries(a.attributes)){let r=i(u.doc.accessors,h.attributes?.[e],`Draco attribute`),a=n(r.count,`Draco accessor count`,1),o=Object.hasOwn(s,r.type)?s[r.type]:void 0;if(!o||a!==b)throw RangeError(`Invalid glTF Draco accessor size; the file is not valid glTF 2.0, re-export it and check it with the glTF Validator`);x+=a*o*4,g[e]=n(r.componentType,`Draco component type`),_[e]=n(t,`Draco attribute id`),v[e]=o}let S=h.indices===void 0?void 0:i(u.doc.accessors,h.indices,`Draco indices`);if(S){if(S.type!==`SCALAR`||![5121,5123,5125].includes(S.componentType)||S.normalized)throw TypeError(`Invalid glTF Draco indices; the file is not valid glTF 2.0, re-export it and check it with the glTF Validator`);let e=n(S.count,`Draco index count`,1);if(e>o||e%3)throw RangeError(`Invalid glTF Draco index count; the file is not valid glTF 2.0, re-export it and check it with the glTF Validator`);x+=e*4}if(x>u.maxBytes*4)throw RangeError(`Decoded glTF exceeds byte budget; load a smaller model, or reduce its textures and meshes`);let C=u.view(a.bufferView);if(x>u.remainingDecodedBytes)throw RangeError(`Decoded glTF exceeds byte budget; load a smaller model, or reduce its textures and meshes`);let w=S?S.count:Math.min(o,Math.floor((u.remainingDecodedBytes-x)/4));if(w<3)throw RangeError(`Decoded glTF exceeds index byte budget; load a smaller model, or reduce its textures and meshes`);if(!f){let{DracoDecoder:e}=await t(u,`Draco`)();d?.throwIfAborted(),f=p=new e}let T=await f.decode(C,{attributeIds:_,componentTypes:g,signal:d,limits:{maxVertices:b,maxIndices:w,maxDecodedBytes:u.remainingDecodedBytes,attributeWidths:v}});d?.throwIfAborted();let E=n(T.vertexCount,`Draco vertex count`,3),D=T.indices;if(E>16777216||!(D instanceof Uint16Array||D instanceof Uint32Array)||!D.length||D.length>o||D.length%3||D.some(e=>e>=E)||S&&D.length!==S.count)throw RangeError(`Invalid glTF Draco triangle indices; the file is not valid glTF 2.0, re-export it and check it with the glTF Validator`);for(let e of Object.keys(_)){let t=h.attributes[e],n=i(u.doc.accessors,t,`Draco attribute`),r=Object.hasOwn(c,e)?c[e]:void 0,a=T.attributes?.[e],o=r?T[r]:a?.array;if(!ArrayBuffer.isView(o)||o instanceof DataView||n.count!==E||o.length!==E*s[n.type]||!r&&(a?.itemSize!==s[n.type]||a.componentType!==n.componentType))throw RangeError(`Mismatched glTF Draco attribute `+e+`; the accessor must match the Draco stream, re-export the model`);let d=Float32Array.from(o);if(n.normalized&&e!==`COLOR_0`){let e=l[n.componentType];if(!e)throw TypeError(`Invalid normalized Draco attribute; the file is not valid glTF 2.0, re-export it and check it with the glTF Validator`);for(let t=0;t<d.length;t++)d[t]=Math.max(-1,d[t]/e)}u.setDecodedAccessor(t,d)}h.indices===void 0&&u.reserveDecodedBytes(D.length*4);let O=Float32Array.from(D);h.indices!==void 0&&u.setDecodedAccessor(h.indices,O),m.set(h,h.indices===void 0?O:u.accessor(h.indices,`SCALAR`))}}finally{p?.dispose()}}export{u as decompressPrimitives};
@@ -1 +0,0 @@
1
- var e=(e,t)=>Object.assign(Error(t),{name:`MargoError`,code:e}),t=(e,t)=>`${e}; see https://margoengine.com/errors#${t}`,n=(n,r,i=n)=>e(n,t(r,i)),r=(e,n)=>TypeError(t(e,n));export{e as n,r,n as t};
@@ -1 +0,0 @@
1
- import{r as e}from"./errors-THVaUwlL.js";var t=/* @__PURE__ */ new WeakMap,n=/* @__PURE__ */ new WeakSet;function r(e){return n.delete(e)?void 0:t.get(e)}function i(t,r,i,a){let o=r({model:t,context:i[0],mode:i[1],phase:i[4]??`all`,draw(){n.add(t);try{a()}finally{n.delete(t)}}});if(o&&typeof o.then==`function`)throw e(`Material draw adapters must complete synchronously; do not return a promise`,`material`)}function a(e,n){let r=t.get(e);r?t.set(n,r):t.delete(n)}export{i,a as n,t as r,r as t};