minerender 2.1.0-alpha.64 → 2.1.0-alpha.66

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/bundle.js CHANGED
@@ -33207,8 +33207,15 @@ var MineRender = (() => {
33207
33207
  material.blending = CustomBlending;
33208
33208
  material.blendSrc = OneFactor;
33209
33209
  material.blendDst = OneFactor;
33210
- material.blendSrcAlpha = ZeroFactor;
33211
- material.blendDstAlpha = OneFactor;
33210
+ material.blendSrcAlpha = OneFactor;
33211
+ material.blendDstAlpha = OneMinusSrcAlphaFactor;
33212
+ material.onBeforeCompile = (shader) => {
33213
+ shader.fragmentShader = shader.fragmentShader.replace(
33214
+ "#include <dithering_fragment>",
33215
+ "gl_FragColor.a = max(gl_FragColor.r, max(gl_FragColor.g, gl_FragColor.b));\n#include <dithering_fragment>"
33216
+ );
33217
+ };
33218
+ material.customProgramCacheKey = () => "energy_swirl";
33212
33219
  material.color.set(8421504);
33213
33220
  break;
33214
33221
  case "water_mask":
@@ -78591,16 +78598,17 @@ ${key}` : key;
78591
78598
  positions[textureKey] = [x4, y5];
78592
78599
  const [width, height] = sizes[textureKey];
78593
78600
  const sequence = frames[textureKey];
78594
- const drawFrame = (index) => {
78601
+ const getFrameData = (index) => {
78595
78602
  const columns = texture.width / width;
78596
- image.putData(texture.getSectionData(
78603
+ return texture.getSectionData(
78597
78604
  index % columns * width,
78598
78605
  Math.floor(index / columns) * height,
78599
78606
  width,
78600
78607
  height
78601
- ), x4, y5);
78608
+ );
78602
78609
  };
78603
- drawFrame(sequence?.[0].index ?? 0);
78610
+ const firstFrame = getFrameData(sequence?.[0].index ?? 0);
78611
+ image.putData(firstFrame, x4, y5);
78604
78612
  if (texture.hasTransparency) {
78605
78613
  hasTransparency = true;
78606
78614
  }
@@ -78608,13 +78616,28 @@ ${key}` : key;
78608
78616
  hasAnimation = true;
78609
78617
  let t5 = 0;
78610
78618
  let f4 = 0;
78619
+ const interpolated = metaMap[textureKey]?.animation?.interpolate ? image.context.createImageData(width, height) : void 0;
78620
+ let currentFrame = firstFrame;
78621
+ let nextFrame = interpolated ? getFrameData(sequence[1].index) : firstFrame;
78611
78622
  animatorFunctions[textureKey] = () => {
78612
- if (++t5 < sequence[f4].time) return false;
78613
- t5 = 0;
78614
- const previous = sequence[f4].index;
78615
- f4 = (f4 + 1) % sequence.length;
78616
- if (sequence[f4].index === previous) return false;
78617
- drawFrame(sequence[f4].index);
78623
+ if (++t5 >= sequence[f4].time) {
78624
+ t5 = 0;
78625
+ const previous = sequence[f4].index;
78626
+ f4 = (f4 + 1) % sequence.length;
78627
+ if (interpolated) {
78628
+ currentFrame = nextFrame;
78629
+ nextFrame = getFrameData(sequence[(f4 + 1) % sequence.length].index);
78630
+ }
78631
+ if (sequence[f4].index === previous) return false;
78632
+ image.putData(interpolated ? currentFrame : getFrameData(sequence[f4].index), x4, y5);
78633
+ return true;
78634
+ }
78635
+ if (!interpolated || sequence[f4].index === sequence[(f4 + 1) % sequence.length].index) return false;
78636
+ const progress = Math.floor(Math.fround(Math.fround(t5 / sequence[f4].time) * 1e3)) / 1e3;
78637
+ for (let i4 = 0; i4 < interpolated.data.length; i4++) {
78638
+ interpolated.data[i4] = currentFrame.data[i4] + (nextFrame.data[i4] - currentFrame.data[i4]) * progress;
78639
+ }
78640
+ image.putData(interpolated, x4, y5);
78618
78641
  return true;
78619
78642
  };
78620
78643
  }