minerender 2.1.0-alpha.1 → 2.1.0-alpha.10

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
 
@@ -623,6 +660,7 @@ declare class AssetLoader {
623
660
  static addSource(key: string, source: AssetSource, override?: boolean): void;
624
661
  static removeSource(key: string): Maybe<AssetSource>;
625
662
  static getAll<T extends MinecraftAsset>(key: AssetKey, parser: AssetParser | string): Promise<T[]>;
663
+ /** Returns the first defined result in source-priority order, without merging assets. */
626
664
  static get<T extends MinecraftAsset>(key: AssetKey, parser: AssetParser | string): Promise<Maybe<T>>;
627
665
  }
628
666
 
@@ -854,6 +892,7 @@ declare class EntityObject extends SceneObject {
854
892
  constructor(entity: EntityModel, options?: Partial<EntityObjectOptions>);
855
893
  init(): Promise<void>;
856
894
  dispose(): void;
895
+ private get textureKey();
857
896
  protected loadTextures(): Promise<void>;
858
897
  protected createMeshes(force?: boolean): void;
859
898
  protected applyTextures(): Promise<void>;
@@ -869,9 +908,12 @@ declare class MineRenderScene extends Scene {
869
908
  readonly stats: SceneStats;
870
909
  protected readonly instanceManager: InstanceManager;
871
910
  dirty: boolean;
911
+ private readonly observedObjects;
912
+ private readonly onObjectChange;
872
913
  constructor(options?: DeepPartial<MineRenderSceneOptions>);
873
- add(...object: any[]): this;
874
- remove(...object: any[]): this;
914
+ add(...objects: Object3D[]): this;
915
+ remove(...objects: Object3D[]): this;
916
+ private updateObjectRegistration;
875
917
  initAndAdd(...object: SceneObject[]): Promise<this>;
876
918
  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
919
  addModel(model: Model, options?: Partial<ModelObjectOptions>, parent?: Object3D): Promise<ModelObject | InstanceReference<ModelObject>>;
@@ -883,7 +925,9 @@ interface MineRenderSceneOptions {
883
925
  }
884
926
  declare function isMineRenderScene(obj: any): obj is MineRenderScene;
885
927
 
886
- declare class SceneObject extends Object3D implements Disposable, Instanceable, Transformable {
928
+ declare class SceneObject extends Object3D<Object3DEventMap & {
929
+ change: {};
930
+ }> implements Disposable, Instanceable, Transformable {
887
931
  readonly isSceneObject: true;
888
932
  static readonly DEFAULT_OPTIONS: SceneObjectOptions;
889
933
  readonly options: SceneObjectOptions;
@@ -909,9 +953,9 @@ declare class SceneObject extends Object3D implements Disposable, Instanceable,
909
953
  */
910
954
  toggleGroupVisibility(name: string, visible?: boolean): boolean;
911
955
  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;
956
+ protected createAndAddMesh(name?: string, group?: Object3D, geometry?: BufferGeometry, material?: Material | Material[], offsetAxis?: Axis, offset?: number): Mesh;
957
+ protected createMesh(name?: string, geometry?: BufferGeometry, material?: Material | Material[], offsetAxis?: Axis, offset?: number): Mesh;
958
+ protected createInstancedMesh(name: Maybe<string>, geometry: BufferGeometry, material: Material | Material[], count: number): InstancedMesh;
915
959
  /**
916
960
  * Get a mesh by its name
917
961
  */
@@ -1080,8 +1124,8 @@ interface NBTAsset extends MinecraftAsset, NBT {
1080
1124
  }
1081
1125
 
1082
1126
  interface ResponseParser<T extends MinecraftAsset> {
1083
- config(request: AxiosRequestConfig): any;
1084
- parse(response: AxiosResponse): Maybe<T> | Promise<Maybe<T>>;
1127
+ config(request: RequestConfig): any;
1128
+ parse(response: RequestResponse): Maybe<T> | Promise<Maybe<T>>;
1085
1129
  }
1086
1130
 
1087
1131
  declare class HostedAssetSource extends AssetSource {
@@ -1209,14 +1253,18 @@ declare class Caching {
1209
1253
  static readonly mergedModelCache: AsyncLoadingCache<CacheKey, Model>;
1210
1254
  static readonly modelTextureAtlasCache: AsyncLoadingCache<CacheKey, TextureAtlas>;
1211
1255
  static readonly blockStateCache: AsyncLoadingCache<CacheKey, BlockState>;
1256
+ static readonly listAssetCache: AsyncLoadingCache<CacheKey, ListAsset>;
1257
+ static readonly defaultBlockStatesCache: AsyncLoadingCache<CacheKey, DefaultBlockStates>;
1258
+ static readonly entityModelsCache: AsyncLoadingCache<CacheKey, EntityModels>;
1259
+ private static createAssetCache;
1212
1260
  /** Every cache above, so clear()/end() can never fall out of sync with the field list again. */
1213
1261
  private static get all();
1214
1262
  static clear(): void;
1215
1263
  /**
1216
1264
  * Clears every cache and stops its expiry timer.
1217
1265
  *
1218
- * loading-cache reschedules that timer indefinitely, so a Node process will not exit until
1219
- * this is called - see {@link shutdown}.
1266
+ * Expiry timers are unref'd in Node, so idle processes can exit without this cleanup.
1267
+ * Use {@link shutdown} to also stop requests and the shared Ticker.
1220
1268
  */
1221
1269
  static end(): void;
1222
1270
  static get cacheSizes(): {};
@@ -1232,38 +1280,127 @@ declare class GuiObject extends SceneObject {
1232
1280
  interface GuiObjectOptions extends SceneObjectOptions {
1233
1281
  }
1234
1282
 
1235
- declare class Renderer {
1283
+ declare class OrbitControls {
1284
+ constructor(object: Camera, domElement?: HTMLElement);
1285
+
1286
+ object: Camera;
1287
+ domElement: HTMLElement | HTMLDocument;
1288
+
1289
+ // API
1290
+ enabled: boolean;
1291
+ target: Vector3;
1292
+
1293
+ // deprecated
1294
+ center: Vector3;
1295
+
1296
+ minDistance: number;
1297
+ maxDistance: number;
1298
+
1299
+ minZoom: number;
1300
+ maxZoom: number;
1301
+
1302
+ minPolarAngle: number;
1303
+ maxPolarAngle: number;
1304
+
1305
+ minAzimuthAngle: number;
1306
+ maxAzimuthAngle: number;
1307
+
1308
+ enableDamping: boolean;
1309
+ dampingFactor: number;
1310
+
1311
+ enableZoom: boolean;
1312
+ zoomSpeed: number;
1313
+
1314
+ enableRotate: boolean;
1315
+ rotateSpeed: number;
1316
+
1317
+ enablePan: boolean;
1318
+ panSpeed: number;
1319
+ screenSpacePanning: boolean;
1320
+ keyPanSpeed: number;
1321
+
1322
+ autoRotate: boolean;
1323
+ autoRotateSpeed: number;
1324
+
1325
+ enableKeys: boolean;
1326
+ keys: { LEFT: string; UP: string; RIGHT: string; BOTTOM: string };
1327
+ mouseButtons: { LEFT: MOUSE; MIDDLE: MOUSE; RIGHT: MOUSE };
1328
+ touches: { ONE: TOUCH; TWO: TOUCH };
1329
+
1330
+ update(): boolean;
1331
+
1332
+ listenToKeyEvents(domElement: HTMLElement): void;
1333
+
1334
+ saveState(): void;
1335
+
1336
+ reset(): void;
1337
+
1338
+ dispose(): void;
1339
+
1340
+ getPolarAngle(): number;
1341
+
1342
+ getAzimuthalAngle(): number;
1343
+
1344
+ getDistance(): number;
1345
+
1346
+ // EventDispatcher mixins
1347
+ addEventListener(type: string, listener: (event: any) => void): void;
1348
+
1349
+ hasEventListener(type: string, listener: (event: any) => void): boolean;
1350
+
1351
+ removeEventListener(type: string, listener: (event: any) => void): void;
1352
+
1353
+ dispatchEvent(event: { type: string; target: any }): void;
1354
+ }
1355
+
1356
+ declare class MapControls extends OrbitControls {
1357
+ constructor(object: Camera, domElement?: HTMLElement);
1358
+ }
1359
+
1360
+ declare class Renderer implements Disposable {
1236
1361
  static readonly DEFAULT_OPTIONS: RendererOptions;
1237
1362
  readonly options: RendererOptions;
1238
1363
  protected _element?: HTMLElement;
1239
1364
  protected _scene: MineRenderScene;
1240
1365
  protected _camera: Camera;
1241
1366
  protected _renderer: WebGLRenderer;
1242
- protected _composer: EffectComposer;
1367
+ protected _composer?: EffectComposer;
1368
+ protected _controls?: OrbitControls;
1243
1369
  protected _stats?: Stats;
1244
1370
  protected _dirty: boolean;
1245
1371
  protected _animationLoop: any;
1246
- protected _fpsTimer: any;
1247
- protected _animationTimer?: NodeJS.Timeout;
1248
- protected _animationFrame?: number;
1372
+ protected _frameInterval?: number;
1249
1373
  protected _resizeListener?: () => void;
1374
+ private _nextFrameTime?;
1375
+ private _disposed;
1376
+ private readonly _debugHelpers;
1377
+ private readonly _eventDispatchers;
1378
+ private readonly _changeListener;
1250
1379
  constructor(options?: DeepPartial<RendererOptions>);
1251
1380
  protected createScene(): MineRenderScene;
1252
1381
  protected createCamera(): Camera;
1253
1382
  protected createRenderer(): WebGLRenderer;
1254
- protected createComposer(): EffectComposer;
1383
+ protected createComposer(): Maybe<EffectComposer>;
1384
+ protected createControls(): Maybe<OrbitControls>;
1255
1385
  init(): void;
1256
1386
  get element(): Maybe<HTMLElement>;
1257
1387
  appendTo(element: HTMLElement): void;
1258
1388
  /**
1259
- * Register an EventDispatcher which may update the scene or renderer in order to redraw the scene
1389
+ * Redraws when the dispatcher emits the selected event. Registering the same pair twice has no effect.
1390
+ * The renderer removes its listener on disposal; the caller retains ownership of the dispatcher.
1260
1391
  */
1261
- registerEventDispatcher(dispatcher: EventDispatcher, changeEvent?: string): void;
1392
+ registerEventDispatcher(dispatcher: EventDispatcher<any>, changeEvent?: string): void;
1262
1393
  resize(width: number, height: number): void;
1263
1394
  get dirty(): boolean;
1264
1395
  set dirty(dirty: boolean);
1265
1396
  start(): void;
1266
1397
  stop(): void;
1398
+ /**
1399
+ * Stops rendering and releases owned resources. Repeated calls have no effect, and a disposed
1400
+ * renderer cannot be restarted. Scene objects are detached; shared assets and caller-owned
1401
+ * controls must be managed by their owners.
1402
+ */
1403
+ dispose(): void;
1267
1404
  private animate;
1268
1405
  toImage(): string;
1269
1406
  protected get attachedToBody(): boolean;
@@ -1272,12 +1409,15 @@ declare class Renderer {
1272
1409
  get scene(): MineRenderScene;
1273
1410
  get camera(): Camera;
1274
1411
  get renderer(): WebGLRenderer;
1275
- get composer(): EffectComposer;
1412
+ get composer(): Maybe<EffectComposer>;
1413
+ /** Renderer-owned controls, or undefined when disabled at construction or after disposal. */
1414
+ get controls(): Maybe<OrbitControls>;
1276
1415
  }
1277
1416
  interface RendererOptions {
1278
1417
  camera: CameraOptions;
1279
1418
  render: RenderOptions;
1280
1419
  composer: ComposerOptions;
1420
+ controls?: ControlsOptions;
1281
1421
  debug: DebugOptions;
1282
1422
  }
1283
1423
  interface CameraOptions {
@@ -1298,6 +1438,7 @@ interface CameraOptions {
1298
1438
  lookingAt: Vector3 | TripleArray;
1299
1439
  }
1300
1440
  interface RenderOptions {
1441
+ /** Maximum draw rate (60 by default); zero or a negative value disables the limit. */
1301
1442
  fpsLimit: number;
1302
1443
  stats: boolean;
1303
1444
  antialias: boolean;
@@ -1308,6 +1449,9 @@ interface RenderOptions {
1308
1449
  interface ComposerOptions {
1309
1450
  enabled: boolean;
1310
1451
  }
1452
+ interface ControlsOptions {
1453
+ enabled: boolean;
1454
+ }
1311
1455
  interface DebugOptions {
1312
1456
  grid: boolean;
1313
1457
  axes: boolean;
@@ -1322,7 +1466,7 @@ declare class SceneInspector {
1322
1466
  private selectedObject?;
1323
1467
  constructor(renderer: Renderer);
1324
1468
  protected init(): void;
1325
- findMeshChildren(from: Object3D, out?: Mesh[]): Mesh<three.BufferGeometry, three.Material | three.Material[]>[];
1469
+ findMeshChildren(from: Object3D, out?: Mesh[]): Mesh<three.BufferGeometry<three.NormalBufferAttributes>, three.Material | three.Material[], three.Object3DEventMap>[];
1326
1470
  onClick(event: any): void;
1327
1471
  appendTo(el: HTMLElement): void;
1328
1472
  protected handleRaycasterObjects(intersections: Intersection[]): void;
@@ -1359,26 +1503,6 @@ declare class StatLine {
1359
1503
  update(): void;
1360
1504
  }
1361
1505
 
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
1506
  type SkinGeometries = Record<SkinPart, TripleArray>;
1383
1507
  declare const classicSkinGeometries: SkinGeometries;
1384
1508
  declare const slimSkinGeometries: SkinGeometries;
@@ -1411,6 +1535,9 @@ declare class Skins {
1411
1535
  }
1412
1536
 
1413
1537
  declare class TextureLoader {
1538
+ private static readonly failedTextures;
1539
+ /** Reports whether image loading failed, so cached textures can be retried. */
1540
+ static hasFailed(texture: Texture): boolean;
1414
1541
  protected static createTexture(): Texture;
1415
1542
  static loadInBackground(src: string, format?: PixelFormat, rotation?: number): Texture;
1416
1543
  static load(src: string, format?: PixelFormat, rotation?: number): Texture;
@@ -1424,91 +1551,14 @@ declare class Textures {
1424
1551
  static getImage(key: TextureKey): Texture;
1425
1552
  }
1426
1553
 
1427
- declare function mergeBufferGeometries(geometries: BufferGeometry$1[], useGroups?: boolean): BufferGeometry$1;
1554
+ declare function mergeBufferGeometries(geometries: BufferGeometry[], useGroups?: boolean): BufferGeometry;
1428
1555
  declare function mergeBufferAttributes(attributes: BufferAttribute[]): BufferAttribute;
1429
1556
  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;
1557
+ declare function estimateBytesUsed(geometry: BufferGeometry): number;
1558
+ declare function mergeVertices(geometry: BufferGeometry, tolerance?: number): BufferGeometry;
1559
+ declare function toTrianglesDrawMode(geometry: BufferGeometry, drawMode: TrianglesDrawModes): BufferGeometry;
1433
1560
  declare function computeMorphedAttributes(object: Mesh | Line | Points): object;
1434
1561
 
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
1562
  interface BlockInfo {
1513
1563
  block: Block;
1514
1564
  object: BlockObject;
@@ -1597,8 +1647,8 @@ declare class BrowserCache extends PersistentCache<LocalForage> {
1597
1647
  *
1598
1648
  * `image-size` pulls in `fs`/`path` at module scope, so it can only live in the Node build.
1599
1649
  * 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).
1650
+ * anything else falls through to an empty result, which ImageLoader rejects.
1601
1651
  */
1602
1652
  declare function probeImageSize(data: Uint8Array): ImageSizeInfo;
1603
1653
 
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 };
1654
+ 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 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 };