@forgeax/engine-render 0.1.6 → 0.1.7

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.
Files changed (151) hide show
  1. package/README.md +139 -0
  2. package/dist/.tsbuildinfo +1 -1
  3. package/dist/__tests__/gpu-driven-indirect-raster-evidence.d.ts.map +1 -1
  4. package/dist/assembly/factory.d.ts +7 -0
  5. package/dist/assembly/factory.d.ts.map +1 -1
  6. package/dist/assembly/material/assembly.d.ts.map +1 -1
  7. package/dist/authoring.d.ts +1 -0
  8. package/dist/authoring.d.ts.map +1 -1
  9. package/dist/authoring.mjs +1 -1
  10. package/dist/{chunk-QC4VW3XJ.mjs → chunk-HCOGPHKS.mjs} +17 -3
  11. package/dist/chunk-HCOGPHKS.mjs.map +1 -0
  12. package/dist/chunk-YEJIUW7D.mjs +1152 -0
  13. package/dist/chunk-YEJIUW7D.mjs.map +1 -0
  14. package/dist/components/__tests__/points-lines-admission.unit.test.d.ts +2 -0
  15. package/dist/components/__tests__/points-lines-admission.unit.test.d.ts.map +1 -0
  16. package/dist/components/__tests__/points-lines-schema.unit.test.d.ts +2 -0
  17. package/dist/components/__tests__/points-lines-schema.unit.test.d.ts.map +1 -0
  18. package/dist/components/index.d.ts +2 -0
  19. package/dist/components/index.d.ts.map +1 -1
  20. package/dist/components/lines.d.ts +5 -0
  21. package/dist/components/lines.d.ts.map +1 -0
  22. package/dist/components/points.d.ts +15 -0
  23. package/dist/components/points.d.ts.map +1 -0
  24. package/dist/construct-renderer.mjs +952 -497
  25. package/dist/construct-renderer.mjs.map +1 -1
  26. package/dist/errors/render.d.ts +82 -1
  27. package/dist/errors/render.d.ts.map +1 -1
  28. package/dist/features/render-graph-raster.d.ts +5 -1
  29. package/dist/features/render-graph-raster.d.ts.map +1 -1
  30. package/dist/gpu-driven/production-raster.d.ts.map +1 -1
  31. package/dist/index.d.ts +4 -0
  32. package/dist/index.d.ts.map +1 -1
  33. package/dist/index.mjs +4 -2
  34. package/dist/index.mjs.map +1 -1
  35. package/dist/inspection-types.d.ts +3 -0
  36. package/dist/inspection-types.d.ts.map +1 -1
  37. package/dist/pbr-pipeline.d.ts +2 -0
  38. package/dist/pbr-pipeline.d.ts.map +1 -1
  39. package/dist/plugin.d.ts.map +1 -1
  40. package/dist/points-lines/__tests__/bounds.unit.test.d.ts +2 -0
  41. package/dist/points-lines/__tests__/bounds.unit.test.d.ts.map +1 -0
  42. package/dist/points-lines/__tests__/cache-recovery.unit.test.d.ts +2 -0
  43. package/dist/points-lines/__tests__/cache-recovery.unit.test.d.ts.map +1 -0
  44. package/dist/points-lines/__tests__/inspection-lanes.integration.test.d.ts +2 -0
  45. package/dist/points-lines/__tests__/inspection-lanes.integration.test.d.ts.map +1 -0
  46. package/dist/points-lines/__tests__/inspection.unit.test.d.ts +2 -0
  47. package/dist/points-lines/__tests__/inspection.unit.test.d.ts.map +1 -0
  48. package/dist/points-lines/__tests__/lane-structural.integration.test.d.ts +2 -0
  49. package/dist/points-lines/__tests__/lane-structural.integration.test.d.ts.map +1 -0
  50. package/dist/points-lines/__tests__/points-lines.bench.d.ts +2 -0
  51. package/dist/points-lines/__tests__/points-lines.bench.d.ts.map +1 -0
  52. package/dist/points-lines/__tests__/raster-lane.integration.test.d.ts +2 -0
  53. package/dist/points-lines/__tests__/raster-lane.integration.test.d.ts.map +1 -0
  54. package/dist/points-lines/__tests__/snapshot.unit.test.d.ts +2 -0
  55. package/dist/points-lines/__tests__/snapshot.unit.test.d.ts.map +1 -0
  56. package/dist/points-lines/__tests__/view-ubo.unit.test.d.ts +2 -0
  57. package/dist/points-lines/__tests__/view-ubo.unit.test.d.ts.map +1 -0
  58. package/dist/points-lines/admission.d.ts +36 -0
  59. package/dist/points-lines/admission.d.ts.map +1 -0
  60. package/dist/points-lines/bounds.d.ts +8 -0
  61. package/dist/points-lines/bounds.d.ts.map +1 -0
  62. package/dist/points-lines/expansion-cache.d.ts +28 -0
  63. package/dist/points-lines/expansion-cache.d.ts.map +1 -0
  64. package/dist/points-lines/inspection.d.ts +53 -0
  65. package/dist/points-lines/inspection.d.ts.map +1 -0
  66. package/dist/points-lines/prepare.d.ts +67 -0
  67. package/dist/points-lines/prepare.d.ts.map +1 -0
  68. package/dist/points-lines/record.d.ts +60 -0
  69. package/dist/points-lines/record.d.ts.map +1 -0
  70. package/dist/points-lines/snapshot.d.ts +49 -0
  71. package/dist/points-lines/snapshot.d.ts.map +1 -0
  72. package/dist/record/frame-lighting.d.ts.map +1 -1
  73. package/dist/record/frame.d.ts +1 -1
  74. package/dist/record/frame.d.ts.map +1 -1
  75. package/dist/record/main-pass-geometry.d.ts +7 -0
  76. package/dist/record/main-pass-geometry.d.ts.map +1 -1
  77. package/dist/record/main-pass.d.ts.map +1 -1
  78. package/dist/record/render-context.d.ts +17 -0
  79. package/dist/record/render-context.d.ts.map +1 -1
  80. package/dist/record/shadow-pass.d.ts.map +1 -1
  81. package/dist/record/skybox-post-pass.d.ts.map +1 -1
  82. package/dist/record/typed-frame-graph.d.ts.map +1 -1
  83. package/dist/record/view-ubo.d.ts +6 -0
  84. package/dist/record/view-ubo.d.ts.map +1 -1
  85. package/dist/render-contract.d.ts +10 -2
  86. package/dist/render-contract.d.ts.map +1 -1
  87. package/dist/render-system-extract.d.ts +3 -0
  88. package/dist/render-system-extract.d.ts.map +1 -1
  89. package/dist/render-system.d.ts +4 -1
  90. package/dist/render-system.d.ts.map +1 -1
  91. package/dist/scene/render-scene-types.d.ts +3 -0
  92. package/dist/scene/render-scene-types.d.ts.map +1 -1
  93. package/dist/scene/render-scene.d.ts +7 -0
  94. package/dist/scene/render-scene.d.ts.map +1 -1
  95. package/package.json +19 -19
  96. package/src/__tests__/authoring-path.unit.test.ts +9 -0
  97. package/src/__tests__/gpu-driven-indirect-raster-evidence.ts +12 -2
  98. package/src/__tests__/material-cooked-projection.unit.test.ts +29 -7
  99. package/src/__tests__/material-static-dynamic-route.unit.test.ts +28 -28
  100. package/src/__tests__/render-error-code-owner.test-d.ts +6 -0
  101. package/src/__tests__/render-error-exhaustive.test-d.ts +19 -0
  102. package/src/__tests__/renderer-factory-material-contract.unit.test.ts +38 -0
  103. package/src/assembly/factory.ts +72 -3
  104. package/src/assembly/material/assembly.ts +2 -5
  105. package/src/authoring.ts +1 -0
  106. package/src/components/__tests__/points-lines-admission.unit.test.ts +219 -0
  107. package/src/components/__tests__/points-lines-schema.unit.test.ts +56 -0
  108. package/src/components/index.ts +7 -0
  109. package/src/components/lines.ts +18 -0
  110. package/src/components/points.ts +40 -0
  111. package/src/errors/render.ts +144 -1
  112. package/src/features/render-graph-raster.ts +22 -3
  113. package/src/gpu-driven/production-raster.ts +6 -1
  114. package/src/index.ts +17 -0
  115. package/src/inspection-types.ts +4 -0
  116. package/src/pbr-pipeline.ts +8 -1
  117. package/src/plugin.ts +4 -0
  118. package/src/points-lines/__tests__/bounds.unit.test.ts +21 -0
  119. package/src/points-lines/__tests__/cache-recovery.unit.test.ts +157 -0
  120. package/src/points-lines/__tests__/inspection-lanes.integration.test.ts +146 -0
  121. package/src/points-lines/__tests__/inspection.unit.test.ts +173 -0
  122. package/src/points-lines/__tests__/lane-structural.integration.test.ts +122 -0
  123. package/src/points-lines/__tests__/points-lines.bench.ts +400 -0
  124. package/src/points-lines/__tests__/raster-lane.integration.test.ts +44 -0
  125. package/src/points-lines/__tests__/snapshot.unit.test.ts +101 -0
  126. package/src/points-lines/__tests__/view-ubo.unit.test.ts +73 -0
  127. package/src/points-lines/admission.ts +238 -0
  128. package/src/points-lines/bounds.ts +23 -0
  129. package/src/points-lines/expansion-cache.ts +215 -0
  130. package/src/points-lines/inspection.ts +97 -0
  131. package/src/points-lines/prepare.ts +177 -0
  132. package/src/points-lines/record.ts +125 -0
  133. package/src/points-lines/snapshot.ts +130 -0
  134. package/src/record/frame-lighting.ts +14 -2
  135. package/src/record/frame.ts +12 -1
  136. package/src/record/main-pass-geometry.ts +92 -0
  137. package/src/record/main-pass-sprite-draws.ts +1 -1
  138. package/src/record/main-pass.ts +6 -3
  139. package/src/record/render-context.ts +20 -0
  140. package/src/record/shadow-pass.ts +16 -5
  141. package/src/record/skybox-post-pass.ts +2 -1
  142. package/src/record/typed-frame-graph.ts +17 -16
  143. package/src/record/view-ubo.ts +47 -0
  144. package/src/render-contract.ts +13 -2
  145. package/src/render-system-extract.ts +71 -8
  146. package/src/render-system.ts +304 -2
  147. package/src/scene/render-scene-types.ts +3 -0
  148. package/src/scene/render-scene.ts +57 -2
  149. package/dist/chunk-QC4VW3XJ.mjs.map +0 -1
  150. package/dist/chunk-SCRSAK5B.mjs +0 -480
  151. package/dist/chunk-SCRSAK5B.mjs.map +0 -1
@@ -1,480 +0,0 @@
1
- import { defineComponent, Entity } from '@forgeax/engine-ecs';
2
- import { TONEMAP_SHADER_MODE } from '@forgeax/engine-shader';
3
- import { projectHierarchy } from '@forgeax/engine-scene';
4
-
5
- // src/components/camera.ts
6
- var CAMERA_PROJECTION_PERSPECTIVE = 0;
7
- var CAMERA_PROJECTION_ORTHOGRAPHIC = 1;
8
- function cameraProjectionFromF32(value) {
9
- return value === CAMERA_PROJECTION_ORTHOGRAPHIC ? "orthographic" : "perspective";
10
- }
11
- var TONEMAP_NONE = TONEMAP_SHADER_MODE.none;
12
- var TONEMAP_REINHARD_EXTENDED = TONEMAP_SHADER_MODE.reinhardExtended;
13
- var TONEMAP_REINHARD = TONEMAP_SHADER_MODE.reinhard;
14
- var TONEMAP_LINEAR = TONEMAP_SHADER_MODE.linear;
15
- var TONEMAP_CINEON = TONEMAP_SHADER_MODE.cineon;
16
- var TONEMAP_ACES_FILMIC = TONEMAP_SHADER_MODE.acesFilmic;
17
- var TONEMAP_AGX = TONEMAP_SHADER_MODE.agx;
18
- var TONEMAP_NEUTRAL = TONEMAP_SHADER_MODE.neutral;
19
- function tonemapFromF32(value) {
20
- switch (value) {
21
- case TONEMAP_REINHARD_EXTENDED:
22
- return "reinhard-extended";
23
- case TONEMAP_REINHARD:
24
- return "reinhard";
25
- case TONEMAP_LINEAR:
26
- return "linear";
27
- case TONEMAP_CINEON:
28
- return "cineon";
29
- case TONEMAP_ACES_FILMIC:
30
- return "aces-filmic";
31
- case TONEMAP_AGX:
32
- return "agx";
33
- case TONEMAP_NEUTRAL:
34
- return "neutral";
35
- default:
36
- return "none";
37
- }
38
- }
39
- function tonemapToU32(mode) {
40
- switch (mode) {
41
- case "reinhard-extended":
42
- return TONEMAP_REINHARD_EXTENDED;
43
- case "reinhard":
44
- return TONEMAP_REINHARD;
45
- case "linear":
46
- return TONEMAP_LINEAR;
47
- case "cineon":
48
- return TONEMAP_CINEON;
49
- case "aces-filmic":
50
- return TONEMAP_ACES_FILMIC;
51
- case "agx":
52
- return TONEMAP_AGX;
53
- case "neutral":
54
- return TONEMAP_NEUTRAL;
55
- case "none":
56
- return TONEMAP_NONE;
57
- }
58
- throw new RangeError(`Invalid tonemap mode: ${String(mode)}.`);
59
- }
60
- var ANTIALIAS_NONE = 0;
61
- var ANTIALIAS_FXAA = 1;
62
- var ANTIALIAS_MSAA = 2;
63
- var ANTIALIAS_TAA = 3;
64
- function antialiasFromF32(value) {
65
- if (value === ANTIALIAS_NONE) return "none";
66
- if (value === ANTIALIAS_FXAA) return "fxaa";
67
- if (value === ANTIALIAS_MSAA) return "msaa";
68
- if (value === ANTIALIAS_TAA) return "taa";
69
- throw new RangeError(
70
- `Invalid antialias value: ${value}. Expected ${ANTIALIAS_NONE} (none), ${ANTIALIAS_FXAA} (fxaa), ${ANTIALIAS_MSAA} (msaa), or ${ANTIALIAS_TAA} (taa).`
71
- );
72
- }
73
- var BLOOM_DISABLED = 0;
74
- var BLOOM_ENABLED = 1;
75
- function bloomEnabledFromF32(value) {
76
- if (value === BLOOM_DISABLED) return "off";
77
- if (value === BLOOM_ENABLED) return "on";
78
- throw new RangeError(
79
- `Invalid bloom value: ${value}. Expected ${BLOOM_DISABLED} (off) or ${BLOOM_ENABLED} (on).`
80
- );
81
- }
82
- var Camera = defineComponent("Camera", {
83
- fov: { type: "f32" },
84
- aspect: { type: "f32" },
85
- near: { type: "f32" },
86
- far: { type: "f32" },
87
- projection: { type: "f32", default: 0 },
88
- left: { type: "f32", default: -1 },
89
- right: { type: "f32", default: 1 },
90
- bottom: { type: "f32", default: -1 },
91
- top: { type: "f32", default: 1 },
92
- tonemap: { type: "f32", default: 0 },
93
- exposure: { type: "f32", default: 1 },
94
- whitePoint: { type: "f32", default: 4 },
95
- antialias: { type: "f32", default: 0 },
96
- historyVersion: { type: "u32", default: 0 },
97
- bloom: { type: "f32", default: 0 },
98
- bloomThreshold: { type: "f32", default: 1 },
99
- bloomIntensity: { type: "f32", default: 1 },
100
- bloomBlurRadius: { type: "f32", default: 4 },
101
- // feat-20260709 M3 / D-3: clear-color is one inline `array<f32,4>` column.
102
- // The earlier 4-scalar form (clearR/G/B/A) was chosen when this was believed
103
- // to be the only SoA-safe shape; the Transform (pos/quat/scale) and light
104
- // (direction/color) precedents disprove that -- an `array<f32,N>` IS an
105
- // inline stride-N SoA column, read on the hot path as `col[i*N+a]` with zero
106
- // allocation, so collapsing four scalars into one column removes three field
107
- // names a reader must track without changing the storage layout or read
108
- // pattern. The default `[0, 0, 0, 0]` is transparent black; explicit alpha
109
- // stays visible through the same public array field.
110
- clearColor: { type: "array<f32, 4>", default: new Float32Array([0, 0, 0, 0]) },
111
- // feat-20260617-host-engine-contract-and-video-cutscene / M3 / D-4: the
112
- // aspect-sync sidecar on the createApp(canvas) path writes
113
- // canvas.width / canvas.height into `aspect` every frame when this flag is
114
- // true. Reuses the existing `bool` column tier (AnimationPlayer.paused /
115
- // AudioSource.playing precedent) -- zero ECS infrastructure change. Default
116
- // true so demos that never touch aspect track the canvas automatically
117
- // (charter P1 default-is-correct); set false for render-to-texture /
118
- // split-screen cameras that drive aspect themselves. Read it via
119
- // world.get (readRow narrows bool -> JS boolean); the query-bundle path
120
- // returns a raw 0/1 number (the `!== 0` always-true trap).
121
- autoAspect: { type: "bool", default: true }
122
- });
123
- function cameraPodFromDefaults() {
124
- const base = {};
125
- for (const [key, field] of Object.entries(Camera.fields)) {
126
- if ("default" in field && field.default !== void 0) {
127
- base[key] = field.default;
128
- }
129
- }
130
- return base;
131
- }
132
- function perspective(opts) {
133
- return {
134
- // cameraPodFromDefaults() reads autoAspect's schema default (true), so an
135
- // omitted opts.autoAspect lands the default-correct value; an explicit
136
- // false overrides it below (D-4: factory one-step opt-out, charter P1).
137
- ...cameraPodFromDefaults(),
138
- fov: opts.fov,
139
- aspect: opts.aspect,
140
- near: opts.near ?? 0.1,
141
- far: opts.far ?? 100,
142
- projection: CAMERA_PROJECTION_PERSPECTIVE,
143
- ...opts.autoAspect !== void 0 ? { autoAspect: opts.autoAspect } : {}
144
- };
145
- }
146
- function orthographic(opts) {
147
- return {
148
- ...cameraPodFromDefaults(),
149
- fov: 0,
150
- aspect: 1,
151
- near: opts.near ?? 0.1,
152
- far: opts.far ?? 100,
153
- projection: CAMERA_PROJECTION_ORTHOGRAPHIC,
154
- left: opts.left,
155
- right: opts.right,
156
- bottom: opts.bottom,
157
- top: opts.top
158
- };
159
- }
160
- var DirectionalLight = defineComponent("DirectionalLight", {
161
- // direction is the ONLY field with no default (D-5): omitting it lands the
162
- // array layer-3 all-zero [0,0,0], which the renderer owner rejects -- there is no
163
- // universal default direction, so "default is illegal" forces an explicit
164
- // non-zero value. color carries an explicit layer-2 default [1,1,1] (white);
165
- // the array layer-3 fallback is all-zero, so the default MUST be explicit.
166
- direction: { type: "array<f32, 3>" },
167
- color: { type: "array<f32, 3>", default: new Float32Array([1, 1, 1]) },
168
- intensity: { type: "f32", default: 1 },
169
- // Shadow opt-out gate: defaults to true so zero-config spawns get shadows.
170
- castShadow: { type: "bool", default: true },
171
- // 9 shadow fields migrated from DirectionalLightShadow (feat-20260621 M1).
172
- cascadeCount: { type: "f32", default: 4 },
173
- splitLambda: { type: "f32", default: 0.75 },
174
- cascadeBlend: { type: "f32", default: 0.2 },
175
- mapSize: { type: "f32", default: 2048 },
176
- depthBias: { type: "f32", default: 5e-3 },
177
- normalBias: { type: "f32", default: 0.05 },
178
- // Sole shadow coverage knob (feat replaces nearPlane/farPlane). The PSSM
179
- // near end derives from the active camera near; shadowDistance is the far
180
- // reach. Default 200 world units (matches UE-style "dynamic shadow
181
- // distance"; the old farPlane default was 50).
182
- shadowDistance: { type: "f32", default: 200 },
183
- pcfKernelSize: { type: "f32", default: 3 }
184
- });
185
- var Instances = defineComponent("Instances", {
186
- transforms: { type: "array<f32>" }
187
- });
188
- var Layer = defineComponent("Layer", {
189
- value: { type: "i32", default: 0 }
190
- });
191
- var MeshFilter = defineComponent("MeshFilter", {
192
- assetHandle: { type: "shared<MeshAsset>" }
193
- });
194
- var MeshRenderer = defineComponent("MeshRenderer", {
195
- materials: { type: "array<shared<MaterialAsset>>", default: [] }
196
- });
197
- var PointLight = defineComponent("PointLight", {
198
- // color carries an explicit layer-2 default [1,1,1] (white); the array
199
- // layer-3 fallback is all-zero, so the default MUST be explicit (D-5).
200
- color: { type: "array<f32, 3>", default: new Float32Array([1, 1, 1]) },
201
- intensity: { type: "f32", default: 1 },
202
- range: { type: "f32", default: 10 }
203
- });
204
- var PointLightShadow = defineComponent("PointLightShadow", {
205
- mapSize: { type: "f32", default: 512 },
206
- depthBias: { type: "f32", default: 5e-3 },
207
- normalBias: { type: "f32", default: 0.05 },
208
- nearPlane: { type: "f32", default: 0.1 },
209
- farPlane: { type: "f32", default: 25 },
210
- pcfKernelSize: { type: "f32", default: 3 }
211
- });
212
- var schema = {
213
- shader: "string",
214
- data: "buffer"
215
- };
216
- var PostProcessParams = defineComponent("PostProcessParams", schema);
217
- var SceneInstance = defineComponent(
218
- "SceneInstance",
219
- {
220
- source: { type: "shared<SceneAsset>" },
221
- mapping: { type: "array<entity>" },
222
- // The unique slot is the ECS storage seam for the instance's structured
223
- // runtime payload; keep the nested semantic visible to schema consumers.
224
- state: { type: "unique<SceneInstanceState>", shape: "nested" }
225
- },
226
- { transient: true }
227
- );
228
- var SKYBOX_MODE_CUBEMAP = 0;
229
- var SkyboxBackground = defineComponent("SkyboxBackground", {
230
- // The GPU skybox projection is render-owned presentation state; restore
231
- // keeps the portable mode/rotation controls and lets the owner re-resolve
232
- // the environment asset on the target world.
233
- equirect: { type: "shared<EquirectAsset>", simulationTransient: true },
234
- mode: { type: "f32", default: SKYBOX_MODE_CUBEMAP },
235
- rotation: { type: "array<f32, 4>", default: new Float32Array([0, 0, 0, 1]) }
236
- });
237
- var Skylight = defineComponent("Skylight", {
238
- // The GPU equirect-to-cubemap projection is render-owned presentation
239
- // state. Record/restore preserves the portable lighting controls while the
240
- // render owner resolves this asset again on the target world.
241
- equirect: { type: "shared<EquirectAsset>", simulationTransient: true },
242
- // color carries an explicit layer-2 default [1,1,1] (white); the array
243
- // layer-3 fallback is all-zero, so the default MUST be explicit (D-5).
244
- color: { type: "array<f32, 3>", default: new Float32Array([1, 1, 1]) },
245
- intensity: { type: "f32", default: 1 },
246
- rotation: { type: "array<f32, 4>", default: new Float32Array([0, 0, 0, 1]) }
247
- });
248
- var SortKey = defineComponent("SortKey", {
249
- value: { type: "f32", default: 0 }
250
- });
251
- var SpotLight = defineComponent("SpotLight", {
252
- // direction has no default (D-5): omitting it lands the array layer-3
253
- // all-zero, which validate() rejects. color carries an explicit layer-2
254
- // default [1,1,1] (white); the array layer-3 fallback is all-zero.
255
- direction: { type: "array<f32, 3>" },
256
- color: { type: "array<f32, 3>", default: new Float32Array([1, 1, 1]) },
257
- intensity: { type: "f32", default: 1 },
258
- range: { type: "f32", default: 10 },
259
- innerConeDeg: { type: "f32", default: 0 },
260
- outerConeDeg: { type: "f32", default: 45 },
261
- // Shadow opt-out gate: defaults to true so zero-config spawns cast shadows.
262
- castShadow: { type: "bool", default: true },
263
- // 6 shadow fields aligned with DirectionalLight (plan-strategy D-6).
264
- mapSize: { type: "f32", default: 2048 },
265
- depthBias: { type: "f32", default: 5e-3 },
266
- normalBias: { type: "f32", default: 0.05 },
267
- nearPlane: { type: "f32", default: 0.1 },
268
- farPlane: { type: "f32", default: 50 },
269
- pcfKernelSize: { type: "f32", default: 3 }
270
- });
271
- var VisibilityStateValue = Object.freeze({
272
- inherited: 0,
273
- hidden: 1,
274
- visible: 2
275
- });
276
- function visibilityStateFromU32(value) {
277
- switch (value) {
278
- case VisibilityStateValue.inherited:
279
- return "inherited";
280
- case VisibilityStateValue.hidden:
281
- return "hidden";
282
- case VisibilityStateValue.visible:
283
- return "visible";
284
- default:
285
- return void 0;
286
- }
287
- }
288
- var Visibility = defineComponent(
289
- "Visibility",
290
- {
291
- state: {
292
- type: "enum",
293
- default: VisibilityStateValue.inherited,
294
- labels: VisibilityStateValue
295
- }
296
- },
297
- {
298
- meta: {
299
- quickStart: "Attach Visibility to author render participation intent.",
300
- diagnostics: "Compare the ECS state with resolveVisibility and renderer.visibilityStats.",
301
- recovery: "Use structured ECS write errors and repair the owning scene relation.",
302
- boundaries: "Visibility does not own camera, picking, lifecycle, assets, or VFX shadow policy."
303
- }
304
- }
305
- );
306
-
307
- // src/pipeline/standard-profile.ts
308
- var STANDARD_PIPELINE_ID = "forgeax::standard";
309
- var STANDARD_LIGHT_COUNTS = [1, 32, 256];
310
- var DEFAULT_CLUSTER_GRID = { x: 16, y: 9, z: 24 };
311
- var CLUSTER_GRID_STRIDE_U32 = 2;
312
- var LIGHT_INDEX_LIST_CAPACITY = 1048576;
313
- var MAX_LIGHTS = 256;
314
- var DEFAULT_STANDARD_PROFILE = Object.freeze({
315
- pipelineId: STANDARD_PIPELINE_ID,
316
- lightCount: 32,
317
- lighting: "direct",
318
- shadows: "filtered",
319
- pbr: true,
320
- ibl: true,
321
- ssao: false,
322
- bloom: true,
323
- tone: "aces-filmic",
324
- antialias: "fxaa",
325
- sky: true,
326
- fallback: "native",
327
- postStages: ["transparent-blend", "bloom", "tone", "fxaa", "output"]
328
- });
329
- function resolveStandardLane(profile, capabilities) {
330
- if (!capabilities.compute || !capabilities.storageBuffer) return "cpu-webgl2";
331
- return profile.lighting;
332
- }
333
-
334
- // src/render-contract.ts
335
- var STANDARD_TONEMAP_FEATURE_ID = "forgeax::standard::tonemap";
336
- var RENDER_GRAPH_EXECUTION_PHASE_CATALOG = [
337
- "record/graph-execute/point-shadow",
338
- "record/graph-execute/cluster-binner-upload",
339
- "record/graph-execute/g-buffer",
340
- "record/graph-execute/g-buffer/geometry-loop",
341
- "record/graph-execute/g-buffer/material-bind-groups",
342
- "record/graph-execute/g-buffer/pipeline-selection",
343
- "record/graph-execute/g-buffer/draw-submit",
344
- "record/graph-execute/ssao-calc",
345
- "record/graph-execute/ssao-blur",
346
- "record/graph-execute/lighting",
347
- "record/graph-execute/forward",
348
- "record/graph-execute/forward/geometry-loop",
349
- "record/graph-execute/forward/material-bind-groups",
350
- "record/graph-execute/forward/pipeline-selection",
351
- "record/graph-execute/forward/draw-submit",
352
- "record/graph-execute/tonemap",
353
- "record/graph-execute/debug-overlay",
354
- "record/graph-execute/shadow",
355
- "record/graph-execute/spot-shadow",
356
- "record/graph-execute/skybox",
357
- "record/graph-execute/main",
358
- "record/graph-execute/fxaa",
359
- "record/graph-execute/bloom-bright",
360
- "record/graph-execute/bloom-blur-h",
361
- "record/graph-execute/bloom-blur-v",
362
- "record/graph-execute/bloom-composite",
363
- "record/graph-execute/other"
364
- ];
365
- var RENDER_HDRP_BINNER_PHASE_CATALOG = [
366
- "record/scene-state/hdrp-cluster/binner/light-bounds-and-occupancy",
367
- "record/scene-state/hdrp-cluster/binner/light-bounds-and-occupancy/light-aabb",
368
- "record/scene-state/hdrp-cluster/binner/light-bounds-and-occupancy/cluster-occupancy",
369
- "record/scene-state/hdrp-cluster/binner/cluster-reserve",
370
- "record/scene-state/hdrp-cluster/binner/input-preparation",
371
- "record/scene-state/hdrp-cluster/binner/bin-core",
372
- "record/scene-state/hdrp-cluster/binner/light-index-write",
373
- "record/scene-state/hdrp-cluster/binner/light-index-write/bounds-read",
374
- "record/scene-state/hdrp-cluster/binner/light-index-write/cluster-write"
375
- ];
376
- var RENDER_HDRP_CLUSTER_PHASE_CATALOG = [
377
- "record/scene-state/hdrp-cluster/binner",
378
- ...RENDER_HDRP_BINNER_PHASE_CATALOG,
379
- "record/scene-state/hdrp-cluster/payload-packing",
380
- "record/scene-state/hdrp-cluster/buffer-upload"
381
- ];
382
- var RENDER_SCENE_STATE_PHASE_CATALOG = [
383
- "record/scene-state/fold-buckets",
384
- "record/scene-state/lighting-prep",
385
- "record/scene-state/ambient-resolution",
386
- "record/scene-state/directional-shadow-cache",
387
- "record/scene-state/hdrp-cluster",
388
- ...RENDER_HDRP_CLUSTER_PHASE_CATALOG
389
- ];
390
- var RENDER_RECORD_PHASE_CATALOG = [
391
- "record/scene-state",
392
- ...RENDER_SCENE_STATE_PHASE_CATALOG,
393
- "record/swapchain",
394
- "record/render-graph",
395
- "record/target-views",
396
- "record/validation",
397
- "record/dispatch-plan",
398
- "record/uploads",
399
- "record/bind-groups",
400
- "record/graph-execute",
401
- ...RENDER_GRAPH_EXECUTION_PHASE_CATALOG
402
- ];
403
- var RENDER_PHASE_CATALOG = [
404
- "extract",
405
- "bind-groups",
406
- "features",
407
- "sort",
408
- "record",
409
- ...RENDER_RECORD_PHASE_CATALOG
410
- ];
411
- function resolveVisibility(world, hierarchy = projectHierarchy(world)) {
412
- const query = world.query({ read: [Entity], optional: [Visibility] });
413
- let intentCount = 0;
414
- let hasAnyHiddenIntent = false;
415
- if (query.ok) {
416
- for (const row of query.value) {
417
- const visibility = row.get(Visibility);
418
- if (visibility === void 0) continue;
419
- intentCount += 1;
420
- if (visibility.state === VisibilityStateValue.hidden) {
421
- hasAnyHiddenIntent = true;
422
- }
423
- }
424
- }
425
- let resolveEntity;
426
- let hasIntent;
427
- const ensureResolver = () => {
428
- if (resolveEntity !== void 0) return;
429
- const intentByEntity = /* @__PURE__ */ new Map();
430
- if (query.ok) {
431
- for (const row of query.value) {
432
- const raw = row.get(Visibility);
433
- const intent = raw === void 0 ? void 0 : visibilityStateFromU32(raw.state);
434
- if (intent !== void 0) {
435
- intentByEntity.set(row.entity, intent);
436
- }
437
- }
438
- }
439
- hasIntent = (entity) => intentByEntity.has(entity);
440
- const resolved = /* @__PURE__ */ new Map();
441
- const resolving = /* @__PURE__ */ new Set();
442
- resolveEntity = (entity) => {
443
- const existing = resolved.get(entity);
444
- if (existing !== void 0) return existing;
445
- if (resolving.has(entity)) return void 0;
446
- const intent = intentByEntity.get(entity) ?? "inherited";
447
- resolving.add(entity);
448
- let result;
449
- if (intent === "hidden") {
450
- result = { intent, effective: "hidden", source: "self" };
451
- } else if (intent === "visible") {
452
- result = { intent, effective: "visible", source: "self" };
453
- } else {
454
- const parent = hierarchy.getParent(entity);
455
- const parentResult = parent === void 0 ? void 0 : resolveEntity?.(parent);
456
- result = parentResult === void 0 ? { intent, effective: "visible", source: "default" } : { intent, effective: parentResult.effective, source: "parent" };
457
- }
458
- resolving.delete(entity);
459
- resolved.set(entity, result);
460
- return result;
461
- };
462
- };
463
- return {
464
- diagnostics: hierarchy.diagnostics,
465
- hasAnyIntent: intentCount > 0,
466
- hasAnyHiddenIntent,
467
- get(entity) {
468
- ensureResolver();
469
- return hasIntent?.(entity) ? resolveEntity?.(entity) : void 0;
470
- },
471
- effective(entity) {
472
- ensureResolver();
473
- return resolveEntity?.(entity)?.effective ?? "visible";
474
- }
475
- };
476
- }
477
-
478
- export { ANTIALIAS_FXAA, ANTIALIAS_MSAA, ANTIALIAS_NONE, BLOOM_DISABLED, BLOOM_ENABLED, CAMERA_PROJECTION_ORTHOGRAPHIC, CAMERA_PROJECTION_PERSPECTIVE, CLUSTER_GRID_STRIDE_U32, Camera, DEFAULT_CLUSTER_GRID, DEFAULT_STANDARD_PROFILE, DirectionalLight, Instances, LIGHT_INDEX_LIST_CAPACITY, Layer, MAX_LIGHTS, MeshFilter, MeshRenderer, PointLight, PointLightShadow, PostProcessParams, RENDER_PHASE_CATALOG, SKYBOX_MODE_CUBEMAP, STANDARD_LIGHT_COUNTS, STANDARD_PIPELINE_ID, STANDARD_TONEMAP_FEATURE_ID, SceneInstance, SkyboxBackground, Skylight, SortKey, SpotLight, TONEMAP_ACES_FILMIC, TONEMAP_AGX, TONEMAP_CINEON, TONEMAP_LINEAR, TONEMAP_NEUTRAL, TONEMAP_NONE, TONEMAP_REINHARD, TONEMAP_REINHARD_EXTENDED, Visibility, VisibilityStateValue, antialiasFromF32, bloomEnabledFromF32, cameraProjectionFromF32, orthographic, perspective, resolveStandardLane, resolveVisibility, tonemapFromF32, tonemapToU32, visibilityStateFromU32 };
479
- //# sourceMappingURL=chunk-SCRSAK5B.mjs.map
480
- //# sourceMappingURL=chunk-SCRSAK5B.mjs.map