minerender 2.1.0-alpha.1 → 2.1.0-alpha.4

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.
@@ -1,5 +1,5 @@
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, BufferGeometry as BufferGeometry$1, InterleavedBufferAttribute, TrianglesDrawModes, Line, Points, MOUSE, TOUCH } from 'three';
2
+ import { Vector3, PixelFormat, BoxGeometry, Material, Mesh, Euler, Vector2, BufferAttribute, Float32BufferAttribute, Object3D, Box3, InstancedMesh, PerspectiveCamera, OrthographicCamera, Matrix4, Scene, Texture, Camera, MOUSE, TOUCH, WebGLRenderer, EventDispatcher, Raycaster, Intersection, CanvasTexture, BufferGeometry as BufferGeometry$1, InterleavedBufferAttribute, TrianglesDrawModes, Line, Points } from 'three';
3
3
  import * as nodeCanvas from 'canvas';
4
4
  import { ImageData as ImageData$1, CanvasRenderingContext2D } from 'canvas';
5
5
  import { AxiosResponse, AxiosRequestConfig } from 'axios';
@@ -869,9 +869,12 @@ declare class MineRenderScene extends Scene {
869
869
  readonly stats: SceneStats;
870
870
  protected readonly instanceManager: InstanceManager;
871
871
  dirty: boolean;
872
+ private readonly observedObjects;
873
+ private readonly onObjectChange;
872
874
  constructor(options?: DeepPartial<MineRenderSceneOptions>);
873
- add(...object: any[]): this;
874
- remove(...object: any[]): this;
875
+ add(...objects: Object3D[]): this;
876
+ remove(...objects: Object3D[]): this;
877
+ private updateObjectRegistration;
875
878
  initAndAdd(...object: SceneObject[]): Promise<this>;
876
879
  addSceneObject<A extends BasicMinecraftAsset, T extends SceneObject, O extends SceneObjectOptions>(asset: A, objectSupplier: () => T | Promise<T>, _options?: Partial<O>, parent?: Object3D): Promise<T | InstanceReference<T>>;
877
880
  addModel(model: Model, options?: Partial<ModelObjectOptions>, parent?: Object3D): Promise<ModelObject | InstanceReference<ModelObject>>;
@@ -1232,7 +1235,84 @@ declare class GuiObject extends SceneObject {
1232
1235
  interface GuiObjectOptions extends SceneObjectOptions {
1233
1236
  }
1234
1237
 
1235
- declare class Renderer {
1238
+ declare class OrbitControls {
1239
+ constructor(object: Camera, domElement?: HTMLElement);
1240
+
1241
+ object: Camera;
1242
+ domElement: HTMLElement | HTMLDocument;
1243
+
1244
+ // API
1245
+ enabled: boolean;
1246
+ target: Vector3;
1247
+
1248
+ // deprecated
1249
+ center: Vector3;
1250
+
1251
+ minDistance: number;
1252
+ maxDistance: number;
1253
+
1254
+ minZoom: number;
1255
+ maxZoom: number;
1256
+
1257
+ minPolarAngle: number;
1258
+ maxPolarAngle: number;
1259
+
1260
+ minAzimuthAngle: number;
1261
+ maxAzimuthAngle: number;
1262
+
1263
+ enableDamping: boolean;
1264
+ dampingFactor: number;
1265
+
1266
+ enableZoom: boolean;
1267
+ zoomSpeed: number;
1268
+
1269
+ enableRotate: boolean;
1270
+ rotateSpeed: number;
1271
+
1272
+ enablePan: boolean;
1273
+ panSpeed: number;
1274
+ screenSpacePanning: boolean;
1275
+ keyPanSpeed: number;
1276
+
1277
+ autoRotate: boolean;
1278
+ autoRotateSpeed: number;
1279
+
1280
+ enableKeys: boolean;
1281
+ keys: { LEFT: string; UP: string; RIGHT: string; BOTTOM: string };
1282
+ mouseButtons: { LEFT: MOUSE; MIDDLE: MOUSE; RIGHT: MOUSE };
1283
+ touches: { ONE: TOUCH; TWO: TOUCH };
1284
+
1285
+ update(): boolean;
1286
+
1287
+ listenToKeyEvents(domElement: HTMLElement): void;
1288
+
1289
+ saveState(): void;
1290
+
1291
+ reset(): void;
1292
+
1293
+ dispose(): void;
1294
+
1295
+ getPolarAngle(): number;
1296
+
1297
+ getAzimuthalAngle(): number;
1298
+
1299
+ getDistance(): number;
1300
+
1301
+ // EventDispatcher mixins
1302
+ addEventListener(type: string, listener: (event: any) => void): void;
1303
+
1304
+ hasEventListener(type: string, listener: (event: any) => void): boolean;
1305
+
1306
+ removeEventListener(type: string, listener: (event: any) => void): void;
1307
+
1308
+ dispatchEvent(event: { type: string; target: any }): void;
1309
+ }
1310
+
1311
+ declare class MapControls extends OrbitControls {
1312
+ constructor(object: Camera, domElement?: HTMLElement);
1313
+ }
1314
+
1315
+ declare class Renderer implements Disposable {
1236
1316
  static readonly DEFAULT_OPTIONS: RendererOptions;
1237
1317
  readonly options: RendererOptions;
1238
1318
  protected _element?: HTMLElement;
@@ -1240,23 +1320,29 @@ declare class Renderer {
1240
1320
  protected _camera: Camera;
1241
1321
  protected _renderer: WebGLRenderer;
1242
1322
  protected _composer: EffectComposer;
1323
+ protected _controls?: OrbitControls;
1243
1324
  protected _stats?: Stats;
1244
1325
  protected _dirty: boolean;
1245
1326
  protected _animationLoop: any;
1246
- protected _fpsTimer: any;
1247
- protected _animationTimer?: NodeJS.Timeout;
1248
- protected _animationFrame?: number;
1327
+ protected _frameInterval?: number;
1249
1328
  protected _resizeListener?: () => void;
1329
+ private _nextFrameTime?;
1330
+ private _disposed;
1331
+ private readonly _debugHelpers;
1332
+ private readonly _eventDispatchers;
1333
+ private readonly _changeListener;
1250
1334
  constructor(options?: DeepPartial<RendererOptions>);
1251
1335
  protected createScene(): MineRenderScene;
1252
1336
  protected createCamera(): Camera;
1253
1337
  protected createRenderer(): WebGLRenderer;
1254
1338
  protected createComposer(): EffectComposer;
1339
+ protected createControls(): Maybe<OrbitControls>;
1255
1340
  init(): void;
1256
1341
  get element(): Maybe<HTMLElement>;
1257
1342
  appendTo(element: HTMLElement): void;
1258
1343
  /**
1259
- * Register an EventDispatcher which may update the scene or renderer in order to redraw the scene
1344
+ * Redraws when the dispatcher emits the selected event. Registering the same pair twice has no effect.
1345
+ * The renderer removes its listener on disposal; the caller retains ownership of the dispatcher.
1260
1346
  */
1261
1347
  registerEventDispatcher(dispatcher: EventDispatcher, changeEvent?: string): void;
1262
1348
  resize(width: number, height: number): void;
@@ -1264,6 +1350,12 @@ declare class Renderer {
1264
1350
  set dirty(dirty: boolean);
1265
1351
  start(): void;
1266
1352
  stop(): void;
1353
+ /**
1354
+ * Stops rendering and releases owned resources. Repeated calls have no effect, and a disposed
1355
+ * renderer cannot be restarted. Scene objects are detached; shared assets and caller-owned
1356
+ * controls must be managed by their owners.
1357
+ */
1358
+ dispose(): void;
1267
1359
  private animate;
1268
1360
  toImage(): string;
1269
1361
  protected get attachedToBody(): boolean;
@@ -1273,11 +1365,14 @@ declare class Renderer {
1273
1365
  get camera(): Camera;
1274
1366
  get renderer(): WebGLRenderer;
1275
1367
  get composer(): EffectComposer;
1368
+ /** Renderer-owned controls, or undefined when disabled at construction or after disposal. */
1369
+ get controls(): Maybe<OrbitControls>;
1276
1370
  }
1277
1371
  interface RendererOptions {
1278
1372
  camera: CameraOptions;
1279
1373
  render: RenderOptions;
1280
1374
  composer: ComposerOptions;
1375
+ controls?: ControlsOptions;
1281
1376
  debug: DebugOptions;
1282
1377
  }
1283
1378
  interface CameraOptions {
@@ -1298,6 +1393,7 @@ interface CameraOptions {
1298
1393
  lookingAt: Vector3 | TripleArray;
1299
1394
  }
1300
1395
  interface RenderOptions {
1396
+ /** Maximum draw rate (60 by default); zero or a negative value disables the limit. */
1301
1397
  fpsLimit: number;
1302
1398
  stats: boolean;
1303
1399
  antialias: boolean;
@@ -1308,6 +1404,9 @@ interface RenderOptions {
1308
1404
  interface ComposerOptions {
1309
1405
  enabled: boolean;
1310
1406
  }
1407
+ interface ControlsOptions {
1408
+ enabled: boolean;
1409
+ }
1311
1410
  interface DebugOptions {
1312
1411
  grid: boolean;
1313
1412
  axes: boolean;
@@ -1432,83 +1531,6 @@ declare function mergeVertices(geometry: BufferGeometry$1, tolerance?: number):
1432
1531
  declare function toTrianglesDrawMode(geometry: BufferGeometry$1, drawMode: TrianglesDrawModes): BufferGeometry$1;
1433
1532
  declare function computeMorphedAttributes(object: Mesh | Line | Points): object;
1434
1533
 
1435
- declare class OrbitControls {
1436
- constructor(object: Camera, domElement?: HTMLElement);
1437
-
1438
- object: Camera;
1439
- domElement: HTMLElement | HTMLDocument;
1440
-
1441
- // API
1442
- enabled: boolean;
1443
- target: Vector3;
1444
-
1445
- // deprecated
1446
- center: Vector3;
1447
-
1448
- minDistance: number;
1449
- maxDistance: number;
1450
-
1451
- minZoom: number;
1452
- maxZoom: number;
1453
-
1454
- minPolarAngle: number;
1455
- maxPolarAngle: number;
1456
-
1457
- minAzimuthAngle: number;
1458
- maxAzimuthAngle: number;
1459
-
1460
- enableDamping: boolean;
1461
- dampingFactor: number;
1462
-
1463
- enableZoom: boolean;
1464
- zoomSpeed: number;
1465
-
1466
- enableRotate: boolean;
1467
- rotateSpeed: number;
1468
-
1469
- enablePan: boolean;
1470
- panSpeed: number;
1471
- screenSpacePanning: boolean;
1472
- keyPanSpeed: number;
1473
-
1474
- autoRotate: boolean;
1475
- autoRotateSpeed: number;
1476
-
1477
- enableKeys: boolean;
1478
- keys: { LEFT: string; UP: string; RIGHT: string; BOTTOM: string };
1479
- mouseButtons: { LEFT: MOUSE; MIDDLE: MOUSE; RIGHT: MOUSE };
1480
- touches: { ONE: TOUCH; TWO: TOUCH };
1481
-
1482
- update(): boolean;
1483
-
1484
- listenToKeyEvents(domElement: HTMLElement): void;
1485
-
1486
- saveState(): void;
1487
-
1488
- reset(): void;
1489
-
1490
- dispose(): void;
1491
-
1492
- getPolarAngle(): number;
1493
-
1494
- getAzimuthalAngle(): number;
1495
-
1496
- getDistance(): number;
1497
-
1498
- // EventDispatcher mixins
1499
- addEventListener(type: string, listener: (event: any) => void): void;
1500
-
1501
- hasEventListener(type: string, listener: (event: any) => void): boolean;
1502
-
1503
- removeEventListener(type: string, listener: (event: any) => void): void;
1504
-
1505
- dispatchEvent(event: { type: string; target: any }): void;
1506
- }
1507
-
1508
- declare class MapControls extends OrbitControls {
1509
- constructor(object: Camera, domElement?: HTMLElement);
1510
- }
1511
-
1512
1534
  interface BlockInfo {
1513
1535
  block: Block;
1514
1536
  object: BlockObject;
@@ -1601,4 +1623,4 @@ declare class BrowserCache extends PersistentCache<LocalForage> {
1601
1623
  */
1602
1624
  declare function probeImageSize(data: Uint8Array): ImageSizeInfo;
1603
1625
 
1604
- 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 };
1626
+ 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 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, 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 };
@@ -1,5 +1,5 @@
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, BufferGeometry as BufferGeometry$1, InterleavedBufferAttribute, TrianglesDrawModes, Line, Points, MOUSE, TOUCH } from 'three';
2
+ import { Vector3, PixelFormat, BoxGeometry, Material, Mesh, Euler, Vector2, BufferAttribute, Float32BufferAttribute, Object3D, Box3, InstancedMesh, PerspectiveCamera, OrthographicCamera, Matrix4, Scene, Texture, Camera, MOUSE, TOUCH, WebGLRenderer, EventDispatcher, Raycaster, Intersection, CanvasTexture, BufferGeometry as BufferGeometry$1, InterleavedBufferAttribute, TrianglesDrawModes, Line, Points } from 'three';
3
3
  import * as nodeCanvas from 'canvas';
4
4
  import { ImageData as ImageData$1, CanvasRenderingContext2D } from 'canvas';
5
5
  import { AxiosResponse, AxiosRequestConfig } from 'axios';
@@ -869,9 +869,12 @@ declare class MineRenderScene extends Scene {
869
869
  readonly stats: SceneStats;
870
870
  protected readonly instanceManager: InstanceManager;
871
871
  dirty: boolean;
872
+ private readonly observedObjects;
873
+ private readonly onObjectChange;
872
874
  constructor(options?: DeepPartial<MineRenderSceneOptions>);
873
- add(...object: any[]): this;
874
- remove(...object: any[]): this;
875
+ add(...objects: Object3D[]): this;
876
+ remove(...objects: Object3D[]): this;
877
+ private updateObjectRegistration;
875
878
  initAndAdd(...object: SceneObject[]): Promise<this>;
876
879
  addSceneObject<A extends BasicMinecraftAsset, T extends SceneObject, O extends SceneObjectOptions>(asset: A, objectSupplier: () => T | Promise<T>, _options?: Partial<O>, parent?: Object3D): Promise<T | InstanceReference<T>>;
877
880
  addModel(model: Model, options?: Partial<ModelObjectOptions>, parent?: Object3D): Promise<ModelObject | InstanceReference<ModelObject>>;
@@ -1232,7 +1235,84 @@ declare class GuiObject extends SceneObject {
1232
1235
  interface GuiObjectOptions extends SceneObjectOptions {
1233
1236
  }
1234
1237
 
1235
- declare class Renderer {
1238
+ declare class OrbitControls {
1239
+ constructor(object: Camera, domElement?: HTMLElement);
1240
+
1241
+ object: Camera;
1242
+ domElement: HTMLElement | HTMLDocument;
1243
+
1244
+ // API
1245
+ enabled: boolean;
1246
+ target: Vector3;
1247
+
1248
+ // deprecated
1249
+ center: Vector3;
1250
+
1251
+ minDistance: number;
1252
+ maxDistance: number;
1253
+
1254
+ minZoom: number;
1255
+ maxZoom: number;
1256
+
1257
+ minPolarAngle: number;
1258
+ maxPolarAngle: number;
1259
+
1260
+ minAzimuthAngle: number;
1261
+ maxAzimuthAngle: number;
1262
+
1263
+ enableDamping: boolean;
1264
+ dampingFactor: number;
1265
+
1266
+ enableZoom: boolean;
1267
+ zoomSpeed: number;
1268
+
1269
+ enableRotate: boolean;
1270
+ rotateSpeed: number;
1271
+
1272
+ enablePan: boolean;
1273
+ panSpeed: number;
1274
+ screenSpacePanning: boolean;
1275
+ keyPanSpeed: number;
1276
+
1277
+ autoRotate: boolean;
1278
+ autoRotateSpeed: number;
1279
+
1280
+ enableKeys: boolean;
1281
+ keys: { LEFT: string; UP: string; RIGHT: string; BOTTOM: string };
1282
+ mouseButtons: { LEFT: MOUSE; MIDDLE: MOUSE; RIGHT: MOUSE };
1283
+ touches: { ONE: TOUCH; TWO: TOUCH };
1284
+
1285
+ update(): boolean;
1286
+
1287
+ listenToKeyEvents(domElement: HTMLElement): void;
1288
+
1289
+ saveState(): void;
1290
+
1291
+ reset(): void;
1292
+
1293
+ dispose(): void;
1294
+
1295
+ getPolarAngle(): number;
1296
+
1297
+ getAzimuthalAngle(): number;
1298
+
1299
+ getDistance(): number;
1300
+
1301
+ // EventDispatcher mixins
1302
+ addEventListener(type: string, listener: (event: any) => void): void;
1303
+
1304
+ hasEventListener(type: string, listener: (event: any) => void): boolean;
1305
+
1306
+ removeEventListener(type: string, listener: (event: any) => void): void;
1307
+
1308
+ dispatchEvent(event: { type: string; target: any }): void;
1309
+ }
1310
+
1311
+ declare class MapControls extends OrbitControls {
1312
+ constructor(object: Camera, domElement?: HTMLElement);
1313
+ }
1314
+
1315
+ declare class Renderer implements Disposable {
1236
1316
  static readonly DEFAULT_OPTIONS: RendererOptions;
1237
1317
  readonly options: RendererOptions;
1238
1318
  protected _element?: HTMLElement;
@@ -1240,23 +1320,29 @@ declare class Renderer {
1240
1320
  protected _camera: Camera;
1241
1321
  protected _renderer: WebGLRenderer;
1242
1322
  protected _composer: EffectComposer;
1323
+ protected _controls?: OrbitControls;
1243
1324
  protected _stats?: Stats;
1244
1325
  protected _dirty: boolean;
1245
1326
  protected _animationLoop: any;
1246
- protected _fpsTimer: any;
1247
- protected _animationTimer?: NodeJS.Timeout;
1248
- protected _animationFrame?: number;
1327
+ protected _frameInterval?: number;
1249
1328
  protected _resizeListener?: () => void;
1329
+ private _nextFrameTime?;
1330
+ private _disposed;
1331
+ private readonly _debugHelpers;
1332
+ private readonly _eventDispatchers;
1333
+ private readonly _changeListener;
1250
1334
  constructor(options?: DeepPartial<RendererOptions>);
1251
1335
  protected createScene(): MineRenderScene;
1252
1336
  protected createCamera(): Camera;
1253
1337
  protected createRenderer(): WebGLRenderer;
1254
1338
  protected createComposer(): EffectComposer;
1339
+ protected createControls(): Maybe<OrbitControls>;
1255
1340
  init(): void;
1256
1341
  get element(): Maybe<HTMLElement>;
1257
1342
  appendTo(element: HTMLElement): void;
1258
1343
  /**
1259
- * Register an EventDispatcher which may update the scene or renderer in order to redraw the scene
1344
+ * Redraws when the dispatcher emits the selected event. Registering the same pair twice has no effect.
1345
+ * The renderer removes its listener on disposal; the caller retains ownership of the dispatcher.
1260
1346
  */
1261
1347
  registerEventDispatcher(dispatcher: EventDispatcher, changeEvent?: string): void;
1262
1348
  resize(width: number, height: number): void;
@@ -1264,6 +1350,12 @@ declare class Renderer {
1264
1350
  set dirty(dirty: boolean);
1265
1351
  start(): void;
1266
1352
  stop(): void;
1353
+ /**
1354
+ * Stops rendering and releases owned resources. Repeated calls have no effect, and a disposed
1355
+ * renderer cannot be restarted. Scene objects are detached; shared assets and caller-owned
1356
+ * controls must be managed by their owners.
1357
+ */
1358
+ dispose(): void;
1267
1359
  private animate;
1268
1360
  toImage(): string;
1269
1361
  protected get attachedToBody(): boolean;
@@ -1273,11 +1365,14 @@ declare class Renderer {
1273
1365
  get camera(): Camera;
1274
1366
  get renderer(): WebGLRenderer;
1275
1367
  get composer(): EffectComposer;
1368
+ /** Renderer-owned controls, or undefined when disabled at construction or after disposal. */
1369
+ get controls(): Maybe<OrbitControls>;
1276
1370
  }
1277
1371
  interface RendererOptions {
1278
1372
  camera: CameraOptions;
1279
1373
  render: RenderOptions;
1280
1374
  composer: ComposerOptions;
1375
+ controls?: ControlsOptions;
1281
1376
  debug: DebugOptions;
1282
1377
  }
1283
1378
  interface CameraOptions {
@@ -1298,6 +1393,7 @@ interface CameraOptions {
1298
1393
  lookingAt: Vector3 | TripleArray;
1299
1394
  }
1300
1395
  interface RenderOptions {
1396
+ /** Maximum draw rate (60 by default); zero or a negative value disables the limit. */
1301
1397
  fpsLimit: number;
1302
1398
  stats: boolean;
1303
1399
  antialias: boolean;
@@ -1308,6 +1404,9 @@ interface RenderOptions {
1308
1404
  interface ComposerOptions {
1309
1405
  enabled: boolean;
1310
1406
  }
1407
+ interface ControlsOptions {
1408
+ enabled: boolean;
1409
+ }
1311
1410
  interface DebugOptions {
1312
1411
  grid: boolean;
1313
1412
  axes: boolean;
@@ -1432,83 +1531,6 @@ declare function mergeVertices(geometry: BufferGeometry$1, tolerance?: number):
1432
1531
  declare function toTrianglesDrawMode(geometry: BufferGeometry$1, drawMode: TrianglesDrawModes): BufferGeometry$1;
1433
1532
  declare function computeMorphedAttributes(object: Mesh | Line | Points): object;
1434
1533
 
1435
- declare class OrbitControls {
1436
- constructor(object: Camera, domElement?: HTMLElement);
1437
-
1438
- object: Camera;
1439
- domElement: HTMLElement | HTMLDocument;
1440
-
1441
- // API
1442
- enabled: boolean;
1443
- target: Vector3;
1444
-
1445
- // deprecated
1446
- center: Vector3;
1447
-
1448
- minDistance: number;
1449
- maxDistance: number;
1450
-
1451
- minZoom: number;
1452
- maxZoom: number;
1453
-
1454
- minPolarAngle: number;
1455
- maxPolarAngle: number;
1456
-
1457
- minAzimuthAngle: number;
1458
- maxAzimuthAngle: number;
1459
-
1460
- enableDamping: boolean;
1461
- dampingFactor: number;
1462
-
1463
- enableZoom: boolean;
1464
- zoomSpeed: number;
1465
-
1466
- enableRotate: boolean;
1467
- rotateSpeed: number;
1468
-
1469
- enablePan: boolean;
1470
- panSpeed: number;
1471
- screenSpacePanning: boolean;
1472
- keyPanSpeed: number;
1473
-
1474
- autoRotate: boolean;
1475
- autoRotateSpeed: number;
1476
-
1477
- enableKeys: boolean;
1478
- keys: { LEFT: string; UP: string; RIGHT: string; BOTTOM: string };
1479
- mouseButtons: { LEFT: MOUSE; MIDDLE: MOUSE; RIGHT: MOUSE };
1480
- touches: { ONE: TOUCH; TWO: TOUCH };
1481
-
1482
- update(): boolean;
1483
-
1484
- listenToKeyEvents(domElement: HTMLElement): void;
1485
-
1486
- saveState(): void;
1487
-
1488
- reset(): void;
1489
-
1490
- dispose(): void;
1491
-
1492
- getPolarAngle(): number;
1493
-
1494
- getAzimuthalAngle(): number;
1495
-
1496
- getDistance(): number;
1497
-
1498
- // EventDispatcher mixins
1499
- addEventListener(type: string, listener: (event: any) => void): void;
1500
-
1501
- hasEventListener(type: string, listener: (event: any) => void): boolean;
1502
-
1503
- removeEventListener(type: string, listener: (event: any) => void): void;
1504
-
1505
- dispatchEvent(event: { type: string; target: any }): void;
1506
- }
1507
-
1508
- declare class MapControls extends OrbitControls {
1509
- constructor(object: Camera, domElement?: HTMLElement);
1510
- }
1511
-
1512
1534
  interface BlockInfo {
1513
1535
  block: Block;
1514
1536
  object: BlockObject;
@@ -1601,4 +1623,4 @@ declare class BrowserCache extends PersistentCache<LocalForage> {
1601
1623
  */
1602
1624
  declare function probeImageSize(data: Uint8Array): ImageSizeInfo;
1603
1625
 
1604
- 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 };
1626
+ 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 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, 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 };