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 +2 -0
- package/dist/browser/index.d.mts +194 -136
- package/dist/browser/index.d.ts +194 -136
- package/dist/browser/index.js +1488 -1275
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/index.mjs +1704 -1491
- package/dist/browser/index.mjs.map +1 -1
- package/dist/bundle.js +3559 -4936
- package/dist/bundle.js.map +1 -1
- package/dist/node/index.d.mts +193 -135
- package/dist/node/index.d.ts +193 -135
- package/dist/node/index.js +1882 -1598
- package/dist/node/index.js.map +1 -1
- package/dist/node/index.mjs +1295 -1013
- package/dist/node/index.mjs.map +1 -1
- package/package.json +7 -9
package/dist/node/index.d.mts
CHANGED
|
@@ -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,
|
|
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
|
import { LocalStorage } from 'node-persist';
|
|
@@ -63,10 +60,11 @@ declare function createCanvas(width: number, height: number): CompatCanvas;
|
|
|
63
60
|
declare abstract class PersistentCache<B = unknown> {
|
|
64
61
|
readonly backing: B;
|
|
65
62
|
/** Bump to invalidate every persisted entry. */
|
|
66
|
-
static readonly VERSION =
|
|
63
|
+
static readonly VERSION = 2;
|
|
67
64
|
static open(name: string): PersistentCache;
|
|
68
65
|
protected constructor(backing: B);
|
|
69
66
|
abstract get<T>(key: string): Promise<T>;
|
|
67
|
+
/** Loads a missing entry and stores only non-nullish results. */
|
|
70
68
|
getOrLoad<T>(key: string, loader: (key: string) => Promise<T>): Promise<T>;
|
|
71
69
|
abstract put<T>(key: string, value: T): Promise<T>;
|
|
72
70
|
abstract delete<T>(key: string): Promise<void>;
|
|
@@ -257,6 +255,46 @@ declare enum GuiLight {
|
|
|
257
255
|
SIDE = "side"
|
|
258
256
|
}
|
|
259
257
|
|
|
258
|
+
interface RequestConfig extends RequestInit {
|
|
259
|
+
url: string;
|
|
260
|
+
/** Prepended to relative URLs, preserving any path in the base URL. */
|
|
261
|
+
baseURL?: string;
|
|
262
|
+
/** Timeout per attempt in milliseconds, including body reading. Defaults to 5000; 0 disables it. */
|
|
263
|
+
timeout?: number;
|
|
264
|
+
responseType?: "json" | "arraybuffer";
|
|
265
|
+
}
|
|
266
|
+
interface RequestResponse<T = any> {
|
|
267
|
+
data: T;
|
|
268
|
+
status: number;
|
|
269
|
+
statusText: string;
|
|
270
|
+
headers: Headers;
|
|
271
|
+
/** Final URL after redirects. */
|
|
272
|
+
url: string;
|
|
273
|
+
}
|
|
274
|
+
declare class RequestError extends Error {
|
|
275
|
+
readonly response?: RequestResponse<undefined> | undefined;
|
|
276
|
+
readonly cause?: unknown;
|
|
277
|
+
constructor(message: string, response?: RequestResponse<undefined> | undefined, cause?: unknown);
|
|
278
|
+
}
|
|
279
|
+
declare class Requests {
|
|
280
|
+
private static genericQueue;
|
|
281
|
+
private static mcAssetRequestQueue;
|
|
282
|
+
static genericRequest(request: RequestConfig): Promise<RequestResponse>;
|
|
283
|
+
static mcAssetRequest(request: RequestConfig): Promise<RequestResponse>;
|
|
284
|
+
static setMcAssetRoot(root: string): void;
|
|
285
|
+
/** Counts unsettled calls, including retry delays and requests still running after shutdown. */
|
|
286
|
+
static get queueSizes(): {
|
|
287
|
+
generic: number;
|
|
288
|
+
mcAsset: number;
|
|
289
|
+
};
|
|
290
|
+
/**
|
|
291
|
+
* Permanently stops both queues and rejects waiting, retrying, and future requests.
|
|
292
|
+
* Requests already running can finish. Idle queues hold no timer, so Node can exit without
|
|
293
|
+
* this cleanup. See {@link shutdown}.
|
|
294
|
+
*/
|
|
295
|
+
static end(): void;
|
|
296
|
+
}
|
|
297
|
+
|
|
260
298
|
declare class WrappedImage {
|
|
261
299
|
readonly dta: ExtractableImageData;
|
|
262
300
|
constructor(dta: ExtractableImageData);
|
|
@@ -292,7 +330,7 @@ declare class ImageLoader {
|
|
|
292
330
|
static infoToData(info: ImageInfo): Promise<ImageData>;
|
|
293
331
|
static getData(src: string): Promise<ImageData>;
|
|
294
332
|
static getCanvasData(src: string): Promise<ExtractableImageData>;
|
|
295
|
-
static processResponse(response:
|
|
333
|
+
static processResponse(response: Pick<RequestResponse<ArrayBuffer>, "data" | "url">): Promise<ImageInfo>;
|
|
296
334
|
static loadInfo(src: string): Promise<ImageInfo>;
|
|
297
335
|
static getInfo(src: string): Promise<ImageInfo>;
|
|
298
336
|
static loadWrapped(src: string): Promise<WrappedImage>;
|
|
@@ -432,7 +470,7 @@ interface Transformable {
|
|
|
432
470
|
declare function isTransformable(obj: any): obj is Transformable;
|
|
433
471
|
|
|
434
472
|
declare const changeEvent: {
|
|
435
|
-
type:
|
|
473
|
+
type: "change";
|
|
436
474
|
};
|
|
437
475
|
type Maybe<T> = T | undefined;
|
|
438
476
|
declare function md5(str: string): string;
|
|
@@ -537,14 +575,13 @@ declare class MinecraftFaceUV {
|
|
|
537
575
|
}
|
|
538
576
|
|
|
539
577
|
/**
|
|
540
|
-
*
|
|
578
|
+
* Stops the shared Ticker and request queues, and clears the in-memory caches.
|
|
541
579
|
*
|
|
542
|
-
*
|
|
543
|
-
*
|
|
544
|
-
* the library is loaded. Browsers don't care, but anything headless - a render server, a CLI, a
|
|
545
|
-
* test run - has to call this when it's done.
|
|
580
|
+
* Idle Node processes can exit without calling this: cache and Ticker timers are unref'd,
|
|
581
|
+
* and idle request queues hold no timer. Pending requests keep their normal timer references.
|
|
546
582
|
*
|
|
547
|
-
*
|
|
583
|
+
* Call this only when finished with MineRender. Queued, retrying, and future requests reject;
|
|
584
|
+
* HTTP requests already running can finish. Queue shutdown is permanent, and cache expiry timers do not restart.
|
|
548
585
|
*/
|
|
549
586
|
declare function shutdown(): void;
|
|
550
587
|
|
|
@@ -617,6 +654,14 @@ declare abstract class AssetSource {
|
|
|
617
654
|
protected constructor();
|
|
618
655
|
abstract get<T extends MinecraftAsset>(key: AssetKey, parser: AssetParser | string): Promise<Maybe<T>>;
|
|
619
656
|
}
|
|
657
|
+
/** A source failed to load or parse an asset; cause retains the original failure. */
|
|
658
|
+
declare class AssetLoadError extends Error {
|
|
659
|
+
readonly source: AssetSource;
|
|
660
|
+
readonly key: AssetKey;
|
|
661
|
+
readonly path: string;
|
|
662
|
+
readonly cause: unknown;
|
|
663
|
+
constructor(source: AssetSource, key: AssetKey, path: string, cause: unknown);
|
|
664
|
+
}
|
|
620
665
|
|
|
621
666
|
declare class AssetLoader {
|
|
622
667
|
static ROOT: string;
|
|
@@ -624,6 +669,7 @@ declare class AssetLoader {
|
|
|
624
669
|
static addSource(key: string, source: AssetSource, override?: boolean): void;
|
|
625
670
|
static removeSource(key: string): Maybe<AssetSource>;
|
|
626
671
|
static getAll<T extends MinecraftAsset>(key: AssetKey, parser: AssetParser | string): Promise<T[]>;
|
|
672
|
+
/** Returns the first defined result in source-priority order, without merging assets. */
|
|
627
673
|
static get<T extends MinecraftAsset>(key: AssetKey, parser: AssetParser | string): Promise<Maybe<T>>;
|
|
628
674
|
}
|
|
629
675
|
|
|
@@ -855,6 +901,7 @@ declare class EntityObject extends SceneObject {
|
|
|
855
901
|
constructor(entity: EntityModel, options?: Partial<EntityObjectOptions>);
|
|
856
902
|
init(): Promise<void>;
|
|
857
903
|
dispose(): void;
|
|
904
|
+
private get textureKey();
|
|
858
905
|
protected loadTextures(): Promise<void>;
|
|
859
906
|
protected createMeshes(force?: boolean): void;
|
|
860
907
|
protected applyTextures(): Promise<void>;
|
|
@@ -870,9 +917,12 @@ declare class MineRenderScene extends Scene {
|
|
|
870
917
|
readonly stats: SceneStats;
|
|
871
918
|
protected readonly instanceManager: InstanceManager;
|
|
872
919
|
dirty: boolean;
|
|
920
|
+
private readonly observedObjects;
|
|
921
|
+
private readonly onObjectChange;
|
|
873
922
|
constructor(options?: DeepPartial<MineRenderSceneOptions>);
|
|
874
|
-
add(...
|
|
875
|
-
remove(...
|
|
923
|
+
add(...objects: Object3D[]): this;
|
|
924
|
+
remove(...objects: Object3D[]): this;
|
|
925
|
+
private updateObjectRegistration;
|
|
876
926
|
initAndAdd(...object: SceneObject[]): Promise<this>;
|
|
877
927
|
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>>;
|
|
878
928
|
addModel(model: Model, options?: Partial<ModelObjectOptions>, parent?: Object3D): Promise<ModelObject | InstanceReference<ModelObject>>;
|
|
@@ -884,7 +934,9 @@ interface MineRenderSceneOptions {
|
|
|
884
934
|
}
|
|
885
935
|
declare function isMineRenderScene(obj: any): obj is MineRenderScene;
|
|
886
936
|
|
|
887
|
-
declare class SceneObject extends Object3D
|
|
937
|
+
declare class SceneObject extends Object3D<Object3DEventMap & {
|
|
938
|
+
change: {};
|
|
939
|
+
}> implements Disposable, Instanceable, Transformable {
|
|
888
940
|
readonly isSceneObject: true;
|
|
889
941
|
static readonly DEFAULT_OPTIONS: SceneObjectOptions;
|
|
890
942
|
readonly options: SceneObjectOptions;
|
|
@@ -910,9 +962,9 @@ declare class SceneObject extends Object3D implements Disposable, Instanceable,
|
|
|
910
962
|
*/
|
|
911
963
|
toggleGroupVisibility(name: string, visible?: boolean): boolean;
|
|
912
964
|
protected addOrReplaceMesh(mesh: Mesh, parent: Object3D, name?: string): void;
|
|
913
|
-
protected createAndAddMesh(name?: string, group?: Object3D, geometry?: BufferGeometry, material?: Material
|
|
914
|
-
protected createMesh(name?: string, geometry?: BufferGeometry, material?: Material
|
|
915
|
-
protected createInstancedMesh(name: Maybe<string>, geometry: BufferGeometry, material: Material
|
|
965
|
+
protected createAndAddMesh(name?: string, group?: Object3D, geometry?: BufferGeometry, material?: Material | Material[], offsetAxis?: Axis, offset?: number): Mesh;
|
|
966
|
+
protected createMesh(name?: string, geometry?: BufferGeometry, material?: Material | Material[], offsetAxis?: Axis, offset?: number): Mesh;
|
|
967
|
+
protected createInstancedMesh(name: Maybe<string>, geometry: BufferGeometry, material: Material | Material[], count: number): InstancedMesh;
|
|
916
968
|
/**
|
|
917
969
|
* Get a mesh by its name
|
|
918
970
|
*/
|
|
@@ -1081,8 +1133,8 @@ interface NBTAsset extends MinecraftAsset, NBT {
|
|
|
1081
1133
|
}
|
|
1082
1134
|
|
|
1083
1135
|
interface ResponseParser<T extends MinecraftAsset> {
|
|
1084
|
-
config(request:
|
|
1085
|
-
parse(response:
|
|
1136
|
+
config(request: RequestConfig): any;
|
|
1137
|
+
parse(response: RequestResponse): Maybe<T> | Promise<Maybe<T>>;
|
|
1086
1138
|
}
|
|
1087
1139
|
|
|
1088
1140
|
declare class HostedAssetSource extends AssetSource {
|
|
@@ -1210,14 +1262,18 @@ declare class Caching {
|
|
|
1210
1262
|
static readonly mergedModelCache: AsyncLoadingCache<CacheKey, Model>;
|
|
1211
1263
|
static readonly modelTextureAtlasCache: AsyncLoadingCache<CacheKey, TextureAtlas>;
|
|
1212
1264
|
static readonly blockStateCache: AsyncLoadingCache<CacheKey, BlockState>;
|
|
1265
|
+
static readonly listAssetCache: AsyncLoadingCache<CacheKey, ListAsset>;
|
|
1266
|
+
static readonly defaultBlockStatesCache: AsyncLoadingCache<CacheKey, DefaultBlockStates>;
|
|
1267
|
+
static readonly entityModelsCache: AsyncLoadingCache<CacheKey, EntityModels>;
|
|
1268
|
+
private static createAssetCache;
|
|
1213
1269
|
/** Every cache above, so clear()/end() can never fall out of sync with the field list again. */
|
|
1214
1270
|
private static get all();
|
|
1215
1271
|
static clear(): void;
|
|
1216
1272
|
/**
|
|
1217
1273
|
* Clears every cache and stops its expiry timer.
|
|
1218
1274
|
*
|
|
1219
|
-
*
|
|
1220
|
-
*
|
|
1275
|
+
* Expiry timers are unref'd in Node, so idle processes can exit without this cleanup.
|
|
1276
|
+
* Use {@link shutdown} to also stop requests and the shared Ticker.
|
|
1221
1277
|
*/
|
|
1222
1278
|
static end(): void;
|
|
1223
1279
|
static get cacheSizes(): {};
|
|
@@ -1233,38 +1289,127 @@ declare class GuiObject extends SceneObject {
|
|
|
1233
1289
|
interface GuiObjectOptions extends SceneObjectOptions {
|
|
1234
1290
|
}
|
|
1235
1291
|
|
|
1236
|
-
declare class
|
|
1292
|
+
declare class OrbitControls {
|
|
1293
|
+
constructor(object: Camera, domElement?: HTMLElement);
|
|
1294
|
+
|
|
1295
|
+
object: Camera;
|
|
1296
|
+
domElement: HTMLElement | HTMLDocument;
|
|
1297
|
+
|
|
1298
|
+
// API
|
|
1299
|
+
enabled: boolean;
|
|
1300
|
+
target: Vector3;
|
|
1301
|
+
|
|
1302
|
+
// deprecated
|
|
1303
|
+
center: Vector3;
|
|
1304
|
+
|
|
1305
|
+
minDistance: number;
|
|
1306
|
+
maxDistance: number;
|
|
1307
|
+
|
|
1308
|
+
minZoom: number;
|
|
1309
|
+
maxZoom: number;
|
|
1310
|
+
|
|
1311
|
+
minPolarAngle: number;
|
|
1312
|
+
maxPolarAngle: number;
|
|
1313
|
+
|
|
1314
|
+
minAzimuthAngle: number;
|
|
1315
|
+
maxAzimuthAngle: number;
|
|
1316
|
+
|
|
1317
|
+
enableDamping: boolean;
|
|
1318
|
+
dampingFactor: number;
|
|
1319
|
+
|
|
1320
|
+
enableZoom: boolean;
|
|
1321
|
+
zoomSpeed: number;
|
|
1322
|
+
|
|
1323
|
+
enableRotate: boolean;
|
|
1324
|
+
rotateSpeed: number;
|
|
1325
|
+
|
|
1326
|
+
enablePan: boolean;
|
|
1327
|
+
panSpeed: number;
|
|
1328
|
+
screenSpacePanning: boolean;
|
|
1329
|
+
keyPanSpeed: number;
|
|
1330
|
+
|
|
1331
|
+
autoRotate: boolean;
|
|
1332
|
+
autoRotateSpeed: number;
|
|
1333
|
+
|
|
1334
|
+
enableKeys: boolean;
|
|
1335
|
+
keys: { LEFT: string; UP: string; RIGHT: string; BOTTOM: string };
|
|
1336
|
+
mouseButtons: { LEFT: MOUSE; MIDDLE: MOUSE; RIGHT: MOUSE };
|
|
1337
|
+
touches: { ONE: TOUCH; TWO: TOUCH };
|
|
1338
|
+
|
|
1339
|
+
update(): boolean;
|
|
1340
|
+
|
|
1341
|
+
listenToKeyEvents(domElement: HTMLElement): void;
|
|
1342
|
+
|
|
1343
|
+
saveState(): void;
|
|
1344
|
+
|
|
1345
|
+
reset(): void;
|
|
1346
|
+
|
|
1347
|
+
dispose(): void;
|
|
1348
|
+
|
|
1349
|
+
getPolarAngle(): number;
|
|
1350
|
+
|
|
1351
|
+
getAzimuthalAngle(): number;
|
|
1352
|
+
|
|
1353
|
+
getDistance(): number;
|
|
1354
|
+
|
|
1355
|
+
// EventDispatcher mixins
|
|
1356
|
+
addEventListener(type: string, listener: (event: any) => void): void;
|
|
1357
|
+
|
|
1358
|
+
hasEventListener(type: string, listener: (event: any) => void): boolean;
|
|
1359
|
+
|
|
1360
|
+
removeEventListener(type: string, listener: (event: any) => void): void;
|
|
1361
|
+
|
|
1362
|
+
dispatchEvent(event: { type: string; target: any }): void;
|
|
1363
|
+
}
|
|
1364
|
+
|
|
1365
|
+
declare class MapControls extends OrbitControls {
|
|
1366
|
+
constructor(object: Camera, domElement?: HTMLElement);
|
|
1367
|
+
}
|
|
1368
|
+
|
|
1369
|
+
declare class Renderer implements Disposable {
|
|
1237
1370
|
static readonly DEFAULT_OPTIONS: RendererOptions;
|
|
1238
1371
|
readonly options: RendererOptions;
|
|
1239
1372
|
protected _element?: HTMLElement;
|
|
1240
1373
|
protected _scene: MineRenderScene;
|
|
1241
1374
|
protected _camera: Camera;
|
|
1242
1375
|
protected _renderer: WebGLRenderer;
|
|
1243
|
-
protected _composer
|
|
1376
|
+
protected _composer?: EffectComposer;
|
|
1377
|
+
protected _controls?: OrbitControls;
|
|
1244
1378
|
protected _stats?: Stats;
|
|
1245
1379
|
protected _dirty: boolean;
|
|
1246
1380
|
protected _animationLoop: any;
|
|
1247
|
-
protected
|
|
1248
|
-
protected _animationTimer?: NodeJS.Timeout;
|
|
1249
|
-
protected _animationFrame?: number;
|
|
1381
|
+
protected _frameInterval?: number;
|
|
1250
1382
|
protected _resizeListener?: () => void;
|
|
1383
|
+
private _nextFrameTime?;
|
|
1384
|
+
private _disposed;
|
|
1385
|
+
private readonly _debugHelpers;
|
|
1386
|
+
private readonly _eventDispatchers;
|
|
1387
|
+
private readonly _changeListener;
|
|
1251
1388
|
constructor(options?: DeepPartial<RendererOptions>);
|
|
1252
1389
|
protected createScene(): MineRenderScene;
|
|
1253
1390
|
protected createCamera(): Camera;
|
|
1254
1391
|
protected createRenderer(): WebGLRenderer;
|
|
1255
|
-
protected createComposer(): EffectComposer
|
|
1392
|
+
protected createComposer(): Maybe<EffectComposer>;
|
|
1393
|
+
protected createControls(): Maybe<OrbitControls>;
|
|
1256
1394
|
init(): void;
|
|
1257
1395
|
get element(): Maybe<HTMLElement>;
|
|
1258
1396
|
appendTo(element: HTMLElement): void;
|
|
1259
1397
|
/**
|
|
1260
|
-
*
|
|
1398
|
+
* Redraws when the dispatcher emits the selected event. Registering the same pair twice has no effect.
|
|
1399
|
+
* The renderer removes its listener on disposal; the caller retains ownership of the dispatcher.
|
|
1261
1400
|
*/
|
|
1262
|
-
registerEventDispatcher(dispatcher: EventDispatcher
|
|
1401
|
+
registerEventDispatcher(dispatcher: EventDispatcher<any>, changeEvent?: string): void;
|
|
1263
1402
|
resize(width: number, height: number): void;
|
|
1264
1403
|
get dirty(): boolean;
|
|
1265
1404
|
set dirty(dirty: boolean);
|
|
1266
1405
|
start(): void;
|
|
1267
1406
|
stop(): void;
|
|
1407
|
+
/**
|
|
1408
|
+
* Stops rendering and releases owned resources. Repeated calls have no effect, and a disposed
|
|
1409
|
+
* renderer cannot be restarted. Scene objects are detached; shared assets and caller-owned
|
|
1410
|
+
* controls must be managed by their owners.
|
|
1411
|
+
*/
|
|
1412
|
+
dispose(): void;
|
|
1268
1413
|
private animate;
|
|
1269
1414
|
toImage(): string;
|
|
1270
1415
|
protected get attachedToBody(): boolean;
|
|
@@ -1273,12 +1418,15 @@ declare class Renderer {
|
|
|
1273
1418
|
get scene(): MineRenderScene;
|
|
1274
1419
|
get camera(): Camera;
|
|
1275
1420
|
get renderer(): WebGLRenderer;
|
|
1276
|
-
get composer(): EffectComposer
|
|
1421
|
+
get composer(): Maybe<EffectComposer>;
|
|
1422
|
+
/** Renderer-owned controls, or undefined when disabled at construction or after disposal. */
|
|
1423
|
+
get controls(): Maybe<OrbitControls>;
|
|
1277
1424
|
}
|
|
1278
1425
|
interface RendererOptions {
|
|
1279
1426
|
camera: CameraOptions;
|
|
1280
1427
|
render: RenderOptions;
|
|
1281
1428
|
composer: ComposerOptions;
|
|
1429
|
+
controls?: ControlsOptions;
|
|
1282
1430
|
debug: DebugOptions;
|
|
1283
1431
|
}
|
|
1284
1432
|
interface CameraOptions {
|
|
@@ -1299,6 +1447,7 @@ interface CameraOptions {
|
|
|
1299
1447
|
lookingAt: Vector3 | TripleArray;
|
|
1300
1448
|
}
|
|
1301
1449
|
interface RenderOptions {
|
|
1450
|
+
/** Maximum draw rate (60 by default); zero or a negative value disables the limit. */
|
|
1302
1451
|
fpsLimit: number;
|
|
1303
1452
|
stats: boolean;
|
|
1304
1453
|
antialias: boolean;
|
|
@@ -1309,6 +1458,9 @@ interface RenderOptions {
|
|
|
1309
1458
|
interface ComposerOptions {
|
|
1310
1459
|
enabled: boolean;
|
|
1311
1460
|
}
|
|
1461
|
+
interface ControlsOptions {
|
|
1462
|
+
enabled: boolean;
|
|
1463
|
+
}
|
|
1312
1464
|
interface DebugOptions {
|
|
1313
1465
|
grid: boolean;
|
|
1314
1466
|
axes: boolean;
|
|
@@ -1323,7 +1475,7 @@ declare class SceneInspector {
|
|
|
1323
1475
|
private selectedObject?;
|
|
1324
1476
|
constructor(renderer: Renderer);
|
|
1325
1477
|
protected init(): void;
|
|
1326
|
-
findMeshChildren(from: Object3D, out?: Mesh[]): Mesh<three.BufferGeometry
|
|
1478
|
+
findMeshChildren(from: Object3D, out?: Mesh[]): Mesh<three.BufferGeometry<three.NormalBufferAttributes>, three.Material | three.Material[], three.Object3DEventMap>[];
|
|
1327
1479
|
onClick(event: any): void;
|
|
1328
1480
|
appendTo(el: HTMLElement): void;
|
|
1329
1481
|
protected handleRaycasterObjects(intersections: Intersection[]): void;
|
|
@@ -1360,26 +1512,6 @@ declare class StatLine {
|
|
|
1360
1512
|
update(): void;
|
|
1361
1513
|
}
|
|
1362
1514
|
|
|
1363
|
-
declare class Requests {
|
|
1364
|
-
private static axiosInstance;
|
|
1365
|
-
private static mcAssetInstance;
|
|
1366
|
-
private static genericQueue;
|
|
1367
|
-
private static mcAssetRequestQueue;
|
|
1368
|
-
static genericRequest(request: AxiosRequestConfig): Promise<AxiosResponse>;
|
|
1369
|
-
static mcAssetRequest(request: AxiosRequestConfig): Promise<AxiosResponse>;
|
|
1370
|
-
private static shouldRetry;
|
|
1371
|
-
static setMcAssetRoot(root: string): void;
|
|
1372
|
-
static get queueSizes(): {
|
|
1373
|
-
generic: number;
|
|
1374
|
-
mcAsset: number;
|
|
1375
|
-
};
|
|
1376
|
-
/**
|
|
1377
|
-
* Stops both queue timers. jobqu reschedules itself indefinitely, so a Node process will not
|
|
1378
|
-
* exit until this is called - see {@link shutdown}.
|
|
1379
|
-
*/
|
|
1380
|
-
static end(): void;
|
|
1381
|
-
}
|
|
1382
|
-
|
|
1383
1515
|
type SkinGeometries = Record<SkinPart, TripleArray>;
|
|
1384
1516
|
declare const classicSkinGeometries: SkinGeometries;
|
|
1385
1517
|
declare const slimSkinGeometries: SkinGeometries;
|
|
@@ -1412,6 +1544,9 @@ declare class Skins {
|
|
|
1412
1544
|
}
|
|
1413
1545
|
|
|
1414
1546
|
declare class TextureLoader {
|
|
1547
|
+
private static readonly failedTextures;
|
|
1548
|
+
/** Reports whether image loading failed, so cached textures can be retried. */
|
|
1549
|
+
static hasFailed(texture: Texture): boolean;
|
|
1415
1550
|
protected static createTexture(): Texture;
|
|
1416
1551
|
static loadInBackground(src: string, format?: PixelFormat, rotation?: number): Texture;
|
|
1417
1552
|
static load(src: string, format?: PixelFormat, rotation?: number): Texture;
|
|
@@ -1425,91 +1560,14 @@ declare class Textures {
|
|
|
1425
1560
|
static getImage(key: TextureKey): Texture;
|
|
1426
1561
|
}
|
|
1427
1562
|
|
|
1428
|
-
declare function mergeBufferGeometries(geometries: BufferGeometry
|
|
1563
|
+
declare function mergeBufferGeometries(geometries: BufferGeometry[], useGroups?: boolean): BufferGeometry;
|
|
1429
1564
|
declare function mergeBufferAttributes(attributes: BufferAttribute[]): BufferAttribute;
|
|
1430
1565
|
declare function interleaveAttributes(attributes: BufferAttribute[]): InterleavedBufferAttribute;
|
|
1431
|
-
declare function estimateBytesUsed(geometry: BufferGeometry
|
|
1432
|
-
declare function mergeVertices(geometry: BufferGeometry
|
|
1433
|
-
declare function toTrianglesDrawMode(geometry: BufferGeometry
|
|
1566
|
+
declare function estimateBytesUsed(geometry: BufferGeometry): number;
|
|
1567
|
+
declare function mergeVertices(geometry: BufferGeometry, tolerance?: number): BufferGeometry;
|
|
1568
|
+
declare function toTrianglesDrawMode(geometry: BufferGeometry, drawMode: TrianglesDrawModes): BufferGeometry;
|
|
1434
1569
|
declare function computeMorphedAttributes(object: Mesh | Line | Points): object;
|
|
1435
1570
|
|
|
1436
|
-
declare class OrbitControls {
|
|
1437
|
-
constructor(object: Camera, domElement?: HTMLElement);
|
|
1438
|
-
|
|
1439
|
-
object: Camera;
|
|
1440
|
-
domElement: HTMLElement | HTMLDocument;
|
|
1441
|
-
|
|
1442
|
-
// API
|
|
1443
|
-
enabled: boolean;
|
|
1444
|
-
target: Vector3;
|
|
1445
|
-
|
|
1446
|
-
// deprecated
|
|
1447
|
-
center: Vector3;
|
|
1448
|
-
|
|
1449
|
-
minDistance: number;
|
|
1450
|
-
maxDistance: number;
|
|
1451
|
-
|
|
1452
|
-
minZoom: number;
|
|
1453
|
-
maxZoom: number;
|
|
1454
|
-
|
|
1455
|
-
minPolarAngle: number;
|
|
1456
|
-
maxPolarAngle: number;
|
|
1457
|
-
|
|
1458
|
-
minAzimuthAngle: number;
|
|
1459
|
-
maxAzimuthAngle: number;
|
|
1460
|
-
|
|
1461
|
-
enableDamping: boolean;
|
|
1462
|
-
dampingFactor: number;
|
|
1463
|
-
|
|
1464
|
-
enableZoom: boolean;
|
|
1465
|
-
zoomSpeed: number;
|
|
1466
|
-
|
|
1467
|
-
enableRotate: boolean;
|
|
1468
|
-
rotateSpeed: number;
|
|
1469
|
-
|
|
1470
|
-
enablePan: boolean;
|
|
1471
|
-
panSpeed: number;
|
|
1472
|
-
screenSpacePanning: boolean;
|
|
1473
|
-
keyPanSpeed: number;
|
|
1474
|
-
|
|
1475
|
-
autoRotate: boolean;
|
|
1476
|
-
autoRotateSpeed: number;
|
|
1477
|
-
|
|
1478
|
-
enableKeys: boolean;
|
|
1479
|
-
keys: { LEFT: string; UP: string; RIGHT: string; BOTTOM: string };
|
|
1480
|
-
mouseButtons: { LEFT: MOUSE; MIDDLE: MOUSE; RIGHT: MOUSE };
|
|
1481
|
-
touches: { ONE: TOUCH; TWO: TOUCH };
|
|
1482
|
-
|
|
1483
|
-
update(): boolean;
|
|
1484
|
-
|
|
1485
|
-
listenToKeyEvents(domElement: HTMLElement): void;
|
|
1486
|
-
|
|
1487
|
-
saveState(): void;
|
|
1488
|
-
|
|
1489
|
-
reset(): void;
|
|
1490
|
-
|
|
1491
|
-
dispose(): void;
|
|
1492
|
-
|
|
1493
|
-
getPolarAngle(): number;
|
|
1494
|
-
|
|
1495
|
-
getAzimuthalAngle(): number;
|
|
1496
|
-
|
|
1497
|
-
getDistance(): number;
|
|
1498
|
-
|
|
1499
|
-
// EventDispatcher mixins
|
|
1500
|
-
addEventListener(type: string, listener: (event: any) => void): void;
|
|
1501
|
-
|
|
1502
|
-
hasEventListener(type: string, listener: (event: any) => void): boolean;
|
|
1503
|
-
|
|
1504
|
-
removeEventListener(type: string, listener: (event: any) => void): void;
|
|
1505
|
-
|
|
1506
|
-
dispatchEvent(event: { type: string; target: any }): void;
|
|
1507
|
-
}
|
|
1508
|
-
|
|
1509
|
-
declare class MapControls extends OrbitControls {
|
|
1510
|
-
constructor(object: Camera, domElement?: HTMLElement);
|
|
1511
|
-
}
|
|
1512
|
-
|
|
1513
1571
|
interface BlockInfo {
|
|
1514
1572
|
block: Block;
|
|
1515
1573
|
object: BlockObject;
|
|
@@ -1604,4 +1662,4 @@ declare class NodeCache extends PersistentCache<LocalStorage> {
|
|
|
1604
1662
|
forEach<T>(callback: (v: T, k: string) => void): Promise<void>;
|
|
1605
1663
|
}
|
|
1606
1664
|
|
|
1607
|
-
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, 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, NodeCache, NodeEnv, 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, registerNodeEnv, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode };
|
|
1665
|
+
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, 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, NodeCache, NodeEnv, 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, registerNodeEnv, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode };
|