minerender 2.1.0-alpha.0 → 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 +1 -1
- package/dist/browser/index.d.mts +187 -137
- package/dist/browser/index.d.ts +187 -137
- package/dist/browser/index.js +1378 -1130
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/index.mjs +1392 -1144
- package/dist/browser/index.mjs.map +1 -1
- package/dist/bundle.js +7531 -8873
- package/dist/bundle.js.map +1 -1
- package/dist/node/index.d.mts +186 -136
- package/dist/node/index.d.ts +186 -136
- package/dist/node/index.js +1598 -1280
- package/dist/node/index.js.map +1 -1
- package/dist/node/index.mjs +1550 -1233
- package/dist/node/index.mjs.map +1 -1
- package/package.json +11 -13
- package/.worktrees/jobqu-review/LICENSE +0 -21
- package/.worktrees/jobqu-review/README.md +0 -176
- package/.worktrees/v2-asset-sources/LICENSE +0 -21
- package/.worktrees/v2-asset-sources/README.md +0 -30
- package/.worktrees/v2-asset-sources/examples/script-tag/README.md +0 -13
- package/.worktrees/v2-asset-sources/examples/vite/README.md +0 -13
- package/.worktrees/v2-asset-sources/packages/minerender/LICENSE +0 -21
- package/.worktrees/v2-asset-sources/packages/minerender/README.md +0 -24
- package/.worktrees/v2-brightness/LICENSE +0 -21
- package/.worktrees/v2-brightness/README.md +0 -30
- package/.worktrees/v2-brightness/examples/script-tag/README.md +0 -13
- package/.worktrees/v2-brightness/examples/vite/README.md +0 -13
- package/.worktrees/v2-brightness/packages/minerender/LICENSE +0 -21
- package/.worktrees/v2-brightness/packages/minerender/README.md +0 -24
- package/.worktrees/v2-cache-recovery/LICENSE +0 -21
- package/.worktrees/v2-cache-recovery/README.md +0 -30
- package/.worktrees/v2-cache-recovery/examples/script-tag/README.md +0 -13
- package/.worktrees/v2-cache-recovery/examples/vite/README.md +0 -13
- package/.worktrees/v2-cache-recovery/packages/minerender/LICENSE +0 -21
- package/.worktrees/v2-cache-recovery/packages/minerender/README.md +0 -24
- package/.worktrees/v2-ci-stack/LICENSE +0 -21
- package/.worktrees/v2-ci-stack/README.md +0 -109
- package/.worktrees/v2-ci-stack/examples/script-tag/README.md +0 -15
- package/.worktrees/v2-ci-stack/examples/vite/README.md +0 -15
- package/.worktrees/v2-ci-stack/packages/minerender/LICENSE +0 -21
- package/.worktrees/v2-ci-stack/packages/minerender/README.md +0 -11
- package/.worktrees/v2-ci-typescript/LICENSE +0 -21
- package/.worktrees/v2-ci-typescript/README.md +0 -11
- package/.worktrees/v2-controls/LICENSE +0 -21
- package/.worktrees/v2-controls/README.md +0 -30
- package/.worktrees/v2-controls/examples/script-tag/README.md +0 -13
- package/.worktrees/v2-controls/examples/vite/README.md +0 -13
- package/.worktrees/v2-controls/packages/minerender/LICENSE +0 -21
- package/.worktrees/v2-controls/packages/minerender/README.md +0 -24
- package/.worktrees/v2-dependencies/LICENSE +0 -21
- package/.worktrees/v2-dependencies/README.md +0 -30
- package/.worktrees/v2-dependencies/examples/script-tag/README.md +0 -13
- package/.worktrees/v2-dependencies/examples/vite/README.md +0 -13
- package/.worktrees/v2-dependencies/packages/minerender/LICENSE +0 -21
- package/.worktrees/v2-dependencies/packages/minerender/README.md +0 -24
- package/.worktrees/v2-frame-limit/LICENSE +0 -21
- package/.worktrees/v2-frame-limit/README.md +0 -30
- package/.worktrees/v2-frame-limit/examples/script-tag/README.md +0 -13
- package/.worktrees/v2-frame-limit/examples/vite/README.md +0 -13
- package/.worktrees/v2-frame-limit/packages/minerender/LICENSE +0 -21
- package/.worktrees/v2-frame-limit/packages/minerender/README.md +0 -24
- package/.worktrees/v2-images/LICENSE +0 -21
- package/.worktrees/v2-images/README.md +0 -30
- package/.worktrees/v2-images/examples/script-tag/README.md +0 -13
- package/.worktrees/v2-images/examples/vite/README.md +0 -13
- package/.worktrees/v2-images/packages/minerender/LICENSE +0 -21
- package/.worktrees/v2-images/packages/minerender/README.md +0 -24
- package/.worktrees/v2-lifecycle/LICENSE +0 -21
- package/.worktrees/v2-lifecycle/README.md +0 -30
- package/.worktrees/v2-lifecycle/examples/script-tag/README.md +0 -13
- package/.worktrees/v2-lifecycle/examples/vite/README.md +0 -13
- package/.worktrees/v2-lifecycle/packages/minerender/LICENSE +0 -21
- package/.worktrees/v2-lifecycle/packages/minerender/README.md +0 -24
- package/.worktrees/v2-main-conflicts/LICENSE +0 -21
- package/.worktrees/v2-main-conflicts/README.md +0 -11
- package/.worktrees/v2-monorepo/LICENSE +0 -21
- package/.worktrees/v2-monorepo/README.md +0 -30
- package/.worktrees/v2-monorepo/examples/script-tag/README.md +0 -13
- package/.worktrees/v2-monorepo/examples/vite/README.md +0 -13
- package/.worktrees/v2-monorepo/packages/minerender/LICENSE +0 -21
- package/.worktrees/v2-monorepo/packages/minerender/README.md +0 -24
- package/.worktrees/v2-requests/LICENSE +0 -21
- package/.worktrees/v2-requests/README.md +0 -30
- package/.worktrees/v2-requests/examples/script-tag/README.md +0 -13
- package/.worktrees/v2-requests/examples/vite/README.md +0 -13
- package/.worktrees/v2-requests/packages/minerender/LICENSE +0 -21
- package/.worktrees/v2-requests/packages/minerender/README.md +0 -26
- package/.worktrees/v2-source-errors/LICENSE +0 -21
- package/.worktrees/v2-source-errors/README.md +0 -30
- package/.worktrees/v2-source-errors/examples/script-tag/README.md +0 -13
- package/.worktrees/v2-source-errors/examples/vite/README.md +0 -13
- package/.worktrees/v2-source-errors/packages/minerender/LICENSE +0 -21
- package/.worktrees/v2-source-errors/packages/minerender/README.md +0 -26
package/dist/node/index.d.ts
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
|
|
|
@@ -624,6 +661,7 @@ declare class AssetLoader {
|
|
|
624
661
|
static addSource(key: string, source: AssetSource, override?: boolean): void;
|
|
625
662
|
static removeSource(key: string): Maybe<AssetSource>;
|
|
626
663
|
static getAll<T extends MinecraftAsset>(key: AssetKey, parser: AssetParser | string): Promise<T[]>;
|
|
664
|
+
/** Returns the first defined result in source-priority order, without merging assets. */
|
|
627
665
|
static get<T extends MinecraftAsset>(key: AssetKey, parser: AssetParser | string): Promise<Maybe<T>>;
|
|
628
666
|
}
|
|
629
667
|
|
|
@@ -650,7 +688,7 @@ interface MultipartCondition {
|
|
|
650
688
|
[key: string]: string;
|
|
651
689
|
}
|
|
652
690
|
|
|
653
|
-
declare const DEFAULT_ROOT = "https://
|
|
691
|
+
declare const DEFAULT_ROOT = "https://assets.mcasset.cloud/1.17.1";
|
|
654
692
|
declare const DEFAULT_NAMESPACE = "minecraft";
|
|
655
693
|
declare class Assets {
|
|
656
694
|
/**
|
|
@@ -855,6 +893,7 @@ declare class EntityObject extends SceneObject {
|
|
|
855
893
|
constructor(entity: EntityModel, options?: Partial<EntityObjectOptions>);
|
|
856
894
|
init(): Promise<void>;
|
|
857
895
|
dispose(): void;
|
|
896
|
+
private get textureKey();
|
|
858
897
|
protected loadTextures(): Promise<void>;
|
|
859
898
|
protected createMeshes(force?: boolean): void;
|
|
860
899
|
protected applyTextures(): Promise<void>;
|
|
@@ -870,9 +909,12 @@ declare class MineRenderScene extends Scene {
|
|
|
870
909
|
readonly stats: SceneStats;
|
|
871
910
|
protected readonly instanceManager: InstanceManager;
|
|
872
911
|
dirty: boolean;
|
|
912
|
+
private readonly observedObjects;
|
|
913
|
+
private readonly onObjectChange;
|
|
873
914
|
constructor(options?: DeepPartial<MineRenderSceneOptions>);
|
|
874
|
-
add(...
|
|
875
|
-
remove(...
|
|
915
|
+
add(...objects: Object3D[]): this;
|
|
916
|
+
remove(...objects: Object3D[]): this;
|
|
917
|
+
private updateObjectRegistration;
|
|
876
918
|
initAndAdd(...object: SceneObject[]): Promise<this>;
|
|
877
919
|
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
920
|
addModel(model: Model, options?: Partial<ModelObjectOptions>, parent?: Object3D): Promise<ModelObject | InstanceReference<ModelObject>>;
|
|
@@ -884,7 +926,9 @@ interface MineRenderSceneOptions {
|
|
|
884
926
|
}
|
|
885
927
|
declare function isMineRenderScene(obj: any): obj is MineRenderScene;
|
|
886
928
|
|
|
887
|
-
declare class SceneObject extends Object3D
|
|
929
|
+
declare class SceneObject extends Object3D<Object3DEventMap & {
|
|
930
|
+
change: {};
|
|
931
|
+
}> implements Disposable, Instanceable, Transformable {
|
|
888
932
|
readonly isSceneObject: true;
|
|
889
933
|
static readonly DEFAULT_OPTIONS: SceneObjectOptions;
|
|
890
934
|
readonly options: SceneObjectOptions;
|
|
@@ -910,9 +954,9 @@ declare class SceneObject extends Object3D implements Disposable, Instanceable,
|
|
|
910
954
|
*/
|
|
911
955
|
toggleGroupVisibility(name: string, visible?: boolean): boolean;
|
|
912
956
|
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
|
|
957
|
+
protected createAndAddMesh(name?: string, group?: Object3D, geometry?: BufferGeometry, material?: Material | Material[], offsetAxis?: Axis, offset?: number): Mesh;
|
|
958
|
+
protected createMesh(name?: string, geometry?: BufferGeometry, material?: Material | Material[], offsetAxis?: Axis, offset?: number): Mesh;
|
|
959
|
+
protected createInstancedMesh(name: Maybe<string>, geometry: BufferGeometry, material: Material | Material[], count: number): InstancedMesh;
|
|
916
960
|
/**
|
|
917
961
|
* Get a mesh by its name
|
|
918
962
|
*/
|
|
@@ -1081,8 +1125,8 @@ interface NBTAsset extends MinecraftAsset, NBT {
|
|
|
1081
1125
|
}
|
|
1082
1126
|
|
|
1083
1127
|
interface ResponseParser<T extends MinecraftAsset> {
|
|
1084
|
-
config(request:
|
|
1085
|
-
parse(response:
|
|
1128
|
+
config(request: RequestConfig): any;
|
|
1129
|
+
parse(response: RequestResponse): Maybe<T> | Promise<Maybe<T>>;
|
|
1086
1130
|
}
|
|
1087
1131
|
|
|
1088
1132
|
declare class HostedAssetSource extends AssetSource {
|
|
@@ -1210,14 +1254,18 @@ declare class Caching {
|
|
|
1210
1254
|
static readonly mergedModelCache: AsyncLoadingCache<CacheKey, Model>;
|
|
1211
1255
|
static readonly modelTextureAtlasCache: AsyncLoadingCache<CacheKey, TextureAtlas>;
|
|
1212
1256
|
static readonly blockStateCache: AsyncLoadingCache<CacheKey, BlockState>;
|
|
1257
|
+
static readonly listAssetCache: AsyncLoadingCache<CacheKey, ListAsset>;
|
|
1258
|
+
static readonly defaultBlockStatesCache: AsyncLoadingCache<CacheKey, DefaultBlockStates>;
|
|
1259
|
+
static readonly entityModelsCache: AsyncLoadingCache<CacheKey, EntityModels>;
|
|
1260
|
+
private static createAssetCache;
|
|
1213
1261
|
/** Every cache above, so clear()/end() can never fall out of sync with the field list again. */
|
|
1214
1262
|
private static get all();
|
|
1215
1263
|
static clear(): void;
|
|
1216
1264
|
/**
|
|
1217
1265
|
* Clears every cache and stops its expiry timer.
|
|
1218
1266
|
*
|
|
1219
|
-
*
|
|
1220
|
-
*
|
|
1267
|
+
* Expiry timers are unref'd in Node, so idle processes can exit without this cleanup.
|
|
1268
|
+
* Use {@link shutdown} to also stop requests and the shared Ticker.
|
|
1221
1269
|
*/
|
|
1222
1270
|
static end(): void;
|
|
1223
1271
|
static get cacheSizes(): {};
|
|
@@ -1233,38 +1281,127 @@ declare class GuiObject extends SceneObject {
|
|
|
1233
1281
|
interface GuiObjectOptions extends SceneObjectOptions {
|
|
1234
1282
|
}
|
|
1235
1283
|
|
|
1236
|
-
declare class
|
|
1284
|
+
declare class OrbitControls {
|
|
1285
|
+
constructor(object: Camera, domElement?: HTMLElement);
|
|
1286
|
+
|
|
1287
|
+
object: Camera;
|
|
1288
|
+
domElement: HTMLElement | HTMLDocument;
|
|
1289
|
+
|
|
1290
|
+
// API
|
|
1291
|
+
enabled: boolean;
|
|
1292
|
+
target: Vector3;
|
|
1293
|
+
|
|
1294
|
+
// deprecated
|
|
1295
|
+
center: Vector3;
|
|
1296
|
+
|
|
1297
|
+
minDistance: number;
|
|
1298
|
+
maxDistance: number;
|
|
1299
|
+
|
|
1300
|
+
minZoom: number;
|
|
1301
|
+
maxZoom: number;
|
|
1302
|
+
|
|
1303
|
+
minPolarAngle: number;
|
|
1304
|
+
maxPolarAngle: number;
|
|
1305
|
+
|
|
1306
|
+
minAzimuthAngle: number;
|
|
1307
|
+
maxAzimuthAngle: number;
|
|
1308
|
+
|
|
1309
|
+
enableDamping: boolean;
|
|
1310
|
+
dampingFactor: number;
|
|
1311
|
+
|
|
1312
|
+
enableZoom: boolean;
|
|
1313
|
+
zoomSpeed: number;
|
|
1314
|
+
|
|
1315
|
+
enableRotate: boolean;
|
|
1316
|
+
rotateSpeed: number;
|
|
1317
|
+
|
|
1318
|
+
enablePan: boolean;
|
|
1319
|
+
panSpeed: number;
|
|
1320
|
+
screenSpacePanning: boolean;
|
|
1321
|
+
keyPanSpeed: number;
|
|
1322
|
+
|
|
1323
|
+
autoRotate: boolean;
|
|
1324
|
+
autoRotateSpeed: number;
|
|
1325
|
+
|
|
1326
|
+
enableKeys: boolean;
|
|
1327
|
+
keys: { LEFT: string; UP: string; RIGHT: string; BOTTOM: string };
|
|
1328
|
+
mouseButtons: { LEFT: MOUSE; MIDDLE: MOUSE; RIGHT: MOUSE };
|
|
1329
|
+
touches: { ONE: TOUCH; TWO: TOUCH };
|
|
1330
|
+
|
|
1331
|
+
update(): boolean;
|
|
1332
|
+
|
|
1333
|
+
listenToKeyEvents(domElement: HTMLElement): void;
|
|
1334
|
+
|
|
1335
|
+
saveState(): void;
|
|
1336
|
+
|
|
1337
|
+
reset(): void;
|
|
1338
|
+
|
|
1339
|
+
dispose(): void;
|
|
1340
|
+
|
|
1341
|
+
getPolarAngle(): number;
|
|
1342
|
+
|
|
1343
|
+
getAzimuthalAngle(): number;
|
|
1344
|
+
|
|
1345
|
+
getDistance(): number;
|
|
1346
|
+
|
|
1347
|
+
// EventDispatcher mixins
|
|
1348
|
+
addEventListener(type: string, listener: (event: any) => void): void;
|
|
1349
|
+
|
|
1350
|
+
hasEventListener(type: string, listener: (event: any) => void): boolean;
|
|
1351
|
+
|
|
1352
|
+
removeEventListener(type: string, listener: (event: any) => void): void;
|
|
1353
|
+
|
|
1354
|
+
dispatchEvent(event: { type: string; target: any }): void;
|
|
1355
|
+
}
|
|
1356
|
+
|
|
1357
|
+
declare class MapControls extends OrbitControls {
|
|
1358
|
+
constructor(object: Camera, domElement?: HTMLElement);
|
|
1359
|
+
}
|
|
1360
|
+
|
|
1361
|
+
declare class Renderer implements Disposable {
|
|
1237
1362
|
static readonly DEFAULT_OPTIONS: RendererOptions;
|
|
1238
1363
|
readonly options: RendererOptions;
|
|
1239
1364
|
protected _element?: HTMLElement;
|
|
1240
1365
|
protected _scene: MineRenderScene;
|
|
1241
1366
|
protected _camera: Camera;
|
|
1242
1367
|
protected _renderer: WebGLRenderer;
|
|
1243
|
-
protected _composer
|
|
1368
|
+
protected _composer?: EffectComposer;
|
|
1369
|
+
protected _controls?: OrbitControls;
|
|
1244
1370
|
protected _stats?: Stats;
|
|
1245
1371
|
protected _dirty: boolean;
|
|
1246
1372
|
protected _animationLoop: any;
|
|
1247
|
-
protected
|
|
1248
|
-
protected _animationTimer?: NodeJS.Timeout;
|
|
1249
|
-
protected _animationFrame?: number;
|
|
1373
|
+
protected _frameInterval?: number;
|
|
1250
1374
|
protected _resizeListener?: () => void;
|
|
1375
|
+
private _nextFrameTime?;
|
|
1376
|
+
private _disposed;
|
|
1377
|
+
private readonly _debugHelpers;
|
|
1378
|
+
private readonly _eventDispatchers;
|
|
1379
|
+
private readonly _changeListener;
|
|
1251
1380
|
constructor(options?: DeepPartial<RendererOptions>);
|
|
1252
1381
|
protected createScene(): MineRenderScene;
|
|
1253
1382
|
protected createCamera(): Camera;
|
|
1254
1383
|
protected createRenderer(): WebGLRenderer;
|
|
1255
|
-
protected createComposer(): EffectComposer
|
|
1384
|
+
protected createComposer(): Maybe<EffectComposer>;
|
|
1385
|
+
protected createControls(): Maybe<OrbitControls>;
|
|
1256
1386
|
init(): void;
|
|
1257
1387
|
get element(): Maybe<HTMLElement>;
|
|
1258
1388
|
appendTo(element: HTMLElement): void;
|
|
1259
1389
|
/**
|
|
1260
|
-
*
|
|
1390
|
+
* Redraws when the dispatcher emits the selected event. Registering the same pair twice has no effect.
|
|
1391
|
+
* The renderer removes its listener on disposal; the caller retains ownership of the dispatcher.
|
|
1261
1392
|
*/
|
|
1262
|
-
registerEventDispatcher(dispatcher: EventDispatcher
|
|
1393
|
+
registerEventDispatcher(dispatcher: EventDispatcher<any>, changeEvent?: string): void;
|
|
1263
1394
|
resize(width: number, height: number): void;
|
|
1264
1395
|
get dirty(): boolean;
|
|
1265
1396
|
set dirty(dirty: boolean);
|
|
1266
1397
|
start(): void;
|
|
1267
1398
|
stop(): void;
|
|
1399
|
+
/**
|
|
1400
|
+
* Stops rendering and releases owned resources. Repeated calls have no effect, and a disposed
|
|
1401
|
+
* renderer cannot be restarted. Scene objects are detached; shared assets and caller-owned
|
|
1402
|
+
* controls must be managed by their owners.
|
|
1403
|
+
*/
|
|
1404
|
+
dispose(): void;
|
|
1268
1405
|
private animate;
|
|
1269
1406
|
toImage(): string;
|
|
1270
1407
|
protected get attachedToBody(): boolean;
|
|
@@ -1273,12 +1410,15 @@ declare class Renderer {
|
|
|
1273
1410
|
get scene(): MineRenderScene;
|
|
1274
1411
|
get camera(): Camera;
|
|
1275
1412
|
get renderer(): WebGLRenderer;
|
|
1276
|
-
get composer(): EffectComposer
|
|
1413
|
+
get composer(): Maybe<EffectComposer>;
|
|
1414
|
+
/** Renderer-owned controls, or undefined when disabled at construction or after disposal. */
|
|
1415
|
+
get controls(): Maybe<OrbitControls>;
|
|
1277
1416
|
}
|
|
1278
1417
|
interface RendererOptions {
|
|
1279
1418
|
camera: CameraOptions;
|
|
1280
1419
|
render: RenderOptions;
|
|
1281
1420
|
composer: ComposerOptions;
|
|
1421
|
+
controls?: ControlsOptions;
|
|
1282
1422
|
debug: DebugOptions;
|
|
1283
1423
|
}
|
|
1284
1424
|
interface CameraOptions {
|
|
@@ -1299,6 +1439,7 @@ interface CameraOptions {
|
|
|
1299
1439
|
lookingAt: Vector3 | TripleArray;
|
|
1300
1440
|
}
|
|
1301
1441
|
interface RenderOptions {
|
|
1442
|
+
/** Maximum draw rate (60 by default); zero or a negative value disables the limit. */
|
|
1302
1443
|
fpsLimit: number;
|
|
1303
1444
|
stats: boolean;
|
|
1304
1445
|
antialias: boolean;
|
|
@@ -1309,6 +1450,9 @@ interface RenderOptions {
|
|
|
1309
1450
|
interface ComposerOptions {
|
|
1310
1451
|
enabled: boolean;
|
|
1311
1452
|
}
|
|
1453
|
+
interface ControlsOptions {
|
|
1454
|
+
enabled: boolean;
|
|
1455
|
+
}
|
|
1312
1456
|
interface DebugOptions {
|
|
1313
1457
|
grid: boolean;
|
|
1314
1458
|
axes: boolean;
|
|
@@ -1323,7 +1467,7 @@ declare class SceneInspector {
|
|
|
1323
1467
|
private selectedObject?;
|
|
1324
1468
|
constructor(renderer: Renderer);
|
|
1325
1469
|
protected init(): void;
|
|
1326
|
-
findMeshChildren(from: Object3D, out?: Mesh[]): Mesh<three.BufferGeometry
|
|
1470
|
+
findMeshChildren(from: Object3D, out?: Mesh[]): Mesh<three.BufferGeometry<three.NormalBufferAttributes>, three.Material | three.Material[], three.Object3DEventMap>[];
|
|
1327
1471
|
onClick(event: any): void;
|
|
1328
1472
|
appendTo(el: HTMLElement): void;
|
|
1329
1473
|
protected handleRaycasterObjects(intersections: Intersection[]): void;
|
|
@@ -1360,26 +1504,6 @@ declare class StatLine {
|
|
|
1360
1504
|
update(): void;
|
|
1361
1505
|
}
|
|
1362
1506
|
|
|
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
1507
|
type SkinGeometries = Record<SkinPart, TripleArray>;
|
|
1384
1508
|
declare const classicSkinGeometries: SkinGeometries;
|
|
1385
1509
|
declare const slimSkinGeometries: SkinGeometries;
|
|
@@ -1412,6 +1536,9 @@ declare class Skins {
|
|
|
1412
1536
|
}
|
|
1413
1537
|
|
|
1414
1538
|
declare class TextureLoader {
|
|
1539
|
+
private static readonly failedTextures;
|
|
1540
|
+
/** Reports whether image loading failed, so cached textures can be retried. */
|
|
1541
|
+
static hasFailed(texture: Texture): boolean;
|
|
1415
1542
|
protected static createTexture(): Texture;
|
|
1416
1543
|
static loadInBackground(src: string, format?: PixelFormat, rotation?: number): Texture;
|
|
1417
1544
|
static load(src: string, format?: PixelFormat, rotation?: number): Texture;
|
|
@@ -1425,91 +1552,14 @@ declare class Textures {
|
|
|
1425
1552
|
static getImage(key: TextureKey): Texture;
|
|
1426
1553
|
}
|
|
1427
1554
|
|
|
1428
|
-
declare function mergeBufferGeometries(geometries: BufferGeometry
|
|
1555
|
+
declare function mergeBufferGeometries(geometries: BufferGeometry[], useGroups?: boolean): BufferGeometry;
|
|
1429
1556
|
declare function mergeBufferAttributes(attributes: BufferAttribute[]): BufferAttribute;
|
|
1430
1557
|
declare function interleaveAttributes(attributes: BufferAttribute[]): InterleavedBufferAttribute;
|
|
1431
|
-
declare function estimateBytesUsed(geometry: BufferGeometry
|
|
1432
|
-
declare function mergeVertices(geometry: BufferGeometry
|
|
1433
|
-
declare function toTrianglesDrawMode(geometry: BufferGeometry
|
|
1558
|
+
declare function estimateBytesUsed(geometry: BufferGeometry): number;
|
|
1559
|
+
declare function mergeVertices(geometry: BufferGeometry, tolerance?: number): BufferGeometry;
|
|
1560
|
+
declare function toTrianglesDrawMode(geometry: BufferGeometry, drawMode: TrianglesDrawModes): BufferGeometry;
|
|
1434
1561
|
declare function computeMorphedAttributes(object: Mesh | Line | Points): object;
|
|
1435
1562
|
|
|
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
1563
|
interface BlockInfo {
|
|
1514
1564
|
block: Block;
|
|
1515
1565
|
object: BlockObject;
|
|
@@ -1604,4 +1654,4 @@ declare class NodeCache extends PersistentCache<LocalStorage> {
|
|
|
1604
1654
|
forEach<T>(callback: (v: T, k: string) => void): Promise<void>;
|
|
1605
1655
|
}
|
|
1606
1656
|
|
|
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 };
|
|
1657
|
+
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 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 };
|