minerender 2.1.0-alpha.51 → 2.1.0-alpha.52
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 +3 -3
- package/dist/browser/index.d.mts +20 -2
- package/dist/browser/index.d.ts +20 -2
- package/dist/browser/index.js +56 -7
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/index.mjs +56 -7
- package/dist/browser/index.mjs.map +1 -1
- package/dist/bundle.js +56 -7
- package/dist/bundle.js.map +1 -1
- package/dist/node/index.d.mts +20 -2
- package/dist/node/index.d.ts +20 -2
- package/dist/node/index.js +56 -7
- package/dist/node/index.js.map +1 -1
- package/dist/node/index.mjs +56 -7
- package/dist/node/index.mjs.map +1 -1
- package/package.json +3 -2
package/dist/node/index.d.mts
CHANGED
|
@@ -1642,7 +1642,10 @@ declare class Renderer implements Disposable {
|
|
|
1642
1642
|
protected _frameInterval?: number;
|
|
1643
1643
|
protected _resizeListener?: () => void;
|
|
1644
1644
|
private _nextFrameTime?;
|
|
1645
|
+
private _running;
|
|
1646
|
+
private _inAnimationLoop;
|
|
1645
1647
|
private _disposed;
|
|
1648
|
+
private readonly _frameCallbacks;
|
|
1646
1649
|
private readonly _debugHelpers;
|
|
1647
1650
|
private readonly _eventDispatchers;
|
|
1648
1651
|
private readonly _changeListener;
|
|
@@ -1663,6 +1666,12 @@ declare class Renderer implements Disposable {
|
|
|
1663
1666
|
resize(width: number, height: number): void;
|
|
1664
1667
|
get dirty(): boolean;
|
|
1665
1668
|
set dirty(dirty: boolean);
|
|
1669
|
+
/**
|
|
1670
|
+
* Calls a synchronous animation update before each FPS-limited draw while started.
|
|
1671
|
+
* Subscriptions keep the scene drawing without manual dirty flags. Returns an unsubscribe function.
|
|
1672
|
+
* Registering the same callback twice has no effect. Image exports do not invoke callbacks.
|
|
1673
|
+
*/
|
|
1674
|
+
onFrame(callback: FrameCallback): () => void;
|
|
1666
1675
|
start(): void;
|
|
1667
1676
|
stop(): void;
|
|
1668
1677
|
/**
|
|
@@ -1692,6 +1701,13 @@ declare class Renderer implements Disposable {
|
|
|
1692
1701
|
/** Renderer-owned controls, or undefined when disabled at construction or after disposal. */
|
|
1693
1702
|
get controls(): Maybe<OrbitControls>;
|
|
1694
1703
|
}
|
|
1704
|
+
interface RendererFrame {
|
|
1705
|
+
/** Animation-loop timestamp in seconds, relative to the browser's performance time origin. */
|
|
1706
|
+
readonly time: number;
|
|
1707
|
+
/** Seconds since this callback's previous update; zero on its first update after subscribing or starting. */
|
|
1708
|
+
readonly delta: number;
|
|
1709
|
+
}
|
|
1710
|
+
type FrameCallback = (frame: RendererFrame) => void;
|
|
1695
1711
|
interface RendererOptions {
|
|
1696
1712
|
camera: CameraOptions;
|
|
1697
1713
|
render: RenderOptions;
|
|
@@ -1767,13 +1783,15 @@ declare class SceneInspector {
|
|
|
1767
1783
|
protected separator(name?: string): HTMLElement;
|
|
1768
1784
|
}
|
|
1769
1785
|
|
|
1770
|
-
declare class SceneStatsDisplay {
|
|
1786
|
+
declare class SceneStatsDisplay implements Disposable {
|
|
1771
1787
|
readonly renderer: Renderer;
|
|
1772
1788
|
readonly statsContainer: HTMLDivElement;
|
|
1773
1789
|
private readonly lines;
|
|
1790
|
+
private interval?;
|
|
1774
1791
|
constructor(renderer: Renderer);
|
|
1775
1792
|
protected init(): void;
|
|
1776
1793
|
appendTo(el: HTMLElement): void;
|
|
1794
|
+
dispose(): void;
|
|
1777
1795
|
add(line?: StatLine): void;
|
|
1778
1796
|
}
|
|
1779
1797
|
declare class StatLine {
|
|
@@ -2058,4 +2076,4 @@ declare class NodeCache extends PersistentCache<LocalStorage> {
|
|
|
2058
2076
|
forEach<T>(callback: (v: T, k: string) => void): Promise<void>;
|
|
2059
2077
|
}
|
|
2060
2078
|
|
|
2061
|
-
export { AXES, type AnimationFrame, type AnimationMeta, type AnimatorFunction, type AnvilChunk, AnvilParser, type AnvilRegion, 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, type BlockFluidState, type BlockInfo, type BlockModel, type BlockModelTextures, BlockObject, type BlockObjectOptions, type BlockState, type BlockStateMultipart, type BlockStateProperties, type BlockStateProperty, type BlockStatePropertyDefaults, type BlockStatePropertyValue, BlockStateResolver, type BlockStateVariant, type BlockStateVariants, BlockStates, BlockTints, type BoxGeometryKey, BrowserArchiveProxy, CUBE_FACES, CUBE_FACE_OFFSETS, type CacheKey, Caching, type CameraOptions, CanvasImage, type CapeLayout, Chunk, ChunkData, type CompatCanvas, type CompatImage, type ComposerOptions, type ControlsOptions, CubeFace, CubeFaceIndex, DEFAULT_ELEMENTS, DEFAULT_NAMESPACE, DEFAULT_ROOT, DEFAULT_UV, DISPLAY_POSITIONS, type DebugOptions, type DeepPartial, DefaultBlockStates, DisplayPosition, DisplayTransforms, type Disposable, type DoubleArray, type ElementFace, type ElementRotation, Entities, type EntityLayer, type EntityModel, type EntityModelCube, type EntityModelFile, type EntityModelLayer, type EntityModelOptions, type EntityModelPart, EntityObject, type EntityObjectOptions, Env, type EnvProvider, type ExtractableImageData, type FluidKind, FluidModelObject, type FluidSample, type FluidSampler, type FromTo, Geometries, GuiHelper, type GuiLayer, 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 MineRenderWorldOptions, type MinecraftAsset, MinecraftCubeTexture, MinecraftFaceUV, type MinecraftTextureMeta, type Model, ModelCulling, type ModelDisplay, type ModelElement, type ModelFaces, ModelGenerator, ModelMerger, ModelObject, type ModelObjectOptions, ModelTextures, Models, type MultiBlockBlock, type MultiBlockEntity, 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, SceneExporter, type SceneGLTFExportOptions, SceneInspector, SceneObject, type SceneObjectOptions, SceneStats, SceneStatsDisplay, SchematicParser, SectionMesh, type SectionMeshEntry, type SectionMeshTemplate, SectionModels, type Serializable, type SkinGeometries, SkinImage, SkinObject, type SkinObjectOptions, SkinPart, type SkinTexture, type SkinTextureCoordinates, SkinTextures, 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, axisToVec3, base64decode, base64encode, capeTextureSizes, captureException, changeEvent, clampRotationDegrees, classicSkinGeometries, classicSkinTextureCoordinates, computeMorphedAttributes, createCanvas, createFluidGeometry, createImage, estimateBytesUsed, getBlockFluidState, getFluidKind, interleaveAttributes, isAssetKey, isBasicAssetKey, isBlockObject, isDisposable, isDoubleArray, isEntityObject, isGuiObject, isInstanceManager, isInstanceReference, isInstanceable, isInstancedMesh, isMesh, isMineRenderScene, isModelObject, isObject3D, isOrthographicCamera, isPerspectiveCamera, isQuadArray, isSceneObject, isTransformable, isTripleArray, isVector3, md5, mergeBufferAttributes, mergeBufferGeometries, mergeVertices, prefix, registerNodeEnv, sampleFluid, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode, trimCanvas };
|
|
2079
|
+
export { AXES, type AnimationFrame, type AnimationMeta, type AnimatorFunction, type AnvilChunk, AnvilParser, type AnvilRegion, 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, type BlockFluidState, type BlockInfo, type BlockModel, type BlockModelTextures, BlockObject, type BlockObjectOptions, type BlockState, type BlockStateMultipart, type BlockStateProperties, type BlockStateProperty, type BlockStatePropertyDefaults, type BlockStatePropertyValue, BlockStateResolver, type BlockStateVariant, type BlockStateVariants, BlockStates, BlockTints, type BoxGeometryKey, BrowserArchiveProxy, CUBE_FACES, CUBE_FACE_OFFSETS, type CacheKey, Caching, type CameraOptions, CanvasImage, type CapeLayout, Chunk, ChunkData, type CompatCanvas, type CompatImage, type ComposerOptions, type ControlsOptions, CubeFace, CubeFaceIndex, DEFAULT_ELEMENTS, DEFAULT_NAMESPACE, DEFAULT_ROOT, DEFAULT_UV, DISPLAY_POSITIONS, type DebugOptions, type DeepPartial, DefaultBlockStates, DisplayPosition, DisplayTransforms, type Disposable, type DoubleArray, type ElementFace, type ElementRotation, Entities, type EntityLayer, type EntityModel, type EntityModelCube, type EntityModelFile, type EntityModelLayer, type EntityModelOptions, type EntityModelPart, EntityObject, type EntityObjectOptions, Env, type EnvProvider, type ExtractableImageData, type FluidKind, FluidModelObject, type FluidSample, type FluidSampler, type FrameCallback, type FromTo, Geometries, GuiHelper, type GuiLayer, 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 MineRenderWorldOptions, type MinecraftAsset, MinecraftCubeTexture, MinecraftFaceUV, type MinecraftTextureMeta, type Model, ModelCulling, type ModelDisplay, type ModelElement, type ModelFaces, ModelGenerator, ModelMerger, ModelObject, type ModelObjectOptions, ModelTextures, Models, type MultiBlockBlock, type MultiBlockEntity, type MultiBlockStructure, type MultipartCondition, type NBTAsset, NBTHelper, NodeCache, NodeEnv, OrbitControls, PersistentCache, type QuadArray, type RawImageKey, type RenderOptions, Renderer, type RendererFrame, type RendererOptions, type RequestConfig, RequestError, type RequestResponse, Requests, type ResponseParser, SKIN_PARTS, SceneExporter, type SceneGLTFExportOptions, SceneInspector, SceneObject, type SceneObjectOptions, SceneStats, SceneStatsDisplay, SchematicParser, SectionMesh, type SectionMeshEntry, type SectionMeshTemplate, SectionModels, type Serializable, type SkinGeometries, SkinImage, SkinObject, type SkinObjectOptions, SkinPart, type SkinTexture, type SkinTextureCoordinates, SkinTextures, 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, axisToVec3, base64decode, base64encode, capeTextureSizes, captureException, changeEvent, clampRotationDegrees, classicSkinGeometries, classicSkinTextureCoordinates, computeMorphedAttributes, createCanvas, createFluidGeometry, createImage, estimateBytesUsed, getBlockFluidState, getFluidKind, interleaveAttributes, isAssetKey, isBasicAssetKey, isBlockObject, isDisposable, isDoubleArray, isEntityObject, isGuiObject, isInstanceManager, isInstanceReference, isInstanceable, isInstancedMesh, isMesh, isMineRenderScene, isModelObject, isObject3D, isOrthographicCamera, isPerspectiveCamera, isQuadArray, isSceneObject, isTransformable, isTripleArray, isVector3, md5, mergeBufferAttributes, mergeBufferGeometries, mergeVertices, prefix, registerNodeEnv, sampleFluid, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode, trimCanvas };
|
package/dist/node/index.d.ts
CHANGED
|
@@ -1642,7 +1642,10 @@ declare class Renderer implements Disposable {
|
|
|
1642
1642
|
protected _frameInterval?: number;
|
|
1643
1643
|
protected _resizeListener?: () => void;
|
|
1644
1644
|
private _nextFrameTime?;
|
|
1645
|
+
private _running;
|
|
1646
|
+
private _inAnimationLoop;
|
|
1645
1647
|
private _disposed;
|
|
1648
|
+
private readonly _frameCallbacks;
|
|
1646
1649
|
private readonly _debugHelpers;
|
|
1647
1650
|
private readonly _eventDispatchers;
|
|
1648
1651
|
private readonly _changeListener;
|
|
@@ -1663,6 +1666,12 @@ declare class Renderer implements Disposable {
|
|
|
1663
1666
|
resize(width: number, height: number): void;
|
|
1664
1667
|
get dirty(): boolean;
|
|
1665
1668
|
set dirty(dirty: boolean);
|
|
1669
|
+
/**
|
|
1670
|
+
* Calls a synchronous animation update before each FPS-limited draw while started.
|
|
1671
|
+
* Subscriptions keep the scene drawing without manual dirty flags. Returns an unsubscribe function.
|
|
1672
|
+
* Registering the same callback twice has no effect. Image exports do not invoke callbacks.
|
|
1673
|
+
*/
|
|
1674
|
+
onFrame(callback: FrameCallback): () => void;
|
|
1666
1675
|
start(): void;
|
|
1667
1676
|
stop(): void;
|
|
1668
1677
|
/**
|
|
@@ -1692,6 +1701,13 @@ declare class Renderer implements Disposable {
|
|
|
1692
1701
|
/** Renderer-owned controls, or undefined when disabled at construction or after disposal. */
|
|
1693
1702
|
get controls(): Maybe<OrbitControls>;
|
|
1694
1703
|
}
|
|
1704
|
+
interface RendererFrame {
|
|
1705
|
+
/** Animation-loop timestamp in seconds, relative to the browser's performance time origin. */
|
|
1706
|
+
readonly time: number;
|
|
1707
|
+
/** Seconds since this callback's previous update; zero on its first update after subscribing or starting. */
|
|
1708
|
+
readonly delta: number;
|
|
1709
|
+
}
|
|
1710
|
+
type FrameCallback = (frame: RendererFrame) => void;
|
|
1695
1711
|
interface RendererOptions {
|
|
1696
1712
|
camera: CameraOptions;
|
|
1697
1713
|
render: RenderOptions;
|
|
@@ -1767,13 +1783,15 @@ declare class SceneInspector {
|
|
|
1767
1783
|
protected separator(name?: string): HTMLElement;
|
|
1768
1784
|
}
|
|
1769
1785
|
|
|
1770
|
-
declare class SceneStatsDisplay {
|
|
1786
|
+
declare class SceneStatsDisplay implements Disposable {
|
|
1771
1787
|
readonly renderer: Renderer;
|
|
1772
1788
|
readonly statsContainer: HTMLDivElement;
|
|
1773
1789
|
private readonly lines;
|
|
1790
|
+
private interval?;
|
|
1774
1791
|
constructor(renderer: Renderer);
|
|
1775
1792
|
protected init(): void;
|
|
1776
1793
|
appendTo(el: HTMLElement): void;
|
|
1794
|
+
dispose(): void;
|
|
1777
1795
|
add(line?: StatLine): void;
|
|
1778
1796
|
}
|
|
1779
1797
|
declare class StatLine {
|
|
@@ -2058,4 +2076,4 @@ declare class NodeCache extends PersistentCache<LocalStorage> {
|
|
|
2058
2076
|
forEach<T>(callback: (v: T, k: string) => void): Promise<void>;
|
|
2059
2077
|
}
|
|
2060
2078
|
|
|
2061
|
-
export { AXES, type AnimationFrame, type AnimationMeta, type AnimatorFunction, type AnvilChunk, AnvilParser, type AnvilRegion, 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, type BlockFluidState, type BlockInfo, type BlockModel, type BlockModelTextures, BlockObject, type BlockObjectOptions, type BlockState, type BlockStateMultipart, type BlockStateProperties, type BlockStateProperty, type BlockStatePropertyDefaults, type BlockStatePropertyValue, BlockStateResolver, type BlockStateVariant, type BlockStateVariants, BlockStates, BlockTints, type BoxGeometryKey, BrowserArchiveProxy, CUBE_FACES, CUBE_FACE_OFFSETS, type CacheKey, Caching, type CameraOptions, CanvasImage, type CapeLayout, Chunk, ChunkData, type CompatCanvas, type CompatImage, type ComposerOptions, type ControlsOptions, CubeFace, CubeFaceIndex, DEFAULT_ELEMENTS, DEFAULT_NAMESPACE, DEFAULT_ROOT, DEFAULT_UV, DISPLAY_POSITIONS, type DebugOptions, type DeepPartial, DefaultBlockStates, DisplayPosition, DisplayTransforms, type Disposable, type DoubleArray, type ElementFace, type ElementRotation, Entities, type EntityLayer, type EntityModel, type EntityModelCube, type EntityModelFile, type EntityModelLayer, type EntityModelOptions, type EntityModelPart, EntityObject, type EntityObjectOptions, Env, type EnvProvider, type ExtractableImageData, type FluidKind, FluidModelObject, type FluidSample, type FluidSampler, type FromTo, Geometries, GuiHelper, type GuiLayer, 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 MineRenderWorldOptions, type MinecraftAsset, MinecraftCubeTexture, MinecraftFaceUV, type MinecraftTextureMeta, type Model, ModelCulling, type ModelDisplay, type ModelElement, type ModelFaces, ModelGenerator, ModelMerger, ModelObject, type ModelObjectOptions, ModelTextures, Models, type MultiBlockBlock, type MultiBlockEntity, 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, SceneExporter, type SceneGLTFExportOptions, SceneInspector, SceneObject, type SceneObjectOptions, SceneStats, SceneStatsDisplay, SchematicParser, SectionMesh, type SectionMeshEntry, type SectionMeshTemplate, SectionModels, type Serializable, type SkinGeometries, SkinImage, SkinObject, type SkinObjectOptions, SkinPart, type SkinTexture, type SkinTextureCoordinates, SkinTextures, 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, axisToVec3, base64decode, base64encode, capeTextureSizes, captureException, changeEvent, clampRotationDegrees, classicSkinGeometries, classicSkinTextureCoordinates, computeMorphedAttributes, createCanvas, createFluidGeometry, createImage, estimateBytesUsed, getBlockFluidState, getFluidKind, interleaveAttributes, isAssetKey, isBasicAssetKey, isBlockObject, isDisposable, isDoubleArray, isEntityObject, isGuiObject, isInstanceManager, isInstanceReference, isInstanceable, isInstancedMesh, isMesh, isMineRenderScene, isModelObject, isObject3D, isOrthographicCamera, isPerspectiveCamera, isQuadArray, isSceneObject, isTransformable, isTripleArray, isVector3, md5, mergeBufferAttributes, mergeBufferGeometries, mergeVertices, prefix, registerNodeEnv, sampleFluid, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode, trimCanvas };
|
|
2079
|
+
export { AXES, type AnimationFrame, type AnimationMeta, type AnimatorFunction, type AnvilChunk, AnvilParser, type AnvilRegion, 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, type BlockFluidState, type BlockInfo, type BlockModel, type BlockModelTextures, BlockObject, type BlockObjectOptions, type BlockState, type BlockStateMultipart, type BlockStateProperties, type BlockStateProperty, type BlockStatePropertyDefaults, type BlockStatePropertyValue, BlockStateResolver, type BlockStateVariant, type BlockStateVariants, BlockStates, BlockTints, type BoxGeometryKey, BrowserArchiveProxy, CUBE_FACES, CUBE_FACE_OFFSETS, type CacheKey, Caching, type CameraOptions, CanvasImage, type CapeLayout, Chunk, ChunkData, type CompatCanvas, type CompatImage, type ComposerOptions, type ControlsOptions, CubeFace, CubeFaceIndex, DEFAULT_ELEMENTS, DEFAULT_NAMESPACE, DEFAULT_ROOT, DEFAULT_UV, DISPLAY_POSITIONS, type DebugOptions, type DeepPartial, DefaultBlockStates, DisplayPosition, DisplayTransforms, type Disposable, type DoubleArray, type ElementFace, type ElementRotation, Entities, type EntityLayer, type EntityModel, type EntityModelCube, type EntityModelFile, type EntityModelLayer, type EntityModelOptions, type EntityModelPart, EntityObject, type EntityObjectOptions, Env, type EnvProvider, type ExtractableImageData, type FluidKind, FluidModelObject, type FluidSample, type FluidSampler, type FrameCallback, type FromTo, Geometries, GuiHelper, type GuiLayer, 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 MineRenderWorldOptions, type MinecraftAsset, MinecraftCubeTexture, MinecraftFaceUV, type MinecraftTextureMeta, type Model, ModelCulling, type ModelDisplay, type ModelElement, type ModelFaces, ModelGenerator, ModelMerger, ModelObject, type ModelObjectOptions, ModelTextures, Models, type MultiBlockBlock, type MultiBlockEntity, type MultiBlockStructure, type MultipartCondition, type NBTAsset, NBTHelper, NodeCache, NodeEnv, OrbitControls, PersistentCache, type QuadArray, type RawImageKey, type RenderOptions, Renderer, type RendererFrame, type RendererOptions, type RequestConfig, RequestError, type RequestResponse, Requests, type ResponseParser, SKIN_PARTS, SceneExporter, type SceneGLTFExportOptions, SceneInspector, SceneObject, type SceneObjectOptions, SceneStats, SceneStatsDisplay, SchematicParser, SectionMesh, type SectionMeshEntry, type SectionMeshTemplate, SectionModels, type Serializable, type SkinGeometries, SkinImage, SkinObject, type SkinObjectOptions, SkinPart, type SkinTexture, type SkinTextureCoordinates, SkinTextures, 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, axisToVec3, base64decode, base64encode, capeTextureSizes, captureException, changeEvent, clampRotationDegrees, classicSkinGeometries, classicSkinTextureCoordinates, computeMorphedAttributes, createCanvas, createFluidGeometry, createImage, estimateBytesUsed, getBlockFluidState, getFluidKind, interleaveAttributes, isAssetKey, isBasicAssetKey, isBlockObject, isDisposable, isDoubleArray, isEntityObject, isGuiObject, isInstanceManager, isInstanceReference, isInstanceable, isInstancedMesh, isMesh, isMineRenderScene, isModelObject, isObject3D, isOrthographicCamera, isPerspectiveCamera, isQuadArray, isSceneObject, isTransformable, isTripleArray, isVector3, md5, mergeBufferAttributes, mergeBufferGeometries, mergeVertices, prefix, registerNodeEnv, sampleFluid, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode, trimCanvas };
|
package/dist/node/index.js
CHANGED
|
@@ -8133,7 +8133,7 @@ var SceneStatsDisplay = class {
|
|
|
8133
8133
|
}
|
|
8134
8134
|
init() {
|
|
8135
8135
|
this.statsContainer.classList.add("minerender-stats");
|
|
8136
|
-
setInterval(() => {
|
|
8136
|
+
this.interval = setInterval(() => {
|
|
8137
8137
|
for (let line of this.lines) {
|
|
8138
8138
|
line.update();
|
|
8139
8139
|
}
|
|
@@ -8142,6 +8142,13 @@ var SceneStatsDisplay = class {
|
|
|
8142
8142
|
appendTo(el) {
|
|
8143
8143
|
el.append(this.statsContainer);
|
|
8144
8144
|
}
|
|
8145
|
+
dispose() {
|
|
8146
|
+
clearInterval(this.interval);
|
|
8147
|
+
this.interval = void 0;
|
|
8148
|
+
this.lines.length = 0;
|
|
8149
|
+
this.statsContainer.replaceChildren();
|
|
8150
|
+
this.statsContainer.remove();
|
|
8151
|
+
}
|
|
8145
8152
|
add(line) {
|
|
8146
8153
|
if (typeof line !== "undefined") {
|
|
8147
8154
|
this.lines.push(line);
|
|
@@ -12381,7 +12388,10 @@ var Renderer = class _Renderer {
|
|
|
12381
12388
|
constructor(options) {
|
|
12382
12389
|
this._dirty = true;
|
|
12383
12390
|
this._resizeListener = void 0;
|
|
12391
|
+
this._running = false;
|
|
12392
|
+
this._inAnimationLoop = false;
|
|
12384
12393
|
this._disposed = false;
|
|
12394
|
+
this._frameCallbacks = /* @__PURE__ */ new Map();
|
|
12385
12395
|
this._debugHelpers = [];
|
|
12386
12396
|
this._eventDispatchers = /* @__PURE__ */ new Map();
|
|
12387
12397
|
this._changeListener = () => {
|
|
@@ -12392,7 +12402,14 @@ var Renderer = class _Renderer {
|
|
|
12392
12402
|
if (!Number.isFinite(pixelRatio) || pixelRatio <= 0) {
|
|
12393
12403
|
throw new RangeError("render.pixelRatio must be a finite positive number");
|
|
12394
12404
|
}
|
|
12395
|
-
this._animationLoop =
|
|
12405
|
+
this._animationLoop = (time) => {
|
|
12406
|
+
this._inAnimationLoop = true;
|
|
12407
|
+
try {
|
|
12408
|
+
this.animate(time);
|
|
12409
|
+
} finally {
|
|
12410
|
+
this._inAnimationLoop = false;
|
|
12411
|
+
}
|
|
12412
|
+
};
|
|
12396
12413
|
this._frameInterval = this.options.render.fpsLimit > 0 ? 1e3 / this.options.render.fpsLimit : void 0;
|
|
12397
12414
|
this._scene = this.createScene();
|
|
12398
12415
|
this._camera = this.createCamera();
|
|
@@ -12607,15 +12624,39 @@ var Renderer = class _Renderer {
|
|
|
12607
12624
|
this._dirty = dirty;
|
|
12608
12625
|
this.scene.dirty = dirty;
|
|
12609
12626
|
}
|
|
12627
|
+
/**
|
|
12628
|
+
* Calls a synchronous animation update before each FPS-limited draw while started.
|
|
12629
|
+
* Subscriptions keep the scene drawing without manual dirty flags. Returns an unsubscribe function.
|
|
12630
|
+
* Registering the same callback twice has no effect. Image exports do not invoke callbacks.
|
|
12631
|
+
*/
|
|
12632
|
+
onFrame(callback) {
|
|
12633
|
+
if (this._disposed) return () => {
|
|
12634
|
+
};
|
|
12635
|
+
const subscription = this._frameCallbacks.get(callback) ?? {};
|
|
12636
|
+
this._frameCallbacks.set(callback, subscription);
|
|
12637
|
+
return () => {
|
|
12638
|
+
if (this._frameCallbacks.get(callback) === subscription) this._frameCallbacks.delete(callback);
|
|
12639
|
+
};
|
|
12640
|
+
}
|
|
12610
12641
|
start() {
|
|
12611
12642
|
if (this._disposed) return;
|
|
12612
12643
|
this.stop();
|
|
12613
|
-
this.
|
|
12644
|
+
this._running = true;
|
|
12645
|
+
if (!this._inAnimationLoop) this.renderer.setAnimationLoop(this._animationLoop);
|
|
12614
12646
|
}
|
|
12615
12647
|
stop() {
|
|
12616
12648
|
if (this._disposed) return;
|
|
12617
|
-
this.
|
|
12649
|
+
this._running = false;
|
|
12650
|
+
if (this._inAnimationLoop) {
|
|
12651
|
+
queueMicrotask(() => {
|
|
12652
|
+
this.renderer.setAnimationLoop(null);
|
|
12653
|
+
if (this._running) this.renderer.setAnimationLoop(this._animationLoop);
|
|
12654
|
+
});
|
|
12655
|
+
} else {
|
|
12656
|
+
this.renderer.setAnimationLoop(null);
|
|
12657
|
+
}
|
|
12618
12658
|
this._nextFrameTime = void 0;
|
|
12659
|
+
for (const subscription of this._frameCallbacks.values()) subscription.previous = void 0;
|
|
12619
12660
|
}
|
|
12620
12661
|
/**
|
|
12621
12662
|
* Stops rendering and releases owned resources. Repeated calls have no effect, and a disposed
|
|
@@ -12626,6 +12667,7 @@ var Renderer = class _Renderer {
|
|
|
12626
12667
|
if (this._disposed) return;
|
|
12627
12668
|
this.stop();
|
|
12628
12669
|
this._disposed = true;
|
|
12670
|
+
this._frameCallbacks.clear();
|
|
12629
12671
|
if (this._resizeListener) {
|
|
12630
12672
|
window.removeEventListener("resize", this._resizeListener);
|
|
12631
12673
|
this._resizeListener = void 0;
|
|
@@ -12660,18 +12702,25 @@ var Renderer = class _Renderer {
|
|
|
12660
12702
|
this.renderer.forceContextLoss();
|
|
12661
12703
|
}
|
|
12662
12704
|
animate(t = performance.now()) {
|
|
12663
|
-
if (this.
|
|
12705
|
+
if (!this._running) return;
|
|
12664
12706
|
if (this._controls?.enabled) {
|
|
12665
12707
|
this._controls.update();
|
|
12666
12708
|
}
|
|
12667
|
-
if (this.
|
|
12668
|
-
if (!this.dirty && !this.options.render.renderAlways) return;
|
|
12709
|
+
if (!this._running) return;
|
|
12710
|
+
if (!this.dirty && !this.options.render.renderAlways && !this._frameCallbacks.size) return;
|
|
12669
12711
|
const interval = this._frameInterval;
|
|
12670
12712
|
if (interval) {
|
|
12671
12713
|
const next = this._nextFrameTime;
|
|
12672
12714
|
if (next !== void 0 && t + 0.1 < next) return;
|
|
12673
12715
|
this._nextFrameTime = next !== void 0 && t - next < interval ? next + interval : t + interval;
|
|
12674
12716
|
}
|
|
12717
|
+
for (const [callback, subscription] of [...this._frameCallbacks]) {
|
|
12718
|
+
if (this._frameCallbacks.get(callback) !== subscription) continue;
|
|
12719
|
+
const previous = subscription.previous;
|
|
12720
|
+
subscription.previous = t;
|
|
12721
|
+
callback({ time: t / 1e3, delta: previous === void 0 ? 0 : (t - previous) / 1e3 });
|
|
12722
|
+
if (!this._running) return;
|
|
12723
|
+
}
|
|
12675
12724
|
this.drawFrame();
|
|
12676
12725
|
}
|
|
12677
12726
|
drawFrame() {
|