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/browser/index.d.ts
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
|
|
|
@@ -14,7 +17,7 @@ interface AnimatorFunction {
|
|
|
14
17
|
}
|
|
15
18
|
|
|
16
19
|
declare enum Axis {
|
|
17
|
-
X = "
|
|
20
|
+
X = "X",
|
|
18
21
|
Y = "y",
|
|
19
22
|
Z = "z"
|
|
20
23
|
}
|
|
@@ -59,11 +62,10 @@ declare function createCanvas(width: number, height: number): CompatCanvas;
|
|
|
59
62
|
declare abstract class PersistentCache<B = unknown> {
|
|
60
63
|
readonly backing: B;
|
|
61
64
|
/** Bump to invalidate every persisted entry. */
|
|
62
|
-
static readonly VERSION =
|
|
65
|
+
static readonly VERSION = 1;
|
|
63
66
|
static open(name: string): PersistentCache;
|
|
64
67
|
protected constructor(backing: B);
|
|
65
68
|
abstract get<T>(key: string): Promise<T>;
|
|
66
|
-
/** Loads a missing entry and stores only non-nullish results. */
|
|
67
69
|
getOrLoad<T>(key: string, loader: (key: string) => Promise<T>): Promise<T>;
|
|
68
70
|
abstract put<T>(key: string, value: T): Promise<T>;
|
|
69
71
|
abstract delete<T>(key: string): Promise<void>;
|
|
@@ -173,7 +175,6 @@ declare class AssetKey extends BasicAssetKey {
|
|
|
173
175
|
rootType: "assets" | "data" | string;
|
|
174
176
|
extension: ".json" | ".png" | string;
|
|
175
177
|
root?: string | undefined;
|
|
176
|
-
readonly isAssetKey: true;
|
|
177
178
|
constructor(namespace: string, path: string, assetType?: AssetType | undefined, type?: string | undefined, rootType?: "assets" | "data" | string, extension?: ".json" | ".png" | string, root?: string | undefined);
|
|
178
179
|
static parse(assetType: AssetType, str: string, origin?: AssetKey): AssetKey;
|
|
179
180
|
toString(): string;
|
|
@@ -255,46 +256,6 @@ declare enum GuiLight {
|
|
|
255
256
|
SIDE = "side"
|
|
256
257
|
}
|
|
257
258
|
|
|
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
|
-
|
|
298
259
|
declare class WrappedImage {
|
|
299
260
|
readonly dta: ExtractableImageData;
|
|
300
261
|
constructor(dta: ExtractableImageData);
|
|
@@ -330,7 +291,7 @@ declare class ImageLoader {
|
|
|
330
291
|
static infoToData(info: ImageInfo): Promise<ImageData>;
|
|
331
292
|
static getData(src: string): Promise<ImageData>;
|
|
332
293
|
static getCanvasData(src: string): Promise<ExtractableImageData>;
|
|
333
|
-
static processResponse(response:
|
|
294
|
+
static processResponse(response: Partial<AxiosResponse>): Promise<ImageInfo>;
|
|
334
295
|
static loadInfo(src: string): Promise<ImageInfo>;
|
|
335
296
|
static getInfo(src: string): Promise<ImageInfo>;
|
|
336
297
|
static loadWrapped(src: string): Promise<WrappedImage>;
|
|
@@ -470,7 +431,7 @@ interface Transformable {
|
|
|
470
431
|
declare function isTransformable(obj: any): obj is Transformable;
|
|
471
432
|
|
|
472
433
|
declare const changeEvent: {
|
|
473
|
-
type:
|
|
434
|
+
type: string;
|
|
474
435
|
};
|
|
475
436
|
type Maybe<T> = T | undefined;
|
|
476
437
|
declare function md5(str: string): string;
|
|
@@ -575,13 +536,14 @@ declare class MinecraftFaceUV {
|
|
|
575
536
|
}
|
|
576
537
|
|
|
577
538
|
/**
|
|
578
|
-
*
|
|
539
|
+
* Releases every long-lived timer MineRender holds, so a Node process can exit.
|
|
579
540
|
*
|
|
580
|
-
*
|
|
581
|
-
*
|
|
541
|
+
* Both `@inventivetalent/loading-cache` (cache expiry) and `jobqu` (request queue draining) use
|
|
542
|
+
* self-rescheduling timers that are not unref'd, which keeps the event loop alive for as long as
|
|
543
|
+
* the library is loaded. Browsers don't care, but anything headless - a render server, a CLI, a
|
|
544
|
+
* test run - has to call this when it's done.
|
|
582
545
|
*
|
|
583
|
-
*
|
|
584
|
-
* HTTP requests already running can finish. Queue shutdown is permanent, and cache expiry timers do not restart.
|
|
546
|
+
* The library stays usable afterwards; the caches and queues simply start over.
|
|
585
547
|
*/
|
|
586
548
|
declare function shutdown(): void;
|
|
587
549
|
|
|
@@ -654,14 +616,6 @@ declare abstract class AssetSource {
|
|
|
654
616
|
protected constructor();
|
|
655
617
|
abstract get<T extends MinecraftAsset>(key: AssetKey, parser: AssetParser | string): Promise<Maybe<T>>;
|
|
656
618
|
}
|
|
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
|
-
}
|
|
665
619
|
|
|
666
620
|
declare class AssetLoader {
|
|
667
621
|
static ROOT: string;
|
|
@@ -669,13 +623,7 @@ declare class AssetLoader {
|
|
|
669
623
|
static addSource(key: string, source: AssetSource, override?: boolean): void;
|
|
670
624
|
static removeSource(key: string): Maybe<AssetSource>;
|
|
671
625
|
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. */
|
|
673
626
|
static get<T extends MinecraftAsset>(key: AssetKey, parser: AssetParser | string): Promise<Maybe<T>>;
|
|
674
|
-
/** Tries each path within a source before considering lower-priority sources. */
|
|
675
|
-
static getFirst<T extends MinecraftAsset>(keys: readonly AssetKey[], parser: AssetParser | string): Promise<Maybe<{
|
|
676
|
-
key: AssetKey;
|
|
677
|
-
asset: T;
|
|
678
|
-
}>>;
|
|
679
627
|
}
|
|
680
628
|
|
|
681
629
|
interface BlockState extends MinecraftAsset {
|
|
@@ -690,19 +638,18 @@ interface BlockStateVariant {
|
|
|
690
638
|
y?: number;
|
|
691
639
|
x?: number;
|
|
692
640
|
uvlock?: boolean;
|
|
693
|
-
weight?: number;
|
|
694
641
|
}
|
|
695
642
|
interface BlockStateMultipart {
|
|
696
|
-
when?: MultipartCondition
|
|
697
|
-
|
|
643
|
+
when?: MultipartCondition | {
|
|
644
|
+
OR: MultipartCondition[];
|
|
645
|
+
};
|
|
646
|
+
apply?: BlockStateVariant;
|
|
647
|
+
}
|
|
648
|
+
interface MultipartCondition {
|
|
649
|
+
[key: string]: string;
|
|
698
650
|
}
|
|
699
|
-
type MultipartCondition = Record<string, string> | {
|
|
700
|
-
OR: MultipartCondition[];
|
|
701
|
-
} | {
|
|
702
|
-
AND: MultipartCondition[];
|
|
703
|
-
};
|
|
704
651
|
|
|
705
|
-
declare const DEFAULT_ROOT = "https://assets.mcasset.cloud/1.
|
|
652
|
+
declare const DEFAULT_ROOT = "https://assets.mcasset.cloud/1.17.1";
|
|
706
653
|
declare const DEFAULT_NAMESPACE = "minecraft";
|
|
707
654
|
declare class Assets {
|
|
708
655
|
/**
|
|
@@ -767,8 +714,6 @@ declare class Models {
|
|
|
767
714
|
private static get PERSISTENT_CACHE();
|
|
768
715
|
static getItemList(): Promise<string[]>;
|
|
769
716
|
static loadAndMerge(key: AssetKey): Promise<Maybe<Model>>;
|
|
770
|
-
private static getItemModel;
|
|
771
|
-
private static defaultItemModel;
|
|
772
717
|
static getRaw(key: AssetKey): Promise<Maybe<Model>>;
|
|
773
718
|
static getMerged(key: AssetKey): Promise<Maybe<Model>>;
|
|
774
719
|
static get(key: AssetKey): Promise<Maybe<Model>>;
|
|
@@ -909,7 +854,6 @@ declare class EntityObject extends SceneObject {
|
|
|
909
854
|
constructor(entity: EntityModel, options?: Partial<EntityObjectOptions>);
|
|
910
855
|
init(): Promise<void>;
|
|
911
856
|
dispose(): void;
|
|
912
|
-
private get textureKey();
|
|
913
857
|
protected loadTextures(): Promise<void>;
|
|
914
858
|
protected createMeshes(force?: boolean): void;
|
|
915
859
|
protected applyTextures(): Promise<void>;
|
|
@@ -942,9 +886,7 @@ interface MineRenderSceneOptions {
|
|
|
942
886
|
}
|
|
943
887
|
declare function isMineRenderScene(obj: any): obj is MineRenderScene;
|
|
944
888
|
|
|
945
|
-
declare class SceneObject extends Object3D
|
|
946
|
-
change: {};
|
|
947
|
-
}> implements Disposable, Instanceable, Transformable {
|
|
889
|
+
declare class SceneObject extends Object3D implements Disposable, Instanceable, Transformable {
|
|
948
890
|
readonly isSceneObject: true;
|
|
949
891
|
static readonly DEFAULT_OPTIONS: SceneObjectOptions;
|
|
950
892
|
readonly options: SceneObjectOptions;
|
|
@@ -970,9 +912,9 @@ declare class SceneObject extends Object3D<Object3DEventMap & {
|
|
|
970
912
|
*/
|
|
971
913
|
toggleGroupVisibility(name: string, visible?: boolean): boolean;
|
|
972
914
|
protected addOrReplaceMesh(mesh: Mesh, parent: Object3D, name?: string): void;
|
|
973
|
-
protected createAndAddMesh(name?: string, group?: Object3D, geometry?: BufferGeometry, material?: Material | Material[], offsetAxis?: Axis, offset?: number): Mesh;
|
|
974
|
-
protected createMesh(name?: string, geometry?: BufferGeometry, material?: Material | Material[], offsetAxis?: Axis, offset?: number): Mesh;
|
|
975
|
-
protected createInstancedMesh(name: Maybe<string>, geometry: BufferGeometry, material: Material | Material[], count: number): InstancedMesh;
|
|
915
|
+
protected createAndAddMesh(name?: string, group?: Object3D, geometry?: BufferGeometry, material?: Material$1 | Material$1[], offsetAxis?: Axis, offset?: number): Mesh;
|
|
916
|
+
protected createMesh(name?: string, geometry?: BufferGeometry, material?: Material$1 | Material$1[], offsetAxis?: Axis, offset?: number): Mesh;
|
|
917
|
+
protected createInstancedMesh(name: Maybe<string>, geometry: BufferGeometry, material: Material$1 | Material$1[], count: number): InstancedMesh;
|
|
976
918
|
/**
|
|
977
919
|
* Get a mesh by its name
|
|
978
920
|
*/
|
|
@@ -1141,8 +1083,8 @@ interface NBTAsset extends MinecraftAsset, NBT {
|
|
|
1141
1083
|
}
|
|
1142
1084
|
|
|
1143
1085
|
interface ResponseParser<T extends MinecraftAsset> {
|
|
1144
|
-
config(request:
|
|
1145
|
-
parse(response:
|
|
1086
|
+
config(request: AxiosRequestConfig): any;
|
|
1087
|
+
parse(response: AxiosResponse): Maybe<T> | Promise<Maybe<T>>;
|
|
1146
1088
|
}
|
|
1147
1089
|
|
|
1148
1090
|
declare class HostedAssetSource extends AssetSource {
|
|
@@ -1270,18 +1212,14 @@ declare class Caching {
|
|
|
1270
1212
|
static readonly mergedModelCache: AsyncLoadingCache<CacheKey, Model>;
|
|
1271
1213
|
static readonly modelTextureAtlasCache: AsyncLoadingCache<CacheKey, TextureAtlas>;
|
|
1272
1214
|
static readonly blockStateCache: AsyncLoadingCache<CacheKey, BlockState>;
|
|
1273
|
-
static readonly listAssetCache: AsyncLoadingCache<CacheKey, ListAsset>;
|
|
1274
|
-
static readonly defaultBlockStatesCache: AsyncLoadingCache<CacheKey, DefaultBlockStates>;
|
|
1275
|
-
static readonly entityModelsCache: AsyncLoadingCache<CacheKey, EntityModels>;
|
|
1276
|
-
private static createAssetCache;
|
|
1277
1215
|
/** Every cache above, so clear()/end() can never fall out of sync with the field list again. */
|
|
1278
1216
|
private static get all();
|
|
1279
1217
|
static clear(): void;
|
|
1280
1218
|
/**
|
|
1281
1219
|
* Clears every cache and stops its expiry timer.
|
|
1282
1220
|
*
|
|
1283
|
-
*
|
|
1284
|
-
*
|
|
1221
|
+
* loading-cache reschedules that timer indefinitely, so a Node process will not exit until
|
|
1222
|
+
* this is called - see {@link shutdown}.
|
|
1285
1223
|
*/
|
|
1286
1224
|
static end(): void;
|
|
1287
1225
|
static get cacheSizes(): {};
|
|
@@ -1297,83 +1235,6 @@ declare class GuiObject extends SceneObject {
|
|
|
1297
1235
|
interface GuiObjectOptions extends SceneObjectOptions {
|
|
1298
1236
|
}
|
|
1299
1237
|
|
|
1300
|
-
declare class OrbitControls {
|
|
1301
|
-
constructor(object: Camera, domElement?: HTMLElement);
|
|
1302
|
-
|
|
1303
|
-
object: Camera;
|
|
1304
|
-
domElement: HTMLElement | HTMLDocument;
|
|
1305
|
-
|
|
1306
|
-
// API
|
|
1307
|
-
enabled: boolean;
|
|
1308
|
-
target: Vector3;
|
|
1309
|
-
|
|
1310
|
-
// deprecated
|
|
1311
|
-
center: Vector3;
|
|
1312
|
-
|
|
1313
|
-
minDistance: number;
|
|
1314
|
-
maxDistance: number;
|
|
1315
|
-
|
|
1316
|
-
minZoom: number;
|
|
1317
|
-
maxZoom: number;
|
|
1318
|
-
|
|
1319
|
-
minPolarAngle: number;
|
|
1320
|
-
maxPolarAngle: number;
|
|
1321
|
-
|
|
1322
|
-
minAzimuthAngle: number;
|
|
1323
|
-
maxAzimuthAngle: number;
|
|
1324
|
-
|
|
1325
|
-
enableDamping: boolean;
|
|
1326
|
-
dampingFactor: number;
|
|
1327
|
-
|
|
1328
|
-
enableZoom: boolean;
|
|
1329
|
-
zoomSpeed: number;
|
|
1330
|
-
|
|
1331
|
-
enableRotate: boolean;
|
|
1332
|
-
rotateSpeed: number;
|
|
1333
|
-
|
|
1334
|
-
enablePan: boolean;
|
|
1335
|
-
panSpeed: number;
|
|
1336
|
-
screenSpacePanning: boolean;
|
|
1337
|
-
keyPanSpeed: number;
|
|
1338
|
-
|
|
1339
|
-
autoRotate: boolean;
|
|
1340
|
-
autoRotateSpeed: number;
|
|
1341
|
-
|
|
1342
|
-
enableKeys: boolean;
|
|
1343
|
-
keys: { LEFT: string; UP: string; RIGHT: string; BOTTOM: string };
|
|
1344
|
-
mouseButtons: { LEFT: MOUSE; MIDDLE: MOUSE; RIGHT: MOUSE };
|
|
1345
|
-
touches: { ONE: TOUCH; TWO: TOUCH };
|
|
1346
|
-
|
|
1347
|
-
update(): boolean;
|
|
1348
|
-
|
|
1349
|
-
listenToKeyEvents(domElement: HTMLElement): void;
|
|
1350
|
-
|
|
1351
|
-
saveState(): void;
|
|
1352
|
-
|
|
1353
|
-
reset(): void;
|
|
1354
|
-
|
|
1355
|
-
dispose(): void;
|
|
1356
|
-
|
|
1357
|
-
getPolarAngle(): number;
|
|
1358
|
-
|
|
1359
|
-
getAzimuthalAngle(): number;
|
|
1360
|
-
|
|
1361
|
-
getDistance(): number;
|
|
1362
|
-
|
|
1363
|
-
// EventDispatcher mixins
|
|
1364
|
-
addEventListener(type: string, listener: (event: any) => void): void;
|
|
1365
|
-
|
|
1366
|
-
hasEventListener(type: string, listener: (event: any) => void): boolean;
|
|
1367
|
-
|
|
1368
|
-
removeEventListener(type: string, listener: (event: any) => void): void;
|
|
1369
|
-
|
|
1370
|
-
dispatchEvent(event: { type: string; target: any }): void;
|
|
1371
|
-
}
|
|
1372
|
-
|
|
1373
|
-
declare class MapControls extends OrbitControls {
|
|
1374
|
-
constructor(object: Camera, domElement?: HTMLElement);
|
|
1375
|
-
}
|
|
1376
|
-
|
|
1377
1238
|
declare class Renderer implements Disposable {
|
|
1378
1239
|
static readonly DEFAULT_OPTIONS: RendererOptions;
|
|
1379
1240
|
readonly options: RendererOptions;
|
|
@@ -1381,14 +1242,14 @@ declare class Renderer implements Disposable {
|
|
|
1381
1242
|
protected _scene: MineRenderScene;
|
|
1382
1243
|
protected _camera: Camera;
|
|
1383
1244
|
protected _renderer: WebGLRenderer;
|
|
1384
|
-
protected _composer
|
|
1385
|
-
protected _controls?: OrbitControls;
|
|
1245
|
+
protected _composer: EffectComposer;
|
|
1386
1246
|
protected _stats?: Stats;
|
|
1387
1247
|
protected _dirty: boolean;
|
|
1388
1248
|
protected _animationLoop: any;
|
|
1389
|
-
protected
|
|
1249
|
+
protected _fpsTimer: any;
|
|
1250
|
+
protected _animationTimer?: NodeJS.Timeout;
|
|
1251
|
+
protected _animationFrame?: number;
|
|
1390
1252
|
protected _resizeListener?: () => void;
|
|
1391
|
-
private _nextFrameTime?;
|
|
1392
1253
|
private _disposed;
|
|
1393
1254
|
private readonly _debugHelpers;
|
|
1394
1255
|
private readonly _eventDispatchers;
|
|
@@ -1397,8 +1258,7 @@ declare class Renderer implements Disposable {
|
|
|
1397
1258
|
protected createScene(): MineRenderScene;
|
|
1398
1259
|
protected createCamera(): Camera;
|
|
1399
1260
|
protected createRenderer(): WebGLRenderer;
|
|
1400
|
-
protected createComposer():
|
|
1401
|
-
protected createControls(): Maybe<OrbitControls>;
|
|
1261
|
+
protected createComposer(): EffectComposer;
|
|
1402
1262
|
init(): void;
|
|
1403
1263
|
get element(): Maybe<HTMLElement>;
|
|
1404
1264
|
appendTo(element: HTMLElement): void;
|
|
@@ -1406,7 +1266,7 @@ declare class Renderer implements Disposable {
|
|
|
1406
1266
|
* Redraws when the dispatcher emits the selected event. Registering the same pair twice has no effect.
|
|
1407
1267
|
* The renderer removes its listener on disposal; the caller retains ownership of the dispatcher.
|
|
1408
1268
|
*/
|
|
1409
|
-
registerEventDispatcher(dispatcher: EventDispatcher
|
|
1269
|
+
registerEventDispatcher(dispatcher: EventDispatcher, changeEvent?: string): void;
|
|
1410
1270
|
resize(width: number, height: number): void;
|
|
1411
1271
|
get dirty(): boolean;
|
|
1412
1272
|
set dirty(dirty: boolean);
|
|
@@ -1426,15 +1286,12 @@ declare class Renderer implements Disposable {
|
|
|
1426
1286
|
get scene(): MineRenderScene;
|
|
1427
1287
|
get camera(): Camera;
|
|
1428
1288
|
get renderer(): WebGLRenderer;
|
|
1429
|
-
get composer():
|
|
1430
|
-
/** Renderer-owned controls, or undefined when disabled at construction or after disposal. */
|
|
1431
|
-
get controls(): Maybe<OrbitControls>;
|
|
1289
|
+
get composer(): EffectComposer;
|
|
1432
1290
|
}
|
|
1433
1291
|
interface RendererOptions {
|
|
1434
1292
|
camera: CameraOptions;
|
|
1435
1293
|
render: RenderOptions;
|
|
1436
1294
|
composer: ComposerOptions;
|
|
1437
|
-
controls?: ControlsOptions;
|
|
1438
1295
|
debug: DebugOptions;
|
|
1439
1296
|
}
|
|
1440
1297
|
interface CameraOptions {
|
|
@@ -1455,7 +1312,6 @@ interface CameraOptions {
|
|
|
1455
1312
|
lookingAt: Vector3 | TripleArray;
|
|
1456
1313
|
}
|
|
1457
1314
|
interface RenderOptions {
|
|
1458
|
-
/** Maximum draw rate (60 by default); zero or a negative value disables the limit. */
|
|
1459
1315
|
fpsLimit: number;
|
|
1460
1316
|
stats: boolean;
|
|
1461
1317
|
antialias: boolean;
|
|
@@ -1466,9 +1322,6 @@ interface RenderOptions {
|
|
|
1466
1322
|
interface ComposerOptions {
|
|
1467
1323
|
enabled: boolean;
|
|
1468
1324
|
}
|
|
1469
|
-
interface ControlsOptions {
|
|
1470
|
-
enabled: boolean;
|
|
1471
|
-
}
|
|
1472
1325
|
interface DebugOptions {
|
|
1473
1326
|
grid: boolean;
|
|
1474
1327
|
axes: boolean;
|
|
@@ -1483,7 +1336,7 @@ declare class SceneInspector {
|
|
|
1483
1336
|
private selectedObject?;
|
|
1484
1337
|
constructor(renderer: Renderer);
|
|
1485
1338
|
protected init(): void;
|
|
1486
|
-
findMeshChildren(from: Object3D, out?: Mesh[]): Mesh<three.BufferGeometry
|
|
1339
|
+
findMeshChildren(from: Object3D, out?: Mesh[]): Mesh<three.BufferGeometry, three.Material | three.Material[]>[];
|
|
1487
1340
|
onClick(event: any): void;
|
|
1488
1341
|
appendTo(el: HTMLElement): void;
|
|
1489
1342
|
protected handleRaycasterObjects(intersections: Intersection[]): void;
|
|
@@ -1520,6 +1373,26 @@ declare class StatLine {
|
|
|
1520
1373
|
update(): void;
|
|
1521
1374
|
}
|
|
1522
1375
|
|
|
1376
|
+
declare class Requests {
|
|
1377
|
+
private static axiosInstance;
|
|
1378
|
+
private static mcAssetInstance;
|
|
1379
|
+
private static genericQueue;
|
|
1380
|
+
private static mcAssetRequestQueue;
|
|
1381
|
+
static genericRequest(request: AxiosRequestConfig): Promise<AxiosResponse>;
|
|
1382
|
+
static mcAssetRequest(request: AxiosRequestConfig): Promise<AxiosResponse>;
|
|
1383
|
+
private static shouldRetry;
|
|
1384
|
+
static setMcAssetRoot(root: string): void;
|
|
1385
|
+
static get queueSizes(): {
|
|
1386
|
+
generic: number;
|
|
1387
|
+
mcAsset: number;
|
|
1388
|
+
};
|
|
1389
|
+
/**
|
|
1390
|
+
* Stops both queue timers. jobqu reschedules itself indefinitely, so a Node process will not
|
|
1391
|
+
* exit until this is called - see {@link shutdown}.
|
|
1392
|
+
*/
|
|
1393
|
+
static end(): void;
|
|
1394
|
+
}
|
|
1395
|
+
|
|
1523
1396
|
type SkinGeometries = Record<SkinPart, TripleArray>;
|
|
1524
1397
|
declare const classicSkinGeometries: SkinGeometries;
|
|
1525
1398
|
declare const slimSkinGeometries: SkinGeometries;
|
|
@@ -1552,9 +1425,6 @@ declare class Skins {
|
|
|
1552
1425
|
}
|
|
1553
1426
|
|
|
1554
1427
|
declare class TextureLoader {
|
|
1555
|
-
private static readonly failedTextures;
|
|
1556
|
-
/** Reports whether image loading failed, so cached textures can be retried. */
|
|
1557
|
-
static hasFailed(texture: Texture): boolean;
|
|
1558
1428
|
protected static createTexture(): Texture;
|
|
1559
1429
|
static loadInBackground(src: string, format?: PixelFormat, rotation?: number): Texture;
|
|
1560
1430
|
static load(src: string, format?: PixelFormat, rotation?: number): Texture;
|
|
@@ -1568,14 +1438,91 @@ declare class Textures {
|
|
|
1568
1438
|
static getImage(key: TextureKey): Texture;
|
|
1569
1439
|
}
|
|
1570
1440
|
|
|
1571
|
-
declare function mergeBufferGeometries(geometries: BufferGeometry[], useGroups?: boolean): BufferGeometry;
|
|
1441
|
+
declare function mergeBufferGeometries(geometries: BufferGeometry$1[], useGroups?: boolean): BufferGeometry$1;
|
|
1572
1442
|
declare function mergeBufferAttributes(attributes: BufferAttribute[]): BufferAttribute;
|
|
1573
1443
|
declare function interleaveAttributes(attributes: BufferAttribute[]): InterleavedBufferAttribute;
|
|
1574
|
-
declare function estimateBytesUsed(geometry: BufferGeometry): number;
|
|
1575
|
-
declare function mergeVertices(geometry: BufferGeometry, tolerance?: number): BufferGeometry;
|
|
1576
|
-
declare function toTrianglesDrawMode(geometry: BufferGeometry, drawMode: TrianglesDrawModes): BufferGeometry;
|
|
1444
|
+
declare function estimateBytesUsed(geometry: BufferGeometry$1): number;
|
|
1445
|
+
declare function mergeVertices(geometry: BufferGeometry$1, tolerance?: number): BufferGeometry$1;
|
|
1446
|
+
declare function toTrianglesDrawMode(geometry: BufferGeometry$1, drawMode: TrianglesDrawModes): BufferGeometry$1;
|
|
1577
1447
|
declare function computeMorphedAttributes(object: Mesh | Line | Points): object;
|
|
1578
1448
|
|
|
1449
|
+
declare class OrbitControls {
|
|
1450
|
+
constructor(object: Camera, domElement?: HTMLElement);
|
|
1451
|
+
|
|
1452
|
+
object: Camera;
|
|
1453
|
+
domElement: HTMLElement | HTMLDocument;
|
|
1454
|
+
|
|
1455
|
+
// API
|
|
1456
|
+
enabled: boolean;
|
|
1457
|
+
target: Vector3;
|
|
1458
|
+
|
|
1459
|
+
// deprecated
|
|
1460
|
+
center: Vector3;
|
|
1461
|
+
|
|
1462
|
+
minDistance: number;
|
|
1463
|
+
maxDistance: number;
|
|
1464
|
+
|
|
1465
|
+
minZoom: number;
|
|
1466
|
+
maxZoom: number;
|
|
1467
|
+
|
|
1468
|
+
minPolarAngle: number;
|
|
1469
|
+
maxPolarAngle: number;
|
|
1470
|
+
|
|
1471
|
+
minAzimuthAngle: number;
|
|
1472
|
+
maxAzimuthAngle: number;
|
|
1473
|
+
|
|
1474
|
+
enableDamping: boolean;
|
|
1475
|
+
dampingFactor: number;
|
|
1476
|
+
|
|
1477
|
+
enableZoom: boolean;
|
|
1478
|
+
zoomSpeed: number;
|
|
1479
|
+
|
|
1480
|
+
enableRotate: boolean;
|
|
1481
|
+
rotateSpeed: number;
|
|
1482
|
+
|
|
1483
|
+
enablePan: boolean;
|
|
1484
|
+
panSpeed: number;
|
|
1485
|
+
screenSpacePanning: boolean;
|
|
1486
|
+
keyPanSpeed: number;
|
|
1487
|
+
|
|
1488
|
+
autoRotate: boolean;
|
|
1489
|
+
autoRotateSpeed: number;
|
|
1490
|
+
|
|
1491
|
+
enableKeys: boolean;
|
|
1492
|
+
keys: { LEFT: string; UP: string; RIGHT: string; BOTTOM: string };
|
|
1493
|
+
mouseButtons: { LEFT: MOUSE; MIDDLE: MOUSE; RIGHT: MOUSE };
|
|
1494
|
+
touches: { ONE: TOUCH; TWO: TOUCH };
|
|
1495
|
+
|
|
1496
|
+
update(): boolean;
|
|
1497
|
+
|
|
1498
|
+
listenToKeyEvents(domElement: HTMLElement): void;
|
|
1499
|
+
|
|
1500
|
+
saveState(): void;
|
|
1501
|
+
|
|
1502
|
+
reset(): void;
|
|
1503
|
+
|
|
1504
|
+
dispose(): void;
|
|
1505
|
+
|
|
1506
|
+
getPolarAngle(): number;
|
|
1507
|
+
|
|
1508
|
+
getAzimuthalAngle(): number;
|
|
1509
|
+
|
|
1510
|
+
getDistance(): number;
|
|
1511
|
+
|
|
1512
|
+
// EventDispatcher mixins
|
|
1513
|
+
addEventListener(type: string, listener: (event: any) => void): void;
|
|
1514
|
+
|
|
1515
|
+
hasEventListener(type: string, listener: (event: any) => void): boolean;
|
|
1516
|
+
|
|
1517
|
+
removeEventListener(type: string, listener: (event: any) => void): void;
|
|
1518
|
+
|
|
1519
|
+
dispatchEvent(event: { type: string; target: any }): void;
|
|
1520
|
+
}
|
|
1521
|
+
|
|
1522
|
+
declare class MapControls extends OrbitControls {
|
|
1523
|
+
constructor(object: Camera, domElement?: HTMLElement);
|
|
1524
|
+
}
|
|
1525
|
+
|
|
1579
1526
|
interface BlockInfo {
|
|
1580
1527
|
block: Block;
|
|
1581
1528
|
object: BlockObject;
|
|
@@ -1664,8 +1611,8 @@ declare class BrowserCache extends PersistentCache<LocalForage> {
|
|
|
1664
1611
|
*
|
|
1665
1612
|
* `image-size` pulls in `fs`/`path` at module scope, so it can only live in the Node build.
|
|
1666
1613
|
* Everything MineRender loads is a PNG in practice; GIF and JPEG are handled as a courtesy and
|
|
1667
|
-
* anything else falls through to an empty result
|
|
1614
|
+
* anything else falls through to an empty result (callers treat that as 0x0).
|
|
1668
1615
|
*/
|
|
1669
1616
|
declare function probeImageSize(data: Uint8Array): ImageSizeInfo;
|
|
1670
1617
|
|
|
1671
|
-
export { AXES, type AnimationFrame, type AnimationMeta, type AnimatorFunction, ArchiveAssetSource, type ArchiveEntry, type ArchiveProxy, AssetKey,
|
|
1618
|
+
export { AXES, type AnimationFrame, type AnimationMeta, type AnimatorFunction, ArchiveAssetSource, type ArchiveEntry, type ArchiveProxy, AssetKey, AssetLoader, AssetParser, AssetSource, type AssetType, Assets, Axis, BUILTIN_ENTITY, BUILTIN_GENERATED, BasicAssetKey, type BasicMinecraftAsset, BatchedExecutor, type BedrockBone, type BedrockCube, type BedrockEntityDescription, type BedrockEntityFile, type BedrockGeometry, type BedrockGeometryFile, type Block, BlockEntityModels, type BlockInfo, type BlockModel, type BlockModelTextures, BlockObject, type BlockObjectOptions, type BlockState, type BlockStateMultipart, type BlockStateProperties, type BlockStateProperty, type BlockStatePropertyDefaults, type BlockStatePropertyValue, type BlockStateVariant, type BlockStateVariants, BlockStates, type BoxGeometryKey, BrowserArchiveProxy, BrowserCache, BrowserEnv, CUBE_FACES, type CacheKey, Caching, type CameraOptions, CanvasImage, Chunk, type CompatCanvas, type CompatImage, type ComposerOptions, type Cube, CubeFace, CubeFaceIndex, DEFAULT_ELEMENTS, DEFAULT_NAMESPACE, DEFAULT_ROOT, DEFAULT_UV, DISPLAY_POSITIONS, type DebugOptions, type DeepPartial, DefaultBlockStates, DisplayPosition, type Disposable, type DoubleArray, type ElementFace, type ElementRotation, Entities, type EntityModel, EntityModels, EntityObject, type EntityObjectOptions, Env, type EnvProvider, type ExtractableImageData, type FromTo, Geometries, GuiLight, GuiObject, type GuiObjectOptions, HostedAssetSource, type IModelTextures, ITEM_GENERATED, type ImageInfo, ImageLoader, type ImageSizeInfo, InstanceManager, InstanceReference, type Instanceable, type ItemModel, type ItemModelTextures, type ListAsset, MapControls, type MaterialKey, Materials, type Maybe, type MeshKey, Meshes, MineRenderError, MineRenderScene, type MineRenderSceneOptions, MineRenderWorld, type MinecraftAsset, MinecraftCubeTexture, MinecraftFaceUV, type MinecraftTextureMeta, type Model, type ModelDisplay, type ModelElement, type ModelFaces, ModelGenerator, ModelMerger, ModelObject, type ModelObjectOptions, type ModelPart, ModelTextures, Models, type MultiBlockBlock, type MultiBlockStructure, type MultipartCondition, type NBTAsset, NBTHelper, OrbitControls, PersistentCache, type QuadArray, type RawImageKey, type RenderOptions, Renderer, type RendererOptions, Requests, type ResponseParser, SKIN_PARTS, SceneInspector, SceneObject, type SceneObjectOptions, SceneStats, SceneStatsDisplay, SchematicParser, type Serializable, type SkinGeometries, SkinObject, type SkinObjectOptions, SkinPart, type SkinTextureCoordinates, Skins, type StructureNBT, StructureParser, type TextureAsset, TextureAtlas, type TextureKey, TextureLoader, Textures, Ticker, type TickerFunction, TintColors, type Transformable, type TripleArray, UVMapper, WrappedImage, addBox3WireframeToObject, addWireframeToMesh, addWireframeToObject, applyElementRotation, applyGenericRotation, applyModelPartRotation, axisToVec3, base64decode, base64encode, captureException, changeEvent, clampRotationDegrees, classicSkinGeometries, classicSkinTextureCoordinates, computeMorphedAttributes, createCanvas, createImage, estimateBytesUsed, interleaveAttributes, isAssetKey, isBasicAssetKey, isBlockObject, isDisposable, isDoubleArray, isEntityObject, isInstanceManager, isInstanceReference, isInstanceable, isInstancedMesh, isMesh, isMineRenderScene, isModelObject, isObject3D, isOrthographicCamera, isPerspectiveCamera, isQuadArray, isSceneObject, isTransformable, isTripleArray, isVector3, md5, mergeBufferAttributes, mergeBufferGeometries, mergeVertices, prefix, probeImageSize, registerBrowserEnv, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode };
|