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