create-threenative 0.2.17 → 0.2.18
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/agent-docs/kit-mcp.md +1 -1
- package/agent-docs/kit-router.md +1 -1
- package/agent-docs/references/assertion-reference.md +54 -110
- package/agent-docs/references/capability-reference.md +580 -22
- package/agent-docs/references/conventions.md +28 -0
- package/agent-docs/references/performance-basics.md +8 -4
- package/agent-files/.agents/skills/ponytail/SKILL.md +1 -1
- package/agent-files/.agents/skills/threenative-capabilities/SKILL.md +7 -4
- package/agent-files/.claude/hooks/discovery-gate.mjs +2 -2
- package/dist/index.d.ts +97 -6
- package/dist/index.js +769 -277
- package/dist/threenative.js +96 -17
- package/dist/web-engine-ccd-ik-solver.js +127 -0
- package/dist/web-engine-gltf-loader.js +52 -14
- package/dist/web-engine-post-effects.js +5 -10
- package/dist/web-engine-runtime.js +3648 -546
- package/package.json +8 -7
- package/template-assets/clearwater/README.md +1 -1
- package/template-assets/patches/manifest.json +18 -0
- package/template-assets/terrain/alpine/assets.json +12 -0
- package/template-assets/terrain/alpine/bake.mjs +6 -0
- package/template-assets/terrain/alpine/credits.json +164 -0
- package/template-assets/terrain/alpine/heightmap.r16 +0 -0
- package/template-assets/terrain/alpine/recipe.json +119 -0
- package/template-assets/terrain/alpine/surface.json +53 -0
- package/template-assets/terrain/coastal/assets.json +11 -0
- package/template-assets/terrain/coastal/bake.mjs +6 -0
- package/template-assets/terrain/coastal/credits.json +117 -0
- package/template-assets/terrain/coastal/heightmap.r16 +0 -0
- package/template-assets/terrain/coastal/recipe.json +113 -0
- package/template-assets/terrain/coastal/surface.json +41 -0
- package/template-assets/terrain/desert/assets.json +12 -0
- package/template-assets/terrain/desert/bake.mjs +6 -0
- package/template-assets/terrain/desert/credits.json +164 -0
- package/template-assets/terrain/desert/heightmap.r16 +0 -0
- package/template-assets/terrain/desert/recipe.json +108 -0
- package/template-assets/terrain/desert/surface.json +54 -0
- package/template-assets/terrain/forest/assets.json +65 -0
- package/template-assets/terrain/forest/bake.mjs +8 -0
- package/template-assets/terrain/forest/credits.json +225 -0
- package/template-assets/terrain/forest/heightmap.r16 +0 -0
- package/template-assets/terrain/forest/recipe.json +350 -0
- package/template-assets/terrain/forest/surface.json +79 -0
- package/template-assets/terrain/tundra/assets.json +12 -0
- package/template-assets/terrain/tundra/bake.mjs +6 -0
- package/template-assets/terrain/tundra/credits.json +164 -0
- package/template-assets/terrain/tundra/heightmap.r16 +0 -0
- package/template-assets/terrain/tundra/recipe.json +277 -0
- package/template-assets/terrain/tundra/surface.json +54 -0
- package/templates/action-rpg/AGENTS.md +8 -4
- package/templates/action-rpg/CLAUDE.md +8 -4
- package/templates/action-rpg/package.json +7 -7
- package/templates/action-rpg/src/game.ts +1 -1
- package/templates/action-rpg/src/render/atmosphere.ts +6 -0
- package/templates/action-rpg/src/render/backlightControls.ts +10 -0
- package/templates/action-rpg/src/render/backlightMaterial.ts +4 -4
- package/templates/action-rpg/src/render/clouds.ts +13 -0
- package/templates/action-rpg/src/render/materialLighting.ts +5 -5
- package/templates/action-rpg/src/render/quality.ts +7 -32
- package/templates/action-rpg/src/scenes/Play.ts +4 -1
- package/templates/action-rpg/src/style.css +4 -0
- package/templates/action-rpg/vite.config.ts +2 -0
- package/templates/adventure/AGENTS.md +7 -2
- package/templates/adventure/CLAUDE.md +7 -2
- package/templates/adventure/kit.json +5 -1
- package/templates/adventure/package.json +7 -7
- package/templates/adventure/src/game.ts +1 -1
- package/templates/adventure/src/style.css +4 -0
- package/templates/adventure/tsconfig.json +1 -1
- package/templates/adventure/vite.config.ts +2 -0
- package/templates/collectathon/AGENTS.md +7 -2
- package/templates/collectathon/CLAUDE.md +7 -2
- package/templates/collectathon/package.json +7 -7
- package/templates/collectathon/src/game.ts +1 -1
- package/templates/collectathon/src/level/Course.ts +55 -9
- package/templates/collectathon/src/level/terrain.ts +27 -6
- package/templates/collectathon/src/main.ts +1 -0
- package/templates/collectathon/src/render/foliage.ts +359 -98
- package/templates/collectathon/src/render/sky.ts +76 -12
- package/templates/collectathon/src/render/water.ts +32 -10
- package/templates/collectathon/src/scenes/Play.ts +18 -5
- package/templates/collectathon/src/style.css +4 -0
- package/templates/collectathon/tsconfig.json +1 -1
- package/templates/collectathon/vite.config.ts +2 -0
- package/templates/kart/AGENTS.md +7 -2
- package/templates/kart/CLAUDE.md +7 -2
- package/templates/kart/package.json +6 -6
- package/templates/kart/src/game.ts +1 -1
- package/templates/kart/src/main.ts +1 -0
- package/templates/kart/src/style.css +4 -0
- package/templates/kart/tsconfig.json +1 -1
- package/templates/kart/vite.config.ts +2 -0
- package/templates/minimal/AGENTS.md +8 -3
- package/templates/minimal/CLAUDE.md +8 -3
- package/templates/minimal/package.json +6 -6
- package/templates/minimal/playtests/stands-still.playtest.json +30 -0
- package/templates/minimal/src/game.ts +1 -1
- package/templates/minimal/src/render/atmosphere.ts +6 -0
- package/templates/minimal/src/render/backlightControls.ts +10 -0
- package/templates/minimal/src/render/backlightMaterial.ts +4 -4
- package/templates/minimal/src/render/camera.ts +13 -2
- package/templates/minimal/src/render/clouds.ts +13 -0
- package/templates/minimal/src/render/lighting.ts +4 -2
- package/templates/minimal/src/render/materialLighting.ts +5 -5
- package/templates/minimal/src/render/materials.ts +10 -0
- package/templates/minimal/src/render/quality.ts +7 -32
- package/templates/minimal/src/scenes/Play.ts +4 -1
- package/templates/minimal/vite.config.ts +7 -1
- package/templates/platformer/AGENTS.md +9 -4
- package/templates/platformer/CLAUDE.md +9 -4
- package/templates/platformer/index.html +1 -1
- package/templates/platformer/main.html +12 -0
- package/templates/platformer/package.json +7 -7
- package/templates/platformer/playtests/gamepad-idle.playtest.json +21 -0
- package/templates/platformer/playtests/gamepad.playtest.json +30 -0
- package/templates/platformer/src/entities/Fox.ts +21 -6
- package/templates/platformer/src/game.ts +1 -1
- package/templates/platformer/src/main.ts +1 -0
- package/templates/platformer/src/render/backlightControls.ts +10 -0
- package/templates/platformer/src/render/backlightMaterial.ts +4 -4
- package/templates/platformer/src/render/materialLighting.ts +5 -5
- package/templates/platformer/src/render/quality.ts +7 -32
- package/templates/platformer/src/scenes/Play.ts +2 -1
- package/templates/platformer/src/style.css +4 -0
- package/templates/platformer/src/worker-page.ts +29 -0
- package/templates/platformer/src/worker.ts +5 -0
- package/templates/platformer/tsconfig.json +1 -1
- package/templates/platformer/vite.config.ts +4 -0
- package/templates/puzzle/AGENTS.md +7 -2
- package/templates/puzzle/CLAUDE.md +7 -2
- package/templates/puzzle/package.json +7 -7
- package/templates/puzzle/src/game.ts +1 -1
- package/templates/puzzle/src/render/backlightControls.ts +10 -0
- package/templates/puzzle/src/render/backlightMaterial.ts +4 -4
- package/templates/puzzle/src/render/materialLighting.ts +5 -5
- package/templates/puzzle/src/render/quality.ts +7 -32
- package/templates/puzzle/src/scenes/Play.ts +1 -1
- package/templates/puzzle/src/style.css +4 -0
- package/templates/puzzle/tsconfig.json +1 -1
- package/templates/puzzle/vite.config.ts +2 -0
- package/templates/racing/AGENTS.md +7 -2
- package/templates/racing/CLAUDE.md +7 -2
- package/templates/racing/package.json +7 -7
- package/templates/racing/src/game.ts +1 -1
- package/templates/racing/src/render/atmosphere.ts +6 -0
- package/templates/racing/src/render/backlightControls.ts +10 -0
- package/templates/racing/src/render/backlightMaterial.ts +4 -4
- package/templates/racing/src/render/clouds.ts +13 -0
- package/templates/racing/src/render/materialLighting.ts +5 -5
- package/templates/racing/src/render/quality.ts +7 -32
- package/templates/racing/src/scenes/Race.ts +4 -1
- package/templates/racing/src/style.css +4 -0
- package/templates/racing/tsconfig.json +1 -1
- package/templates/racing/vite.config.ts +2 -0
- package/templates/rain/AGENTS.md +6 -2
- package/templates/rain/CLAUDE.md +6 -2
- package/templates/rain/package.json +6 -6
- package/templates/rain/src/game.ts +1 -1
- package/templates/rain/vite.config.ts +6 -0
- package/templates/rts/AGENTS.md +6 -2
- package/templates/rts/CLAUDE.md +6 -2
- package/templates/rts/package.json +6 -6
- package/templates/rts/src/game.ts +1 -1
- package/templates/rts/src/render/backlightControls.ts +10 -0
- package/templates/rts/src/render/backlightMaterial.ts +4 -4
- package/templates/rts/src/render/materialLighting.ts +5 -5
- package/templates/rts/src/render/quality.ts +7 -31
- package/templates/rts/src/scenes/Play.ts +1 -1
- package/templates/rts/src/style.css +4 -0
- package/templates/rts/vite.config.ts +2 -0
- package/templates/runner/AGENTS.md +7 -2
- package/templates/runner/CLAUDE.md +7 -2
- package/templates/runner/package.json +7 -7
- package/templates/runner/src/game.ts +1 -1
- package/templates/runner/src/render/atmosphere.ts +6 -0
- package/templates/runner/src/render/backlightControls.ts +10 -0
- package/templates/runner/src/render/backlightMaterial.ts +4 -4
- package/templates/runner/src/render/clouds.ts +13 -0
- package/templates/runner/src/render/materialLighting.ts +5 -5
- package/templates/runner/src/render/quality.ts +7 -32
- package/templates/runner/src/scenes/Run.ts +4 -1
- package/templates/runner/src/style.css +4 -0
- package/templates/runner/tsconfig.json +1 -1
- package/templates/runner/vite.config.ts +2 -0
- package/templates/sailing/AGENTS.md +7 -2
- package/templates/sailing/CLAUDE.md +7 -2
- package/templates/sailing/package.json +7 -7
- package/templates/sailing/src/game.ts +1 -1
- package/templates/sailing/src/render/backlightControls.ts +10 -0
- package/templates/sailing/src/render/backlightMaterial.ts +4 -4
- package/templates/sailing/src/render/environmentSetup.ts +1 -1
- package/templates/sailing/src/render/materialLighting.ts +5 -5
- package/templates/sailing/src/render/quality.ts +7 -32
- package/templates/sailing/src/style.css +5 -0
- package/templates/sailing/vite.config.ts +6 -0
- package/templates/shooter/AGENTS.md +6 -2
- package/templates/shooter/CLAUDE.md +6 -2
- package/templates/shooter/package.json +7 -7
- package/templates/shooter/src/game.ts +3 -2
- package/templates/shooter/src/render/atmosphere.ts +6 -0
- package/templates/shooter/src/render/backlightControls.ts +10 -0
- package/templates/shooter/src/render/backlightMaterial.ts +4 -4
- package/templates/shooter/src/render/clouds.ts +13 -0
- package/templates/shooter/src/render/materialLighting.ts +5 -5
- package/templates/shooter/src/render/quality.ts +7 -32
- package/templates/shooter/src/scenes/Play.ts +4 -1
- package/templates/shooter/src/style.css +4 -0
- package/templates/shooter/vite.config.ts +2 -0
- package/templates/snow/AGENTS.md +7 -2
- package/templates/snow/CLAUDE.md +7 -2
- package/templates/snow/package.json +7 -7
- package/templates/snow/src/game.ts +1 -1
- package/templates/snow/src/render/backlightControls.ts +10 -0
- package/templates/snow/src/render/backlightMaterial.ts +4 -4
- package/templates/snow/src/render/materialLighting.ts +5 -5
- package/templates/snow/src/render/quality.ts +7 -32
- package/templates/snow/src/style.css +5 -0
- package/templates/snow/vite.config.ts +6 -0
- package/templates/starter/AGENTS.md +8 -3
- package/templates/starter/CLAUDE.md +8 -3
- package/templates/starter/package.json +7 -7
- package/templates/starter/src/entities/Crate.ts +5 -2
- package/templates/starter/src/game.ts +4 -3
- package/templates/starter/src/render/adaptiveQuality.ts +17 -0
- package/templates/starter/src/render/atmosphere.ts +6 -0
- package/templates/starter/src/render/backlightControls.ts +10 -0
- package/templates/starter/src/render/backlightMaterial.ts +4 -4
- package/templates/starter/src/render/clouds.ts +13 -0
- package/templates/starter/src/render/contactShadow.ts +1 -1
- package/templates/starter/src/render/materialLighting.ts +5 -5
- package/templates/starter/src/render/postprocessing.ts +11 -10
- package/templates/starter/src/render/quality.ts +14 -1
- package/templates/starter/src/scenes/Play.ts +12 -3
- package/templates/starter/src/state.ts +2 -0
- package/templates/starter/src/style.css +4 -0
- package/templates/starter/src/ui/Menu.tsx +5 -1
- package/templates/starter/vite.config.ts +2 -0
- package/templates/tower-defense/AGENTS.md +7 -2
- package/templates/tower-defense/CLAUDE.md +7 -2
- package/templates/tower-defense/package.json +7 -7
- package/templates/tower-defense/src/game.ts +1 -1
- package/templates/tower-defense/src/render/backlightControls.ts +10 -0
- package/templates/tower-defense/src/render/backlightMaterial.ts +4 -4
- package/templates/tower-defense/src/render/materialLighting.ts +5 -5
- package/templates/tower-defense/src/render/quality.ts +7 -32
- package/templates/tower-defense/src/scenes/Battle.ts +1 -1
- package/templates/tower-defense/src/style.css +4 -0
- package/templates/tower-defense/tsconfig.json +1 -1
- package/templates/tower-defense/vite.config.ts +2 -0
- package/templates/action-rpg/src/render/environmentContribution.ts +0 -188
- package/templates/action-rpg/src/render/environmentRadiance.ts +0 -36
- package/templates/action-rpg/src/render/environmentSampleCache.ts +0 -43
- package/templates/action-rpg/src/render/environmentSampling.ts +0 -193
- package/templates/action-rpg/src/render/environmentSnapshot.ts +0 -53
- package/templates/minimal/src/render/environmentContribution.ts +0 -188
- package/templates/minimal/src/render/environmentRadiance.ts +0 -36
- package/templates/minimal/src/render/environmentSampleCache.ts +0 -43
- package/templates/minimal/src/render/environmentSampling.ts +0 -193
- package/templates/minimal/src/render/environmentSnapshot.ts +0 -53
- package/templates/platformer/src/render/environmentContribution.ts +0 -188
- package/templates/platformer/src/render/environmentRadiance.ts +0 -36
- package/templates/platformer/src/render/environmentSampleCache.ts +0 -43
- package/templates/platformer/src/render/environmentSampling.ts +0 -193
- package/templates/platformer/src/render/environmentSnapshot.ts +0 -53
- package/templates/puzzle/src/render/environmentContribution.ts +0 -188
- package/templates/puzzle/src/render/environmentRadiance.ts +0 -36
- package/templates/puzzle/src/render/environmentSampleCache.ts +0 -43
- package/templates/puzzle/src/render/environmentSampling.ts +0 -193
- package/templates/puzzle/src/render/environmentSnapshot.ts +0 -53
- package/templates/racing/src/render/environmentContribution.ts +0 -188
- package/templates/racing/src/render/environmentRadiance.ts +0 -36
- package/templates/racing/src/render/environmentSampleCache.ts +0 -43
- package/templates/racing/src/render/environmentSampling.ts +0 -193
- package/templates/racing/src/render/environmentSnapshot.ts +0 -53
- package/templates/rts/src/render/environmentContribution.ts +0 -188
- package/templates/rts/src/render/environmentRadiance.ts +0 -36
- package/templates/rts/src/render/environmentSampleCache.ts +0 -43
- package/templates/rts/src/render/environmentSampling.ts +0 -193
- package/templates/rts/src/render/environmentSnapshot.ts +0 -53
- package/templates/runner/src/render/environmentContribution.ts +0 -188
- package/templates/runner/src/render/environmentRadiance.ts +0 -36
- package/templates/runner/src/render/environmentSampleCache.ts +0 -43
- package/templates/runner/src/render/environmentSampling.ts +0 -193
- package/templates/runner/src/render/environmentSnapshot.ts +0 -53
- package/templates/sailing/src/render/environmentContribution.ts +0 -188
- package/templates/sailing/src/render/environmentRadiance.ts +0 -36
- package/templates/sailing/src/render/environmentSampleCache.ts +0 -43
- package/templates/sailing/src/render/environmentSampling.ts +0 -193
- package/templates/sailing/src/render/environmentSnapshot.ts +0 -53
- package/templates/shooter/src/render/environmentContribution.ts +0 -188
- package/templates/shooter/src/render/environmentRadiance.ts +0 -36
- package/templates/shooter/src/render/environmentSampleCache.ts +0 -43
- package/templates/shooter/src/render/environmentSampling.ts +0 -193
- package/templates/shooter/src/render/environmentSnapshot.ts +0 -53
- package/templates/snow/src/render/environmentContribution.ts +0 -188
- package/templates/snow/src/render/environmentRadiance.ts +0 -36
- package/templates/snow/src/render/environmentSampleCache.ts +0 -43
- package/templates/snow/src/render/environmentSampling.ts +0 -193
- package/templates/snow/src/render/environmentSnapshot.ts +0 -53
- package/templates/starter/src/render/environmentContribution.ts +0 -188
- package/templates/starter/src/render/environmentRadiance.ts +0 -36
- package/templates/starter/src/render/environmentSampleCache.ts +0 -43
- package/templates/starter/src/render/environmentSampling.ts +0 -193
- package/templates/starter/src/render/environmentSnapshot.ts +0 -53
- package/templates/starter/src/render/rendererGate.ts +0 -36
- package/templates/tower-defense/src/render/environmentContribution.ts +0 -188
- package/templates/tower-defense/src/render/environmentRadiance.ts +0 -36
- package/templates/tower-defense/src/render/environmentSampleCache.ts +0 -43
- package/templates/tower-defense/src/render/environmentSampling.ts +0 -193
- package/templates/tower-defense/src/render/environmentSnapshot.ts +0 -53
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Generated for you. This is ordinary Three.js — edit or delete it freely.
|
|
2
2
|
// ThreeNative does not read this file.
|
|
3
3
|
//
|
|
4
|
-
// A baked blob under a prop: what makes a crate sit on the floor on
|
|
4
|
+
// A baked blob under a prop: what makes a crate sit on the floor on the `low` tier. Unreal grounds a
|
|
5
5
|
// contact with ambient occlusion, which is on by default (UE 5.8.3: Engine/Source/Runtime/Engine/
|
|
6
6
|
// Private/SceneView.cpp:168-173, Scene.cpp:567) and off at its Low scalability level
|
|
7
7
|
// (Engine/Config/BaseScalability.ini:568-569); its lights add no contact shadow of their own
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
// Generated for you. Scene-owned material assignments; no engine appearance hooks.
|
|
2
|
-
import type { Camera, DirectionalLight, Object3D, Scene, Texture } from "three";
|
|
3
|
-
import type { IBacklightControls } from "./backlightMaterial.js";
|
|
4
1
|
import {
|
|
5
2
|
type IEnvironmentMeasurement,
|
|
6
3
|
measureEnvironment,
|
|
7
4
|
reportEnvironmentContribution,
|
|
8
|
-
} from "
|
|
5
|
+
} from "@threenative/core/render/environment";
|
|
9
6
|
import {
|
|
10
7
|
type IEnvironmentSourceSnapshot,
|
|
11
8
|
captureEnvironmentSnapshot,
|
|
12
9
|
environmentSnapshotCurrent,
|
|
13
|
-
} from "
|
|
10
|
+
} from "@threenative/core/render/environment";
|
|
11
|
+
// Generated for you. Scene-owned material assignments; no engine appearance hooks.
|
|
12
|
+
import type { Camera, DirectionalLight, Object3D, Scene, Texture } from "three";
|
|
13
|
+
import type { IBacklightControls } from "./backlightMaterial.js";
|
|
14
14
|
import { type ILightingConvention, createLightingConvention } from "./lighting.js";
|
|
15
15
|
import { createMaterialAssignments } from "./materialAssignments.js";
|
|
16
16
|
import { type IMaterialLightingEnvironment, materialLightingEnabled } from "./quality.js";
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import { type OutputRenderer, WorldEnvironment } from "@threenative/core";
|
|
2
2
|
// Generated for you: ordinary Three.js; ThreeNative does not read this file.
|
|
3
|
-
//
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
// To make the game cheaper or prettier everywhere, edit `quality.ts`. To force one tier for one run
|
|
9
|
-
// (a slow desktop, a capture to compare), pass `setupPost(renderer, scene, camera, { tier: "low" })`.
|
|
10
|
-
// `TN_QUALITY_TIER` names the tier that ran either way.
|
|
3
|
+
// This file wires two things together and decides nothing itself. `quality.ts` owns which stages run at which
|
|
4
|
+
// tier and records what each one measured; core's `WorldEnvironment` builds them and prints `TN_WORLD_ENVIRONMENT`,
|
|
5
|
+
// naming every stage as applied or refused **with a reason**.
|
|
6
|
+
// To make the game cheaper or prettier everywhere, edit `quality.ts`. To force one tier for one run (a slow desktop,
|
|
7
|
+
// a capture to compare), pass `setupPost(renderer, scene, camera, { tier: "low" })`; `TN_QUALITY_TIER` names it.
|
|
11
8
|
import { type Camera, type DirectionalLight, FloatType, type Scene } from "three";
|
|
12
9
|
import { LUTCubeLoader } from "three/addons/loaders/LUTCubeLoader.js";
|
|
13
10
|
import {
|
|
@@ -17,7 +14,7 @@ import {
|
|
|
17
14
|
formatQualityAdaptation,
|
|
18
15
|
} from "./adaptiveQuality.js";
|
|
19
16
|
import { type IGradeTable, filterableTable, gradeStages } from "./grade.js";
|
|
20
|
-
import { type QualityTier, gradePreset, qualityPreset } from "./quality.js";
|
|
17
|
+
import { type QualityTier, gradePreset, qualityPreset, tierShadows } from "./quality.js";
|
|
21
18
|
import { type TemporalAAProvider, temporalAAStages } from "./temporalAAStage.js";
|
|
22
19
|
import { temporalDetailRequested, temporalDetailStages } from "./temporalDetailStage.js";
|
|
23
20
|
import type { FogMedium } from "./volumetricFog.js";
|
|
@@ -64,6 +61,7 @@ export function setupPost(
|
|
|
64
61
|
tier?: QualityTier;
|
|
65
62
|
/** Scene-owned material assignments follow the same resolved tier. */
|
|
66
63
|
onTierChanged?: (tier: QualityTier) => void;
|
|
64
|
+
shadows?: boolean; // on or off at every tier; omitted, the tier decides (`tierShadows` in `quality.ts`)
|
|
67
65
|
/**
|
|
68
66
|
* The bounded participating medium from `volumetricFog.ts`, built once per graph: a tier change
|
|
69
67
|
* replaces the graph, and a fog controller owns one graph, so it is released and rebuilt here
|
|
@@ -95,6 +93,8 @@ export function setupPost(
|
|
|
95
93
|
medium?.dispose();
|
|
96
94
|
medium = environment.fog?.();
|
|
97
95
|
const composed = medium;
|
|
96
|
+
const shadows = tierShadows(policy.tier, environment.shadows, renderer.raw);
|
|
97
|
+
observation = { ...observation, shadows };
|
|
98
98
|
const settings = qualityPreset(policy.tier);
|
|
99
99
|
const detail = temporalDetailRequested(renderer, settings) ? temporalDetailStages() : [];
|
|
100
100
|
const world = new WorldEnvironment({
|
|
@@ -157,7 +157,7 @@ export function setupPost(
|
|
|
157
157
|
console.info(
|
|
158
158
|
`TN_QUALITY_TIER ${policy.tier} mobile=${environment.mobile === true} software=${
|
|
159
159
|
environment.software === true
|
|
160
|
-
} source=${source}`,
|
|
160
|
+
} source=${source} shadows=${tierShadows(policy.tier, environment.shadows).label}`,
|
|
161
161
|
);
|
|
162
162
|
const controller = {
|
|
163
163
|
get tier(): QualityTier {
|
|
@@ -174,6 +174,7 @@ export function setupPost(
|
|
|
174
174
|
observation = {
|
|
175
175
|
stages: observation.stages,
|
|
176
176
|
dropped: observation.dropped,
|
|
177
|
+
shadows: observation.shadows,
|
|
177
178
|
...decision,
|
|
178
179
|
...(Number.isInteger(window.window) ? { window: window.window } : {}),
|
|
179
180
|
};
|
|
@@ -52,6 +52,19 @@ export function qualityPreset(tier: string): IWorldEnvironmentOptions {
|
|
|
52
52
|
return { ...coreQualityPreset(tier), exposurePolicy: exposureSettings };
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
+
/**
|
|
56
|
+
* Whether a tier casts shadows: the game's `setupPost(..., { shadows })`, else the tier's. `low` casts none, as
|
|
57
|
+
* Unreal's `sg.ShadowQuality` 0: its shadow pass was an Iris Xe frame's largest GPU cost (PRD-871). Pass the raw
|
|
58
|
+
* renderer to apply it to `shadowMap.enabled`.
|
|
59
|
+
*/
|
|
60
|
+
export function tierShadows(tier: QualityTier, override?: boolean, raw?: unknown) {
|
|
61
|
+
const enabled = override ?? qualityTiers.shadow(tier).castShadows;
|
|
62
|
+
const source = override === undefined ? "tier" : "override";
|
|
63
|
+
const shadowMap = (raw as { shadowMap?: { enabled: boolean } } | undefined)?.shadowMap;
|
|
64
|
+
if (shadowMap) shadowMap.enabled = enabled;
|
|
65
|
+
return { enabled, source, label: `${enabled ? "on" : "off"}(${source})` } as const;
|
|
66
|
+
}
|
|
67
|
+
|
|
55
68
|
/** The grade and grain a tier runs. Throws on a name that is not a tier, for the same reason. */
|
|
56
69
|
export function gradePreset(tier: string): IGradeSettings {
|
|
57
70
|
const preset = GRADE_PRESETS[tier as QualityTier];
|
|
@@ -67,4 +80,4 @@ export {
|
|
|
67
80
|
type IMaterialLightingEnvironment,
|
|
68
81
|
isWebGLFallbackRenderer,
|
|
69
82
|
materialLightingEnabled,
|
|
70
|
-
} from "
|
|
83
|
+
} from "@threenative/core/render/environment";
|
|
@@ -5,10 +5,12 @@ import {
|
|
|
5
5
|
type SceneFrame,
|
|
6
6
|
createRandom,
|
|
7
7
|
getPlatform,
|
|
8
|
+
isConsole,
|
|
8
9
|
isMobile,
|
|
9
10
|
isTouchscreenAvailable,
|
|
10
11
|
resolveTargetFps,
|
|
11
12
|
} from "@threenative/core";
|
|
13
|
+
import { type IEnvironmentSample, sampleEnvironment } from "@threenative/core/render/environment";
|
|
12
14
|
import { Area3D, CollisionShape3D, type IPhysicsContext, RigidBody3D } from "@threenative/physics";
|
|
13
15
|
import {
|
|
14
16
|
BufferAttribute,
|
|
@@ -24,8 +26,8 @@ import { Goal, ISLAND } from "../entities/Goal.js";
|
|
|
24
26
|
import { type IPlayerModel, PLAYER_STAND_Y, Player } from "../entities/Player.js";
|
|
25
27
|
import { createArena, platform } from "../render/arena.js";
|
|
26
28
|
import { createSpringArm } from "../render/camera.js";
|
|
29
|
+
import { cloudTextures, primeCloudTextures } from "../render/clouds.js";
|
|
27
30
|
import { pickupRiseEase } from "../render/easing.js";
|
|
28
|
-
import { type IEnvironmentSample, sampleEnvironment } from "../render/environmentSampling.js";
|
|
29
31
|
import { setupLighting, shadeLikeSubstrate } from "../render/lighting.js";
|
|
30
32
|
import { createLoadingScreen } from "../render/loading.js";
|
|
31
33
|
import { createMaterialLighting } from "../render/materialLighting.js";
|
|
@@ -64,6 +66,7 @@ export class Play extends Scene<GameState, IPhysicsContext> {
|
|
|
64
66
|
levelX: -99,
|
|
65
67
|
lives: STARTING_LIVES,
|
|
66
68
|
odometer: 0,
|
|
69
|
+
pad: false,
|
|
67
70
|
paused: false,
|
|
68
71
|
peakRise: 0,
|
|
69
72
|
playerX: -2,
|
|
@@ -84,6 +87,8 @@ export class Play extends Scene<GameState, IPhysicsContext> {
|
|
|
84
87
|
]);
|
|
85
88
|
this.#playerModel = playerModel;
|
|
86
89
|
this.#sky = sky;
|
|
90
|
+
// The cloud noise is the same every run of this build: generate it once, then read it back.
|
|
91
|
+
primeCloudTextures(await ctx.assets.memo("clouds", () => cloudTextures()));
|
|
87
92
|
setupSky(ctx.scene, sky, ctx.renderer.softwareAdapter !== undefined);
|
|
88
93
|
this.#environmentSample = await sampleEnvironment(ctx.renderer.raw, ctx.scene, {
|
|
89
94
|
web: getPlatform().runtime === "web",
|
|
@@ -299,7 +304,10 @@ export class Play extends Scene<GameState, IPhysicsContext> {
|
|
|
299
304
|
ctx.add(fixed(floorMesh));
|
|
300
305
|
ctx.add(fixed(floorBase));
|
|
301
306
|
lensBlockers.push(...arena.solids, floorMesh, floorBase);
|
|
302
|
-
ctx.entities.add(
|
|
307
|
+
ctx.entities.add(
|
|
308
|
+
"crate",
|
|
309
|
+
new Crate(ctx, levelX, 4, -1.5, propMaterial, () => this.#post?.tier === "low"),
|
|
310
|
+
);
|
|
303
311
|
const pickupBase = block(0.42, 0.14, 0.42, propMaterial);
|
|
304
312
|
const pickupStem = tube(0.08, 0.08, 0.3, propMaterial);
|
|
305
313
|
const pickupOrb = ball(0.16, propMaterial);
|
|
@@ -346,7 +354,8 @@ export class Play extends Scene<GameState, IPhysicsContext> {
|
|
|
346
354
|
if (body === player.body) overGoal = true;
|
|
347
355
|
});
|
|
348
356
|
let entityCount = 4;
|
|
349
|
-
|
|
357
|
+
// A console has a pad and no keyboard: the menu reads `pad` to show DualShock prompts.
|
|
358
|
+
ctx.state.set({ entityCount, pad: isConsole() });
|
|
350
359
|
const pickup = new Area3D({
|
|
351
360
|
physics: ctx.physics,
|
|
352
361
|
position: { x: pickupX, y: 0.5, z: 0 },
|
|
@@ -9,6 +9,8 @@ export type GameState = {
|
|
|
9
9
|
levelX: number;
|
|
10
10
|
lives: number;
|
|
11
11
|
odometer: number;
|
|
12
|
+
/** True on a console (`isConsole()`): the menu shows pad prompts instead of keyboard ones. */
|
|
13
|
+
pad: boolean;
|
|
12
14
|
/** Set from the UI's pause and resume intents, and read back by the menu. */
|
|
13
15
|
paused: boolean;
|
|
14
16
|
/** True once the UI layer has rendered and published its interactive rectangles. */
|
|
@@ -9,6 +9,10 @@
|
|
|
9
9
|
*/
|
|
10
10
|
@source "../index.html";
|
|
11
11
|
@source "./";
|
|
12
|
+
/* `src/render/` is shader and material source: a word in its comments ("blur", "filter",
|
|
13
|
+
"table") became a real utility rule, which is what made a clean HUD look like a native-css
|
|
14
|
+
profile failure. Tailwind scans what it is told to scan. */
|
|
15
|
+
@source not "./render";
|
|
12
16
|
|
|
13
17
|
/*
|
|
14
18
|
* Your palette. Every name here becomes a real Tailwind utility — `bg-ink`,
|
|
@@ -43,7 +43,11 @@ export function Menu() {
|
|
|
43
43
|
>
|
|
44
44
|
restart
|
|
45
45
|
</button>
|
|
46
|
-
<span>
|
|
46
|
+
<span>
|
|
47
|
+
{state.pad
|
|
48
|
+
? "left stick to move · R2 to run · ✕ to jump the gap · right stick to zoom · reach the flag"
|
|
49
|
+
: "WASD / arrows to move · shift to run · space to jump the gap · reach the flag"}
|
|
50
|
+
</span>
|
|
47
51
|
</div>
|
|
48
52
|
);
|
|
49
53
|
}
|
|
@@ -2,6 +2,7 @@ import tailwindcss from "@tailwindcss/vite";
|
|
|
2
2
|
import { watchAssets } from "@threenative/assets";
|
|
3
3
|
import react from "@vitejs/plugin-react";
|
|
4
4
|
import {
|
|
5
|
+
createEngineCatalogPlugin,
|
|
5
6
|
createEngineFreshnessPlugin,
|
|
6
7
|
createWebBrandPlugin,
|
|
7
8
|
webRuntimeDecoders,
|
|
@@ -36,6 +37,7 @@ export default defineConfig({
|
|
|
36
37
|
plugins: [
|
|
37
38
|
createEngineFreshnessPlugin(),
|
|
38
39
|
createWebBrandPlugin(),
|
|
40
|
+
createEngineCatalogPlugin(),
|
|
39
41
|
react(),
|
|
40
42
|
tailwindcss(),
|
|
41
43
|
assetsWatchPlugin(),
|
|
@@ -11,7 +11,7 @@ Detail for each step: `threenative-capabilities` skill. Do the steps in order. A
|
|
|
11
11
|
|
|
12
12
|
1. **Kit** (new game only): `engine_search_capabilities {situation: "<the whole request>", scope: "request"}` returns the matching starter kit first. This folder is already a kit.
|
|
13
13
|
2. **Mechanics**: per mechanic, `engine_search_references {situation}`, then `engine_reference_detail` on each hit for pinned constants and feel. To see a mechanic move, `engine_watch_reference {query: "<game> <mechanic>"}` returns a contact sheet of real gameplay. Borrow mechanics only: no code, level layouts, character names or art. Cite `file:line`.
|
|
14
|
-
3. **Built-ins**: per mechanic, system or symptom, `engine_search_capabilities {situation, scope: "mechanic"}
|
|
14
|
+
3. **Built-ins**: per mechanic, system or symptom, `engine_search_capabilities {situation, scope: "mechanic"}`; rows answer; `engine_capability_detail` only for omitted symbols. Constraints are binding. `verdict: "none"` means the game writes it in `src/`.
|
|
15
15
|
4. **Plan** (new game, or a change to several systems): `prd-creator` with the kit, references and built-ins. With a user, wait for explicit approval, then implement. With no user (`claude -p`, a script), record the plan and assumptions, then continue.
|
|
16
16
|
5. **Assets**: `asset_search_sources`, the source's search tool, then `asset_download_file`; record source and licence in `CREDITS.md`. Nothing fits: `sculpt_plan`. A rigged GLB: `animation_inspect` (`threenative-assets` skill).
|
|
17
17
|
6. **Build**: gameplay in `src/`, look in `src/render/` (`threenative-context` and `threenative-ui` skills). For parallel work, give each subagent one area and its files, then integrate.
|
|
@@ -30,7 +30,7 @@ A change to an existing game repeats steps 2-3 for that change, then steps 5-8.
|
|
|
30
30
|
- `threenative-assets`: a texture, HDRI, sound or model. `asset_search_sources`, `asset_download_file`, `audio_search_assets`, `mesh_optimize`.
|
|
31
31
|
- `threenative-sculpt`: a bespoke mesh or character from a reference image. `sculpt_plan`, `sculpt_spec_gate`, `sculpt_compare`, `sculpt_pass_gate`.
|
|
32
32
|
- `threenative-animation`: a rigged GLB with a held prop, foot slide or loop seam. `animation_inspect`, `animation_attach`, `animation_verify`.
|
|
33
|
-
- `threenative-terrain`:
|
|
33
|
+
- `threenative-terrain`: any terrain, from words. `terrain_generate`.
|
|
34
34
|
- `threenative-devtools`: after `npx @threenative/playtest trace` names no cause. `performance_start_trace`, `performance_analyze_insight`.
|
|
35
35
|
<!-- /shared -->
|
|
36
36
|
|
|
@@ -54,6 +54,7 @@ pnpm dev # play in the browser
|
|
|
54
54
|
pnpm test # typecheck, lint, format, then every playtest
|
|
55
55
|
pnpm build --target desktop # also: web, android, ios
|
|
56
56
|
npx threenative doctor # build, import, device or blank-frame failure
|
|
57
|
+
npx threenative doctor --fix # refresh agent files
|
|
57
58
|
```
|
|
58
59
|
<!-- /shared -->
|
|
59
60
|
|
|
@@ -63,6 +64,7 @@ npx threenative doctor # build, import, device or blank-frame failure
|
|
|
63
64
|
Each is on by default with a named override. Detail: `node_modules/create-threenative/agent-docs/references/conventions.md#<id>`.
|
|
64
65
|
|
|
65
66
|
- **Look** `#look`: filmic curve, metered auto exposure. Override: `tonemapMode: "aces"`; `autoExposureEnabled: false` + `exposure`. Marker: `TN_WORLD_ENVIRONMENT`.
|
|
67
|
+
- **Ambient occlusion** `#ao-indirect`: darkens indirect light only, not the sun. Override: `gtaoIndirectOnly: false`; `gtaoEnabled: false`. Marker: `TN_WORLD_ENVIRONMENT`.
|
|
66
68
|
- **Quality tier (`src/render/quality.ts`)** `#quality`: GPU class picks `high`, `medium` or `low`. Override: `setupPost(..., { tier: "low" })`. Marker: `TN_QUALITY_TIER`.
|
|
67
69
|
- **Resolution scale** `#resolution`: `"auto"`, 0.85 on mobile-low. Override: numeric `resolutionScale`. Marker: `TN_FRAME_BUDGET`.
|
|
68
70
|
- **Budget real time for the look** `#frame-budget`: frame meter and scene verdict on. Override: `frameBudget: false`. Marker: `TN_FRAME_BUDGET`, `TN_SCENE_WARNING`.
|
|
@@ -86,12 +88,15 @@ Each is on by default with a named override. Detail: `node_modules/create-threen
|
|
|
86
88
|
- **Frame spans** `#spans`: off. Override: `TN_FRAME_SPANS=1`. Marker: `TN_FRAME_SPANS`.
|
|
87
89
|
- **Multiplayer** `#net`: none; unsupported transport rejects. Override: `connect` from `@threenative/core/net` with four limits. Marker: `TN_NET_UNAVAILABLE`.
|
|
88
90
|
- **Desktop window** `#desktop-mode`: CLI, then `display.fullscreen`, then `window.maximized`. Override: `--windowed`; `--maximized`; `--fullscreen`.
|
|
91
|
+
- **CPU priority** `#cpu-priority`: game threads first. Override: `display.priority: "normal"`. Marker: `TN_PROCESS_PRIORITY`.
|
|
89
92
|
- **Terrain** `#terrain`: authored in the game. Override: optional `@threenative/terrain`; `references/terrain-authoring.md`.
|
|
90
93
|
- **Navigation** `#navigation`: none; browser-only WASM. Override: import `@threenative/physics/navigation` on purpose.
|
|
94
|
+
- **Controller** `#gamepad`: W3C standard mapping on every pad, radial dead zone `0.2`, and a button press or a decisive stick move claims which pad is read. Override: `gamepadDeadZone: 0` for raw axes. Marker: `TN_GAMEPAD`.
|
|
91
95
|
- **Move input** `#move-axis`: `input.vector("move").y` is +up. Override: one explicit `-move.y` conversion.
|
|
92
96
|
- **Scene change** `#scene-change`: `ctx.goto(name)` keeps state. Override: `game.goto(name)` resets state.
|
|
93
97
|
- **Randomness** `#seed`: unseeded. Override: `defineGame({ seed })`.
|
|
94
98
|
- **Engine** `#engine`: owned C++ engine. Override: `engine: "threejs"` only when the user asks. Marker: `TN_NATIVE_ENGINE_UNBOUND`.
|
|
99
|
+
- **Refused imports** `#engine-catalog`: refused `three` imports fail at their line. Override: `createEngineCatalogPlugin({ mode: "warn" })`. Marker: `TN_ENGINE_CATALOG`.
|
|
95
100
|
<!-- /shared -->
|
|
96
101
|
|
|
97
102
|
<!-- shared: kit-stuck -->
|
|
@@ -13,7 +13,7 @@ Detail for each step: `threenative-capabilities` skill. Do the steps in order. A
|
|
|
13
13
|
|
|
14
14
|
1. **Kit** (new game only): `engine_search_capabilities {situation: "<the whole request>", scope: "request"}` returns the matching starter kit first. This folder is already a kit.
|
|
15
15
|
2. **Mechanics**: per mechanic, `engine_search_references {situation}`, then `engine_reference_detail` on each hit for pinned constants and feel. To see a mechanic move, `engine_watch_reference {query: "<game> <mechanic>"}` returns a contact sheet of real gameplay. Borrow mechanics only: no code, level layouts, character names or art. Cite `file:line`.
|
|
16
|
-
3. **Built-ins**: per mechanic, system or symptom, `engine_search_capabilities {situation, scope: "mechanic"}
|
|
16
|
+
3. **Built-ins**: per mechanic, system or symptom, `engine_search_capabilities {situation, scope: "mechanic"}`; rows answer; `engine_capability_detail` only for omitted symbols. Constraints are binding. `verdict: "none"` means the game writes it in `src/`.
|
|
17
17
|
4. **Plan** (new game, or a change to several systems): `prd-creator` with the kit, references and built-ins. With a user, wait for explicit approval, then implement. With no user (`claude -p`, a script), record the plan and assumptions, then continue.
|
|
18
18
|
5. **Assets**: `asset_search_sources`, the source's search tool, then `asset_download_file`; record source and licence in `CREDITS.md`. Nothing fits: `sculpt_plan`. A rigged GLB: `animation_inspect` (`threenative-assets` skill).
|
|
19
19
|
6. **Build**: gameplay in `src/`, look in `src/render/` (`threenative-context` and `threenative-ui` skills). For parallel work, give each subagent one area and its files, then integrate.
|
|
@@ -32,7 +32,7 @@ A change to an existing game repeats steps 2-3 for that change, then steps 5-8.
|
|
|
32
32
|
- `threenative-assets`: a texture, HDRI, sound or model. `asset_search_sources`, `asset_download_file`, `audio_search_assets`, `mesh_optimize`.
|
|
33
33
|
- `threenative-sculpt`: a bespoke mesh or character from a reference image. `sculpt_plan`, `sculpt_spec_gate`, `sculpt_compare`, `sculpt_pass_gate`.
|
|
34
34
|
- `threenative-animation`: a rigged GLB with a held prop, foot slide or loop seam. `animation_inspect`, `animation_attach`, `animation_verify`.
|
|
35
|
-
- `threenative-terrain`:
|
|
35
|
+
- `threenative-terrain`: any terrain, from words. `terrain_generate`.
|
|
36
36
|
- `threenative-devtools`: after `npx @threenative/playtest trace` names no cause. `performance_start_trace`, `performance_analyze_insight`.
|
|
37
37
|
<!-- /shared -->
|
|
38
38
|
|
|
@@ -56,6 +56,7 @@ pnpm dev # play in the browser
|
|
|
56
56
|
pnpm test # typecheck, lint, format, then every playtest
|
|
57
57
|
pnpm build --target desktop # also: web, android, ios
|
|
58
58
|
npx threenative doctor # build, import, device or blank-frame failure
|
|
59
|
+
npx threenative doctor --fix # refresh agent files
|
|
59
60
|
```
|
|
60
61
|
<!-- /shared -->
|
|
61
62
|
|
|
@@ -65,6 +66,7 @@ npx threenative doctor # build, import, device or blank-frame failure
|
|
|
65
66
|
Each is on by default with a named override. Detail: `node_modules/create-threenative/agent-docs/references/conventions.md#<id>`.
|
|
66
67
|
|
|
67
68
|
- **Look** `#look`: filmic curve, metered auto exposure. Override: `tonemapMode: "aces"`; `autoExposureEnabled: false` + `exposure`. Marker: `TN_WORLD_ENVIRONMENT`.
|
|
69
|
+
- **Ambient occlusion** `#ao-indirect`: darkens indirect light only, not the sun. Override: `gtaoIndirectOnly: false`; `gtaoEnabled: false`. Marker: `TN_WORLD_ENVIRONMENT`.
|
|
68
70
|
- **Quality tier (`src/render/quality.ts`)** `#quality`: GPU class picks `high`, `medium` or `low`. Override: `setupPost(..., { tier: "low" })`. Marker: `TN_QUALITY_TIER`.
|
|
69
71
|
- **Resolution scale** `#resolution`: `"auto"`, 0.85 on mobile-low. Override: numeric `resolutionScale`. Marker: `TN_FRAME_BUDGET`.
|
|
70
72
|
- **Budget real time for the look** `#frame-budget`: frame meter and scene verdict on. Override: `frameBudget: false`. Marker: `TN_FRAME_BUDGET`, `TN_SCENE_WARNING`.
|
|
@@ -88,12 +90,15 @@ Each is on by default with a named override. Detail: `node_modules/create-threen
|
|
|
88
90
|
- **Frame spans** `#spans`: off. Override: `TN_FRAME_SPANS=1`. Marker: `TN_FRAME_SPANS`.
|
|
89
91
|
- **Multiplayer** `#net`: none; unsupported transport rejects. Override: `connect` from `@threenative/core/net` with four limits. Marker: `TN_NET_UNAVAILABLE`.
|
|
90
92
|
- **Desktop window** `#desktop-mode`: CLI, then `display.fullscreen`, then `window.maximized`. Override: `--windowed`; `--maximized`; `--fullscreen`.
|
|
93
|
+
- **CPU priority** `#cpu-priority`: game threads first. Override: `display.priority: "normal"`. Marker: `TN_PROCESS_PRIORITY`.
|
|
91
94
|
- **Terrain** `#terrain`: authored in the game. Override: optional `@threenative/terrain`; `references/terrain-authoring.md`.
|
|
92
95
|
- **Navigation** `#navigation`: none; browser-only WASM. Override: import `@threenative/physics/navigation` on purpose.
|
|
96
|
+
- **Controller** `#gamepad`: W3C standard mapping on every pad, radial dead zone `0.2`, and a button press or a decisive stick move claims which pad is read. Override: `gamepadDeadZone: 0` for raw axes. Marker: `TN_GAMEPAD`.
|
|
93
97
|
- **Move input** `#move-axis`: `input.vector("move").y` is +up. Override: one explicit `-move.y` conversion.
|
|
94
98
|
- **Scene change** `#scene-change`: `ctx.goto(name)` keeps state. Override: `game.goto(name)` resets state.
|
|
95
99
|
- **Randomness** `#seed`: unseeded. Override: `defineGame({ seed })`.
|
|
96
100
|
- **Engine** `#engine`: owned C++ engine. Override: `engine: "threejs"` only when the user asks. Marker: `TN_NATIVE_ENGINE_UNBOUND`.
|
|
101
|
+
- **Refused imports** `#engine-catalog`: refused `three` imports fail at their line. Override: `createEngineCatalogPlugin({ mode: "warn" })`. Marker: `TN_ENGINE_CATALOG`.
|
|
97
102
|
<!-- /shared -->
|
|
98
103
|
|
|
99
104
|
<!-- shared: kit-stuck -->
|
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
"format:check": "biome format src"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@threenative/core": "0.3.
|
|
22
|
-
"@threenative/physics": "0.3.
|
|
23
|
-
"@threenative/ui": "0.3.
|
|
21
|
+
"@threenative/core": "0.3.13",
|
|
22
|
+
"@threenative/physics": "0.3.13",
|
|
23
|
+
"@threenative/ui": "0.3.13",
|
|
24
24
|
"react": "19.2.0",
|
|
25
25
|
"react-dom": "19.2.0",
|
|
26
26
|
"three": "0.187.0"
|
|
@@ -28,13 +28,13 @@
|
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@gltf-transform/cli": "4.4.2",
|
|
30
30
|
"@tailwindcss/vite": "4.3.3",
|
|
31
|
-
"@threenative/assets": "0.3.
|
|
32
|
-
"@threenative/playtest": "0.3.
|
|
31
|
+
"@threenative/assets": "0.3.14",
|
|
32
|
+
"@threenative/playtest": "0.3.13",
|
|
33
33
|
"@types/react": "19.2.0",
|
|
34
34
|
"@types/react-dom": "19.2.0",
|
|
35
35
|
"@types/three": "0.187.0",
|
|
36
36
|
"@vitejs/plugin-react": "6.0.5",
|
|
37
|
-
"create-threenative": "0.2.
|
|
37
|
+
"create-threenative": "0.2.18",
|
|
38
38
|
"esbuild": "0.27.0",
|
|
39
39
|
"playwright": "1.62.1",
|
|
40
40
|
"tailwindcss": "4.3.3",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"eslint": "10.13.0"
|
|
45
45
|
},
|
|
46
46
|
"optionalDependencies": {
|
|
47
|
-
"@threenative/runtime-native": "0.3.
|
|
47
|
+
"@threenative/runtime-native": "0.3.13"
|
|
48
48
|
},
|
|
49
49
|
"overrides": {
|
|
50
50
|
"sharp": ">=0.35.4",
|
|
@@ -40,7 +40,7 @@ const game = defineGame<GameState, IPhysicsContext>({
|
|
|
40
40
|
// curve. The world still needs a solver to answer those questions, so gravity is simply zero.
|
|
41
41
|
plugins: [rapier({ gravity: { x: 0, y: 0, z: 0 } }), playtest({ events })],
|
|
42
42
|
display: config.display,
|
|
43
|
-
|
|
43
|
+
renderer: config.renderer,
|
|
44
44
|
scenes: { battle: Battle, boot: Boot },
|
|
45
45
|
seed: 47021,
|
|
46
46
|
start: "boot",
|
|
@@ -10,6 +10,11 @@ function finiteColor(color: Color) {
|
|
|
10
10
|
color.b >= 0
|
|
11
11
|
);
|
|
12
12
|
}
|
|
13
|
+
/**
|
|
14
|
+
* Throws when a `IBacklightControls` is missing a light or names a non-finite gain.
|
|
15
|
+
*
|
|
16
|
+
* @situation fail loudly instead of drawing an unlit material when a backlight has no key light
|
|
17
|
+
*/
|
|
13
18
|
export function validateControls(controls: IBacklightControls) {
|
|
14
19
|
if (
|
|
15
20
|
!Number.isFinite(controls.rimGain) ||
|
|
@@ -30,6 +35,11 @@ export function validateControls(controls: IBacklightControls) {
|
|
|
30
35
|
"Backlight controls require finite nonnegative gains, a direction and angular size in (0, 1.5].",
|
|
31
36
|
);
|
|
32
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* The light and camera a backlit material reads its key direction from.
|
|
40
|
+
*
|
|
41
|
+
* @situation point the backlight at the sun the scene actually has
|
|
42
|
+
*/
|
|
33
43
|
export function resolveKey(
|
|
34
44
|
controls: IBacklightControls,
|
|
35
45
|
direction: Vector3,
|
|
@@ -48,10 +48,10 @@ export interface IBacklightControls {
|
|
|
48
48
|
const graphs = new WeakMap<IBacklightControls, ReturnType<typeof createGraph>>();
|
|
49
49
|
|
|
50
50
|
/**
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
51
|
+
* The game's material, wrapped in a node twin that adds the backlit sheen it was given.
|
|
52
|
+
*
|
|
53
|
+
* @situation give a material a launcher's glow without editing its colour, texture or roughness
|
|
54
|
+
* @constraint every colour, gain and angular size is the caller's; this copies the game's material and adds light
|
|
55
55
|
*/
|
|
56
56
|
export function backlightMaterial(source: MeshStandardMaterial, controls: IBacklightControls) {
|
|
57
57
|
if (
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
// Generated for you. Scene-owned material assignments; no engine appearance hooks.
|
|
2
|
-
import type { Camera, DirectionalLight, Object3D, Scene, Texture } from "three";
|
|
3
|
-
import type { IBacklightControls } from "./backlightMaterial.js";
|
|
4
1
|
import {
|
|
5
2
|
type IEnvironmentMeasurement,
|
|
6
3
|
measureEnvironment,
|
|
7
4
|
reportEnvironmentContribution,
|
|
8
|
-
} from "
|
|
5
|
+
} from "@threenative/core/render/environment";
|
|
9
6
|
import {
|
|
10
7
|
type IEnvironmentSourceSnapshot,
|
|
11
8
|
captureEnvironmentSnapshot,
|
|
12
9
|
environmentSnapshotCurrent,
|
|
13
|
-
} from "
|
|
10
|
+
} from "@threenative/core/render/environment";
|
|
11
|
+
// Generated for you. Scene-owned material assignments; no engine appearance hooks.
|
|
12
|
+
import type { Camera, DirectionalLight, Object3D, Scene, Texture } from "three";
|
|
13
|
+
import type { IBacklightControls } from "./backlightMaterial.js";
|
|
14
14
|
import { type ILightingConvention, createLightingConvention } from "./lighting.js";
|
|
15
15
|
import { createMaterialAssignments } from "./materialAssignments.js";
|
|
16
16
|
import { type IMaterialLightingEnvironment, materialLightingEnabled } from "./quality.js";
|
|
@@ -31,7 +31,6 @@ import {
|
|
|
31
31
|
} from "@threenative/core";
|
|
32
32
|
import { exposureSettings } from "./exposure.js";
|
|
33
33
|
export type { QualityTier } from "@threenative/core";
|
|
34
|
-
import type { QualityTier } from "@threenative/core";
|
|
35
34
|
|
|
36
35
|
/**
|
|
37
36
|
* The three names this game's look comes in.
|
|
@@ -48,34 +47,10 @@ export function qualityPreset(tier: string): IWorldEnvironmentOptions {
|
|
|
48
47
|
}
|
|
49
48
|
|
|
50
49
|
/** First admitted material lane: high desktop hardware WebGPU in the browser only. */
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
export function materialLightingEnabled(
|
|
59
|
-
tier: QualityTier,
|
|
60
|
-
environment: IMaterialLightingEnvironment,
|
|
61
|
-
): boolean {
|
|
62
|
-
return (
|
|
63
|
-
tier === "high" &&
|
|
64
|
-
environment.web &&
|
|
65
|
-
environment.rendererKind === "webgpu" &&
|
|
66
|
-
environment.mobile !== true &&
|
|
67
|
-
environment.software !== true &&
|
|
68
|
-
environment.webglFallback !== true
|
|
69
|
-
);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
/** A WebGPURenderer wrapper may run an ordinary WebGL fallback backend. */
|
|
73
|
-
export function isWebGLFallbackRenderer(renderer: unknown): boolean {
|
|
74
|
-
if (renderer === null || typeof renderer !== "object") return false;
|
|
75
|
-
const backend = Reflect.get(renderer, "backend");
|
|
76
|
-
return (
|
|
77
|
-
backend !== null &&
|
|
78
|
-
typeof backend === "object" &&
|
|
79
|
-
Reflect.get(backend, "isWebGLBackend") === true
|
|
80
|
-
);
|
|
81
|
-
}
|
|
50
|
+
// The material lane's admission rule and the WebGL-fallback probe are the engine's: twelve kits
|
|
51
|
+
// held a copy each, so a fix to one left eleven admitting what it refused.
|
|
52
|
+
export {
|
|
53
|
+
type IMaterialLightingEnvironment,
|
|
54
|
+
isWebGLFallbackRenderer,
|
|
55
|
+
materialLightingEnabled,
|
|
56
|
+
} from "@threenative/core/render/environment";
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
getPlatform,
|
|
7
7
|
isMobile,
|
|
8
8
|
} from "@threenative/core";
|
|
9
|
+
import { type IEnvironmentSample, sampleEnvironment } from "@threenative/core/render/environment";
|
|
9
10
|
import type { IPhysicsContext } from "@threenative/physics";
|
|
10
11
|
import { type Group, type Mesh, type PerspectiveCamera, type Texture, Vector3 } from "three";
|
|
11
12
|
import {
|
|
@@ -34,7 +35,6 @@ import { Enemy } from "../enemies/Enemy.js";
|
|
|
34
35
|
import { drainIntents } from "../intents.js";
|
|
35
36
|
import { emitPlaytestEvent } from "../playtest-events.js";
|
|
36
37
|
import { setupCamera } from "../render/camera.js";
|
|
37
|
-
import { type IEnvironmentSample, sampleEnvironment } from "../render/environmentSampling.js";
|
|
38
38
|
import { setupLighting } from "../render/lighting.js";
|
|
39
39
|
import { createLoadingScreen } from "../render/loading.js";
|
|
40
40
|
import { createMaterialLighting } from "../render/materialLighting.js";
|
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
@source "../index.html";
|
|
4
4
|
@source "./";
|
|
5
|
+
/* `src/render/` is shader and material source: a word in its comments ("blur", "filter",
|
|
6
|
+
"table") became a real utility rule, which is what made a clean HUD look like a native-css
|
|
7
|
+
profile failure. Tailwind scans what it is told to scan. */
|
|
8
|
+
@source not "./render";
|
|
5
9
|
|
|
6
10
|
@theme {
|
|
7
11
|
--color-ink: #14241e;
|
|
@@ -2,6 +2,7 @@ import tailwindcss from "@tailwindcss/vite";
|
|
|
2
2
|
import { watchAssets } from "@threenative/assets";
|
|
3
3
|
import react from "@vitejs/plugin-react";
|
|
4
4
|
import {
|
|
5
|
+
createEngineCatalogPlugin,
|
|
5
6
|
createEngineFreshnessPlugin,
|
|
6
7
|
createWebBrandPlugin,
|
|
7
8
|
webRuntimeDecoders,
|
|
@@ -36,6 +37,7 @@ export default defineConfig({
|
|
|
36
37
|
plugins: [
|
|
37
38
|
createEngineFreshnessPlugin(),
|
|
38
39
|
createWebBrandPlugin(),
|
|
40
|
+
createEngineCatalogPlugin(),
|
|
39
41
|
react(),
|
|
40
42
|
tailwindcss(),
|
|
41
43
|
assetsWatchPlugin(),
|