minerender 2.1.0-alpha.128 → 2.1.0-alpha.129

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.
@@ -2649,6 +2649,9 @@ interface BedrockGeometryFile {
2649
2649
 
2650
2650
  /** Shared in-memory caches for loaded assets and render resources. Persistent stores are managed separately. */
2651
2651
  declare class Caching {
2652
+ private static _generation;
2653
+ /** Changes when shared assets are cleared, so derived caches can discard their old values. */
2654
+ static get generation(): number;
2652
2655
  static readonly rawImageCache: AsyncLoadingCache<CacheKey, ImageInfo>;
2653
2656
  static readonly imageDataCache: AsyncLoadingCache<CacheKey, ImageData>;
2654
2657
  static readonly canvasImageDataCache: AsyncLoadingCache<CacheKey, ExtractableImageData>;
@@ -3786,6 +3789,7 @@ interface SectionTemplateData {
3786
3789
  colors: Float32Array;
3787
3790
  indices: Uint16Array;
3788
3791
  cullFaces: Uint8Array;
3792
+ biomeTint?: Uint8Array;
3789
3793
  atlas: number;
3790
3794
  layer: number;
3791
3795
  ambientOcclusion?: boolean;
@@ -3818,6 +3822,8 @@ interface SectionGeometryInput {
3818
3822
  indices: Uint16Array;
3819
3823
  templates: Uint16Array;
3820
3824
  cullMasks: Uint8Array;
3825
+ /** Linear RGB per placement; three NaN values preserve the template's colors. */
3826
+ biomeTints?: Float32Array;
3821
3827
  templateData: SectionTemplateData[];
3822
3828
  atlases: SectionAtlasSize[];
3823
3829
  maxAtlasSize: number;
@@ -3858,6 +3864,8 @@ interface SectionMeshTemplate {
3858
3864
  geometry: BufferGeometry;
3859
3865
  atlas: TextureAtlas;
3860
3866
  cullFaces: Uint8Array;
3867
+ /** Quads that accept a placement's biome tint, stored as zero or one. */
3868
+ biomeTint?: Uint8Array;
3861
3869
  occludes: boolean;
3862
3870
  /** Whether the model permits corner shading from neighboring full cubes. */
3863
3871
  ambientOcclusion?: boolean;
@@ -3868,6 +3876,8 @@ interface SectionMeshEntry {
3868
3876
  index: number;
3869
3877
  template: SectionMeshTemplate;
3870
3878
  cullMask: number;
3879
+ /** Linear RGB replacing automatic biome colors on eligible quads. */
3880
+ biomeTint?: readonly [number, number, number];
3871
3881
  }
3872
3882
  /** Fluid cells for one section and the shared atlases of the kinds present. */
3873
3883
  interface SectionFluids {
@@ -3901,9 +3911,10 @@ declare class SectionModels {
3901
3911
  constructor(maxAtlasSize?: number);
3902
3912
  /** Returns templates for the matched parts, or `undefined` when the block needs an individual render object. */
3903
3913
  get(blockState: BlockState, properties?: BlockStateProperties, position?: Readonly<TripleArray>, biome?: string): Promise<SectionMeshTemplate[] | undefined>;
3904
- /** Resolves section templates for one tint palette, with a synchronous weighted choice for each cell. */
3905
- prepareState(blockState: BlockState, properties?: BlockStateProperties, biomeColor?: number | (() => Promise<number | undefined>)): Promise<{
3914
+ /** Resolves shared templates; dynamic biome tints are supplied on section placements instead of cached geometry. */
3915
+ prepareState(blockState: BlockState, properties?: BlockStateProperties, biomeColor?: number | (() => Promise<number | undefined>), dynamicBiomeTint?: boolean): Promise<{
3906
3916
  pick(position?: Readonly<TripleArray>): SectionMeshTemplate[];
3917
+ biomeTint?: boolean;
3907
3918
  } | undefined>;
3908
3919
  private state;
3909
3920
  /** Returns the shared still/flow atlas used by per-block fluid objects. */
@@ -3914,6 +3925,20 @@ declare class SectionModels {
3914
3925
  clear(): void;
3915
3926
  }
3916
3927
 
3928
+ /** Caches horizontal color averages for saved quart-resolution biome samples. */
3929
+ declare class BiomeBlend {
3930
+ private readonly biomeAt;
3931
+ private readonly tiles;
3932
+ private generation;
3933
+ private _radius;
3934
+ constructor(biomeAt: (x: number, y: number, z: number) => string | undefined, radius: number);
3935
+ get radius(): number;
3936
+ clear(): void;
3937
+ invalidateColumn(x: number, z: number): void;
3938
+ getColor(kind: BiomeColorKind, origin: AssetKey | undefined, position: Readonly<TripleArray>): Promise<number | undefined>;
3939
+ private buildTile;
3940
+ }
3941
+
3917
3942
  /** The nearest rendered block triangle hit by a world raycast. */
3918
3943
  interface WorldBlockIntersection {
3919
3944
  /** Integer world block coordinates of the geometry's owner. */
@@ -3944,6 +3969,7 @@ declare class Chunk<SectionMeshing extends boolean = false> {
3944
3969
  private readonly lightAt?;
3945
3970
  private readonly onLightCleared?;
3946
3971
  private readonly ambientLight;
3972
+ private readonly biomeBlend?;
3947
3973
  readonly scene: MineRenderScene;
3948
3974
  readonly x: number;
3949
3975
  readonly y: number;
@@ -3961,7 +3987,9 @@ declare class Chunk<SectionMeshing extends boolean = false> {
3961
3987
  private meshDirty;
3962
3988
  private meshGeneration;
3963
3989
  private ambientOcclusionCells?;
3964
- 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);
3990
+ private readonly blockChanges;
3991
+ private biomeChange?;
3992
+ 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, biomeBlend?: (() => BiomeBlend | undefined) | undefined);
3965
3993
  /** Finds the nearest owned block hit across sections, testing each shared mesh once. */
3966
3994
  static raycast<SectionMeshing extends boolean>(chunks: Iterable<Chunk<SectionMeshing>>, raycaster: Raycaster): WorldBlockIntersection | undefined;
3967
3995
  getBlockAt(x: number, y: number, z: number): Maybe<BlockInfo<SectionMeshing>>;
@@ -3974,7 +4002,11 @@ declare class Chunk<SectionMeshing extends boolean = false> {
3974
4002
  /** Copies 64 biome IDs in x + z * 4 + y * 16 order and refreshes placed blocks. Omit the array to clear biome data. */
3975
4003
  setBiomes(biomes?: readonly string[]): Promise<void>;
3976
4004
  /** Rebuilds biome-tinted blocks while preserving hidden blocks and unrelated render objects. */
3977
- refreshBiomes(): Promise<void>;
4005
+ refreshBiomes(columns?: readonly {
4006
+ x: number;
4007
+ z: number;
4008
+ }[]): Promise<void>;
4009
+ private refreshBiomeBlocks;
3978
4010
  /**
3979
4011
  * Places a block at integer world block coordinates. Pass `undefined` to remove it.
3980
4012
  */
@@ -3990,8 +4022,11 @@ declare class Chunk<SectionMeshing extends boolean = false> {
3990
4022
  index: number;
3991
4023
  block: Maybe<Block>;
3992
4024
  }[]): Promise<Vector3[]>;
4025
+ private changeBlocks;
4026
+ private replaceBlocks;
3993
4027
  /** Replaces every cell from parsed section data. The caller refreshes neighbor culling. */
3994
4028
  placeSection(data: ChunkData): Promise<void>;
4029
+ private replaceSection;
3995
4030
  private positionAt;
3996
4031
  /** Refreshes saved lighting after adjacent columns load or unload, including columns with only light data. */
3997
4032
  refreshLight(indices?: Iterable<number>): Promise<void>;
@@ -4003,6 +4038,7 @@ declare class Chunk<SectionMeshing extends boolean = false> {
4003
4038
  private setWaterTint;
4004
4039
  /** Changes visibility at world block coordinates while preserving the block's data. */
4005
4040
  setBlockVisibleAt(pos: Vector3, visible: boolean): Promise<void>;
4041
+ private setBlockVisibility;
4006
4042
  isBlockVisibleAt(pos: Vector3): boolean;
4007
4043
  /** Reports whether a cell has a visible render object or section entry. */
4008
4044
  isBlockVisibleIndex(index: number): boolean;
@@ -4067,6 +4103,10 @@ declare class MineRenderWorld<SectionMeshing extends boolean = false> {
4067
4103
  private readonly ambientLight;
4068
4104
  private _ambientOcclusion;
4069
4105
  private ambientOcclusionPending;
4106
+ private _biomeBlendRadius;
4107
+ private biomeBlend?;
4108
+ private readonly pendingBiomes;
4109
+ private biomeRefreshing?;
4070
4110
  private readonly sectionModels?;
4071
4111
  private readonly entities?;
4072
4112
  private readonly pendingCulling;
@@ -4087,6 +4127,12 @@ declare class MineRenderWorld<SectionMeshing extends boolean = false> {
4087
4127
  get ambientOcclusion(): boolean;
4088
4128
  /** Rebuilds loaded blocks with or without corner shading. Block data and saved lighting are preserved. */
4089
4129
  setAmbientOcclusion(enabled: boolean): Promise<void>;
4130
+ /** Horizontal biome-color sampling radius, from 0 to 7 blocks. Zero disables blending. */
4131
+ get biomeBlendRadius(): number;
4132
+ /** Refreshes loaded grass, foliage, and water colors without reloading their source chunks. */
4133
+ setBiomeBlendRadius(radius: number): Promise<void>;
4134
+ private markBiomesChanged;
4135
+ private refreshBiomes;
4090
4136
  /** Returns a placed block at world block coordinates, or `undefined` for an empty position. */
4091
4137
  getBlockAt(x: number, y: number, z: number): Maybe<BlockInfo<SectionMeshing>>;
4092
4138
  getBlockAt(pos: Vector3): Maybe<BlockInfo<SectionMeshing>>;
@@ -4162,6 +4208,8 @@ interface MineRenderWorldOptions<SectionMeshing extends boolean = boolean> {
4162
4208
  ambientLight?: number;
4163
4209
  /** Bake corner shading from neighboring opaque full cubes. Defaults to false; no per-frame shading pass is added. Requires `sectionMeshing`. */
4164
4210
  ambientOcclusion?: boolean;
4211
+ /** Average neighboring biome colors within this horizontal radius, from 0 to 7 blocks. Defaults to 0 (off). Requires `sectionMeshing`. */
4212
+ biomeBlendRadius?: number;
4165
4213
  /** Maximum width and height of each section atlas page, in pixels. */
4166
4214
  maxAtlasSize?: number;
4167
4215
  }
@@ -2649,6 +2649,9 @@ interface BedrockGeometryFile {
2649
2649
 
2650
2650
  /** Shared in-memory caches for loaded assets and render resources. Persistent stores are managed separately. */
2651
2651
  declare class Caching {
2652
+ private static _generation;
2653
+ /** Changes when shared assets are cleared, so derived caches can discard their old values. */
2654
+ static get generation(): number;
2652
2655
  static readonly rawImageCache: AsyncLoadingCache<CacheKey, ImageInfo>;
2653
2656
  static readonly imageDataCache: AsyncLoadingCache<CacheKey, ImageData>;
2654
2657
  static readonly canvasImageDataCache: AsyncLoadingCache<CacheKey, ExtractableImageData>;
@@ -3786,6 +3789,7 @@ interface SectionTemplateData {
3786
3789
  colors: Float32Array;
3787
3790
  indices: Uint16Array;
3788
3791
  cullFaces: Uint8Array;
3792
+ biomeTint?: Uint8Array;
3789
3793
  atlas: number;
3790
3794
  layer: number;
3791
3795
  ambientOcclusion?: boolean;
@@ -3818,6 +3822,8 @@ interface SectionGeometryInput {
3818
3822
  indices: Uint16Array;
3819
3823
  templates: Uint16Array;
3820
3824
  cullMasks: Uint8Array;
3825
+ /** Linear RGB per placement; three NaN values preserve the template's colors. */
3826
+ biomeTints?: Float32Array;
3821
3827
  templateData: SectionTemplateData[];
3822
3828
  atlases: SectionAtlasSize[];
3823
3829
  maxAtlasSize: number;
@@ -3858,6 +3864,8 @@ interface SectionMeshTemplate {
3858
3864
  geometry: BufferGeometry;
3859
3865
  atlas: TextureAtlas;
3860
3866
  cullFaces: Uint8Array;
3867
+ /** Quads that accept a placement's biome tint, stored as zero or one. */
3868
+ biomeTint?: Uint8Array;
3861
3869
  occludes: boolean;
3862
3870
  /** Whether the model permits corner shading from neighboring full cubes. */
3863
3871
  ambientOcclusion?: boolean;
@@ -3868,6 +3876,8 @@ interface SectionMeshEntry {
3868
3876
  index: number;
3869
3877
  template: SectionMeshTemplate;
3870
3878
  cullMask: number;
3879
+ /** Linear RGB replacing automatic biome colors on eligible quads. */
3880
+ biomeTint?: readonly [number, number, number];
3871
3881
  }
3872
3882
  /** Fluid cells for one section and the shared atlases of the kinds present. */
3873
3883
  interface SectionFluids {
@@ -3901,9 +3911,10 @@ declare class SectionModels {
3901
3911
  constructor(maxAtlasSize?: number);
3902
3912
  /** Returns templates for the matched parts, or `undefined` when the block needs an individual render object. */
3903
3913
  get(blockState: BlockState, properties?: BlockStateProperties, position?: Readonly<TripleArray>, biome?: string): Promise<SectionMeshTemplate[] | undefined>;
3904
- /** Resolves section templates for one tint palette, with a synchronous weighted choice for each cell. */
3905
- prepareState(blockState: BlockState, properties?: BlockStateProperties, biomeColor?: number | (() => Promise<number | undefined>)): Promise<{
3914
+ /** Resolves shared templates; dynamic biome tints are supplied on section placements instead of cached geometry. */
3915
+ prepareState(blockState: BlockState, properties?: BlockStateProperties, biomeColor?: number | (() => Promise<number | undefined>), dynamicBiomeTint?: boolean): Promise<{
3906
3916
  pick(position?: Readonly<TripleArray>): SectionMeshTemplate[];
3917
+ biomeTint?: boolean;
3907
3918
  } | undefined>;
3908
3919
  private state;
3909
3920
  /** Returns the shared still/flow atlas used by per-block fluid objects. */
@@ -3914,6 +3925,20 @@ declare class SectionModels {
3914
3925
  clear(): void;
3915
3926
  }
3916
3927
 
3928
+ /** Caches horizontal color averages for saved quart-resolution biome samples. */
3929
+ declare class BiomeBlend {
3930
+ private readonly biomeAt;
3931
+ private readonly tiles;
3932
+ private generation;
3933
+ private _radius;
3934
+ constructor(biomeAt: (x: number, y: number, z: number) => string | undefined, radius: number);
3935
+ get radius(): number;
3936
+ clear(): void;
3937
+ invalidateColumn(x: number, z: number): void;
3938
+ getColor(kind: BiomeColorKind, origin: AssetKey | undefined, position: Readonly<TripleArray>): Promise<number | undefined>;
3939
+ private buildTile;
3940
+ }
3941
+
3917
3942
  /** The nearest rendered block triangle hit by a world raycast. */
3918
3943
  interface WorldBlockIntersection {
3919
3944
  /** Integer world block coordinates of the geometry's owner. */
@@ -3944,6 +3969,7 @@ declare class Chunk<SectionMeshing extends boolean = false> {
3944
3969
  private readonly lightAt?;
3945
3970
  private readonly onLightCleared?;
3946
3971
  private readonly ambientLight;
3972
+ private readonly biomeBlend?;
3947
3973
  readonly scene: MineRenderScene;
3948
3974
  readonly x: number;
3949
3975
  readonly y: number;
@@ -3961,7 +3987,9 @@ declare class Chunk<SectionMeshing extends boolean = false> {
3961
3987
  private meshDirty;
3962
3988
  private meshGeneration;
3963
3989
  private ambientOcclusionCells?;
3964
- 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);
3990
+ private readonly blockChanges;
3991
+ private biomeChange?;
3992
+ 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, biomeBlend?: (() => BiomeBlend | undefined) | undefined);
3965
3993
  /** Finds the nearest owned block hit across sections, testing each shared mesh once. */
3966
3994
  static raycast<SectionMeshing extends boolean>(chunks: Iterable<Chunk<SectionMeshing>>, raycaster: Raycaster): WorldBlockIntersection | undefined;
3967
3995
  getBlockAt(x: number, y: number, z: number): Maybe<BlockInfo<SectionMeshing>>;
@@ -3974,7 +4002,11 @@ declare class Chunk<SectionMeshing extends boolean = false> {
3974
4002
  /** Copies 64 biome IDs in x + z * 4 + y * 16 order and refreshes placed blocks. Omit the array to clear biome data. */
3975
4003
  setBiomes(biomes?: readonly string[]): Promise<void>;
3976
4004
  /** Rebuilds biome-tinted blocks while preserving hidden blocks and unrelated render objects. */
3977
- refreshBiomes(): Promise<void>;
4005
+ refreshBiomes(columns?: readonly {
4006
+ x: number;
4007
+ z: number;
4008
+ }[]): Promise<void>;
4009
+ private refreshBiomeBlocks;
3978
4010
  /**
3979
4011
  * Places a block at integer world block coordinates. Pass `undefined` to remove it.
3980
4012
  */
@@ -3990,8 +4022,11 @@ declare class Chunk<SectionMeshing extends boolean = false> {
3990
4022
  index: number;
3991
4023
  block: Maybe<Block>;
3992
4024
  }[]): Promise<Vector3[]>;
4025
+ private changeBlocks;
4026
+ private replaceBlocks;
3993
4027
  /** Replaces every cell from parsed section data. The caller refreshes neighbor culling. */
3994
4028
  placeSection(data: ChunkData): Promise<void>;
4029
+ private replaceSection;
3995
4030
  private positionAt;
3996
4031
  /** Refreshes saved lighting after adjacent columns load or unload, including columns with only light data. */
3997
4032
  refreshLight(indices?: Iterable<number>): Promise<void>;
@@ -4003,6 +4038,7 @@ declare class Chunk<SectionMeshing extends boolean = false> {
4003
4038
  private setWaterTint;
4004
4039
  /** Changes visibility at world block coordinates while preserving the block's data. */
4005
4040
  setBlockVisibleAt(pos: Vector3, visible: boolean): Promise<void>;
4041
+ private setBlockVisibility;
4006
4042
  isBlockVisibleAt(pos: Vector3): boolean;
4007
4043
  /** Reports whether a cell has a visible render object or section entry. */
4008
4044
  isBlockVisibleIndex(index: number): boolean;
@@ -4067,6 +4103,10 @@ declare class MineRenderWorld<SectionMeshing extends boolean = false> {
4067
4103
  private readonly ambientLight;
4068
4104
  private _ambientOcclusion;
4069
4105
  private ambientOcclusionPending;
4106
+ private _biomeBlendRadius;
4107
+ private biomeBlend?;
4108
+ private readonly pendingBiomes;
4109
+ private biomeRefreshing?;
4070
4110
  private readonly sectionModels?;
4071
4111
  private readonly entities?;
4072
4112
  private readonly pendingCulling;
@@ -4087,6 +4127,12 @@ declare class MineRenderWorld<SectionMeshing extends boolean = false> {
4087
4127
  get ambientOcclusion(): boolean;
4088
4128
  /** Rebuilds loaded blocks with or without corner shading. Block data and saved lighting are preserved. */
4089
4129
  setAmbientOcclusion(enabled: boolean): Promise<void>;
4130
+ /** Horizontal biome-color sampling radius, from 0 to 7 blocks. Zero disables blending. */
4131
+ get biomeBlendRadius(): number;
4132
+ /** Refreshes loaded grass, foliage, and water colors without reloading their source chunks. */
4133
+ setBiomeBlendRadius(radius: number): Promise<void>;
4134
+ private markBiomesChanged;
4135
+ private refreshBiomes;
4090
4136
  /** Returns a placed block at world block coordinates, or `undefined` for an empty position. */
4091
4137
  getBlockAt(x: number, y: number, z: number): Maybe<BlockInfo<SectionMeshing>>;
4092
4138
  getBlockAt(pos: Vector3): Maybe<BlockInfo<SectionMeshing>>;
@@ -4162,6 +4208,8 @@ interface MineRenderWorldOptions<SectionMeshing extends boolean = boolean> {
4162
4208
  ambientLight?: number;
4163
4209
  /** Bake corner shading from neighboring opaque full cubes. Defaults to false; no per-frame shading pass is added. Requires `sectionMeshing`. */
4164
4210
  ambientOcclusion?: boolean;
4211
+ /** Average neighboring biome colors within this horizontal radius, from 0 to 7 blocks. Defaults to 0 (off). Requires `sectionMeshing`. */
4212
+ biomeBlendRadius?: number;
4165
4213
  /** Maximum width and height of each section atlas page, in pixels. */
4166
4214
  maxAtlasSize?: number;
4167
4215
  }