minerender 2.1.0-alpha.1 → 2.1.0-alpha.11

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/README.md CHANGED
@@ -22,3 +22,5 @@ renderer.start();
22
22
  The package provides ESM and CommonJS entries for browsers and Node.js, plus
23
23
  `dist/bundle.js` for the `MineRender` browser global. Node imports require the optional
24
24
  native `canvas` dependency; headless rendering is still in development.
25
+
26
+ Requires Node.js 22+ or a browser with Fetch, `AbortSignal.any()`, and `AbortSignal.timeout()`.
@@ -1,14 +1,11 @@
1
1
  import * as three from 'three';
2
- import { Vector3, PixelFormat, BoxGeometry, Material, Mesh, Euler, Vector2, BufferAttribute, Float32BufferAttribute, Object3D, Box3, InstancedMesh, PerspectiveCamera, OrthographicCamera, Matrix4, Scene, Texture, Camera, WebGLRenderer, EventDispatcher, Raycaster, Intersection, CanvasTexture, BufferGeometry as BufferGeometry$1, InterleavedBufferAttribute, TrianglesDrawModes, Line, Points, MOUSE, TOUCH } from 'three';
2
+ import { Vector3, PixelFormat, BoxGeometry, Material, Mesh, Euler, Vector2, BufferAttribute, Float32BufferAttribute, BufferGeometry, Object3D, Box3, InstancedMesh, PerspectiveCamera, OrthographicCamera, Matrix4, Scene, Object3DEventMap, Texture, Camera, MOUSE, TOUCH, WebGLRenderer, EventDispatcher, Raycaster, Intersection, CanvasTexture, InterleavedBufferAttribute, TrianglesDrawModes, Line, Points } from 'three';
3
3
  import * as nodeCanvas from 'canvas';
4
4
  import { ImageData as ImageData$1, CanvasRenderingContext2D } from 'canvas';
5
- import { AxiosResponse, AxiosRequestConfig } from 'axios';
6
5
  import { Buffer as Buffer$1 } from 'buffer';
7
6
  import { NBT } from 'prismarine-nbt';
8
7
  import { ZipReader } from '@zip.js/zip.js';
9
8
  import { AsyncLoadingCache, SimpleCache } from '@inventivetalent/loading-cache';
10
- import { BufferGeometry } from 'three/src/core/BufferGeometry';
11
- import { Material as Material$1 } from 'three/src/materials/Material';
12
9
  import Stats from 'stats.js';
13
10
  import { EffectComposer } from 'postprocessing';
14
11
 
@@ -62,10 +59,11 @@ declare function createCanvas(width: number, height: number): CompatCanvas;
62
59
  declare abstract class PersistentCache<B = unknown> {
63
60
  readonly backing: B;
64
61
  /** Bump to invalidate every persisted entry. */
65
- static readonly VERSION = 1;
62
+ static readonly VERSION = 2;
66
63
  static open(name: string): PersistentCache;
67
64
  protected constructor(backing: B);
68
65
  abstract get<T>(key: string): Promise<T>;
66
+ /** Loads a missing entry and stores only non-nullish results. */
69
67
  getOrLoad<T>(key: string, loader: (key: string) => Promise<T>): Promise<T>;
70
68
  abstract put<T>(key: string, value: T): Promise<T>;
71
69
  abstract delete<T>(key: string): Promise<void>;
@@ -256,6 +254,46 @@ declare enum GuiLight {
256
254
  SIDE = "side"
257
255
  }
258
256
 
257
+ interface RequestConfig extends RequestInit {
258
+ url: string;
259
+ /** Prepended to relative URLs, preserving any path in the base URL. */
260
+ baseURL?: string;
261
+ /** Timeout per attempt in milliseconds, including body reading. Defaults to 5000; 0 disables it. */
262
+ timeout?: number;
263
+ responseType?: "json" | "arraybuffer";
264
+ }
265
+ interface RequestResponse<T = any> {
266
+ data: T;
267
+ status: number;
268
+ statusText: string;
269
+ headers: Headers;
270
+ /** Final URL after redirects. */
271
+ url: string;
272
+ }
273
+ declare class RequestError extends Error {
274
+ readonly response?: RequestResponse<undefined> | undefined;
275
+ readonly cause?: unknown;
276
+ constructor(message: string, response?: RequestResponse<undefined> | undefined, cause?: unknown);
277
+ }
278
+ declare class Requests {
279
+ private static genericQueue;
280
+ private static mcAssetRequestQueue;
281
+ static genericRequest(request: RequestConfig): Promise<RequestResponse>;
282
+ static mcAssetRequest(request: RequestConfig): Promise<RequestResponse>;
283
+ static setMcAssetRoot(root: string): void;
284
+ /** Counts unsettled calls, including retry delays and requests still running after shutdown. */
285
+ static get queueSizes(): {
286
+ generic: number;
287
+ mcAsset: number;
288
+ };
289
+ /**
290
+ * Permanently stops both queues and rejects waiting, retrying, and future requests.
291
+ * Requests already running can finish. Idle queues hold no timer, so Node can exit without
292
+ * this cleanup. See {@link shutdown}.
293
+ */
294
+ static end(): void;
295
+ }
296
+
259
297
  declare class WrappedImage {
260
298
  readonly dta: ExtractableImageData;
261
299
  constructor(dta: ExtractableImageData);
@@ -291,7 +329,7 @@ declare class ImageLoader {
291
329
  static infoToData(info: ImageInfo): Promise<ImageData>;
292
330
  static getData(src: string): Promise<ImageData>;
293
331
  static getCanvasData(src: string): Promise<ExtractableImageData>;
294
- static processResponse(response: Partial<AxiosResponse>): Promise<ImageInfo>;
332
+ static processResponse(response: Pick<RequestResponse<ArrayBuffer>, "data" | "url">): Promise<ImageInfo>;
295
333
  static loadInfo(src: string): Promise<ImageInfo>;
296
334
  static getInfo(src: string): Promise<ImageInfo>;
297
335
  static loadWrapped(src: string): Promise<WrappedImage>;
@@ -431,7 +469,7 @@ interface Transformable {
431
469
  declare function isTransformable(obj: any): obj is Transformable;
432
470
 
433
471
  declare const changeEvent: {
434
- type: string;
472
+ type: "change";
435
473
  };
436
474
  type Maybe<T> = T | undefined;
437
475
  declare function md5(str: string): string;
@@ -536,14 +574,13 @@ declare class MinecraftFaceUV {
536
574
  }
537
575
 
538
576
  /**
539
- * Releases every long-lived timer MineRender holds, so a Node process can exit.
577
+ * Stops the shared Ticker and request queues, and clears the in-memory caches.
540
578
  *
541
- * Both `@inventivetalent/loading-cache` (cache expiry) and `jobqu` (request queue draining) use
542
- * self-rescheduling timers that are not unref'd, which keeps the event loop alive for as long as
543
- * the library is loaded. Browsers don't care, but anything headless - a render server, a CLI, a
544
- * test run - has to call this when it's done.
579
+ * Idle Node processes can exit without calling this: cache and Ticker timers are unref'd,
580
+ * and idle request queues hold no timer. Pending requests keep their normal timer references.
545
581
  *
546
- * The library stays usable afterwards; the caches and queues simply start over.
582
+ * Call this only when finished with MineRender. Queued, retrying, and future requests reject;
583
+ * HTTP requests already running can finish. Queue shutdown is permanent, and cache expiry timers do not restart.
547
584
  */
548
585
  declare function shutdown(): void;
549
586
 
@@ -616,6 +653,14 @@ declare abstract class AssetSource {
616
653
  protected constructor();
617
654
  abstract get<T extends MinecraftAsset>(key: AssetKey, parser: AssetParser | string): Promise<Maybe<T>>;
618
655
  }
656
+ /** A source failed to load or parse an asset; cause retains the original failure. */
657
+ declare class AssetLoadError extends Error {
658
+ readonly source: AssetSource;
659
+ readonly key: AssetKey;
660
+ readonly path: string;
661
+ readonly cause: unknown;
662
+ constructor(source: AssetSource, key: AssetKey, path: string, cause: unknown);
663
+ }
619
664
 
620
665
  declare class AssetLoader {
621
666
  static ROOT: string;
@@ -623,6 +668,7 @@ declare class AssetLoader {
623
668
  static addSource(key: string, source: AssetSource, override?: boolean): void;
624
669
  static removeSource(key: string): Maybe<AssetSource>;
625
670
  static getAll<T extends MinecraftAsset>(key: AssetKey, parser: AssetParser | string): Promise<T[]>;
671
+ /** Returns the first defined result in source-priority order, without merging assets. */
626
672
  static get<T extends MinecraftAsset>(key: AssetKey, parser: AssetParser | string): Promise<Maybe<T>>;
627
673
  }
628
674
 
@@ -854,6 +900,7 @@ declare class EntityObject extends SceneObject {
854
900
  constructor(entity: EntityModel, options?: Partial<EntityObjectOptions>);
855
901
  init(): Promise<void>;
856
902
  dispose(): void;
903
+ private get textureKey();
857
904
  protected loadTextures(): Promise<void>;
858
905
  protected createMeshes(force?: boolean): void;
859
906
  protected applyTextures(): Promise<void>;
@@ -869,9 +916,12 @@ declare class MineRenderScene extends Scene {
869
916
  readonly stats: SceneStats;
870
917
  protected readonly instanceManager: InstanceManager;
871
918
  dirty: boolean;
919
+ private readonly observedObjects;
920
+ private readonly onObjectChange;
872
921
  constructor(options?: DeepPartial<MineRenderSceneOptions>);
873
- add(...object: any[]): this;
874
- remove(...object: any[]): this;
922
+ add(...objects: Object3D[]): this;
923
+ remove(...objects: Object3D[]): this;
924
+ private updateObjectRegistration;
875
925
  initAndAdd(...object: SceneObject[]): Promise<this>;
876
926
  addSceneObject<A extends BasicMinecraftAsset, T extends SceneObject, O extends SceneObjectOptions>(asset: A, objectSupplier: () => T | Promise<T>, _options?: Partial<O>, parent?: Object3D): Promise<T | InstanceReference<T>>;
877
927
  addModel(model: Model, options?: Partial<ModelObjectOptions>, parent?: Object3D): Promise<ModelObject | InstanceReference<ModelObject>>;
@@ -883,7 +933,9 @@ interface MineRenderSceneOptions {
883
933
  }
884
934
  declare function isMineRenderScene(obj: any): obj is MineRenderScene;
885
935
 
886
- declare class SceneObject extends Object3D implements Disposable, Instanceable, Transformable {
936
+ declare class SceneObject extends Object3D<Object3DEventMap & {
937
+ change: {};
938
+ }> implements Disposable, Instanceable, Transformable {
887
939
  readonly isSceneObject: true;
888
940
  static readonly DEFAULT_OPTIONS: SceneObjectOptions;
889
941
  readonly options: SceneObjectOptions;
@@ -909,9 +961,9 @@ declare class SceneObject extends Object3D implements Disposable, Instanceable,
909
961
  */
910
962
  toggleGroupVisibility(name: string, visible?: boolean): boolean;
911
963
  protected addOrReplaceMesh(mesh: Mesh, parent: Object3D, name?: string): void;
912
- protected createAndAddMesh(name?: string, group?: Object3D, geometry?: BufferGeometry, material?: Material$1 | Material$1[], offsetAxis?: Axis, offset?: number): Mesh;
913
- protected createMesh(name?: string, geometry?: BufferGeometry, material?: Material$1 | Material$1[], offsetAxis?: Axis, offset?: number): Mesh;
914
- protected createInstancedMesh(name: Maybe<string>, geometry: BufferGeometry, material: Material$1 | Material$1[], count: number): InstancedMesh;
964
+ protected createAndAddMesh(name?: string, group?: Object3D, geometry?: BufferGeometry, material?: Material | Material[], offsetAxis?: Axis, offset?: number): Mesh;
965
+ protected createMesh(name?: string, geometry?: BufferGeometry, material?: Material | Material[], offsetAxis?: Axis, offset?: number): Mesh;
966
+ protected createInstancedMesh(name: Maybe<string>, geometry: BufferGeometry, material: Material | Material[], count: number): InstancedMesh;
915
967
  /**
916
968
  * Get a mesh by its name
917
969
  */
@@ -1080,8 +1132,8 @@ interface NBTAsset extends MinecraftAsset, NBT {
1080
1132
  }
1081
1133
 
1082
1134
  interface ResponseParser<T extends MinecraftAsset> {
1083
- config(request: AxiosRequestConfig): any;
1084
- parse(response: AxiosResponse): Maybe<T> | Promise<Maybe<T>>;
1135
+ config(request: RequestConfig): any;
1136
+ parse(response: RequestResponse): Maybe<T> | Promise<Maybe<T>>;
1085
1137
  }
1086
1138
 
1087
1139
  declare class HostedAssetSource extends AssetSource {
@@ -1209,14 +1261,18 @@ declare class Caching {
1209
1261
  static readonly mergedModelCache: AsyncLoadingCache<CacheKey, Model>;
1210
1262
  static readonly modelTextureAtlasCache: AsyncLoadingCache<CacheKey, TextureAtlas>;
1211
1263
  static readonly blockStateCache: AsyncLoadingCache<CacheKey, BlockState>;
1264
+ static readonly listAssetCache: AsyncLoadingCache<CacheKey, ListAsset>;
1265
+ static readonly defaultBlockStatesCache: AsyncLoadingCache<CacheKey, DefaultBlockStates>;
1266
+ static readonly entityModelsCache: AsyncLoadingCache<CacheKey, EntityModels>;
1267
+ private static createAssetCache;
1212
1268
  /** Every cache above, so clear()/end() can never fall out of sync with the field list again. */
1213
1269
  private static get all();
1214
1270
  static clear(): void;
1215
1271
  /**
1216
1272
  * Clears every cache and stops its expiry timer.
1217
1273
  *
1218
- * loading-cache reschedules that timer indefinitely, so a Node process will not exit until
1219
- * this is called - see {@link shutdown}.
1274
+ * Expiry timers are unref'd in Node, so idle processes can exit without this cleanup.
1275
+ * Use {@link shutdown} to also stop requests and the shared Ticker.
1220
1276
  */
1221
1277
  static end(): void;
1222
1278
  static get cacheSizes(): {};
@@ -1232,38 +1288,127 @@ declare class GuiObject extends SceneObject {
1232
1288
  interface GuiObjectOptions extends SceneObjectOptions {
1233
1289
  }
1234
1290
 
1235
- declare class Renderer {
1291
+ declare class OrbitControls {
1292
+ constructor(object: Camera, domElement?: HTMLElement);
1293
+
1294
+ object: Camera;
1295
+ domElement: HTMLElement | HTMLDocument;
1296
+
1297
+ // API
1298
+ enabled: boolean;
1299
+ target: Vector3;
1300
+
1301
+ // deprecated
1302
+ center: Vector3;
1303
+
1304
+ minDistance: number;
1305
+ maxDistance: number;
1306
+
1307
+ minZoom: number;
1308
+ maxZoom: number;
1309
+
1310
+ minPolarAngle: number;
1311
+ maxPolarAngle: number;
1312
+
1313
+ minAzimuthAngle: number;
1314
+ maxAzimuthAngle: number;
1315
+
1316
+ enableDamping: boolean;
1317
+ dampingFactor: number;
1318
+
1319
+ enableZoom: boolean;
1320
+ zoomSpeed: number;
1321
+
1322
+ enableRotate: boolean;
1323
+ rotateSpeed: number;
1324
+
1325
+ enablePan: boolean;
1326
+ panSpeed: number;
1327
+ screenSpacePanning: boolean;
1328
+ keyPanSpeed: number;
1329
+
1330
+ autoRotate: boolean;
1331
+ autoRotateSpeed: number;
1332
+
1333
+ enableKeys: boolean;
1334
+ keys: { LEFT: string; UP: string; RIGHT: string; BOTTOM: string };
1335
+ mouseButtons: { LEFT: MOUSE; MIDDLE: MOUSE; RIGHT: MOUSE };
1336
+ touches: { ONE: TOUCH; TWO: TOUCH };
1337
+
1338
+ update(): boolean;
1339
+
1340
+ listenToKeyEvents(domElement: HTMLElement): void;
1341
+
1342
+ saveState(): void;
1343
+
1344
+ reset(): void;
1345
+
1346
+ dispose(): void;
1347
+
1348
+ getPolarAngle(): number;
1349
+
1350
+ getAzimuthalAngle(): number;
1351
+
1352
+ getDistance(): number;
1353
+
1354
+ // EventDispatcher mixins
1355
+ addEventListener(type: string, listener: (event: any) => void): void;
1356
+
1357
+ hasEventListener(type: string, listener: (event: any) => void): boolean;
1358
+
1359
+ removeEventListener(type: string, listener: (event: any) => void): void;
1360
+
1361
+ dispatchEvent(event: { type: string; target: any }): void;
1362
+ }
1363
+
1364
+ declare class MapControls extends OrbitControls {
1365
+ constructor(object: Camera, domElement?: HTMLElement);
1366
+ }
1367
+
1368
+ declare class Renderer implements Disposable {
1236
1369
  static readonly DEFAULT_OPTIONS: RendererOptions;
1237
1370
  readonly options: RendererOptions;
1238
1371
  protected _element?: HTMLElement;
1239
1372
  protected _scene: MineRenderScene;
1240
1373
  protected _camera: Camera;
1241
1374
  protected _renderer: WebGLRenderer;
1242
- protected _composer: EffectComposer;
1375
+ protected _composer?: EffectComposer;
1376
+ protected _controls?: OrbitControls;
1243
1377
  protected _stats?: Stats;
1244
1378
  protected _dirty: boolean;
1245
1379
  protected _animationLoop: any;
1246
- protected _fpsTimer: any;
1247
- protected _animationTimer?: NodeJS.Timeout;
1248
- protected _animationFrame?: number;
1380
+ protected _frameInterval?: number;
1249
1381
  protected _resizeListener?: () => void;
1382
+ private _nextFrameTime?;
1383
+ private _disposed;
1384
+ private readonly _debugHelpers;
1385
+ private readonly _eventDispatchers;
1386
+ private readonly _changeListener;
1250
1387
  constructor(options?: DeepPartial<RendererOptions>);
1251
1388
  protected createScene(): MineRenderScene;
1252
1389
  protected createCamera(): Camera;
1253
1390
  protected createRenderer(): WebGLRenderer;
1254
- protected createComposer(): EffectComposer;
1391
+ protected createComposer(): Maybe<EffectComposer>;
1392
+ protected createControls(): Maybe<OrbitControls>;
1255
1393
  init(): void;
1256
1394
  get element(): Maybe<HTMLElement>;
1257
1395
  appendTo(element: HTMLElement): void;
1258
1396
  /**
1259
- * Register an EventDispatcher which may update the scene or renderer in order to redraw the scene
1397
+ * Redraws when the dispatcher emits the selected event. Registering the same pair twice has no effect.
1398
+ * The renderer removes its listener on disposal; the caller retains ownership of the dispatcher.
1260
1399
  */
1261
- registerEventDispatcher(dispatcher: EventDispatcher, changeEvent?: string): void;
1400
+ registerEventDispatcher(dispatcher: EventDispatcher<any>, changeEvent?: string): void;
1262
1401
  resize(width: number, height: number): void;
1263
1402
  get dirty(): boolean;
1264
1403
  set dirty(dirty: boolean);
1265
1404
  start(): void;
1266
1405
  stop(): void;
1406
+ /**
1407
+ * Stops rendering and releases owned resources. Repeated calls have no effect, and a disposed
1408
+ * renderer cannot be restarted. Scene objects are detached; shared assets and caller-owned
1409
+ * controls must be managed by their owners.
1410
+ */
1411
+ dispose(): void;
1267
1412
  private animate;
1268
1413
  toImage(): string;
1269
1414
  protected get attachedToBody(): boolean;
@@ -1272,12 +1417,15 @@ declare class Renderer {
1272
1417
  get scene(): MineRenderScene;
1273
1418
  get camera(): Camera;
1274
1419
  get renderer(): WebGLRenderer;
1275
- get composer(): EffectComposer;
1420
+ get composer(): Maybe<EffectComposer>;
1421
+ /** Renderer-owned controls, or undefined when disabled at construction or after disposal. */
1422
+ get controls(): Maybe<OrbitControls>;
1276
1423
  }
1277
1424
  interface RendererOptions {
1278
1425
  camera: CameraOptions;
1279
1426
  render: RenderOptions;
1280
1427
  composer: ComposerOptions;
1428
+ controls?: ControlsOptions;
1281
1429
  debug: DebugOptions;
1282
1430
  }
1283
1431
  interface CameraOptions {
@@ -1298,6 +1446,7 @@ interface CameraOptions {
1298
1446
  lookingAt: Vector3 | TripleArray;
1299
1447
  }
1300
1448
  interface RenderOptions {
1449
+ /** Maximum draw rate (60 by default); zero or a negative value disables the limit. */
1301
1450
  fpsLimit: number;
1302
1451
  stats: boolean;
1303
1452
  antialias: boolean;
@@ -1308,6 +1457,9 @@ interface RenderOptions {
1308
1457
  interface ComposerOptions {
1309
1458
  enabled: boolean;
1310
1459
  }
1460
+ interface ControlsOptions {
1461
+ enabled: boolean;
1462
+ }
1311
1463
  interface DebugOptions {
1312
1464
  grid: boolean;
1313
1465
  axes: boolean;
@@ -1322,7 +1474,7 @@ declare class SceneInspector {
1322
1474
  private selectedObject?;
1323
1475
  constructor(renderer: Renderer);
1324
1476
  protected init(): void;
1325
- findMeshChildren(from: Object3D, out?: Mesh[]): Mesh<three.BufferGeometry, three.Material | three.Material[]>[];
1477
+ findMeshChildren(from: Object3D, out?: Mesh[]): Mesh<three.BufferGeometry<three.NormalBufferAttributes>, three.Material | three.Material[], three.Object3DEventMap>[];
1326
1478
  onClick(event: any): void;
1327
1479
  appendTo(el: HTMLElement): void;
1328
1480
  protected handleRaycasterObjects(intersections: Intersection[]): void;
@@ -1359,26 +1511,6 @@ declare class StatLine {
1359
1511
  update(): void;
1360
1512
  }
1361
1513
 
1362
- declare class Requests {
1363
- private static axiosInstance;
1364
- private static mcAssetInstance;
1365
- private static genericQueue;
1366
- private static mcAssetRequestQueue;
1367
- static genericRequest(request: AxiosRequestConfig): Promise<AxiosResponse>;
1368
- static mcAssetRequest(request: AxiosRequestConfig): Promise<AxiosResponse>;
1369
- private static shouldRetry;
1370
- static setMcAssetRoot(root: string): void;
1371
- static get queueSizes(): {
1372
- generic: number;
1373
- mcAsset: number;
1374
- };
1375
- /**
1376
- * Stops both queue timers. jobqu reschedules itself indefinitely, so a Node process will not
1377
- * exit until this is called - see {@link shutdown}.
1378
- */
1379
- static end(): void;
1380
- }
1381
-
1382
1514
  type SkinGeometries = Record<SkinPart, TripleArray>;
1383
1515
  declare const classicSkinGeometries: SkinGeometries;
1384
1516
  declare const slimSkinGeometries: SkinGeometries;
@@ -1411,6 +1543,9 @@ declare class Skins {
1411
1543
  }
1412
1544
 
1413
1545
  declare class TextureLoader {
1546
+ private static readonly failedTextures;
1547
+ /** Reports whether image loading failed, so cached textures can be retried. */
1548
+ static hasFailed(texture: Texture): boolean;
1414
1549
  protected static createTexture(): Texture;
1415
1550
  static loadInBackground(src: string, format?: PixelFormat, rotation?: number): Texture;
1416
1551
  static load(src: string, format?: PixelFormat, rotation?: number): Texture;
@@ -1424,91 +1559,14 @@ declare class Textures {
1424
1559
  static getImage(key: TextureKey): Texture;
1425
1560
  }
1426
1561
 
1427
- declare function mergeBufferGeometries(geometries: BufferGeometry$1[], useGroups?: boolean): BufferGeometry$1;
1562
+ declare function mergeBufferGeometries(geometries: BufferGeometry[], useGroups?: boolean): BufferGeometry;
1428
1563
  declare function mergeBufferAttributes(attributes: BufferAttribute[]): BufferAttribute;
1429
1564
  declare function interleaveAttributes(attributes: BufferAttribute[]): InterleavedBufferAttribute;
1430
- declare function estimateBytesUsed(geometry: BufferGeometry$1): number;
1431
- declare function mergeVertices(geometry: BufferGeometry$1, tolerance?: number): BufferGeometry$1;
1432
- declare function toTrianglesDrawMode(geometry: BufferGeometry$1, drawMode: TrianglesDrawModes): BufferGeometry$1;
1565
+ declare function estimateBytesUsed(geometry: BufferGeometry): number;
1566
+ declare function mergeVertices(geometry: BufferGeometry, tolerance?: number): BufferGeometry;
1567
+ declare function toTrianglesDrawMode(geometry: BufferGeometry, drawMode: TrianglesDrawModes): BufferGeometry;
1433
1568
  declare function computeMorphedAttributes(object: Mesh | Line | Points): object;
1434
1569
 
1435
- declare class OrbitControls {
1436
- constructor(object: Camera, domElement?: HTMLElement);
1437
-
1438
- object: Camera;
1439
- domElement: HTMLElement | HTMLDocument;
1440
-
1441
- // API
1442
- enabled: boolean;
1443
- target: Vector3;
1444
-
1445
- // deprecated
1446
- center: Vector3;
1447
-
1448
- minDistance: number;
1449
- maxDistance: number;
1450
-
1451
- minZoom: number;
1452
- maxZoom: number;
1453
-
1454
- minPolarAngle: number;
1455
- maxPolarAngle: number;
1456
-
1457
- minAzimuthAngle: number;
1458
- maxAzimuthAngle: number;
1459
-
1460
- enableDamping: boolean;
1461
- dampingFactor: number;
1462
-
1463
- enableZoom: boolean;
1464
- zoomSpeed: number;
1465
-
1466
- enableRotate: boolean;
1467
- rotateSpeed: number;
1468
-
1469
- enablePan: boolean;
1470
- panSpeed: number;
1471
- screenSpacePanning: boolean;
1472
- keyPanSpeed: number;
1473
-
1474
- autoRotate: boolean;
1475
- autoRotateSpeed: number;
1476
-
1477
- enableKeys: boolean;
1478
- keys: { LEFT: string; UP: string; RIGHT: string; BOTTOM: string };
1479
- mouseButtons: { LEFT: MOUSE; MIDDLE: MOUSE; RIGHT: MOUSE };
1480
- touches: { ONE: TOUCH; TWO: TOUCH };
1481
-
1482
- update(): boolean;
1483
-
1484
- listenToKeyEvents(domElement: HTMLElement): void;
1485
-
1486
- saveState(): void;
1487
-
1488
- reset(): void;
1489
-
1490
- dispose(): void;
1491
-
1492
- getPolarAngle(): number;
1493
-
1494
- getAzimuthalAngle(): number;
1495
-
1496
- getDistance(): number;
1497
-
1498
- // EventDispatcher mixins
1499
- addEventListener(type: string, listener: (event: any) => void): void;
1500
-
1501
- hasEventListener(type: string, listener: (event: any) => void): boolean;
1502
-
1503
- removeEventListener(type: string, listener: (event: any) => void): void;
1504
-
1505
- dispatchEvent(event: { type: string; target: any }): void;
1506
- }
1507
-
1508
- declare class MapControls extends OrbitControls {
1509
- constructor(object: Camera, domElement?: HTMLElement);
1510
- }
1511
-
1512
1570
  interface BlockInfo {
1513
1571
  block: Block;
1514
1572
  object: BlockObject;
@@ -1597,8 +1655,8 @@ declare class BrowserCache extends PersistentCache<LocalForage> {
1597
1655
  *
1598
1656
  * `image-size` pulls in `fs`/`path` at module scope, so it can only live in the Node build.
1599
1657
  * Everything MineRender loads is a PNG in practice; GIF and JPEG are handled as a courtesy and
1600
- * anything else falls through to an empty result (callers treat that as 0x0).
1658
+ * anything else falls through to an empty result, which ImageLoader rejects.
1601
1659
  */
1602
1660
  declare function probeImageSize(data: Uint8Array): ImageSizeInfo;
1603
1661
 
1604
- export { AXES, type AnimationFrame, type AnimationMeta, type AnimatorFunction, ArchiveAssetSource, type ArchiveEntry, type ArchiveProxy, AssetKey, AssetLoader, AssetParser, AssetSource, type AssetType, Assets, Axis, BUILTIN_ENTITY, BUILTIN_GENERATED, BasicAssetKey, type BasicMinecraftAsset, BatchedExecutor, type BedrockBone, type BedrockCube, type BedrockEntityDescription, type BedrockEntityFile, type BedrockGeometry, type BedrockGeometryFile, type Block, BlockEntityModels, type BlockInfo, type BlockModel, type BlockModelTextures, BlockObject, type BlockObjectOptions, type BlockState, type BlockStateMultipart, type BlockStateProperties, type BlockStateProperty, type BlockStatePropertyDefaults, type BlockStatePropertyValue, type BlockStateVariant, type BlockStateVariants, BlockStates, type BoxGeometryKey, BrowserArchiveProxy, BrowserCache, BrowserEnv, CUBE_FACES, type CacheKey, Caching, type CameraOptions, CanvasImage, Chunk, type CompatCanvas, type CompatImage, type ComposerOptions, type Cube, CubeFace, CubeFaceIndex, DEFAULT_ELEMENTS, DEFAULT_NAMESPACE, DEFAULT_ROOT, DEFAULT_UV, DISPLAY_POSITIONS, type DebugOptions, type DeepPartial, DefaultBlockStates, DisplayPosition, type Disposable, type DoubleArray, type ElementFace, type ElementRotation, Entities, type EntityModel, EntityModels, EntityObject, type EntityObjectOptions, Env, type EnvProvider, type ExtractableImageData, type FromTo, Geometries, GuiLight, GuiObject, type GuiObjectOptions, HostedAssetSource, type IModelTextures, ITEM_GENERATED, type ImageInfo, ImageLoader, type ImageSizeInfo, InstanceManager, InstanceReference, type Instanceable, type ItemModel, type ItemModelTextures, type ListAsset, MapControls, type MaterialKey, Materials, type Maybe, type MeshKey, Meshes, MineRenderError, MineRenderScene, type MineRenderSceneOptions, MineRenderWorld, type MinecraftAsset, MinecraftCubeTexture, MinecraftFaceUV, type MinecraftTextureMeta, type Model, type ModelDisplay, type ModelElement, type ModelFaces, ModelGenerator, ModelMerger, ModelObject, type ModelObjectOptions, type ModelPart, ModelTextures, Models, type MultiBlockBlock, type MultiBlockStructure, type MultipartCondition, type NBTAsset, NBTHelper, OrbitControls, PersistentCache, type QuadArray, type RawImageKey, type RenderOptions, Renderer, type RendererOptions, Requests, type ResponseParser, SKIN_PARTS, SceneInspector, SceneObject, type SceneObjectOptions, SceneStats, SceneStatsDisplay, SchematicParser, type Serializable, type SkinGeometries, SkinObject, type SkinObjectOptions, SkinPart, type SkinTextureCoordinates, Skins, type StructureNBT, StructureParser, type TextureAsset, TextureAtlas, type TextureKey, TextureLoader, Textures, Ticker, type TickerFunction, TintColors, type Transformable, type TripleArray, UVMapper, WrappedImage, addBox3WireframeToObject, addWireframeToMesh, addWireframeToObject, applyElementRotation, applyGenericRotation, applyModelPartRotation, axisToVec3, base64decode, base64encode, captureException, changeEvent, clampRotationDegrees, classicSkinGeometries, classicSkinTextureCoordinates, computeMorphedAttributes, createCanvas, createImage, estimateBytesUsed, interleaveAttributes, isAssetKey, isBasicAssetKey, isBlockObject, isDisposable, isDoubleArray, isEntityObject, isInstanceManager, isInstanceReference, isInstanceable, isInstancedMesh, isMesh, isMineRenderScene, isModelObject, isObject3D, isOrthographicCamera, isPerspectiveCamera, isQuadArray, isSceneObject, isTransformable, isTripleArray, isVector3, md5, mergeBufferAttributes, mergeBufferGeometries, mergeVertices, prefix, probeImageSize, registerBrowserEnv, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode };
1662
+ export { AXES, type AnimationFrame, type AnimationMeta, type AnimatorFunction, ArchiveAssetSource, type ArchiveEntry, type ArchiveProxy, AssetKey, AssetLoadError, AssetLoader, AssetParser, AssetSource, type AssetType, Assets, Axis, BUILTIN_ENTITY, BUILTIN_GENERATED, BasicAssetKey, type BasicMinecraftAsset, BatchedExecutor, type BedrockBone, type BedrockCube, type BedrockEntityDescription, type BedrockEntityFile, type BedrockGeometry, type BedrockGeometryFile, type Block, BlockEntityModels, type BlockInfo, type BlockModel, type BlockModelTextures, BlockObject, type BlockObjectOptions, type BlockState, type BlockStateMultipart, type BlockStateProperties, type BlockStateProperty, type BlockStatePropertyDefaults, type BlockStatePropertyValue, type BlockStateVariant, type BlockStateVariants, BlockStates, type BoxGeometryKey, BrowserArchiveProxy, BrowserCache, BrowserEnv, CUBE_FACES, type CacheKey, Caching, type CameraOptions, CanvasImage, Chunk, type CompatCanvas, type CompatImage, type ComposerOptions, type ControlsOptions, type Cube, CubeFace, CubeFaceIndex, DEFAULT_ELEMENTS, DEFAULT_NAMESPACE, DEFAULT_ROOT, DEFAULT_UV, DISPLAY_POSITIONS, type DebugOptions, type DeepPartial, DefaultBlockStates, DisplayPosition, type Disposable, type DoubleArray, type ElementFace, type ElementRotation, Entities, type EntityModel, EntityModels, EntityObject, type EntityObjectOptions, Env, type EnvProvider, type ExtractableImageData, type FromTo, Geometries, GuiLight, GuiObject, type GuiObjectOptions, HostedAssetSource, type IModelTextures, ITEM_GENERATED, type ImageInfo, ImageLoader, type ImageSizeInfo, InstanceManager, InstanceReference, type Instanceable, type ItemModel, type ItemModelTextures, type ListAsset, MapControls, type MaterialKey, Materials, type Maybe, type MeshKey, Meshes, MineRenderError, MineRenderScene, type MineRenderSceneOptions, MineRenderWorld, type MinecraftAsset, MinecraftCubeTexture, MinecraftFaceUV, type MinecraftTextureMeta, type Model, type ModelDisplay, type ModelElement, type ModelFaces, ModelGenerator, ModelMerger, ModelObject, type ModelObjectOptions, type ModelPart, ModelTextures, Models, type MultiBlockBlock, type MultiBlockStructure, type MultipartCondition, type NBTAsset, NBTHelper, OrbitControls, PersistentCache, type QuadArray, type RawImageKey, type RenderOptions, Renderer, type RendererOptions, type RequestConfig, RequestError, type RequestResponse, Requests, type ResponseParser, SKIN_PARTS, SceneInspector, SceneObject, type SceneObjectOptions, SceneStats, SceneStatsDisplay, SchematicParser, type Serializable, type SkinGeometries, SkinObject, type SkinObjectOptions, SkinPart, type SkinTextureCoordinates, Skins, type StructureNBT, StructureParser, type TextureAsset, TextureAtlas, type TextureKey, TextureLoader, Textures, Ticker, type TickerFunction, TintColors, type Transformable, type TripleArray, UVMapper, WrappedImage, addBox3WireframeToObject, addWireframeToMesh, addWireframeToObject, applyElementRotation, applyGenericRotation, applyModelPartRotation, axisToVec3, base64decode, base64encode, captureException, changeEvent, clampRotationDegrees, classicSkinGeometries, classicSkinTextureCoordinates, computeMorphedAttributes, createCanvas, createImage, estimateBytesUsed, interleaveAttributes, isAssetKey, isBasicAssetKey, isBlockObject, isDisposable, isDoubleArray, isEntityObject, isInstanceManager, isInstanceReference, isInstanceable, isInstancedMesh, isMesh, isMineRenderScene, isModelObject, isObject3D, isOrthographicCamera, isPerspectiveCamera, isQuadArray, isSceneObject, isTransformable, isTripleArray, isVector3, md5, mergeBufferAttributes, mergeBufferGeometries, mergeVertices, prefix, probeImageSize, registerBrowserEnv, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode };