minerender 2.1.0-alpha.121 → 2.1.0-alpha.122
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/dist/browser/index.d.mts +30 -1
- package/dist/browser/index.d.ts +30 -1
- package/dist/browser/index.js +117 -2
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/index.mjs +118 -3
- package/dist/browser/index.mjs.map +1 -1
- package/dist/browser/section.worker.js +5 -2
- package/dist/browser/section.worker.js.map +1 -1
- package/dist/browser/section.worker.mjs +5 -2
- package/dist/browser/section.worker.mjs.map +1 -1
- package/dist/bundle.js +122 -2
- package/dist/bundle.js.map +1 -1
- package/dist/node/index.d.mts +30 -1
- package/dist/node/index.d.ts +30 -1
- package/dist/node/index.js +117 -2
- package/dist/node/index.js.map +1 -1
- package/dist/node/index.mjs +118 -3
- package/dist/node/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/browser/index.d.mts
CHANGED
|
@@ -1670,6 +1670,8 @@ declare class BlockObject extends SceneObject {
|
|
|
1670
1670
|
private removeEntities;
|
|
1671
1671
|
/** Entity models drawn for this block instead of its block model; they are scene children, unlike the block. */
|
|
1672
1672
|
get blockEntities(): readonly EntityObject[];
|
|
1673
|
+
/** Model placements drawn for this block, including its fluid surface. */
|
|
1674
|
+
get models(): readonly (ModelObject | InstanceReference<ModelObject>)[];
|
|
1673
1675
|
/** Sets visibility for this block's model instances and block entities. */
|
|
1674
1676
|
setVisible(visible: boolean): void;
|
|
1675
1677
|
/**
|
|
@@ -3803,6 +3805,8 @@ interface SectionGeometryPage {
|
|
|
3803
3805
|
uvBounds: Float32Array;
|
|
3804
3806
|
colors: Float32Array;
|
|
3805
3807
|
indices: Uint32Array;
|
|
3808
|
+
/** Owning section cell for each quad; each quad contributes two consecutive triangles. */
|
|
3809
|
+
blockIndices: Uint16Array;
|
|
3806
3810
|
}
|
|
3807
3811
|
/** Builds section-local geometry from visible quads, with bounded atlas pages per layer. */
|
|
3808
3812
|
declare function buildSectionGeometry(input: SectionGeometryInput): SectionGeometryPage[];
|
|
@@ -3836,6 +3840,9 @@ interface SectionFluids {
|
|
|
3836
3840
|
/** Merged terrain geometry and atlas pages for one 16×16×16 section. Owns its generated render resources. */
|
|
3837
3841
|
declare class SectionMesh extends Group {
|
|
3838
3842
|
private readonly ownedMeshes;
|
|
3843
|
+
private readonly blockIndices;
|
|
3844
|
+
/** Returns the owning section cell for a triangle hit on this mesh's merged geometry. */
|
|
3845
|
+
getBlockIndex(hit: Intersection): number | undefined;
|
|
3839
3846
|
/** Builds section-local meshes from visible quads. `maxAtlasSize` limits each atlas dimension in pixels. */
|
|
3840
3847
|
static build(entries: readonly SectionMeshEntry[], maxAtlasSize?: number, fluids?: SectionFluids, lighting?: Pick<SectionGeometryInput, "light" | "ambientLight" | "ambientOcclusion">): SectionMesh;
|
|
3841
3848
|
/** Builds section-local meshes in a browser worker when available, with synchronous fallback. */
|
|
@@ -3867,6 +3874,20 @@ declare class SectionModels {
|
|
|
3867
3874
|
clear(): void;
|
|
3868
3875
|
}
|
|
3869
3876
|
|
|
3877
|
+
/** The nearest rendered block triangle hit by a world raycast. */
|
|
3878
|
+
interface WorldBlockIntersection {
|
|
3879
|
+
/** Integer world block coordinates of the geometry's owner. */
|
|
3880
|
+
position: Vector3;
|
|
3881
|
+
/** Detached block data; use world setters to change the block. */
|
|
3882
|
+
block: Block;
|
|
3883
|
+
/** Hit position in scene units. */
|
|
3884
|
+
point: Vector3;
|
|
3885
|
+
/** Unit face normal in scene space. Sloped and rotated faces retain their geometric normal. */
|
|
3886
|
+
normal: Vector3;
|
|
3887
|
+
/** Distance from the ray origin, in scene units. */
|
|
3888
|
+
distance: number;
|
|
3889
|
+
}
|
|
3890
|
+
|
|
3870
3891
|
/**
|
|
3871
3892
|
* A 16×16×16 block section and its render objects.
|
|
3872
3893
|
* Constructor coordinates identify the section. Block accessors use world block coordinates
|
|
@@ -3887,6 +3908,7 @@ declare class Chunk<SectionMeshing extends boolean = false> {
|
|
|
3887
3908
|
readonly z: number;
|
|
3888
3909
|
private readonly data;
|
|
3889
3910
|
private readonly renderedBlocks;
|
|
3911
|
+
private readonly objectBlocks;
|
|
3890
3912
|
private readonly sectionBlocks;
|
|
3891
3913
|
private readonly hiddenBlocks;
|
|
3892
3914
|
private readonly fluidCells;
|
|
@@ -3898,6 +3920,8 @@ declare class Chunk<SectionMeshing extends boolean = false> {
|
|
|
3898
3920
|
private meshGeneration;
|
|
3899
3921
|
private ambientOcclusionCells?;
|
|
3900
3922
|
constructor(scene: MineRenderScene, x: number, y: number, z: number, onBlocksChanged?: ((positions: Vector3[]) => Promise<void>) | undefined, sectionModels?: SectionModels | undefined, neighborCell?: ((x: number, y: number, z: number) => number) | undefined, biomeAt?: ((x: number, y: number, z: number) => Maybe<string>) | undefined, onBiomesChanged?: ((biomes?: readonly string[]) => Promise<void>) | undefined, lightAt?: ((x: number, y: number, z: number) => number) | undefined, onLightCleared?: (() => Promise<void>) | undefined, ambientLight?: number);
|
|
3923
|
+
/** Finds the nearest owned block hit across sections, testing each shared mesh once. */
|
|
3924
|
+
static raycast<SectionMeshing extends boolean>(chunks: Iterable<Chunk<SectionMeshing>>, raycaster: Raycaster): WorldBlockIntersection | undefined;
|
|
3901
3925
|
getBlockAt(x: number, y: number, z: number): Maybe<BlockInfo<SectionMeshing>>;
|
|
3902
3926
|
getBlockAt(pos: Vector3): Maybe<BlockInfo<SectionMeshing>>;
|
|
3903
3927
|
getBlockAt(pos: TripleArray): Maybe<BlockInfo<SectionMeshing>>;
|
|
@@ -3985,6 +4009,11 @@ declare class MineRenderWorld<SectionMeshing extends boolean = false> {
|
|
|
3985
4009
|
private readonly pendingCulling;
|
|
3986
4010
|
private culling?;
|
|
3987
4011
|
constructor(scene: MineRenderScene, options?: MineRenderWorldOptions<SectionMeshing>);
|
|
4012
|
+
/**
|
|
4013
|
+
* Returns the nearest visible block geometry hit, respecting the raycaster's layers and near/far range.
|
|
4014
|
+
* Includes fluids and block entities; texture alpha does not change triangle intersections.
|
|
4015
|
+
*/
|
|
4016
|
+
raycast(raycaster: Raycaster): WorldBlockIntersection | undefined;
|
|
3988
4017
|
/** Whether neighboring opaque cubes shade block-face corners. Defaults to false. */
|
|
3989
4018
|
get ambientOcclusion(): boolean;
|
|
3990
4019
|
/** Rebuilds loaded blocks with or without corner shading. Block data and saved lighting are preserved. */
|
|
@@ -4195,4 +4224,4 @@ declare class BrowserCache extends PersistentCache<LocalForage> {
|
|
|
4195
4224
|
*/
|
|
4196
4225
|
declare function probeImageSize(data: Uint8Array): ImageSizeInfo;
|
|
4197
4226
|
|
|
4198
|
-
export { AXES, type AnimationFrame, type AnimationMeta, type AnimatorFunction, type AnvilChunk, type AnvilEntityChunk, type AnvilExternalChunkReader, type AnvilParseOptions, AnvilParser, type AnvilRegion, type AnvilRegionReader, AnvilWorldSource, type AnvilWorldSourceOptions, ArchiveAssetSource, type ArchiveAssetSourceOptions, type ArchiveEntry, type ArchiveProxy, AssetKey, AssetLoadError, AssetLoader, AssetParser, AssetSource, type AssetType, Assets, Axis, BUILTIN_ENTITY, BUILTIN_GENERATED, type BannerPattern, type BannerPatternDraw, BannerPatterns, BasicAssetKey, type BasicMinecraftAsset, BatchedExecutor, type BedrockBone, type BedrockCube, type BedrockEntityDescription, type BedrockEntityFile, type BedrockGeometry, type BedrockGeometryFile, type Biome, type BiomeColorKind, Biomes, type BitmapFont, type BitmapGlyph, type Block, BlockEntities, type BlockEntityEntry, type BlockEntityIndex, type BlockEntityPart, type BlockEntityRotation, 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, Colormaps, type CompatCanvas, type CompatImage, type ComposerOptions, type ControlsMode, type ControlsOptions, CubeFace, CubeFaceIndex, DEFAULT_ELEMENTS, DEFAULT_NAMESPACE, DEFAULT_ROOT, DEFAULT_UV, DISPLAY_POSITIONS, DYE_COLORS, type DebugOptions, type DecoratedPotSide, DecoratedPots, type DeepPartial, DefaultBlockStates, DisplayPosition, DisplayTransforms, type Disposable, type DoubleArray, type DyeColor, ENTITY_ANIMATION_CHANNELS, type ElementFace, type ElementRotation, Entities, type EntityAnimation, type EntityAnimationBone, type EntityAnimationChannel, type EntityAnimationFile, type EntityAnimationKeyframe, type EntityAnimationOptions, EntityAnimationPlayer, type EntityAnimationPose, type EntityLayer, type EntityModel, type EntityModelCube, type EntityModelFile, type EntityModelLayer, type EntityModelOptions, type EntityModelPart, type EntityModelPass, EntityObject, type EntityObjectOptions, type EntityRenderMode, type EntityTransformOp, Env, type EnvProvider, type ExtractableImageData, type FluidKind, FluidModelObject, type FluidQuads, type FluidRules, type FluidSample, type FluidSampler, type FlyAction, FlyControls, type FlyControlsEventMap, Fonts, type FrameCallback, type FromTo, GUI_CONTAINER_LAYOUTS, Geometries, type GuiBookButtonState, type GuiBookOptions, type GuiBossBarColor, type GuiBossBarOptions, type GuiContainerType, GuiHelper, type GuiItemLayer, type GuiLayer, GuiLight, GuiObject, type GuiObjectOptions, type GuiRecipe, type GuiRecipeIngredient, type GuiRecipeOptions, type GuiSpriteScaling, type GuiText, type GuiTextLayer, type GuiTextLayout, type GuiTextOptions, type GuiTextRun, type GuiTextStyle, type GuiTextureLayer, type GuiTooltipOptions, HostedAssetSource, type IModelTextures, ITEM_GENERATED, type ImageInfo, ImageLoader, type ImageSizeInfo, InstanceManager, InstanceReference, type Instanceable, ItemDefaults, ItemGlint, type ItemModel, type ItemModelContext, type ItemModelTextures, type ItemTintColor, type ItemTintSource, ItemTints, type ListAsset, LitematicaParser, type LitematicaRegion, type LitematicaStructure, type LoadedSceneDocument, type LoadedSceneObject, MapControls, type MaterialKey, Materials, type Maybe, type MeshKey, Meshes, MineRenderData, type MineRenderDataManifest, type MineRenderDatasets, 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, type PackFormat, PackFormats, PackMetadata, PersistentCache, PlayerHeadTextures, type PositionedGuiGlyph, type QuadArray, type RawImageKey, type RenderOptions, Renderer, type RendererControls, type RendererFrame, type RendererOptions, type RendererSurface, type RequestConfig, RequestError, type RequestResponse, Requests, type ResolvedBlockEntity, type ResolvedMineRenderData, type ResponseParser, SCENE_DOCUMENT_MAX_BYTES, SKIN_PARTS, type SavedLightSample, type SceneBlockDefinition, type SceneDocument, SceneDocumentLoader, type SceneEntityDefinition, SceneExporter, type SceneGLTFExportOptions, type SceneGuiDefinition, type SceneGuiLayer, SceneInspector, type SceneItemContext, type SceneModelDefinition, SceneObject, type SceneObjectDefinition, type SceneObjectDefinitionBase, type SceneObjectOptions, type SceneSkinDefinition, type SceneSkinPosePart, SceneStats, SceneStatsDisplay, SchematicParser, type SchematicParserOptions, type SectionAtlasSize, type SectionFluidInput, type SectionFluidKind, type SectionFluids, type SectionGeometryInput, type SectionGeometryPage, type SectionLightData, SectionMesh, type SectionMeshEntry, type SectionMeshTemplate, SectionModels, type SectionTemplateData, SectionWorker, type Serializable, type SkinGeometries, SkinImage, SkinObject, type SkinObjectOptions, SkinPart, type SkinTexture, type SkinTextureCoordinates, SkinTextures, Skins, type SpecialItemPart, type SpecialItemRenderer, SpecialItems, SpongeSchematicParser, type StructureNBT, StructureParser, type TextureAsset, TextureAtlas, type TextureKey, TextureLoader, Textures, Ticker, type TickerFunction, TintColors, type Transformable, type TripleArray, UVMapper, type VideoExportOptions, VideoExporter, type WorldChunkSource, WorldStreamer, type WorldStreamerOptions, WrappedImage, addBox3WireframeToObject, addWireframeToMesh, addWireframeToObject, applyElementRotation, applyGenericRotation, axisToVec3, base64decode, base64encode, buildFluidQuads, buildSectionGeometry, capeTextureSizes, captureException, changeEvent, clampRotationDegrees, classicSkinGeometries, classicSkinTextureCoordinates, computeMorphedAttributes, copySectionLight, createCanvas, createFluidGeometry, createGuiTextGeometry, createGuiTextureGeometry, createImage, decodeSceneDocument, encodeSceneDocument, entityAnimationTime, estimateBytesUsed, fluidKindOf, getBlockFluidState, getFluidKind, interleaveAttributes, isAssetKey, isBasicAssetKey, isBlockObject, isDisposable, isDoubleArray, isEntityObject, isFlyControls, isGuiObject, isInstanceManager, isInstanceReference, isInstanceable, isInstancedMesh, isMesh, isMineRenderScene, isModelObject, isObject3D, isOrthographicCamera, isPerspectiveCamera, isQuadArray, isResourceLocation, isSceneObject, isTransformable, isTripleArray, isVector3, layoutGuiText, md5, mergeBufferAttributes, mergeBufferGeometries, mergeVertices, parseSceneDocument, prefix, probeImageSize, registerBrowserEnv, resolveBlockFluidState, resolveLegacyBlock, resolveLegacyBlockState, sampleEntityAnimation, sampleEntityKeyframes, sampleFluid, sampleSectionLight, sectionGeometryTransferables, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode, trimCanvas, yieldToEventLoop };
|
|
4227
|
+
export { AXES, type AnimationFrame, type AnimationMeta, type AnimatorFunction, type AnvilChunk, type AnvilEntityChunk, type AnvilExternalChunkReader, type AnvilParseOptions, AnvilParser, type AnvilRegion, type AnvilRegionReader, AnvilWorldSource, type AnvilWorldSourceOptions, ArchiveAssetSource, type ArchiveAssetSourceOptions, type ArchiveEntry, type ArchiveProxy, AssetKey, AssetLoadError, AssetLoader, AssetParser, AssetSource, type AssetType, Assets, Axis, BUILTIN_ENTITY, BUILTIN_GENERATED, type BannerPattern, type BannerPatternDraw, BannerPatterns, BasicAssetKey, type BasicMinecraftAsset, BatchedExecutor, type BedrockBone, type BedrockCube, type BedrockEntityDescription, type BedrockEntityFile, type BedrockGeometry, type BedrockGeometryFile, type Biome, type BiomeColorKind, Biomes, type BitmapFont, type BitmapGlyph, type Block, BlockEntities, type BlockEntityEntry, type BlockEntityIndex, type BlockEntityPart, type BlockEntityRotation, 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, Colormaps, type CompatCanvas, type CompatImage, type ComposerOptions, type ControlsMode, type ControlsOptions, CubeFace, CubeFaceIndex, DEFAULT_ELEMENTS, DEFAULT_NAMESPACE, DEFAULT_ROOT, DEFAULT_UV, DISPLAY_POSITIONS, DYE_COLORS, type DebugOptions, type DecoratedPotSide, DecoratedPots, type DeepPartial, DefaultBlockStates, DisplayPosition, DisplayTransforms, type Disposable, type DoubleArray, type DyeColor, ENTITY_ANIMATION_CHANNELS, type ElementFace, type ElementRotation, Entities, type EntityAnimation, type EntityAnimationBone, type EntityAnimationChannel, type EntityAnimationFile, type EntityAnimationKeyframe, type EntityAnimationOptions, EntityAnimationPlayer, type EntityAnimationPose, type EntityLayer, type EntityModel, type EntityModelCube, type EntityModelFile, type EntityModelLayer, type EntityModelOptions, type EntityModelPart, type EntityModelPass, EntityObject, type EntityObjectOptions, type EntityRenderMode, type EntityTransformOp, Env, type EnvProvider, type ExtractableImageData, type FluidKind, FluidModelObject, type FluidQuads, type FluidRules, type FluidSample, type FluidSampler, type FlyAction, FlyControls, type FlyControlsEventMap, Fonts, type FrameCallback, type FromTo, GUI_CONTAINER_LAYOUTS, Geometries, type GuiBookButtonState, type GuiBookOptions, type GuiBossBarColor, type GuiBossBarOptions, type GuiContainerType, GuiHelper, type GuiItemLayer, type GuiLayer, GuiLight, GuiObject, type GuiObjectOptions, type GuiRecipe, type GuiRecipeIngredient, type GuiRecipeOptions, type GuiSpriteScaling, type GuiText, type GuiTextLayer, type GuiTextLayout, type GuiTextOptions, type GuiTextRun, type GuiTextStyle, type GuiTextureLayer, type GuiTooltipOptions, HostedAssetSource, type IModelTextures, ITEM_GENERATED, type ImageInfo, ImageLoader, type ImageSizeInfo, InstanceManager, InstanceReference, type Instanceable, ItemDefaults, ItemGlint, type ItemModel, type ItemModelContext, type ItemModelTextures, type ItemTintColor, type ItemTintSource, ItemTints, type ListAsset, LitematicaParser, type LitematicaRegion, type LitematicaStructure, type LoadedSceneDocument, type LoadedSceneObject, MapControls, type MaterialKey, Materials, type Maybe, type MeshKey, Meshes, MineRenderData, type MineRenderDataManifest, type MineRenderDatasets, 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, type PackFormat, PackFormats, PackMetadata, PersistentCache, PlayerHeadTextures, type PositionedGuiGlyph, type QuadArray, type RawImageKey, type RenderOptions, Renderer, type RendererControls, type RendererFrame, type RendererOptions, type RendererSurface, type RequestConfig, RequestError, type RequestResponse, Requests, type ResolvedBlockEntity, type ResolvedMineRenderData, type ResponseParser, SCENE_DOCUMENT_MAX_BYTES, SKIN_PARTS, type SavedLightSample, type SceneBlockDefinition, type SceneDocument, SceneDocumentLoader, type SceneEntityDefinition, SceneExporter, type SceneGLTFExportOptions, type SceneGuiDefinition, type SceneGuiLayer, SceneInspector, type SceneItemContext, type SceneModelDefinition, SceneObject, type SceneObjectDefinition, type SceneObjectDefinitionBase, type SceneObjectOptions, type SceneSkinDefinition, type SceneSkinPosePart, SceneStats, SceneStatsDisplay, SchematicParser, type SchematicParserOptions, type SectionAtlasSize, type SectionFluidInput, type SectionFluidKind, type SectionFluids, type SectionGeometryInput, type SectionGeometryPage, type SectionLightData, SectionMesh, type SectionMeshEntry, type SectionMeshTemplate, SectionModels, type SectionTemplateData, SectionWorker, type Serializable, type SkinGeometries, SkinImage, SkinObject, type SkinObjectOptions, SkinPart, type SkinTexture, type SkinTextureCoordinates, SkinTextures, Skins, type SpecialItemPart, type SpecialItemRenderer, SpecialItems, SpongeSchematicParser, type StructureNBT, StructureParser, type TextureAsset, TextureAtlas, type TextureKey, TextureLoader, Textures, Ticker, type TickerFunction, TintColors, type Transformable, type TripleArray, UVMapper, type VideoExportOptions, VideoExporter, type WorldBlockIntersection, type WorldChunkSource, WorldStreamer, type WorldStreamerOptions, WrappedImage, addBox3WireframeToObject, addWireframeToMesh, addWireframeToObject, applyElementRotation, applyGenericRotation, axisToVec3, base64decode, base64encode, buildFluidQuads, buildSectionGeometry, capeTextureSizes, captureException, changeEvent, clampRotationDegrees, classicSkinGeometries, classicSkinTextureCoordinates, computeMorphedAttributes, copySectionLight, createCanvas, createFluidGeometry, createGuiTextGeometry, createGuiTextureGeometry, createImage, decodeSceneDocument, encodeSceneDocument, entityAnimationTime, estimateBytesUsed, fluidKindOf, getBlockFluidState, getFluidKind, interleaveAttributes, isAssetKey, isBasicAssetKey, isBlockObject, isDisposable, isDoubleArray, isEntityObject, isFlyControls, isGuiObject, isInstanceManager, isInstanceReference, isInstanceable, isInstancedMesh, isMesh, isMineRenderScene, isModelObject, isObject3D, isOrthographicCamera, isPerspectiveCamera, isQuadArray, isResourceLocation, isSceneObject, isTransformable, isTripleArray, isVector3, layoutGuiText, md5, mergeBufferAttributes, mergeBufferGeometries, mergeVertices, parseSceneDocument, prefix, probeImageSize, registerBrowserEnv, resolveBlockFluidState, resolveLegacyBlock, resolveLegacyBlockState, sampleEntityAnimation, sampleEntityKeyframes, sampleFluid, sampleSectionLight, sectionGeometryTransferables, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode, trimCanvas, yieldToEventLoop };
|
package/dist/browser/index.d.ts
CHANGED
|
@@ -1670,6 +1670,8 @@ declare class BlockObject extends SceneObject {
|
|
|
1670
1670
|
private removeEntities;
|
|
1671
1671
|
/** Entity models drawn for this block instead of its block model; they are scene children, unlike the block. */
|
|
1672
1672
|
get blockEntities(): readonly EntityObject[];
|
|
1673
|
+
/** Model placements drawn for this block, including its fluid surface. */
|
|
1674
|
+
get models(): readonly (ModelObject | InstanceReference<ModelObject>)[];
|
|
1673
1675
|
/** Sets visibility for this block's model instances and block entities. */
|
|
1674
1676
|
setVisible(visible: boolean): void;
|
|
1675
1677
|
/**
|
|
@@ -3803,6 +3805,8 @@ interface SectionGeometryPage {
|
|
|
3803
3805
|
uvBounds: Float32Array;
|
|
3804
3806
|
colors: Float32Array;
|
|
3805
3807
|
indices: Uint32Array;
|
|
3808
|
+
/** Owning section cell for each quad; each quad contributes two consecutive triangles. */
|
|
3809
|
+
blockIndices: Uint16Array;
|
|
3806
3810
|
}
|
|
3807
3811
|
/** Builds section-local geometry from visible quads, with bounded atlas pages per layer. */
|
|
3808
3812
|
declare function buildSectionGeometry(input: SectionGeometryInput): SectionGeometryPage[];
|
|
@@ -3836,6 +3840,9 @@ interface SectionFluids {
|
|
|
3836
3840
|
/** Merged terrain geometry and atlas pages for one 16×16×16 section. Owns its generated render resources. */
|
|
3837
3841
|
declare class SectionMesh extends Group {
|
|
3838
3842
|
private readonly ownedMeshes;
|
|
3843
|
+
private readonly blockIndices;
|
|
3844
|
+
/** Returns the owning section cell for a triangle hit on this mesh's merged geometry. */
|
|
3845
|
+
getBlockIndex(hit: Intersection): number | undefined;
|
|
3839
3846
|
/** Builds section-local meshes from visible quads. `maxAtlasSize` limits each atlas dimension in pixels. */
|
|
3840
3847
|
static build(entries: readonly SectionMeshEntry[], maxAtlasSize?: number, fluids?: SectionFluids, lighting?: Pick<SectionGeometryInput, "light" | "ambientLight" | "ambientOcclusion">): SectionMesh;
|
|
3841
3848
|
/** Builds section-local meshes in a browser worker when available, with synchronous fallback. */
|
|
@@ -3867,6 +3874,20 @@ declare class SectionModels {
|
|
|
3867
3874
|
clear(): void;
|
|
3868
3875
|
}
|
|
3869
3876
|
|
|
3877
|
+
/** The nearest rendered block triangle hit by a world raycast. */
|
|
3878
|
+
interface WorldBlockIntersection {
|
|
3879
|
+
/** Integer world block coordinates of the geometry's owner. */
|
|
3880
|
+
position: Vector3;
|
|
3881
|
+
/** Detached block data; use world setters to change the block. */
|
|
3882
|
+
block: Block;
|
|
3883
|
+
/** Hit position in scene units. */
|
|
3884
|
+
point: Vector3;
|
|
3885
|
+
/** Unit face normal in scene space. Sloped and rotated faces retain their geometric normal. */
|
|
3886
|
+
normal: Vector3;
|
|
3887
|
+
/** Distance from the ray origin, in scene units. */
|
|
3888
|
+
distance: number;
|
|
3889
|
+
}
|
|
3890
|
+
|
|
3870
3891
|
/**
|
|
3871
3892
|
* A 16×16×16 block section and its render objects.
|
|
3872
3893
|
* Constructor coordinates identify the section. Block accessors use world block coordinates
|
|
@@ -3887,6 +3908,7 @@ declare class Chunk<SectionMeshing extends boolean = false> {
|
|
|
3887
3908
|
readonly z: number;
|
|
3888
3909
|
private readonly data;
|
|
3889
3910
|
private readonly renderedBlocks;
|
|
3911
|
+
private readonly objectBlocks;
|
|
3890
3912
|
private readonly sectionBlocks;
|
|
3891
3913
|
private readonly hiddenBlocks;
|
|
3892
3914
|
private readonly fluidCells;
|
|
@@ -3898,6 +3920,8 @@ declare class Chunk<SectionMeshing extends boolean = false> {
|
|
|
3898
3920
|
private meshGeneration;
|
|
3899
3921
|
private ambientOcclusionCells?;
|
|
3900
3922
|
constructor(scene: MineRenderScene, x: number, y: number, z: number, onBlocksChanged?: ((positions: Vector3[]) => Promise<void>) | undefined, sectionModels?: SectionModels | undefined, neighborCell?: ((x: number, y: number, z: number) => number) | undefined, biomeAt?: ((x: number, y: number, z: number) => Maybe<string>) | undefined, onBiomesChanged?: ((biomes?: readonly string[]) => Promise<void>) | undefined, lightAt?: ((x: number, y: number, z: number) => number) | undefined, onLightCleared?: (() => Promise<void>) | undefined, ambientLight?: number);
|
|
3923
|
+
/** Finds the nearest owned block hit across sections, testing each shared mesh once. */
|
|
3924
|
+
static raycast<SectionMeshing extends boolean>(chunks: Iterable<Chunk<SectionMeshing>>, raycaster: Raycaster): WorldBlockIntersection | undefined;
|
|
3901
3925
|
getBlockAt(x: number, y: number, z: number): Maybe<BlockInfo<SectionMeshing>>;
|
|
3902
3926
|
getBlockAt(pos: Vector3): Maybe<BlockInfo<SectionMeshing>>;
|
|
3903
3927
|
getBlockAt(pos: TripleArray): Maybe<BlockInfo<SectionMeshing>>;
|
|
@@ -3985,6 +4009,11 @@ declare class MineRenderWorld<SectionMeshing extends boolean = false> {
|
|
|
3985
4009
|
private readonly pendingCulling;
|
|
3986
4010
|
private culling?;
|
|
3987
4011
|
constructor(scene: MineRenderScene, options?: MineRenderWorldOptions<SectionMeshing>);
|
|
4012
|
+
/**
|
|
4013
|
+
* Returns the nearest visible block geometry hit, respecting the raycaster's layers and near/far range.
|
|
4014
|
+
* Includes fluids and block entities; texture alpha does not change triangle intersections.
|
|
4015
|
+
*/
|
|
4016
|
+
raycast(raycaster: Raycaster): WorldBlockIntersection | undefined;
|
|
3988
4017
|
/** Whether neighboring opaque cubes shade block-face corners. Defaults to false. */
|
|
3989
4018
|
get ambientOcclusion(): boolean;
|
|
3990
4019
|
/** Rebuilds loaded blocks with or without corner shading. Block data and saved lighting are preserved. */
|
|
@@ -4195,4 +4224,4 @@ declare class BrowserCache extends PersistentCache<LocalForage> {
|
|
|
4195
4224
|
*/
|
|
4196
4225
|
declare function probeImageSize(data: Uint8Array): ImageSizeInfo;
|
|
4197
4226
|
|
|
4198
|
-
export { AXES, type AnimationFrame, type AnimationMeta, type AnimatorFunction, type AnvilChunk, type AnvilEntityChunk, type AnvilExternalChunkReader, type AnvilParseOptions, AnvilParser, type AnvilRegion, type AnvilRegionReader, AnvilWorldSource, type AnvilWorldSourceOptions, ArchiveAssetSource, type ArchiveAssetSourceOptions, type ArchiveEntry, type ArchiveProxy, AssetKey, AssetLoadError, AssetLoader, AssetParser, AssetSource, type AssetType, Assets, Axis, BUILTIN_ENTITY, BUILTIN_GENERATED, type BannerPattern, type BannerPatternDraw, BannerPatterns, BasicAssetKey, type BasicMinecraftAsset, BatchedExecutor, type BedrockBone, type BedrockCube, type BedrockEntityDescription, type BedrockEntityFile, type BedrockGeometry, type BedrockGeometryFile, type Biome, type BiomeColorKind, Biomes, type BitmapFont, type BitmapGlyph, type Block, BlockEntities, type BlockEntityEntry, type BlockEntityIndex, type BlockEntityPart, type BlockEntityRotation, 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, Colormaps, type CompatCanvas, type CompatImage, type ComposerOptions, type ControlsMode, type ControlsOptions, CubeFace, CubeFaceIndex, DEFAULT_ELEMENTS, DEFAULT_NAMESPACE, DEFAULT_ROOT, DEFAULT_UV, DISPLAY_POSITIONS, DYE_COLORS, type DebugOptions, type DecoratedPotSide, DecoratedPots, type DeepPartial, DefaultBlockStates, DisplayPosition, DisplayTransforms, type Disposable, type DoubleArray, type DyeColor, ENTITY_ANIMATION_CHANNELS, type ElementFace, type ElementRotation, Entities, type EntityAnimation, type EntityAnimationBone, type EntityAnimationChannel, type EntityAnimationFile, type EntityAnimationKeyframe, type EntityAnimationOptions, EntityAnimationPlayer, type EntityAnimationPose, type EntityLayer, type EntityModel, type EntityModelCube, type EntityModelFile, type EntityModelLayer, type EntityModelOptions, type EntityModelPart, type EntityModelPass, EntityObject, type EntityObjectOptions, type EntityRenderMode, type EntityTransformOp, Env, type EnvProvider, type ExtractableImageData, type FluidKind, FluidModelObject, type FluidQuads, type FluidRules, type FluidSample, type FluidSampler, type FlyAction, FlyControls, type FlyControlsEventMap, Fonts, type FrameCallback, type FromTo, GUI_CONTAINER_LAYOUTS, Geometries, type GuiBookButtonState, type GuiBookOptions, type GuiBossBarColor, type GuiBossBarOptions, type GuiContainerType, GuiHelper, type GuiItemLayer, type GuiLayer, GuiLight, GuiObject, type GuiObjectOptions, type GuiRecipe, type GuiRecipeIngredient, type GuiRecipeOptions, type GuiSpriteScaling, type GuiText, type GuiTextLayer, type GuiTextLayout, type GuiTextOptions, type GuiTextRun, type GuiTextStyle, type GuiTextureLayer, type GuiTooltipOptions, HostedAssetSource, type IModelTextures, ITEM_GENERATED, type ImageInfo, ImageLoader, type ImageSizeInfo, InstanceManager, InstanceReference, type Instanceable, ItemDefaults, ItemGlint, type ItemModel, type ItemModelContext, type ItemModelTextures, type ItemTintColor, type ItemTintSource, ItemTints, type ListAsset, LitematicaParser, type LitematicaRegion, type LitematicaStructure, type LoadedSceneDocument, type LoadedSceneObject, MapControls, type MaterialKey, Materials, type Maybe, type MeshKey, Meshes, MineRenderData, type MineRenderDataManifest, type MineRenderDatasets, 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, type PackFormat, PackFormats, PackMetadata, PersistentCache, PlayerHeadTextures, type PositionedGuiGlyph, type QuadArray, type RawImageKey, type RenderOptions, Renderer, type RendererControls, type RendererFrame, type RendererOptions, type RendererSurface, type RequestConfig, RequestError, type RequestResponse, Requests, type ResolvedBlockEntity, type ResolvedMineRenderData, type ResponseParser, SCENE_DOCUMENT_MAX_BYTES, SKIN_PARTS, type SavedLightSample, type SceneBlockDefinition, type SceneDocument, SceneDocumentLoader, type SceneEntityDefinition, SceneExporter, type SceneGLTFExportOptions, type SceneGuiDefinition, type SceneGuiLayer, SceneInspector, type SceneItemContext, type SceneModelDefinition, SceneObject, type SceneObjectDefinition, type SceneObjectDefinitionBase, type SceneObjectOptions, type SceneSkinDefinition, type SceneSkinPosePart, SceneStats, SceneStatsDisplay, SchematicParser, type SchematicParserOptions, type SectionAtlasSize, type SectionFluidInput, type SectionFluidKind, type SectionFluids, type SectionGeometryInput, type SectionGeometryPage, type SectionLightData, SectionMesh, type SectionMeshEntry, type SectionMeshTemplate, SectionModels, type SectionTemplateData, SectionWorker, type Serializable, type SkinGeometries, SkinImage, SkinObject, type SkinObjectOptions, SkinPart, type SkinTexture, type SkinTextureCoordinates, SkinTextures, Skins, type SpecialItemPart, type SpecialItemRenderer, SpecialItems, SpongeSchematicParser, type StructureNBT, StructureParser, type TextureAsset, TextureAtlas, type TextureKey, TextureLoader, Textures, Ticker, type TickerFunction, TintColors, type Transformable, type TripleArray, UVMapper, type VideoExportOptions, VideoExporter, type WorldChunkSource, WorldStreamer, type WorldStreamerOptions, WrappedImage, addBox3WireframeToObject, addWireframeToMesh, addWireframeToObject, applyElementRotation, applyGenericRotation, axisToVec3, base64decode, base64encode, buildFluidQuads, buildSectionGeometry, capeTextureSizes, captureException, changeEvent, clampRotationDegrees, classicSkinGeometries, classicSkinTextureCoordinates, computeMorphedAttributes, copySectionLight, createCanvas, createFluidGeometry, createGuiTextGeometry, createGuiTextureGeometry, createImage, decodeSceneDocument, encodeSceneDocument, entityAnimationTime, estimateBytesUsed, fluidKindOf, getBlockFluidState, getFluidKind, interleaveAttributes, isAssetKey, isBasicAssetKey, isBlockObject, isDisposable, isDoubleArray, isEntityObject, isFlyControls, isGuiObject, isInstanceManager, isInstanceReference, isInstanceable, isInstancedMesh, isMesh, isMineRenderScene, isModelObject, isObject3D, isOrthographicCamera, isPerspectiveCamera, isQuadArray, isResourceLocation, isSceneObject, isTransformable, isTripleArray, isVector3, layoutGuiText, md5, mergeBufferAttributes, mergeBufferGeometries, mergeVertices, parseSceneDocument, prefix, probeImageSize, registerBrowserEnv, resolveBlockFluidState, resolveLegacyBlock, resolveLegacyBlockState, sampleEntityAnimation, sampleEntityKeyframes, sampleFluid, sampleSectionLight, sectionGeometryTransferables, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode, trimCanvas, yieldToEventLoop };
|
|
4227
|
+
export { AXES, type AnimationFrame, type AnimationMeta, type AnimatorFunction, type AnvilChunk, type AnvilEntityChunk, type AnvilExternalChunkReader, type AnvilParseOptions, AnvilParser, type AnvilRegion, type AnvilRegionReader, AnvilWorldSource, type AnvilWorldSourceOptions, ArchiveAssetSource, type ArchiveAssetSourceOptions, type ArchiveEntry, type ArchiveProxy, AssetKey, AssetLoadError, AssetLoader, AssetParser, AssetSource, type AssetType, Assets, Axis, BUILTIN_ENTITY, BUILTIN_GENERATED, type BannerPattern, type BannerPatternDraw, BannerPatterns, BasicAssetKey, type BasicMinecraftAsset, BatchedExecutor, type BedrockBone, type BedrockCube, type BedrockEntityDescription, type BedrockEntityFile, type BedrockGeometry, type BedrockGeometryFile, type Biome, type BiomeColorKind, Biomes, type BitmapFont, type BitmapGlyph, type Block, BlockEntities, type BlockEntityEntry, type BlockEntityIndex, type BlockEntityPart, type BlockEntityRotation, 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, Colormaps, type CompatCanvas, type CompatImage, type ComposerOptions, type ControlsMode, type ControlsOptions, CubeFace, CubeFaceIndex, DEFAULT_ELEMENTS, DEFAULT_NAMESPACE, DEFAULT_ROOT, DEFAULT_UV, DISPLAY_POSITIONS, DYE_COLORS, type DebugOptions, type DecoratedPotSide, DecoratedPots, type DeepPartial, DefaultBlockStates, DisplayPosition, DisplayTransforms, type Disposable, type DoubleArray, type DyeColor, ENTITY_ANIMATION_CHANNELS, type ElementFace, type ElementRotation, Entities, type EntityAnimation, type EntityAnimationBone, type EntityAnimationChannel, type EntityAnimationFile, type EntityAnimationKeyframe, type EntityAnimationOptions, EntityAnimationPlayer, type EntityAnimationPose, type EntityLayer, type EntityModel, type EntityModelCube, type EntityModelFile, type EntityModelLayer, type EntityModelOptions, type EntityModelPart, type EntityModelPass, EntityObject, type EntityObjectOptions, type EntityRenderMode, type EntityTransformOp, Env, type EnvProvider, type ExtractableImageData, type FluidKind, FluidModelObject, type FluidQuads, type FluidRules, type FluidSample, type FluidSampler, type FlyAction, FlyControls, type FlyControlsEventMap, Fonts, type FrameCallback, type FromTo, GUI_CONTAINER_LAYOUTS, Geometries, type GuiBookButtonState, type GuiBookOptions, type GuiBossBarColor, type GuiBossBarOptions, type GuiContainerType, GuiHelper, type GuiItemLayer, type GuiLayer, GuiLight, GuiObject, type GuiObjectOptions, type GuiRecipe, type GuiRecipeIngredient, type GuiRecipeOptions, type GuiSpriteScaling, type GuiText, type GuiTextLayer, type GuiTextLayout, type GuiTextOptions, type GuiTextRun, type GuiTextStyle, type GuiTextureLayer, type GuiTooltipOptions, HostedAssetSource, type IModelTextures, ITEM_GENERATED, type ImageInfo, ImageLoader, type ImageSizeInfo, InstanceManager, InstanceReference, type Instanceable, ItemDefaults, ItemGlint, type ItemModel, type ItemModelContext, type ItemModelTextures, type ItemTintColor, type ItemTintSource, ItemTints, type ListAsset, LitematicaParser, type LitematicaRegion, type LitematicaStructure, type LoadedSceneDocument, type LoadedSceneObject, MapControls, type MaterialKey, Materials, type Maybe, type MeshKey, Meshes, MineRenderData, type MineRenderDataManifest, type MineRenderDatasets, 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, type PackFormat, PackFormats, PackMetadata, PersistentCache, PlayerHeadTextures, type PositionedGuiGlyph, type QuadArray, type RawImageKey, type RenderOptions, Renderer, type RendererControls, type RendererFrame, type RendererOptions, type RendererSurface, type RequestConfig, RequestError, type RequestResponse, Requests, type ResolvedBlockEntity, type ResolvedMineRenderData, type ResponseParser, SCENE_DOCUMENT_MAX_BYTES, SKIN_PARTS, type SavedLightSample, type SceneBlockDefinition, type SceneDocument, SceneDocumentLoader, type SceneEntityDefinition, SceneExporter, type SceneGLTFExportOptions, type SceneGuiDefinition, type SceneGuiLayer, SceneInspector, type SceneItemContext, type SceneModelDefinition, SceneObject, type SceneObjectDefinition, type SceneObjectDefinitionBase, type SceneObjectOptions, type SceneSkinDefinition, type SceneSkinPosePart, SceneStats, SceneStatsDisplay, SchematicParser, type SchematicParserOptions, type SectionAtlasSize, type SectionFluidInput, type SectionFluidKind, type SectionFluids, type SectionGeometryInput, type SectionGeometryPage, type SectionLightData, SectionMesh, type SectionMeshEntry, type SectionMeshTemplate, SectionModels, type SectionTemplateData, SectionWorker, type Serializable, type SkinGeometries, SkinImage, SkinObject, type SkinObjectOptions, SkinPart, type SkinTexture, type SkinTextureCoordinates, SkinTextures, Skins, type SpecialItemPart, type SpecialItemRenderer, SpecialItems, SpongeSchematicParser, type StructureNBT, StructureParser, type TextureAsset, TextureAtlas, type TextureKey, TextureLoader, Textures, Ticker, type TickerFunction, TintColors, type Transformable, type TripleArray, UVMapper, type VideoExportOptions, VideoExporter, type WorldBlockIntersection, type WorldChunkSource, WorldStreamer, type WorldStreamerOptions, WrappedImage, addBox3WireframeToObject, addWireframeToMesh, addWireframeToObject, applyElementRotation, applyGenericRotation, axisToVec3, base64decode, base64encode, buildFluidQuads, buildSectionGeometry, capeTextureSizes, captureException, changeEvent, clampRotationDegrees, classicSkinGeometries, classicSkinTextureCoordinates, computeMorphedAttributes, copySectionLight, createCanvas, createFluidGeometry, createGuiTextGeometry, createGuiTextureGeometry, createImage, decodeSceneDocument, encodeSceneDocument, entityAnimationTime, estimateBytesUsed, fluidKindOf, getBlockFluidState, getFluidKind, interleaveAttributes, isAssetKey, isBasicAssetKey, isBlockObject, isDisposable, isDoubleArray, isEntityObject, isFlyControls, isGuiObject, isInstanceManager, isInstanceReference, isInstanceable, isInstancedMesh, isMesh, isMineRenderScene, isModelObject, isObject3D, isOrthographicCamera, isPerspectiveCamera, isQuadArray, isResourceLocation, isSceneObject, isTransformable, isTripleArray, isVector3, layoutGuiText, md5, mergeBufferAttributes, mergeBufferGeometries, mergeVertices, parseSceneDocument, prefix, probeImageSize, registerBrowserEnv, resolveBlockFluidState, resolveLegacyBlock, resolveLegacyBlockState, sampleEntityAnimation, sampleEntityKeyframes, sampleFluid, sampleSectionLight, sectionGeometryTransferables, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode, trimCanvas, yieldToEventLoop };
|
package/dist/browser/index.js
CHANGED
|
@@ -12596,6 +12596,10 @@ var _BlockObject = class _BlockObject extends SceneObject {
|
|
|
12596
12596
|
get blockEntities() {
|
|
12597
12597
|
return this._entities;
|
|
12598
12598
|
}
|
|
12599
|
+
/** Model placements drawn for this block, including its fluid surface. */
|
|
12600
|
+
get models() {
|
|
12601
|
+
return this._models;
|
|
12602
|
+
}
|
|
12599
12603
|
/** Sets visibility for this block's model instances and block entities. */
|
|
12600
12604
|
setVisible(visible) {
|
|
12601
12605
|
this.visible = visible;
|
|
@@ -17736,6 +17740,13 @@ var MineRenderWorld = class {
|
|
|
17736
17740
|
if (options.sectionMeshing) this.sectionModels = new SectionModels(options.maxAtlasSize);
|
|
17737
17741
|
if (options.renderEntities) this.entities = new WorldEntities(scene);
|
|
17738
17742
|
}
|
|
17743
|
+
/**
|
|
17744
|
+
* Returns the nearest visible block geometry hit, respecting the raycaster's layers and near/far range.
|
|
17745
|
+
* Includes fluids and block entities; texture alpha does not change triangle intersections.
|
|
17746
|
+
*/
|
|
17747
|
+
raycast(raycaster) {
|
|
17748
|
+
return Chunk.raycast(this._chunks.values(), raycaster);
|
|
17749
|
+
}
|
|
17739
17750
|
/** Whether neighboring opaque cubes shade block-face corners. Defaults to false. */
|
|
17740
17751
|
get ambientOcclusion() {
|
|
17741
17752
|
return this._ambientOcclusion;
|
|
@@ -18410,6 +18421,7 @@ function buildSectionGeometry(input) {
|
|
|
18410
18421
|
const positions = new Float32Array(faces * 12), normals = new Float32Array(faces * 12);
|
|
18411
18422
|
const uvs = new Float32Array(faces * 8), uvBounds = new Float32Array(faces * 16), colors = new Float32Array(faces * 12);
|
|
18412
18423
|
const outputIndices = new Uint32Array(faces * 6);
|
|
18424
|
+
const blockIndices = new Uint16Array(faces);
|
|
18413
18425
|
let vertex = 0, indexOffset = 0;
|
|
18414
18426
|
for (const entry of page.entries) {
|
|
18415
18427
|
const template = templateData[templates[entry]];
|
|
@@ -18424,6 +18436,7 @@ function buildSectionGeometry(input) {
|
|
|
18424
18436
|
const ambientMask = ambientOcclusion && template.ambientOcclusion !== false ? sectionAmbientOcclusionMask(ambientOcclusion, lightIndex) : 0;
|
|
18425
18437
|
for (let quad = 0; quad < template.quads; quad++) {
|
|
18426
18438
|
if (cullMasks[entry] & template.cullFaces[quad]) continue;
|
|
18439
|
+
blockIndices[indexOffset / 6] = indices[entry];
|
|
18427
18440
|
if (ambientMask) quadAmbientOcclusion(template.positions, template.normals, quad, ambientMask, cornerBrightness2);
|
|
18428
18441
|
const brightness = light ? lightBrightness(light[lightIndex + LIGHT_SAMPLE_OFFSETS[quadLightIndex(template.positions, template.normals, quad)]], ambientLight) : 1;
|
|
18429
18442
|
const start = vertex;
|
|
@@ -18456,6 +18469,7 @@ function buildSectionGeometry(input) {
|
|
|
18456
18469
|
const mapV = (v) => 1 - (placement.y + (1 - v) * atlas.height) / page.height;
|
|
18457
18470
|
const lightIndex = (y + 1) * 324 + (z + 1) * 18 + x + 1;
|
|
18458
18471
|
for (let quad = 0; quad < quads.sprites.length; quad++) {
|
|
18472
|
+
blockIndices[indexOffset / 6] = x + z * 16 + y * 256;
|
|
18459
18473
|
const rect = quads.sprites[quad] === 0 ? data.still : data.flow;
|
|
18460
18474
|
const brightness = light ? lightBrightness(fluidLightLevel(
|
|
18461
18475
|
light[lightIndex],
|
|
@@ -18486,11 +18500,11 @@ function buildSectionGeometry(input) {
|
|
|
18486
18500
|
indexOffset += 6;
|
|
18487
18501
|
}
|
|
18488
18502
|
}
|
|
18489
|
-
return { layer: page.layer, width: page.width, height: page.height, placements: page.placements, positions, normals, uvs, uvBounds, colors, indices: outputIndices };
|
|
18503
|
+
return { layer: page.layer, width: page.width, height: page.height, placements: page.placements, positions, normals, uvs, uvBounds, colors, indices: outputIndices, blockIndices };
|
|
18490
18504
|
});
|
|
18491
18505
|
}
|
|
18492
18506
|
function sectionGeometryTransferables(pages) {
|
|
18493
|
-
return pages.flatMap((page) => [page.positions.buffer, page.normals.buffer, page.uvs.buffer, page.uvBounds.buffer, page.colors.buffer, page.indices.buffer]);
|
|
18507
|
+
return pages.flatMap((page) => [page.positions.buffer, page.normals.buffer, page.uvs.buffer, page.uvBounds.buffer, page.colors.buffer, page.indices.buffer, page.blockIndices.buffer]);
|
|
18494
18508
|
}
|
|
18495
18509
|
|
|
18496
18510
|
// src/world/SectionWorker.ts
|
|
@@ -18648,6 +18662,12 @@ var SectionMesh = class _SectionMesh extends import_three43.Group {
|
|
|
18648
18662
|
constructor() {
|
|
18649
18663
|
super(...arguments);
|
|
18650
18664
|
this.ownedMeshes = [];
|
|
18665
|
+
this.blockIndices = /* @__PURE__ */ new Map();
|
|
18666
|
+
}
|
|
18667
|
+
/** Returns the owning section cell for a triangle hit on this mesh's merged geometry. */
|
|
18668
|
+
getBlockIndex(hit) {
|
|
18669
|
+
if (hit.faceIndex === void 0 || hit.faceIndex === null) return void 0;
|
|
18670
|
+
return this.blockIndices.get(hit.object)?.[Math.floor(hit.faceIndex / 2)];
|
|
18651
18671
|
}
|
|
18652
18672
|
/** Builds section-local meshes from visible quads. `maxAtlasSize` limits each atlas dimension in pixels. */
|
|
18653
18673
|
static build(entries, maxAtlasSize = 2048, fluids, lighting) {
|
|
@@ -18690,6 +18710,7 @@ var SectionMesh = class _SectionMesh extends import_three43.Group {
|
|
|
18690
18710
|
const texture = material.uniforms?.map?.value ?? material.map;
|
|
18691
18711
|
const mesh = new import_three43.Mesh(geometry, material);
|
|
18692
18712
|
section.add(mesh);
|
|
18713
|
+
section.blockIndices.set(mesh, page.blockIndices);
|
|
18693
18714
|
const unsubscribe = [];
|
|
18694
18715
|
for (const { atlas: id, x, y } of page.placements) {
|
|
18695
18716
|
const atlas = atlases[id];
|
|
@@ -18715,6 +18736,7 @@ var SectionMesh = class _SectionMesh extends import_three43.Group {
|
|
|
18715
18736
|
mesh.material.dispose();
|
|
18716
18737
|
texture?.dispose();
|
|
18717
18738
|
}
|
|
18739
|
+
this.blockIndices.clear();
|
|
18718
18740
|
this.removeFromParent();
|
|
18719
18741
|
super.dispose();
|
|
18720
18742
|
}
|
|
@@ -18724,6 +18746,8 @@ var SectionMesh = class _SectionMesh extends import_three43.Group {
|
|
|
18724
18746
|
init_FluidGeometry();
|
|
18725
18747
|
init_FluidQuads();
|
|
18726
18748
|
init_CubeFace();
|
|
18749
|
+
init_InstanceReference();
|
|
18750
|
+
init_three();
|
|
18727
18751
|
var WATER_TINT2 = new import_three44.Color(4159204).toArray();
|
|
18728
18752
|
var Chunk = class _Chunk {
|
|
18729
18753
|
constructor(scene, x, y, z, onBlocksChanged, sectionModels, neighborCell, biomeAt, onBiomesChanged, lightAt, onLightCleared, ambientLight = 0) {
|
|
@@ -18737,6 +18761,7 @@ var Chunk = class _Chunk {
|
|
|
18737
18761
|
this.ambientLight = ambientLight;
|
|
18738
18762
|
this.data = new ChunkData();
|
|
18739
18763
|
this.renderedBlocks = /* @__PURE__ */ new Map();
|
|
18764
|
+
this.objectBlocks = /* @__PURE__ */ new Set();
|
|
18740
18765
|
this.sectionBlocks = /* @__PURE__ */ new Map();
|
|
18741
18766
|
this.hiddenBlocks = /* @__PURE__ */ new Set();
|
|
18742
18767
|
this.fluidCells = new Uint8Array(4096);
|
|
@@ -18748,6 +18773,89 @@ var Chunk = class _Chunk {
|
|
|
18748
18773
|
this.y = y;
|
|
18749
18774
|
this.z = z;
|
|
18750
18775
|
}
|
|
18776
|
+
/** Finds the nearest owned block hit across sections, testing each shared mesh once. */
|
|
18777
|
+
static raycast(chunks, raycaster) {
|
|
18778
|
+
const roots = /* @__PURE__ */ new Map();
|
|
18779
|
+
const targets = /* @__PURE__ */ new Map();
|
|
18780
|
+
const meshes = (root, scene) => {
|
|
18781
|
+
const cached2 = roots.get(root);
|
|
18782
|
+
if (cached2) return cached2;
|
|
18783
|
+
const result = [];
|
|
18784
|
+
roots.set(root, result);
|
|
18785
|
+
let attached = false;
|
|
18786
|
+
for (let parent = root; parent; parent = parent.parent) {
|
|
18787
|
+
if (!parent.visible) return result;
|
|
18788
|
+
if (parent === scene) attached = true;
|
|
18789
|
+
}
|
|
18790
|
+
if (!attached) return result;
|
|
18791
|
+
root.updateWorldMatrix(true, true);
|
|
18792
|
+
root.traverseVisible((object4) => {
|
|
18793
|
+
if (isMesh(object4) && raycaster.layers.test(object4.layers)) result.push(object4);
|
|
18794
|
+
});
|
|
18795
|
+
return result;
|
|
18796
|
+
};
|
|
18797
|
+
const add = (root, owner, reference) => {
|
|
18798
|
+
for (const mesh of meshes(root, owner.chunk.scene)) {
|
|
18799
|
+
if (reference && reference.instanceable.getInstanceReference(mesh, reference.index) !== reference) continue;
|
|
18800
|
+
let entry = targets.get(mesh);
|
|
18801
|
+
if (!entry) targets.set(mesh, entry = { owners: /* @__PURE__ */ new Map() });
|
|
18802
|
+
entry.owners.set(reference?.index, owner);
|
|
18803
|
+
}
|
|
18804
|
+
};
|
|
18805
|
+
for (const chunk of chunks) {
|
|
18806
|
+
for (const index of chunk.objectBlocks) {
|
|
18807
|
+
const block = chunk.renderedBlocks.get(index).object;
|
|
18808
|
+
if (!block || !block.visible || chunk.hiddenBlocks.has(index)) continue;
|
|
18809
|
+
const owner = { chunk, index };
|
|
18810
|
+
for (const model of block.models) {
|
|
18811
|
+
if (isInstanceReference(model)) {
|
|
18812
|
+
if (model.instanceable.isInstanceActive(model.index, model)) add(model.instanceable, owner, model);
|
|
18813
|
+
} else {
|
|
18814
|
+
add(model, owner);
|
|
18815
|
+
}
|
|
18816
|
+
}
|
|
18817
|
+
for (const entity of block.blockEntities) add(entity, owner);
|
|
18818
|
+
}
|
|
18819
|
+
if (chunk.sectionMesh) {
|
|
18820
|
+
for (const mesh of meshes(chunk.sectionMesh, chunk.scene)) {
|
|
18821
|
+
targets.set(mesh, { owners: /* @__PURE__ */ new Map(), section: { chunk, mesh: chunk.sectionMesh } });
|
|
18822
|
+
}
|
|
18823
|
+
}
|
|
18824
|
+
}
|
|
18825
|
+
for (const hit of raycaster.intersectObjects([...targets.keys()], false)) {
|
|
18826
|
+
if (!hit.face) continue;
|
|
18827
|
+
const mesh = hit.object;
|
|
18828
|
+
const material = Array.isArray(mesh.material) ? mesh.material[hit.face.materialIndex] : mesh.material;
|
|
18829
|
+
if (!material?.visible) continue;
|
|
18830
|
+
const entry = targets.get(mesh);
|
|
18831
|
+
let owner = entry.owners.get(hit.instanceId) ?? entry.owners.get(void 0);
|
|
18832
|
+
if (entry.section) {
|
|
18833
|
+
const index = entry.section.mesh.getBlockIndex(hit);
|
|
18834
|
+
if (index !== void 0) owner = { chunk: entry.section.chunk, index };
|
|
18835
|
+
}
|
|
18836
|
+
if (!owner || owner.chunk.hiddenBlocks.has(owner.index)) continue;
|
|
18837
|
+
const info = owner.chunk.renderedBlocks.get(owner.index);
|
|
18838
|
+
if (!info) continue;
|
|
18839
|
+
const matrix = mesh.matrixWorld.clone();
|
|
18840
|
+
if (isInstancedMesh(mesh) && hit.instanceId !== void 0) {
|
|
18841
|
+
const instance = new import_three44.Matrix4();
|
|
18842
|
+
mesh.getMatrixAt(hit.instanceId, instance);
|
|
18843
|
+
matrix.multiply(instance);
|
|
18844
|
+
}
|
|
18845
|
+
return {
|
|
18846
|
+
position: new import_three44.Vector3(
|
|
18847
|
+
owner.chunk.x * 16 + owner.index % 16,
|
|
18848
|
+
owner.chunk.y * 16 + Math.floor(owner.index / 256),
|
|
18849
|
+
owner.chunk.z * 16 + Math.floor(owner.index / 16) % 16
|
|
18850
|
+
),
|
|
18851
|
+
block: info.block,
|
|
18852
|
+
point: hit.point.clone(),
|
|
18853
|
+
normal: hit.face.normal.clone().applyNormalMatrix(new import_three44.Matrix3().getNormalMatrix(matrix)),
|
|
18854
|
+
distance: hit.distance
|
|
18855
|
+
};
|
|
18856
|
+
}
|
|
18857
|
+
return void 0;
|
|
18858
|
+
}
|
|
18751
18859
|
getBlockAt(posOrX, y, z) {
|
|
18752
18860
|
if (typeof posOrX == "number") {
|
|
18753
18861
|
return this.getBlockAt(new import_three44.Vector3(posOrX, y, z));
|
|
@@ -18868,6 +18976,7 @@ var Chunk = class _Chunk {
|
|
|
18868
18976
|
if (this.fluidCells[index]) this.meshDirty = true;
|
|
18869
18977
|
this.fluidCells[index] = 0;
|
|
18870
18978
|
this.renderedBlocks.delete(index);
|
|
18979
|
+
this.objectBlocks.delete(index);
|
|
18871
18980
|
const worldPos = new import_three44.Vector3(
|
|
18872
18981
|
this.x * 16 + index % 16,
|
|
18873
18982
|
this.y * 16 + Math.floor(index / 256),
|
|
@@ -18910,6 +19019,7 @@ var Chunk = class _Chunk {
|
|
|
18910
19019
|
this.renderedBlocks.set(index, { get block() {
|
|
18911
19020
|
return readBlock();
|
|
18912
19021
|
}, object: object4 });
|
|
19022
|
+
if (object4) this.objectBlocks.add(index);
|
|
18913
19023
|
} catch (error) {
|
|
18914
19024
|
this.data.assign(index, 0);
|
|
18915
19025
|
this.fluidCells[index] = 0;
|
|
@@ -18928,6 +19038,7 @@ var Chunk = class _Chunk {
|
|
|
18928
19038
|
this.fluidCells.fill(0);
|
|
18929
19039
|
this.waterTints = void 0;
|
|
18930
19040
|
this.renderedBlocks.clear();
|
|
19041
|
+
this.objectBlocks.clear();
|
|
18931
19042
|
this.hiddenBlocks.clear();
|
|
18932
19043
|
this.meshDirty = true;
|
|
18933
19044
|
this.data.copyFrom(data);
|
|
@@ -18977,6 +19088,7 @@ var Chunk = class _Chunk {
|
|
|
18977
19088
|
this.renderedBlocks.set(index, { get block() {
|
|
18978
19089
|
return readBlock();
|
|
18979
19090
|
}, object: void 0 });
|
|
19091
|
+
this.objectBlocks.delete(index);
|
|
18980
19092
|
} catch (error) {
|
|
18981
19093
|
this.data.assign(index, 0);
|
|
18982
19094
|
this.fluidCells[index] = 0;
|
|
@@ -19002,10 +19114,12 @@ var Chunk = class _Chunk {
|
|
|
19002
19114
|
this.z * 256 + Math.floor(index / 16) % 16 * 16
|
|
19003
19115
|
));
|
|
19004
19116
|
this.renderedBlocks.get(index).object = object4;
|
|
19117
|
+
this.objectBlocks.add(index);
|
|
19005
19118
|
} catch (error) {
|
|
19006
19119
|
this.data.assign(index, 0);
|
|
19007
19120
|
this.fluidCells[index] = 0;
|
|
19008
19121
|
this.renderedBlocks.delete(index);
|
|
19122
|
+
this.objectBlocks.delete(index);
|
|
19009
19123
|
object4?.removeFromScene();
|
|
19010
19124
|
if (!failed) failure = error;
|
|
19011
19125
|
failed = true;
|
|
@@ -19266,6 +19380,7 @@ var Chunk = class _Chunk {
|
|
|
19266
19380
|
this.sectionMesh = void 0;
|
|
19267
19381
|
this.meshDirty = false;
|
|
19268
19382
|
this.renderedBlocks.clear();
|
|
19383
|
+
this.objectBlocks.clear();
|
|
19269
19384
|
this.hiddenBlocks.clear();
|
|
19270
19385
|
this.fluidCells.fill(0);
|
|
19271
19386
|
this.waterTints = void 0;
|