create-threenative 0.2.12 → 0.2.14
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/references/capability-reference.md +1 -1
- package/capabilities.json +1 -1
- package/dist/index.js +1 -1
- package/dist/threenative.js +7 -3
- package/dist/web-engine-post-effects.js +1 -1
- package/dist/web-engine-runtime.js +3 -0
- package/package.json +8 -8
- package/template-assets/patches/{three@0.185.1.patch → three@0.187.0.patch} +2543 -3560
- package/templates/action-rpg/package.json +10 -10
- package/templates/action-rpg/src/render/gpuSky.ts +3 -4
- package/templates/adventure/package.json +10 -10
- package/templates/collectathon/package.json +10 -10
- package/templates/kart/package.json +9 -9
- package/templates/minimal/package.json +9 -9
- package/templates/minimal/src/render/gpuSky.ts +3 -4
- package/templates/platformer/package.json +10 -10
- package/templates/puzzle/package.json +10 -10
- package/templates/racing/package.json +10 -10
- package/templates/racing/src/render/gpuSky.ts +3 -4
- package/templates/rain/package.json +9 -9
- package/templates/rts/package.json +9 -9
- package/templates/runner/package.json +10 -10
- package/templates/runner/src/render/gpuSky.ts +3 -4
- package/templates/sailing/package.json +10 -10
- package/templates/sailing/playtests/float-after-the-run-ends.playtest.json +1 -1
- package/templates/shooter/package.json +10 -10
- package/templates/shooter/src/render/gpuSky.ts +3 -4
- package/templates/shooter/src/scenes/Play.ts +4 -3
- package/templates/snow/package.json +10 -10
- package/templates/starter/package.json +10 -10
- package/templates/starter/src/render/gpuSky.ts +3 -4
- package/templates/starter/src/render/temporalAA.ts +10 -9
- package/templates/starter/src/render/temporalAAFrame.ts +2 -5
- package/templates/starter/src/render/temporalAAHooks.ts +53 -31
- package/templates/starter/src/render/temporalResolveDepth.ts +2 -2
- package/templates/tower-defense/package.json +10 -10
|
@@ -36,14 +36,13 @@ import {
|
|
|
36
36
|
vec4,
|
|
37
37
|
} from "three/tsl";
|
|
38
38
|
import {
|
|
39
|
-
|
|
39
|
+
Node,
|
|
40
40
|
type NodeBuilder,
|
|
41
41
|
type NodeFrame,
|
|
42
42
|
NodeMaterial,
|
|
43
43
|
NodeUpdateType,
|
|
44
44
|
QuadMesh,
|
|
45
45
|
RendererUtils,
|
|
46
|
-
TempNode,
|
|
47
46
|
} from "three/webgpu";
|
|
48
47
|
import {
|
|
49
48
|
BOTTOM_KM,
|
|
@@ -259,7 +258,7 @@ function cloudNoise() {
|
|
|
259
258
|
const skyDisc = uniform(1);
|
|
260
259
|
|
|
261
260
|
/** Cached passes: only texture reads and the analytic disc run at screen resolution. */
|
|
262
|
-
class GpuSkyNode extends
|
|
261
|
+
class GpuSkyNode extends Node<"vec3"> {
|
|
263
262
|
static get type(): string {
|
|
264
263
|
return "GpuSkyNode";
|
|
265
264
|
}
|
|
@@ -271,7 +270,7 @@ class GpuSkyNode extends TempNode<"vec3"> {
|
|
|
271
270
|
};
|
|
272
271
|
readonly materials: NodeMaterial[] = [];
|
|
273
272
|
readonly sun = uniform(new Vector3());
|
|
274
|
-
readonly #quad = new QuadMesh();
|
|
273
|
+
readonly #quad = new QuadMesh(new NodeMaterial());
|
|
275
274
|
readonly #noise = cloudNoise();
|
|
276
275
|
readonly #fog = uniform(new Color());
|
|
277
276
|
readonly #scale = vec3(...temperatureColour(SUN_KELVIN)).mul(SUN_ILLUMINANCE * SKY_TO_SUN);
|
|
@@ -19,23 +19,23 @@
|
|
|
19
19
|
"format:check": "biome format src"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@threenative/core": "0.3.
|
|
23
|
-
"@threenative/physics": "0.3.
|
|
24
|
-
"@threenative/ui": "0.3.
|
|
22
|
+
"@threenative/core": "0.3.10",
|
|
23
|
+
"@threenative/physics": "0.3.10",
|
|
24
|
+
"@threenative/ui": "0.3.10",
|
|
25
25
|
"react": "19.2.0",
|
|
26
26
|
"react-dom": "19.2.0",
|
|
27
27
|
"react-reconciler": "0.33.0",
|
|
28
|
-
"three": "0.
|
|
28
|
+
"three": "0.187.0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@tailwindcss/vite": "4.3.3",
|
|
32
|
-
"@threenative/assets": "0.3.
|
|
33
|
-
"@threenative/playtest": "0.3.
|
|
32
|
+
"@threenative/assets": "0.3.11",
|
|
33
|
+
"@threenative/playtest": "0.3.10",
|
|
34
34
|
"@types/react": "19.2.0",
|
|
35
35
|
"@types/react-dom": "19.2.0",
|
|
36
|
-
"@types/three": "0.
|
|
36
|
+
"@types/three": "0.187.0",
|
|
37
37
|
"@vitejs/plugin-react": "6.0.5",
|
|
38
|
-
"create-threenative": "0.2.
|
|
38
|
+
"create-threenative": "0.2.14",
|
|
39
39
|
"esbuild": "0.27.0",
|
|
40
40
|
"playwright": "1.62.1",
|
|
41
41
|
"tailwindcss": "4.3.3",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"eslint": "10.13.0"
|
|
47
47
|
},
|
|
48
48
|
"optionalDependencies": {
|
|
49
|
-
"@threenative/runtime-native": "0.3.
|
|
49
|
+
"@threenative/runtime-native": "0.3.10"
|
|
50
50
|
},
|
|
51
51
|
"overrides": {
|
|
52
52
|
"sharp": ">=0.35.4",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
},
|
|
59
59
|
"onlyBuiltDependencies": ["@threenative/core", "@threenative/runtime-native"],
|
|
60
60
|
"patchedDependencies": {
|
|
61
|
-
"three@0.
|
|
61
|
+
"three@0.187.0": "patches/three@0.187.0.patch",
|
|
62
62
|
"vite@8.2.0": "patches/vite@8.2.0.patch",
|
|
63
63
|
"@tailwindcss/node@4.3.3": "patches/@tailwindcss__node@4.3.3.patch"
|
|
64
64
|
}
|
|
@@ -19,23 +19,23 @@
|
|
|
19
19
|
"format:check": "biome format src"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@threenative/core": "0.3.
|
|
23
|
-
"@threenative/physics": "0.3.
|
|
24
|
-
"@threenative/ui": "0.3.
|
|
22
|
+
"@threenative/core": "0.3.10",
|
|
23
|
+
"@threenative/physics": "0.3.10",
|
|
24
|
+
"@threenative/ui": "0.3.10",
|
|
25
25
|
"react": "19.2.0",
|
|
26
26
|
"react-dom": "19.2.0",
|
|
27
|
-
"three": "0.
|
|
27
|
+
"three": "0.187.0"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@tailwindcss/vite": "4.3.3",
|
|
31
|
-
"@types/three": "0.
|
|
31
|
+
"@types/three": "0.187.0",
|
|
32
32
|
"@vitejs/plugin-react": "6.0.5",
|
|
33
|
-
"@threenative/assets": "0.3.
|
|
34
|
-
"@threenative/playtest": "0.3.
|
|
33
|
+
"@threenative/assets": "0.3.11",
|
|
34
|
+
"@threenative/playtest": "0.3.10",
|
|
35
35
|
"@types/react": "19.2.0",
|
|
36
36
|
"@types/react-dom": "19.2.0",
|
|
37
37
|
"playwright": "1.62.1",
|
|
38
|
-
"create-threenative": "0.2.
|
|
38
|
+
"create-threenative": "0.2.14",
|
|
39
39
|
"esbuild": "0.27.0",
|
|
40
40
|
"tailwindcss": "4.3.3",
|
|
41
41
|
"typescript": "7.0.2",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"eslint": "10.13.0"
|
|
46
46
|
},
|
|
47
47
|
"optionalDependencies": {
|
|
48
|
-
"@threenative/runtime-native": "0.3.
|
|
48
|
+
"@threenative/runtime-native": "0.3.10"
|
|
49
49
|
},
|
|
50
50
|
"overrides": {
|
|
51
51
|
"sharp": ">=0.35.4",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
},
|
|
58
58
|
"onlyBuiltDependencies": ["@threenative/core", "@threenative/runtime-native"],
|
|
59
59
|
"patchedDependencies": {
|
|
60
|
-
"three@0.
|
|
60
|
+
"three@0.187.0": "patches/three@0.187.0.patch",
|
|
61
61
|
"vite@8.2.0": "patches/vite@8.2.0.patch",
|
|
62
62
|
"@tailwindcss/node@4.3.3": "patches/@tailwindcss__node@4.3.3.patch"
|
|
63
63
|
}
|
|
@@ -36,14 +36,13 @@ import {
|
|
|
36
36
|
vec4,
|
|
37
37
|
} from "three/tsl";
|
|
38
38
|
import {
|
|
39
|
-
|
|
39
|
+
Node,
|
|
40
40
|
type NodeBuilder,
|
|
41
41
|
type NodeFrame,
|
|
42
42
|
NodeMaterial,
|
|
43
43
|
NodeUpdateType,
|
|
44
44
|
QuadMesh,
|
|
45
45
|
RendererUtils,
|
|
46
|
-
TempNode,
|
|
47
46
|
} from "three/webgpu";
|
|
48
47
|
import {
|
|
49
48
|
BOTTOM_KM,
|
|
@@ -259,7 +258,7 @@ function cloudNoise() {
|
|
|
259
258
|
const skyDisc = uniform(1);
|
|
260
259
|
|
|
261
260
|
/** Cached passes: only texture reads and the analytic disc run at screen resolution. */
|
|
262
|
-
class GpuSkyNode extends
|
|
261
|
+
class GpuSkyNode extends Node<"vec3"> {
|
|
263
262
|
static get type(): string {
|
|
264
263
|
return "GpuSkyNode";
|
|
265
264
|
}
|
|
@@ -271,7 +270,7 @@ class GpuSkyNode extends TempNode<"vec3"> {
|
|
|
271
270
|
};
|
|
272
271
|
readonly materials: NodeMaterial[] = [];
|
|
273
272
|
readonly sun = uniform(new Vector3());
|
|
274
|
-
readonly #quad = new QuadMesh();
|
|
273
|
+
readonly #quad = new QuadMesh(new NodeMaterial());
|
|
275
274
|
readonly #noise = cloudNoise();
|
|
276
275
|
readonly #fog = uniform(new Color());
|
|
277
276
|
readonly #scale = vec3(...temperatureColour(SUN_KELVIN)).mul(SUN_ILLUMINANCE * SKY_TO_SUN);
|
|
@@ -317,9 +317,10 @@ export class Play extends Scene<GameState, IPhysicsContext> {
|
|
|
317
317
|
});
|
|
318
318
|
// Thumb controls. Registered so a scenario can assert a finger actually drove the player,
|
|
319
319
|
// and read every tick below before the player consumes its input.
|
|
320
|
-
//
|
|
321
|
-
// stop being submitted. Worth ~a third of the draw calls on a
|
|
322
|
-
|
|
320
|
+
// Readiness follows a sustained window of real frames, so every pooled pipeline has been through
|
|
321
|
+
// a draw and the unused slots can stop being submitted. Worth ~a third of the draw calls on a
|
|
322
|
+
// phone. A fixed delay ran past the reveal once startup got faster: 731 draws where 104 hold.
|
|
323
|
+
void ctx.startup.whenReady().then(() => {
|
|
323
324
|
decals.settle();
|
|
324
325
|
smoke.settle();
|
|
325
326
|
impacts.settle();
|
|
@@ -19,23 +19,23 @@
|
|
|
19
19
|
"format:check": "biome format src"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@threenative/core": "0.3.
|
|
23
|
-
"@threenative/physics": "0.3.
|
|
24
|
-
"@threenative/ui": "0.3.
|
|
22
|
+
"@threenative/core": "0.3.10",
|
|
23
|
+
"@threenative/physics": "0.3.10",
|
|
24
|
+
"@threenative/ui": "0.3.10",
|
|
25
25
|
"react": "19.2.0",
|
|
26
26
|
"react-dom": "19.2.0",
|
|
27
27
|
"react-reconciler": "0.33.0",
|
|
28
|
-
"three": "0.
|
|
28
|
+
"three": "0.187.0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@tailwindcss/vite": "4.3.3",
|
|
32
|
-
"@threenative/assets": "0.3.
|
|
33
|
-
"@threenative/playtest": "0.3.
|
|
32
|
+
"@threenative/assets": "0.3.11",
|
|
33
|
+
"@threenative/playtest": "0.3.10",
|
|
34
34
|
"@types/react": "19.2.0",
|
|
35
35
|
"@types/react-dom": "19.2.0",
|
|
36
|
-
"@types/three": "0.
|
|
36
|
+
"@types/three": "0.187.0",
|
|
37
37
|
"@vitejs/plugin-react": "6.0.5",
|
|
38
|
-
"create-threenative": "0.2.
|
|
38
|
+
"create-threenative": "0.2.14",
|
|
39
39
|
"esbuild": "0.27.0",
|
|
40
40
|
"playwright": "1.62.1",
|
|
41
41
|
"tailwindcss": "4.3.3",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"eslint": "10.13.0"
|
|
47
47
|
},
|
|
48
48
|
"optionalDependencies": {
|
|
49
|
-
"@threenative/runtime-native": "0.3.
|
|
49
|
+
"@threenative/runtime-native": "0.3.10"
|
|
50
50
|
},
|
|
51
51
|
"overrides": {
|
|
52
52
|
"sharp": ">=0.35.4",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
},
|
|
59
59
|
"onlyBuiltDependencies": ["@threenative/core", "@threenative/runtime-native"],
|
|
60
60
|
"patchedDependencies": {
|
|
61
|
-
"three@0.
|
|
61
|
+
"three@0.187.0": "patches/three@0.187.0.patch",
|
|
62
62
|
"vite@8.2.0": "patches/vite@8.2.0.patch",
|
|
63
63
|
"@tailwindcss/node@4.3.3": "patches/@tailwindcss__node@4.3.3.patch"
|
|
64
64
|
}
|
|
@@ -20,23 +20,23 @@
|
|
|
20
20
|
"format:check": "biome format src"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@threenative/core": "0.3.
|
|
24
|
-
"@threenative/physics": "0.3.
|
|
25
|
-
"@threenative/ui": "0.3.
|
|
23
|
+
"@threenative/core": "0.3.10",
|
|
24
|
+
"@threenative/physics": "0.3.10",
|
|
25
|
+
"@threenative/ui": "0.3.10",
|
|
26
26
|
"react": "19.2.0",
|
|
27
27
|
"react-dom": "19.2.0",
|
|
28
28
|
"react-reconciler": "0.33.0",
|
|
29
|
-
"three": "0.
|
|
29
|
+
"three": "0.187.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@tailwindcss/vite": "4.3.3",
|
|
33
|
-
"@threenative/assets": "0.3.
|
|
34
|
-
"@threenative/playtest": "0.3.
|
|
33
|
+
"@threenative/assets": "0.3.11",
|
|
34
|
+
"@threenative/playtest": "0.3.10",
|
|
35
35
|
"@types/react": "19.2.0",
|
|
36
36
|
"@types/react-dom": "19.2.0",
|
|
37
|
-
"@types/three": "0.
|
|
37
|
+
"@types/three": "0.187.0",
|
|
38
38
|
"@vitejs/plugin-react": "6.0.5",
|
|
39
|
-
"create-threenative": "0.2.
|
|
39
|
+
"create-threenative": "0.2.14",
|
|
40
40
|
"esbuild": "0.27.0",
|
|
41
41
|
"playwright": "1.62.1",
|
|
42
42
|
"tailwindcss": "4.3.3",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"eslint": "10.13.0"
|
|
48
48
|
},
|
|
49
49
|
"optionalDependencies": {
|
|
50
|
-
"@threenative/runtime-native": "0.3.
|
|
50
|
+
"@threenative/runtime-native": "0.3.10"
|
|
51
51
|
},
|
|
52
52
|
"overrides": {
|
|
53
53
|
"sharp": ">=0.35.4",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
},
|
|
60
60
|
"onlyBuiltDependencies": ["@threenative/core", "@threenative/runtime-native"],
|
|
61
61
|
"patchedDependencies": {
|
|
62
|
-
"three@0.
|
|
62
|
+
"three@0.187.0": "patches/three@0.187.0.patch",
|
|
63
63
|
"vite@8.2.0": "patches/vite@8.2.0.patch",
|
|
64
64
|
"@tailwindcss/node@4.3.3": "patches/@tailwindcss__node@4.3.3.patch"
|
|
65
65
|
}
|
|
@@ -36,14 +36,13 @@ import {
|
|
|
36
36
|
vec4,
|
|
37
37
|
} from "three/tsl";
|
|
38
38
|
import {
|
|
39
|
-
|
|
39
|
+
Node,
|
|
40
40
|
type NodeBuilder,
|
|
41
41
|
type NodeFrame,
|
|
42
42
|
NodeMaterial,
|
|
43
43
|
NodeUpdateType,
|
|
44
44
|
QuadMesh,
|
|
45
45
|
RendererUtils,
|
|
46
|
-
TempNode,
|
|
47
46
|
} from "three/webgpu";
|
|
48
47
|
import {
|
|
49
48
|
BOTTOM_KM,
|
|
@@ -259,7 +258,7 @@ function cloudNoise() {
|
|
|
259
258
|
const skyDisc = uniform(1);
|
|
260
259
|
|
|
261
260
|
/** Cached passes: only texture reads and the analytic disc run at screen resolution. */
|
|
262
|
-
class GpuSkyNode extends
|
|
261
|
+
class GpuSkyNode extends Node<"vec3"> {
|
|
263
262
|
static get type(): string {
|
|
264
263
|
return "GpuSkyNode";
|
|
265
264
|
}
|
|
@@ -271,7 +270,7 @@ class GpuSkyNode extends TempNode<"vec3"> {
|
|
|
271
270
|
};
|
|
272
271
|
readonly materials: NodeMaterial[] = [];
|
|
273
272
|
readonly sun = uniform(new Vector3());
|
|
274
|
-
readonly #quad = new QuadMesh();
|
|
273
|
+
readonly #quad = new QuadMesh(new NodeMaterial());
|
|
275
274
|
readonly #noise = cloudNoise();
|
|
276
275
|
readonly #fog = uniform(new Color());
|
|
277
276
|
readonly #scale = vec3(...temperatureColour(SUN_KELVIN)).mul(SUN_ILLUMINANCE * SKY_TO_SUN);
|
|
@@ -55,9 +55,9 @@ export function createTemporalAA(
|
|
|
55
55
|
resolve.equations,
|
|
56
56
|
currentProducer?.publishDepth,
|
|
57
57
|
);
|
|
58
|
-
const hooks = createTemporalAAHooks(frames.jitterInput);
|
|
58
|
+
const hooks = createTemporalAAHooks(frames.jitterInput, () => internals.clearViewOffset());
|
|
59
59
|
let ownedViewOffset: { width: number; height: number } | null = null;
|
|
60
|
-
|
|
60
|
+
let projection: Matrix4 | undefined;
|
|
61
61
|
const setViewOffset = internals.setViewOffset.bind(node);
|
|
62
62
|
const clearViewOffset = internals.clearViewOffset.bind(node);
|
|
63
63
|
let pending: TemporalResetReason | null = "initial";
|
|
@@ -90,8 +90,10 @@ export function createTemporalAA(
|
|
|
90
90
|
const aspect = (camera as PerspectiveCamera).aspect;
|
|
91
91
|
if (ownedViewOffset !== null) camera.clearViewOffset();
|
|
92
92
|
camera.updateProjectionMatrix();
|
|
93
|
-
|
|
94
|
-
|
|
93
|
+
// The first observation is the baseline: the `initial` reset already drops history. Three 0.187
|
|
94
|
+
// asks for the offset from the pipeline's before-callback, after the frame cleared `pending`.
|
|
95
|
+
if (projection?.equals(camera.projectionMatrix) === false) pending ??= "projection-change";
|
|
96
|
+
projection = (projection ?? new Matrix4()).copy(camera.projectionMatrix);
|
|
95
97
|
setViewOffset(width, height);
|
|
96
98
|
if ((camera as PerspectiveCamera).aspect !== aspect) {
|
|
97
99
|
(camera as PerspectiveCamera).aspect = aspect;
|
|
@@ -108,14 +110,13 @@ export function createTemporalAA(
|
|
|
108
110
|
properties.temporalColour = node.beautyNode;
|
|
109
111
|
properties.temporalDepth = depth;
|
|
110
112
|
properties.temporalVelocity = velocity;
|
|
111
|
-
const pipeline = (builder.context as { renderPipeline?:
|
|
112
|
-
|
|
113
|
-
// The originals are read before upstream's setup writes the node's own pair over them.
|
|
114
|
-
if (pipeline !== undefined) hooks.captureBeforeSetup(pipeline.context);
|
|
113
|
+
const pipeline = (builder.context as { renderPipeline?: unknown }).renderPipeline;
|
|
114
|
+
if (pipeline !== undefined) hooks.claim(builder.context, node);
|
|
115
115
|
const output = setup(builder);
|
|
116
116
|
resolve.configure(builder.renderer);
|
|
117
117
|
// Upstream's resolve is what this replaces, so the reset kernel runs by default.
|
|
118
|
-
if (pipeline !== undefined)
|
|
118
|
+
if (pipeline !== undefined)
|
|
119
|
+
hooks.installAfterSetup(builder.context as PipelineContext, builder.renderer);
|
|
119
120
|
// VelocityNode keeps whichever projection source that input pass first compiles: prime ours.
|
|
120
121
|
if (ownedViewOffset === null) {
|
|
121
122
|
camera.updateProjectionMatrix();
|
|
@@ -37,7 +37,8 @@ export function createTemporalAAFrame(
|
|
|
37
37
|
rejection: () => TemporalDepthRejection | undefined,
|
|
38
38
|
publishCurrentDepth?: (renderer: Renderer) => void,
|
|
39
39
|
) {
|
|
40
|
-
|
|
40
|
+
// Three 0.187's QuadMesh takes a material in the constructor; the draw replaces it before rendering.
|
|
41
|
+
const quadMesh = new QuadMesh(internals._resolveMaterial);
|
|
41
42
|
quadMesh.name = "Temporal AA";
|
|
42
43
|
const display = new Vector2();
|
|
43
44
|
let previousDepth: DepthTexture | null = null;
|
|
@@ -83,10 +84,6 @@ export function createTemporalAAFrame(
|
|
|
83
84
|
internals._cameraWorldMatrix.value.copy(camera.matrixWorld);
|
|
84
85
|
internals._cameraWorldMatrixInverse.value.copy(camera.matrixWorldInverse);
|
|
85
86
|
internals._cameraProjectionMatrixInverse.value.copy(camera.projectionMatrixInverse);
|
|
86
|
-
if (internals._needsPostProcessingSync === true) {
|
|
87
|
-
internals.setViewOffset(input.x, input.y);
|
|
88
|
-
internals._needsPostProcessingSync = false;
|
|
89
|
-
}
|
|
90
87
|
historyValid.value = reset ? 0 : 1;
|
|
91
88
|
// Depth history stays input sized, independently of display history. Seed on either-axis resize.
|
|
92
89
|
if (previousDepth?.image.width !== input.x || previousDepth?.image.height !== input.y) {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
// Generated user source: who owns the
|
|
2
|
-
//
|
|
3
|
-
//
|
|
1
|
+
// Generated user source: who owns the pipeline callbacks a temporal AA compile borrows. Three 0.187
|
|
2
|
+
// keeps one callback list per pipeline boundary in the node builder's context, and its TRAANode only
|
|
3
|
+
// registers its own pair while nothing owns the view offset. The provider claims that ownership, so
|
|
4
|
+
// this pair is the one the pipeline drives: the jitter before the pass draws, the clear after it.
|
|
4
5
|
import type { Matrix4 } from "three";
|
|
5
|
-
import type { NodeMaterial, RenderTarget, Renderer, TextureNode } from "three/webgpu";
|
|
6
|
+
import type { Node, NodeMaterial, RenderTarget, Renderer, TextureNode } from "three/webgpu";
|
|
6
7
|
import type { ITemporalResolvePinned } from "./temporalResolveDepth.js";
|
|
7
8
|
|
|
8
9
|
export interface ITemporalAANode extends ITemporalResolvePinned {
|
|
9
10
|
_resolveMaterial: NodeMaterial;
|
|
10
|
-
|
|
11
|
-
_historyValidUniform: { value: number };
|
|
11
|
+
_historyValidUniform: Node<"float"> & { value: number };
|
|
12
12
|
_originalProjectionMatrix: Matrix4;
|
|
13
13
|
_velocityNode: {
|
|
14
14
|
projectionMatrix: Matrix4 | null;
|
|
@@ -43,57 +43,79 @@ export function guardTemporalAASeams(node: ITemporalAANode): void {
|
|
|
43
43
|
throw new Error("Temporal AA requires the pinned TRAANode resolve seams of Three 0.185.1.");
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
+
/** The pipeline's context in a node builder: three keeps one callback list per boundary. */
|
|
46
47
|
export type PipelineContext = {
|
|
47
|
-
|
|
48
|
-
|
|
48
|
+
onBeforePipelineCallbacks?: (() => void)[];
|
|
49
|
+
onAfterPipelineCallbacks?: (() => void)[];
|
|
49
50
|
};
|
|
50
51
|
|
|
51
|
-
|
|
52
|
+
/** Who owns the pipeline's view offset; three's own TRAANode registers its pair while it is null. */
|
|
53
|
+
export type ITemporalAARenderPipelineState = {
|
|
54
|
+
renderPipelineState?: { viewOffsetOwner: unknown };
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export function createTemporalAAHooks(jitter: (renderer: Renderer) => void, clear: () => void) {
|
|
52
58
|
let context: PipelineContext | undefined;
|
|
53
|
-
let previousBefore: (() => void) | undefined;
|
|
54
|
-
let previousAfter: (() => void) | undefined;
|
|
55
59
|
let ownedBefore: (() => void) | undefined;
|
|
56
60
|
let ownedAfter: (() => void) | undefined;
|
|
57
61
|
|
|
58
|
-
/**
|
|
59
|
-
* Each borrowed slot goes back to the original its own context held, and only while it is still
|
|
60
|
-
* this node's: a later owner keeps the slot, and upstream's pair belongs to the node.
|
|
61
|
-
*/
|
|
62
|
+
/** Only this compile's pair goes back: a later owner's callbacks keep their place. */
|
|
62
63
|
function restore(): void {
|
|
63
64
|
if (context === undefined) return;
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
if (
|
|
65
|
+
const before = context.onBeforePipelineCallbacks;
|
|
66
|
+
const after = context.onAfterPipelineCallbacks;
|
|
67
|
+
if (before !== undefined && ownedBefore !== undefined) {
|
|
68
|
+
const at = before.indexOf(ownedBefore);
|
|
69
|
+
if (at !== -1) before.splice(at, 1);
|
|
70
|
+
}
|
|
71
|
+
if (after !== undefined && ownedAfter !== undefined) {
|
|
72
|
+
const at = after.indexOf(ownedAfter);
|
|
73
|
+
if (at !== -1) after.splice(at, 1);
|
|
74
|
+
}
|
|
75
|
+
context = undefined;
|
|
67
76
|
}
|
|
68
77
|
|
|
69
78
|
return {
|
|
70
79
|
/**
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
80
|
+
* Three 0.187 keeps a pipeline's callbacks in the builder context and registers its own pair
|
|
81
|
+
* only while nothing owns the view offset. The provider owns it: upstream's pair would ask
|
|
82
|
+
* for the whole drawing buffer rather than the raster the input draws on.
|
|
83
|
+
*/
|
|
84
|
+
claim(builderContext: unknown, owner: unknown): void {
|
|
85
|
+
const state = (builderContext as ITemporalAARenderPipelineState).renderPipelineState;
|
|
86
|
+
if (state === undefined)
|
|
87
|
+
throw new Error("Temporal AA requires the render pipeline state of Three 0.187.0.");
|
|
88
|
+
state.viewOffsetOwner = owner;
|
|
89
|
+
this.captureBeforeSetup(builderContext as PipelineContext);
|
|
90
|
+
},
|
|
91
|
+
/**
|
|
92
|
+
* The context this compile pushes into, read before upstream's setup runs. A recompile into a
|
|
93
|
+
* fresh context object hands the previous one back first, so the context three stops calling
|
|
94
|
+
* keeps nothing it borrowed.
|
|
74
95
|
*/
|
|
75
96
|
captureBeforeSetup(next: PipelineContext): void {
|
|
76
97
|
if (context === next) return;
|
|
77
98
|
restore();
|
|
78
99
|
context = next;
|
|
79
|
-
previousBefore = next.onBeforeRenderPipeline;
|
|
80
|
-
previousAfter = next.onAfterRenderPipeline;
|
|
81
100
|
},
|
|
82
101
|
/**
|
|
83
|
-
* The
|
|
84
|
-
*
|
|
85
|
-
*
|
|
102
|
+
* The pair the claimed view offset owes the pipeline. The jitter keeps its identity across
|
|
103
|
+
* recompiles, so a second setup into the same context finds its callbacks instead of adding
|
|
104
|
+
* them twice, and the clear stays with it so the jitter index advances once per frame.
|
|
86
105
|
*/
|
|
87
106
|
installAfterSetup(next: PipelineContext, renderer: Renderer): void {
|
|
88
107
|
ownedBefore ??= () => jitter(renderer);
|
|
89
|
-
ownedAfter
|
|
90
|
-
next.
|
|
108
|
+
ownedAfter ??= clear;
|
|
109
|
+
if (next.onBeforePipelineCallbacks === undefined) next.onBeforePipelineCallbacks = [];
|
|
110
|
+
if (next.onAfterPipelineCallbacks === undefined) next.onAfterPipelineCallbacks = [];
|
|
111
|
+
const before = next.onBeforePipelineCallbacks;
|
|
112
|
+
const after = next.onAfterPipelineCallbacks;
|
|
113
|
+
if (!before.includes(ownedBefore)) before.push(ownedBefore);
|
|
114
|
+
if (!after.includes(ownedAfter)) after.push(ownedAfter);
|
|
115
|
+
context = next;
|
|
91
116
|
},
|
|
92
117
|
dispose(): void {
|
|
93
118
|
restore();
|
|
94
|
-
context = undefined;
|
|
95
|
-
previousBefore = undefined;
|
|
96
|
-
previousAfter = undefined;
|
|
97
119
|
ownedBefore = undefined;
|
|
98
120
|
ownedAfter = undefined;
|
|
99
121
|
},
|
|
@@ -69,7 +69,7 @@ export interface ITemporalResolvePinned {
|
|
|
69
69
|
_previousCameraWorldMatrix: Node<"mat4"> & ITemporalUniform<Matrix4>;
|
|
70
70
|
_previousCameraProjectionMatrixInverse: Node<"mat4"> & ITemporalUniform<Matrix4>;
|
|
71
71
|
/** Installed by `createTemporalAA`. 0 on a reset frame, which then weights current colour only. */
|
|
72
|
-
_historyValidUniform?: ITemporalUniform<number>;
|
|
72
|
+
_historyValidUniform?: Node<"float"> & ITemporalUniform<number>;
|
|
73
73
|
/** Input-pixel jitter for current-frame reconstruction, captured beside the depth matrices. */
|
|
74
74
|
_reconstructionJitterOffset?: Node<"vec2"> & ITemporalUniform<Vector2>;
|
|
75
75
|
/** Actual input jitter, in input-raster UVs, captured beside the matching depth matrices. */
|
|
@@ -138,7 +138,7 @@ export function createTemporalDepthRejection(
|
|
|
138
138
|
offsetUV: "vec2",
|
|
139
139
|
});
|
|
140
140
|
// Absent on a standalone node, which then keeps upstream's own history reuse unchanged.
|
|
141
|
-
const historyValid =
|
|
141
|
+
const historyValid = node._historyValidUniform ?? float(1);
|
|
142
142
|
/**
|
|
143
143
|
* The one history-validity decision, parameterised by the pixel's own UV: `historyValid ∧ validUV
|
|
144
144
|
* ∧ ¬disocclusion`. The resolve weights its blend with this, and the rejection counter calls the
|
|
@@ -18,23 +18,23 @@
|
|
|
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.10",
|
|
22
|
+
"@threenative/physics": "0.3.10",
|
|
23
|
+
"@threenative/ui": "0.3.10",
|
|
24
24
|
"react": "19.2.0",
|
|
25
25
|
"react-dom": "19.2.0",
|
|
26
|
-
"three": "0.
|
|
26
|
+
"three": "0.187.0"
|
|
27
27
|
},
|
|
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.11",
|
|
32
|
+
"@threenative/playtest": "0.3.10",
|
|
33
33
|
"@types/react": "19.2.0",
|
|
34
34
|
"@types/react-dom": "19.2.0",
|
|
35
|
-
"@types/three": "0.
|
|
35
|
+
"@types/three": "0.187.0",
|
|
36
36
|
"@vitejs/plugin-react": "6.0.5",
|
|
37
|
-
"create-threenative": "0.2.
|
|
37
|
+
"create-threenative": "0.2.14",
|
|
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.10"
|
|
48
48
|
},
|
|
49
49
|
"overrides": {
|
|
50
50
|
"sharp": ">=0.35.4",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
},
|
|
57
57
|
"onlyBuiltDependencies": ["@threenative/core", "@threenative/runtime-native"],
|
|
58
58
|
"patchedDependencies": {
|
|
59
|
-
"three@0.
|
|
59
|
+
"three@0.187.0": "patches/three@0.187.0.patch",
|
|
60
60
|
"vite@8.2.0": "patches/vite@8.2.0.patch",
|
|
61
61
|
"@tailwindcss/node@4.3.3": "patches/@tailwindcss__node@4.3.3.patch"
|
|
62
62
|
}
|