@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.js
CHANGED
|
@@ -5047,8 +5047,15 @@ function installGlassDamage(kit) {
|
|
|
5047
5047
|
x.arc(cx, cy, 26 * s, 0, PI * 2);
|
|
5048
5048
|
x.fill();
|
|
5049
5049
|
}
|
|
5050
|
+
const NO_CANVAS = new Proxy(function() {
|
|
5051
|
+
}, { get: () => NO_CANVAS, apply: () => NO_CANVAS, set: () => true });
|
|
5050
5052
|
function crackGlass(c, msh, p, force, sc) {
|
|
5051
5053
|
const G = msh.userData.glass;
|
|
5054
|
+
if (G.cracksFreed) {
|
|
5055
|
+
drawWeb(NO_CANVAS, 0, 0, sc != null ? sc : 0.6 + force * 0.5, Math.max(0.4, G.aspect || 1), c.rand);
|
|
5056
|
+
G.hits++;
|
|
5057
|
+
return;
|
|
5058
|
+
}
|
|
5052
5059
|
if (!G.cv) {
|
|
5053
5060
|
G.cv = document2.createElement("canvas");
|
|
5054
5061
|
G.cv.width = G.cv.height = 256;
|
|
@@ -5131,6 +5138,14 @@ function installGlassDamage(kit) {
|
|
|
5131
5138
|
const G = msh.userData.glass;
|
|
5132
5139
|
if (G.broken) return;
|
|
5133
5140
|
G.broken = true;
|
|
5141
|
+
const freeCracks = function() {
|
|
5142
|
+
if (!G.tex) return;
|
|
5143
|
+
if (msh.material !== MATERIALS.glassEdge && msh.material?.map === G.tex) msh.material.dispose();
|
|
5144
|
+
G.tex.dispose();
|
|
5145
|
+
G.tex = null;
|
|
5146
|
+
G.cv = null;
|
|
5147
|
+
G.cracksFreed = true;
|
|
5148
|
+
};
|
|
5134
5149
|
const cubesAt = [];
|
|
5135
5150
|
if (G.outline && G.T !== void 0) {
|
|
5136
5151
|
const out = G.outline;
|
|
@@ -5164,6 +5179,7 @@ function installGlassDamage(kit) {
|
|
|
5164
5179
|
geo.computeVertexNormals();
|
|
5165
5180
|
msh.geometry.dispose();
|
|
5166
5181
|
msh.geometry = geo;
|
|
5182
|
+
freeCracks();
|
|
5167
5183
|
msh.material = MATERIALS.glassEdge;
|
|
5168
5184
|
let minx = 1e9;
|
|
5169
5185
|
let maxx = -1e9;
|
|
@@ -5187,8 +5203,12 @@ function installGlassDamage(kit) {
|
|
|
5187
5203
|
if (rim) {
|
|
5188
5204
|
msh.geometry.dispose();
|
|
5189
5205
|
msh.geometry = rim;
|
|
5206
|
+
freeCracks();
|
|
5190
5207
|
msh.material = MATERIALS.glassEdge;
|
|
5191
|
-
} else
|
|
5208
|
+
} else {
|
|
5209
|
+
freeCracks();
|
|
5210
|
+
msh.visible = false;
|
|
5211
|
+
}
|
|
5192
5212
|
for (let j = 0; j < 36; j++)
|
|
5193
5213
|
cubesAt.push(
|
|
5194
5214
|
new V3(
|