@adatechnology/game-vehicles-three 0.9.13 → 0.10.1
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/README.md +4 -0
- package/dist/{chunk-VCFML7I4.js → chunk-5T52WAQS.js} +56 -2
- package/dist/chunk-5T52WAQS.js.map +1 -0
- package/dist/index.d.ts +24 -4
- package/dist/index.global.js +953 -97
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +5 -1
- package/dist/{testing-CY8IYz1H.d.ts → testing-CRVetKNa.d.ts} +10 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +5 -3
- package/package.json +11 -11
- package/dist/chunk-VCFML7I4.js.map +0 -1
package/README.md
CHANGED
|
@@ -24,3 +24,7 @@ car.triangles // 19286 · car.drawCalls // 6 · car.damageables // metal, glass,
|
|
|
24
24
|
`createVehiclesTestModule({ locale, document?, three?, vehicles?, effects? })` is a `TestableModule` for the shared test room (`room.loadModule`, or `loadVehiclesTestModule(room)`, which learns the room's three.js to compute the door, hood and trunk clips). It lays the eight vehicles of the Frota test, each with its own `DestructibleImpl`, and brings 13 scenarios: the eleven of the team's test page, literal (`vehicles_9mm_windshield`, `vehicles_shotgun_door`, `vehicles_ram_front`, `vehicles_engine_fire`, `vehicles_fuel_tank`, `vehicles_unbolt_wheel`, `vehicles_tear_bumper`, `vehicles_break_mirror`, `vehicles_kill_battery`, `vehicles_rollover`, `vehicles_melt`; the page ids are in `PAGE_SCENARIO_ALIASES`), plus `vehicles_drive_arcade` and `vehicles_drive_semi` for `@adatechnology/game-vehicles-driving`.
|
|
25
25
|
|
|
26
26
|
The bench sets the quality (full or light mode), the paint by seed and palette, the driving mode and the surface, and drives a car down a lane; its layers show the damageable boxes by material, the zones by type and the axes of the output frame; its metrics read triangles, draw calls, the size against `DIMS` and the boxes by material. The module draws no particles: fire, explosion, glass, sparks, leaks and exhaust are requested by id through `host.effects` when the host has one (`defaultEffectIds`, replaceable by option). A pierced tank asks for `leak` (`vehicle_leak`: the pool and the drips only); when the leak catches fire (a spark, an incendiary round, a fire near, a blast) the `ignite` event of the tank asks for `leakIgnited` (`vehicle_leak_ignited`: the Garagem's whole sequence, the fire along the pool and then the blast). `examples/vehicles-test-area` loads it.
|
|
27
|
+
|
|
28
|
+
## Rain under the roof
|
|
29
|
+
|
|
30
|
+
`createVehicleRainCovers()` keeps the host's rain (`ModuleHost.rainCover`) told what each vehicle in the scene roofs over: `track(id, destructible, frame)`, then `sync(host.rainCover, dt)` every frame and `clear()` when the module leaves (the vehicles test area does it). The cover comes from `createVehicleRainCover` of `game-vehicles`: the cabin box and roof of a car, the body of a bus or truck; an open pickup bed, bikes, boats, planes, helicopters and the tractor roof nothing. A torn-off roof, a broken windshield or pane and a through-hole of 30 cm or more are openings; a moving car only turns its rectangle (the damage state is read every 0.4 s) and the version the far curtain caches grows every metre or so.
|
|
@@ -932,6 +932,47 @@ function createCabinSmoke() {
|
|
|
932
932
|
};
|
|
933
933
|
}
|
|
934
934
|
|
|
935
|
+
// src/rain-cover.ts
|
|
936
|
+
import { createVehicleRainCover } from "@adatechnology/game-vehicles";
|
|
937
|
+
var RAIN_SHELL_INTERVAL = 0.4;
|
|
938
|
+
function createVehicleRainCovers() {
|
|
939
|
+
const tracked = /* @__PURE__ */ new Map();
|
|
940
|
+
let counter = 0;
|
|
941
|
+
const end = (id) => {
|
|
942
|
+
tracked.get(id)?.remove?.();
|
|
943
|
+
tracked.delete(id);
|
|
944
|
+
};
|
|
945
|
+
return {
|
|
946
|
+
track(id, source, frame) {
|
|
947
|
+
tracked.set(id, { rain: createVehicleRainCover(source, { frame }), frame, remove: void 0, untilShell: counter++ % 8 * (RAIN_SHELL_INTERVAL / 8) });
|
|
948
|
+
},
|
|
949
|
+
untrack: end,
|
|
950
|
+
sync(cover, dt) {
|
|
951
|
+
if (!cover) return;
|
|
952
|
+
for (const [id, entry] of tracked) {
|
|
953
|
+
if (!entry.frame.parent) {
|
|
954
|
+
if (entry.remove) end(id);
|
|
955
|
+
continue;
|
|
956
|
+
}
|
|
957
|
+
if (!entry.remove) {
|
|
958
|
+
entry.remove = cover.add(entry.rain.source);
|
|
959
|
+
entry.rain.refreshShell();
|
|
960
|
+
}
|
|
961
|
+
entry.untilShell -= dt;
|
|
962
|
+
if (entry.untilShell <= 0) {
|
|
963
|
+
entry.untilShell = RAIN_SHELL_INTERVAL;
|
|
964
|
+
entry.rain.refreshShell();
|
|
965
|
+
}
|
|
966
|
+
entry.rain.place();
|
|
967
|
+
}
|
|
968
|
+
},
|
|
969
|
+
clear() {
|
|
970
|
+
for (const id of [...tracked.keys()]) end(id);
|
|
971
|
+
},
|
|
972
|
+
ids: () => [...tracked.keys()]
|
|
973
|
+
};
|
|
974
|
+
}
|
|
975
|
+
|
|
935
976
|
// src/test-area/lane-damage.ts
|
|
936
977
|
import { crashVehicle, createVehicleDestructible } from "@adatechnology/game-vehicles";
|
|
937
978
|
import { conditionFromDamage } from "@adatechnology/game-vehicles-driving";
|
|
@@ -1802,6 +1843,7 @@ function createVehiclesTestModule(options = {}) {
|
|
|
1802
1843
|
const kits = /* @__PURE__ */ new WeakMap();
|
|
1803
1844
|
const placed = /* @__PURE__ */ new Map();
|
|
1804
1845
|
const cabins = createCabinSmoke();
|
|
1846
|
+
const rainCovers = createVehicleRainCovers();
|
|
1805
1847
|
let host = null;
|
|
1806
1848
|
let three = null;
|
|
1807
1849
|
let counter = 0;
|
|
@@ -1898,6 +1940,7 @@ function createVehiclesTestModule(options = {}) {
|
|
|
1898
1940
|
return hitBody(h);
|
|
1899
1941
|
};
|
|
1900
1942
|
cabins.track(id, d, root);
|
|
1943
|
+
rainCovers.track(id, d, root);
|
|
1901
1944
|
r.userData.destructible = d;
|
|
1902
1945
|
return d;
|
|
1903
1946
|
},
|
|
@@ -2209,6 +2252,7 @@ function createVehiclesTestModule(options = {}) {
|
|
|
2209
2252
|
if (host?.bench && boxKey() !== helpersShown && (host.bench.layer("damageables") || host.bench.layer("zones") || helpersShown !== "")) refreshLayers();
|
|
2210
2253
|
lane?.step(dt);
|
|
2211
2254
|
cabins.sync(effects());
|
|
2255
|
+
rainCovers.sync(host?.rainCover, dt);
|
|
2212
2256
|
};
|
|
2213
2257
|
const count2 = () => {
|
|
2214
2258
|
let drawCalls = 0;
|
|
@@ -2319,6 +2363,7 @@ function createVehiclesTestModule(options = {}) {
|
|
|
2319
2363
|
stopCrease?.();
|
|
2320
2364
|
stopLodBatch?.();
|
|
2321
2365
|
cabins.clear(effects());
|
|
2366
|
+
rainCovers.clear();
|
|
2322
2367
|
clearHelpers();
|
|
2323
2368
|
clearLane();
|
|
2324
2369
|
host = null;
|
|
@@ -2327,6 +2372,9 @@ function createVehiclesTestModule(options = {}) {
|
|
|
2327
2372
|
};
|
|
2328
2373
|
}
|
|
2329
2374
|
function loadVehiclesTestModule(room, options = {}) {
|
|
2375
|
+
return room.loadModule(createVehiclesTestModule({ ...options, three: learnThree(room, options) }));
|
|
2376
|
+
}
|
|
2377
|
+
function learnThree(room, options) {
|
|
2330
2378
|
let three = options.three;
|
|
2331
2379
|
if (!three) {
|
|
2332
2380
|
room.loadModule({ id: "vehicles_probe", name: "Vehicles probe", group: "Vehicles", items: () => [], attach: (lent) => {
|
|
@@ -2334,7 +2382,10 @@ function loadVehiclesTestModule(room, options = {}) {
|
|
|
2334
2382
|
return () => void 0;
|
|
2335
2383
|
} });
|
|
2336
2384
|
}
|
|
2337
|
-
return
|
|
2385
|
+
return three;
|
|
2386
|
+
}
|
|
2387
|
+
function loadVehiclesTestModuleAsync(room, between, options = {}) {
|
|
2388
|
+
return room.loadModuleAsync(createVehiclesTestModule({ ...options, three: learnThree(room, options) }), between);
|
|
2338
2389
|
}
|
|
2339
2390
|
|
|
2340
2391
|
// src/test-area/proving/module.ts
|
|
@@ -4382,6 +4433,8 @@ export {
|
|
|
4382
4433
|
liteMeshes,
|
|
4383
4434
|
createVehiclesThree,
|
|
4384
4435
|
createCabinSmoke,
|
|
4436
|
+
RAIN_SHELL_INTERVAL,
|
|
4437
|
+
createVehicleRainCovers,
|
|
4385
4438
|
firingHz,
|
|
4386
4439
|
rpmShare,
|
|
4387
4440
|
layerWeight,
|
|
@@ -4421,6 +4474,7 @@ export {
|
|
|
4421
4474
|
DEFAULT_TEST_VEHICLES,
|
|
4422
4475
|
createVehiclesTestModule,
|
|
4423
4476
|
loadVehiclesTestModule,
|
|
4477
|
+
loadVehiclesTestModuleAsync,
|
|
4424
4478
|
createVehicleBody,
|
|
4425
4479
|
DASHBOARD_LOOK,
|
|
4426
4480
|
createVehicleDashboard,
|
|
@@ -4434,4 +4488,4 @@ export {
|
|
|
4434
4488
|
createProvingModule,
|
|
4435
4489
|
loadProvingModule
|
|
4436
4490
|
};
|
|
4437
|
-
//# sourceMappingURL=chunk-
|
|
4491
|
+
//# sourceMappingURL=chunk-5T52WAQS.js.map
|