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/browser/index.js +35 -12
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/index.mjs +36 -13
- package/dist/browser/index.mjs.map +1 -1
- package/dist/bundle.js +35 -12
- package/dist/bundle.js.map +1 -1
- package/dist/node/index.js +35 -12
- package/dist/node/index.js.map +1 -1
- package/dist/node/index.mjs +36 -13
- package/dist/node/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/node/index.js
CHANGED
|
@@ -944,8 +944,15 @@ var init_Materials = __esm({
|
|
|
944
944
|
material.blending = import_three5.CustomBlending;
|
|
945
945
|
material.blendSrc = import_three5.OneFactor;
|
|
946
946
|
material.blendDst = import_three5.OneFactor;
|
|
947
|
-
material.blendSrcAlpha = import_three5.
|
|
948
|
-
material.blendDstAlpha = import_three5.
|
|
947
|
+
material.blendSrcAlpha = import_three5.OneFactor;
|
|
948
|
+
material.blendDstAlpha = import_three5.OneMinusSrcAlphaFactor;
|
|
949
|
+
material.onBeforeCompile = (shader) => {
|
|
950
|
+
shader.fragmentShader = shader.fragmentShader.replace(
|
|
951
|
+
"#include <dithering_fragment>",
|
|
952
|
+
"gl_FragColor.a = max(gl_FragColor.r, max(gl_FragColor.g, gl_FragColor.b));\n#include <dithering_fragment>"
|
|
953
|
+
);
|
|
954
|
+
};
|
|
955
|
+
material.customProgramCacheKey = () => "energy_swirl";
|
|
949
956
|
material.color.set(8421504);
|
|
950
957
|
break;
|
|
951
958
|
case "water_mask":
|
|
@@ -3001,16 +3008,17 @@ var init_UVMapper = __esm({
|
|
|
3001
3008
|
positions[textureKey] = [x, y];
|
|
3002
3009
|
const [width, height] = sizes[textureKey];
|
|
3003
3010
|
const sequence = frames[textureKey];
|
|
3004
|
-
const
|
|
3011
|
+
const getFrameData = (index) => {
|
|
3005
3012
|
const columns = texture.width / width;
|
|
3006
|
-
|
|
3013
|
+
return texture.getSectionData(
|
|
3007
3014
|
index % columns * width,
|
|
3008
3015
|
Math.floor(index / columns) * height,
|
|
3009
3016
|
width,
|
|
3010
3017
|
height
|
|
3011
|
-
)
|
|
3018
|
+
);
|
|
3012
3019
|
};
|
|
3013
|
-
|
|
3020
|
+
const firstFrame = getFrameData(sequence?.[0].index ?? 0);
|
|
3021
|
+
image.putData(firstFrame, x, y);
|
|
3014
3022
|
if (texture.hasTransparency) {
|
|
3015
3023
|
hasTransparency = true;
|
|
3016
3024
|
}
|
|
@@ -3018,13 +3026,28 @@ var init_UVMapper = __esm({
|
|
|
3018
3026
|
hasAnimation = true;
|
|
3019
3027
|
let t = 0;
|
|
3020
3028
|
let f = 0;
|
|
3029
|
+
const interpolated = metaMap[textureKey]?.animation?.interpolate ? image.context.createImageData(width, height) : void 0;
|
|
3030
|
+
let currentFrame = firstFrame;
|
|
3031
|
+
let nextFrame = interpolated ? getFrameData(sequence[1].index) : firstFrame;
|
|
3021
3032
|
animatorFunctions[textureKey] = () => {
|
|
3022
|
-
if (++t
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3033
|
+
if (++t >= sequence[f].time) {
|
|
3034
|
+
t = 0;
|
|
3035
|
+
const previous = sequence[f].index;
|
|
3036
|
+
f = (f + 1) % sequence.length;
|
|
3037
|
+
if (interpolated) {
|
|
3038
|
+
currentFrame = nextFrame;
|
|
3039
|
+
nextFrame = getFrameData(sequence[(f + 1) % sequence.length].index);
|
|
3040
|
+
}
|
|
3041
|
+
if (sequence[f].index === previous) return false;
|
|
3042
|
+
image.putData(interpolated ? currentFrame : getFrameData(sequence[f].index), x, y);
|
|
3043
|
+
return true;
|
|
3044
|
+
}
|
|
3045
|
+
if (!interpolated || sequence[f].index === sequence[(f + 1) % sequence.length].index) return false;
|
|
3046
|
+
const progress = Math.floor(Math.fround(Math.fround(t / sequence[f].time) * 1e3)) / 1e3;
|
|
3047
|
+
for (let i = 0; i < interpolated.data.length; i++) {
|
|
3048
|
+
interpolated.data[i] = currentFrame.data[i] + (nextFrame.data[i] - currentFrame.data[i]) * progress;
|
|
3049
|
+
}
|
|
3050
|
+
image.putData(interpolated, x, y);
|
|
3028
3051
|
return true;
|
|
3029
3052
|
};
|
|
3030
3053
|
}
|