@adatechnology/game-vehicles 0.4.6 → 0.4.7
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 +21 -1
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +21 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.global.js
CHANGED
|
@@ -6661,8 +6661,15 @@ var GameVehicles = (() => {
|
|
|
6661
6661
|
x.arc(cx, cy, 26 * s, 0, PI * 2);
|
|
6662
6662
|
x.fill();
|
|
6663
6663
|
}
|
|
6664
|
+
const NO_CANVAS = new Proxy(function() {
|
|
6665
|
+
}, { get: () => NO_CANVAS, apply: () => NO_CANVAS, set: () => true });
|
|
6664
6666
|
function crackGlass(c, msh, p, force, sc) {
|
|
6665
6667
|
const G = msh.userData.glass;
|
|
6668
|
+
if (G.cracksFreed) {
|
|
6669
|
+
drawWeb(NO_CANVAS, 0, 0, sc != null ? sc : 0.6 + force * 0.5, Math.max(0.4, G.aspect || 1), c.rand);
|
|
6670
|
+
G.hits++;
|
|
6671
|
+
return;
|
|
6672
|
+
}
|
|
6666
6673
|
if (!G.cv) {
|
|
6667
6674
|
G.cv = document2.createElement("canvas");
|
|
6668
6675
|
G.cv.width = G.cv.height = 256;
|
|
@@ -6745,6 +6752,14 @@ var GameVehicles = (() => {
|
|
|
6745
6752
|
const G = msh.userData.glass;
|
|
6746
6753
|
if (G.broken) return;
|
|
6747
6754
|
G.broken = true;
|
|
6755
|
+
const freeCracks = function() {
|
|
6756
|
+
if (!G.tex) return;
|
|
6757
|
+
if (msh.material !== MATERIALS.glassEdge && msh.material?.map === G.tex) msh.material.dispose();
|
|
6758
|
+
G.tex.dispose();
|
|
6759
|
+
G.tex = null;
|
|
6760
|
+
G.cv = null;
|
|
6761
|
+
G.cracksFreed = true;
|
|
6762
|
+
};
|
|
6748
6763
|
const cubesAt = [];
|
|
6749
6764
|
if (G.outline && G.T !== void 0) {
|
|
6750
6765
|
const out = G.outline;
|
|
@@ -6778,6 +6793,7 @@ var GameVehicles = (() => {
|
|
|
6778
6793
|
geo.computeVertexNormals();
|
|
6779
6794
|
msh.geometry.dispose();
|
|
6780
6795
|
msh.geometry = geo;
|
|
6796
|
+
freeCracks();
|
|
6781
6797
|
msh.material = MATERIALS.glassEdge;
|
|
6782
6798
|
let minx = 1e9;
|
|
6783
6799
|
let maxx = -1e9;
|
|
@@ -6801,8 +6817,12 @@ var GameVehicles = (() => {
|
|
|
6801
6817
|
if (rim) {
|
|
6802
6818
|
msh.geometry.dispose();
|
|
6803
6819
|
msh.geometry = rim;
|
|
6820
|
+
freeCracks();
|
|
6804
6821
|
msh.material = MATERIALS.glassEdge;
|
|
6805
|
-
} else
|
|
6822
|
+
} else {
|
|
6823
|
+
freeCracks();
|
|
6824
|
+
msh.visible = false;
|
|
6825
|
+
}
|
|
6806
6826
|
for (let j = 0; j < 36; j++)
|
|
6807
6827
|
cubesAt.push(
|
|
6808
6828
|
new V3(
|