modern-canvas 0.4.1 → 0.4.3
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/index.cjs +18 -3
- package/dist/index.js +29 -15
- package/dist/index.mjs +18 -3
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -7684,7 +7684,8 @@ let MaskEffect = class extends Effect {
|
|
|
7684
7684
|
QuadUvGeometry.draw(renderer, MaskEffect.material, {
|
|
7685
7685
|
sampler: 0,
|
|
7686
7686
|
mask: 1,
|
|
7687
|
-
area: context.targetArea
|
|
7687
|
+
area: context.targetArea,
|
|
7688
|
+
rotation: context.target?.globalRotation ?? 0
|
|
7688
7689
|
});
|
|
7689
7690
|
renderer.texture.unbind(1);
|
|
7690
7691
|
});
|
|
@@ -7704,6 +7705,20 @@ void main() {
|
|
|
7704
7705
|
uniform sampler2D sampler;
|
|
7705
7706
|
uniform sampler2D mask;
|
|
7706
7707
|
uniform float area[4];
|
|
7708
|
+
uniform float rotation;
|
|
7709
|
+
|
|
7710
|
+
vec2 rotateUV(vec2 uv, float angle) {
|
|
7711
|
+
uv -= 0.5;
|
|
7712
|
+
float cosAngle = cos(angle);
|
|
7713
|
+
float sinAngle = sin(angle);
|
|
7714
|
+
mat2 rotationMatrix = mat2(
|
|
7715
|
+
cosAngle, -sinAngle,
|
|
7716
|
+
sinAngle, cosAngle
|
|
7717
|
+
);
|
|
7718
|
+
uv = rotationMatrix * uv;
|
|
7719
|
+
uv += 0.5;
|
|
7720
|
+
return uv;
|
|
7721
|
+
}
|
|
7707
7722
|
|
|
7708
7723
|
void main(void) {
|
|
7709
7724
|
if (
|
|
@@ -7717,7 +7732,7 @@ void main(void) {
|
|
|
7717
7732
|
(vUv.x - area[0]) / area[2],
|
|
7718
7733
|
((1.0 - vUv.y) - area[1]) / area[3]
|
|
7719
7734
|
);
|
|
7720
|
-
vec4 maskColor = texture2D(mask, uv);
|
|
7735
|
+
vec4 maskColor = texture2D(mask, rotateUV(uv, rotation));
|
|
7721
7736
|
gl_FragColor = mix(vec4(0.), color, maskColor.a);
|
|
7722
7737
|
} else {
|
|
7723
7738
|
gl_FragColor = vec4(0.);
|
|
@@ -9655,7 +9670,7 @@ let Image2D = class extends Element2D {
|
|
|
9655
9670
|
}
|
|
9656
9671
|
}
|
|
9657
9672
|
_repaint(batchables) {
|
|
9658
|
-
return batchables.map((batchable) => {
|
|
9673
|
+
return super._repaint(batchables).map((batchable) => {
|
|
9659
9674
|
return {
|
|
9660
9675
|
...batchable,
|
|
9661
9676
|
disableWrapMode: true
|