minerender 2.1.0-alpha.45 → 2.1.0-alpha.47

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.
@@ -842,7 +842,12 @@ var init_Materials = __esm({
842
842
  const vertShader = `
843
843
  uniform bool SHADE;
844
844
 
845
+ // Keep MSAA edge pixels from sampling outside the face's atlas region.
846
+ #if __VERSION__ >= 300
847
+ centroid out vec2 vUv;
848
+ #else
845
849
  varying vec2 vUv;
850
+ #endif
846
851
  varying vec3 vTint;
847
852
  varying float light;
848
853
  varying float lift;
@@ -899,7 +904,11 @@ var init_Materials = __esm({
899
904
  uniform bool EMISSIVE;
900
905
  uniform float BRIGHTNESS;
901
906
 
907
+ #if __VERSION__ >= 300
908
+ centroid in vec2 vUv;
909
+ #else
902
910
  varying vec2 vUv;
911
+ #endif
903
912
  varying vec3 vTint;
904
913
  varying float light;
905
914
  varying float lift;
@@ -4136,11 +4145,35 @@ var init_ModelObject = __esm({
4136
4145
  }
4137
4146
  });
4138
4147
 
4148
+ // src/model/fluid/fluidBlocks.json
4149
+ var fluidBlocks_default;
4150
+ var init_fluidBlocks = __esm({
4151
+ "src/model/fluid/fluidBlocks.json"() {
4152
+ fluidBlocks_default = {
4153
+ "minecraft:water": { kind: "water", levelProperty: "level", renderModel: false },
4154
+ "minecraft:lava": { kind: "lava", levelProperty: "level", renderModel: false },
4155
+ "minecraft:kelp": { kind: "water", renderModel: true },
4156
+ "minecraft:kelp_plant": { kind: "water", renderModel: true },
4157
+ "minecraft:seagrass": { kind: "water", renderModel: true },
4158
+ "minecraft:tall_seagrass": { kind: "water", renderModel: true },
4159
+ "minecraft:bubble_column": { kind: "water", renderModel: false }
4160
+ };
4161
+ }
4162
+ });
4163
+
4139
4164
  // src/model/fluid/FluidGeometry.ts
4140
4165
  import { BufferGeometry as BufferGeometry2, Float32BufferAttribute as Float32BufferAttribute4 } from "three";
4166
+ function getBlockFluidState(key, state) {
4167
+ const rule = key && fluidRules[key.toNamespacedString()];
4168
+ if (rule) return {
4169
+ kind: rule.kind,
4170
+ level: rule.levelProperty ? Number(state?.[rule.levelProperty] ?? 0) : 0,
4171
+ renderModel: rule.renderModel
4172
+ };
4173
+ return state?.waterlogged === "true" ? { kind: "water", level: 0, renderModel: true } : void 0;
4174
+ }
4141
4175
  function getFluidKind(key, state) {
4142
- if (key?.namespace === "minecraft" && !key.type && (key.path === "water" || key.path === "lava")) return key.path;
4143
- return state?.waterlogged === "true" ? "water" : void 0;
4176
+ return getBlockFluidState(key, state)?.kind;
4144
4177
  }
4145
4178
  function ownHeight(sample) {
4146
4179
  const level = sample.level ?? 0;
@@ -4252,9 +4285,11 @@ function createFluidGeometry(kind, sample) {
4252
4285
  geometry.setIndex(indices);
4253
4286
  return geometry;
4254
4287
  }
4255
- var HORIZONTAL, EPSILON;
4288
+ var fluidRules, HORIZONTAL, EPSILON;
4256
4289
  var init_FluidGeometry = __esm({
4257
4290
  "src/model/fluid/FluidGeometry.ts"() {
4291
+ init_fluidBlocks();
4292
+ fluidRules = fluidBlocks_default;
4258
4293
  HORIZONTAL = [[0, -1], [0, 1], [-1, 0], [1, 0]];
4259
4294
  EPSILON = 1e-3;
4260
4295
  }
@@ -5585,7 +5620,7 @@ var _BlockObject = class _BlockObject extends SceneObject {
5585
5620
  return getFluidKind(this.blockState.key, this.state);
5586
5621
  }
5587
5622
  get fluidLevel() {
5588
- return getFluidKind(this.blockState.key) ? Number(this.state.level ?? 0) : 0;
5623
+ return getBlockFluidState(this.blockState.key, this.state)?.level ?? 0;
5589
5624
  }
5590
5625
  /** Refreshes fluid surfaces from relative neighbors; standalone previews use air around the block. */
5591
5626
  async updateFluid(sample) {
@@ -5627,7 +5662,7 @@ var _BlockObject = class _BlockObject extends SceneObject {
5627
5662
  }
5628
5663
  async recreateModels() {
5629
5664
  this.clearModels();
5630
- if (getFluidKind(this.blockState.key)) {
5665
+ if (getBlockFluidState(this.blockState.key, this.state)?.renderModel === false) {
5631
5666
  await this.updateFluid(this._fluidSampler);
5632
5667
  return;
5633
5668
  }
@@ -10901,6 +10936,7 @@ export {
10901
10936
  createFluidGeometry,
10902
10937
  createImage,
10903
10938
  estimateBytesUsed,
10939
+ getBlockFluidState,
10904
10940
  getFluidKind,
10905
10941
  interleaveAttributes,
10906
10942
  isAssetKey,