@adatechnology/game-fluids-three 0.4.2 → 0.4.4
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.global.js +12 -3
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +12 -3
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/index.global.js
CHANGED
|
@@ -8691,6 +8691,12 @@ void main(){vec2 d=gl_PointCoord-.5;float r=length(d)*2.;if(r>1.)discard;float a
|
|
|
8691
8691
|
|
|
8692
8692
|
// src/liquid-body.ts
|
|
8693
8693
|
var INSET = 0.985;
|
|
8694
|
+
var narrowMouth = (state) => {
|
|
8695
|
+
const shape = state.shape;
|
|
8696
|
+
if (!shape || state.lipRadius === void 0) return false;
|
|
8697
|
+
const inner = shape.kind === "cylinder" ? shape.radius : Math.min(shape.size[0], shape.size[2]) / 2;
|
|
8698
|
+
return state.lipRadius < inner * 0.5;
|
|
8699
|
+
};
|
|
8694
8700
|
var LiquidBody = class {
|
|
8695
8701
|
constructor(THREE, containerId, object, offset) {
|
|
8696
8702
|
__publicField(this, "THREE", THREE);
|
|
@@ -8753,7 +8759,7 @@ void main(){vec2 d=gl_PointCoord-.5;float r=length(d)*2.;if(r>1.)discard;float a
|
|
|
8753
8759
|
this.vertices = 0;
|
|
8754
8760
|
return;
|
|
8755
8761
|
}
|
|
8756
|
-
if (state.closed && this.isShellOpaque()) {
|
|
8762
|
+
if ((state.closed || narrowMouth(state)) && this.isShellOpaque()) {
|
|
8757
8763
|
if (this.mesh) this.mesh.visible = false;
|
|
8758
8764
|
this.vertices = 0;
|
|
8759
8765
|
return;
|
|
@@ -8783,12 +8789,15 @@ void main(){vec2 d=gl_PointCoord-.5;float r=length(d)*2.;if(r>1.)discard;float a
|
|
|
8783
8789
|
}
|
|
8784
8790
|
} else this.steamAcc = 0;
|
|
8785
8791
|
}
|
|
8786
|
-
/**
|
|
8792
|
+
/**
|
|
8793
|
+
* Every mesh of the bound object (the liquid itself aside) is drawn with an opaque material. The marks drawn on its surface (bullet holes, scorches: the
|
|
8794
|
+
* `userData.destructionDebris` meshes of `game-destruction-three`) are see-through discs on the shell, not windows into it.
|
|
8795
|
+
*/
|
|
8787
8796
|
isShellOpaque() {
|
|
8788
8797
|
let opaque = true;
|
|
8789
8798
|
this.object.traverse((child) => {
|
|
8790
8799
|
const mesh2 = child;
|
|
8791
|
-
if (!opaque || !mesh2.isMesh || child === this.mesh) return;
|
|
8800
|
+
if (!opaque || !mesh2.isMesh || child === this.mesh || child.userData?.destructionDebris === true) return;
|
|
8792
8801
|
const materials = Array.isArray(mesh2.material) ? mesh2.material : [mesh2.material];
|
|
8793
8802
|
if (materials.some((material) => material.transparent || material.opacity < 1)) opaque = false;
|
|
8794
8803
|
});
|