minerender 2.1.0-alpha.2 → 2.1.0-alpha.21
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 +212 -141
- package/dist/browser/index.d.ts +212 -141
- package/dist/browser/index.js +2007 -1669
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/index.mjs +1990 -1652
- package/dist/browser/index.mjs.map +1 -1
- package/dist/bundle.js +3789 -5036
- package/dist/bundle.js.map +1 -1
- package/dist/node/index.d.mts +211 -140
- package/dist/node/index.d.ts +211 -140
- package/dist/node/index.js +2034 -1624
- package/dist/node/index.js.map +1 -1
- package/dist/node/index.mjs +1660 -1253
- package/dist/node/index.mjs.map +1 -1
- package/package.json +7 -9
package/dist/node/index.d.ts
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import * as three from 'three';
|
|
2
|
-
import { Vector3, PixelFormat, BoxGeometry, Material, Mesh, Euler, Vector2, BufferAttribute, Float32BufferAttribute, Object3D, Box3, InstancedMesh, PerspectiveCamera, OrthographicCamera, Matrix4, Scene, Texture, Camera, WebGLRenderer, EventDispatcher, Raycaster, Intersection, CanvasTexture,
|
|
2
|
+
import { Vector3, PixelFormat, BoxGeometry, Material, Mesh, Euler, Vector2, BufferAttribute, Float32BufferAttribute, BufferGeometry, Object3D, Box3, InstancedMesh, PerspectiveCamera, OrthographicCamera, Matrix4, Scene, Object3DEventMap, Texture, Camera, MOUSE, TOUCH, WebGLRenderer, EventDispatcher, Raycaster, Intersection, CanvasTexture, InterleavedBufferAttribute, TrianglesDrawModes, Line, Points } from 'three';
|
|
3
3
|
import * as nodeCanvas from 'canvas';
|
|
4
4
|
import { ImageData as ImageData$1, CanvasRenderingContext2D } from 'canvas';
|
|
5
|
-
import { AxiosResponse, AxiosRequestConfig } from 'axios';
|
|
6
5
|
import { Buffer as Buffer$1 } from 'buffer';
|
|
7
6
|
import { NBT } from 'prismarine-nbt';
|
|
8
7
|
import { ZipReader } from '@zip.js/zip.js';
|
|
9
8
|
import { AsyncLoadingCache, SimpleCache } from '@inventivetalent/loading-cache';
|
|
10
|
-
import { BufferGeometry } from 'three/src/core/BufferGeometry';
|
|
11
|
-
import { Material as Material$1 } from 'three/src/materials/Material';
|
|
12
9
|
import Stats from 'stats.js';
|
|
13
10
|
import { EffectComposer } from 'postprocessing';
|
|
14
11
|
import { LocalStorage } from 'node-persist';
|
|
@@ -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>>;
|
|
@@ -737,6 +793,12 @@ interface Block {
|
|
|
737
793
|
nbt?: any;
|
|
738
794
|
}
|
|
739
795
|
|
|
796
|
+
declare class BlockTints {
|
|
797
|
+
/** Resolves block preview colors without biome context; explicit tints take precedence. */
|
|
798
|
+
static get(key: AssetKey | undefined, state: BlockStateProperties, model: Model, tints?: Record<number, number>): Promise<Record<number, number> | undefined>;
|
|
799
|
+
private static grassColor;
|
|
800
|
+
}
|
|
801
|
+
|
|
740
802
|
interface Instanceable {
|
|
741
803
|
nextInstance(): InstanceReference<SceneObject>;
|
|
742
804
|
getMatrixAt(index: number, matrix?: Matrix4): Matrix4;
|
|
@@ -793,6 +855,10 @@ declare class ModelObject extends SceneObject {
|
|
|
793
855
|
protected applyTextures(): void;
|
|
794
856
|
}
|
|
795
857
|
interface ModelObjectOptions extends SceneObjectOptions {
|
|
858
|
+
/** Quarter-turn block rotation in radians to compensate when locking UVs. */
|
|
859
|
+
uvLockRotation?: TripleArray;
|
|
860
|
+
/** sRGB 0xRRGGBB colors by face tint index; omitted indices stay white. */
|
|
861
|
+
tints?: Record<number, number>;
|
|
796
862
|
}
|
|
797
863
|
declare function isModelObject(obj: any): obj is ModelObject;
|
|
798
864
|
|
|
@@ -855,6 +921,7 @@ declare class EntityObject extends SceneObject {
|
|
|
855
921
|
constructor(entity: EntityModel, options?: Partial<EntityObjectOptions>);
|
|
856
922
|
init(): Promise<void>;
|
|
857
923
|
dispose(): void;
|
|
924
|
+
private get textureKey();
|
|
858
925
|
protected loadTextures(): Promise<void>;
|
|
859
926
|
protected createMeshes(force?: boolean): void;
|
|
860
927
|
protected applyTextures(): Promise<void>;
|
|
@@ -887,7 +954,9 @@ interface MineRenderSceneOptions {
|
|
|
887
954
|
}
|
|
888
955
|
declare function isMineRenderScene(obj: any): obj is MineRenderScene;
|
|
889
956
|
|
|
890
|
-
declare class SceneObject extends Object3D
|
|
957
|
+
declare class SceneObject extends Object3D<Object3DEventMap & {
|
|
958
|
+
change: {};
|
|
959
|
+
}> implements Disposable, Instanceable, Transformable {
|
|
891
960
|
readonly isSceneObject: true;
|
|
892
961
|
static readonly DEFAULT_OPTIONS: SceneObjectOptions;
|
|
893
962
|
readonly options: SceneObjectOptions;
|
|
@@ -913,9 +982,9 @@ declare class SceneObject extends Object3D implements Disposable, Instanceable,
|
|
|
913
982
|
*/
|
|
914
983
|
toggleGroupVisibility(name: string, visible?: boolean): boolean;
|
|
915
984
|
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
|
|
985
|
+
protected createAndAddMesh(name?: string, group?: Object3D, geometry?: BufferGeometry, material?: Material | Material[], offsetAxis?: Axis, offset?: number): Mesh;
|
|
986
|
+
protected createMesh(name?: string, geometry?: BufferGeometry, material?: Material | Material[], offsetAxis?: Axis, offset?: number): Mesh;
|
|
987
|
+
protected createInstancedMesh(name: Maybe<string>, geometry: BufferGeometry, material: Material | Material[], count: number): InstancedMesh;
|
|
919
988
|
/**
|
|
920
989
|
* Get a mesh by its name
|
|
921
990
|
*/
|
|
@@ -1084,8 +1153,8 @@ interface NBTAsset extends MinecraftAsset, NBT {
|
|
|
1084
1153
|
}
|
|
1085
1154
|
|
|
1086
1155
|
interface ResponseParser<T extends MinecraftAsset> {
|
|
1087
|
-
config(request:
|
|
1088
|
-
parse(response:
|
|
1156
|
+
config(request: RequestConfig): any;
|
|
1157
|
+
parse(response: RequestResponse): Maybe<T> | Promise<Maybe<T>>;
|
|
1089
1158
|
}
|
|
1090
1159
|
|
|
1091
1160
|
declare class HostedAssetSource extends AssetSource {
|
|
@@ -1213,14 +1282,19 @@ declare class Caching {
|
|
|
1213
1282
|
static readonly mergedModelCache: AsyncLoadingCache<CacheKey, Model>;
|
|
1214
1283
|
static readonly modelTextureAtlasCache: AsyncLoadingCache<CacheKey, TextureAtlas>;
|
|
1215
1284
|
static readonly blockStateCache: AsyncLoadingCache<CacheKey, BlockState>;
|
|
1285
|
+
static readonly listAssetCache: AsyncLoadingCache<CacheKey, ListAsset>;
|
|
1286
|
+
static readonly defaultBlockStatesCache: AsyncLoadingCache<CacheKey, DefaultBlockStates>;
|
|
1287
|
+
static readonly blockTintCache: AsyncLoadingCache<CacheKey, number>;
|
|
1288
|
+
static readonly entityModelsCache: AsyncLoadingCache<CacheKey, EntityModels>;
|
|
1289
|
+
private static createAssetCache;
|
|
1216
1290
|
/** Every cache above, so clear()/end() can never fall out of sync with the field list again. */
|
|
1217
1291
|
private static get all();
|
|
1218
1292
|
static clear(): void;
|
|
1219
1293
|
/**
|
|
1220
1294
|
* Clears every cache and stops its expiry timer.
|
|
1221
1295
|
*
|
|
1222
|
-
*
|
|
1223
|
-
*
|
|
1296
|
+
* Expiry timers are unref'd in Node, so idle processes can exit without this cleanup.
|
|
1297
|
+
* Use {@link shutdown} to also stop requests and the shared Ticker.
|
|
1224
1298
|
*/
|
|
1225
1299
|
static end(): void;
|
|
1226
1300
|
static get cacheSizes(): {};
|
|
@@ -1236,6 +1310,83 @@ declare class GuiObject extends SceneObject {
|
|
|
1236
1310
|
interface GuiObjectOptions extends SceneObjectOptions {
|
|
1237
1311
|
}
|
|
1238
1312
|
|
|
1313
|
+
declare class OrbitControls {
|
|
1314
|
+
constructor(object: Camera, domElement?: HTMLElement);
|
|
1315
|
+
|
|
1316
|
+
object: Camera;
|
|
1317
|
+
domElement: HTMLElement | HTMLDocument;
|
|
1318
|
+
|
|
1319
|
+
// API
|
|
1320
|
+
enabled: boolean;
|
|
1321
|
+
target: Vector3;
|
|
1322
|
+
|
|
1323
|
+
// deprecated
|
|
1324
|
+
center: Vector3;
|
|
1325
|
+
|
|
1326
|
+
minDistance: number;
|
|
1327
|
+
maxDistance: number;
|
|
1328
|
+
|
|
1329
|
+
minZoom: number;
|
|
1330
|
+
maxZoom: number;
|
|
1331
|
+
|
|
1332
|
+
minPolarAngle: number;
|
|
1333
|
+
maxPolarAngle: number;
|
|
1334
|
+
|
|
1335
|
+
minAzimuthAngle: number;
|
|
1336
|
+
maxAzimuthAngle: number;
|
|
1337
|
+
|
|
1338
|
+
enableDamping: boolean;
|
|
1339
|
+
dampingFactor: number;
|
|
1340
|
+
|
|
1341
|
+
enableZoom: boolean;
|
|
1342
|
+
zoomSpeed: number;
|
|
1343
|
+
|
|
1344
|
+
enableRotate: boolean;
|
|
1345
|
+
rotateSpeed: number;
|
|
1346
|
+
|
|
1347
|
+
enablePan: boolean;
|
|
1348
|
+
panSpeed: number;
|
|
1349
|
+
screenSpacePanning: boolean;
|
|
1350
|
+
keyPanSpeed: number;
|
|
1351
|
+
|
|
1352
|
+
autoRotate: boolean;
|
|
1353
|
+
autoRotateSpeed: number;
|
|
1354
|
+
|
|
1355
|
+
enableKeys: boolean;
|
|
1356
|
+
keys: { LEFT: string; UP: string; RIGHT: string; BOTTOM: string };
|
|
1357
|
+
mouseButtons: { LEFT: MOUSE; MIDDLE: MOUSE; RIGHT: MOUSE };
|
|
1358
|
+
touches: { ONE: TOUCH; TWO: TOUCH };
|
|
1359
|
+
|
|
1360
|
+
update(): boolean;
|
|
1361
|
+
|
|
1362
|
+
listenToKeyEvents(domElement: HTMLElement): void;
|
|
1363
|
+
|
|
1364
|
+
saveState(): void;
|
|
1365
|
+
|
|
1366
|
+
reset(): void;
|
|
1367
|
+
|
|
1368
|
+
dispose(): void;
|
|
1369
|
+
|
|
1370
|
+
getPolarAngle(): number;
|
|
1371
|
+
|
|
1372
|
+
getAzimuthalAngle(): number;
|
|
1373
|
+
|
|
1374
|
+
getDistance(): number;
|
|
1375
|
+
|
|
1376
|
+
// EventDispatcher mixins
|
|
1377
|
+
addEventListener(type: string, listener: (event: any) => void): void;
|
|
1378
|
+
|
|
1379
|
+
hasEventListener(type: string, listener: (event: any) => void): boolean;
|
|
1380
|
+
|
|
1381
|
+
removeEventListener(type: string, listener: (event: any) => void): void;
|
|
1382
|
+
|
|
1383
|
+
dispatchEvent(event: { type: string; target: any }): void;
|
|
1384
|
+
}
|
|
1385
|
+
|
|
1386
|
+
declare class MapControls extends OrbitControls {
|
|
1387
|
+
constructor(object: Camera, domElement?: HTMLElement);
|
|
1388
|
+
}
|
|
1389
|
+
|
|
1239
1390
|
declare class Renderer implements Disposable {
|
|
1240
1391
|
static readonly DEFAULT_OPTIONS: RendererOptions;
|
|
1241
1392
|
readonly options: RendererOptions;
|
|
@@ -1243,14 +1394,14 @@ declare class Renderer implements Disposable {
|
|
|
1243
1394
|
protected _scene: MineRenderScene;
|
|
1244
1395
|
protected _camera: Camera;
|
|
1245
1396
|
protected _renderer: WebGLRenderer;
|
|
1246
|
-
protected _composer
|
|
1397
|
+
protected _composer?: EffectComposer;
|
|
1398
|
+
protected _controls?: OrbitControls;
|
|
1247
1399
|
protected _stats?: Stats;
|
|
1248
1400
|
protected _dirty: boolean;
|
|
1249
1401
|
protected _animationLoop: any;
|
|
1250
|
-
protected
|
|
1251
|
-
protected _animationTimer?: NodeJS.Timeout;
|
|
1252
|
-
protected _animationFrame?: number;
|
|
1402
|
+
protected _frameInterval?: number;
|
|
1253
1403
|
protected _resizeListener?: () => void;
|
|
1404
|
+
private _nextFrameTime?;
|
|
1254
1405
|
private _disposed;
|
|
1255
1406
|
private readonly _debugHelpers;
|
|
1256
1407
|
private readonly _eventDispatchers;
|
|
@@ -1259,7 +1410,8 @@ declare class Renderer implements Disposable {
|
|
|
1259
1410
|
protected createScene(): MineRenderScene;
|
|
1260
1411
|
protected createCamera(): Camera;
|
|
1261
1412
|
protected createRenderer(): WebGLRenderer;
|
|
1262
|
-
protected createComposer(): EffectComposer
|
|
1413
|
+
protected createComposer(): Maybe<EffectComposer>;
|
|
1414
|
+
protected createControls(): Maybe<OrbitControls>;
|
|
1263
1415
|
init(): void;
|
|
1264
1416
|
get element(): Maybe<HTMLElement>;
|
|
1265
1417
|
appendTo(element: HTMLElement): void;
|
|
@@ -1267,7 +1419,7 @@ declare class Renderer implements Disposable {
|
|
|
1267
1419
|
* Redraws when the dispatcher emits the selected event. Registering the same pair twice has no effect.
|
|
1268
1420
|
* The renderer removes its listener on disposal; the caller retains ownership of the dispatcher.
|
|
1269
1421
|
*/
|
|
1270
|
-
registerEventDispatcher(dispatcher: EventDispatcher
|
|
1422
|
+
registerEventDispatcher(dispatcher: EventDispatcher<any>, changeEvent?: string): void;
|
|
1271
1423
|
resize(width: number, height: number): void;
|
|
1272
1424
|
get dirty(): boolean;
|
|
1273
1425
|
set dirty(dirty: boolean);
|
|
@@ -1287,12 +1439,15 @@ declare class Renderer implements Disposable {
|
|
|
1287
1439
|
get scene(): MineRenderScene;
|
|
1288
1440
|
get camera(): Camera;
|
|
1289
1441
|
get renderer(): WebGLRenderer;
|
|
1290
|
-
get composer(): EffectComposer
|
|
1442
|
+
get composer(): Maybe<EffectComposer>;
|
|
1443
|
+
/** Renderer-owned controls, or undefined when disabled at construction or after disposal. */
|
|
1444
|
+
get controls(): Maybe<OrbitControls>;
|
|
1291
1445
|
}
|
|
1292
1446
|
interface RendererOptions {
|
|
1293
1447
|
camera: CameraOptions;
|
|
1294
1448
|
render: RenderOptions;
|
|
1295
1449
|
composer: ComposerOptions;
|
|
1450
|
+
controls?: ControlsOptions;
|
|
1296
1451
|
debug: DebugOptions;
|
|
1297
1452
|
}
|
|
1298
1453
|
interface CameraOptions {
|
|
@@ -1313,6 +1468,7 @@ interface CameraOptions {
|
|
|
1313
1468
|
lookingAt: Vector3 | TripleArray;
|
|
1314
1469
|
}
|
|
1315
1470
|
interface RenderOptions {
|
|
1471
|
+
/** Maximum draw rate (60 by default); zero or a negative value disables the limit. */
|
|
1316
1472
|
fpsLimit: number;
|
|
1317
1473
|
stats: boolean;
|
|
1318
1474
|
antialias: boolean;
|
|
@@ -1323,6 +1479,9 @@ interface RenderOptions {
|
|
|
1323
1479
|
interface ComposerOptions {
|
|
1324
1480
|
enabled: boolean;
|
|
1325
1481
|
}
|
|
1482
|
+
interface ControlsOptions {
|
|
1483
|
+
enabled: boolean;
|
|
1484
|
+
}
|
|
1326
1485
|
interface DebugOptions {
|
|
1327
1486
|
grid: boolean;
|
|
1328
1487
|
axes: boolean;
|
|
@@ -1337,7 +1496,7 @@ declare class SceneInspector {
|
|
|
1337
1496
|
private selectedObject?;
|
|
1338
1497
|
constructor(renderer: Renderer);
|
|
1339
1498
|
protected init(): void;
|
|
1340
|
-
findMeshChildren(from: Object3D, out?: Mesh[]): Mesh<three.BufferGeometry
|
|
1499
|
+
findMeshChildren(from: Object3D, out?: Mesh[]): Mesh<three.BufferGeometry<three.NormalBufferAttributes>, three.Material | three.Material[], three.Object3DEventMap>[];
|
|
1341
1500
|
onClick(event: any): void;
|
|
1342
1501
|
appendTo(el: HTMLElement): void;
|
|
1343
1502
|
protected handleRaycasterObjects(intersections: Intersection[]): void;
|
|
@@ -1374,26 +1533,6 @@ declare class StatLine {
|
|
|
1374
1533
|
update(): void;
|
|
1375
1534
|
}
|
|
1376
1535
|
|
|
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
1536
|
type SkinGeometries = Record<SkinPart, TripleArray>;
|
|
1398
1537
|
declare const classicSkinGeometries: SkinGeometries;
|
|
1399
1538
|
declare const slimSkinGeometries: SkinGeometries;
|
|
@@ -1412,6 +1551,8 @@ declare class Skins {
|
|
|
1412
1551
|
static capeFromUsername(username: string): Promise<Maybe<string>>;
|
|
1413
1552
|
static capeFromCapesDev(uuid: string, capeType?: string): Promise<Maybe<string>>;
|
|
1414
1553
|
private static usernameToUuid;
|
|
1554
|
+
private static usernameToUuidMcProxy;
|
|
1555
|
+
/** @deprecated **/
|
|
1415
1556
|
private static usernameToUuidSkinProxy;
|
|
1416
1557
|
private static usernameToUuidMineTools;
|
|
1417
1558
|
private static getProfileFromMinetools;
|
|
@@ -1421,11 +1562,18 @@ declare class Skins {
|
|
|
1421
1562
|
private static getCrafatarCapeUrl;
|
|
1422
1563
|
private static getMcHeadsSkinUrl;
|
|
1423
1564
|
private static getMineSkinPlayerSkinUrl;
|
|
1565
|
+
/** @deprecated **/
|
|
1424
1566
|
private static getSkinProxySkinUrl;
|
|
1567
|
+
/** @deprecated **/
|
|
1425
1568
|
private static getSkinProxyCapeUrl;
|
|
1569
|
+
private static getMcProxySkinUrl;
|
|
1570
|
+
private static getMcProxyCapeUrl;
|
|
1426
1571
|
}
|
|
1427
1572
|
|
|
1428
1573
|
declare class TextureLoader {
|
|
1574
|
+
private static readonly failedTextures;
|
|
1575
|
+
/** Reports whether image loading failed, so cached textures can be retried. */
|
|
1576
|
+
static hasFailed(texture: Texture): boolean;
|
|
1429
1577
|
protected static createTexture(): Texture;
|
|
1430
1578
|
static loadInBackground(src: string, format?: PixelFormat, rotation?: number): Texture;
|
|
1431
1579
|
static load(src: string, format?: PixelFormat, rotation?: number): Texture;
|
|
@@ -1439,91 +1587,14 @@ declare class Textures {
|
|
|
1439
1587
|
static getImage(key: TextureKey): Texture;
|
|
1440
1588
|
}
|
|
1441
1589
|
|
|
1442
|
-
declare function mergeBufferGeometries(geometries: BufferGeometry
|
|
1590
|
+
declare function mergeBufferGeometries(geometries: BufferGeometry[], useGroups?: boolean): BufferGeometry;
|
|
1443
1591
|
declare function mergeBufferAttributes(attributes: BufferAttribute[]): BufferAttribute;
|
|
1444
1592
|
declare function interleaveAttributes(attributes: BufferAttribute[]): InterleavedBufferAttribute;
|
|
1445
|
-
declare function estimateBytesUsed(geometry: BufferGeometry
|
|
1446
|
-
declare function mergeVertices(geometry: BufferGeometry
|
|
1447
|
-
declare function toTrianglesDrawMode(geometry: BufferGeometry
|
|
1593
|
+
declare function estimateBytesUsed(geometry: BufferGeometry): number;
|
|
1594
|
+
declare function mergeVertices(geometry: BufferGeometry, tolerance?: number): BufferGeometry;
|
|
1595
|
+
declare function toTrianglesDrawMode(geometry: BufferGeometry, drawMode: TrianglesDrawModes): BufferGeometry;
|
|
1448
1596
|
declare function computeMorphedAttributes(object: Mesh | Line | Points): object;
|
|
1449
1597
|
|
|
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
1598
|
interface BlockInfo {
|
|
1528
1599
|
block: Block;
|
|
1529
1600
|
object: BlockObject;
|
|
@@ -1618,4 +1689,4 @@ declare class NodeCache extends PersistentCache<LocalStorage> {
|
|
|
1618
1689
|
forEach<T>(callback: (v: T, k: string) => void): Promise<void>;
|
|
1619
1690
|
}
|
|
1620
1691
|
|
|
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 };
|
|
1692
|
+
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, BlockTints, 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 };
|