minerender 2.1.0-alpha.2 → 2.1.0-alpha.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/browser/index.d.mts +205 -141
- package/dist/browser/index.d.ts +205 -141
- package/dist/browser/index.js +1893 -1644
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/index.mjs +1901 -1652
- package/dist/browser/index.mjs.map +1 -1
- package/dist/bundle.js +3679 -5020
- package/dist/bundle.js.map +1 -1
- package/dist/node/index.d.mts +204 -140
- package/dist/node/index.d.ts +204 -140
- package/dist/node/index.js +1815 -1497
- package/dist/node/index.js.map +1 -1
- package/dist/node/index.mjs +1569 -1253
- package/dist/node/index.mjs.map +1 -1
- package/package.json +7 -9
package/dist/node/index.d.mts
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import * as three from 'three';
|
|
2
|
-
import { Vector3, PixelFormat, BoxGeometry, Material, Mesh, Euler, Vector2, BufferAttribute, Float32BufferAttribute, Object3D, Box3, InstancedMesh, PerspectiveCamera, OrthographicCamera, Matrix4, Scene, Texture, Camera, WebGLRenderer, EventDispatcher, Raycaster, Intersection, CanvasTexture,
|
|
2
|
+
import { Vector3, PixelFormat, BoxGeometry, Material, Mesh, Euler, Vector2, BufferAttribute, Float32BufferAttribute, BufferGeometry, Object3D, Box3, InstancedMesh, PerspectiveCamera, OrthographicCamera, Matrix4, Scene, Object3DEventMap, Texture, Camera, MOUSE, TOUCH, WebGLRenderer, EventDispatcher, Raycaster, Intersection, CanvasTexture, InterleavedBufferAttribute, TrianglesDrawModes, Line, Points } from 'three';
|
|
3
3
|
import * as nodeCanvas from 'canvas';
|
|
4
4
|
import { ImageData as ImageData$1, CanvasRenderingContext2D } from 'canvas';
|
|
5
|
-
import { AxiosResponse, AxiosRequestConfig } from 'axios';
|
|
6
5
|
import { Buffer as Buffer$1 } from 'buffer';
|
|
7
6
|
import { NBT } from 'prismarine-nbt';
|
|
8
7
|
import { ZipReader } from '@zip.js/zip.js';
|
|
9
8
|
import { AsyncLoadingCache, SimpleCache } from '@inventivetalent/loading-cache';
|
|
10
|
-
import { BufferGeometry } from 'three/src/core/BufferGeometry';
|
|
11
|
-
import { Material as Material$1 } from 'three/src/materials/Material';
|
|
12
9
|
import Stats from 'stats.js';
|
|
13
10
|
import { EffectComposer } from 'postprocessing';
|
|
14
11
|
import { LocalStorage } from 'node-persist';
|
|
@@ -18,7 +15,7 @@ interface AnimatorFunction {
|
|
|
18
15
|
}
|
|
19
16
|
|
|
20
17
|
declare enum Axis {
|
|
21
|
-
X = "
|
|
18
|
+
X = "x",
|
|
22
19
|
Y = "y",
|
|
23
20
|
Z = "z"
|
|
24
21
|
}
|
|
@@ -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>;
|
|
@@ -176,6 +174,7 @@ declare class AssetKey extends BasicAssetKey {
|
|
|
176
174
|
rootType: "assets" | "data" | string;
|
|
177
175
|
extension: ".json" | ".png" | string;
|
|
178
176
|
root?: string | undefined;
|
|
177
|
+
readonly isAssetKey: true;
|
|
179
178
|
constructor(namespace: string, path: string, assetType?: AssetType | undefined, type?: string | undefined, rootType?: "assets" | "data" | string, extension?: ".json" | ".png" | string, root?: string | undefined);
|
|
180
179
|
static parse(assetType: AssetType, str: string, origin?: AssetKey): AssetKey;
|
|
181
180
|
toString(): string;
|
|
@@ -257,6 +256,46 @@ declare enum GuiLight {
|
|
|
257
256
|
SIDE = "side"
|
|
258
257
|
}
|
|
259
258
|
|
|
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
|
+
|
|
260
299
|
declare class WrappedImage {
|
|
261
300
|
readonly dta: ExtractableImageData;
|
|
262
301
|
constructor(dta: ExtractableImageData);
|
|
@@ -292,7 +331,7 @@ declare class ImageLoader {
|
|
|
292
331
|
static infoToData(info: ImageInfo): Promise<ImageData>;
|
|
293
332
|
static getData(src: string): Promise<ImageData>;
|
|
294
333
|
static getCanvasData(src: string): Promise<ExtractableImageData>;
|
|
295
|
-
static processResponse(response:
|
|
334
|
+
static processResponse(response: Pick<RequestResponse<ArrayBuffer>, "data" | "url">): Promise<ImageInfo>;
|
|
296
335
|
static loadInfo(src: string): Promise<ImageInfo>;
|
|
297
336
|
static getInfo(src: string): Promise<ImageInfo>;
|
|
298
337
|
static loadWrapped(src: string): Promise<WrappedImage>;
|
|
@@ -432,7 +471,7 @@ interface Transformable {
|
|
|
432
471
|
declare function isTransformable(obj: any): obj is Transformable;
|
|
433
472
|
|
|
434
473
|
declare const changeEvent: {
|
|
435
|
-
type:
|
|
474
|
+
type: "change";
|
|
436
475
|
};
|
|
437
476
|
type Maybe<T> = T | undefined;
|
|
438
477
|
declare function md5(str: string): string;
|
|
@@ -516,6 +555,7 @@ declare class UVMapper {
|
|
|
516
555
|
static setCubeUvs(geometry: BoxGeometry, originalTextureSize: DoubleArray, actualTextureSize: DoubleArray, faces: ModelFaces): void;
|
|
517
556
|
static facesToUvArray(faces: ModelFaces, originalTextureSize: DoubleArray, actualTextureSize: DoubleArray): number[];
|
|
518
557
|
static facesToUv(faces: ModelFaces, originalTextureSize: DoubleArray, actualTextureSize: DoubleArray): Float32BufferAttribute;
|
|
558
|
+
static lockUvs(geometry: BoxGeometry, faces: ModelFaces, atlas: TextureAtlas, rotation: Euler): void;
|
|
519
559
|
static getAtlas(model: Model): Promise<Maybe<TextureAtlas>>;
|
|
520
560
|
static fillMissingTextureKeys<T>(textures: ModelTextures, target: {
|
|
521
561
|
[k: string]: T;
|
|
@@ -537,14 +577,13 @@ declare class MinecraftFaceUV {
|
|
|
537
577
|
}
|
|
538
578
|
|
|
539
579
|
/**
|
|
540
|
-
*
|
|
580
|
+
* Stops the shared Ticker and request queues, and clears the in-memory caches.
|
|
541
581
|
*
|
|
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.
|
|
582
|
+
* Idle Node processes can exit without calling this: cache and Ticker timers are unref'd,
|
|
583
|
+
* and idle request queues hold no timer. Pending requests keep their normal timer references.
|
|
546
584
|
*
|
|
547
|
-
*
|
|
585
|
+
* Call this only when finished with MineRender. Queued, retrying, and future requests reject;
|
|
586
|
+
* HTTP requests already running can finish. Queue shutdown is permanent, and cache expiry timers do not restart.
|
|
548
587
|
*/
|
|
549
588
|
declare function shutdown(): void;
|
|
550
589
|
|
|
@@ -617,6 +656,14 @@ declare abstract class AssetSource {
|
|
|
617
656
|
protected constructor();
|
|
618
657
|
abstract get<T extends MinecraftAsset>(key: AssetKey, parser: AssetParser | string): Promise<Maybe<T>>;
|
|
619
658
|
}
|
|
659
|
+
/** A source failed to load or parse an asset; cause retains the original failure. */
|
|
660
|
+
declare class AssetLoadError extends Error {
|
|
661
|
+
readonly source: AssetSource;
|
|
662
|
+
readonly key: AssetKey;
|
|
663
|
+
readonly path: string;
|
|
664
|
+
readonly cause: unknown;
|
|
665
|
+
constructor(source: AssetSource, key: AssetKey, path: string, cause: unknown);
|
|
666
|
+
}
|
|
620
667
|
|
|
621
668
|
declare class AssetLoader {
|
|
622
669
|
static ROOT: string;
|
|
@@ -624,7 +671,13 @@ declare class AssetLoader {
|
|
|
624
671
|
static addSource(key: string, source: AssetSource, override?: boolean): void;
|
|
625
672
|
static removeSource(key: string): Maybe<AssetSource>;
|
|
626
673
|
static getAll<T extends MinecraftAsset>(key: AssetKey, parser: AssetParser | string): Promise<T[]>;
|
|
674
|
+
/** Returns the first defined result in source-priority order, without merging assets. */
|
|
627
675
|
static get<T extends MinecraftAsset>(key: AssetKey, parser: AssetParser | string): Promise<Maybe<T>>;
|
|
676
|
+
/** Tries each path within a source before considering lower-priority sources. */
|
|
677
|
+
static getFirst<T extends MinecraftAsset>(keys: readonly AssetKey[], parser: AssetParser | string): Promise<Maybe<{
|
|
678
|
+
key: AssetKey;
|
|
679
|
+
asset: T;
|
|
680
|
+
}>>;
|
|
628
681
|
}
|
|
629
682
|
|
|
630
683
|
interface BlockState extends MinecraftAsset {
|
|
@@ -639,18 +692,19 @@ interface BlockStateVariant {
|
|
|
639
692
|
y?: number;
|
|
640
693
|
x?: number;
|
|
641
694
|
uvlock?: boolean;
|
|
695
|
+
weight?: number;
|
|
642
696
|
}
|
|
643
697
|
interface BlockStateMultipart {
|
|
644
|
-
when?: MultipartCondition
|
|
645
|
-
|
|
646
|
-
};
|
|
647
|
-
apply?: BlockStateVariant;
|
|
648
|
-
}
|
|
649
|
-
interface MultipartCondition {
|
|
650
|
-
[key: string]: string;
|
|
698
|
+
when?: MultipartCondition;
|
|
699
|
+
apply?: BlockStateVariant | BlockStateVariant[];
|
|
651
700
|
}
|
|
701
|
+
type MultipartCondition = Record<string, string> | {
|
|
702
|
+
OR: MultipartCondition[];
|
|
703
|
+
} | {
|
|
704
|
+
AND: MultipartCondition[];
|
|
705
|
+
};
|
|
652
706
|
|
|
653
|
-
declare const DEFAULT_ROOT = "https://assets.mcasset.cloud/1.
|
|
707
|
+
declare const DEFAULT_ROOT = "https://assets.mcasset.cloud/1.21.11";
|
|
654
708
|
declare const DEFAULT_NAMESPACE = "minecraft";
|
|
655
709
|
declare class Assets {
|
|
656
710
|
/**
|
|
@@ -715,6 +769,8 @@ declare class Models {
|
|
|
715
769
|
private static get PERSISTENT_CACHE();
|
|
716
770
|
static getItemList(): Promise<string[]>;
|
|
717
771
|
static loadAndMerge(key: AssetKey): Promise<Maybe<Model>>;
|
|
772
|
+
private static getItemModel;
|
|
773
|
+
private static defaultItemModel;
|
|
718
774
|
static getRaw(key: AssetKey): Promise<Maybe<Model>>;
|
|
719
775
|
static getMerged(key: AssetKey): Promise<Maybe<Model>>;
|
|
720
776
|
static get(key: AssetKey): Promise<Maybe<Model>>;
|
|
@@ -793,6 +849,10 @@ declare class ModelObject extends SceneObject {
|
|
|
793
849
|
protected applyTextures(): void;
|
|
794
850
|
}
|
|
795
851
|
interface ModelObjectOptions extends SceneObjectOptions {
|
|
852
|
+
/** Quarter-turn block rotation in radians to compensate when locking UVs. */
|
|
853
|
+
uvLockRotation?: TripleArray;
|
|
854
|
+
/** sRGB 0xRRGGBB colors by face tint index; omitted indices stay white. */
|
|
855
|
+
tints?: Record<number, number>;
|
|
796
856
|
}
|
|
797
857
|
declare function isModelObject(obj: any): obj is ModelObject;
|
|
798
858
|
|
|
@@ -855,6 +915,7 @@ declare class EntityObject extends SceneObject {
|
|
|
855
915
|
constructor(entity: EntityModel, options?: Partial<EntityObjectOptions>);
|
|
856
916
|
init(): Promise<void>;
|
|
857
917
|
dispose(): void;
|
|
918
|
+
private get textureKey();
|
|
858
919
|
protected loadTextures(): Promise<void>;
|
|
859
920
|
protected createMeshes(force?: boolean): void;
|
|
860
921
|
protected applyTextures(): Promise<void>;
|
|
@@ -887,7 +948,9 @@ interface MineRenderSceneOptions {
|
|
|
887
948
|
}
|
|
888
949
|
declare function isMineRenderScene(obj: any): obj is MineRenderScene;
|
|
889
950
|
|
|
890
|
-
declare class SceneObject extends Object3D
|
|
951
|
+
declare class SceneObject extends Object3D<Object3DEventMap & {
|
|
952
|
+
change: {};
|
|
953
|
+
}> implements Disposable, Instanceable, Transformable {
|
|
891
954
|
readonly isSceneObject: true;
|
|
892
955
|
static readonly DEFAULT_OPTIONS: SceneObjectOptions;
|
|
893
956
|
readonly options: SceneObjectOptions;
|
|
@@ -913,9 +976,9 @@ declare class SceneObject extends Object3D implements Disposable, Instanceable,
|
|
|
913
976
|
*/
|
|
914
977
|
toggleGroupVisibility(name: string, visible?: boolean): boolean;
|
|
915
978
|
protected addOrReplaceMesh(mesh: Mesh, parent: Object3D, name?: string): void;
|
|
916
|
-
protected createAndAddMesh(name?: string, group?: Object3D, geometry?: BufferGeometry, material?: Material
|
|
917
|
-
protected createMesh(name?: string, geometry?: BufferGeometry, material?: Material
|
|
918
|
-
protected createInstancedMesh(name: Maybe<string>, geometry: BufferGeometry, material: Material
|
|
979
|
+
protected createAndAddMesh(name?: string, group?: Object3D, geometry?: BufferGeometry, material?: Material | Material[], offsetAxis?: Axis, offset?: number): Mesh;
|
|
980
|
+
protected createMesh(name?: string, geometry?: BufferGeometry, material?: Material | Material[], offsetAxis?: Axis, offset?: number): Mesh;
|
|
981
|
+
protected createInstancedMesh(name: Maybe<string>, geometry: BufferGeometry, material: Material | Material[], count: number): InstancedMesh;
|
|
919
982
|
/**
|
|
920
983
|
* Get a mesh by its name
|
|
921
984
|
*/
|
|
@@ -1084,8 +1147,8 @@ interface NBTAsset extends MinecraftAsset, NBT {
|
|
|
1084
1147
|
}
|
|
1085
1148
|
|
|
1086
1149
|
interface ResponseParser<T extends MinecraftAsset> {
|
|
1087
|
-
config(request:
|
|
1088
|
-
parse(response:
|
|
1150
|
+
config(request: RequestConfig): any;
|
|
1151
|
+
parse(response: RequestResponse): Maybe<T> | Promise<Maybe<T>>;
|
|
1089
1152
|
}
|
|
1090
1153
|
|
|
1091
1154
|
declare class HostedAssetSource extends AssetSource {
|
|
@@ -1213,14 +1276,18 @@ declare class Caching {
|
|
|
1213
1276
|
static readonly mergedModelCache: AsyncLoadingCache<CacheKey, Model>;
|
|
1214
1277
|
static readonly modelTextureAtlasCache: AsyncLoadingCache<CacheKey, TextureAtlas>;
|
|
1215
1278
|
static readonly blockStateCache: AsyncLoadingCache<CacheKey, BlockState>;
|
|
1279
|
+
static readonly listAssetCache: AsyncLoadingCache<CacheKey, ListAsset>;
|
|
1280
|
+
static readonly defaultBlockStatesCache: AsyncLoadingCache<CacheKey, DefaultBlockStates>;
|
|
1281
|
+
static readonly entityModelsCache: AsyncLoadingCache<CacheKey, EntityModels>;
|
|
1282
|
+
private static createAssetCache;
|
|
1216
1283
|
/** Every cache above, so clear()/end() can never fall out of sync with the field list again. */
|
|
1217
1284
|
private static get all();
|
|
1218
1285
|
static clear(): void;
|
|
1219
1286
|
/**
|
|
1220
1287
|
* Clears every cache and stops its expiry timer.
|
|
1221
1288
|
*
|
|
1222
|
-
*
|
|
1223
|
-
*
|
|
1289
|
+
* Expiry timers are unref'd in Node, so idle processes can exit without this cleanup.
|
|
1290
|
+
* Use {@link shutdown} to also stop requests and the shared Ticker.
|
|
1224
1291
|
*/
|
|
1225
1292
|
static end(): void;
|
|
1226
1293
|
static get cacheSizes(): {};
|
|
@@ -1236,6 +1303,83 @@ declare class GuiObject extends SceneObject {
|
|
|
1236
1303
|
interface GuiObjectOptions extends SceneObjectOptions {
|
|
1237
1304
|
}
|
|
1238
1305
|
|
|
1306
|
+
declare class OrbitControls {
|
|
1307
|
+
constructor(object: Camera, domElement?: HTMLElement);
|
|
1308
|
+
|
|
1309
|
+
object: Camera;
|
|
1310
|
+
domElement: HTMLElement | HTMLDocument;
|
|
1311
|
+
|
|
1312
|
+
// API
|
|
1313
|
+
enabled: boolean;
|
|
1314
|
+
target: Vector3;
|
|
1315
|
+
|
|
1316
|
+
// deprecated
|
|
1317
|
+
center: Vector3;
|
|
1318
|
+
|
|
1319
|
+
minDistance: number;
|
|
1320
|
+
maxDistance: number;
|
|
1321
|
+
|
|
1322
|
+
minZoom: number;
|
|
1323
|
+
maxZoom: number;
|
|
1324
|
+
|
|
1325
|
+
minPolarAngle: number;
|
|
1326
|
+
maxPolarAngle: number;
|
|
1327
|
+
|
|
1328
|
+
minAzimuthAngle: number;
|
|
1329
|
+
maxAzimuthAngle: number;
|
|
1330
|
+
|
|
1331
|
+
enableDamping: boolean;
|
|
1332
|
+
dampingFactor: number;
|
|
1333
|
+
|
|
1334
|
+
enableZoom: boolean;
|
|
1335
|
+
zoomSpeed: number;
|
|
1336
|
+
|
|
1337
|
+
enableRotate: boolean;
|
|
1338
|
+
rotateSpeed: number;
|
|
1339
|
+
|
|
1340
|
+
enablePan: boolean;
|
|
1341
|
+
panSpeed: number;
|
|
1342
|
+
screenSpacePanning: boolean;
|
|
1343
|
+
keyPanSpeed: number;
|
|
1344
|
+
|
|
1345
|
+
autoRotate: boolean;
|
|
1346
|
+
autoRotateSpeed: number;
|
|
1347
|
+
|
|
1348
|
+
enableKeys: boolean;
|
|
1349
|
+
keys: { LEFT: string; UP: string; RIGHT: string; BOTTOM: string };
|
|
1350
|
+
mouseButtons: { LEFT: MOUSE; MIDDLE: MOUSE; RIGHT: MOUSE };
|
|
1351
|
+
touches: { ONE: TOUCH; TWO: TOUCH };
|
|
1352
|
+
|
|
1353
|
+
update(): boolean;
|
|
1354
|
+
|
|
1355
|
+
listenToKeyEvents(domElement: HTMLElement): void;
|
|
1356
|
+
|
|
1357
|
+
saveState(): void;
|
|
1358
|
+
|
|
1359
|
+
reset(): void;
|
|
1360
|
+
|
|
1361
|
+
dispose(): void;
|
|
1362
|
+
|
|
1363
|
+
getPolarAngle(): number;
|
|
1364
|
+
|
|
1365
|
+
getAzimuthalAngle(): number;
|
|
1366
|
+
|
|
1367
|
+
getDistance(): number;
|
|
1368
|
+
|
|
1369
|
+
// EventDispatcher mixins
|
|
1370
|
+
addEventListener(type: string, listener: (event: any) => void): void;
|
|
1371
|
+
|
|
1372
|
+
hasEventListener(type: string, listener: (event: any) => void): boolean;
|
|
1373
|
+
|
|
1374
|
+
removeEventListener(type: string, listener: (event: any) => void): void;
|
|
1375
|
+
|
|
1376
|
+
dispatchEvent(event: { type: string; target: any }): void;
|
|
1377
|
+
}
|
|
1378
|
+
|
|
1379
|
+
declare class MapControls extends OrbitControls {
|
|
1380
|
+
constructor(object: Camera, domElement?: HTMLElement);
|
|
1381
|
+
}
|
|
1382
|
+
|
|
1239
1383
|
declare class Renderer implements Disposable {
|
|
1240
1384
|
static readonly DEFAULT_OPTIONS: RendererOptions;
|
|
1241
1385
|
readonly options: RendererOptions;
|
|
@@ -1243,14 +1387,14 @@ declare class Renderer implements Disposable {
|
|
|
1243
1387
|
protected _scene: MineRenderScene;
|
|
1244
1388
|
protected _camera: Camera;
|
|
1245
1389
|
protected _renderer: WebGLRenderer;
|
|
1246
|
-
protected _composer
|
|
1390
|
+
protected _composer?: EffectComposer;
|
|
1391
|
+
protected _controls?: OrbitControls;
|
|
1247
1392
|
protected _stats?: Stats;
|
|
1248
1393
|
protected _dirty: boolean;
|
|
1249
1394
|
protected _animationLoop: any;
|
|
1250
|
-
protected
|
|
1251
|
-
protected _animationTimer?: NodeJS.Timeout;
|
|
1252
|
-
protected _animationFrame?: number;
|
|
1395
|
+
protected _frameInterval?: number;
|
|
1253
1396
|
protected _resizeListener?: () => void;
|
|
1397
|
+
private _nextFrameTime?;
|
|
1254
1398
|
private _disposed;
|
|
1255
1399
|
private readonly _debugHelpers;
|
|
1256
1400
|
private readonly _eventDispatchers;
|
|
@@ -1259,7 +1403,8 @@ declare class Renderer implements Disposable {
|
|
|
1259
1403
|
protected createScene(): MineRenderScene;
|
|
1260
1404
|
protected createCamera(): Camera;
|
|
1261
1405
|
protected createRenderer(): WebGLRenderer;
|
|
1262
|
-
protected createComposer(): EffectComposer
|
|
1406
|
+
protected createComposer(): Maybe<EffectComposer>;
|
|
1407
|
+
protected createControls(): Maybe<OrbitControls>;
|
|
1263
1408
|
init(): void;
|
|
1264
1409
|
get element(): Maybe<HTMLElement>;
|
|
1265
1410
|
appendTo(element: HTMLElement): void;
|
|
@@ -1267,7 +1412,7 @@ declare class Renderer implements Disposable {
|
|
|
1267
1412
|
* Redraws when the dispatcher emits the selected event. Registering the same pair twice has no effect.
|
|
1268
1413
|
* The renderer removes its listener on disposal; the caller retains ownership of the dispatcher.
|
|
1269
1414
|
*/
|
|
1270
|
-
registerEventDispatcher(dispatcher: EventDispatcher
|
|
1415
|
+
registerEventDispatcher(dispatcher: EventDispatcher<any>, changeEvent?: string): void;
|
|
1271
1416
|
resize(width: number, height: number): void;
|
|
1272
1417
|
get dirty(): boolean;
|
|
1273
1418
|
set dirty(dirty: boolean);
|
|
@@ -1287,12 +1432,15 @@ declare class Renderer implements Disposable {
|
|
|
1287
1432
|
get scene(): MineRenderScene;
|
|
1288
1433
|
get camera(): Camera;
|
|
1289
1434
|
get renderer(): WebGLRenderer;
|
|
1290
|
-
get composer(): EffectComposer
|
|
1435
|
+
get composer(): Maybe<EffectComposer>;
|
|
1436
|
+
/** Renderer-owned controls, or undefined when disabled at construction or after disposal. */
|
|
1437
|
+
get controls(): Maybe<OrbitControls>;
|
|
1291
1438
|
}
|
|
1292
1439
|
interface RendererOptions {
|
|
1293
1440
|
camera: CameraOptions;
|
|
1294
1441
|
render: RenderOptions;
|
|
1295
1442
|
composer: ComposerOptions;
|
|
1443
|
+
controls?: ControlsOptions;
|
|
1296
1444
|
debug: DebugOptions;
|
|
1297
1445
|
}
|
|
1298
1446
|
interface CameraOptions {
|
|
@@ -1313,6 +1461,7 @@ interface CameraOptions {
|
|
|
1313
1461
|
lookingAt: Vector3 | TripleArray;
|
|
1314
1462
|
}
|
|
1315
1463
|
interface RenderOptions {
|
|
1464
|
+
/** Maximum draw rate (60 by default); zero or a negative value disables the limit. */
|
|
1316
1465
|
fpsLimit: number;
|
|
1317
1466
|
stats: boolean;
|
|
1318
1467
|
antialias: boolean;
|
|
@@ -1323,6 +1472,9 @@ interface RenderOptions {
|
|
|
1323
1472
|
interface ComposerOptions {
|
|
1324
1473
|
enabled: boolean;
|
|
1325
1474
|
}
|
|
1475
|
+
interface ControlsOptions {
|
|
1476
|
+
enabled: boolean;
|
|
1477
|
+
}
|
|
1326
1478
|
interface DebugOptions {
|
|
1327
1479
|
grid: boolean;
|
|
1328
1480
|
axes: boolean;
|
|
@@ -1337,7 +1489,7 @@ declare class SceneInspector {
|
|
|
1337
1489
|
private selectedObject?;
|
|
1338
1490
|
constructor(renderer: Renderer);
|
|
1339
1491
|
protected init(): void;
|
|
1340
|
-
findMeshChildren(from: Object3D, out?: Mesh[]): Mesh<three.BufferGeometry
|
|
1492
|
+
findMeshChildren(from: Object3D, out?: Mesh[]): Mesh<three.BufferGeometry<three.NormalBufferAttributes>, three.Material | three.Material[], three.Object3DEventMap>[];
|
|
1341
1493
|
onClick(event: any): void;
|
|
1342
1494
|
appendTo(el: HTMLElement): void;
|
|
1343
1495
|
protected handleRaycasterObjects(intersections: Intersection[]): void;
|
|
@@ -1374,26 +1526,6 @@ declare class StatLine {
|
|
|
1374
1526
|
update(): void;
|
|
1375
1527
|
}
|
|
1376
1528
|
|
|
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
|
-
|
|
1397
1529
|
type SkinGeometries = Record<SkinPart, TripleArray>;
|
|
1398
1530
|
declare const classicSkinGeometries: SkinGeometries;
|
|
1399
1531
|
declare const slimSkinGeometries: SkinGeometries;
|
|
@@ -1412,6 +1544,8 @@ declare class Skins {
|
|
|
1412
1544
|
static capeFromUsername(username: string): Promise<Maybe<string>>;
|
|
1413
1545
|
static capeFromCapesDev(uuid: string, capeType?: string): Promise<Maybe<string>>;
|
|
1414
1546
|
private static usernameToUuid;
|
|
1547
|
+
private static usernameToUuidMcProxy;
|
|
1548
|
+
/** @deprecated **/
|
|
1415
1549
|
private static usernameToUuidSkinProxy;
|
|
1416
1550
|
private static usernameToUuidMineTools;
|
|
1417
1551
|
private static getProfileFromMinetools;
|
|
@@ -1421,11 +1555,18 @@ declare class Skins {
|
|
|
1421
1555
|
private static getCrafatarCapeUrl;
|
|
1422
1556
|
private static getMcHeadsSkinUrl;
|
|
1423
1557
|
private static getMineSkinPlayerSkinUrl;
|
|
1558
|
+
/** @deprecated **/
|
|
1424
1559
|
private static getSkinProxySkinUrl;
|
|
1560
|
+
/** @deprecated **/
|
|
1425
1561
|
private static getSkinProxyCapeUrl;
|
|
1562
|
+
private static getMcProxySkinUrl;
|
|
1563
|
+
private static getMcProxyCapeUrl;
|
|
1426
1564
|
}
|
|
1427
1565
|
|
|
1428
1566
|
declare class TextureLoader {
|
|
1567
|
+
private static readonly failedTextures;
|
|
1568
|
+
/** Reports whether image loading failed, so cached textures can be retried. */
|
|
1569
|
+
static hasFailed(texture: Texture): boolean;
|
|
1429
1570
|
protected static createTexture(): Texture;
|
|
1430
1571
|
static loadInBackground(src: string, format?: PixelFormat, rotation?: number): Texture;
|
|
1431
1572
|
static load(src: string, format?: PixelFormat, rotation?: number): Texture;
|
|
@@ -1439,91 +1580,14 @@ declare class Textures {
|
|
|
1439
1580
|
static getImage(key: TextureKey): Texture;
|
|
1440
1581
|
}
|
|
1441
1582
|
|
|
1442
|
-
declare function mergeBufferGeometries(geometries: BufferGeometry
|
|
1583
|
+
declare function mergeBufferGeometries(geometries: BufferGeometry[], useGroups?: boolean): BufferGeometry;
|
|
1443
1584
|
declare function mergeBufferAttributes(attributes: BufferAttribute[]): BufferAttribute;
|
|
1444
1585
|
declare function interleaveAttributes(attributes: BufferAttribute[]): InterleavedBufferAttribute;
|
|
1445
|
-
declare function estimateBytesUsed(geometry: BufferGeometry
|
|
1446
|
-
declare function mergeVertices(geometry: BufferGeometry
|
|
1447
|
-
declare function toTrianglesDrawMode(geometry: BufferGeometry
|
|
1586
|
+
declare function estimateBytesUsed(geometry: BufferGeometry): number;
|
|
1587
|
+
declare function mergeVertices(geometry: BufferGeometry, tolerance?: number): BufferGeometry;
|
|
1588
|
+
declare function toTrianglesDrawMode(geometry: BufferGeometry, drawMode: TrianglesDrawModes): BufferGeometry;
|
|
1448
1589
|
declare function computeMorphedAttributes(object: Mesh | Line | Points): object;
|
|
1449
1590
|
|
|
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
|
-
|
|
1527
1591
|
interface BlockInfo {
|
|
1528
1592
|
block: Block;
|
|
1529
1593
|
object: BlockObject;
|
|
@@ -1618,4 +1682,4 @@ declare class NodeCache extends PersistentCache<LocalStorage> {
|
|
|
1618
1682
|
forEach<T>(callback: (v: T, k: string) => void): Promise<void>;
|
|
1619
1683
|
}
|
|
1620
1684
|
|
|
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 };
|
|
1685
|
+
export { AXES, type AnimationFrame, type AnimationMeta, type AnimatorFunction, ArchiveAssetSource, type ArchiveEntry, type ArchiveProxy, AssetKey, AssetLoadError, AssetLoader, AssetParser, AssetSource, type AssetType, Assets, Axis, BUILTIN_ENTITY, BUILTIN_GENERATED, BasicAssetKey, type BasicMinecraftAsset, BatchedExecutor, type BedrockBone, type BedrockCube, type BedrockEntityDescription, type BedrockEntityFile, type BedrockGeometry, type BedrockGeometryFile, type Block, BlockEntityModels, type BlockInfo, type BlockModel, type BlockModelTextures, BlockObject, type BlockObjectOptions, type BlockState, type BlockStateMultipart, type BlockStateProperties, type BlockStateProperty, type BlockStatePropertyDefaults, type BlockStatePropertyValue, type BlockStateVariant, type BlockStateVariants, BlockStates, type BoxGeometryKey, BrowserArchiveProxy, CUBE_FACES, type CacheKey, Caching, type CameraOptions, CanvasImage, Chunk, type CompatCanvas, type CompatImage, type ComposerOptions, type ControlsOptions, type Cube, CubeFace, CubeFaceIndex, DEFAULT_ELEMENTS, DEFAULT_NAMESPACE, DEFAULT_ROOT, DEFAULT_UV, DISPLAY_POSITIONS, type DebugOptions, type DeepPartial, DefaultBlockStates, DisplayPosition, type Disposable, type DoubleArray, type ElementFace, type ElementRotation, Entities, type EntityModel, EntityModels, EntityObject, type EntityObjectOptions, Env, type EnvProvider, type ExtractableImageData, type FromTo, Geometries, GuiLight, GuiObject, type GuiObjectOptions, HostedAssetSource, type IModelTextures, ITEM_GENERATED, type ImageInfo, ImageLoader, type ImageSizeInfo, InstanceManager, InstanceReference, type Instanceable, type ItemModel, type ItemModelTextures, type ListAsset, MapControls, type MaterialKey, Materials, type Maybe, type MeshKey, Meshes, MineRenderError, MineRenderScene, type MineRenderSceneOptions, MineRenderWorld, type MinecraftAsset, MinecraftCubeTexture, MinecraftFaceUV, type MinecraftTextureMeta, type Model, type ModelDisplay, type ModelElement, type ModelFaces, ModelGenerator, ModelMerger, ModelObject, type ModelObjectOptions, type ModelPart, ModelTextures, Models, type MultiBlockBlock, type MultiBlockStructure, type MultipartCondition, type NBTAsset, NBTHelper, NodeCache, NodeEnv, OrbitControls, PersistentCache, type QuadArray, type RawImageKey, type RenderOptions, Renderer, type RendererOptions, type RequestConfig, RequestError, type RequestResponse, Requests, type ResponseParser, SKIN_PARTS, SceneInspector, SceneObject, type SceneObjectOptions, SceneStats, SceneStatsDisplay, SchematicParser, type Serializable, type SkinGeometries, SkinObject, type SkinObjectOptions, SkinPart, type SkinTextureCoordinates, Skins, type StructureNBT, StructureParser, type TextureAsset, TextureAtlas, type TextureKey, TextureLoader, Textures, Ticker, type TickerFunction, TintColors, type Transformable, type TripleArray, UVMapper, WrappedImage, addBox3WireframeToObject, addWireframeToMesh, addWireframeToObject, applyElementRotation, applyGenericRotation, applyModelPartRotation, axisToVec3, base64decode, base64encode, captureException, changeEvent, clampRotationDegrees, classicSkinGeometries, classicSkinTextureCoordinates, computeMorphedAttributes, createCanvas, createImage, estimateBytesUsed, interleaveAttributes, isAssetKey, isBasicAssetKey, isBlockObject, isDisposable, isDoubleArray, isEntityObject, isInstanceManager, isInstanceReference, isInstanceable, isInstancedMesh, isMesh, isMineRenderScene, isModelObject, isObject3D, isOrthographicCamera, isPerspectiveCamera, isQuadArray, isSceneObject, isTransformable, isTripleArray, isVector3, md5, mergeBufferAttributes, mergeBufferGeometries, mergeVertices, prefix, registerNodeEnv, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode };
|