@vgai/engine 0.5.11 → 0.5.13
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 +6 -5
- package/dist/adapter/authoring.d.ts +51 -28
- package/dist/adapter/authoring.d.ts.map +1 -1
- package/dist/adapter/body-marks.d.ts +59 -0
- package/dist/adapter/body-marks.d.ts.map +1 -0
- package/dist/adapter/body-marks.js +62 -0
- package/dist/adapter/constraint.d.ts +41 -0
- package/dist/adapter/constraint.d.ts.map +1 -0
- package/dist/adapter/constraint.js +27 -0
- package/dist/adapter/hierarchy-marks.d.ts +138 -0
- package/dist/adapter/hierarchy-marks.d.ts.map +1 -0
- package/dist/adapter/hierarchy-marks.js +148 -0
- package/dist/adapter/index.d.ts +1 -1
- package/dist/adapter/index.d.ts.map +1 -1
- package/dist/adapter/ingest/contract-system-adapters.d.ts +64 -0
- package/dist/adapter/ingest/contract-system-adapters.d.ts.map +1 -0
- package/dist/adapter/ingest/contract-system-adapters.js +134 -0
- package/dist/adapter/ingest/game-contract.d.ts +87 -9
- package/dist/adapter/ingest/game-contract.d.ts.map +1 -1
- package/dist/adapter/ingest/game-contract.js +7 -6
- package/dist/adapter/ingest/scene-capture.d.ts +31 -4
- package/dist/adapter/ingest/scene-capture.d.ts.map +1 -1
- package/dist/adapter/ingest/scene-capture.js +29 -7
- package/dist/adapter/ingest/structural-ids.d.ts +1 -1
- package/dist/adapter/ingest/structural-ids.js +2 -2
- package/dist/adapter/reflection-probe.d.ts +53 -0
- package/dist/adapter/reflection-probe.d.ts.map +1 -0
- package/dist/adapter/reflection-probe.js +18 -0
- package/dist/asset-formats/index.d.ts +4 -10
- package/dist/asset-formats/index.d.ts.map +1 -1
- package/dist/asset-formats/index.js +3 -8
- package/dist/asset-formats/material.d.ts +0 -66
- package/dist/asset-formats/material.d.ts.map +1 -1
- package/dist/asset-formats/material.js +0 -8
- package/dist/asset-formats/mesh.d.ts +1 -2
- package/dist/asset-formats/mesh.d.ts.map +1 -1
- package/dist/asset-formats/mesh.js +3 -13
- package/dist/asset-formats/render-env.d.ts +2 -2
- package/dist/asset-parse-error.d.ts +4 -5
- package/dist/asset-parse-error.d.ts.map +1 -1
- package/dist/asset-parse-error.js +4 -5
- package/dist/config.d.ts +7 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +7 -0
- package/dist/data/curve.d.ts +116 -0
- package/dist/data/curve.d.ts.map +1 -0
- package/dist/data/curve.js +230 -0
- package/dist/data/vite-plugin-data.d.ts +2 -2
- package/dist/data/vite-plugin-data.d.ts.map +1 -1
- package/dist/data/vite-plugin-data.js +24 -15
- package/dist/dev/performance-profiler.d.ts +1 -0
- package/dist/dev/performance-profiler.d.ts.map +1 -1
- package/dist/dev/performance-profiler.js +25 -2
- package/dist/ecs/user-data.d.ts +49 -1
- package/dist/ecs/user-data.d.ts.map +1 -1
- package/dist/ecs/user-data.js +34 -0
- package/dist/index.d.ts +2 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -3
- package/dist/manifest/index.d.ts +3 -3
- package/dist/manifest/index.d.ts.map +1 -1
- package/dist/manifest/index.js +2 -2
- package/dist/manifest/load.d.ts +15 -67
- package/dist/manifest/load.d.ts.map +1 -1
- package/dist/manifest/load.js +11 -103
- package/dist/manifest/schema.d.ts +18 -103
- package/dist/manifest/schema.d.ts.map +1 -1
- package/dist/manifest/schema.js +59 -179
- package/dist/pixi/index.d.ts +2 -3
- package/dist/pixi/index.d.ts.map +1 -1
- package/dist/pixi/index.js +2 -3
- package/dist/pixi/ingest.d.ts +7 -75
- package/dist/pixi/ingest.d.ts.map +1 -1
- package/dist/pixi/ingest.js +6 -14
- package/dist/pixi/scene-capture.d.ts +2 -2
- package/dist/pixi/scene-capture.js +2 -2
- package/dist/react/use-data.d.ts +10 -5
- package/dist/react/use-data.d.ts.map +1 -1
- package/dist/react/use-data.js +15 -15
- package/dist/render/viewport-shading.d.ts +1 -1
- package/dist/render/viewport-shading.d.ts.map +1 -1
- package/dist/render/viewport-shading.js +14 -0
- package/dist/runtime/create-runtime.d.ts +12 -0
- package/dist/runtime/create-runtime.d.ts.map +1 -1
- package/dist/runtime/create-runtime.js +7 -2
- package/dist/runtime/mount-game.d.ts +1 -1
- package/dist/runtime/mount-game.d.ts.map +1 -1
- package/dist/runtime/mount-manifest.d.ts.map +1 -1
- package/dist/runtime/mount-manifest.js +5 -1
- package/dist/world3d-react/r3f-adapter.d.ts.map +1 -1
- package/dist/world3d-react/r3f-adapter.js +69 -39
- package/dist/world3d-react/renderer-config.d.ts +15 -0
- package/dist/world3d-react/renderer-config.d.ts.map +1 -1
- package/dist/world3d-react/renderer-config.js +15 -0
- package/dist/world3d-react/world-context.d.ts +2 -1
- package/dist/world3d-react/world-context.d.ts.map +1 -1
- package/dist-config/config.js +140 -20
- package/dist-config/config.js.map +4 -4
- package/package.json +1 -1
- package/schemas/engine-capabilities.json +10 -10
- package/schemas/vgai-project.schema.json +21 -76
- package/src/adapter/authoring.ts +54 -31
- package/src/adapter/body-marks.ts +69 -0
- package/src/adapter/constraint.ts +71 -0
- package/src/adapter/hierarchy-marks.ts +155 -0
- package/src/adapter/index.ts +2 -3
- package/src/adapter/ingest/contract-system-adapters.ts +174 -0
- package/src/adapter/ingest/game-contract.ts +98 -9
- package/src/adapter/ingest/scene-capture.ts +61 -11
- package/src/adapter/ingest/structural-ids.ts +2 -2
- package/src/adapter/reflection-probe.ts +75 -0
- package/src/asset-formats/index.ts +4 -10
- package/src/asset-formats/material.ts +0 -11
- package/src/asset-formats/mesh.ts +3 -16
- package/src/asset-parse-error.ts +4 -5
- package/src/config.ts +13 -0
- package/src/data/curve.ts +263 -0
- package/src/data/vite-plugin-data.ts +48 -14
- package/src/dev/performance-profiler.ts +21 -2
- package/src/ecs/user-data.ts +50 -0
- package/src/index.ts +2 -3
- package/src/manifest/index.ts +3 -15
- package/src/manifest/load.ts +27 -143
- package/src/manifest/schema.ts +65 -223
- package/src/pixi/index.ts +2 -15
- package/src/pixi/ingest.ts +13 -87
- package/src/pixi/scene-capture.ts +2 -2
- package/src/react/use-data.ts +15 -20
- package/src/render/viewport-shading.ts +16 -1
- package/src/runtime/create-runtime.ts +30 -5
- package/src/runtime/mount-game.ts +1 -1
- package/src/runtime/mount-manifest.ts +5 -1
- package/src/world3d-react/r3f-adapter.tsx +73 -39
- package/src/world3d-react/renderer-config.ts +31 -0
- package/src/world3d-react/world-context.ts +2 -1
- package/dist/asset-formats/instances.d.ts +0 -17
- package/dist/asset-formats/instances.d.ts.map +0 -1
- package/dist/asset-formats/instances.js +0 -31
- package/dist/asset-formats/parse.d.ts +0 -20
- package/dist/asset-formats/parse.d.ts.map +0 -1
- package/dist/asset-formats/parse.js +0 -34
- package/dist/pixi/ingest-iframe.d.ts +0 -82
- package/dist/pixi/ingest-iframe.d.ts.map +0 -1
- package/dist/pixi/ingest-iframe.js +0 -166
- package/dist/render/instance-mesh.d.ts +0 -5
- package/dist/render/instance-mesh.d.ts.map +0 -1
- package/dist/render/instance-mesh.js +0 -19
- package/schemas/mat.schema.json +0 -255
- package/src/asset-formats/instances.ts +0 -38
- package/src/asset-formats/parse.ts +0 -39
- package/src/pixi/ingest-iframe.ts +0 -255
- package/src/render/instance-mesh.ts +0 -25
|
@@ -49,6 +49,7 @@ export class ViewportShadingRenderer {
|
|
|
49
49
|
}
|
|
50
50
|
dispose() {
|
|
51
51
|
for (const pair of this._derived.values()) {
|
|
52
|
+
pair.clay.dispose();
|
|
52
53
|
pair.unlit.dispose();
|
|
53
54
|
pair.wireframe.dispose();
|
|
54
55
|
}
|
|
@@ -77,6 +78,19 @@ export class ViewportShadingRenderer {
|
|
|
77
78
|
fog: material.fog ?? true,
|
|
78
79
|
};
|
|
79
80
|
pair = {
|
|
81
|
+
clay: new THREE.MeshStandardMaterial({
|
|
82
|
+
color: 0xaeb6c0,
|
|
83
|
+
roughness: 0.82,
|
|
84
|
+
metalness: 0,
|
|
85
|
+
flatShading: true,
|
|
86
|
+
alphaMap: textureOf(material, 'alphaMap'),
|
|
87
|
+
alphaTest: material.alphaTest,
|
|
88
|
+
opacity: material.opacity,
|
|
89
|
+
transparent: material.transparent,
|
|
90
|
+
side: material.side,
|
|
91
|
+
depthTest: material.depthTest,
|
|
92
|
+
depthWrite: material.depthWrite,
|
|
93
|
+
}),
|
|
80
94
|
unlit: new THREE.MeshBasicMaterial(common),
|
|
81
95
|
wireframe: new THREE.MeshBasicMaterial({ ...common, wireframe: true }),
|
|
82
96
|
};
|
|
@@ -180,6 +180,18 @@ export interface RootsRuntimeConfig {
|
|
|
180
180
|
* a 2D canvas renderer with no GPU. Never set `true` in a real host.
|
|
181
181
|
*/
|
|
182
182
|
headless?: boolean | undefined;
|
|
183
|
+
/**
|
|
184
|
+
* `vgai.project.json`'s `rendering.antialias` — whether every three root's
|
|
185
|
+
* WebGL context is built with a multisampled drawing buffer.
|
|
186
|
+
*
|
|
187
|
+
* It is a RUNTIME-CONFIG option rather than a world's own
|
|
188
|
+
* `WorldRendererConfig` field for the reason that file's header gives: a
|
|
189
|
+
* context's sample count is fixed at CREATION, before any world exists, so
|
|
190
|
+
* there is no honest moment at which a world could ask for it. The
|
|
191
|
+
* manifest-aware boot path (`mount-manifest.ts`) is the real reader;
|
|
192
|
+
* omitting it leaves `createHostRenderer`'s own registry default alone.
|
|
193
|
+
*/
|
|
194
|
+
antialias?: boolean | undefined;
|
|
183
195
|
/** D15 (T-D15.1) — the root seed `ctx.random` boots from on every world
|
|
184
196
|
* mounted onto this session's Game, forwarded to `createGame` BEFORE any
|
|
185
197
|
* world's `mount()`/`setup()` runs (this function constructs the Game
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-runtime.d.ts","sourceRoot":"","sources":["../../src/runtime/create-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAqB,cAAc,EAAoB,MAAM,yBAAyB,CAAC;AACnG,OAAO,KAAK,EACV,eAAe,E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S,CAAC;KACvD,GACD,SAAS,CAAC;CACf;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,WAAW;IAC1B,IAAI,IAAI,IAAI,CAAC;IACb,KAAK,IAAI,IAAI,CAAC;IACd,MAAM,IAAI,IAAI,CAAC;IACf,IAAI,IAAI,IAAI,CAAC;IACb;;oEAEgE;IAChE,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACjE,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,KAAK,CAAC,iBAAiB,CAAC;IACzC;;;;;;;8DAO0D;IAC1D,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC;IAC9B;;+DAE2D;IAC3D,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;CACrB;AAED;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,WAAW,CAAC,CAExF"}
|
|
@@ -130,10 +130,14 @@ function createHeadlessRendererStub() {
|
|
|
130
130
|
* `createRootsGameRuntime` purely to keep that function's own branching
|
|
131
131
|
* simple — see `mountOnePixiRoot` for the canvas sibling. */
|
|
132
132
|
async function mountOneThreeRoot(spec, ctx) {
|
|
133
|
-
const { game, canvas, w, h, dpr, isBottom, headless, assets } = ctx;
|
|
133
|
+
const { game, canvas, w, h, dpr, isBottom, headless, assets, antialias } = ctx;
|
|
134
134
|
const renderer = headless
|
|
135
135
|
? createHeadlessRendererStub()
|
|
136
|
-
: createHostRenderer(canvas, w, h,
|
|
136
|
+
: createHostRenderer(canvas, w, h,
|
|
137
|
+
// The manifest's `rendering.antialias` reaches the WebGL context here and NOWHERE else:
|
|
138
|
+
// `createHostRenderer` passes it straight to the constructor, and the sample count is
|
|
139
|
+
// fixed from that moment. Omitted → the render-settings registry's own default.
|
|
140
|
+
antialias === undefined ? undefined : { antialias }, {
|
|
137
141
|
alpha: !isBottom,
|
|
138
142
|
preserveDrawingBuffer: true,
|
|
139
143
|
});
|
|
@@ -562,6 +566,7 @@ async function createRootsGameRuntime(config) {
|
|
|
562
566
|
dpr,
|
|
563
567
|
headless,
|
|
564
568
|
assets,
|
|
569
|
+
antialias: config.antialias,
|
|
565
570
|
});
|
|
566
571
|
// --- Delegating input router (D5 §2a) ---
|
|
567
572
|
const router = createInputRouter(container, routerEntries);
|
|
@@ -29,7 +29,7 @@ export interface ManifestHost {
|
|
|
29
29
|
/** Resolve asset/scene URLs relative to the project — forwarded to a
|
|
30
30
|
* registered {@link AdapterSurfaceFactory} via {@link AdapterSurfaceFactoryContext},
|
|
31
31
|
* never called by this module itself (a factory only needs it for a
|
|
32
|
-
* non-default resolution scheme, e.g. a
|
|
32
|
+
* non-default resolution scheme, e.g. a project served under a base path). */
|
|
33
33
|
resolveUrl?(path: string): string;
|
|
34
34
|
readonly width?: number | undefined;
|
|
35
35
|
readonly height?: number | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mount-game.d.ts","sourceRoot":"","sources":["../../src/runtime/mount-game.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,KAAK,UAAU,EAAuC,MAAM,kBAAkB,CAAC;AAQxF;;;;;GAKG;AACH,MAAM,WAAW,YAAY;IAC3B;6DACyD;IACzD,QAAQ,CAAC,SAAS,EAAE,WAAW,CAAC;IAChC;;;;;;;;;;;;;OAaG;IACH,eAAe,CAAC,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACjD;;;
|
|
1
|
+
{"version":3,"file":"mount-game.d.ts","sourceRoot":"","sources":["../../src/runtime/mount-game.ts"],"names":[],"mappings":"AAoBA,OAAO,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d;;;;;;;OAOG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,qEAAqE;IACrE,QAAQ,CAAC,QAAQ,CAAC,EAAE,eAAe,GAAG,IAAI,GAAG,SAAS,CAAC;IACvD;;;;;;;OAOG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACzC;;;kFAG8E;IAC9E,QAAQ,CAAC,OAAO,CAAC,EAAE;QAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS,CAAC;CAC5D;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE;IAC3C,QAAQ,CAAC,WAAW,EAAE,oBAAoB,CAAC,aAAa,CAAC,CAAC;IAC1D,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1C,QAAQ,CAAC,GAAG,EAAE;QAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS,CAAC;CACvD,GAAG,MAAM,GAAG,SAAS,CAIrB;AAkBD,MAAM,MAAM,sBAAsB,GAAG,WAAW,CAAC;AA8BjD;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,OAAO,GAAG,oBAAoB,CAGlE;AA8HD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAAC,WAAW,CAAC,CAsGzF"}
|
|
@@ -120,7 +120,7 @@ function resolveThreeAdapter(world, entry) {
|
|
|
120
120
|
if (world.adapter.type === 'ingest') {
|
|
121
121
|
throw new Error(`mountManifestRoots: world "${world.id}" (three) declares an { ingest } adapter — ` +
|
|
122
122
|
"ingest roots require the editor's dev-server-backed mount machinery (an EditorStore " +
|
|
123
|
-
"plus
|
|
123
|
+
"plus in-realm scene capture, see adapter-resolver.ts's resolveIngestThreeAdapter) and are " +
|
|
124
124
|
'not supported by mountManifestRoots (no porting aids, no hosted ingest routes).');
|
|
125
125
|
}
|
|
126
126
|
// type === 'default'
|
|
@@ -252,6 +252,10 @@ export async function mountManifestRoots(opts) {
|
|
|
252
252
|
width: opts.width ?? manifest.resolution?.width,
|
|
253
253
|
height: opts.height ?? manifest.resolution?.height,
|
|
254
254
|
headless: opts.headless,
|
|
255
|
+
// `rendering.antialias` reaches the WebGL context at CONSTRUCTION and can be honoured
|
|
256
|
+
// nowhere else — see the manifest schema's own `rendering` block and
|
|
257
|
+
// `world3d-react/renderer-config.ts`'s header for why it is not a world-level declaration.
|
|
258
|
+
...(manifest.rendering === undefined ? {} : { antialias: manifest.rendering.antialias }),
|
|
255
259
|
seed: resolvedSeed,
|
|
256
260
|
playtest: opts.playtest,
|
|
257
261
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"r3f-adapter.d.ts","sourceRoot":"","sources":["../../src/world3d-react/r3f-adapter.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AASH,OAAO,EAAiB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,KAAK,EAAoB,WAAW,EAAoB,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"r3f-adapter.d.ts","sourceRoot":"","sources":["../../src/world3d-react/r3f-adapter.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AASH,OAAO,EAAiB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,KAAK,EAAoB,WAAW,EAAoB,MAAM,YAAY,CAAC;AAalF,OAAO,EAA4B,KAAK,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAYvF,sEAAsE;AACtE,MAAM,WAAW,uBAAuB;IACtC,qEAAqE;IACrE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB;;uBAEmB;IACnB,QAAQ,CAAC,OAAO,EAAE,SAAS,CAAC;IAC5B;;;;0CAIsC;IACtC,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAClD;;;iDAG6C;IAC7C,QAAQ,CAAC,QAAQ,CAAC,EAAE,mBAAmB,GAAG,SAAS,CAAC;CACrD;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,uBAAuB,GAAG,WAAW,CAge9E"}
|
|
@@ -21,7 +21,10 @@
|
|
|
21
21
|
import { advance, createRoot, extend, events as pointerEvents, } from '@react-three/fiber';
|
|
22
22
|
import { createElement } from 'react';
|
|
23
23
|
import { registerRenderVitals } from '../dev/register-render-vitals';
|
|
24
|
+
import { createRenderDebugAdapter, frameCaptureContextFor, } from '../dev/render-debug-adapter';
|
|
25
|
+
import { collectRenderMemory } from '../dev/render-memory';
|
|
24
26
|
import { RENDER_SUBMIT_PHASE } from '../dev/render-vitals';
|
|
27
|
+
import { createWebGLFrameCapture } from '../dev/webgl-frame-capture';
|
|
25
28
|
import { WorldProvider } from '../react/world-state';
|
|
26
29
|
import { devLayersEnabled } from '../runtime/dev-layers';
|
|
27
30
|
import { EngineBridge } from './engine-bridge';
|
|
@@ -328,6 +331,25 @@ export function createR3FAdapter(options) {
|
|
|
328
331
|
renderer: host.renderer,
|
|
329
332
|
});
|
|
330
333
|
}
|
|
334
|
+
// Engine-owned render introspection, built over the SAME renderer and
|
|
335
|
+
// scene Fiber uses. A design-time stand-in has no context and a
|
|
336
|
+
// headless mount returned above, so both honestly omit the capability.
|
|
337
|
+
// `frameCaptureContextFor` is the same construction gate as the classic
|
|
338
|
+
// Three adapter; no editor-side renderer inference is involved.
|
|
339
|
+
const rendererContext = typeof host.renderer.getContext === 'function' ? host.renderer.getContext() : undefined;
|
|
340
|
+
const frameCaptureContext = frameCaptureContextFor(false, rendererContext);
|
|
341
|
+
const frameCapture = frameCaptureContext
|
|
342
|
+
? createWebGLFrameCapture(frameCaptureContext)
|
|
343
|
+
: null;
|
|
344
|
+
const renderDebugWiring = frameCapture
|
|
345
|
+
? createRenderDebugAdapter({
|
|
346
|
+
capture: frameCapture,
|
|
347
|
+
scene: state.scene,
|
|
348
|
+
memory: () => collectRenderMemory(live().scene, host.renderer.info),
|
|
349
|
+
})
|
|
350
|
+
: null;
|
|
351
|
+
if (renderDebugWiring)
|
|
352
|
+
runtime.systemAdapters.renderDebug = renderDebugWiring.adapter;
|
|
331
353
|
// The engine drives every `useFrame` through the mounted world's
|
|
332
354
|
// `update(dt)` hook, never off a raw host-loop callback. That is the
|
|
333
355
|
// whole pause story: `runFrameImpl` (`runtime/game.ts`) calls
|
|
@@ -379,9 +401,10 @@ export function createR3FAdapter(options) {
|
|
|
379
401
|
return live().camera;
|
|
380
402
|
},
|
|
381
403
|
drivesOwnLoop: false,
|
|
382
|
-
// Adapter surface: `debug`
|
|
383
|
-
//
|
|
384
|
-
// `ctx.registerSystemAdapter` exactly
|
|
404
|
+
// Adapter surface: `debug` (the shared game registry) and, when a real
|
|
405
|
+
// WebGL2 context exists, `renderDebug` are engine-seeded. Game code
|
|
406
|
+
// adds its own capabilities via `ctx.registerSystemAdapter` exactly
|
|
407
|
+
// as in a classic world.
|
|
385
408
|
systems: runtime.systemAdapters,
|
|
386
409
|
update(dt) {
|
|
387
410
|
elapsed += dt;
|
|
@@ -399,51 +422,58 @@ export function createR3FAdapter(options) {
|
|
|
399
422
|
// then fiber's advance (useFrame callbacks + the actual render see
|
|
400
423
|
// the fresh state). Both are host-gated: neither runs while frozen.
|
|
401
424
|
systems.run(dt);
|
|
402
|
-
|
|
403
|
-
if (!profiler?.enabled) {
|
|
404
|
-
advance(elapsed, true, current);
|
|
405
|
-
return;
|
|
406
|
-
}
|
|
407
|
-
// Issue #1504's measurement, produced where the draw actually
|
|
408
|
-
// happens. `advance()` under `frameloop: 'never'` is what calls
|
|
409
|
-
// `gl.render(scene, camera)`, so this bracket — not a phase span
|
|
410
|
-
// inside `systems` — is the frame's CPU submission cost, and it is
|
|
411
|
-
// also what makes this frame a PRESENTATION as far as the vitals
|
|
412
|
-
// fold is concerned (`../dev/render-vitals.ts`: no bracket, no
|
|
413
|
-
// display frame). The profiler's phase clock is a stack, so
|
|
414
|
-
// bracketing here cannot truncate an enclosing phase.
|
|
415
|
-
const info = host.renderer.info;
|
|
416
|
-
const passesBefore = info?.render.frame ?? 0;
|
|
417
|
-
profiler.beginPhase();
|
|
425
|
+
renderDebugWiring?.beforeRender();
|
|
418
426
|
try {
|
|
419
|
-
|
|
427
|
+
const profiler = host.game?.profiler;
|
|
428
|
+
if (!profiler?.enabled) {
|
|
429
|
+
advance(elapsed, true, current);
|
|
430
|
+
return;
|
|
431
|
+
}
|
|
432
|
+
// Issue #1504's measurement, produced where the draw actually
|
|
433
|
+
// happens. `advance()` under `frameloop: 'never'` is what calls
|
|
434
|
+
// `gl.render(scene, camera)`, so this bracket — not a phase span
|
|
435
|
+
// inside `systems` — is the frame's CPU submission cost, and it is
|
|
436
|
+
// also what makes this frame a PRESENTATION as far as the vitals
|
|
437
|
+
// fold is concerned (`../dev/render-vitals.ts`: no bracket, no
|
|
438
|
+
// display frame). The profiler's phase clock is a stack, so
|
|
439
|
+
// bracketing here cannot truncate an enclosing phase.
|
|
440
|
+
const info = host.renderer.info;
|
|
441
|
+
const passesBefore = info?.render.frame ?? 0;
|
|
442
|
+
profiler.beginPhase();
|
|
443
|
+
try {
|
|
444
|
+
advance(elapsed, true, current);
|
|
445
|
+
}
|
|
446
|
+
finally {
|
|
447
|
+
profiler.endPhase(RENDER_SUBMIT_PHASE);
|
|
448
|
+
}
|
|
449
|
+
// Checked, not assumed — a duck-typed/design-time renderer supplies
|
|
450
|
+
// only what a mount needs, and a mount with no counters must report
|
|
451
|
+
// NOTHING rather than throw once per frame (the classic adapter's
|
|
452
|
+
// `postFrame` pays for the same assumption for the same reason).
|
|
453
|
+
// `gpuMs` is null: this path runs no GPU timer, and the profiler
|
|
454
|
+
// keeps the previous reading rather than inventing a zero.
|
|
455
|
+
if (info) {
|
|
456
|
+
profiler.reportRender({
|
|
457
|
+
gpuMs: null,
|
|
458
|
+
drawCalls: info.render.calls,
|
|
459
|
+
triangles: info.render.triangles,
|
|
460
|
+
geometries: info.memory.geometries,
|
|
461
|
+
textures: info.memory.textures,
|
|
462
|
+
renderPasses: info.render.frame - passesBefore,
|
|
463
|
+
});
|
|
464
|
+
}
|
|
420
465
|
}
|
|
421
466
|
finally {
|
|
422
|
-
|
|
423
|
-
}
|
|
424
|
-
// Checked, not assumed — a duck-typed/design-time renderer supplies
|
|
425
|
-
// only what a mount needs, and a mount with no counters must report
|
|
426
|
-
// NOTHING rather than throw once per frame (the classic adapter's
|
|
427
|
-
// `postFrame` pays for the same assumption for the same reason).
|
|
428
|
-
// `gpuMs` is null: this path runs no GPU timer, and the profiler
|
|
429
|
-
// keeps the previous reading rather than inventing a zero.
|
|
430
|
-
if (info) {
|
|
431
|
-
profiler.reportRender({
|
|
432
|
-
gpuMs: null,
|
|
433
|
-
drawCalls: info.render.calls,
|
|
434
|
-
triangles: info.render.triangles,
|
|
435
|
-
geometries: info.memory.geometries,
|
|
436
|
-
textures: info.memory.textures,
|
|
437
|
-
renderPasses: info.render.frame - passesBefore,
|
|
438
|
-
});
|
|
467
|
+
renderDebugWiring?.afterRender();
|
|
439
468
|
}
|
|
440
469
|
},
|
|
441
470
|
resize(width, height) {
|
|
442
471
|
live().setSize(width, height);
|
|
443
472
|
},
|
|
444
473
|
dispose() {
|
|
445
|
-
//
|
|
446
|
-
//
|
|
474
|
+
// Reject/restore a pending capture while its renderables still
|
|
475
|
+
// exist, then unmount component effects and strip runtime state.
|
|
476
|
+
renderDebugWiring?.dispose();
|
|
447
477
|
root.unmount();
|
|
448
478
|
// The vitals fold owns two `profiler.subscribe` registrations, and
|
|
449
479
|
// `runtime.dispose()`'s `strip(id)` removes the REGISTRATIONS only —
|
|
@@ -36,11 +36,26 @@ export type WorldToneMapping = 'none' | 'linear' | 'reinhard' | 'cineon' | 'aces
|
|
|
36
36
|
* result is already in display space and encoding it a second time washes the frame out.
|
|
37
37
|
*/
|
|
38
38
|
export type WorldOutputColorSpace = 'srgb' | 'srgb-linear';
|
|
39
|
+
/**
|
|
40
|
+
* The shadow-map filter, named as data rather than as three's numeric enum.
|
|
41
|
+
*
|
|
42
|
+
* This is a renderer INSTANCE property (`WebGLRenderer.shadowMap.type`), not a context attribute,
|
|
43
|
+
* so unlike MSAA it has an honest moment at which a world can ask for it — which is the whole test
|
|
44
|
+
* this file's header states. A source engine that declares its own shadow filter (Godot 3's
|
|
45
|
+
* `rendering/quality/shadows/filter_mode`) would otherwise inherit whatever the host built with.
|
|
46
|
+
*/
|
|
47
|
+
export type WorldShadowMapType = 'basic' | 'pcf' | 'pcf-soft' | 'vsm';
|
|
39
48
|
/** What a world may declare about the renderer that draws it. Every field is optional; see header. */
|
|
40
49
|
export interface WorldRendererConfig {
|
|
41
50
|
readonly toneMapping?: WorldToneMapping | undefined;
|
|
42
51
|
readonly toneMappingExposure?: number | undefined;
|
|
43
52
|
readonly outputColorSpace?: WorldOutputColorSpace | undefined;
|
|
53
|
+
/**
|
|
54
|
+
* `WebGLRenderer.shadowMap.type`. Writing it after a shadow map has already been built needs
|
|
55
|
+
* `shadowMap.needsUpdate`, which this function sets — three caches the compiled depth material
|
|
56
|
+
* per type and would otherwise keep filtering with the previous one.
|
|
57
|
+
*/
|
|
58
|
+
readonly shadowMapType?: WorldShadowMapType | undefined;
|
|
44
59
|
/**
|
|
45
60
|
* The colour the frame is cleared to, as a CSS hex string. The renderer's existing clear ALPHA
|
|
46
61
|
* is preserved: a stacked canvas is transparent on purpose (`create-runtime.ts` gives every
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderer-config.d.ts","sourceRoot":"","sources":["../../src/world3d-react/renderer-config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AAEpC,mGAAmG;AACnG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AS,CAAC;IACpD,QAAQ,CAAC,mBAAmB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAClD,QAAQ,CAAC,gBAAgB,CAAC,EAAE,qBAAqB,GAAG,SAAS,CAAC;IAC9D;;;;OAIG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,kBAAkB,GAAG,SAAS,CAAC;IACxD;;;;OAIG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC1C;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,OAAO,KAAK,EACnB,QAAQ,EAAE,KAAK,CAAC,aAAa,EAC7B,MAAM,EAAE,mBAAmB,GAC1B,MAAM,IAAI,CA+EZ"}
|
|
@@ -56,6 +56,12 @@ export function applyWorldRendererConfig(three, renderer, config) {
|
|
|
56
56
|
srgb: three.SRGBColorSpace,
|
|
57
57
|
'srgb-linear': three.LinearSRGBColorSpace,
|
|
58
58
|
};
|
|
59
|
+
const shadowMapTypes = {
|
|
60
|
+
basic: three.BasicShadowMap,
|
|
61
|
+
pcf: three.PCFShadowMap,
|
|
62
|
+
'pcf-soft': three.PCFSoftShadowMap,
|
|
63
|
+
vsm: three.VSMShadowMap,
|
|
64
|
+
};
|
|
59
65
|
const restores = [];
|
|
60
66
|
if (config.toneMapping !== undefined) {
|
|
61
67
|
const previous = renderer.toneMapping;
|
|
@@ -78,6 +84,15 @@ export function applyWorldRendererConfig(three, renderer, config) {
|
|
|
78
84
|
renderer.outputColorSpace = previous;
|
|
79
85
|
});
|
|
80
86
|
}
|
|
87
|
+
if (config.shadowMapType !== undefined && renderer.shadowMap !== undefined) {
|
|
88
|
+
const previous = renderer.shadowMap.type;
|
|
89
|
+
renderer.shadowMap.type = shadowMapTypes[config.shadowMapType];
|
|
90
|
+
renderer.shadowMap.needsUpdate = true;
|
|
91
|
+
restores.push(() => {
|
|
92
|
+
renderer.shadowMap.type = previous;
|
|
93
|
+
renderer.shadowMap.needsUpdate = true;
|
|
94
|
+
});
|
|
95
|
+
}
|
|
81
96
|
if (config.clearColor !== undefined) {
|
|
82
97
|
const previousColor = new three.Color();
|
|
83
98
|
renderer.getClearColor(previousColor);
|
|
@@ -98,7 +98,8 @@ export interface R3FRootRuntime {
|
|
|
98
98
|
/** The world-local phase runner `mount().update(dt)` ticks. */
|
|
99
99
|
readonly systems: ReturnType<typeof createSystemRunner>;
|
|
100
100
|
/** The mounted world's `SystemAdapters` bag (`mounted.systems`) —
|
|
101
|
-
* `ctx.registerSystemAdapter` writes into it; `debug` is pre-seeded
|
|
101
|
+
* `ctx.registerSystemAdapter` writes into it; `debug` is pre-seeded here,
|
|
102
|
+
* and the R3F mount adds renderer-backed engine capabilities after commit. */
|
|
102
103
|
readonly systemAdapters: SystemAdapters;
|
|
103
104
|
/** The registry every registration of this world's lands in — the game's
|
|
104
105
|
* own when a `Game` hosts it, a private mount-local one otherwise. Exposed
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"world-context.d.ts","sourceRoot":"","sources":["../../src/world3d-react/world-context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAgCK;AAEL,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AACpC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAOhE,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAEL,KAAK,aAAa,EAEnB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD;iFACiF;AACjF,eAAO,MAAM,sBAAsB,qCAAqC,CAAC;AAEzE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,MAAM,MAAM,cAAc,GAAG,IAAI,CAC/B,WAAW,EACT,OAAO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,OAAO,GACP,QAAQ,GACR,MAAM,GACN,OAAO,GACP,UAAU,GACV,uBAAuB,CAC1B,CAAC;AAEF,MAAM,WAAW,qBAAqB;IACpC;gFAC4E;IAC5E,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB;;;;;;OAMG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;CACnD;AAED;+EAC+E;AAC/E,MAAM,WAAW,cAAc;IAC7B;6EACyE;IACzE,QAAQ,CAAC,GAAG,EAAE,cAAc,CAAC;IAC7B,+DAA+D;IAC/D,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC;IACxD;;mFAE+E;IAC/E,QAAQ,CAAC,cAAc,EAAE,cAAc,CAAC;IACxC;;;;;;yDAMqD;IACrD,QAAQ,CAAC,aAAa,EAAE,aAAa,CAAC;IACtC;qEACiE;IACjE,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IACtC;;;4DAGwD;IACxD,cAAc,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC;IAC/D;;gFAE4E;IAC5E,OAAO,IAAI,IAAI,CAAC;CACjB;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,gBAAgB,EACtB,OAAO,EAAE,qBAAqB,GAC7B,cAAc,CAsKhB"}
|
package/dist-config/config.js
CHANGED
|
@@ -1,5 +1,110 @@
|
|
|
1
|
-
// src/data/
|
|
1
|
+
// src/data/curve.ts
|
|
2
2
|
import { z } from "zod";
|
|
3
|
+
var CURVE_META_KEY = "x-vgai-curve";
|
|
4
|
+
function axisLabel(axes, axis) {
|
|
5
|
+
return axes[axis].label ?? axis;
|
|
6
|
+
}
|
|
7
|
+
function checkPoints(value, axes, ctx) {
|
|
8
|
+
const points = value.points;
|
|
9
|
+
for (let i = 0; i < points.length; i++) {
|
|
10
|
+
const point = points[i];
|
|
11
|
+
for (const axis of ["x", "y"]) {
|
|
12
|
+
const { min, max } = axes[axis];
|
|
13
|
+
if (point[axis] < min || point[axis] > max) {
|
|
14
|
+
ctx.addIssue({
|
|
15
|
+
code: "custom",
|
|
16
|
+
path: ["points", i, axis],
|
|
17
|
+
message: `${point[axis]} is outside this curve's ${axisLabel(axes, axis)} domain [${min}, ${max}] \u2014 move the point inside the domain, or widen the axis in the schema (curve({ ${axis}: { min, max } })).`
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
if (i === 0) continue;
|
|
22
|
+
const previous = points[i - 1];
|
|
23
|
+
if (point.x <= previous.x) {
|
|
24
|
+
ctx.addIssue({
|
|
25
|
+
code: "custom",
|
|
26
|
+
path: ["points", i, "x"],
|
|
27
|
+
message: `${point.x} must be strictly greater than the previous point's x (${previous.x}) \u2014 curve points run left to right along x, with no duplicate x. Sort the points, or nudge this one.`
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
function curve(axes) {
|
|
33
|
+
const point = z.strictObject({
|
|
34
|
+
x: z.number().describe(`Position along ${axisLabel(axes, "x")}.`),
|
|
35
|
+
y: z.number().describe(`Value at that position, along ${axisLabel(axes, "y")}.`)
|
|
36
|
+
});
|
|
37
|
+
return z.strictObject({
|
|
38
|
+
interpolation: z.enum(["linear", "smooth"]).describe(
|
|
39
|
+
'How the value moves between points: "linear" for straight segments, "smooth" for a monotone cubic that never overshoots them.'
|
|
40
|
+
),
|
|
41
|
+
points: z.array(point).min(2, {
|
|
42
|
+
message: 'a curve needs at least two points \u2014 add another { "x": \u2026, "y": \u2026 } so the value has somewhere to travel between.'
|
|
43
|
+
}).describe("Keys in increasing x order; the value is clamped outside the first/last x.")
|
|
44
|
+
}).superRefine((value, ctx) => checkPoints(value, axes, ctx)).meta({ [CURVE_META_KEY]: axes });
|
|
45
|
+
}
|
|
46
|
+
function monotoneTangents(points) {
|
|
47
|
+
const n = points.length;
|
|
48
|
+
const secants = [];
|
|
49
|
+
for (let i = 0; i < n - 1; i++) {
|
|
50
|
+
const left = points[i];
|
|
51
|
+
const right = points[i + 1];
|
|
52
|
+
secants.push((right.y - left.y) / (right.x - left.x));
|
|
53
|
+
}
|
|
54
|
+
const tangents = [secants[0]];
|
|
55
|
+
for (let i = 1; i < n - 1; i++) {
|
|
56
|
+
tangents.push((secants[i - 1] + secants[i]) / 2);
|
|
57
|
+
}
|
|
58
|
+
tangents.push(secants[n - 2]);
|
|
59
|
+
for (let i = 0; i < n - 1; i++) {
|
|
60
|
+
const secant = secants[i];
|
|
61
|
+
if (secant === 0) {
|
|
62
|
+
tangents[i] = 0;
|
|
63
|
+
tangents[i + 1] = 0;
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
let alpha = tangents[i] / secant;
|
|
67
|
+
let beta = tangents[i + 1] / secant;
|
|
68
|
+
if (alpha < 0) {
|
|
69
|
+
tangents[i] = 0;
|
|
70
|
+
alpha = 0;
|
|
71
|
+
}
|
|
72
|
+
if (beta < 0) {
|
|
73
|
+
tangents[i + 1] = 0;
|
|
74
|
+
beta = 0;
|
|
75
|
+
}
|
|
76
|
+
const radius = alpha * alpha + beta * beta;
|
|
77
|
+
if (radius > 9) {
|
|
78
|
+
const scale = 3 / Math.sqrt(radius);
|
|
79
|
+
tangents[i] = scale * alpha * secant;
|
|
80
|
+
tangents[i + 1] = scale * beta * secant;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return tangents;
|
|
84
|
+
}
|
|
85
|
+
function sampleCurve(value, x) {
|
|
86
|
+
const points = value.points;
|
|
87
|
+
if (points.length === 0) return 0;
|
|
88
|
+
const first = points[0];
|
|
89
|
+
const last = points[points.length - 1];
|
|
90
|
+
if (points.length === 1 || x <= first.x) return first.y;
|
|
91
|
+
if (x >= last.x) return last.y;
|
|
92
|
+
let i = 0;
|
|
93
|
+
while (i < points.length - 2 && x >= points[i + 1].x) i++;
|
|
94
|
+
const left = points[i];
|
|
95
|
+
const right = points[i + 1];
|
|
96
|
+
const span = right.x - left.x;
|
|
97
|
+
if (span <= 0) return left.y;
|
|
98
|
+
const t = (x - left.x) / span;
|
|
99
|
+
if (value.interpolation === "linear") return left.y + (right.y - left.y) * t;
|
|
100
|
+
const tangents = monotoneTangents(points);
|
|
101
|
+
const t2 = t * t;
|
|
102
|
+
const t3 = t2 * t;
|
|
103
|
+
return (2 * t3 - 3 * t2 + 1) * left.y + (t3 - 2 * t2 + t) * span * tangents[i] + (-2 * t3 + 3 * t2) * right.y + (t3 - t2) * span * tangents[i + 1];
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// src/data/data-ref.ts
|
|
107
|
+
import { z as z2 } from "zod";
|
|
3
108
|
|
|
4
109
|
// src/data/data-check-core.ts
|
|
5
110
|
var DATA_REF_PATTERN = /^([A-Za-z0-9_-]+)#([A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)*)$/;
|
|
@@ -96,7 +201,7 @@ function refPattern(target) {
|
|
|
96
201
|
return new RegExp(`^${target}#[A-Za-z0-9_-]+(?:\\.[A-Za-z0-9_-]+)*$`);
|
|
97
202
|
}
|
|
98
203
|
function dataRef(target) {
|
|
99
|
-
return
|
|
204
|
+
return z2.string().regex(refPattern(target), {
|
|
100
205
|
message: `must be a "${target}#<key>" reference \u2014 expected the target asset stem "${target}", e.g. "${target}#some-key".`
|
|
101
206
|
}).meta({ "x-vgai-ref": target });
|
|
102
207
|
}
|
|
@@ -138,14 +243,10 @@ function getRef(target, ref) {
|
|
|
138
243
|
return node;
|
|
139
244
|
}
|
|
140
245
|
|
|
141
|
-
// src/data/vite-plugin-data.ts
|
|
142
|
-
import { readdirSync, readFileSync, statSync } from "node:fs";
|
|
143
|
-
import { join, relative } from "node:path";
|
|
144
|
-
|
|
145
246
|
// src/data/data-asset.ts
|
|
146
|
-
import { z as
|
|
247
|
+
import { z as z3 } from "zod";
|
|
147
248
|
function toDataJsonSchema(schema) {
|
|
148
|
-
const emitted =
|
|
249
|
+
const emitted = z3.toJSONSchema(schema, { io: "input" });
|
|
149
250
|
if (emitted["type"] === "object") {
|
|
150
251
|
const properties = emitted["properties"] ?? {};
|
|
151
252
|
properties["$schema"] ??= { type: "string" };
|
|
@@ -168,17 +269,27 @@ Fix the JSON to match the Zod schema (its emitted twin, "${sourcePath.replace(/\
|
|
|
168
269
|
}
|
|
169
270
|
|
|
170
271
|
// src/data/vite-plugin-data.ts
|
|
171
|
-
function
|
|
272
|
+
async function loadNodeIo() {
|
|
273
|
+
const [fs, path] = await Promise.all([import("node:fs"), import("node:path")]);
|
|
274
|
+
return {
|
|
275
|
+
readdirSync: fs.readdirSync,
|
|
276
|
+
readFileSync: fs.readFileSync,
|
|
277
|
+
statSync: fs.statSync,
|
|
278
|
+
join: path.join,
|
|
279
|
+
relative: path.relative
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
function findDataFiles(io, dir) {
|
|
172
283
|
let entries;
|
|
173
284
|
try {
|
|
174
|
-
entries = readdirSync(dir);
|
|
285
|
+
entries = io.readdirSync(dir);
|
|
175
286
|
} catch {
|
|
176
287
|
return [];
|
|
177
288
|
}
|
|
178
289
|
const out = [];
|
|
179
290
|
for (const entry of entries) {
|
|
180
|
-
const full = join(dir, entry);
|
|
181
|
-
if (statSync(full).isDirectory()) out.push(...findDataFiles(full));
|
|
291
|
+
const full = io.join(dir, entry);
|
|
292
|
+
if (io.statSync(full).isDirectory()) out.push(...findDataFiles(io, full));
|
|
182
293
|
else if (entry.endsWith(".data.json")) out.push(full);
|
|
183
294
|
}
|
|
184
295
|
return out;
|
|
@@ -187,17 +298,17 @@ function assetStem(sourcePath) {
|
|
|
187
298
|
const rel = sourcePath.split("\\").join("/");
|
|
188
299
|
return rel.split("/").pop()?.replace(/\.data\.json$/, "") ?? rel;
|
|
189
300
|
}
|
|
190
|
-
function parseAllDataFiles(root, registered, errors, warnings) {
|
|
301
|
+
function parseAllDataFiles(io, root, registered, errors, warnings) {
|
|
191
302
|
const parsedByStem = /* @__PURE__ */ new Map();
|
|
192
303
|
const pathsByStem = /* @__PURE__ */ new Map();
|
|
193
|
-
for (const abs of findDataFiles(join(root, "src", "data"))) {
|
|
194
|
-
const rel = relative(root, abs).split("\\").join("/");
|
|
304
|
+
for (const abs of findDataFiles(io, io.join(root, "src", "data"))) {
|
|
305
|
+
const rel = io.relative(root, abs).split("\\").join("/");
|
|
195
306
|
const stem = assetStem(rel);
|
|
196
307
|
const paths = pathsByStem.get(stem);
|
|
197
308
|
if (paths) paths.push(rel);
|
|
198
309
|
else pathsByStem.set(stem, [rel]);
|
|
199
310
|
try {
|
|
200
|
-
parsedByStem.set(stem, JSON.parse(readFileSync(abs, "utf-8")));
|
|
311
|
+
parsedByStem.set(stem, JSON.parse(io.readFileSync(abs, "utf-8")));
|
|
201
312
|
} catch (err) {
|
|
202
313
|
errors.push(
|
|
203
314
|
`"${rel}" is not valid JSON: ${err instanceof Error ? err.message : String(err)}`
|
|
@@ -221,12 +332,19 @@ function parseAllDataFiles(root, registered, errors, warnings) {
|
|
|
221
332
|
}
|
|
222
333
|
return { parsedByStem, ambiguousStems };
|
|
223
334
|
}
|
|
224
|
-
function collectDataCheckProblems(options) {
|
|
335
|
+
async function collectDataCheckProblems(options) {
|
|
336
|
+
const io = await loadNodeIo();
|
|
225
337
|
const root = options.root ?? process.cwd();
|
|
226
338
|
const errors = [];
|
|
227
339
|
const warnings = [];
|
|
228
340
|
const registered = new Set(options.assets.map((a) => a.sourcePath.split("\\").join("/")));
|
|
229
|
-
const { parsedByStem, ambiguousStems } = parseAllDataFiles(
|
|
341
|
+
const { parsedByStem, ambiguousStems } = parseAllDataFiles(
|
|
342
|
+
io,
|
|
343
|
+
root,
|
|
344
|
+
registered,
|
|
345
|
+
errors,
|
|
346
|
+
warnings
|
|
347
|
+
);
|
|
230
348
|
for (const asset of options.assets) {
|
|
231
349
|
const rel = asset.sourcePath.split("\\").join("/");
|
|
232
350
|
if (!parsedByStem.has(assetStem(rel))) {
|
|
@@ -268,8 +386,8 @@ function vgaiDataCheck(options) {
|
|
|
268
386
|
return {
|
|
269
387
|
name: "vgai:data-check",
|
|
270
388
|
apply: "build",
|
|
271
|
-
buildStart() {
|
|
272
|
-
const { errors, warnings } = collectDataCheckProblems(options);
|
|
389
|
+
async buildStart() {
|
|
390
|
+
const { errors, warnings } = await collectDataCheckProblems(options);
|
|
273
391
|
for (const warning of warnings) this.warn(warning);
|
|
274
392
|
if (errors.length > 0) {
|
|
275
393
|
this.error(
|
|
@@ -296,8 +414,10 @@ ${[...leaked].map((id) => ` - ${id}`).join("\n")}`
|
|
|
296
414
|
};
|
|
297
415
|
}
|
|
298
416
|
export {
|
|
417
|
+
curve,
|
|
299
418
|
dataRef,
|
|
300
419
|
getRef,
|
|
420
|
+
sampleCurve,
|
|
301
421
|
vgaiDataCheck
|
|
302
422
|
};
|
|
303
423
|
//# sourceMappingURL=config.js.map
|