@pinkaphant/kolmo 0.1.2 → 0.2.0
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/LICENSE +21 -0
- package/README.md +16 -14
- package/bin/kolmo.mjs +22 -54
- package/dist/body/HeldItem.js +171 -0
- package/dist/body/KhrBody.js +171 -0
- package/dist/body/bodySi.d.ts +0 -11
- package/dist/body/bodySi.js +52 -0
- package/dist/body/index.d.ts +1 -1
- package/dist/body/index.js +4 -1
- package/dist/engine/index.d.ts +4 -4
- package/dist/engine/index.js +12 -3
- package/dist/engine/kolmoActor.d.ts +11 -4
- package/dist/engine/kolmoActor.js +197 -0
- package/dist/engine/kolmoInput.d.ts +17 -0
- package/dist/engine/kolmoInput.js +78 -0
- package/dist/engine/kolmoIsland.d.ts +3 -1
- package/dist/engine/kolmoIsland.js +311 -0
- package/dist/engine/kolmoLongDrive.js +223 -0
- package/dist/engine/kolmoRigs.js +59 -0
- package/dist/engine/kolmoStore.d.ts +53 -27
- package/dist/engine/kolmoStore.js +211 -0
- package/dist/engine/kolmoSurface.d.ts +1 -1
- package/dist/engine/kolmoSurface.js +182 -0
- package/dist/engine/kolmoVehicle.d.ts +3 -1
- package/dist/engine/kolmoVehicle.js +250 -0
- package/dist/engine/kolmoVehicleDriver.d.ts +30 -0
- package/dist/engine/kolmoVehicleDriver.js +29 -0
- package/dist/engine/kolmoWorld.d.ts +7 -15
- package/dist/engine/kolmoWorld.js +139 -0
- package/dist/engine/longDriveKit.d.ts +4 -2
- package/dist/engine/longDriveKit.js +254 -0
- package/dist/engine/mainlandMacroCell.d.ts +3 -7
- package/dist/engine/mainlandMacroCell.js +247 -0
- package/dist/engine/shiftedFixedBody.d.ts +13 -0
- package/dist/engine/shiftedFixedBody.js +64 -0
- package/dist/importer/ChopShopPanel.js +465 -0
- package/dist/importer/DomainWorkshopPanel.d.ts +9 -4
- package/dist/importer/DomainWorkshopPanel.js +385 -0
- package/dist/importer/GateHudBar.js +312 -0
- package/dist/importer/GlbImportGate.js +250 -0
- package/dist/importer/ImperativeVehicleRig.js +336 -0
- package/dist/importer/ImporterPlinthUikitTags.js +112 -0
- package/dist/importer/Step1CalibrationPlinth.js +275 -0
- package/dist/importer/Step2UniversalPad.js +244 -0
- package/dist/importer/VfxEmitterPool.js +91 -0
- package/dist/importer/chopShopActions.d.ts +22 -2
- package/dist/importer/chopShopActions.js +232 -0
- package/dist/importer/gateStore.d.ts +1 -1
- package/dist/importer/gateStore.js +92 -0
- package/dist/importer/glbNormalizer.js +133 -0
- package/dist/importer/importerWebMcp.d.ts +17 -6
- package/dist/importer/importerWebMcp.js +343 -0
- package/dist/importer/index.js +22 -3
- package/dist/importer/khrCompiler.d.ts +1 -1
- package/dist/importer/khrCompiler.js +434 -0
- package/dist/importer/launcherBake.js +51 -0
- package/dist/importer/meshIslands.d.ts +1 -1
- package/dist/importer/meshIslands.js +301 -0
- package/dist/importer/surfaceCutter.js +254 -0
- package/dist/importer/surfaceTopology.js +183 -0
- package/dist/importer/universalGateBake.js +162 -0
- package/dist/importer/usdToGlb.js +294 -0
- package/dist/importer/useChopShopController.d.ts +11 -2
- package/dist/importer/useChopShopController.js +364 -0
- package/dist/importer/vehiclePanelAnim.js +214 -0
- package/dist/importer/wheelAxlePairing.d.ts +1 -2
- package/dist/importer/wheelAxlePairing.js +102 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +69 -13
- package/dist/junk/DestructibleTarget.js +154 -0
- package/dist/junk/KolmoJunk.js +65 -0
- package/dist/junk/ShardPieces.d.ts +6 -4
- package/dist/junk/ShardPieces.js +74 -0
- package/dist/junk/TargetDecals.js +51 -0
- package/dist/junk/bvhShatter.js +55 -0
- package/dist/junk/bvhTriCollector.js +78 -0
- package/dist/junk/index.js +11 -1
- package/dist/junk/junkGeometry.js +69 -0
- package/dist/junk/junkImportSanitize.js +54 -0
- package/dist/junk/junkImporter.js +95 -0
- package/dist/junk/junkLabelCanvas.js +67 -0
- package/dist/junk/junkLabels.js +35 -0
- package/dist/junk/targetHelpers.js +103 -0
- package/dist/junk/targetHitLogic.js +128 -0
- package/dist/junk/useTargetAssets.js +102 -0
- package/dist/physics/index.d.ts +26 -0
- package/dist/physics/index.js +84 -0
- package/dist/schema/kolmoSchema.d.ts +2 -1
- package/dist/schema/kolmoSchema.js +184 -0
- package/dist/shaders/celestialBackdrop.d.ts +1 -1
- package/dist/shaders/celestialBackdrop.js +344 -0
- package/dist/shaders/index.d.ts +0 -1
- package/dist/shaders/index.js +9 -1
- package/dist/shaders/plumeAndSparkle.js +271 -0
- package/dist/shaders/ps2GlslShared.d.ts +1 -1
- package/dist/shaders/ps2GlslShared.js +3 -0
- package/dist/shaders/ps2MaterialsTSL.js +65 -0
- package/dist/shaders/ps2MaterialsWebGL.js +40 -0
- package/dist/shaders/ps2RoadWebGL.js +101 -0
- package/dist/shaders/ps2TerrainWebGL.js +54 -0
- package/dist/shaders/ps2Textures.js +224 -0
- package/dist/shaders/retroPalettes.js +188 -0
- package/dist/shaders/retroShader.d.ts +31 -3
- package/dist/shaders/retroShader.js +249 -0
- package/dist/shaders/tsl.d.ts +1 -0
- package/dist/shaders/tsl.js +1 -0
- package/dist/vite/index.d.ts +15 -0
- package/dist/vite/index.js +90 -0
- package/dist/world/frontage.js +32 -0
- package/dist/world/index.d.ts +1 -1
- package/dist/world/index.js +11 -3
- package/dist/world/infiniteWorld2D.js +244 -0
- package/dist/world/island.js +201 -0
- package/dist/world/macroCellSchema.js +27 -0
- package/dist/world/macroKnightAStar.js +171 -0
- package/dist/world/random.js +33 -0
- package/dist/world/road.js +136 -0
- package/dist/world/roadRibbon.d.ts +6 -6
- package/dist/world/roadRibbon.js +161 -0
- package/dist/world/terrain.js +87 -0
- package/dist/world/worldTypes.js +111 -0
- package/package.json +32 -18
- package/dist/body-B7FTf67o.js +0 -362
- package/dist/engine-BeKvBM8d.js +0 -1745
- package/dist/importer-B2-S-N_e.js +0 -5113
- package/dist/junk-B4bC1zAl.js +0 -1049
- package/dist/kolmoSurface-DTnrFXH0.js +0 -558
- package/dist/shaders-GS71Ek1A.js +0 -1383
- package/dist/world-PRWPYrlx.js +0 -947
- package/dist/worldTypes-Z0KfdCd0.js +0 -226
package/dist/body/index.js
CHANGED
|
@@ -1 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import { BODY_SI as e, BODY_SOCKET_IDS as t, bodyEyeOffsetY as n, bodyRestCenterY as r, bodySpawnPosition as i, bodyStandingHeight as a, stepCameraSync as o, withExcludeCharacterRay as s } from "./bodySi.js";
|
|
2
|
+
import { KhrBody as c } from "./KhrBody.js";
|
|
3
|
+
import { HeldItem as l } from "./HeldItem.js";
|
|
4
|
+
export { e as BODY_SI, t as BODY_SOCKET_IDS, l as HeldItem, c as KhrBody, n as bodyEyeOffsetY, r as bodyRestCenterY, i as bodySpawnPosition, a as bodyStandingHeight, o as stepCameraSync, s as withExcludeCharacterRay };
|
package/dist/engine/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { EMPTY_KOLMO_INPUT, KOLMO_KEY_MAP, KolmoCanvas, KolmoGravityContext, KolmoPhysics, KolmoWorld, RetroViewportSync, RoomEnvRig, ShadowSnapRig, useIsKolmoCustomGravity, useKolmoInput, useOptionalKootaWorld, type KolmoCanvasProps, type KolmoGravityCallback, type KolmoGravitySpec, type KolmoInputGetter, type KolmoInputState, type KolmoKeyAction, type KolmoPhysicsProps, type KolmoPointGravity, type KolmoTimeControlValue, type KolmoWorldProps, type RetroViewportSyncProps, type RoomEnvRigProps, } from "./kolmoWorld.js";
|
|
2
2
|
export { KolmoVehicle, type KolmoVehicleProps } from "./kolmoVehicle.js";
|
|
3
3
|
export { KolmoActor, type KolmoActorProps } from "./kolmoActor.js";
|
|
4
|
-
export {
|
|
4
|
+
export { KolmoProp, KolmoSurface, togglePropJoint, type KolmoPropProps, type KolmoSurfaceProps, } from "./kolmoSurface.js";
|
|
5
5
|
export { KolmoIsland, computeIslandSpawnPose, getCachedIslandPlan, type IslandSpawnPose, type KolmoIslandProps, } from "./kolmoIsland.js";
|
|
6
6
|
export { KolmoLongDrive, computeLongDriveBridgeheadSpawn, computeLongDriveMainlandSpawn, type KolmoLongDriveProps, } from "./kolmoLongDrive.js";
|
|
7
|
-
export { ShiftedFixedBody } from "./mainlandMacroCell.js";
|
|
8
|
-
export {
|
|
7
|
+
export { ShiftedFixedBody, type ShiftedFixedBodyProps } from "./mainlandMacroCell.js";
|
|
8
|
+
export { ActorTrait, FloatingBodyTrait, InteractableTrait, PilotLink, VehicleTrait, WorldSessionTrait, ensureWorldSession, kolmoActions, kolmoTelemetry, kolmoWorld, readFloatingOriginAnchorXZ, shiftFloatingOriginEntities, useActiveKolmoWorld, useWorldTrait, type FloatingOriginRapierSync, type KolmoControlMode, type KolmoTelemetryState, } from "./kolmoStore.js";
|
package/dist/engine/index.js
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { KolmoGravityContext as e, KolmoPhysics as t, useIsKolmoCustomGravity as n, useOptionalKootaWorld as r } from "../physics/index.js";
|
|
2
|
+
import { EMPTY_KOLMO_INPUT as i, KOLMO_KEY_MAP as a, useKolmoInput as o } from "./kolmoInput.js";
|
|
3
|
+
import { RetroViewportSync as s, RoomEnvRig as c, ShadowSnapRig as l } from "./kolmoRigs.js";
|
|
4
|
+
import { KolmoCanvas as u, KolmoWorld as d } from "./kolmoWorld.js";
|
|
5
|
+
import { KolmoVehicle as f } from "./kolmoVehicle.js";
|
|
6
|
+
import { KolmoActor as p } from "./kolmoActor.js";
|
|
7
|
+
import { KolmoProp as m, KolmoSurface as h, togglePropJoint as g } from "./kolmoSurface.js";
|
|
8
|
+
import { KolmoIsland as _, computeIslandSpawnPose as v, getCachedIslandPlan as y } from "./kolmoIsland.js";
|
|
9
|
+
import { KolmoLongDrive as b, computeLongDriveBridgeheadSpawn as x, computeLongDriveMainlandSpawn as S } from "./kolmoLongDrive.js";
|
|
10
|
+
import { ShiftedFixedBody as C } from "./shiftedFixedBody.js";
|
|
11
|
+
import { ActorTrait as w, FloatingBodyTrait as T, InteractableTrait as E, PilotLink as D, VehicleTrait as O, WorldSessionTrait as k, ensureWorldSession as A, kolmoActions as j, kolmoTelemetry as M, kolmoWorld as N, readFloatingOriginAnchorXZ as P, shiftFloatingOriginEntities as F, useActiveKolmoWorld as I, useWorldTrait as L } from "./kolmoStore.js";
|
|
12
|
+
export { w as ActorTrait, i as EMPTY_KOLMO_INPUT, T as FloatingBodyTrait, E as InteractableTrait, a as KOLMO_KEY_MAP, p as KolmoActor, u as KolmoCanvas, e as KolmoGravityContext, _ as KolmoIsland, b as KolmoLongDrive, t as KolmoPhysics, m as KolmoProp, h as KolmoSurface, f as KolmoVehicle, d as KolmoWorld, D as PilotLink, s as RetroViewportSync, c as RoomEnvRig, l as ShadowSnapRig, C as ShiftedFixedBody, O as VehicleTrait, k as WorldSessionTrait, v as computeIslandSpawnPose, x as computeLongDriveBridgeheadSpawn, S as computeLongDriveMainlandSpawn, A as ensureWorldSession, y as getCachedIslandPlan, j as kolmoActions, M as kolmoTelemetry, N as kolmoWorld, P as readFloatingOriginAnchorXZ, F as shiftFloatingOriginEntities, g as togglePropJoint, I as useActiveKolmoWorld, n as useIsKolmoCustomGravity, o as useKolmoInput, r as useOptionalKootaWorld, L as useWorldTrait };
|
|
@@ -1,6 +1,13 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { type ComponentProps, type ReactNode } from "react";
|
|
2
|
+
import { type EcctrlProps } from "@pinkaphant/ecctrl";
|
|
3
|
+
import { EcctrlCameraControls } from "@pinkaphant/ecctrl/camera";
|
|
4
|
+
import { type KolmoInputGetter } from "./kolmoInput.js";
|
|
2
5
|
export interface KolmoActorProps {
|
|
3
|
-
position?: [number, number, number];
|
|
4
|
-
enabled?: boolean;
|
|
6
|
+
readonly position?: [number, number, number];
|
|
7
|
+
readonly enabled?: boolean;
|
|
8
|
+
readonly getInput?: KolmoInputGetter;
|
|
9
|
+
readonly ecctrlProps?: Omit<EcctrlProps, "ref">;
|
|
10
|
+
readonly cameraProps?: Omit<ComponentProps<typeof EcctrlCameraControls>, "ref"> | null | false;
|
|
11
|
+
readonly children?: ReactNode;
|
|
5
12
|
}
|
|
6
|
-
export declare function KolmoActor({ position, enabled }: KolmoActorProps): React.JSX.Element | null;
|
|
13
|
+
export declare function KolmoActor({ position, enabled, getInput, ecctrlProps, cameraProps, children, }: KolmoActorProps): React.JSX.Element | null;
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import { KolmoGravityContext as e } from "../physics/index.js";
|
|
2
|
+
import { applyRetroMaterial as t } from "../shaders/retroShader.js";
|
|
3
|
+
import { useKolmoInput as n } from "./kolmoInput.js";
|
|
4
|
+
import { ActorTrait as r, InteractableTrait as i, VehicleTrait as a, WorldSessionTrait as o, ensureWorldSession as s, kolmoActions as c, kolmoTelemetry as l, useActiveKolmoWorld as u, useWorldTrait as d } from "./kolmoStore.js";
|
|
5
|
+
import { useCallback as f, useContext as p, useLayoutEffect as m, useMemo as h, useRef as g } from "react";
|
|
6
|
+
import * as _ from "three";
|
|
7
|
+
import { useFrame as v, useThree as y } from "@react-three/fiber";
|
|
8
|
+
import { Fragment as b, jsx as x, jsxs as S } from "react/jsx-runtime";
|
|
9
|
+
import { Ecctrl as C } from "@pinkaphant/ecctrl";
|
|
10
|
+
import { EcctrlCameraControls as w } from "@pinkaphant/ecctrl/camera";
|
|
11
|
+
// src/engine/kolmoActor.tsx
|
|
12
|
+
var T = new _.Vector3(), E = new _.Vector3(), D = new _.Vector3();
|
|
13
|
+
function O() {
|
|
14
|
+
let e = h(() => ({
|
|
15
|
+
suitGeo: new _.CapsuleGeometry(.28, .56, 6, 12),
|
|
16
|
+
visorGeo: new _.BoxGeometry(.34, .16, .14),
|
|
17
|
+
packGeo: new _.BoxGeometry(.32, .42, .16),
|
|
18
|
+
suitMat: t(new _.MeshStandardMaterial({
|
|
19
|
+
color: "#e2e8f0",
|
|
20
|
+
roughness: .55,
|
|
21
|
+
metalness: .15
|
|
22
|
+
})),
|
|
23
|
+
visorMat: t(new _.MeshStandardMaterial({
|
|
24
|
+
color: "#38bdf8",
|
|
25
|
+
emissive: "#0284c7",
|
|
26
|
+
emissiveIntensity: .55,
|
|
27
|
+
roughness: .2
|
|
28
|
+
})),
|
|
29
|
+
packMat: t(new _.MeshStandardMaterial({
|
|
30
|
+
color: "#334155",
|
|
31
|
+
roughness: .7
|
|
32
|
+
}))
|
|
33
|
+
}), []);
|
|
34
|
+
return m(() => () => {
|
|
35
|
+
e.suitGeo.dispose(), e.visorGeo.dispose(), e.packGeo.dispose(), e.suitMat.dispose(), e.visorMat.dispose(), e.packMat.dispose();
|
|
36
|
+
}, [e]), /* @__PURE__ */ S("group", { children: [
|
|
37
|
+
/* @__PURE__ */ x("mesh", {
|
|
38
|
+
castShadow: !0,
|
|
39
|
+
geometry: e.suitGeo,
|
|
40
|
+
material: e.suitMat
|
|
41
|
+
}),
|
|
42
|
+
/* @__PURE__ */ x("mesh", {
|
|
43
|
+
position: [
|
|
44
|
+
0,
|
|
45
|
+
.24,
|
|
46
|
+
.22
|
|
47
|
+
],
|
|
48
|
+
geometry: e.visorGeo,
|
|
49
|
+
material: e.visorMat
|
|
50
|
+
}),
|
|
51
|
+
/* @__PURE__ */ x("mesh", {
|
|
52
|
+
position: [
|
|
53
|
+
0,
|
|
54
|
+
.06,
|
|
55
|
+
-.24
|
|
56
|
+
],
|
|
57
|
+
castShadow: !0,
|
|
58
|
+
geometry: e.packGeo,
|
|
59
|
+
material: e.packMat
|
|
60
|
+
})
|
|
61
|
+
] });
|
|
62
|
+
}
|
|
63
|
+
function k({ position: t = [
|
|
64
|
+
0,
|
|
65
|
+
1.4,
|
|
66
|
+
0
|
|
67
|
+
], enabled: k = !0, getInput: A, ecctrlProps: j, cameraProps: M, children: N }) {
|
|
68
|
+
let P = p(e), F = u();
|
|
69
|
+
m(() => {
|
|
70
|
+
s(F);
|
|
71
|
+
}, [F]);
|
|
72
|
+
let I = d(F, o), L = n(A), R = y((e) => typeof e.gl?.domElement?.setAttribute == "function"), z = g(null), B = g(null), V = g(new _.Vector3()), H = g(new _.Vector3(0, 1, 0)), U = g(!1), W = g(0), G = g({
|
|
73
|
+
pos: null,
|
|
74
|
+
yaw: 0
|
|
75
|
+
}), K = g(null), q = g({
|
|
76
|
+
forward: !1,
|
|
77
|
+
backward: !1,
|
|
78
|
+
leftward: !1,
|
|
79
|
+
rightward: !1,
|
|
80
|
+
run: !1,
|
|
81
|
+
jump: !1
|
|
82
|
+
}), J = f((e, t) => {
|
|
83
|
+
V.current.x -= e, V.current.z -= t, z.current && (z.current.currPos.x -= e, z.current.currPos.z -= t);
|
|
84
|
+
let n = B.current;
|
|
85
|
+
n?.getPosition && n?.getTarget && n?.setLookAt && (n.getPosition(E), n.getTarget(D), n.setLookAt(E.x - e, E.y, E.z - t, D.x - e, D.y, D.z - t, !1));
|
|
86
|
+
}, []);
|
|
87
|
+
m(() => {
|
|
88
|
+
let e = F.spawn(r({
|
|
89
|
+
id: "pilot",
|
|
90
|
+
handle: z.current,
|
|
91
|
+
exitSpawnPos: null,
|
|
92
|
+
exitSpawnYaw: 0,
|
|
93
|
+
exitLinVel: null,
|
|
94
|
+
onOriginShift: J
|
|
95
|
+
})), t = F.onChange(r, (t) => {
|
|
96
|
+
if (t !== e) return;
|
|
97
|
+
let n = e.get(r);
|
|
98
|
+
n && (G.current = {
|
|
99
|
+
pos: n.exitSpawnPos,
|
|
100
|
+
yaw: n.exitSpawnYaw
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
return () => {
|
|
104
|
+
t(), e.destroy();
|
|
105
|
+
};
|
|
106
|
+
}, [F, J]);
|
|
107
|
+
let Y = f((e) => {
|
|
108
|
+
z.current = e;
|
|
109
|
+
let t = F.queryFirst(r);
|
|
110
|
+
if (!t) return;
|
|
111
|
+
let n = t.get(r);
|
|
112
|
+
e?.body && n?.exitLinVel && e.body.setLinvel({
|
|
113
|
+
x: n.exitLinVel[0],
|
|
114
|
+
y: n.exitLinVel[1],
|
|
115
|
+
z: n.exitLinVel[2]
|
|
116
|
+
}, !0), e?.body && (G.current.pos = null), t.set(r, {
|
|
117
|
+
id: n?.id ?? "pilot",
|
|
118
|
+
handle: e,
|
|
119
|
+
exitSpawnPos: e?.body ? null : n?.exitSpawnPos ?? null,
|
|
120
|
+
exitSpawnYaw: n?.exitSpawnYaw ?? 0,
|
|
121
|
+
exitLinVel: e?.body ? null : n?.exitLinVel ?? null,
|
|
122
|
+
onOriginShift: J
|
|
123
|
+
});
|
|
124
|
+
}, [F, J]), X = I?.activeVehicleId || "", Z = k && !X;
|
|
125
|
+
if (!Z) K.current = null;
|
|
126
|
+
else if (!K.current) {
|
|
127
|
+
let e = G.current.pos ?? j?.position ?? t, n = j?.rotation ?? [
|
|
128
|
+
0,
|
|
129
|
+
G.current.yaw,
|
|
130
|
+
0
|
|
131
|
+
];
|
|
132
|
+
K.current = {
|
|
133
|
+
pos: [
|
|
134
|
+
e[0],
|
|
135
|
+
e[1],
|
|
136
|
+
e[2]
|
|
137
|
+
],
|
|
138
|
+
rot: [
|
|
139
|
+
n[0],
|
|
140
|
+
n[1],
|
|
141
|
+
n[2]
|
|
142
|
+
]
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
let Q = h(() => {
|
|
146
|
+
let e = j?.userData ?? {}, t = e.ecctrl ?? {};
|
|
147
|
+
return {
|
|
148
|
+
...e,
|
|
149
|
+
ecctrl: {
|
|
150
|
+
excludeVehicleRay: !0,
|
|
151
|
+
...t
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
}, [j?.userData]);
|
|
155
|
+
return v((e, t) => {
|
|
156
|
+
if (!k) return;
|
|
157
|
+
let n = Math.min(Math.max(t, 1e-4), .05);
|
|
158
|
+
W.current > 0 && (W.current = Math.max(0, W.current - n));
|
|
159
|
+
let r = L(), o = r.interact && !U.current;
|
|
160
|
+
if (U.current = r.interact, X) {
|
|
161
|
+
o && W.current === 0 && (W.current = .25, c(F).exitVehicle());
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
let s = z.current;
|
|
165
|
+
if (!s || !s.body) return;
|
|
166
|
+
let u = q.current;
|
|
167
|
+
u.forward = r.forward, u.backward = r.backward, u.leftward = r.left, u.rightward = r.right, u.run = r.boost, u.jump = r.brake, s.setMovement(u), l.mode = "foot", l.speedKmh = s.moveSpeed * 3.6, l.rpm = 0, l.gear = 0, l.throttle = +!!s.isMoving, l.boost = r.boost && s.isMoving ? 1 : 0;
|
|
168
|
+
let d = null, f = Infinity;
|
|
169
|
+
for (let e of F.query(a, i)) {
|
|
170
|
+
let t = e.get(a), n = e.get(i);
|
|
171
|
+
if (!t?.handle || !n) continue;
|
|
172
|
+
T.set(t.seatOffset[0] - t.centerOfMass[0], t.seatOffset[1] - t.centerOfMass[1], t.seatOffset[2] - t.centerOfMass[2]).applyQuaternion(t.handle.currQuat).add(t.handle.currPos);
|
|
173
|
+
let r = s.currPos.distanceToSquared(T);
|
|
174
|
+
r <= n.radius * n.radius && r < f && (f = r, d = t.id);
|
|
175
|
+
}
|
|
176
|
+
l.nearVehicleId = d, o && d && W.current === 0 ? (W.current = .25, c(F).boardVehicle(d)) : B.current && s.currPos.lengthSq() > 0 && (V.current.copy(s.currPos).addScaledVector(s.bodyYAxis, .55), H.current.copy(s.upAxis), B.current.moveTo(V.current.x, V.current.y, V.current.z, !0), e.camera.up.lerp(H.current, .14), B.current.setUp(e.camera.up));
|
|
177
|
+
}), Z ? /* @__PURE__ */ S(b, { children: [R && M !== !1 && M !== null && /* @__PURE__ */ x(w, {
|
|
178
|
+
ref: B,
|
|
179
|
+
makeDefault: !0,
|
|
180
|
+
minPolarAngle: .12,
|
|
181
|
+
maxPolarAngle: Math.PI - .12,
|
|
182
|
+
smoothTime: .08,
|
|
183
|
+
...M ?? {}
|
|
184
|
+
}), /* @__PURE__ */ x(C, {
|
|
185
|
+
ref: Y,
|
|
186
|
+
enableCustomGravity: P,
|
|
187
|
+
maxWalkVel: 3.2,
|
|
188
|
+
maxRunVel: 7.2,
|
|
189
|
+
jumpVel: 5.8,
|
|
190
|
+
...j,
|
|
191
|
+
position: K.current.pos,
|
|
192
|
+
rotation: K.current.rot,
|
|
193
|
+
userData: Q,
|
|
194
|
+
children: N ?? /* @__PURE__ */ x(O, {})
|
|
195
|
+
})] }) : null;
|
|
196
|
+
}
|
|
197
|
+
export { k as KolmoActor };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React, { type ReactNode } from "react";
|
|
2
|
+
import { type KeyboardControlsEntry } from "@react-three/drei";
|
|
3
|
+
export declare const KolmoKeyboardContext: React.Context<(() => Record<string, boolean>) | null>;
|
|
4
|
+
export declare function KolmoKeyboardBridge({ children }: {
|
|
5
|
+
readonly children: ReactNode;
|
|
6
|
+
}): React.JSX.Element;
|
|
7
|
+
export type KolmoKeyAction = "forward" | "backward" | "left" | "right" | "brake" | "boost" | "interact" | "turnLeft" | "turnRight" | "descend" | "cameraView";
|
|
8
|
+
export type KolmoInputState = Record<KolmoKeyAction, boolean>;
|
|
9
|
+
export type KolmoInputGetter = () => Partial<KolmoInputState>;
|
|
10
|
+
export declare const EMPTY_KOLMO_INPUT: Readonly<KolmoInputState>;
|
|
11
|
+
export declare const KOLMO_KEY_MAP: KeyboardControlsEntry<KolmoKeyAction>[];
|
|
12
|
+
/**
|
|
13
|
+
* Safe zero-allocation input reader that falls back cleanly to `EMPTY_KOLMO_INPUT`
|
|
14
|
+
* when `<KeyboardControls>` is omitted (`keyboardMap={null}` or `<KolmoPhysics>`),
|
|
15
|
+
* and merges optional caller `getInput()` overrides.
|
|
16
|
+
*/
|
|
17
|
+
export declare function useKolmoInput(getInput?: KolmoInputGetter): () => Readonly<KolmoInputState>;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import e, { createContext as t, useCallback as n, useContext as r, useRef as i } from "react";
|
|
2
|
+
import { useKeyboardControls as a } from "@react-three/drei";
|
|
3
|
+
// src/engine/kolmoInput.ts
|
|
4
|
+
var o = t(null);
|
|
5
|
+
function s({ children: t }) {
|
|
6
|
+
let [, n] = a();
|
|
7
|
+
return e.createElement(o.Provider, { value: n }, t);
|
|
8
|
+
}
|
|
9
|
+
var c = Object.freeze({
|
|
10
|
+
forward: !1,
|
|
11
|
+
backward: !1,
|
|
12
|
+
left: !1,
|
|
13
|
+
right: !1,
|
|
14
|
+
brake: !1,
|
|
15
|
+
boost: !1,
|
|
16
|
+
interact: !1,
|
|
17
|
+
turnLeft: !1,
|
|
18
|
+
turnRight: !1,
|
|
19
|
+
descend: !1,
|
|
20
|
+
cameraView: !1
|
|
21
|
+
}), l = [
|
|
22
|
+
{
|
|
23
|
+
name: "forward",
|
|
24
|
+
keys: ["KeyW", "ArrowUp"]
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
name: "backward",
|
|
28
|
+
keys: ["KeyS", "ArrowDown"]
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
name: "left",
|
|
32
|
+
keys: ["KeyA", "ArrowLeft"]
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
name: "right",
|
|
36
|
+
keys: ["KeyD", "ArrowRight"]
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
name: "brake",
|
|
40
|
+
keys: ["Space"]
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
name: "boost",
|
|
44
|
+
keys: ["ShiftLeft", "ShiftRight"]
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
name: "interact",
|
|
48
|
+
keys: ["KeyF", "KeyE"]
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
name: "turnLeft",
|
|
52
|
+
keys: ["KeyQ"]
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
name: "turnRight",
|
|
56
|
+
keys: ["KeyC"]
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
name: "descend",
|
|
60
|
+
keys: ["KeyX", "ControlLeft"]
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
name: "cameraView",
|
|
64
|
+
keys: ["KeyV"]
|
|
65
|
+
}
|
|
66
|
+
];
|
|
67
|
+
function u(e) {
|
|
68
|
+
let t = r(o), a = i(e);
|
|
69
|
+
a.current = e;
|
|
70
|
+
let s = i({ ...c });
|
|
71
|
+
return n(() => {
|
|
72
|
+
let e = a.current?.();
|
|
73
|
+
if (!t && !e) return c;
|
|
74
|
+
let n = t ? t() : c, r = s.current;
|
|
75
|
+
return r.forward = !!(e?.forward ?? n.forward), r.backward = !!(e?.backward ?? n.backward), r.left = !!(e?.left ?? n.left), r.right = !!(e?.right ?? n.right), r.brake = !!(e?.brake ?? n.brake), r.boost = !!(e?.boost ?? n.boost), r.interact = !!(e?.interact ?? n.interact), r.turnLeft = !!(e?.turnLeft ?? n.turnLeft), r.turnRight = !!(e?.turnRight ?? n.turnRight), r.descend = !!(e?.descend ?? n.descend), r.cameraView = !!(e?.cameraView ?? n.cameraView), r;
|
|
76
|
+
}, [t]);
|
|
77
|
+
}
|
|
78
|
+
export { c as EMPTY_KOLMO_INPUT, l as KOLMO_KEY_MAP, s as KolmoKeyboardBridge, o as KolmoKeyboardContext, u as useKolmoInput };
|
|
@@ -13,5 +13,7 @@ export interface KolmoIslandProps {
|
|
|
13
13
|
readonly size?: number;
|
|
14
14
|
readonly segments?: number;
|
|
15
15
|
readonly settlementTier?: SettlementTier;
|
|
16
|
+
readonly offX?: number;
|
|
17
|
+
readonly offZ?: number;
|
|
16
18
|
}
|
|
17
|
-
export declare function KolmoIsland({ seed, size, segments, settlementTier, }: KolmoIslandProps): React.JSX.Element;
|
|
19
|
+
export declare function KolmoIsland({ seed, size, segments, settlementTier, offX, offZ, }: KolmoIslandProps): React.JSX.Element;
|
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
import { createPS2RoadMaterialWebGL as e } from "../shaders/ps2RoadWebGL.js";
|
|
2
|
+
import { createPS2TerrainMaterialWebGL as t } from "../shaders/ps2TerrainWebGL.js";
|
|
3
|
+
import { createPS2WorldTextures as n } from "../shaders/ps2Textures.js";
|
|
4
|
+
import { applyRetroMaterial as r } from "../shaders/retroShader.js";
|
|
5
|
+
import { bakeWorldSplatMaps as i } from "../world/worldTypes.js";
|
|
6
|
+
import { buildCarvedTerrainGeometry as a, buildRoadRibbonGeometry as o, planDirtSpurs as s } from "../world/roadRibbon.js";
|
|
7
|
+
import { childSeed as c, mulberry32 as l } from "../world/random.js";
|
|
8
|
+
import { planIslandWorld as u } from "../world/island.js";
|
|
9
|
+
import { ShiftedFixedBody as d } from "./shiftedFixedBody.js";
|
|
10
|
+
import { useEffect as f, useLayoutEffect as p, useMemo as m, useRef as h } from "react";
|
|
11
|
+
import * as g from "three";
|
|
12
|
+
import { jsx as _, jsxs as v } from "react/jsx-runtime";
|
|
13
|
+
import { CuboidCollider as y, TrimeshCollider as b } from "@react-three/rapier";
|
|
14
|
+
import { instanceBatches as x, planSettlement as S, poseToFloat as C } from "@khr3/c12";
|
|
15
|
+
import { mergeGeometries as w } from "three/examples/jsm/utils/BufferGeometryUtils.js";
|
|
16
|
+
// src/engine/kolmoIsland.tsx
|
|
17
|
+
var T = /* @__PURE__ */ new Map();
|
|
18
|
+
function E(e = 77, t = 960) {
|
|
19
|
+
let n = `${e}:${t}`, r = T.get(n);
|
|
20
|
+
return r || (r = u(e, { size: t }), T.set(n, r)), r;
|
|
21
|
+
}
|
|
22
|
+
function D(e = 77, t = 960) {
|
|
23
|
+
let n = E(e, t), r = n.road.at(n.road.length * .48), i = Math.atan2(r.tangent[0], r.tangent[2]);
|
|
24
|
+
return {
|
|
25
|
+
vehiclePos: [
|
|
26
|
+
r.pos[0],
|
|
27
|
+
r.pos[1] + .45,
|
|
28
|
+
r.pos[2]
|
|
29
|
+
],
|
|
30
|
+
vehicleRot: [
|
|
31
|
+
0,
|
|
32
|
+
i,
|
|
33
|
+
0
|
|
34
|
+
],
|
|
35
|
+
actorPos: [
|
|
36
|
+
r.pos[0] + r.left[0] * (n.road.halfWidth + 2),
|
|
37
|
+
r.pos[1] + 1.5,
|
|
38
|
+
r.pos[2] + r.left[2] * (n.road.halfWidth + 2)
|
|
39
|
+
]
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
function O(e) {
|
|
43
|
+
if (e === "FoundationSquare") {
|
|
44
|
+
let e = new g.BoxGeometry(3, .36, 3);
|
|
45
|
+
return e.translate(0, -.18, 0), {
|
|
46
|
+
geo: e,
|
|
47
|
+
color: "#64748b"
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
if (e === "Street") {
|
|
51
|
+
let e = new g.BoxGeometry(3, .14, 3);
|
|
52
|
+
return e.translate(0, .05, 0), {
|
|
53
|
+
geo: e,
|
|
54
|
+
color: "#475569"
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
if (e === "Wall") {
|
|
58
|
+
let e = new g.BoxGeometry(3, 3, .22);
|
|
59
|
+
return e.translate(0, 1.5, 0), {
|
|
60
|
+
geo: e,
|
|
61
|
+
color: "#cbd5e1"
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
if (e === "Doorway") {
|
|
65
|
+
let e = new g.BoxGeometry(1.05, 3, .24);
|
|
66
|
+
e.translate(-.975, 1.5, 0);
|
|
67
|
+
let t = new g.BoxGeometry(1.05, 3, .24);
|
|
68
|
+
t.translate(.975, 1.5, 0);
|
|
69
|
+
let n = new g.BoxGeometry(.9, .9, .24);
|
|
70
|
+
n.translate(0, 2.55, 0);
|
|
71
|
+
let r = w([
|
|
72
|
+
e,
|
|
73
|
+
t,
|
|
74
|
+
n
|
|
75
|
+
], !1);
|
|
76
|
+
return e.dispose(), t.dispose(), n.dispose(), {
|
|
77
|
+
geo: r,
|
|
78
|
+
color: "#94a3b8"
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
if (e === "DoorLeaf") {
|
|
82
|
+
let e = new g.BoxGeometry(.9, 2.1, .1);
|
|
83
|
+
return e.translate(0, 1.05, 0), {
|
|
84
|
+
geo: e,
|
|
85
|
+
color: "#d97706"
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
if (e === "Stairs") {
|
|
89
|
+
let e = new g.BoxGeometry(1.4, .24, 3.8);
|
|
90
|
+
return e.rotateX(-Math.PI / 4), e.translate(0, 1.5, 0), {
|
|
91
|
+
geo: e,
|
|
92
|
+
color: "#a16207"
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
if (e === "Roof") {
|
|
96
|
+
let e = new g.BoxGeometry(3.16, .26, 3.16);
|
|
97
|
+
return e.translate(0, .13, 0), {
|
|
98
|
+
geo: e,
|
|
99
|
+
color: "#be123c"
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
let t = new g.BoxGeometry(3, .2, 3);
|
|
103
|
+
return t.translate(0, .1, 0), {
|
|
104
|
+
geo: t,
|
|
105
|
+
color: "#94a3b8"
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
function k({ matrices: e, count: t, geo: n, mat: r }) {
|
|
109
|
+
let i = h(null);
|
|
110
|
+
return p(() => {
|
|
111
|
+
let t = i.current;
|
|
112
|
+
t && (t.instanceMatrix.array.set(e), t.instanceMatrix.needsUpdate = !0, t.computeBoundingSphere());
|
|
113
|
+
}, [e, t]), /* @__PURE__ */ _("instancedMesh", {
|
|
114
|
+
ref: i,
|
|
115
|
+
args: [
|
|
116
|
+
n,
|
|
117
|
+
r,
|
|
118
|
+
t
|
|
119
|
+
],
|
|
120
|
+
frustumCulled: !1
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
function A({ seed: u = 77, size: p = 960, segments: h = 160, settlementTier: w = "town", offX: T = 0, offZ: D = 0 }) {
|
|
124
|
+
let A = m(() => E(u, p), [u, p]), { spurs: j, junctions: M } = m(() => s(A, 2), [A]), N = m(() => i(A, 256, j), [A, j]), P = m(() => a(A.terrain, A.size, h), [A, h]), F = m(() => o(A.road, { tJunctions: M }), [A, M]), I = m(() => j.map((e) => o(e, { crownHeight: .03 })), [j]), L = m(() => S(A.road, w, u), [
|
|
125
|
+
A,
|
|
126
|
+
w,
|
|
127
|
+
u
|
|
128
|
+
]), R = m(() => x(L.pieces), [L]), z = m(() => new g.PlaneGeometry(A.size * 1.8, A.size * 1.8), [A.size]), B = m(() => {
|
|
129
|
+
let i = n(N), { material: a, depthMaterial: o } = t(i, {
|
|
130
|
+
ditherTexelsPerMeter: 16,
|
|
131
|
+
ps2ColorQuantize: .85
|
|
132
|
+
}), { material: s } = e(i, {
|
|
133
|
+
preset: "ASPHALT",
|
|
134
|
+
ditherTexelsPerMeter: 16,
|
|
135
|
+
ps2ColorQuantize: .85
|
|
136
|
+
}), { material: c } = e(i, {
|
|
137
|
+
preset: "DIRT",
|
|
138
|
+
ditherTexelsPerMeter: 16,
|
|
139
|
+
ps2ColorQuantize: .85
|
|
140
|
+
}), l = new g.MeshLambertMaterial({
|
|
141
|
+
color: "#125274",
|
|
142
|
+
transparent: !0,
|
|
143
|
+
opacity: .84,
|
|
144
|
+
fog: !0
|
|
145
|
+
}), u = new g.MeshLambertMaterial({
|
|
146
|
+
color: "#2d4c24",
|
|
147
|
+
flatShading: !0,
|
|
148
|
+
fog: !0
|
|
149
|
+
});
|
|
150
|
+
return r(u, { flatShading: !0 }), {
|
|
151
|
+
tex: i,
|
|
152
|
+
terrainMat: a,
|
|
153
|
+
terrainDepthMat: o,
|
|
154
|
+
asphaltMat: s,
|
|
155
|
+
dirtMat: c,
|
|
156
|
+
waterMat: l,
|
|
157
|
+
treeMat: u
|
|
158
|
+
};
|
|
159
|
+
}, [N]), V = m(() => {
|
|
160
|
+
let e = /* @__PURE__ */ new Map();
|
|
161
|
+
for (let t of R) {
|
|
162
|
+
let { geo: n, color: i } = O(t.kind), a = new g.MeshStandardMaterial({
|
|
163
|
+
color: i,
|
|
164
|
+
roughness: .82,
|
|
165
|
+
flatShading: !0
|
|
166
|
+
});
|
|
167
|
+
r(a, { flatShading: !0 }), e.set(t.kind, {
|
|
168
|
+
geo: n,
|
|
169
|
+
mat: a
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
return e;
|
|
173
|
+
}, [R]), H = m(() => {
|
|
174
|
+
let e = l(c(u, "island-trees")), t = [], n = new g.Object3D(), r = L.buildings.map((e) => ({
|
|
175
|
+
p: C(e.pose).position,
|
|
176
|
+
r: Math.hypot(e.width, e.depth) * 2.2
|
|
177
|
+
}));
|
|
178
|
+
for (let i = 0; i < 950 && t.length < 3520; i++) {
|
|
179
|
+
let i = (e() - .5) * A.size * .82, a = (e() - .5) * A.size * .82, o = A.terrain.height(i, a);
|
|
180
|
+
if (o < A.waterLevel + 2.4 || o > 40 || A.terrain.roadMask(i, a).exclude || r.some((e) => Math.hypot(i - e.p[0], a - e.p[2]) < e.r)) continue;
|
|
181
|
+
let s = .85 + e() * .8;
|
|
182
|
+
n.position.set(i, o + 2.1 * s, a), n.rotation.set(0, e() * Math.PI * 2, 0), n.scale.set(s, s, s), n.updateMatrix(), t.push(...n.matrix.elements);
|
|
183
|
+
}
|
|
184
|
+
return {
|
|
185
|
+
geo: new g.ConeGeometry(1.5, 4.6, 6),
|
|
186
|
+
matrices: new Float32Array(t),
|
|
187
|
+
count: t.length / 16
|
|
188
|
+
};
|
|
189
|
+
}, [
|
|
190
|
+
A,
|
|
191
|
+
L,
|
|
192
|
+
u
|
|
193
|
+
]);
|
|
194
|
+
return f(() => () => {
|
|
195
|
+
B.terrainMat.dispose(), B.terrainDepthMat.dispose(), B.asphaltMat.dispose(), B.dirtMat.dispose(), B.waterMat.dispose(), B.treeMat.dispose(), B.tex.dispose(), P.geometry.dispose(), F.geometry.dispose(), I.forEach((e) => e.geometry.dispose()), H.geo.dispose(), z.dispose();
|
|
196
|
+
for (let e of V.values()) e.geo.dispose(), e.mat.dispose();
|
|
197
|
+
}, [
|
|
198
|
+
B,
|
|
199
|
+
P,
|
|
200
|
+
F,
|
|
201
|
+
I,
|
|
202
|
+
H,
|
|
203
|
+
z,
|
|
204
|
+
V
|
|
205
|
+
]), /* @__PURE__ */ v("group", { children: [
|
|
206
|
+
/* @__PURE__ */ _("fogExp2", {
|
|
207
|
+
attach: "fog",
|
|
208
|
+
args: [10335428, .00145]
|
|
209
|
+
}),
|
|
210
|
+
/* @__PURE__ */ _("hemisphereLight", { args: [
|
|
211
|
+
11059416,
|
|
212
|
+
5392440,
|
|
213
|
+
.72
|
|
214
|
+
] }),
|
|
215
|
+
/* @__PURE__ */ v(d, {
|
|
216
|
+
x: T,
|
|
217
|
+
z: D,
|
|
218
|
+
friction: .9,
|
|
219
|
+
children: [/* @__PURE__ */ _(b, { args: [P.colliderVertices, P.colliderIndices] }), /* @__PURE__ */ _("mesh", {
|
|
220
|
+
geometry: P.geometry,
|
|
221
|
+
material: B.terrainMat,
|
|
222
|
+
customDepthMaterial: B.terrainDepthMat,
|
|
223
|
+
castShadow: !0,
|
|
224
|
+
receiveShadow: !0
|
|
225
|
+
})]
|
|
226
|
+
}),
|
|
227
|
+
/* @__PURE__ */ v(d, {
|
|
228
|
+
x: T,
|
|
229
|
+
z: D,
|
|
230
|
+
friction: 1.05,
|
|
231
|
+
children: [/* @__PURE__ */ _(b, { args: [F.colliderVertices, F.colliderIndices] }), /* @__PURE__ */ _("mesh", {
|
|
232
|
+
geometry: F.geometry,
|
|
233
|
+
material: B.asphaltMat,
|
|
234
|
+
receiveShadow: !0
|
|
235
|
+
})]
|
|
236
|
+
}),
|
|
237
|
+
I.map((e, t) => /* @__PURE__ */ v(d, {
|
|
238
|
+
x: T,
|
|
239
|
+
z: D,
|
|
240
|
+
friction: .85,
|
|
241
|
+
children: [/* @__PURE__ */ _(b, { args: [e.colliderVertices, e.colliderIndices] }), /* @__PURE__ */ _("mesh", {
|
|
242
|
+
geometry: e.geometry,
|
|
243
|
+
material: B.dirtMat,
|
|
244
|
+
receiveShadow: !0
|
|
245
|
+
})]
|
|
246
|
+
}, `spur_${t}`)),
|
|
247
|
+
/* @__PURE__ */ _(d, {
|
|
248
|
+
x: T,
|
|
249
|
+
z: D,
|
|
250
|
+
children: L.buildings.map((e) => {
|
|
251
|
+
let { position: t, yaw: n } = C(e.pose);
|
|
252
|
+
return /* @__PURE__ */ _(y, {
|
|
253
|
+
position: [
|
|
254
|
+
t[0],
|
|
255
|
+
t[1] + e.storeys * 1.5,
|
|
256
|
+
t[2]
|
|
257
|
+
],
|
|
258
|
+
rotation: [
|
|
259
|
+
0,
|
|
260
|
+
n,
|
|
261
|
+
0
|
|
262
|
+
],
|
|
263
|
+
args: [
|
|
264
|
+
e.width * 1.5,
|
|
265
|
+
e.storeys * 1.5,
|
|
266
|
+
e.depth * 1.5
|
|
267
|
+
]
|
|
268
|
+
}, e.id);
|
|
269
|
+
})
|
|
270
|
+
}),
|
|
271
|
+
/* @__PURE__ */ v("group", {
|
|
272
|
+
position: [
|
|
273
|
+
T,
|
|
274
|
+
0,
|
|
275
|
+
D
|
|
276
|
+
],
|
|
277
|
+
children: [
|
|
278
|
+
/* @__PURE__ */ _("mesh", {
|
|
279
|
+
position: [
|
|
280
|
+
0,
|
|
281
|
+
A.waterLevel,
|
|
282
|
+
0
|
|
283
|
+
],
|
|
284
|
+
rotation: [
|
|
285
|
+
-Math.PI * .5,
|
|
286
|
+
0,
|
|
287
|
+
0
|
|
288
|
+
],
|
|
289
|
+
geometry: z,
|
|
290
|
+
material: B.waterMat
|
|
291
|
+
}),
|
|
292
|
+
R.map((e) => {
|
|
293
|
+
let t = V.get(e.kind);
|
|
294
|
+
return /* @__PURE__ */ _(k, {
|
|
295
|
+
matrices: e.matrices,
|
|
296
|
+
count: e.count,
|
|
297
|
+
geo: t.geo,
|
|
298
|
+
mat: t.mat
|
|
299
|
+
}, e.kind);
|
|
300
|
+
}),
|
|
301
|
+
H.count > 0 && /* @__PURE__ */ _(k, {
|
|
302
|
+
matrices: H.matrices,
|
|
303
|
+
count: H.count,
|
|
304
|
+
geo: H.geo,
|
|
305
|
+
mat: B.treeMat
|
|
306
|
+
})
|
|
307
|
+
]
|
|
308
|
+
})
|
|
309
|
+
] });
|
|
310
|
+
}
|
|
311
|
+
export { A as KolmoIsland, D as computeIslandSpawnPose, E as getCachedIslandPlan };
|