@threenative/terrain 0.1.11 → 0.1.12
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 +1 -0
- package/dist/bake-DJ5cxg0C.d.ts +82 -0
- package/dist/editor/index.d.ts +4 -4
- package/dist/editor/index.js +1 -1
- package/dist/editor/server.d.ts +2 -2
- package/dist/editor/worker.d.ts +1 -1
- package/dist/editor/worker.js +1 -1
- package/dist/export.d.ts +1 -1
- package/dist/index.d.ts +51 -222
- package/dist/index.js +111 -2
- package/dist/kit-world.d.ts +107 -0
- package/dist/kit-world.js +5134 -0
- package/dist/kit.d.ts +21 -4
- package/dist/kit.js +19 -4
- package/dist/mcp/cook-child.js +9 -6
- package/dist/mcp/server.js +14 -4
- package/dist/prop-package-Dwz0EWoB.d.ts +141 -0
- package/dist/{server-B5RdvEAC.d.ts → server-LnFwY8sr.d.ts} +1 -1
- package/dist/starter.d.ts +1141 -6
- package/dist/starter.js +1999 -17
- package/dist/{terrain-CAEaW0mQ.d.ts → terrain-DYCyAOCJ.d.ts} +1 -1
- package/dist/three.d.ts +1 -1
- package/dist/{types-BpH00qsx.d.ts → types-kpI0C4hW.d.ts} +1 -1
- package/dist/{world-package-B8QgHjAQ.d.ts → world-package-DqJC3-Nn.d.ts} +2 -2
- package/docs/authoring/new-environment.md +97 -0
- package/package.json +8 -8
- package/starter/alpine/README.md +22 -14
- package/starter/alpine/bake.mjs +14 -1
- package/starter/alpine/biome.data.json +187 -25
- package/starter/alpine/heightmap.r16 +0 -0
- package/starter/alpine/playerRig.ts +89 -0
- package/starter/alpine/recipe.json +169 -15
- package/starter/alpine/render/bakedFile.ts +17 -0
- package/starter/alpine/render/benchmark.ts +77 -0
- package/starter/alpine/render/biomeData.ts +14 -0
- package/starter/alpine/render/biomes.ts +687 -0
- package/starter/alpine/render/ground/cover.ts +565 -0
- package/starter/alpine/render/ground/horizon.ts +219 -0
- package/starter/alpine/render/ground/palette.d.ts +1 -0
- package/starter/alpine/render/ground/palette.js +11 -0
- package/starter/alpine/render/ground/scatter.ts +104 -0
- package/starter/alpine/render/ground/terrain.ts +1860 -0
- package/starter/alpine/render/kitAssets.ts +28 -0
- package/starter/alpine/render/loading.ts +354 -0
- package/starter/alpine/render/lookKnobs.ts +37 -0
- package/starter/alpine/render/orbitCamera.ts +155 -0
- package/starter/alpine/render/props/farForest.ts +94 -0
- package/starter/alpine/render/props/pack.ts +1114 -0
- package/starter/alpine/render/props/prepared.ts +225 -0
- package/starter/alpine/render/props/propMaterials.ts +1239 -0
- package/starter/alpine/render/props/propProgress.ts +2 -0
- package/starter/alpine/render/props/propWorld.ts +105 -0
- package/starter/alpine/render/props/props.ts +633 -0
- package/starter/alpine/render/props/spruce.ts +440 -0
- package/starter/alpine/render/sky/atmosphere.ts +329 -0
- package/starter/alpine/render/sky/sky.ts +382 -0
- package/starter/alpine/render/texturePreparation.ts +135 -0
- package/starter/alpine/render/water/river.ts +1132 -0
- package/starter/alpine/render/worldNames.ts +6 -0
- package/starter/alpine/scene.ts +715 -0
- package/starter/alpine/sceneProps.ts +561 -0
- package/starter/alpine/sceneState.ts +33 -0
- package/starter/alpine/world/terrainAssets.ts +145 -0
- package/starter/alpine/world/walkBand.ts +47 -0
- package/starter/alpine/world/water.ts +74 -0
- package/starter/alpine/worlds.ts +13 -0
- package/starter/coastal/README.md +26 -27
- package/starter/coastal/assets.json +10 -0
- package/starter/coastal/bake.mjs +14 -1
- package/starter/coastal/biome.data.json +18 -3
- package/starter/coastal/playerRig.ts +89 -0
- package/starter/coastal/recipe.json +220 -18
- package/starter/coastal/render/bakedFile.ts +17 -0
- package/starter/coastal/render/benchmark.ts +81 -0
- package/starter/coastal/render/biomeData.ts +14 -0
- package/starter/coastal/render/biomes.ts +678 -0
- package/starter/coastal/render/ground/cover.ts +565 -0
- package/starter/coastal/render/ground/horizon.ts +219 -0
- package/starter/coastal/render/ground/palette.d.ts +1 -0
- package/starter/coastal/render/ground/palette.js +11 -0
- package/starter/coastal/render/ground/scatter.ts +104 -0
- package/starter/coastal/render/ground/terrain.ts +1829 -0
- package/starter/coastal/render/kitAssets.ts +28 -0
- package/starter/coastal/render/loading.ts +354 -0
- package/starter/coastal/render/lookKnobs.ts +37 -0
- package/starter/coastal/render/orbitCamera.ts +155 -0
- package/starter/coastal/render/props/farForest.ts +94 -0
- package/starter/coastal/render/props/pack.ts +1109 -0
- package/starter/coastal/render/props/prepared.ts +225 -0
- package/starter/coastal/render/props/propMaterials.ts +1239 -0
- package/starter/coastal/render/props/propProgress.ts +2 -0
- package/starter/coastal/render/props/propWorld.ts +105 -0
- package/starter/coastal/render/props/props.ts +633 -0
- package/starter/coastal/render/props/spruce.ts +440 -0
- package/starter/coastal/render/sky/atmosphere.ts +329 -0
- package/starter/coastal/render/sky/sky.ts +382 -0
- package/starter/coastal/render/texturePreparation.ts +135 -0
- package/starter/coastal/render/water/ocean.ts +284 -0
- package/starter/coastal/render/water/river.ts +1132 -0
- package/starter/coastal/render/worldNames.ts +6 -0
- package/starter/coastal/scene.ts +740 -0
- package/starter/coastal/sceneProps.ts +559 -0
- package/starter/coastal/sceneState.ts +33 -0
- package/starter/coastal/world/terrainAssets.ts +151 -0
- package/starter/coastal/world/walkBand.ts +47 -0
- package/starter/coastal/world/water.ts +74 -0
- package/starter/coastal/worlds.ts +13 -0
- package/starter/desert/README.md +51 -25
- package/starter/desert/bake-flora.mjs +142 -0
- package/starter/desert/bake-rocks.mjs +291 -0
- package/starter/desert/bake.mjs +14 -1
- package/starter/desert/biome.data.json +24 -12
- package/starter/desert/playerRig.ts +89 -0
- package/starter/desert/recipe.json +63 -16
- package/starter/desert/render/bakedFile.ts +17 -0
- package/starter/desert/render/benchmark.ts +79 -0
- package/starter/desert/render/biomeData.ts +14 -0
- package/starter/desert/render/biomes.ts +660 -0
- package/starter/desert/render/ground/cover.ts +565 -0
- package/starter/desert/render/ground/debris.ts +136 -0
- package/starter/desert/render/ground/horizon.ts +219 -0
- package/starter/desert/render/ground/palette.d.ts +1 -0
- package/starter/desert/render/ground/palette.js +11 -0
- package/starter/desert/render/ground/scatter.ts +104 -0
- package/starter/desert/render/ground/terrain.ts +1854 -0
- package/starter/desert/render/kitAssets.ts +28 -0
- package/starter/desert/render/loading.ts +354 -0
- package/starter/desert/render/lookKnobs.ts +37 -0
- package/starter/desert/render/orbitCamera.ts +155 -0
- package/starter/desert/render/props/farForest.ts +96 -0
- package/starter/desert/render/props/formations.ts +630 -0
- package/starter/desert/render/props/pack.ts +1195 -0
- package/starter/desert/render/props/prepared.ts +225 -0
- package/starter/desert/render/props/propMaterials.ts +1255 -0
- package/starter/desert/render/props/propProgress.ts +2 -0
- package/starter/desert/render/props/propWorld.ts +105 -0
- package/starter/desert/render/props/props.ts +624 -0
- package/starter/desert/render/props/spruce.ts +440 -0
- package/starter/desert/render/sand.ts +581 -0
- package/starter/desert/render/sky/atmosphere.ts +329 -0
- package/starter/desert/render/sky/sky.ts +382 -0
- package/starter/desert/render/texturePreparation.ts +135 -0
- package/starter/desert/render/water/river.ts +1132 -0
- package/starter/desert/render/worldNames.ts +6 -0
- package/starter/desert/scene.ts +748 -0
- package/starter/desert/sceneProps.ts +562 -0
- package/starter/desert/sceneState.ts +33 -0
- package/starter/desert/world/terrainAssets.ts +162 -0
- package/starter/desert/world/walkBand.ts +47 -0
- package/starter/desert/world/water.ts +74 -0
- package/starter/desert/worlds.ts +13 -0
- package/starter/forest/README.md +8 -5
- package/starter/forest/bake.mjs +21 -413
- package/starter/forest/playerRig.ts +37 -171
- package/starter/forest/recipe.json +237 -47
- package/starter/forest/render/biomes.ts +2 -1
- package/starter/forest/render/ground/horizon.ts +4 -302
- package/starter/forest/render/ground/terrain.ts +14 -32
- package/starter/forest/render/kitAssets.ts +3 -2
- package/starter/forest/render/props/farForest.ts +2 -1
- package/starter/forest/render/props/pack.ts +4 -2
- package/starter/forest/render/props/prepared.ts +2 -1
- package/starter/forest/render/props/propProgress.ts +1 -11
- package/starter/forest/render/props/propWorld.ts +48 -662
- package/starter/forest/render/props/props.ts +64 -248
- package/starter/forest/render/sky/sky.ts +2 -1
- package/starter/forest/render/worldNames.ts +6 -2
- package/starter/forest/scene.ts +34 -25
- package/starter/forest/sceneProps.ts +2 -2
- package/starter/forest/sceneState.ts +5 -4
- package/starter/forest/surface.json +2 -2
- package/starter/forest/worlds.ts +3 -2
- package/starter/tundra/README.md +35 -16
- package/starter/tundra/bake.mjs +14 -1
- package/starter/tundra/biome.data.json +6 -6
- package/starter/tundra/playerRig.ts +89 -0
- package/starter/tundra/recipe.json +111 -110
- package/starter/tundra/render/bakedFile.ts +17 -0
- package/starter/tundra/render/benchmark.ts +79 -0
- package/starter/tundra/render/biomeData.ts +14 -0
- package/starter/tundra/render/biomes.ts +714 -0
- package/starter/tundra/render/ground/cover.ts +565 -0
- package/starter/tundra/render/ground/horizon.ts +219 -0
- package/starter/tundra/render/ground/palette.d.ts +1 -0
- package/starter/tundra/render/ground/palette.js +11 -0
- package/starter/tundra/render/ground/scatter.ts +104 -0
- package/starter/tundra/render/ground/terrain.ts +1874 -0
- package/starter/tundra/render/kitAssets.ts +28 -0
- package/starter/tundra/render/loading.ts +354 -0
- package/starter/tundra/render/lookKnobs.ts +37 -0
- package/starter/tundra/render/orbitCamera.ts +155 -0
- package/starter/tundra/render/props/farForest.ts +96 -0
- package/starter/tundra/render/props/pack.ts +1088 -0
- package/starter/tundra/render/props/prepared.ts +225 -0
- package/starter/tundra/render/props/propMaterials.ts +1247 -0
- package/starter/tundra/render/props/propProgress.ts +2 -0
- package/starter/tundra/render/props/propWorld.ts +105 -0
- package/starter/tundra/render/props/props.ts +624 -0
- package/starter/tundra/render/props/spruce.ts +440 -0
- package/starter/tundra/render/sky/atmosphere.ts +329 -0
- package/starter/tundra/render/sky/sky.ts +382 -0
- package/starter/tundra/render/texturePreparation.ts +135 -0
- package/starter/tundra/render/water/river.ts +1132 -0
- package/starter/tundra/render/worldNames.ts +6 -0
- package/starter/tundra/scene.ts +715 -0
- package/starter/tundra/sceneProps.ts +559 -0
- package/starter/tundra/sceneState.ts +33 -0
- package/starter/tundra/world/terrainAssets.ts +159 -0
- package/starter/tundra/world/walkBand.ts +47 -0
- package/starter/tundra/world/water.ts +74 -0
- package/starter/tundra/worlds.ts +13 -0
- package/starter-assets.json +4 -4
- package/starter-credits.json +613 -10
- package/starter/forest/diagnostics.ts +0 -1020
- package/starter/forest/render/sky/skyVisibility.ts +0 -121
- package/starter/forest/spawnGate.ts +0 -183
- package/starter/forest/viewStatistics.ts +0 -47
- package/starter/forest/world/streamedGround.ts +0 -139
package/starter/tundra/bake.mjs
CHANGED
|
@@ -1,6 +1,19 @@
|
|
|
1
1
|
// Run with [--assets <dir>] [--out <dir>]; defaults to installed assets and ./world.
|
|
2
|
+
// The tundra kit's look: its palette, its ground maps, its canopy rows and its prop policy.
|
|
2
3
|
import { bakeKit } from "@threenative/terrain/kit";
|
|
4
|
+
import { register } from "tsx/esm/api";
|
|
5
|
+
|
|
6
|
+
register();
|
|
7
|
+
const { terrainPalette } = await import("./render/ground/palette.js");
|
|
8
|
+
const { GROUND_MAPS, GROUND_TILE } = await import("./world/terrainAssets.ts");
|
|
9
|
+
const { CANOPY_CROWN } = await import("./render/ground/terrain.ts");
|
|
10
|
+
const props = await import("./render/props/props.ts");
|
|
3
11
|
|
|
4
12
|
await bakeKit(import.meta.url, {
|
|
5
|
-
|
|
13
|
+
look: {
|
|
14
|
+
palette: terrainPalette,
|
|
15
|
+
ground: { maps: GROUND_MAPS, tile: GROUND_TILE },
|
|
16
|
+
canopy: CANOPY_CROWN,
|
|
17
|
+
props,
|
|
18
|
+
},
|
|
6
19
|
});
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"seed": 466468,
|
|
14
14
|
"attempts": 80000,
|
|
15
15
|
"stoneRadius": 1.9,
|
|
16
|
-
"clearings": [[
|
|
16
|
+
"clearings": [[150, 205, 10]],
|
|
17
17
|
"understorey": {
|
|
18
18
|
"attempts": 14000,
|
|
19
19
|
"litter": 1,
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"foliage": [
|
|
29
29
|
{
|
|
30
30
|
"species": "sapling",
|
|
31
|
-
"density":
|
|
31
|
+
"density": 140,
|
|
32
32
|
"slope": [0, 32],
|
|
33
33
|
"height": null,
|
|
34
34
|
"spacing": [3.4, 3.4],
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"density": 1,
|
|
46
46
|
"slope": [0, 30],
|
|
47
47
|
"height": null,
|
|
48
|
-
"spacing": 1.
|
|
48
|
+
"spacing": 1.1,
|
|
49
49
|
"slopeFalloff": 22,
|
|
50
50
|
"heightFalloff": 28,
|
|
51
51
|
"mats": [0.47, 0.3],
|
|
@@ -132,10 +132,10 @@
|
|
|
132
132
|
}
|
|
133
133
|
],
|
|
134
134
|
"spawn": {
|
|
135
|
-
"at": [
|
|
135
|
+
"at": [150, 205],
|
|
136
136
|
"cameraOffset": [28, 24, 42],
|
|
137
|
-
"focus": [150,
|
|
137
|
+
"focus": [150, 205]
|
|
138
138
|
},
|
|
139
|
-
"species": ["boulder", "bush", "riverrock", "sapling", "scree", "scrub"],
|
|
139
|
+
"species": ["boulder", "bush", "grass", "riverrock", "sapling", "scree", "scrub"],
|
|
140
140
|
"aliases": ["tundra", "arctic", "ice", "frozen", "permafrost", "glacial"]
|
|
141
141
|
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import type { Heightfield } from "@threenative/core/world";
|
|
2
|
+
import {
|
|
3
|
+
type IMannequin,
|
|
4
|
+
type IPlayerRig,
|
|
5
|
+
type PlayerWallProbe,
|
|
6
|
+
createPlayerRig as createRig,
|
|
7
|
+
} from "@threenative/terrain/starter";
|
|
8
|
+
import { type AnimationClip, Vector3 } from "three";
|
|
9
|
+
import { CAMERA_RIG, type WallProbe, createOrbitCamera } from "./render/orbitCamera.js";
|
|
10
|
+
import { SIGHT_RADIUS, sightLine } from "./render/props/pack.js";
|
|
11
|
+
import type { TerrainCtx } from "./sceneState.js";
|
|
12
|
+
|
|
13
|
+
export type { IMannequin, IPlayerRig };
|
|
14
|
+
export type { WallProbe };
|
|
15
|
+
|
|
16
|
+
/** The starter kit's mannequin (Quaternius Universal Animation Library, CC0) and its clips. */
|
|
17
|
+
const CLIPS = {
|
|
18
|
+
idle: "Idle_Loop",
|
|
19
|
+
walk: "Walk_Loop",
|
|
20
|
+
run: "Jog_Fwd_Loop",
|
|
21
|
+
fall: "Jump_Loop",
|
|
22
|
+
swim: "Swim_Fwd_Loop",
|
|
23
|
+
tread: "Swim_Idle_Loop",
|
|
24
|
+
} as const;
|
|
25
|
+
/** Ground speeds in m/s: the walk clip's pace, the jog, and the Shift sprint. */
|
|
26
|
+
const STRIDE = 1.8;
|
|
27
|
+
const JOG = 6;
|
|
28
|
+
const SPRINT = 9;
|
|
29
|
+
|
|
30
|
+
export interface IPlayerRigOptions {
|
|
31
|
+
readonly world: string;
|
|
32
|
+
/** The player's launch point, in world metres. */
|
|
33
|
+
readonly at: readonly [number, number];
|
|
34
|
+
/** Where the launch camera stands relative to the player: above the ground under the spawn. */
|
|
35
|
+
readonly cameraOffset: readonly [number, number, number];
|
|
36
|
+
/** The ground the spawn stands on: the launch pose is measured from it, not guessed. */
|
|
37
|
+
readonly field: Heightfield;
|
|
38
|
+
readonly mannequin: IMannequin;
|
|
39
|
+
/** The rig's two swim clips, which the mannequin's own clips do not carry. */
|
|
40
|
+
readonly swimClips: readonly AnimationClip[];
|
|
41
|
+
/** A staged world streams its own ground, so the player walks only while the player view draws. */
|
|
42
|
+
readonly staged: boolean;
|
|
43
|
+
/** A vista look frames the player from a fixed aim instead of the orbit camera. */
|
|
44
|
+
readonly vista: boolean;
|
|
45
|
+
/** Centres the sun's shadow pages, or clears them when no player framing draws. */
|
|
46
|
+
readonly focusShadows: (at: Vector3 | undefined) => void;
|
|
47
|
+
/** The horizon seam the scene draws under the player, for the scene picker's report. */
|
|
48
|
+
readonly horizon: () => unknown;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* The player: the package's capsule and clip state machine, this kit's mannequin, gait data and
|
|
53
|
+
* orbit camera. The follow camera and the wall probe stay here because the arm's framing and the
|
|
54
|
+
* sight line are look decisions of this game.
|
|
55
|
+
*/
|
|
56
|
+
export function createPlayerRig(ctx: TerrainCtx, options: IPlayerRigOptions): IPlayerRig {
|
|
57
|
+
const { at, cameraOffset, field, focusShadows, horizon, mannequin, staged, swimClips, vista } =
|
|
58
|
+
options;
|
|
59
|
+
// The terrain and the prop colliders are the camera's walls; both answer on the kit's ground lens.
|
|
60
|
+
const along = new Vector3();
|
|
61
|
+
const probe: WallProbe = (from, to) =>
|
|
62
|
+
along.subVectors(to, from).lengthSq() < 1e-8
|
|
63
|
+
? undefined
|
|
64
|
+
: ctx.physics.directSpaceState.intersectRay({
|
|
65
|
+
...(staged ? {} : { collisionMask: 4 }),
|
|
66
|
+
from,
|
|
67
|
+
to,
|
|
68
|
+
})?.distance;
|
|
69
|
+
const camera = createOrbitCamera(ctx.camera);
|
|
70
|
+
return createRig({
|
|
71
|
+
ctx,
|
|
72
|
+
at,
|
|
73
|
+
field,
|
|
74
|
+
mannequin,
|
|
75
|
+
clips: CLIPS,
|
|
76
|
+
swimClips,
|
|
77
|
+
cameraOffset,
|
|
78
|
+
collisionMask: staged ? undefined : 4,
|
|
79
|
+
gait: { stride: STRIDE, run: JOG, sprint: SPRINT },
|
|
80
|
+
camera,
|
|
81
|
+
probe: probe as PlayerWallProbe,
|
|
82
|
+
following: () => !vista && ctx.state.getState().view === "player",
|
|
83
|
+
aimHeight: CAMERA_RIG.aimHeight,
|
|
84
|
+
// The vision line the camera aims: the player's own eye line at the prop pack's sight radius.
|
|
85
|
+
sight: { aim: sightLine.aim, radius: sightLine.radius, radiusValue: SIGHT_RADIUS },
|
|
86
|
+
focusShadows,
|
|
87
|
+
horizon,
|
|
88
|
+
});
|
|
89
|
+
}
|
|
@@ -57,10 +57,7 @@
|
|
|
57
57
|
"id": "near-kettle-bed",
|
|
58
58
|
"type": "flatten",
|
|
59
59
|
"params": {
|
|
60
|
-
"at": [
|
|
61
|
-
65,
|
|
62
|
-
80
|
|
63
|
-
],
|
|
60
|
+
"at": [65, 80],
|
|
64
61
|
"radius": 30,
|
|
65
62
|
"height": 27,
|
|
66
63
|
"falloff": 0.65
|
|
@@ -72,10 +69,7 @@
|
|
|
72
69
|
"id": "far-kettle-bed",
|
|
73
70
|
"type": "flatten",
|
|
74
71
|
"params": {
|
|
75
|
-
"at": [
|
|
76
|
-
-65,
|
|
77
|
-
-50
|
|
78
|
-
],
|
|
72
|
+
"at": [-65, -50],
|
|
79
73
|
"radius": 42,
|
|
80
74
|
"height": 28,
|
|
81
75
|
"falloff": 0.65
|
|
@@ -88,61 +82,17 @@
|
|
|
88
82
|
"type": "river",
|
|
89
83
|
"params": {
|
|
90
84
|
"points": [
|
|
91
|
-
[
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
],
|
|
96
|
-
[
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
],
|
|
101
|
-
[
|
|
102
|
-
-100,
|
|
103
|
-
30,
|
|
104
|
-
-90
|
|
105
|
-
],
|
|
106
|
-
[
|
|
107
|
-
-65,
|
|
108
|
-
30,
|
|
109
|
-
-50
|
|
110
|
-
],
|
|
111
|
-
[
|
|
112
|
-
-30,
|
|
113
|
-
30,
|
|
114
|
-
-15
|
|
115
|
-
],
|
|
116
|
-
[
|
|
117
|
-
0,
|
|
118
|
-
29.3,
|
|
119
|
-
5
|
|
120
|
-
],
|
|
121
|
-
[
|
|
122
|
-
38,
|
|
123
|
-
28.8,
|
|
124
|
-
47
|
|
125
|
-
],
|
|
126
|
-
[
|
|
127
|
-
65,
|
|
128
|
-
28.8,
|
|
129
|
-
80
|
|
130
|
-
],
|
|
131
|
-
[
|
|
132
|
-
100,
|
|
133
|
-
28.8,
|
|
134
|
-
100
|
|
135
|
-
],
|
|
136
|
-
[
|
|
137
|
-
160,
|
|
138
|
-
27,
|
|
139
|
-
140
|
|
140
|
-
],
|
|
141
|
-
[
|
|
142
|
-
250,
|
|
143
|
-
26,
|
|
144
|
-
150
|
|
145
|
-
]
|
|
85
|
+
[-210, 36, -135],
|
|
86
|
+
[-125, 33, -80],
|
|
87
|
+
[-100, 30, -90],
|
|
88
|
+
[-65, 30, -50],
|
|
89
|
+
[-30, 30, -15],
|
|
90
|
+
[0, 29.3, 5],
|
|
91
|
+
[38, 28.8, 47],
|
|
92
|
+
[65, 28.8, 80],
|
|
93
|
+
[100, 28.8, 100],
|
|
94
|
+
[160, 27, 140],
|
|
95
|
+
[250, 26, 150]
|
|
146
96
|
],
|
|
147
97
|
"width": 7,
|
|
148
98
|
"depth": 1.5,
|
|
@@ -157,31 +107,11 @@
|
|
|
157
107
|
"type": "river",
|
|
158
108
|
"params": {
|
|
159
109
|
"points": [
|
|
160
|
-
[
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
]
|
|
165
|
-
[
|
|
166
|
-
-40,
|
|
167
|
-
30,
|
|
168
|
-
-18
|
|
169
|
-
],
|
|
170
|
-
[
|
|
171
|
-
-30,
|
|
172
|
-
29.4,
|
|
173
|
-
40
|
|
174
|
-
],
|
|
175
|
-
[
|
|
176
|
-
15,
|
|
177
|
-
28.8,
|
|
178
|
-
105
|
|
179
|
-
],
|
|
180
|
-
[
|
|
181
|
-
65,
|
|
182
|
-
28.8,
|
|
183
|
-
80
|
|
184
|
-
]
|
|
110
|
+
[-65, 30, -50],
|
|
111
|
+
[-40, 30, -18],
|
|
112
|
+
[-30, 29.4, 40],
|
|
113
|
+
[15, 28.8, 105],
|
|
114
|
+
[65, 28.8, 80]
|
|
185
115
|
],
|
|
186
116
|
"width": 4,
|
|
187
117
|
"depth": 1.2,
|
|
@@ -196,10 +126,7 @@
|
|
|
196
126
|
"type": "water",
|
|
197
127
|
"params": {
|
|
198
128
|
"kind": "lake",
|
|
199
|
-
"at": [
|
|
200
|
-
65,
|
|
201
|
-
80
|
|
202
|
-
],
|
|
129
|
+
"at": [65, 80],
|
|
203
130
|
"radius": 34,
|
|
204
131
|
"level": 28.8
|
|
205
132
|
}
|
|
@@ -211,10 +138,7 @@
|
|
|
211
138
|
"type": "water",
|
|
212
139
|
"params": {
|
|
213
140
|
"kind": "lake",
|
|
214
|
-
"at": [
|
|
215
|
-
-65,
|
|
216
|
-
-50
|
|
217
|
-
],
|
|
141
|
+
"at": [-65, -50],
|
|
218
142
|
"radius": 46,
|
|
219
143
|
"level": 30
|
|
220
144
|
}
|
|
@@ -227,30 +151,57 @@
|
|
|
227
151
|
"params": {
|
|
228
152
|
"rules": [
|
|
229
153
|
{
|
|
230
|
-
"material": "
|
|
154
|
+
"material": "dirt",
|
|
231
155
|
"mask": {
|
|
232
|
-
"type": "
|
|
233
|
-
|
|
156
|
+
"type": "noise",
|
|
157
|
+
"scale": 55,
|
|
158
|
+
"threshold": 0.6,
|
|
159
|
+
"seed": 131,
|
|
160
|
+
"fade": 0.22
|
|
161
|
+
},
|
|
162
|
+
"strength": 0.55
|
|
234
163
|
},
|
|
235
164
|
{
|
|
236
|
-
"material": "
|
|
165
|
+
"material": "moss",
|
|
237
166
|
"mask": {
|
|
238
167
|
"type": "noise",
|
|
239
|
-
"scale":
|
|
240
|
-
"threshold": 0.
|
|
241
|
-
"seed":
|
|
242
|
-
"fade": 0.
|
|
168
|
+
"scale": 28,
|
|
169
|
+
"threshold": 0.6,
|
|
170
|
+
"seed": 137,
|
|
171
|
+
"fade": 0.25
|
|
243
172
|
},
|
|
244
|
-
"strength": 0.
|
|
173
|
+
"strength": 0.5
|
|
245
174
|
},
|
|
246
175
|
{
|
|
247
176
|
"material": "rock",
|
|
248
177
|
"mask": {
|
|
249
178
|
"type": "slope",
|
|
250
|
-
"min":
|
|
179
|
+
"min": 28,
|
|
251
180
|
"max": 90,
|
|
252
181
|
"fade": 8
|
|
253
182
|
}
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
"material": "snow",
|
|
186
|
+
"mask": {
|
|
187
|
+
"type": "and",
|
|
188
|
+
"masks": [
|
|
189
|
+
{
|
|
190
|
+
"type": "noise",
|
|
191
|
+
"scale": 70,
|
|
192
|
+
"threshold": 0.72,
|
|
193
|
+
"seed": 139,
|
|
194
|
+
"fade": 0.1
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
"type": "slope",
|
|
198
|
+
"min": 0,
|
|
199
|
+
"max": 30,
|
|
200
|
+
"fade": 6
|
|
201
|
+
}
|
|
202
|
+
]
|
|
203
|
+
},
|
|
204
|
+
"strength": 1
|
|
254
205
|
}
|
|
255
206
|
]
|
|
256
207
|
}
|
|
@@ -266,12 +217,62 @@
|
|
|
266
217
|
"minDistance": 8,
|
|
267
218
|
"maxSlope": 30,
|
|
268
219
|
"avoidWater": true,
|
|
269
|
-
"scale": [
|
|
270
|
-
0.6,
|
|
271
|
-
1.8
|
|
272
|
-
]
|
|
220
|
+
"scale": [0.6, 1.8]
|
|
273
221
|
}
|
|
274
222
|
}
|
|
275
223
|
]
|
|
224
|
+
},
|
|
225
|
+
"world": {
|
|
226
|
+
"name": "tundra",
|
|
227
|
+
"ground": {
|
|
228
|
+
"base": "grass",
|
|
229
|
+
"layers": ["dirt", "moss", "sand", "rock", "snow"],
|
|
230
|
+
"roughness": 0.95
|
|
231
|
+
},
|
|
232
|
+
"art": [
|
|
233
|
+
"boulder_01",
|
|
234
|
+
"rock_face",
|
|
235
|
+
"rock_boulder_dry",
|
|
236
|
+
"rocks",
|
|
237
|
+
"river_small_rocks",
|
|
238
|
+
"cliff_side",
|
|
239
|
+
"snow_02",
|
|
240
|
+
"grass_medium",
|
|
241
|
+
"leafy_grass",
|
|
242
|
+
"lichen_rock",
|
|
243
|
+
"mossy_rock",
|
|
244
|
+
"shrub_02",
|
|
245
|
+
"tree_small_02",
|
|
246
|
+
"fir_tree_01",
|
|
247
|
+
"hdri/kloofendal_48d_partly_cloudy_1k.hdr",
|
|
248
|
+
"mannequin-swim.glb",
|
|
249
|
+
"bark_brown_02",
|
|
250
|
+
"celandine_01",
|
|
251
|
+
"dandelion_01",
|
|
252
|
+
"dead_tree_trunk",
|
|
253
|
+
"dry_branches_medium_01",
|
|
254
|
+
"fern_02",
|
|
255
|
+
"forest_ground_04",
|
|
256
|
+
"moss_01",
|
|
257
|
+
"nettle_plant",
|
|
258
|
+
"periwinkle_plant",
|
|
259
|
+
"sand_01",
|
|
260
|
+
"shrub_04",
|
|
261
|
+
"tree_stump_01",
|
|
262
|
+
"weed_plant_02",
|
|
263
|
+
"needle-atlas.png",
|
|
264
|
+
"needle-surface.png",
|
|
265
|
+
"fir_tree_01/fir_tree_01_twig_arm_1k.jpg",
|
|
266
|
+
"fir_tree_01/fir_tree_01_twig_diff_1k.jpg",
|
|
267
|
+
"fir_tree_01/fir_tree_01_twig_nor_gl_1k.jpg",
|
|
268
|
+
"hdri/kloofendal_48d_partly_cloudy_2k.hdr",
|
|
269
|
+
"grass_ground"
|
|
270
|
+
],
|
|
271
|
+
"farRing": {
|
|
272
|
+
"survey": "tundra-horizon",
|
|
273
|
+
"datum": 3420,
|
|
274
|
+
"seed": 1,
|
|
275
|
+
"layers": []
|
|
276
|
+
}
|
|
276
277
|
}
|
|
277
278
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type IAssetLoader, fetchAsset } from "@threenative/core";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* One baked file under `world/`, from the first root the asset loader resolves that serves it
|
|
5
|
+
* (core `fetchAsset`). A miss on every root fails closed, naming the file the world is missing.
|
|
6
|
+
*/
|
|
7
|
+
export async function fetchBakedFile(
|
|
8
|
+
assets: Pick<IAssetLoader, "resolve">,
|
|
9
|
+
path: string,
|
|
10
|
+
what = "world file",
|
|
11
|
+
): Promise<Response> {
|
|
12
|
+
try {
|
|
13
|
+
return await fetchAsset(assets, path);
|
|
14
|
+
} catch (error) {
|
|
15
|
+
throw new Error(`Missing baked ${what}: ${path}`, { cause: error });
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import type { WorldName } from "./biomes.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The fixed benchmark framings, in world metres, per world.
|
|
5
|
+
*
|
|
6
|
+
* Fixed rather than relative to the player so a capture at seed 73 is the same picture on every
|
|
7
|
+
* machine, and so the rubric's "close ground/vegetation view" and "landscape overview" are two
|
|
8
|
+
* numbers rather than two moods. `eye` is the height above the terrain under the camera, which is
|
|
9
|
+
* what makes "eye height ~1.7 m" true on a slope instead of true only on a flat.
|
|
10
|
+
*
|
|
11
|
+
* The meadow focus is where the ground is grass with spruces on it and a slope to look along, and
|
|
12
|
+
* it is also where the dense grass goes: ground cover is placed around this point, not around the
|
|
13
|
+
* origin, because a meadow is a place rather than a texture.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/** Every framing the `V` key can hold, whether or not the current world has one for it. */
|
|
17
|
+
export type ViewName = "meadow-close" | "overview" | "player" | "river" | "vista";
|
|
18
|
+
|
|
19
|
+
interface IBenchmarkPose {
|
|
20
|
+
/** World x and z of the eye, and the height above the terrain under it. */
|
|
21
|
+
readonly at: readonly [number, number];
|
|
22
|
+
readonly eye: number;
|
|
23
|
+
/** Absolute elevation for an overview over surveyed scenery beyond the playable collider. */
|
|
24
|
+
readonly eyeY?: number;
|
|
25
|
+
/** World x and z to look at, and the height above the terrain under *that*. */
|
|
26
|
+
readonly look: readonly [number, number];
|
|
27
|
+
readonly lookUp: number;
|
|
28
|
+
/**
|
|
29
|
+
* An absolute world height to look at instead, for a target with no ground under it: a sea
|
|
30
|
+
* horizon is a direction, and thirty metres below the surface three hundred metres out is how a
|
|
31
|
+
* hillside tips its view down far enough for the water to be a band rather than a line.
|
|
32
|
+
*/
|
|
33
|
+
readonly lookY?: number;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
interface IBenchmark {
|
|
37
|
+
/**
|
|
38
|
+
* The playable square the poses frame, in metres. A cooked world of another size
|
|
39
|
+
* (`STRATA_WORLD`, "a huge spruce forest") scales them, so the vista still stands past its edge.
|
|
40
|
+
*/
|
|
41
|
+
readonly size?: number;
|
|
42
|
+
/** Where this world's ground cover is placed. */
|
|
43
|
+
readonly focus: { readonly x: number; readonly z: number };
|
|
44
|
+
readonly poses: Readonly<Record<string, IBenchmarkPose>>;
|
|
45
|
+
/** The order the `V` key walks, and the framings the playtest screenshots. */
|
|
46
|
+
readonly views: readonly ViewName[];
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export const BENCHMARK: Record<WorldName, IBenchmark> = {
|
|
50
|
+
tundra: {
|
|
51
|
+
size: 512,
|
|
52
|
+
focus: { x: 150, z: 205 },
|
|
53
|
+
poses: {
|
|
54
|
+
// From the turf above the meltwater, down the swale to the near kettle pond.
|
|
55
|
+
"meadow-close": { at: [160, 215], eye: 1.7, look: [65, 80], lookUp: 1.2 },
|
|
56
|
+
// Over both kettle ponds and the braided meltwater, north-west to the ridge.
|
|
57
|
+
overview: { at: [230, 250], eye: 60, look: [-60, -30], lookUp: 0 },
|
|
58
|
+
// On the bank of the upper meltwater, down to the far kettle pond.
|
|
59
|
+
river: { at: [-175, -95], eye: 1.7, look: [-65, -50], lookUp: 0 },
|
|
60
|
+
// Past the square's south-east corner, across the ponds to Trail Ridge's high peaks (3.7-3.8 km).
|
|
61
|
+
vista: { at: [330, 300], eye: 0, eyeY: 78, look: [-1300, -2000], lookUp: 0, lookY: 190 },
|
|
62
|
+
},
|
|
63
|
+
views: ["player", "meadow-close", "overview", "river", "vista"],
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
/** A world's poses for a square of `size` metres: x and z scale with it, heights do not. */
|
|
68
|
+
export function posesFor(world: WorldName, size: number): Readonly<Record<string, IBenchmarkPose>> {
|
|
69
|
+
const { poses, size: framed } = BENCHMARK[world];
|
|
70
|
+
const k = framed === undefined ? 1 : size / framed;
|
|
71
|
+
if (k === 1) return poses;
|
|
72
|
+
const scaled = ([x, z]: readonly [number, number]) => [x * k, z * k] as const;
|
|
73
|
+
return Object.fromEntries(
|
|
74
|
+
Object.entries(poses).map(([name, pose]) => [
|
|
75
|
+
name,
|
|
76
|
+
{ ...pose, at: scaled(pose.at), look: scaled(pose.look) },
|
|
77
|
+
]),
|
|
78
|
+
);
|
|
79
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { IBiomeSpec } from "@threenative/terrain";
|
|
2
|
+
import forest from "../biome.data.json";
|
|
3
|
+
import type { WorldName } from "./biomes.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The forest's biome file (`biome.data.json`): the rules it grows by. The bake validates it with
|
|
7
|
+
* `validateBiome` before it places anything, so the game reads it as data and ships no validator.
|
|
8
|
+
*/
|
|
9
|
+
const TUNDRA_SPEC = forest as unknown as IBiomeSpec;
|
|
10
|
+
|
|
11
|
+
/** The world's rules. */
|
|
12
|
+
export function biomeSpec(_world?: WorldName): IBiomeSpec {
|
|
13
|
+
return TUNDRA_SPEC;
|
|
14
|
+
}
|