minerender 2.1.0-alpha.18 → 2.1.0-alpha.2
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 +0 -2
- package/dist/browser/index.d.mts +141 -194
- package/dist/browser/index.d.ts +141 -194
- package/dist/browser/index.js +1592 -1738
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/index.mjs +1590 -1736
- package/dist/browser/index.mjs.map +1 -1
- package/dist/bundle.js +4971 -3527
- package/dist/bundle.js.map +1 -1
- package/dist/node/index.d.mts +140 -193
- package/dist/node/index.d.ts +140 -193
- package/dist/node/index.js +1711 -1926
- package/dist/node/index.js.map +1 -1
- package/dist/node/index.mjs +1705 -1918
- package/dist/node/index.mjs.map +1 -1
- package/package.json +9 -7
package/dist/node/index.d.mts
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import * as three from 'three';
|
|
2
|
-
import { Vector3, PixelFormat, BoxGeometry, Material, Mesh, Euler, Vector2, BufferAttribute, Float32BufferAttribute,
|
|
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';
|
|
3
3
|
import * as nodeCanvas from 'canvas';
|
|
4
4
|
import { ImageData as ImageData$1, CanvasRenderingContext2D } from 'canvas';
|
|
5
|
+
import { AxiosResponse, AxiosRequestConfig } from 'axios';
|
|
5
6
|
import { Buffer as Buffer$1 } from 'buffer';
|
|
6
7
|
import { NBT } from 'prismarine-nbt';
|
|
7
8
|
import { ZipReader } from '@zip.js/zip.js';
|
|
8
9
|
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';
|
|
9
12
|
import Stats from 'stats.js';
|
|
10
13
|
import { EffectComposer } from 'postprocessing';
|
|
11
14
|
import { LocalStorage } from 'node-persist';
|
|
@@ -15,7 +18,7 @@ interface AnimatorFunction {
|
|
|
15
18
|
}
|
|
16
19
|
|
|
17
20
|
declare enum Axis {
|
|
18
|
-
X = "
|
|
21
|
+
X = "X",
|
|
19
22
|
Y = "y",
|
|
20
23
|
Z = "z"
|
|
21
24
|
}
|
|
@@ -60,11 +63,10 @@ declare function createCanvas(width: number, height: number): CompatCanvas;
|
|
|
60
63
|
declare abstract class PersistentCache<B = unknown> {
|
|
61
64
|
readonly backing: B;
|
|
62
65
|
/** Bump to invalidate every persisted entry. */
|
|
63
|
-
static readonly VERSION =
|
|
66
|
+
static readonly VERSION = 1;
|
|
64
67
|
static open(name: string): PersistentCache;
|
|
65
68
|
protected constructor(backing: B);
|
|
66
69
|
abstract get<T>(key: string): Promise<T>;
|
|
67
|
-
/** Loads a missing entry and stores only non-nullish results. */
|
|
68
70
|
getOrLoad<T>(key: string, loader: (key: string) => Promise<T>): Promise<T>;
|
|
69
71
|
abstract put<T>(key: string, value: T): Promise<T>;
|
|
70
72
|
abstract delete<T>(key: string): Promise<void>;
|
|
@@ -174,7 +176,6 @@ declare class AssetKey extends BasicAssetKey {
|
|
|
174
176
|
rootType: "assets" | "data" | string;
|
|
175
177
|
extension: ".json" | ".png" | string;
|
|
176
178
|
root?: string | undefined;
|
|
177
|
-
readonly isAssetKey: true;
|
|
178
179
|
constructor(namespace: string, path: string, assetType?: AssetType | undefined, type?: string | undefined, rootType?: "assets" | "data" | string, extension?: ".json" | ".png" | string, root?: string | undefined);
|
|
179
180
|
static parse(assetType: AssetType, str: string, origin?: AssetKey): AssetKey;
|
|
180
181
|
toString(): string;
|
|
@@ -256,46 +257,6 @@ declare enum GuiLight {
|
|
|
256
257
|
SIDE = "side"
|
|
257
258
|
}
|
|
258
259
|
|
|
259
|
-
interface RequestConfig extends RequestInit {
|
|
260
|
-
url: string;
|
|
261
|
-
/** Prepended to relative URLs, preserving any path in the base URL. */
|
|
262
|
-
baseURL?: string;
|
|
263
|
-
/** Timeout per attempt in milliseconds, including body reading. Defaults to 5000; 0 disables it. */
|
|
264
|
-
timeout?: number;
|
|
265
|
-
responseType?: "json" | "arraybuffer";
|
|
266
|
-
}
|
|
267
|
-
interface RequestResponse<T = any> {
|
|
268
|
-
data: T;
|
|
269
|
-
status: number;
|
|
270
|
-
statusText: string;
|
|
271
|
-
headers: Headers;
|
|
272
|
-
/** Final URL after redirects. */
|
|
273
|
-
url: string;
|
|
274
|
-
}
|
|
275
|
-
declare class RequestError extends Error {
|
|
276
|
-
readonly response?: RequestResponse<undefined> | undefined;
|
|
277
|
-
readonly cause?: unknown;
|
|
278
|
-
constructor(message: string, response?: RequestResponse<undefined> | undefined, cause?: unknown);
|
|
279
|
-
}
|
|
280
|
-
declare class Requests {
|
|
281
|
-
private static genericQueue;
|
|
282
|
-
private static mcAssetRequestQueue;
|
|
283
|
-
static genericRequest(request: RequestConfig): Promise<RequestResponse>;
|
|
284
|
-
static mcAssetRequest(request: RequestConfig): Promise<RequestResponse>;
|
|
285
|
-
static setMcAssetRoot(root: string): void;
|
|
286
|
-
/** Counts unsettled calls, including retry delays and requests still running after shutdown. */
|
|
287
|
-
static get queueSizes(): {
|
|
288
|
-
generic: number;
|
|
289
|
-
mcAsset: number;
|
|
290
|
-
};
|
|
291
|
-
/**
|
|
292
|
-
* Permanently stops both queues and rejects waiting, retrying, and future requests.
|
|
293
|
-
* Requests already running can finish. Idle queues hold no timer, so Node can exit without
|
|
294
|
-
* this cleanup. See {@link shutdown}.
|
|
295
|
-
*/
|
|
296
|
-
static end(): void;
|
|
297
|
-
}
|
|
298
|
-
|
|
299
260
|
declare class WrappedImage {
|
|
300
261
|
readonly dta: ExtractableImageData;
|
|
301
262
|
constructor(dta: ExtractableImageData);
|
|
@@ -331,7 +292,7 @@ declare class ImageLoader {
|
|
|
331
292
|
static infoToData(info: ImageInfo): Promise<ImageData>;
|
|
332
293
|
static getData(src: string): Promise<ImageData>;
|
|
333
294
|
static getCanvasData(src: string): Promise<ExtractableImageData>;
|
|
334
|
-
static processResponse(response:
|
|
295
|
+
static processResponse(response: Partial<AxiosResponse>): Promise<ImageInfo>;
|
|
335
296
|
static loadInfo(src: string): Promise<ImageInfo>;
|
|
336
297
|
static getInfo(src: string): Promise<ImageInfo>;
|
|
337
298
|
static loadWrapped(src: string): Promise<WrappedImage>;
|
|
@@ -471,7 +432,7 @@ interface Transformable {
|
|
|
471
432
|
declare function isTransformable(obj: any): obj is Transformable;
|
|
472
433
|
|
|
473
434
|
declare const changeEvent: {
|
|
474
|
-
type:
|
|
435
|
+
type: string;
|
|
475
436
|
};
|
|
476
437
|
type Maybe<T> = T | undefined;
|
|
477
438
|
declare function md5(str: string): string;
|
|
@@ -576,13 +537,14 @@ declare class MinecraftFaceUV {
|
|
|
576
537
|
}
|
|
577
538
|
|
|
578
539
|
/**
|
|
579
|
-
*
|
|
540
|
+
* Releases every long-lived timer MineRender holds, so a Node process can exit.
|
|
580
541
|
*
|
|
581
|
-
*
|
|
582
|
-
*
|
|
542
|
+
* Both `@inventivetalent/loading-cache` (cache expiry) and `jobqu` (request queue draining) use
|
|
543
|
+
* self-rescheduling timers that are not unref'd, which keeps the event loop alive for as long as
|
|
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.
|
|
583
546
|
*
|
|
584
|
-
*
|
|
585
|
-
* HTTP requests already running can finish. Queue shutdown is permanent, and cache expiry timers do not restart.
|
|
547
|
+
* The library stays usable afterwards; the caches and queues simply start over.
|
|
586
548
|
*/
|
|
587
549
|
declare function shutdown(): void;
|
|
588
550
|
|
|
@@ -655,14 +617,6 @@ declare abstract class AssetSource {
|
|
|
655
617
|
protected constructor();
|
|
656
618
|
abstract get<T extends MinecraftAsset>(key: AssetKey, parser: AssetParser | string): Promise<Maybe<T>>;
|
|
657
619
|
}
|
|
658
|
-
/** A source failed to load or parse an asset; cause retains the original failure. */
|
|
659
|
-
declare class AssetLoadError extends Error {
|
|
660
|
-
readonly source: AssetSource;
|
|
661
|
-
readonly key: AssetKey;
|
|
662
|
-
readonly path: string;
|
|
663
|
-
readonly cause: unknown;
|
|
664
|
-
constructor(source: AssetSource, key: AssetKey, path: string, cause: unknown);
|
|
665
|
-
}
|
|
666
620
|
|
|
667
621
|
declare class AssetLoader {
|
|
668
622
|
static ROOT: string;
|
|
@@ -670,13 +624,7 @@ declare class AssetLoader {
|
|
|
670
624
|
static addSource(key: string, source: AssetSource, override?: boolean): void;
|
|
671
625
|
static removeSource(key: string): Maybe<AssetSource>;
|
|
672
626
|
static getAll<T extends MinecraftAsset>(key: AssetKey, parser: AssetParser | string): Promise<T[]>;
|
|
673
|
-
/** Returns the first defined result in source-priority order, without merging assets. */
|
|
674
627
|
static get<T extends MinecraftAsset>(key: AssetKey, parser: AssetParser | string): Promise<Maybe<T>>;
|
|
675
|
-
/** Tries each path within a source before considering lower-priority sources. */
|
|
676
|
-
static getFirst<T extends MinecraftAsset>(keys: readonly AssetKey[], parser: AssetParser | string): Promise<Maybe<{
|
|
677
|
-
key: AssetKey;
|
|
678
|
-
asset: T;
|
|
679
|
-
}>>;
|
|
680
628
|
}
|
|
681
629
|
|
|
682
630
|
interface BlockState extends MinecraftAsset {
|
|
@@ -691,19 +639,18 @@ interface BlockStateVariant {
|
|
|
691
639
|
y?: number;
|
|
692
640
|
x?: number;
|
|
693
641
|
uvlock?: boolean;
|
|
694
|
-
weight?: number;
|
|
695
642
|
}
|
|
696
643
|
interface BlockStateMultipart {
|
|
697
|
-
when?: MultipartCondition
|
|
698
|
-
|
|
644
|
+
when?: MultipartCondition | {
|
|
645
|
+
OR: MultipartCondition[];
|
|
646
|
+
};
|
|
647
|
+
apply?: BlockStateVariant;
|
|
648
|
+
}
|
|
649
|
+
interface MultipartCondition {
|
|
650
|
+
[key: string]: string;
|
|
699
651
|
}
|
|
700
|
-
type MultipartCondition = Record<string, string> | {
|
|
701
|
-
OR: MultipartCondition[];
|
|
702
|
-
} | {
|
|
703
|
-
AND: MultipartCondition[];
|
|
704
|
-
};
|
|
705
652
|
|
|
706
|
-
declare const DEFAULT_ROOT = "https://assets.mcasset.cloud/1.
|
|
653
|
+
declare const DEFAULT_ROOT = "https://assets.mcasset.cloud/1.17.1";
|
|
707
654
|
declare const DEFAULT_NAMESPACE = "minecraft";
|
|
708
655
|
declare class Assets {
|
|
709
656
|
/**
|
|
@@ -768,8 +715,6 @@ declare class Models {
|
|
|
768
715
|
private static get PERSISTENT_CACHE();
|
|
769
716
|
static getItemList(): Promise<string[]>;
|
|
770
717
|
static loadAndMerge(key: AssetKey): Promise<Maybe<Model>>;
|
|
771
|
-
private static getItemModel;
|
|
772
|
-
private static defaultItemModel;
|
|
773
718
|
static getRaw(key: AssetKey): Promise<Maybe<Model>>;
|
|
774
719
|
static getMerged(key: AssetKey): Promise<Maybe<Model>>;
|
|
775
720
|
static get(key: AssetKey): Promise<Maybe<Model>>;
|
|
@@ -910,7 +855,6 @@ declare class EntityObject extends SceneObject {
|
|
|
910
855
|
constructor(entity: EntityModel, options?: Partial<EntityObjectOptions>);
|
|
911
856
|
init(): Promise<void>;
|
|
912
857
|
dispose(): void;
|
|
913
|
-
private get textureKey();
|
|
914
858
|
protected loadTextures(): Promise<void>;
|
|
915
859
|
protected createMeshes(force?: boolean): void;
|
|
916
860
|
protected applyTextures(): Promise<void>;
|
|
@@ -943,9 +887,7 @@ interface MineRenderSceneOptions {
|
|
|
943
887
|
}
|
|
944
888
|
declare function isMineRenderScene(obj: any): obj is MineRenderScene;
|
|
945
889
|
|
|
946
|
-
declare class SceneObject extends Object3D
|
|
947
|
-
change: {};
|
|
948
|
-
}> implements Disposable, Instanceable, Transformable {
|
|
890
|
+
declare class SceneObject extends Object3D implements Disposable, Instanceable, Transformable {
|
|
949
891
|
readonly isSceneObject: true;
|
|
950
892
|
static readonly DEFAULT_OPTIONS: SceneObjectOptions;
|
|
951
893
|
readonly options: SceneObjectOptions;
|
|
@@ -971,9 +913,9 @@ declare class SceneObject extends Object3D<Object3DEventMap & {
|
|
|
971
913
|
*/
|
|
972
914
|
toggleGroupVisibility(name: string, visible?: boolean): boolean;
|
|
973
915
|
protected addOrReplaceMesh(mesh: Mesh, parent: Object3D, name?: string): void;
|
|
974
|
-
protected createAndAddMesh(name?: string, group?: Object3D, geometry?: BufferGeometry, material?: Material | Material[], offsetAxis?: Axis, offset?: number): Mesh;
|
|
975
|
-
protected createMesh(name?: string, geometry?: BufferGeometry, material?: Material | Material[], offsetAxis?: Axis, offset?: number): Mesh;
|
|
976
|
-
protected createInstancedMesh(name: Maybe<string>, geometry: BufferGeometry, material: Material | Material[], count: number): InstancedMesh;
|
|
916
|
+
protected createAndAddMesh(name?: string, group?: Object3D, geometry?: BufferGeometry, material?: Material$1 | Material$1[], offsetAxis?: Axis, offset?: number): Mesh;
|
|
917
|
+
protected createMesh(name?: string, geometry?: BufferGeometry, material?: Material$1 | Material$1[], offsetAxis?: Axis, offset?: number): Mesh;
|
|
918
|
+
protected createInstancedMesh(name: Maybe<string>, geometry: BufferGeometry, material: Material$1 | Material$1[], count: number): InstancedMesh;
|
|
977
919
|
/**
|
|
978
920
|
* Get a mesh by its name
|
|
979
921
|
*/
|
|
@@ -1142,8 +1084,8 @@ interface NBTAsset extends MinecraftAsset, NBT {
|
|
|
1142
1084
|
}
|
|
1143
1085
|
|
|
1144
1086
|
interface ResponseParser<T extends MinecraftAsset> {
|
|
1145
|
-
config(request:
|
|
1146
|
-
parse(response:
|
|
1087
|
+
config(request: AxiosRequestConfig): any;
|
|
1088
|
+
parse(response: AxiosResponse): Maybe<T> | Promise<Maybe<T>>;
|
|
1147
1089
|
}
|
|
1148
1090
|
|
|
1149
1091
|
declare class HostedAssetSource extends AssetSource {
|
|
@@ -1271,18 +1213,14 @@ declare class Caching {
|
|
|
1271
1213
|
static readonly mergedModelCache: AsyncLoadingCache<CacheKey, Model>;
|
|
1272
1214
|
static readonly modelTextureAtlasCache: AsyncLoadingCache<CacheKey, TextureAtlas>;
|
|
1273
1215
|
static readonly blockStateCache: AsyncLoadingCache<CacheKey, BlockState>;
|
|
1274
|
-
static readonly listAssetCache: AsyncLoadingCache<CacheKey, ListAsset>;
|
|
1275
|
-
static readonly defaultBlockStatesCache: AsyncLoadingCache<CacheKey, DefaultBlockStates>;
|
|
1276
|
-
static readonly entityModelsCache: AsyncLoadingCache<CacheKey, EntityModels>;
|
|
1277
|
-
private static createAssetCache;
|
|
1278
1216
|
/** Every cache above, so clear()/end() can never fall out of sync with the field list again. */
|
|
1279
1217
|
private static get all();
|
|
1280
1218
|
static clear(): void;
|
|
1281
1219
|
/**
|
|
1282
1220
|
* Clears every cache and stops its expiry timer.
|
|
1283
1221
|
*
|
|
1284
|
-
*
|
|
1285
|
-
*
|
|
1222
|
+
* loading-cache reschedules that timer indefinitely, so a Node process will not exit until
|
|
1223
|
+
* this is called - see {@link shutdown}.
|
|
1286
1224
|
*/
|
|
1287
1225
|
static end(): void;
|
|
1288
1226
|
static get cacheSizes(): {};
|
|
@@ -1298,83 +1236,6 @@ declare class GuiObject extends SceneObject {
|
|
|
1298
1236
|
interface GuiObjectOptions extends SceneObjectOptions {
|
|
1299
1237
|
}
|
|
1300
1238
|
|
|
1301
|
-
declare class OrbitControls {
|
|
1302
|
-
constructor(object: Camera, domElement?: HTMLElement);
|
|
1303
|
-
|
|
1304
|
-
object: Camera;
|
|
1305
|
-
domElement: HTMLElement | HTMLDocument;
|
|
1306
|
-
|
|
1307
|
-
// API
|
|
1308
|
-
enabled: boolean;
|
|
1309
|
-
target: Vector3;
|
|
1310
|
-
|
|
1311
|
-
// deprecated
|
|
1312
|
-
center: Vector3;
|
|
1313
|
-
|
|
1314
|
-
minDistance: number;
|
|
1315
|
-
maxDistance: number;
|
|
1316
|
-
|
|
1317
|
-
minZoom: number;
|
|
1318
|
-
maxZoom: number;
|
|
1319
|
-
|
|
1320
|
-
minPolarAngle: number;
|
|
1321
|
-
maxPolarAngle: number;
|
|
1322
|
-
|
|
1323
|
-
minAzimuthAngle: number;
|
|
1324
|
-
maxAzimuthAngle: number;
|
|
1325
|
-
|
|
1326
|
-
enableDamping: boolean;
|
|
1327
|
-
dampingFactor: number;
|
|
1328
|
-
|
|
1329
|
-
enableZoom: boolean;
|
|
1330
|
-
zoomSpeed: number;
|
|
1331
|
-
|
|
1332
|
-
enableRotate: boolean;
|
|
1333
|
-
rotateSpeed: number;
|
|
1334
|
-
|
|
1335
|
-
enablePan: boolean;
|
|
1336
|
-
panSpeed: number;
|
|
1337
|
-
screenSpacePanning: boolean;
|
|
1338
|
-
keyPanSpeed: number;
|
|
1339
|
-
|
|
1340
|
-
autoRotate: boolean;
|
|
1341
|
-
autoRotateSpeed: number;
|
|
1342
|
-
|
|
1343
|
-
enableKeys: boolean;
|
|
1344
|
-
keys: { LEFT: string; UP: string; RIGHT: string; BOTTOM: string };
|
|
1345
|
-
mouseButtons: { LEFT: MOUSE; MIDDLE: MOUSE; RIGHT: MOUSE };
|
|
1346
|
-
touches: { ONE: TOUCH; TWO: TOUCH };
|
|
1347
|
-
|
|
1348
|
-
update(): boolean;
|
|
1349
|
-
|
|
1350
|
-
listenToKeyEvents(domElement: HTMLElement): void;
|
|
1351
|
-
|
|
1352
|
-
saveState(): void;
|
|
1353
|
-
|
|
1354
|
-
reset(): void;
|
|
1355
|
-
|
|
1356
|
-
dispose(): void;
|
|
1357
|
-
|
|
1358
|
-
getPolarAngle(): number;
|
|
1359
|
-
|
|
1360
|
-
getAzimuthalAngle(): number;
|
|
1361
|
-
|
|
1362
|
-
getDistance(): number;
|
|
1363
|
-
|
|
1364
|
-
// EventDispatcher mixins
|
|
1365
|
-
addEventListener(type: string, listener: (event: any) => void): void;
|
|
1366
|
-
|
|
1367
|
-
hasEventListener(type: string, listener: (event: any) => void): boolean;
|
|
1368
|
-
|
|
1369
|
-
removeEventListener(type: string, listener: (event: any) => void): void;
|
|
1370
|
-
|
|
1371
|
-
dispatchEvent(event: { type: string; target: any }): void;
|
|
1372
|
-
}
|
|
1373
|
-
|
|
1374
|
-
declare class MapControls extends OrbitControls {
|
|
1375
|
-
constructor(object: Camera, domElement?: HTMLElement);
|
|
1376
|
-
}
|
|
1377
|
-
|
|
1378
1239
|
declare class Renderer implements Disposable {
|
|
1379
1240
|
static readonly DEFAULT_OPTIONS: RendererOptions;
|
|
1380
1241
|
readonly options: RendererOptions;
|
|
@@ -1382,14 +1243,14 @@ declare class Renderer implements Disposable {
|
|
|
1382
1243
|
protected _scene: MineRenderScene;
|
|
1383
1244
|
protected _camera: Camera;
|
|
1384
1245
|
protected _renderer: WebGLRenderer;
|
|
1385
|
-
protected _composer
|
|
1386
|
-
protected _controls?: OrbitControls;
|
|
1246
|
+
protected _composer: EffectComposer;
|
|
1387
1247
|
protected _stats?: Stats;
|
|
1388
1248
|
protected _dirty: boolean;
|
|
1389
1249
|
protected _animationLoop: any;
|
|
1390
|
-
protected
|
|
1250
|
+
protected _fpsTimer: any;
|
|
1251
|
+
protected _animationTimer?: NodeJS.Timeout;
|
|
1252
|
+
protected _animationFrame?: number;
|
|
1391
1253
|
protected _resizeListener?: () => void;
|
|
1392
|
-
private _nextFrameTime?;
|
|
1393
1254
|
private _disposed;
|
|
1394
1255
|
private readonly _debugHelpers;
|
|
1395
1256
|
private readonly _eventDispatchers;
|
|
@@ -1398,8 +1259,7 @@ declare class Renderer implements Disposable {
|
|
|
1398
1259
|
protected createScene(): MineRenderScene;
|
|
1399
1260
|
protected createCamera(): Camera;
|
|
1400
1261
|
protected createRenderer(): WebGLRenderer;
|
|
1401
|
-
protected createComposer():
|
|
1402
|
-
protected createControls(): Maybe<OrbitControls>;
|
|
1262
|
+
protected createComposer(): EffectComposer;
|
|
1403
1263
|
init(): void;
|
|
1404
1264
|
get element(): Maybe<HTMLElement>;
|
|
1405
1265
|
appendTo(element: HTMLElement): void;
|
|
@@ -1407,7 +1267,7 @@ declare class Renderer implements Disposable {
|
|
|
1407
1267
|
* Redraws when the dispatcher emits the selected event. Registering the same pair twice has no effect.
|
|
1408
1268
|
* The renderer removes its listener on disposal; the caller retains ownership of the dispatcher.
|
|
1409
1269
|
*/
|
|
1410
|
-
registerEventDispatcher(dispatcher: EventDispatcher
|
|
1270
|
+
registerEventDispatcher(dispatcher: EventDispatcher, changeEvent?: string): void;
|
|
1411
1271
|
resize(width: number, height: number): void;
|
|
1412
1272
|
get dirty(): boolean;
|
|
1413
1273
|
set dirty(dirty: boolean);
|
|
@@ -1427,15 +1287,12 @@ declare class Renderer implements Disposable {
|
|
|
1427
1287
|
get scene(): MineRenderScene;
|
|
1428
1288
|
get camera(): Camera;
|
|
1429
1289
|
get renderer(): WebGLRenderer;
|
|
1430
|
-
get composer():
|
|
1431
|
-
/** Renderer-owned controls, or undefined when disabled at construction or after disposal. */
|
|
1432
|
-
get controls(): Maybe<OrbitControls>;
|
|
1290
|
+
get composer(): EffectComposer;
|
|
1433
1291
|
}
|
|
1434
1292
|
interface RendererOptions {
|
|
1435
1293
|
camera: CameraOptions;
|
|
1436
1294
|
render: RenderOptions;
|
|
1437
1295
|
composer: ComposerOptions;
|
|
1438
|
-
controls?: ControlsOptions;
|
|
1439
1296
|
debug: DebugOptions;
|
|
1440
1297
|
}
|
|
1441
1298
|
interface CameraOptions {
|
|
@@ -1456,7 +1313,6 @@ interface CameraOptions {
|
|
|
1456
1313
|
lookingAt: Vector3 | TripleArray;
|
|
1457
1314
|
}
|
|
1458
1315
|
interface RenderOptions {
|
|
1459
|
-
/** Maximum draw rate (60 by default); zero or a negative value disables the limit. */
|
|
1460
1316
|
fpsLimit: number;
|
|
1461
1317
|
stats: boolean;
|
|
1462
1318
|
antialias: boolean;
|
|
@@ -1467,9 +1323,6 @@ interface RenderOptions {
|
|
|
1467
1323
|
interface ComposerOptions {
|
|
1468
1324
|
enabled: boolean;
|
|
1469
1325
|
}
|
|
1470
|
-
interface ControlsOptions {
|
|
1471
|
-
enabled: boolean;
|
|
1472
|
-
}
|
|
1473
1326
|
interface DebugOptions {
|
|
1474
1327
|
grid: boolean;
|
|
1475
1328
|
axes: boolean;
|
|
@@ -1484,7 +1337,7 @@ declare class SceneInspector {
|
|
|
1484
1337
|
private selectedObject?;
|
|
1485
1338
|
constructor(renderer: Renderer);
|
|
1486
1339
|
protected init(): void;
|
|
1487
|
-
findMeshChildren(from: Object3D, out?: Mesh[]): Mesh<three.BufferGeometry
|
|
1340
|
+
findMeshChildren(from: Object3D, out?: Mesh[]): Mesh<three.BufferGeometry, three.Material | three.Material[]>[];
|
|
1488
1341
|
onClick(event: any): void;
|
|
1489
1342
|
appendTo(el: HTMLElement): void;
|
|
1490
1343
|
protected handleRaycasterObjects(intersections: Intersection[]): void;
|
|
@@ -1521,6 +1374,26 @@ declare class StatLine {
|
|
|
1521
1374
|
update(): void;
|
|
1522
1375
|
}
|
|
1523
1376
|
|
|
1377
|
+
declare class Requests {
|
|
1378
|
+
private static axiosInstance;
|
|
1379
|
+
private static mcAssetInstance;
|
|
1380
|
+
private static genericQueue;
|
|
1381
|
+
private static mcAssetRequestQueue;
|
|
1382
|
+
static genericRequest(request: AxiosRequestConfig): Promise<AxiosResponse>;
|
|
1383
|
+
static mcAssetRequest(request: AxiosRequestConfig): Promise<AxiosResponse>;
|
|
1384
|
+
private static shouldRetry;
|
|
1385
|
+
static setMcAssetRoot(root: string): void;
|
|
1386
|
+
static get queueSizes(): {
|
|
1387
|
+
generic: number;
|
|
1388
|
+
mcAsset: number;
|
|
1389
|
+
};
|
|
1390
|
+
/**
|
|
1391
|
+
* Stops both queue timers. jobqu reschedules itself indefinitely, so a Node process will not
|
|
1392
|
+
* exit until this is called - see {@link shutdown}.
|
|
1393
|
+
*/
|
|
1394
|
+
static end(): void;
|
|
1395
|
+
}
|
|
1396
|
+
|
|
1524
1397
|
type SkinGeometries = Record<SkinPart, TripleArray>;
|
|
1525
1398
|
declare const classicSkinGeometries: SkinGeometries;
|
|
1526
1399
|
declare const slimSkinGeometries: SkinGeometries;
|
|
@@ -1553,9 +1426,6 @@ declare class Skins {
|
|
|
1553
1426
|
}
|
|
1554
1427
|
|
|
1555
1428
|
declare class TextureLoader {
|
|
1556
|
-
private static readonly failedTextures;
|
|
1557
|
-
/** Reports whether image loading failed, so cached textures can be retried. */
|
|
1558
|
-
static hasFailed(texture: Texture): boolean;
|
|
1559
1429
|
protected static createTexture(): Texture;
|
|
1560
1430
|
static loadInBackground(src: string, format?: PixelFormat, rotation?: number): Texture;
|
|
1561
1431
|
static load(src: string, format?: PixelFormat, rotation?: number): Texture;
|
|
@@ -1569,14 +1439,91 @@ declare class Textures {
|
|
|
1569
1439
|
static getImage(key: TextureKey): Texture;
|
|
1570
1440
|
}
|
|
1571
1441
|
|
|
1572
|
-
declare function mergeBufferGeometries(geometries: BufferGeometry[], useGroups?: boolean): BufferGeometry;
|
|
1442
|
+
declare function mergeBufferGeometries(geometries: BufferGeometry$1[], useGroups?: boolean): BufferGeometry$1;
|
|
1573
1443
|
declare function mergeBufferAttributes(attributes: BufferAttribute[]): BufferAttribute;
|
|
1574
1444
|
declare function interleaveAttributes(attributes: BufferAttribute[]): InterleavedBufferAttribute;
|
|
1575
|
-
declare function estimateBytesUsed(geometry: BufferGeometry): number;
|
|
1576
|
-
declare function mergeVertices(geometry: BufferGeometry, tolerance?: number): BufferGeometry;
|
|
1577
|
-
declare function toTrianglesDrawMode(geometry: BufferGeometry, drawMode: TrianglesDrawModes): BufferGeometry;
|
|
1445
|
+
declare function estimateBytesUsed(geometry: BufferGeometry$1): number;
|
|
1446
|
+
declare function mergeVertices(geometry: BufferGeometry$1, tolerance?: number): BufferGeometry$1;
|
|
1447
|
+
declare function toTrianglesDrawMode(geometry: BufferGeometry$1, drawMode: TrianglesDrawModes): BufferGeometry$1;
|
|
1578
1448
|
declare function computeMorphedAttributes(object: Mesh | Line | Points): object;
|
|
1579
1449
|
|
|
1450
|
+
declare class OrbitControls {
|
|
1451
|
+
constructor(object: Camera, domElement?: HTMLElement);
|
|
1452
|
+
|
|
1453
|
+
object: Camera;
|
|
1454
|
+
domElement: HTMLElement | HTMLDocument;
|
|
1455
|
+
|
|
1456
|
+
// API
|
|
1457
|
+
enabled: boolean;
|
|
1458
|
+
target: Vector3;
|
|
1459
|
+
|
|
1460
|
+
// deprecated
|
|
1461
|
+
center: Vector3;
|
|
1462
|
+
|
|
1463
|
+
minDistance: number;
|
|
1464
|
+
maxDistance: number;
|
|
1465
|
+
|
|
1466
|
+
minZoom: number;
|
|
1467
|
+
maxZoom: number;
|
|
1468
|
+
|
|
1469
|
+
minPolarAngle: number;
|
|
1470
|
+
maxPolarAngle: number;
|
|
1471
|
+
|
|
1472
|
+
minAzimuthAngle: number;
|
|
1473
|
+
maxAzimuthAngle: number;
|
|
1474
|
+
|
|
1475
|
+
enableDamping: boolean;
|
|
1476
|
+
dampingFactor: number;
|
|
1477
|
+
|
|
1478
|
+
enableZoom: boolean;
|
|
1479
|
+
zoomSpeed: number;
|
|
1480
|
+
|
|
1481
|
+
enableRotate: boolean;
|
|
1482
|
+
rotateSpeed: number;
|
|
1483
|
+
|
|
1484
|
+
enablePan: boolean;
|
|
1485
|
+
panSpeed: number;
|
|
1486
|
+
screenSpacePanning: boolean;
|
|
1487
|
+
keyPanSpeed: number;
|
|
1488
|
+
|
|
1489
|
+
autoRotate: boolean;
|
|
1490
|
+
autoRotateSpeed: number;
|
|
1491
|
+
|
|
1492
|
+
enableKeys: boolean;
|
|
1493
|
+
keys: { LEFT: string; UP: string; RIGHT: string; BOTTOM: string };
|
|
1494
|
+
mouseButtons: { LEFT: MOUSE; MIDDLE: MOUSE; RIGHT: MOUSE };
|
|
1495
|
+
touches: { ONE: TOUCH; TWO: TOUCH };
|
|
1496
|
+
|
|
1497
|
+
update(): boolean;
|
|
1498
|
+
|
|
1499
|
+
listenToKeyEvents(domElement: HTMLElement): void;
|
|
1500
|
+
|
|
1501
|
+
saveState(): void;
|
|
1502
|
+
|
|
1503
|
+
reset(): void;
|
|
1504
|
+
|
|
1505
|
+
dispose(): void;
|
|
1506
|
+
|
|
1507
|
+
getPolarAngle(): number;
|
|
1508
|
+
|
|
1509
|
+
getAzimuthalAngle(): number;
|
|
1510
|
+
|
|
1511
|
+
getDistance(): number;
|
|
1512
|
+
|
|
1513
|
+
// EventDispatcher mixins
|
|
1514
|
+
addEventListener(type: string, listener: (event: any) => void): void;
|
|
1515
|
+
|
|
1516
|
+
hasEventListener(type: string, listener: (event: any) => void): boolean;
|
|
1517
|
+
|
|
1518
|
+
removeEventListener(type: string, listener: (event: any) => void): void;
|
|
1519
|
+
|
|
1520
|
+
dispatchEvent(event: { type: string; target: any }): void;
|
|
1521
|
+
}
|
|
1522
|
+
|
|
1523
|
+
declare class MapControls extends OrbitControls {
|
|
1524
|
+
constructor(object: Camera, domElement?: HTMLElement);
|
|
1525
|
+
}
|
|
1526
|
+
|
|
1580
1527
|
interface BlockInfo {
|
|
1581
1528
|
block: Block;
|
|
1582
1529
|
object: BlockObject;
|
|
@@ -1671,4 +1618,4 @@ declare class NodeCache extends PersistentCache<LocalStorage> {
|
|
|
1671
1618
|
forEach<T>(callback: (v: T, k: string) => void): Promise<void>;
|
|
1672
1619
|
}
|
|
1673
1620
|
|
|
1674
|
-
export { AXES, type AnimationFrame, type AnimationMeta, type AnimatorFunction, ArchiveAssetSource, type ArchiveEntry, type ArchiveProxy, AssetKey,
|
|
1621
|
+
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 };
|