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