minerender 2.1.0-alpha.40 → 2.1.0-alpha.42

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, BufferGeometry, Object3D, Box3, InstancedMesh, PerspectiveCamera, OrthographicCamera, Matrix4, Scene, Object3DEventMap, Texture, Camera, MOUSE, TOUCH, WebGLRenderer, EventDispatcher, Raycaster, Intersection, MeshBasicMaterial, CanvasTexture, InterleavedBufferAttribute, TrianglesDrawModes, Line, Points } from 'three';
2
+ import { Vector3, PixelFormat, BoxGeometry, Material, Mesh, Euler, Vector2, BufferAttribute, Float32BufferAttribute, BufferGeometry, Object3D, Box3, InstancedMesh, PerspectiveCamera, OrthographicCamera, Matrix4, Scene, Object3DEventMap, Texture, Camera, MOUSE, TOUCH, WebGLRenderer, EventDispatcher, Raycaster, Intersection, MeshBasicMaterial, CanvasTexture, InterleavedBufferAttribute, TrianglesDrawModes, Line, Points, Group } from 'three';
3
3
  import * as nodeCanvas from 'canvas';
4
4
  import { ImageData as ImageData$1, CanvasRenderingContext2D } from 'canvas';
5
5
  import { Buffer } from 'buffer';
@@ -827,6 +827,14 @@ interface Block {
827
827
  nbt?: any;
828
828
  }
829
829
 
830
+ declare class BlockStateResolver {
831
+ static defaults(blockState: BlockState): Promise<BlockStateProperties>;
832
+ static select(blockState: BlockState, state: BlockStateProperties, choose?: (variants: BlockStateVariant | BlockStateVariant[]) => BlockStateVariant): BlockStateVariant[];
833
+ static matching(blockState: BlockState, state: BlockStateProperties): (BlockStateVariant | BlockStateVariant[])[];
834
+ static choose(variants: BlockStateVariant | BlockStateVariant[]): BlockStateVariant;
835
+ static rotation(variant: BlockStateVariant): Euler;
836
+ }
837
+
830
838
  declare class BlockTints {
831
839
  /** Resolves block preview colors without biome context; explicit tints take precedence. */
832
840
  static get(key: AssetKey | undefined, state: BlockStateProperties, model: Model, tints?: Record<number, number>): Promise<Record<number, number> | undefined>;
@@ -1782,34 +1790,69 @@ declare class AnvilParser {
1782
1790
  private static unpack;
1783
1791
  }
1784
1792
 
1785
- interface BlockInfo {
1793
+ interface BlockInfo<SectionMeshing extends boolean = false> {
1786
1794
  /** Detached block data; use world or chunk setters to update stored blocks. */
1787
1795
  readonly block: Block;
1788
- object: BlockObject;
1796
+ /** Merged terrain has no individual render object in section-meshing mode. */
1797
+ object: SectionMeshing extends false ? BlockObject : BlockObject | undefined;
1798
+ }
1799
+
1800
+ interface SectionMeshTemplate {
1801
+ geometry: BufferGeometry;
1802
+ atlas: TextureAtlas;
1803
+ cullFaces: readonly number[];
1804
+ }
1805
+ interface SectionMeshEntry {
1806
+ index: number;
1807
+ template: SectionMeshTemplate;
1808
+ cullMask: number;
1809
+ }
1810
+ declare class SectionMesh extends Group {
1811
+ private readonly ownedMeshes;
1812
+ static build(entries: readonly SectionMeshEntry[], maxAtlasSize?: number): SectionMesh;
1813
+ dispose(): void;
1814
+ }
1815
+
1816
+ declare class SectionModels {
1817
+ readonly maxAtlasSize: number;
1818
+ private states;
1819
+ private models;
1820
+ private readonly templates;
1821
+ constructor(maxAtlasSize?: number);
1822
+ get(blockState: BlockState, properties?: BlockStateProperties): Promise<SectionMeshTemplate | undefined>;
1823
+ private prepare;
1824
+ clear(): void;
1789
1825
  }
1790
1826
 
1791
- declare class Chunk {
1827
+ declare class Chunk<SectionMeshing extends boolean = false> {
1792
1828
  private readonly onBlocksChanged?;
1829
+ private readonly sectionModels?;
1793
1830
  readonly scene: MineRenderScene;
1794
1831
  readonly x: number;
1795
1832
  readonly y: number;
1796
1833
  readonly z: number;
1797
1834
  private readonly data;
1798
1835
  private readonly renderedBlocks;
1799
- constructor(scene: MineRenderScene, x: number, y: number, z: number, onBlocksChanged?: ((positions: Vector3[]) => Promise<void>) | undefined);
1800
- getBlockAt(x: number, y: number, z: number): Maybe<BlockInfo>;
1801
- getBlockAt(pos: Vector3): Maybe<BlockInfo>;
1802
- getBlockAt(pos: TripleArray): Maybe<BlockInfo>;
1836
+ private readonly sectionBlocks;
1837
+ private sectionMesh?;
1838
+ private meshDirty;
1839
+ constructor(scene: MineRenderScene, x: number, y: number, z: number, onBlocksChanged?: ((positions: Vector3[]) => Promise<void>) | undefined, sectionModels?: SectionModels | undefined);
1840
+ getBlockAt(x: number, y: number, z: number): Maybe<BlockInfo<SectionMeshing>>;
1841
+ getBlockAt(pos: Vector3): Maybe<BlockInfo<SectionMeshing>>;
1842
+ getBlockAt(pos: TripleArray): Maybe<BlockInfo<SectionMeshing>>;
1803
1843
  /**
1804
1844
  * Set block at a _world_ position
1805
1845
  */
1806
- setBlockAt(x: number, y: number, z: number, block: Maybe<Block>): Promise<Maybe<BlockInfo>>;
1807
- setBlockAt(pos: Vector3, block: Maybe<Block>): Promise<Maybe<BlockInfo>>;
1808
- setBlockAt(pos: TripleArray, block: Maybe<Block>): Promise<Maybe<BlockInfo>>;
1846
+ setBlockAt(x: number, y: number, z: number, block: Maybe<Block>): Promise<Maybe<BlockInfo<SectionMeshing>>>;
1847
+ setBlockAt(pos: Vector3, block: Maybe<Block>): Promise<Maybe<BlockInfo<SectionMeshing>>>;
1848
+ setBlockAt(pos: TripleArray, block: Maybe<Block>): Promise<Maybe<BlockInfo<SectionMeshing>>>;
1809
1849
  /**
1810
1850
  * Set a block at integer chunk-local coordinates from 0 to 15.
1811
1851
  */
1812
- setBlockInChunkAt(pos: Vector3, block?: Block, worldPos?: Vector3, onBlocksChanged?: ((positions: Vector3[]) => Promise<void>) | undefined): Promise<Maybe<BlockInfo>>;
1852
+ setBlockInChunkAt(pos: Vector3, block?: Block, worldPos?: Vector3, onBlocksChanged?: ((positions: Vector3[]) => Promise<void>) | undefined): Promise<Maybe<BlockInfo<SectionMeshing>>>;
1853
+ isOccludingAt(pos: Vector3): boolean;
1854
+ setCullMaskAt(pos: Vector3, mask: number): Promise<void>;
1855
+ rebuildSectionMesh(): void;
1813
1856
  clear(onBlocksChanged?: ((positions: Vector3[]) => Promise<void>) | undefined): Promise<void>;
1814
1857
  dispose(): Promise<void>;
1815
1858
  static isAir(block: Maybe<Block>): boolean;
@@ -1818,18 +1861,19 @@ declare class Chunk {
1818
1861
  chunkPosToWorldPos(pos: Vector3): Vector3;
1819
1862
  }
1820
1863
 
1821
- declare class MineRenderWorld {
1864
+ declare class MineRenderWorld<SectionMeshing extends boolean = false> {
1822
1865
  readonly scene: MineRenderScene;
1823
1866
  private readonly _chunks;
1867
+ private readonly sectionModels?;
1824
1868
  private readonly pendingCulling;
1825
1869
  private culling?;
1826
- constructor(scene: MineRenderScene);
1827
- getBlockAt(x: number, y: number, z: number): Maybe<BlockInfo>;
1828
- getBlockAt(pos: Vector3): Maybe<BlockInfo>;
1829
- getBlockAt(pos: TripleArray): Maybe<BlockInfo>;
1830
- setBlockAt(x: number, y: number, z: number, block: Maybe<Block>): Promise<Maybe<BlockInfo>>;
1831
- setBlockAt(pos: Vector3, block: Maybe<Block>): Promise<Maybe<BlockInfo>>;
1832
- setBlockAt(pos: TripleArray, block: Maybe<Block>): Promise<Maybe<BlockInfo>>;
1870
+ constructor(scene: MineRenderScene, options?: MineRenderWorldOptions<SectionMeshing>);
1871
+ getBlockAt(x: number, y: number, z: number): Maybe<BlockInfo<SectionMeshing>>;
1872
+ getBlockAt(pos: Vector3): Maybe<BlockInfo<SectionMeshing>>;
1873
+ getBlockAt(pos: TripleArray): Maybe<BlockInfo<SectionMeshing>>;
1874
+ setBlockAt(x: number, y: number, z: number, block: Maybe<Block>): Promise<Maybe<BlockInfo<SectionMeshing>>>;
1875
+ setBlockAt(pos: Vector3, block: Maybe<Block>): Promise<Maybe<BlockInfo<SectionMeshing>>>;
1876
+ setBlockAt(pos: TripleArray, block: Maybe<Block>): Promise<Maybe<BlockInfo<SectionMeshing>>>;
1833
1877
  private placeBlock;
1834
1878
  placeMultiBlock(multiblock: MultiBlockStructure, useBatches?: boolean, executor?: BatchedExecutor): Promise<void>;
1835
1879
  private placeBlocks;
@@ -1838,12 +1882,18 @@ declare class MineRenderWorld {
1838
1882
  clear(): Promise<void>;
1839
1883
  private updateCulling;
1840
1884
  private getOrCreateChunkAt;
1841
- getChunkAt(pos: Vector3): Maybe<Chunk>;
1885
+ getChunkAt(pos: Vector3): Maybe<Chunk<SectionMeshing>>;
1842
1886
  static worldToScenePosition(pos: Vector3): Vector3;
1843
1887
  static sceneToWorldPosition(pos: Vector3): Vector3;
1844
1888
  worldPosToChunkKey(pos: Vector3): string;
1845
1889
  validatePosBounds(pos: Vector3): void;
1846
1890
  }
1891
+ interface MineRenderWorldOptions<SectionMeshing extends boolean = boolean> {
1892
+ /** Merge static opaque cubes into section meshes. Merged blocks have no individual object. */
1893
+ sectionMeshing?: SectionMeshing;
1894
+ /** Maximum width and height of each section atlas page, in pixels. */
1895
+ maxAtlasSize?: number;
1896
+ }
1847
1897
 
1848
1898
  /**
1849
1899
  * {@link EnvProvider} for headless Node.
@@ -1883,4 +1933,4 @@ declare class NodeCache extends PersistentCache<LocalStorage> {
1883
1933
  forEach<T>(callback: (v: T, k: string) => void): Promise<void>;
1884
1934
  }
1885
1935
 
1886
- 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 BlockInfo, type BlockModel, type BlockModelTextures, BlockObject, type BlockObjectOptions, type BlockState, type BlockStateMultipart, type BlockStateProperties, type BlockStateProperty, type BlockStatePropertyDefaults, type BlockStatePropertyValue, type BlockStateVariant, type BlockStateVariants, BlockStates, BlockTints, type BoxGeometryKey, BrowserArchiveProxy, CUBE_FACES, 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 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, 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, SceneInspector, SceneObject, type SceneObjectOptions, SceneStats, SceneStatsDisplay, SchematicParser, 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, createImage, estimateBytesUsed, interleaveAttributes, isAssetKey, isBasicAssetKey, isBlockObject, isDisposable, isDoubleArray, isEntityObject, isInstanceManager, isInstanceReference, isInstanceable, isInstancedMesh, isMesh, isMineRenderScene, isModelObject, isObject3D, isOrthographicCamera, isPerspectiveCamera, isQuadArray, isSceneObject, isTransformable, isTripleArray, isVector3, md5, mergeBufferAttributes, mergeBufferGeometries, mergeVertices, prefix, registerNodeEnv, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode };
1936
+ 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 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 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 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, 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, createImage, estimateBytesUsed, interleaveAttributes, isAssetKey, isBasicAssetKey, isBlockObject, isDisposable, isDoubleArray, isEntityObject, isInstanceManager, isInstanceReference, isInstanceable, isInstancedMesh, isMesh, isMineRenderScene, isModelObject, isObject3D, isOrthographicCamera, isPerspectiveCamera, isQuadArray, isSceneObject, isTransformable, isTripleArray, isVector3, md5, mergeBufferAttributes, mergeBufferGeometries, mergeVertices, prefix, registerNodeEnv, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode };
@@ -1,5 +1,5 @@
1
1
  import * as three from 'three';
2
- import { Vector3, PixelFormat, BoxGeometry, Material, Mesh, Euler, Vector2, BufferAttribute, Float32BufferAttribute, BufferGeometry, Object3D, Box3, InstancedMesh, PerspectiveCamera, OrthographicCamera, Matrix4, Scene, Object3DEventMap, Texture, Camera, MOUSE, TOUCH, WebGLRenderer, EventDispatcher, Raycaster, Intersection, MeshBasicMaterial, CanvasTexture, InterleavedBufferAttribute, TrianglesDrawModes, Line, Points } from 'three';
2
+ import { Vector3, PixelFormat, BoxGeometry, Material, Mesh, Euler, Vector2, BufferAttribute, Float32BufferAttribute, BufferGeometry, Object3D, Box3, InstancedMesh, PerspectiveCamera, OrthographicCamera, Matrix4, Scene, Object3DEventMap, Texture, Camera, MOUSE, TOUCH, WebGLRenderer, EventDispatcher, Raycaster, Intersection, MeshBasicMaterial, CanvasTexture, InterleavedBufferAttribute, TrianglesDrawModes, Line, Points, Group } from 'three';
3
3
  import * as nodeCanvas from 'canvas';
4
4
  import { ImageData as ImageData$1, CanvasRenderingContext2D } from 'canvas';
5
5
  import { Buffer } from 'buffer';
@@ -827,6 +827,14 @@ interface Block {
827
827
  nbt?: any;
828
828
  }
829
829
 
830
+ declare class BlockStateResolver {
831
+ static defaults(blockState: BlockState): Promise<BlockStateProperties>;
832
+ static select(blockState: BlockState, state: BlockStateProperties, choose?: (variants: BlockStateVariant | BlockStateVariant[]) => BlockStateVariant): BlockStateVariant[];
833
+ static matching(blockState: BlockState, state: BlockStateProperties): (BlockStateVariant | BlockStateVariant[])[];
834
+ static choose(variants: BlockStateVariant | BlockStateVariant[]): BlockStateVariant;
835
+ static rotation(variant: BlockStateVariant): Euler;
836
+ }
837
+
830
838
  declare class BlockTints {
831
839
  /** Resolves block preview colors without biome context; explicit tints take precedence. */
832
840
  static get(key: AssetKey | undefined, state: BlockStateProperties, model: Model, tints?: Record<number, number>): Promise<Record<number, number> | undefined>;
@@ -1782,34 +1790,69 @@ declare class AnvilParser {
1782
1790
  private static unpack;
1783
1791
  }
1784
1792
 
1785
- interface BlockInfo {
1793
+ interface BlockInfo<SectionMeshing extends boolean = false> {
1786
1794
  /** Detached block data; use world or chunk setters to update stored blocks. */
1787
1795
  readonly block: Block;
1788
- object: BlockObject;
1796
+ /** Merged terrain has no individual render object in section-meshing mode. */
1797
+ object: SectionMeshing extends false ? BlockObject : BlockObject | undefined;
1798
+ }
1799
+
1800
+ interface SectionMeshTemplate {
1801
+ geometry: BufferGeometry;
1802
+ atlas: TextureAtlas;
1803
+ cullFaces: readonly number[];
1804
+ }
1805
+ interface SectionMeshEntry {
1806
+ index: number;
1807
+ template: SectionMeshTemplate;
1808
+ cullMask: number;
1809
+ }
1810
+ declare class SectionMesh extends Group {
1811
+ private readonly ownedMeshes;
1812
+ static build(entries: readonly SectionMeshEntry[], maxAtlasSize?: number): SectionMesh;
1813
+ dispose(): void;
1814
+ }
1815
+
1816
+ declare class SectionModels {
1817
+ readonly maxAtlasSize: number;
1818
+ private states;
1819
+ private models;
1820
+ private readonly templates;
1821
+ constructor(maxAtlasSize?: number);
1822
+ get(blockState: BlockState, properties?: BlockStateProperties): Promise<SectionMeshTemplate | undefined>;
1823
+ private prepare;
1824
+ clear(): void;
1789
1825
  }
1790
1826
 
1791
- declare class Chunk {
1827
+ declare class Chunk<SectionMeshing extends boolean = false> {
1792
1828
  private readonly onBlocksChanged?;
1829
+ private readonly sectionModels?;
1793
1830
  readonly scene: MineRenderScene;
1794
1831
  readonly x: number;
1795
1832
  readonly y: number;
1796
1833
  readonly z: number;
1797
1834
  private readonly data;
1798
1835
  private readonly renderedBlocks;
1799
- constructor(scene: MineRenderScene, x: number, y: number, z: number, onBlocksChanged?: ((positions: Vector3[]) => Promise<void>) | undefined);
1800
- getBlockAt(x: number, y: number, z: number): Maybe<BlockInfo>;
1801
- getBlockAt(pos: Vector3): Maybe<BlockInfo>;
1802
- getBlockAt(pos: TripleArray): Maybe<BlockInfo>;
1836
+ private readonly sectionBlocks;
1837
+ private sectionMesh?;
1838
+ private meshDirty;
1839
+ constructor(scene: MineRenderScene, x: number, y: number, z: number, onBlocksChanged?: ((positions: Vector3[]) => Promise<void>) | undefined, sectionModels?: SectionModels | undefined);
1840
+ getBlockAt(x: number, y: number, z: number): Maybe<BlockInfo<SectionMeshing>>;
1841
+ getBlockAt(pos: Vector3): Maybe<BlockInfo<SectionMeshing>>;
1842
+ getBlockAt(pos: TripleArray): Maybe<BlockInfo<SectionMeshing>>;
1803
1843
  /**
1804
1844
  * Set block at a _world_ position
1805
1845
  */
1806
- setBlockAt(x: number, y: number, z: number, block: Maybe<Block>): Promise<Maybe<BlockInfo>>;
1807
- setBlockAt(pos: Vector3, block: Maybe<Block>): Promise<Maybe<BlockInfo>>;
1808
- setBlockAt(pos: TripleArray, block: Maybe<Block>): Promise<Maybe<BlockInfo>>;
1846
+ setBlockAt(x: number, y: number, z: number, block: Maybe<Block>): Promise<Maybe<BlockInfo<SectionMeshing>>>;
1847
+ setBlockAt(pos: Vector3, block: Maybe<Block>): Promise<Maybe<BlockInfo<SectionMeshing>>>;
1848
+ setBlockAt(pos: TripleArray, block: Maybe<Block>): Promise<Maybe<BlockInfo<SectionMeshing>>>;
1809
1849
  /**
1810
1850
  * Set a block at integer chunk-local coordinates from 0 to 15.
1811
1851
  */
1812
- setBlockInChunkAt(pos: Vector3, block?: Block, worldPos?: Vector3, onBlocksChanged?: ((positions: Vector3[]) => Promise<void>) | undefined): Promise<Maybe<BlockInfo>>;
1852
+ setBlockInChunkAt(pos: Vector3, block?: Block, worldPos?: Vector3, onBlocksChanged?: ((positions: Vector3[]) => Promise<void>) | undefined): Promise<Maybe<BlockInfo<SectionMeshing>>>;
1853
+ isOccludingAt(pos: Vector3): boolean;
1854
+ setCullMaskAt(pos: Vector3, mask: number): Promise<void>;
1855
+ rebuildSectionMesh(): void;
1813
1856
  clear(onBlocksChanged?: ((positions: Vector3[]) => Promise<void>) | undefined): Promise<void>;
1814
1857
  dispose(): Promise<void>;
1815
1858
  static isAir(block: Maybe<Block>): boolean;
@@ -1818,18 +1861,19 @@ declare class Chunk {
1818
1861
  chunkPosToWorldPos(pos: Vector3): Vector3;
1819
1862
  }
1820
1863
 
1821
- declare class MineRenderWorld {
1864
+ declare class MineRenderWorld<SectionMeshing extends boolean = false> {
1822
1865
  readonly scene: MineRenderScene;
1823
1866
  private readonly _chunks;
1867
+ private readonly sectionModels?;
1824
1868
  private readonly pendingCulling;
1825
1869
  private culling?;
1826
- constructor(scene: MineRenderScene);
1827
- getBlockAt(x: number, y: number, z: number): Maybe<BlockInfo>;
1828
- getBlockAt(pos: Vector3): Maybe<BlockInfo>;
1829
- getBlockAt(pos: TripleArray): Maybe<BlockInfo>;
1830
- setBlockAt(x: number, y: number, z: number, block: Maybe<Block>): Promise<Maybe<BlockInfo>>;
1831
- setBlockAt(pos: Vector3, block: Maybe<Block>): Promise<Maybe<BlockInfo>>;
1832
- setBlockAt(pos: TripleArray, block: Maybe<Block>): Promise<Maybe<BlockInfo>>;
1870
+ constructor(scene: MineRenderScene, options?: MineRenderWorldOptions<SectionMeshing>);
1871
+ getBlockAt(x: number, y: number, z: number): Maybe<BlockInfo<SectionMeshing>>;
1872
+ getBlockAt(pos: Vector3): Maybe<BlockInfo<SectionMeshing>>;
1873
+ getBlockAt(pos: TripleArray): Maybe<BlockInfo<SectionMeshing>>;
1874
+ setBlockAt(x: number, y: number, z: number, block: Maybe<Block>): Promise<Maybe<BlockInfo<SectionMeshing>>>;
1875
+ setBlockAt(pos: Vector3, block: Maybe<Block>): Promise<Maybe<BlockInfo<SectionMeshing>>>;
1876
+ setBlockAt(pos: TripleArray, block: Maybe<Block>): Promise<Maybe<BlockInfo<SectionMeshing>>>;
1833
1877
  private placeBlock;
1834
1878
  placeMultiBlock(multiblock: MultiBlockStructure, useBatches?: boolean, executor?: BatchedExecutor): Promise<void>;
1835
1879
  private placeBlocks;
@@ -1838,12 +1882,18 @@ declare class MineRenderWorld {
1838
1882
  clear(): Promise<void>;
1839
1883
  private updateCulling;
1840
1884
  private getOrCreateChunkAt;
1841
- getChunkAt(pos: Vector3): Maybe<Chunk>;
1885
+ getChunkAt(pos: Vector3): Maybe<Chunk<SectionMeshing>>;
1842
1886
  static worldToScenePosition(pos: Vector3): Vector3;
1843
1887
  static sceneToWorldPosition(pos: Vector3): Vector3;
1844
1888
  worldPosToChunkKey(pos: Vector3): string;
1845
1889
  validatePosBounds(pos: Vector3): void;
1846
1890
  }
1891
+ interface MineRenderWorldOptions<SectionMeshing extends boolean = boolean> {
1892
+ /** Merge static opaque cubes into section meshes. Merged blocks have no individual object. */
1893
+ sectionMeshing?: SectionMeshing;
1894
+ /** Maximum width and height of each section atlas page, in pixels. */
1895
+ maxAtlasSize?: number;
1896
+ }
1847
1897
 
1848
1898
  /**
1849
1899
  * {@link EnvProvider} for headless Node.
@@ -1883,4 +1933,4 @@ declare class NodeCache extends PersistentCache<LocalStorage> {
1883
1933
  forEach<T>(callback: (v: T, k: string) => void): Promise<void>;
1884
1934
  }
1885
1935
 
1886
- 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 BlockInfo, type BlockModel, type BlockModelTextures, BlockObject, type BlockObjectOptions, type BlockState, type BlockStateMultipart, type BlockStateProperties, type BlockStateProperty, type BlockStatePropertyDefaults, type BlockStatePropertyValue, type BlockStateVariant, type BlockStateVariants, BlockStates, BlockTints, type BoxGeometryKey, BrowserArchiveProxy, CUBE_FACES, 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 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, 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, SceneInspector, SceneObject, type SceneObjectOptions, SceneStats, SceneStatsDisplay, SchematicParser, 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, createImage, estimateBytesUsed, interleaveAttributes, isAssetKey, isBasicAssetKey, isBlockObject, isDisposable, isDoubleArray, isEntityObject, isInstanceManager, isInstanceReference, isInstanceable, isInstancedMesh, isMesh, isMineRenderScene, isModelObject, isObject3D, isOrthographicCamera, isPerspectiveCamera, isQuadArray, isSceneObject, isTransformable, isTripleArray, isVector3, md5, mergeBufferAttributes, mergeBufferGeometries, mergeVertices, prefix, registerNodeEnv, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode };
1936
+ 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 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 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 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, 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, createImage, estimateBytesUsed, interleaveAttributes, isAssetKey, isBasicAssetKey, isBlockObject, isDisposable, isDoubleArray, isEntityObject, isInstanceManager, isInstanceReference, isInstanceable, isInstancedMesh, isMesh, isMineRenderScene, isModelObject, isObject3D, isOrthographicCamera, isPerspectiveCamera, isQuadArray, isSceneObject, isTransformable, isTripleArray, isVector3, md5, mergeBufferAttributes, mergeBufferGeometries, mergeVertices, prefix, registerNodeEnv, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode };