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.
@@ -889,7 +889,12 @@ var init_Materials = __esm({
889
889
  const vertShader = `
890
890
  uniform bool SHADE;
891
891
 
892
+ // Keep MSAA edge pixels from sampling outside the face's atlas region.
893
+ #if __VERSION__ >= 300
894
+ centroid out vec2 vUv;
895
+ #else
892
896
  varying vec2 vUv;
897
+ #endif
893
898
  varying vec3 vTint;
894
899
  varying float light;
895
900
  varying float lift;
@@ -946,7 +951,11 @@ var init_Materials = __esm({
946
951
  uniform bool EMISSIVE;
947
952
  uniform float BRIGHTNESS;
948
953
 
954
+ #if __VERSION__ >= 300
955
+ centroid in vec2 vUv;
956
+ #else
949
957
  varying vec2 vUv;
958
+ #endif
950
959
  varying vec3 vTint;
951
960
  varying float light;
952
961
  varying float lift;
@@ -4220,11 +4229,35 @@ var init_ModelObject = __esm({
4220
4229
  }
4221
4230
  });
4222
4231
 
4232
+ // src/model/fluid/fluidBlocks.json
4233
+ var fluidBlocks_default;
4234
+ var init_fluidBlocks = __esm({
4235
+ "src/model/fluid/fluidBlocks.json"() {
4236
+ fluidBlocks_default = {
4237
+ "minecraft:water": { kind: "water", levelProperty: "level", renderModel: false },
4238
+ "minecraft:lava": { kind: "lava", levelProperty: "level", renderModel: false },
4239
+ "minecraft:kelp": { kind: "water", renderModel: true },
4240
+ "minecraft:kelp_plant": { kind: "water", renderModel: true },
4241
+ "minecraft:seagrass": { kind: "water", renderModel: true },
4242
+ "minecraft:tall_seagrass": { kind: "water", renderModel: true },
4243
+ "minecraft:bubble_column": { kind: "water", renderModel: false }
4244
+ };
4245
+ }
4246
+ });
4247
+
4223
4248
  // src/model/fluid/FluidGeometry.ts
4224
4249
  import { BufferGeometry as BufferGeometry2, Float32BufferAttribute as Float32BufferAttribute4 } from "three";
4250
+ function getBlockFluidState(key, state) {
4251
+ const rule = key && fluidRules[key.toNamespacedString()];
4252
+ if (rule) return {
4253
+ kind: rule.kind,
4254
+ level: rule.levelProperty ? Number(state?.[rule.levelProperty] ?? 0) : 0,
4255
+ renderModel: rule.renderModel
4256
+ };
4257
+ return state?.waterlogged === "true" ? { kind: "water", level: 0, renderModel: true } : void 0;
4258
+ }
4225
4259
  function getFluidKind(key, state) {
4226
- if (key?.namespace === "minecraft" && !key.type && (key.path === "water" || key.path === "lava")) return key.path;
4227
- return state?.waterlogged === "true" ? "water" : void 0;
4260
+ return getBlockFluidState(key, state)?.kind;
4228
4261
  }
4229
4262
  function ownHeight(sample) {
4230
4263
  const level = sample.level ?? 0;
@@ -4336,9 +4369,11 @@ function createFluidGeometry(kind, sample) {
4336
4369
  geometry.setIndex(indices);
4337
4370
  return geometry;
4338
4371
  }
4339
- var HORIZONTAL, EPSILON;
4372
+ var fluidRules, HORIZONTAL, EPSILON;
4340
4373
  var init_FluidGeometry = __esm({
4341
4374
  "src/model/fluid/FluidGeometry.ts"() {
4375
+ init_fluidBlocks();
4376
+ fluidRules = fluidBlocks_default;
4342
4377
  HORIZONTAL = [[0, -1], [0, 1], [-1, 0], [1, 0]];
4343
4378
  EPSILON = 1e-3;
4344
4379
  }
@@ -5637,7 +5672,7 @@ var BlockObject = class _BlockObject extends SceneObject {
5637
5672
  return getFluidKind(this.blockState.key, this.state);
5638
5673
  }
5639
5674
  get fluidLevel() {
5640
- return getFluidKind(this.blockState.key) ? Number(this.state.level ?? 0) : 0;
5675
+ return getBlockFluidState(this.blockState.key, this.state)?.level ?? 0;
5641
5676
  }
5642
5677
  /** Refreshes fluid surfaces from relative neighbors; standalone previews use air around the block. */
5643
5678
  async updateFluid(sample) {
@@ -5679,7 +5714,7 @@ var BlockObject = class _BlockObject extends SceneObject {
5679
5714
  }
5680
5715
  async recreateModels() {
5681
5716
  this.clearModels();
5682
- if (getFluidKind(this.blockState.key)) {
5717
+ if (getBlockFluidState(this.blockState.key, this.state)?.renderModel === false) {
5683
5718
  await this.updateFluid(this._fluidSampler);
5684
5719
  return;
5685
5720
  }
@@ -10951,6 +10986,7 @@ export {
10951
10986
  createFluidGeometry,
10952
10987
  createImage,
10953
10988
  estimateBytesUsed,
10989
+ getBlockFluidState,
10954
10990
  getFluidKind,
10955
10991
  interleaveAttributes,
10956
10992
  isAssetKey,