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/README.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# MineRender V2
|
|
2
2
|
|
|
3
3
|
A TypeScript library for interactive Minecraft skins, models, blocks, entities, and worlds.
|
|
4
|
-
V2 is in
|
|
4
|
+
V2 is in beta. See the [roadmap](https://github.com/InventivetalentDev/MineRender/blob/main/ROADMAP.md) for feature parity and remaining work.
|
|
5
5
|
|
|
6
|
-
Install the
|
|
6
|
+
Install the beta package with its three.js peer:
|
|
7
7
|
|
|
8
8
|
```sh
|
|
9
|
-
yarn add minerender@
|
|
9
|
+
yarn add minerender@beta three@^0.158.0
|
|
10
10
|
```
|
|
11
11
|
|
|
12
12
|
In a browser application:
|
package/dist/browser/index.d.mts
CHANGED
|
@@ -1641,7 +1641,10 @@ declare class Renderer implements Disposable {
|
|
|
1641
1641
|
protected _frameInterval?: number;
|
|
1642
1642
|
protected _resizeListener?: () => void;
|
|
1643
1643
|
private _nextFrameTime?;
|
|
1644
|
+
private _running;
|
|
1645
|
+
private _inAnimationLoop;
|
|
1644
1646
|
private _disposed;
|
|
1647
|
+
private readonly _frameCallbacks;
|
|
1645
1648
|
private readonly _debugHelpers;
|
|
1646
1649
|
private readonly _eventDispatchers;
|
|
1647
1650
|
private readonly _changeListener;
|
|
@@ -1662,6 +1665,12 @@ declare class Renderer implements Disposable {
|
|
|
1662
1665
|
resize(width: number, height: number): void;
|
|
1663
1666
|
get dirty(): boolean;
|
|
1664
1667
|
set dirty(dirty: boolean);
|
|
1668
|
+
/**
|
|
1669
|
+
* Calls a synchronous animation update before each FPS-limited draw while started.
|
|
1670
|
+
* Subscriptions keep the scene drawing without manual dirty flags. Returns an unsubscribe function.
|
|
1671
|
+
* Registering the same callback twice has no effect. Image exports do not invoke callbacks.
|
|
1672
|
+
*/
|
|
1673
|
+
onFrame(callback: FrameCallback): () => void;
|
|
1665
1674
|
start(): void;
|
|
1666
1675
|
stop(): void;
|
|
1667
1676
|
/**
|
|
@@ -1691,6 +1700,13 @@ declare class Renderer implements Disposable {
|
|
|
1691
1700
|
/** Renderer-owned controls, or undefined when disabled at construction or after disposal. */
|
|
1692
1701
|
get controls(): Maybe<OrbitControls>;
|
|
1693
1702
|
}
|
|
1703
|
+
interface RendererFrame {
|
|
1704
|
+
/** Animation-loop timestamp in seconds, relative to the browser's performance time origin. */
|
|
1705
|
+
readonly time: number;
|
|
1706
|
+
/** Seconds since this callback's previous update; zero on its first update after subscribing or starting. */
|
|
1707
|
+
readonly delta: number;
|
|
1708
|
+
}
|
|
1709
|
+
type FrameCallback = (frame: RendererFrame) => void;
|
|
1694
1710
|
interface RendererOptions {
|
|
1695
1711
|
camera: CameraOptions;
|
|
1696
1712
|
render: RenderOptions;
|
|
@@ -1766,13 +1782,15 @@ declare class SceneInspector {
|
|
|
1766
1782
|
protected separator(name?: string): HTMLElement;
|
|
1767
1783
|
}
|
|
1768
1784
|
|
|
1769
|
-
declare class SceneStatsDisplay {
|
|
1785
|
+
declare class SceneStatsDisplay implements Disposable {
|
|
1770
1786
|
readonly renderer: Renderer;
|
|
1771
1787
|
readonly statsContainer: HTMLDivElement;
|
|
1772
1788
|
private readonly lines;
|
|
1789
|
+
private interval?;
|
|
1773
1790
|
constructor(renderer: Renderer);
|
|
1774
1791
|
protected init(): void;
|
|
1775
1792
|
appendTo(el: HTMLElement): void;
|
|
1793
|
+
dispose(): void;
|
|
1776
1794
|
add(line?: StatLine): void;
|
|
1777
1795
|
}
|
|
1778
1796
|
declare class StatLine {
|
|
@@ -2055,4 +2073,4 @@ declare class BrowserCache extends PersistentCache<LocalForage> {
|
|
|
2055
2073
|
*/
|
|
2056
2074
|
declare function probeImageSize(data: Uint8Array): ImageSizeInfo;
|
|
2057
2075
|
|
|
2058
|
-
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, BrowserCache, BrowserEnv, 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, 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, probeImageSize, registerBrowserEnv, sampleFluid, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode, trimCanvas };
|
|
2076
|
+
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, BrowserCache, BrowserEnv, 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, 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, probeImageSize, registerBrowserEnv, sampleFluid, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode, trimCanvas };
|
package/dist/browser/index.d.ts
CHANGED
|
@@ -1641,7 +1641,10 @@ declare class Renderer implements Disposable {
|
|
|
1641
1641
|
protected _frameInterval?: number;
|
|
1642
1642
|
protected _resizeListener?: () => void;
|
|
1643
1643
|
private _nextFrameTime?;
|
|
1644
|
+
private _running;
|
|
1645
|
+
private _inAnimationLoop;
|
|
1644
1646
|
private _disposed;
|
|
1647
|
+
private readonly _frameCallbacks;
|
|
1645
1648
|
private readonly _debugHelpers;
|
|
1646
1649
|
private readonly _eventDispatchers;
|
|
1647
1650
|
private readonly _changeListener;
|
|
@@ -1662,6 +1665,12 @@ declare class Renderer implements Disposable {
|
|
|
1662
1665
|
resize(width: number, height: number): void;
|
|
1663
1666
|
get dirty(): boolean;
|
|
1664
1667
|
set dirty(dirty: boolean);
|
|
1668
|
+
/**
|
|
1669
|
+
* Calls a synchronous animation update before each FPS-limited draw while started.
|
|
1670
|
+
* Subscriptions keep the scene drawing without manual dirty flags. Returns an unsubscribe function.
|
|
1671
|
+
* Registering the same callback twice has no effect. Image exports do not invoke callbacks.
|
|
1672
|
+
*/
|
|
1673
|
+
onFrame(callback: FrameCallback): () => void;
|
|
1665
1674
|
start(): void;
|
|
1666
1675
|
stop(): void;
|
|
1667
1676
|
/**
|
|
@@ -1691,6 +1700,13 @@ declare class Renderer implements Disposable {
|
|
|
1691
1700
|
/** Renderer-owned controls, or undefined when disabled at construction or after disposal. */
|
|
1692
1701
|
get controls(): Maybe<OrbitControls>;
|
|
1693
1702
|
}
|
|
1703
|
+
interface RendererFrame {
|
|
1704
|
+
/** Animation-loop timestamp in seconds, relative to the browser's performance time origin. */
|
|
1705
|
+
readonly time: number;
|
|
1706
|
+
/** Seconds since this callback's previous update; zero on its first update after subscribing or starting. */
|
|
1707
|
+
readonly delta: number;
|
|
1708
|
+
}
|
|
1709
|
+
type FrameCallback = (frame: RendererFrame) => void;
|
|
1694
1710
|
interface RendererOptions {
|
|
1695
1711
|
camera: CameraOptions;
|
|
1696
1712
|
render: RenderOptions;
|
|
@@ -1766,13 +1782,15 @@ declare class SceneInspector {
|
|
|
1766
1782
|
protected separator(name?: string): HTMLElement;
|
|
1767
1783
|
}
|
|
1768
1784
|
|
|
1769
|
-
declare class SceneStatsDisplay {
|
|
1785
|
+
declare class SceneStatsDisplay implements Disposable {
|
|
1770
1786
|
readonly renderer: Renderer;
|
|
1771
1787
|
readonly statsContainer: HTMLDivElement;
|
|
1772
1788
|
private readonly lines;
|
|
1789
|
+
private interval?;
|
|
1773
1790
|
constructor(renderer: Renderer);
|
|
1774
1791
|
protected init(): void;
|
|
1775
1792
|
appendTo(el: HTMLElement): void;
|
|
1793
|
+
dispose(): void;
|
|
1776
1794
|
add(line?: StatLine): void;
|
|
1777
1795
|
}
|
|
1778
1796
|
declare class StatLine {
|
|
@@ -2055,4 +2073,4 @@ declare class BrowserCache extends PersistentCache<LocalForage> {
|
|
|
2055
2073
|
*/
|
|
2056
2074
|
declare function probeImageSize(data: Uint8Array): ImageSizeInfo;
|
|
2057
2075
|
|
|
2058
|
-
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, BrowserCache, BrowserEnv, 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, 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, probeImageSize, registerBrowserEnv, sampleFluid, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode, trimCanvas };
|
|
2076
|
+
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, BrowserCache, BrowserEnv, 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, 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, probeImageSize, registerBrowserEnv, sampleFluid, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode, trimCanvas };
|
package/dist/browser/index.js
CHANGED
|
@@ -8087,7 +8087,7 @@ var SceneStatsDisplay = class {
|
|
|
8087
8087
|
}
|
|
8088
8088
|
init() {
|
|
8089
8089
|
this.statsContainer.classList.add("minerender-stats");
|
|
8090
|
-
setInterval(() => {
|
|
8090
|
+
this.interval = setInterval(() => {
|
|
8091
8091
|
for (let line of this.lines) {
|
|
8092
8092
|
line.update();
|
|
8093
8093
|
}
|
|
@@ -8096,6 +8096,13 @@ var SceneStatsDisplay = class {
|
|
|
8096
8096
|
appendTo(el) {
|
|
8097
8097
|
el.append(this.statsContainer);
|
|
8098
8098
|
}
|
|
8099
|
+
dispose() {
|
|
8100
|
+
clearInterval(this.interval);
|
|
8101
|
+
this.interval = void 0;
|
|
8102
|
+
this.lines.length = 0;
|
|
8103
|
+
this.statsContainer.replaceChildren();
|
|
8104
|
+
this.statsContainer.remove();
|
|
8105
|
+
}
|
|
8099
8106
|
add(line) {
|
|
8100
8107
|
if (typeof line !== "undefined") {
|
|
8101
8108
|
this.lines.push(line);
|
|
@@ -12333,7 +12340,10 @@ var _Renderer = class _Renderer {
|
|
|
12333
12340
|
constructor(options) {
|
|
12334
12341
|
this._dirty = true;
|
|
12335
12342
|
this._resizeListener = void 0;
|
|
12343
|
+
this._running = false;
|
|
12344
|
+
this._inAnimationLoop = false;
|
|
12336
12345
|
this._disposed = false;
|
|
12346
|
+
this._frameCallbacks = /* @__PURE__ */ new Map();
|
|
12337
12347
|
this._debugHelpers = [];
|
|
12338
12348
|
this._eventDispatchers = /* @__PURE__ */ new Map();
|
|
12339
12349
|
this._changeListener = () => {
|
|
@@ -12344,7 +12354,14 @@ var _Renderer = class _Renderer {
|
|
|
12344
12354
|
if (!Number.isFinite(pixelRatio) || pixelRatio <= 0) {
|
|
12345
12355
|
throw new RangeError("render.pixelRatio must be a finite positive number");
|
|
12346
12356
|
}
|
|
12347
|
-
this._animationLoop =
|
|
12357
|
+
this._animationLoop = (time) => {
|
|
12358
|
+
this._inAnimationLoop = true;
|
|
12359
|
+
try {
|
|
12360
|
+
this.animate(time);
|
|
12361
|
+
} finally {
|
|
12362
|
+
this._inAnimationLoop = false;
|
|
12363
|
+
}
|
|
12364
|
+
};
|
|
12348
12365
|
this._frameInterval = this.options.render.fpsLimit > 0 ? 1e3 / this.options.render.fpsLimit : void 0;
|
|
12349
12366
|
this._scene = this.createScene();
|
|
12350
12367
|
this._camera = this.createCamera();
|
|
@@ -12519,15 +12536,39 @@ var _Renderer = class _Renderer {
|
|
|
12519
12536
|
this._dirty = dirty;
|
|
12520
12537
|
this.scene.dirty = dirty;
|
|
12521
12538
|
}
|
|
12539
|
+
/**
|
|
12540
|
+
* Calls a synchronous animation update before each FPS-limited draw while started.
|
|
12541
|
+
* Subscriptions keep the scene drawing without manual dirty flags. Returns an unsubscribe function.
|
|
12542
|
+
* Registering the same callback twice has no effect. Image exports do not invoke callbacks.
|
|
12543
|
+
*/
|
|
12544
|
+
onFrame(callback) {
|
|
12545
|
+
if (this._disposed) return () => {
|
|
12546
|
+
};
|
|
12547
|
+
const subscription = this._frameCallbacks.get(callback) ?? {};
|
|
12548
|
+
this._frameCallbacks.set(callback, subscription);
|
|
12549
|
+
return () => {
|
|
12550
|
+
if (this._frameCallbacks.get(callback) === subscription) this._frameCallbacks.delete(callback);
|
|
12551
|
+
};
|
|
12552
|
+
}
|
|
12522
12553
|
start() {
|
|
12523
12554
|
if (this._disposed) return;
|
|
12524
12555
|
this.stop();
|
|
12525
|
-
this.
|
|
12556
|
+
this._running = true;
|
|
12557
|
+
if (!this._inAnimationLoop) this.renderer.setAnimationLoop(this._animationLoop);
|
|
12526
12558
|
}
|
|
12527
12559
|
stop() {
|
|
12528
12560
|
if (this._disposed) return;
|
|
12529
|
-
this.
|
|
12561
|
+
this._running = false;
|
|
12562
|
+
if (this._inAnimationLoop) {
|
|
12563
|
+
queueMicrotask(() => {
|
|
12564
|
+
this.renderer.setAnimationLoop(null);
|
|
12565
|
+
if (this._running) this.renderer.setAnimationLoop(this._animationLoop);
|
|
12566
|
+
});
|
|
12567
|
+
} else {
|
|
12568
|
+
this.renderer.setAnimationLoop(null);
|
|
12569
|
+
}
|
|
12530
12570
|
this._nextFrameTime = void 0;
|
|
12571
|
+
for (const subscription of this._frameCallbacks.values()) subscription.previous = void 0;
|
|
12531
12572
|
}
|
|
12532
12573
|
/**
|
|
12533
12574
|
* Stops rendering and releases owned resources. Repeated calls have no effect, and a disposed
|
|
@@ -12538,6 +12579,7 @@ var _Renderer = class _Renderer {
|
|
|
12538
12579
|
if (this._disposed) return;
|
|
12539
12580
|
this.stop();
|
|
12540
12581
|
this._disposed = true;
|
|
12582
|
+
this._frameCallbacks.clear();
|
|
12541
12583
|
if (this._resizeListener) {
|
|
12542
12584
|
window.removeEventListener("resize", this._resizeListener);
|
|
12543
12585
|
this._resizeListener = void 0;
|
|
@@ -12572,18 +12614,25 @@ var _Renderer = class _Renderer {
|
|
|
12572
12614
|
this.renderer.forceContextLoss();
|
|
12573
12615
|
}
|
|
12574
12616
|
animate(t = performance.now()) {
|
|
12575
|
-
if (this.
|
|
12617
|
+
if (!this._running) return;
|
|
12576
12618
|
if (this._controls?.enabled) {
|
|
12577
12619
|
this._controls.update();
|
|
12578
12620
|
}
|
|
12579
|
-
if (this.
|
|
12580
|
-
if (!this.dirty && !this.options.render.renderAlways) return;
|
|
12621
|
+
if (!this._running) return;
|
|
12622
|
+
if (!this.dirty && !this.options.render.renderAlways && !this._frameCallbacks.size) return;
|
|
12581
12623
|
const interval = this._frameInterval;
|
|
12582
12624
|
if (interval) {
|
|
12583
12625
|
const next = this._nextFrameTime;
|
|
12584
12626
|
if (next !== void 0 && t + 0.1 < next) return;
|
|
12585
12627
|
this._nextFrameTime = next !== void 0 && t - next < interval ? next + interval : t + interval;
|
|
12586
12628
|
}
|
|
12629
|
+
for (const [callback, subscription] of [...this._frameCallbacks]) {
|
|
12630
|
+
if (this._frameCallbacks.get(callback) !== subscription) continue;
|
|
12631
|
+
const previous = subscription.previous;
|
|
12632
|
+
subscription.previous = t;
|
|
12633
|
+
callback({ time: t / 1e3, delta: previous === void 0 ? 0 : (t - previous) / 1e3 });
|
|
12634
|
+
if (!this._running) return;
|
|
12635
|
+
}
|
|
12587
12636
|
this.drawFrame();
|
|
12588
12637
|
}
|
|
12589
12638
|
drawFrame() {
|