@forgeax/engine-render 0.1.34 → 0.1.36
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 +69 -3
- package/dist/assembly/device-feature-admission.d.ts +2 -2
- package/dist/assembly/host-contract.d.ts +3 -2
- package/dist/assembly/host-contract.d.ts.map +1 -1
- package/dist/assembly/recovery/renderer-recover.d.ts.map +1 -1
- package/dist/assembly/render-target-host.d.ts +5 -0
- package/dist/assembly/render-target-host.d.ts.map +1 -1
- package/dist/assembly/renderer-facade.d.ts.map +1 -1
- package/dist/assembly/webgpu-renderer.d.ts +1 -0
- package/dist/assembly/webgpu-renderer.d.ts.map +1 -1
- package/dist/assembly/webgpu-vertex-layouts.d.ts.map +1 -1
- package/dist/authoring.mjs +2 -4
- package/dist/authoring.mjs.map +1 -1
- package/dist/chunk-2OZAS3WU.mjs +3489 -0
- package/dist/chunk-2OZAS3WU.mjs.map +1 -0
- package/dist/{chunk-UI5SFODX.mjs → chunk-BZQ4CDRF.mjs} +2338 -1991
- package/dist/chunk-BZQ4CDRF.mjs.map +1 -0
- package/dist/{chunk-MKDIT2EM.mjs → chunk-CJOV2XLO.mjs} +216 -261
- package/dist/chunk-CJOV2XLO.mjs.map +1 -0
- package/dist/chunk-D6WSBXJ2.mjs +1842 -0
- package/dist/chunk-D6WSBXJ2.mjs.map +1 -0
- package/dist/{chunk-HEB564WF.mjs → chunk-DRF6OULX.mjs} +4 -4
- package/dist/{chunk-HEB564WF.mjs.map → chunk-DRF6OULX.mjs.map} +1 -1
- package/dist/{chunk-OCDLEI6I.mjs → chunk-OB5WAFYH.mjs} +117 -5
- package/dist/chunk-OB5WAFYH.mjs.map +1 -0
- package/dist/{chunk-ODZWR6JQ.mjs → chunk-OEYKKMXG.mjs} +2042 -27
- package/dist/chunk-OEYKKMXG.mjs.map +1 -0
- package/dist/chunk-RIPAEGI6.mjs +48 -0
- package/dist/chunk-RIPAEGI6.mjs.map +1 -0
- package/dist/{chunk-ELJFJ2BU.mjs → chunk-X2KA6WHM.mjs} +29 -4
- package/dist/chunk-X2KA6WHM.mjs.map +1 -0
- package/dist/{chunk-BLXGONR2.mjs → chunk-XSFB7XXQ.mjs} +51 -4
- package/dist/chunk-XSFB7XXQ.mjs.map +1 -0
- package/dist/cloud/frame-context.d.ts +2 -2
- package/dist/cloud/frame-context.d.ts.map +1 -1
- package/dist/construct-renderer.mjs +936 -2140
- package/dist/construct-renderer.mjs.map +1 -1
- package/dist/device/device-scope.d.ts.map +1 -1
- package/dist/device/gpu-residency.d.ts +19 -19
- package/dist/device/gpu-residency.d.ts.map +1 -1
- package/dist/errors/render.d.ts +3 -2
- package/dist/errors/render.d.ts.map +1 -1
- package/dist/extract/material-context.d.ts +7 -0
- package/dist/extract/material-context.d.ts.map +1 -0
- package/dist/features/host.d.ts +5 -0
- package/dist/features/host.d.ts.map +1 -1
- package/dist/features/particle-mesh-layout.d.ts +19 -0
- package/dist/features/particle-mesh-layout.d.ts.map +1 -0
- package/dist/features/plan.d.ts +2 -0
- package/dist/features/plan.d.ts.map +1 -1
- package/dist/features/types.d.ts +8 -0
- package/dist/features/types.d.ts.map +1 -1
- package/dist/glyph-text-layout-system.d.ts +1 -1
- package/dist/glyph-text-layout-system.d.ts.map +1 -1
- package/dist/gpu-driven/production-raster.d.ts +1 -1
- package/dist/gpu-driven/production-raster.d.ts.map +1 -1
- package/dist/gpu-driven/shadow-ownership.d.ts +3 -3
- package/dist/gpu-driven/shadow-ownership.d.ts.map +1 -1
- package/dist/gpu-driven/shadow-views.d.ts +1 -1
- package/dist/gpu-driven/shadow-views.d.ts.map +1 -1
- package/dist/gpu-driven/view-gpu.d.ts +1 -1
- package/dist/gpu-driven/view-gpu.d.ts.map +1 -1
- package/dist/ibl/frame-resources.d.ts.map +1 -1
- package/dist/ibl/skylight-bind-group.d.ts +4 -4
- package/dist/ibl/skylight-bind-group.d.ts.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +542 -9
- package/dist/index.mjs.map +1 -1
- package/dist/instances.d.ts +3 -4
- package/dist/instances.d.ts.map +1 -1
- package/dist/internal.mjs +7 -8
- package/dist/internal.mjs.map +1 -1
- package/dist/pbr-pipeline.d.ts +3 -3
- package/dist/pbr-pipeline.d.ts.map +1 -1
- package/dist/pipeline/standard-output/lut-gpu.d.ts +2 -2
- package/dist/pipeline/standard-output/lut-gpu.d.ts.map +1 -1
- package/dist/pipeline/standard-output/resources.d.ts +2 -2
- package/dist/pipeline/standard-output/resources.d.ts.map +1 -1
- package/dist/publication/contract.d.ts +77 -0
- package/dist/publication/contract.d.ts.map +1 -0
- package/dist/publication/dependencies.d.ts +7 -0
- package/dist/publication/dependencies.d.ts.map +1 -0
- package/dist/publication/prepare-geometry.d.ts +9 -0
- package/dist/publication/prepare-geometry.d.ts.map +1 -0
- package/dist/publication/programs.d.ts +5 -0
- package/dist/publication/programs.d.ts.map +1 -0
- package/dist/publication/publisher.d.ts +34 -0
- package/dist/publication/publisher.d.ts.map +1 -0
- package/dist/publication/receiver.d.ts +29 -0
- package/dist/publication/receiver.d.ts.map +1 -0
- package/dist/publication/resource-scope.d.ts +18 -0
- package/dist/publication/resource-scope.d.ts.map +1 -0
- package/dist/publication/targets.d.ts +33 -0
- package/dist/publication/targets.d.ts.map +1 -0
- package/dist/publication/video.d.ts +5 -0
- package/dist/publication/video.d.ts.map +1 -0
- package/dist/record/fold-buckets.d.ts +3 -3
- package/dist/record/fold-buckets.d.ts.map +1 -1
- package/dist/record/frame-snapshot.d.ts +6 -6
- package/dist/record/frame-snapshot.d.ts.map +1 -1
- package/dist/record/frame.d.ts +5 -4
- package/dist/record/frame.d.ts.map +1 -1
- package/dist/record/helpers.d.ts +2 -2
- package/dist/record/helpers.d.ts.map +1 -1
- package/dist/record/main-pass-geometry.d.ts +2 -2
- package/dist/record/main-pass-geometry.d.ts.map +1 -1
- package/dist/record/main-pass-material.d.ts +7 -9
- package/dist/record/main-pass-material.d.ts.map +1 -1
- package/dist/record/main-pass-sprite-draws.d.ts +3 -16
- package/dist/record/main-pass-sprite-draws.d.ts.map +1 -1
- package/dist/record/main-pass.d.ts.map +1 -1
- package/dist/record/prepared-material-bindings.d.ts +2 -3
- package/dist/record/prepared-material-bindings.d.ts.map +1 -1
- package/dist/record/render-context.d.ts +4 -2
- package/dist/record/render-context.d.ts.map +1 -1
- package/dist/record/shadow-pass.d.ts +2 -2
- package/dist/record/shadow-pass.d.ts.map +1 -1
- package/dist/record/sprite-instance-buffer.d.ts +31 -0
- package/dist/record/sprite-instance-buffer.d.ts.map +1 -0
- package/dist/record/target-capture-graph.d.ts +19 -0
- package/dist/record/target-capture-graph.d.ts.map +1 -0
- package/dist/record/typed-frame-graph.d.ts +2 -13
- package/dist/record/typed-frame-graph.d.ts.map +1 -1
- package/dist/record/view-ubo.d.ts.map +1 -1
- package/dist/record/volume-params.d.ts +2 -2
- package/dist/record/volume-params.d.ts.map +1 -1
- package/dist/recovery/render-system-candidate.d.ts +5 -12
- package/dist/recovery/render-system-candidate.d.ts.map +1 -1
- package/dist/render-contract.d.ts +4 -1
- package/dist/render-contract.d.ts.map +1 -1
- package/dist/render-system-extract-tail.d.ts.map +1 -1
- package/dist/render-system-extract.d.ts +2 -0
- package/dist/render-system-extract.d.ts.map +1 -1
- package/dist/render-system-presentation.d.ts +2 -2
- package/dist/render-system-presentation.d.ts.map +1 -1
- package/dist/render-system-projections.d.ts +3 -2
- package/dist/render-system-projections.d.ts.map +1 -1
- package/dist/render-system-residency.d.ts +2 -2
- package/dist/render-system-residency.d.ts.map +1 -1
- package/dist/render-system.d.ts +3 -7
- package/dist/render-system.d.ts.map +1 -1
- package/dist/scene/render-scene.d.ts +8 -4
- package/dist/scene/render-scene.d.ts.map +1 -1
- package/dist/scene/render-source.d.ts +42 -0
- package/dist/scene/render-source.d.ts.map +1 -0
- package/dist/scene/source-systems.d.ts +6 -0
- package/dist/scene/source-systems.d.ts.map +1 -0
- package/dist/systems/skin-palette-allocator.d.ts.map +1 -1
- package/dist/systems/skin-palette-types.d.ts +10 -0
- package/dist/systems/skin-palette-types.d.ts.map +1 -1
- package/dist/systems/transparent-dispatch.d.ts +2 -2
- package/dist/systems/transparent-dispatch.d.ts.map +1 -1
- package/dist/systems/transparent-sort-config.d.ts +2 -1
- package/dist/systems/transparent-sort-config.d.ts.map +1 -1
- package/dist/temporal/index.mjs +6 -7
- package/dist/typed-shadow-passes.d.ts.map +1 -1
- package/package.json +21 -21
- package/src/__tests__/auto-exposure-transaction.integration.test.ts +4 -9
- package/src/__tests__/device-feature-admission.unit.test.ts +3 -2
- package/src/__tests__/device-scope-lifecycle.unit.test.ts +26 -0
- package/src/__tests__/gpu-driven-pbr.dawn.test.ts +3 -4
- package/src/__tests__/gpu-driven-production.integration.test.ts +18 -1
- package/src/__tests__/gpu-driven-shadow-views.unit.test.ts +23 -0
- package/src/__tests__/ktx2-basis-gpu-consumer.dawn.test.ts +4 -1
- package/src/__tests__/main-pass-material-medium-selection.unit.test.ts +0 -1
- package/src/__tests__/material-vertex-texture.browser.test.ts +7 -0
- package/src/__tests__/material-vertex-texture.dawn.test.ts +7 -0
- package/src/__tests__/material-vertex-texture.fixture.ts +31 -0
- package/src/__tests__/materials-standard-contract.unit.test.ts +0 -1
- package/src/__tests__/physical-clearcoat.integration.test.ts +23 -23
- package/src/__tests__/physical-material-budget.unit.test.ts +40 -0
- package/src/__tests__/recovery-candidate-prepare.contract.test.ts +5 -0
- package/src/__tests__/render-error-code-owner.test-d.ts +1 -0
- package/src/__tests__/renderer-factory-material-contract.unit.test.ts +107 -5
- package/src/__tests__/runtime-material-program.integration.test.ts +79 -0
- package/src/__tests__/vertex-layouts-ssot.unit.test.ts +23 -3
- package/src/assembly/device-feature-admission.ts +2 -2
- package/src/assembly/host-contract.ts +5 -2
- package/src/assembly/recovery/renderer-recover.ts +9 -0
- package/src/assembly/render-target-host.ts +57 -47
- package/src/assembly/renderer-facade.ts +3 -1
- package/src/assembly/webgpu-ready.ts +1 -1
- package/src/assembly/webgpu-renderer.ts +101 -70
- package/src/assembly/webgpu-vertex-layouts.ts +2 -9
- package/src/cloud/frame-context.ts +2 -2
- package/src/device/device-scope.ts +3 -0
- package/src/device/gpu-residency.ts +26 -25
- package/src/errors/render.ts +3 -1
- package/src/extract/material-context.ts +21 -0
- package/src/features/host.ts +13 -5
- package/src/features/particle-mesh-layout.ts +25 -0
- package/src/features/plan.ts +2 -0
- package/src/features/types.ts +8 -0
- package/src/glyph-text-layout-system.ts +2 -2
- package/src/gpu-driven/production-raster.ts +9 -3
- package/src/gpu-driven/shadow-ownership.ts +3 -3
- package/src/gpu-driven/shadow-views.ts +27 -2
- package/src/gpu-driven/view-gpu.ts +5 -0
- package/src/ibl/frame-resources.ts +0 -1
- package/src/ibl/skylight-bind-group.ts +13 -25
- package/src/index.ts +9 -0
- package/src/instances.ts +9 -6
- package/src/pbr-pipeline.ts +15 -18
- package/src/pipeline/standard-output/lut-gpu.ts +3 -3
- package/src/pipeline/standard-output/resources.ts +2 -2
- package/src/publication/__tests__/derived-geometry.integration.test.ts +177 -0
- package/src/publication/__tests__/features.integration.test.ts +173 -0
- package/src/publication/__tests__/programs.unit.test.ts +25 -0
- package/src/publication/__tests__/publication.integration.test.ts +415 -0
- package/src/publication/__tests__/targets.integration.test.ts +120 -0
- package/src/publication/__tests__/video.browser.test.ts +50 -0
- package/src/publication/contract.ts +104 -0
- package/src/publication/dependencies.ts +54 -0
- package/src/publication/prepare-geometry.ts +94 -0
- package/src/publication/programs.ts +45 -0
- package/src/publication/publisher.ts +645 -0
- package/src/publication/receiver.ts +297 -0
- package/src/publication/resource-scope.ts +31 -0
- package/src/publication/targets.ts +182 -0
- package/src/publication/video.ts +33 -0
- package/src/record/__tests__/material-bg-cache.unit.test.ts +15 -1
- package/src/record/__tests__/prepared-runtime-material.integration.test.ts +134 -0
- package/src/record/__tests__/sprite-material-abi.unit.test.ts +8 -10
- package/src/record/__tests__/video-texture-view.unit.test.ts +9 -9
- package/src/record/fold-buckets.ts +8 -5
- package/src/record/frame-snapshot.ts +6 -6
- package/src/record/frame.ts +87 -28
- package/src/record/helpers.ts +2 -2
- package/src/record/main-pass-geometry.ts +21 -2
- package/src/record/main-pass-material.ts +37 -33
- package/src/record/main-pass-sprite-draws.ts +6 -152
- package/src/record/main-pass.ts +8 -7
- package/src/record/prepared-material-bindings.ts +16 -37
- package/src/record/render-context.ts +4 -2
- package/src/record/shadow-pass.ts +65 -7
- package/src/record/sprite-instance-buffer.ts +155 -0
- package/src/record/target-capture-graph.ts +258 -0
- package/src/record/typed-frame-graph.ts +11 -207
- package/src/record/view-ubo.ts +1 -1
- package/src/record/volume-params.ts +6 -6
- package/src/recovery/render-system-candidate.ts +10 -18
- package/src/render-contract.ts +6 -1
- package/src/render-system-extract-tail.ts +48 -23
- package/src/render-system-extract.ts +11 -2
- package/src/render-system-presentation.ts +2 -2
- package/src/render-system-projections.ts +3 -2
- package/src/render-system-residency.ts +2 -2
- package/src/render-system.ts +82 -54
- package/src/scene/render-scene.ts +110 -100
- package/src/scene/render-source.ts +90 -0
- package/src/scene/source-systems.ts +33 -0
- package/src/systems/skin-palette-allocator.ts +1 -0
- package/src/systems/skin-palette-types.ts +11 -0
- package/src/systems/transparent-dispatch.ts +2 -2
- package/src/systems/transparent-sort-config.ts +3 -1
- package/src/typed-shadow-passes.ts +36 -5
- package/dist/chunk-BLXGONR2.mjs.map +0 -1
- package/dist/chunk-ELJFJ2BU.mjs.map +0 -1
- package/dist/chunk-ILQ5MEZF.mjs +0 -32
- package/dist/chunk-ILQ5MEZF.mjs.map +0 -1
- package/dist/chunk-MKDIT2EM.mjs.map +0 -1
- package/dist/chunk-OCDLEI6I.mjs.map +0 -1
- package/dist/chunk-ODZWR6JQ.mjs.map +0 -1
- package/dist/chunk-RXZ3RGOU.mjs +0 -53
- package/dist/chunk-RXZ3RGOU.mjs.map +0 -1
- package/dist/chunk-SHFUFJ5N.mjs +0 -1781
- package/dist/chunk-SHFUFJ5N.mjs.map +0 -1
- package/dist/chunk-UI5SFODX.mjs.map +0 -1
- package/dist/chunk-UINHLCZA.mjs +0 -2389
- package/dist/chunk-UINHLCZA.mjs.map +0 -1
- package/dist/chunk-WEX45HKH.mjs +0 -1524
- package/dist/chunk-WEX45HKH.mjs.map +0 -1
package/dist/chunk-UINHLCZA.mjs
DELETED
|
@@ -1,2389 +0,0 @@
|
|
|
1
|
-
import { RenderIntentInvalidError, DynamicResolutionRequiresTaaError, ShadowInvalidConfigError, VolumeDensityShapeMismatchError, VolumeInvalidBoundsError, VolumeInvalidParametersError, EnvironmentSourceConflictError, FogCardinalityError, VolumeOwnerConflictError, BarrelDistortionInvalidParameterError, DynamicResolutionInvalidParameterError, AtmosphereInvalidParameterError } from './chunk-WEX45HKH.mjs';
|
|
2
|
-
import { defineComponent, Entity, Time } from '@forgeax/engine-ecs';
|
|
3
|
-
import { R_MIN, err, ok } from '@forgeax/engine-types';
|
|
4
|
-
import { TONEMAP_SHADER_MODE } from '@forgeax/engine-shader';
|
|
5
|
-
import { SpawnLightInvalidBoundsError } from '@forgeax/engine-ecs/projection';
|
|
6
|
-
import { Transform, projectHierarchy } from '@forgeax/engine-scene';
|
|
7
|
-
import { mat4 } from '@forgeax/engine-math';
|
|
8
|
-
|
|
9
|
-
var Atmosphere = defineComponent("Atmosphere", {
|
|
10
|
-
turbidity: { type: "f32", default: 2 },
|
|
11
|
-
rayleigh: { type: "f32", default: 1 },
|
|
12
|
-
mieCoefficient: { type: "f32", default: 5e-3 },
|
|
13
|
-
mieDirectionalG: { type: "f32", default: 0.8 },
|
|
14
|
-
sunAngularRadius: { type: "f32", default: 4675e-6 },
|
|
15
|
-
/** Independent multiplier for the analytic circumsolar lobe. */
|
|
16
|
-
circumsolarStrength: { type: "f32", default: 1 },
|
|
17
|
-
/** Relative angular width of the analytic circumsolar lobe. */
|
|
18
|
-
circumsolarWidth: { type: "f32", default: 1 }
|
|
19
|
-
});
|
|
20
|
-
var BarrelDistortion = defineComponent("BarrelDistortion", {
|
|
21
|
-
strength: { type: "f32", default: 0 },
|
|
22
|
-
centerX: { type: "f32", default: 0.5 },
|
|
23
|
-
centerY: { type: "f32", default: 0.5 }
|
|
24
|
-
});
|
|
25
|
-
var DEFAULT_BARREL_DISTORTION = Object.freeze({
|
|
26
|
-
strength: 0,
|
|
27
|
-
centerX: 0.5,
|
|
28
|
-
centerY: 0.5
|
|
29
|
-
});
|
|
30
|
-
function invalid(field, value, expected) {
|
|
31
|
-
return new BarrelDistortionInvalidParameterError({ field, value, expected });
|
|
32
|
-
}
|
|
33
|
-
function validateBarrelDistortionParameters(input) {
|
|
34
|
-
const value = input ?? {};
|
|
35
|
-
const strength = value.strength ?? DEFAULT_BARREL_DISTORTION.strength;
|
|
36
|
-
const centerX = value.centerX ?? DEFAULT_BARREL_DISTORTION.centerX;
|
|
37
|
-
const centerY = value.centerY ?? DEFAULT_BARREL_DISTORTION.centerY;
|
|
38
|
-
if (!Number.isFinite(strength) || strength < 0 || strength > 0.35) {
|
|
39
|
-
return err(invalid("strength", strength, "finite and in [0, 0.35]"));
|
|
40
|
-
}
|
|
41
|
-
if (!Number.isFinite(centerX) || centerX < 0 || centerX > 1) {
|
|
42
|
-
return err(invalid("centerX", centerX, "finite and in [0, 1]"));
|
|
43
|
-
}
|
|
44
|
-
if (!Number.isFinite(centerY) || centerY < 0 || centerY > 1) {
|
|
45
|
-
return err(invalid("centerY", centerY, "finite and in [0, 1]"));
|
|
46
|
-
}
|
|
47
|
-
return ok(Object.freeze({ strength, centerX, centerY }));
|
|
48
|
-
}
|
|
49
|
-
var CAMERA_PROJECTION_PERSPECTIVE = 0;
|
|
50
|
-
var CAMERA_PROJECTION_ORTHOGRAPHIC = 1;
|
|
51
|
-
var CAMERA_EXPOSURE_MODE_MANUAL = 0;
|
|
52
|
-
var CAMERA_EXPOSURE_MODE_AUTO = 1;
|
|
53
|
-
var CAMERA_TEMPERATURE_MIN = 1e3;
|
|
54
|
-
var CAMERA_TEMPERATURE_MAX = 4e4;
|
|
55
|
-
var CAMERA_TINT_MIN = -1;
|
|
56
|
-
var CAMERA_TINT_MAX = 1;
|
|
57
|
-
var CameraError = class extends Error {
|
|
58
|
-
code;
|
|
59
|
-
expected;
|
|
60
|
-
hint;
|
|
61
|
-
detail;
|
|
62
|
-
constructor(code, field, actual, expected, hint) {
|
|
63
|
-
super(`${code}: ${field}=${String(actual)}; expected ${expected}`);
|
|
64
|
-
this.name = "CameraError";
|
|
65
|
-
this.code = code;
|
|
66
|
-
this.expected = expected;
|
|
67
|
-
this.hint = hint;
|
|
68
|
-
this.detail = Object.freeze({ field, actual, expected });
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
function actualValue(value) {
|
|
72
|
-
if (typeof value === "number" || typeof value === "string") return value;
|
|
73
|
-
try {
|
|
74
|
-
return JSON.stringify(value) ?? String(value);
|
|
75
|
-
} catch {
|
|
76
|
-
return String(value);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
function cameraError(code, field, actual, expected, hint) {
|
|
80
|
-
return new CameraError(code, field, actualValue(actual), expected, hint);
|
|
81
|
-
}
|
|
82
|
-
function finitePositive(value) {
|
|
83
|
-
return Number.isFinite(value) && value > 0;
|
|
84
|
-
}
|
|
85
|
-
function validateCameraExposure(exposure) {
|
|
86
|
-
if (typeof exposure !== "object" || exposure === null) {
|
|
87
|
-
throw cameraError(
|
|
88
|
-
"camera-exposure-invalid",
|
|
89
|
-
"value",
|
|
90
|
-
exposure,
|
|
91
|
-
"an object with kind manual or auto",
|
|
92
|
-
"choose one member of the CameraExposure union"
|
|
93
|
-
);
|
|
94
|
-
}
|
|
95
|
-
if (exposure.kind === "manual") {
|
|
96
|
-
if (!finitePositive(exposure.multiplier)) {
|
|
97
|
-
throw cameraError(
|
|
98
|
-
"camera-exposure-invalid",
|
|
99
|
-
"multiplier",
|
|
100
|
-
exposure.multiplier,
|
|
101
|
-
"a finite number greater than zero",
|
|
102
|
-
"set Camera.exposure to a positive finite manual multiplier"
|
|
103
|
-
);
|
|
104
|
-
}
|
|
105
|
-
return exposure;
|
|
106
|
-
}
|
|
107
|
-
if (exposure.kind === "auto") {
|
|
108
|
-
const [min, max] = exposure.rangeEv;
|
|
109
|
-
const [up, down] = exposure.rates;
|
|
110
|
-
if (!finitePositive(exposure.fallback) || !Number.isFinite(exposure.compensationEv) || !Number.isFinite(min) || !Number.isFinite(max) || min > max || !Number.isFinite(up) || !Number.isFinite(down) || up < 0 || down < 0) {
|
|
111
|
-
throw cameraError(
|
|
112
|
-
"camera-exposure-invalid",
|
|
113
|
-
"auto",
|
|
114
|
-
JSON.stringify(exposure),
|
|
115
|
-
"finite fallback/compensation, an ordered range, and non-negative rates",
|
|
116
|
-
"inspect fallback, compensationEv, rangeEv, and rates before rebuilding the camera"
|
|
117
|
-
);
|
|
118
|
-
}
|
|
119
|
-
return exposure;
|
|
120
|
-
}
|
|
121
|
-
throw cameraError(
|
|
122
|
-
"camera-exposure-invalid",
|
|
123
|
-
"kind",
|
|
124
|
-
exposure.kind,
|
|
125
|
-
"'manual' or 'auto'",
|
|
126
|
-
"choose one member of the CameraExposure union"
|
|
127
|
-
);
|
|
128
|
-
}
|
|
129
|
-
function validateCameraColorGrading(temperature, tint, colorLutStrength) {
|
|
130
|
-
if (!Number.isFinite(temperature) || temperature < CAMERA_TEMPERATURE_MIN || temperature > CAMERA_TEMPERATURE_MAX) {
|
|
131
|
-
throw cameraError(
|
|
132
|
-
"camera-color-grading-invalid",
|
|
133
|
-
"temperature",
|
|
134
|
-
temperature,
|
|
135
|
-
`a finite value in [${CAMERA_TEMPERATURE_MIN}, ${CAMERA_TEMPERATURE_MAX}]`,
|
|
136
|
-
"set Camera.temperature to a supported Kelvin value"
|
|
137
|
-
);
|
|
138
|
-
}
|
|
139
|
-
if (!Number.isFinite(tint) || tint < CAMERA_TINT_MIN || tint > CAMERA_TINT_MAX) {
|
|
140
|
-
throw cameraError(
|
|
141
|
-
"camera-color-grading-invalid",
|
|
142
|
-
"tint",
|
|
143
|
-
tint,
|
|
144
|
-
`a finite value in [${CAMERA_TINT_MIN}, ${CAMERA_TINT_MAX}]`,
|
|
145
|
-
"set Camera.tint to a normalized value between -1 and 1"
|
|
146
|
-
);
|
|
147
|
-
}
|
|
148
|
-
if (!Number.isFinite(colorLutStrength) || colorLutStrength < 0 || colorLutStrength > 1) {
|
|
149
|
-
throw cameraError(
|
|
150
|
-
"camera-color-grading-invalid",
|
|
151
|
-
"colorLutStrength",
|
|
152
|
-
colorLutStrength,
|
|
153
|
-
"a finite value in [0, 1]",
|
|
154
|
-
"set Camera.colorLutStrength to zero to disable the LUT or a blend in [0, 1]"
|
|
155
|
-
);
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
function cameraProjectionFromF32(value) {
|
|
159
|
-
return value === CAMERA_PROJECTION_ORTHOGRAPHIC ? "orthographic" : "perspective";
|
|
160
|
-
}
|
|
161
|
-
var TONEMAP_NONE = TONEMAP_SHADER_MODE.none;
|
|
162
|
-
var TONEMAP_REINHARD_EXTENDED = TONEMAP_SHADER_MODE.reinhardExtended;
|
|
163
|
-
var TONEMAP_REINHARD = TONEMAP_SHADER_MODE.reinhard;
|
|
164
|
-
var TONEMAP_LINEAR = TONEMAP_SHADER_MODE.linear;
|
|
165
|
-
var TONEMAP_CINEON = TONEMAP_SHADER_MODE.cineon;
|
|
166
|
-
var TONEMAP_ACES_FILMIC = TONEMAP_SHADER_MODE.acesFilmic;
|
|
167
|
-
var TONEMAP_AGX = TONEMAP_SHADER_MODE.agx;
|
|
168
|
-
var TONEMAP_NEUTRAL = TONEMAP_SHADER_MODE.neutral;
|
|
169
|
-
function tonemapFromF32(value) {
|
|
170
|
-
switch (value) {
|
|
171
|
-
case TONEMAP_REINHARD_EXTENDED:
|
|
172
|
-
return "reinhard-extended";
|
|
173
|
-
case TONEMAP_REINHARD:
|
|
174
|
-
return "reinhard";
|
|
175
|
-
case TONEMAP_LINEAR:
|
|
176
|
-
return "linear";
|
|
177
|
-
case TONEMAP_CINEON:
|
|
178
|
-
return "cineon";
|
|
179
|
-
case TONEMAP_ACES_FILMIC:
|
|
180
|
-
return "aces-filmic";
|
|
181
|
-
case TONEMAP_AGX:
|
|
182
|
-
return "agx";
|
|
183
|
-
case TONEMAP_NEUTRAL:
|
|
184
|
-
return "neutral";
|
|
185
|
-
default:
|
|
186
|
-
return "none";
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
function tonemapToU32(mode) {
|
|
190
|
-
switch (mode) {
|
|
191
|
-
case "reinhard-extended":
|
|
192
|
-
return TONEMAP_REINHARD_EXTENDED;
|
|
193
|
-
case "reinhard":
|
|
194
|
-
return TONEMAP_REINHARD;
|
|
195
|
-
case "linear":
|
|
196
|
-
return TONEMAP_LINEAR;
|
|
197
|
-
case "cineon":
|
|
198
|
-
return TONEMAP_CINEON;
|
|
199
|
-
case "aces-filmic":
|
|
200
|
-
return TONEMAP_ACES_FILMIC;
|
|
201
|
-
case "agx":
|
|
202
|
-
return TONEMAP_AGX;
|
|
203
|
-
case "neutral":
|
|
204
|
-
return TONEMAP_NEUTRAL;
|
|
205
|
-
case "none":
|
|
206
|
-
return TONEMAP_NONE;
|
|
207
|
-
}
|
|
208
|
-
throw cameraError(
|
|
209
|
-
"camera-tonemap-invalid",
|
|
210
|
-
"tonemap",
|
|
211
|
-
mode,
|
|
212
|
-
"one of the closed Tonemap values",
|
|
213
|
-
"select a supported Camera tonemap mode"
|
|
214
|
-
);
|
|
215
|
-
}
|
|
216
|
-
var ANTIALIAS_NONE = 0;
|
|
217
|
-
var ANTIALIAS_FXAA = 1;
|
|
218
|
-
var ANTIALIAS_MSAA = 2;
|
|
219
|
-
var ANTIALIAS_TAA = 3;
|
|
220
|
-
function antialiasFromF32(value) {
|
|
221
|
-
if (value === ANTIALIAS_NONE) return "none";
|
|
222
|
-
if (value === ANTIALIAS_FXAA) return "fxaa";
|
|
223
|
-
if (value === ANTIALIAS_MSAA) return "msaa";
|
|
224
|
-
if (value === ANTIALIAS_TAA) return "taa";
|
|
225
|
-
throw cameraError(
|
|
226
|
-
"camera-antialias-invalid",
|
|
227
|
-
"antialias",
|
|
228
|
-
value,
|
|
229
|
-
`${ANTIALIAS_NONE}, ${ANTIALIAS_FXAA}, ${ANTIALIAS_MSAA}, or ${ANTIALIAS_TAA}`,
|
|
230
|
-
"select a supported Camera antialias mode"
|
|
231
|
-
);
|
|
232
|
-
}
|
|
233
|
-
var BLOOM_DISABLED = 0;
|
|
234
|
-
var BLOOM_ENABLED = 1;
|
|
235
|
-
var CAMERA_BLOOM_INTENSITY_MIN = 0;
|
|
236
|
-
var CAMERA_BLOOM_INTENSITY_MAX = 8;
|
|
237
|
-
var CAMERA_BLOOM_THRESHOLD_MIN = 0;
|
|
238
|
-
var CAMERA_BLOOM_THRESHOLD_MAX = 65504;
|
|
239
|
-
var CAMERA_BLOOM_SOFT_KNEE_MIN = 0;
|
|
240
|
-
var CAMERA_BLOOM_SOFT_KNEE_MAX = 1;
|
|
241
|
-
var CAMERA_BLOOM_SCATTER_MIN = 0;
|
|
242
|
-
var CAMERA_BLOOM_SCATTER_MAX = 0.95;
|
|
243
|
-
function bloomEnabledFromF32(value) {
|
|
244
|
-
if (value === BLOOM_DISABLED) return "off";
|
|
245
|
-
if (value === BLOOM_ENABLED) return "on";
|
|
246
|
-
throw cameraError(
|
|
247
|
-
"camera-bloom-invalid",
|
|
248
|
-
"bloom",
|
|
249
|
-
value,
|
|
250
|
-
`${BLOOM_DISABLED} or ${BLOOM_ENABLED}`,
|
|
251
|
-
"select Camera bloom off or on"
|
|
252
|
-
);
|
|
253
|
-
}
|
|
254
|
-
function validateBloomRange(field, value, min, max) {
|
|
255
|
-
if (!Number.isFinite(value) || value < min || value > max) {
|
|
256
|
-
throw cameraError(
|
|
257
|
-
"camera-bloom-invalid",
|
|
258
|
-
field,
|
|
259
|
-
value,
|
|
260
|
-
`a finite value in [${min}, ${max}]`,
|
|
261
|
-
`set Camera.${field} to a finite value in [${min}, ${max}]`
|
|
262
|
-
);
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
function validateCameraBloom(bloom, threshold, intensity, softKnee, scatter) {
|
|
266
|
-
const enabled = bloomEnabledFromF32(bloom);
|
|
267
|
-
validateBloomRange(
|
|
268
|
-
"bloomThreshold",
|
|
269
|
-
threshold,
|
|
270
|
-
CAMERA_BLOOM_THRESHOLD_MIN,
|
|
271
|
-
CAMERA_BLOOM_THRESHOLD_MAX
|
|
272
|
-
);
|
|
273
|
-
validateBloomRange(
|
|
274
|
-
"bloomIntensity",
|
|
275
|
-
intensity,
|
|
276
|
-
CAMERA_BLOOM_INTENSITY_MIN,
|
|
277
|
-
CAMERA_BLOOM_INTENSITY_MAX
|
|
278
|
-
);
|
|
279
|
-
validateBloomRange(
|
|
280
|
-
"bloomSoftKnee",
|
|
281
|
-
softKnee,
|
|
282
|
-
CAMERA_BLOOM_SOFT_KNEE_MIN,
|
|
283
|
-
CAMERA_BLOOM_SOFT_KNEE_MAX
|
|
284
|
-
);
|
|
285
|
-
validateBloomRange("bloomScatter", scatter, CAMERA_BLOOM_SCATTER_MIN, CAMERA_BLOOM_SCATTER_MAX);
|
|
286
|
-
return enabled;
|
|
287
|
-
}
|
|
288
|
-
var Camera = defineComponent("Camera", {
|
|
289
|
-
fov: { type: "f32" },
|
|
290
|
-
aspect: { type: "f32" },
|
|
291
|
-
near: { type: "f32" },
|
|
292
|
-
far: { type: "f32" },
|
|
293
|
-
projection: { type: "f32", default: 0 },
|
|
294
|
-
left: { type: "f32", default: -1 },
|
|
295
|
-
right: { type: "f32", default: 1 },
|
|
296
|
-
bottom: { type: "f32", default: -1 },
|
|
297
|
-
top: { type: "f32", default: 1 },
|
|
298
|
-
tonemap: { type: "f32", default: 0 },
|
|
299
|
-
exposure: { type: "f32", default: 1 },
|
|
300
|
-
exposureMode: { type: "f32", default: CAMERA_EXPOSURE_MODE_MANUAL },
|
|
301
|
-
compensationEv: { type: "f32", default: 0 },
|
|
302
|
-
rangeEv: { type: "array<f32, 2>", default: new Float32Array([-8, 8]) },
|
|
303
|
-
rates: { type: "array<f32, 2>", default: new Float32Array([3, 1]) },
|
|
304
|
-
whitePoint: { type: "f32", default: 4 },
|
|
305
|
-
temperature: { type: "f32", default: 6504 },
|
|
306
|
-
tint: { type: "f32", default: 0 },
|
|
307
|
-
colorLut: { type: "shared<TextureAsset>", default: 0 },
|
|
308
|
-
colorLutStrength: { type: "f32", default: 0 },
|
|
309
|
-
antialias: { type: "f32", default: 0 },
|
|
310
|
-
historyVersion: { type: "u32", default: 0 },
|
|
311
|
-
bloom: { type: "f32", default: 0 },
|
|
312
|
-
bloomThreshold: { type: "f32", default: 1 },
|
|
313
|
-
bloomIntensity: { type: "f32", default: 1 },
|
|
314
|
-
bloomSoftKnee: { type: "f32", default: 0.5 },
|
|
315
|
-
bloomScatter: { type: "f32", default: 0.7 },
|
|
316
|
-
// M1 target camera role: zero means this camera is eligible for display;
|
|
317
|
-
// non-zero shared targets are auxiliary producers whose views and receipt
|
|
318
|
-
// promotion remain owned by Renderer.
|
|
319
|
-
target: { type: "shared<RenderTarget>", simulationTransient: true },
|
|
320
|
-
// feat-20260709 M3 / D-3: clear-color is one inline `array<f32,4>` column.
|
|
321
|
-
// The earlier 4-scalar form (clearR/G/B/A) was chosen when this was believed
|
|
322
|
-
// to be the only SoA-safe shape; the Transform (pos/quat/scale) and light
|
|
323
|
-
// (direction/color) precedents disprove that -- an `array<f32,N>` IS an
|
|
324
|
-
// inline stride-N SoA column, read on the hot path as `col[i*N+a]` with zero
|
|
325
|
-
// allocation, so collapsing four scalars into one column removes three field
|
|
326
|
-
// names a reader must track without changing the storage layout or read
|
|
327
|
-
// pattern. The default `[0, 0, 0, 0]` is transparent black; explicit alpha
|
|
328
|
-
// stays visible through the same public array field.
|
|
329
|
-
clearColor: { type: "array<f32, 4>", default: new Float32Array([0, 0, 0, 0]) },
|
|
330
|
-
// feat-20260617-host-engine-contract-and-video-cutscene / M3 / D-4: the
|
|
331
|
-
// aspect-sync sidecar on the createApp(canvas) path writes
|
|
332
|
-
// canvas.width / canvas.height into `aspect` every frame when this flag is
|
|
333
|
-
// true. Reuses the existing `bool` column tier (AnimationPlayer.paused /
|
|
334
|
-
// AudioSource.playing precedent) -- zero ECS infrastructure change. Default
|
|
335
|
-
// true so demos that never touch aspect track the canvas automatically
|
|
336
|
-
// (charter P1 default-is-correct); set false for render-to-texture /
|
|
337
|
-
// split-screen cameras that drive aspect themselves. Read it via
|
|
338
|
-
// world.get (readRow narrows bool -> JS boolean); the query-bundle path
|
|
339
|
-
// returns a raw 0/1 number (the `!== 0` always-true trap).
|
|
340
|
-
autoAspect: { type: "bool", default: true }
|
|
341
|
-
});
|
|
342
|
-
function cameraExposureFromColumns(input) {
|
|
343
|
-
if (input.exposureMode === CAMERA_EXPOSURE_MODE_MANUAL) {
|
|
344
|
-
return validateCameraExposure({ kind: "manual", multiplier: input.exposure });
|
|
345
|
-
}
|
|
346
|
-
if (input.exposureMode === CAMERA_EXPOSURE_MODE_AUTO) {
|
|
347
|
-
return validateCameraExposure({
|
|
348
|
-
kind: "auto",
|
|
349
|
-
fallback: input.exposure,
|
|
350
|
-
compensationEv: input.compensationEv,
|
|
351
|
-
rangeEv: [input.rangeEv[0] ?? -8, input.rangeEv[1] ?? 8],
|
|
352
|
-
rates: [input.rates[0] ?? 3, input.rates[1] ?? 1]
|
|
353
|
-
});
|
|
354
|
-
}
|
|
355
|
-
throw cameraError(
|
|
356
|
-
"camera-exposure-mode-invalid",
|
|
357
|
-
"exposureMode",
|
|
358
|
-
input.exposureMode,
|
|
359
|
-
`${CAMERA_EXPOSURE_MODE_MANUAL} or ${CAMERA_EXPOSURE_MODE_AUTO}`,
|
|
360
|
-
"set Camera.exposureMode to the manual or auto encoding"
|
|
361
|
-
);
|
|
362
|
-
}
|
|
363
|
-
function cameraExposureColumns(exposure) {
|
|
364
|
-
const checked = validateCameraExposure(exposure);
|
|
365
|
-
if (checked.kind === "manual") {
|
|
366
|
-
return {
|
|
367
|
-
exposureMode: CAMERA_EXPOSURE_MODE_MANUAL,
|
|
368
|
-
exposure: checked.multiplier,
|
|
369
|
-
compensationEv: 0,
|
|
370
|
-
rangeEv: new Float32Array([-8, 8]),
|
|
371
|
-
rates: new Float32Array([3, 1])
|
|
372
|
-
};
|
|
373
|
-
}
|
|
374
|
-
return {
|
|
375
|
-
exposureMode: CAMERA_EXPOSURE_MODE_AUTO,
|
|
376
|
-
exposure: checked.fallback,
|
|
377
|
-
compensationEv: checked.compensationEv,
|
|
378
|
-
rangeEv: new Float32Array(checked.rangeEv),
|
|
379
|
-
rates: new Float32Array(checked.rates)
|
|
380
|
-
};
|
|
381
|
-
}
|
|
382
|
-
function cameraColorGradingColumns(opts) {
|
|
383
|
-
const exposure = opts.exposure ?? { kind: "manual", multiplier: 1 };
|
|
384
|
-
const temperature = opts.temperature ?? 6504;
|
|
385
|
-
const tint = opts.tint ?? 0;
|
|
386
|
-
const colorLutStrength = opts.colorLutStrength ?? 0;
|
|
387
|
-
validateCameraColorGrading(temperature, tint, colorLutStrength);
|
|
388
|
-
return {
|
|
389
|
-
...cameraExposureColumns(exposure),
|
|
390
|
-
temperature,
|
|
391
|
-
tint,
|
|
392
|
-
colorLut: opts.colorLut ?? 0,
|
|
393
|
-
colorLutStrength
|
|
394
|
-
};
|
|
395
|
-
}
|
|
396
|
-
function cameraPodFromDefaults() {
|
|
397
|
-
const base = {};
|
|
398
|
-
for (const [key, field] of Object.entries(Camera.fields)) {
|
|
399
|
-
if ("default" in field && field.default !== void 0) {
|
|
400
|
-
base[key] = field.default;
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
return base;
|
|
404
|
-
}
|
|
405
|
-
function perspective(opts) {
|
|
406
|
-
return {
|
|
407
|
-
// cameraPodFromDefaults() reads autoAspect's schema default (true), so an
|
|
408
|
-
// omitted opts.autoAspect lands the default-correct value; an explicit
|
|
409
|
-
// false overrides it below (D-4: factory one-step opt-out, charter P1).
|
|
410
|
-
...cameraPodFromDefaults(),
|
|
411
|
-
fov: opts.fov,
|
|
412
|
-
aspect: opts.aspect,
|
|
413
|
-
near: opts.near ?? 0.1,
|
|
414
|
-
far: opts.far ?? 100,
|
|
415
|
-
projection: CAMERA_PROJECTION_PERSPECTIVE,
|
|
416
|
-
...opts.autoAspect !== void 0 ? { autoAspect: opts.autoAspect } : {},
|
|
417
|
-
...cameraColorGradingColumns(opts)
|
|
418
|
-
};
|
|
419
|
-
}
|
|
420
|
-
function orthographic(opts) {
|
|
421
|
-
return {
|
|
422
|
-
...cameraPodFromDefaults(),
|
|
423
|
-
fov: 0,
|
|
424
|
-
aspect: 1,
|
|
425
|
-
near: opts.near ?? 0.1,
|
|
426
|
-
far: opts.far ?? 100,
|
|
427
|
-
projection: CAMERA_PROJECTION_ORTHOGRAPHIC,
|
|
428
|
-
left: opts.left,
|
|
429
|
-
right: opts.right,
|
|
430
|
-
bottom: opts.bottom,
|
|
431
|
-
top: opts.top,
|
|
432
|
-
...cameraColorGradingColumns(opts)
|
|
433
|
-
};
|
|
434
|
-
}
|
|
435
|
-
var CloudQualityValue = Object.freeze({
|
|
436
|
-
low: 0,
|
|
437
|
-
medium: 1,
|
|
438
|
-
high: 2
|
|
439
|
-
});
|
|
440
|
-
var CloudLayer = defineComponent("CloudLayer", {
|
|
441
|
-
/** Stable integer seed for the periodic 3D density field. */
|
|
442
|
-
seed: { type: "u32", default: 1337 },
|
|
443
|
-
/** World-space lower edge of the layer, in metres. */
|
|
444
|
-
baseHeight: { type: "f32", default: 120 },
|
|
445
|
-
/** World-space thickness of the layer, in metres. */
|
|
446
|
-
thickness: { type: "f32", default: 80 },
|
|
447
|
-
/** Horizontal noise scale, in cycles per metre. */
|
|
448
|
-
scale: { type: "f32", default: 4e-3 },
|
|
449
|
-
/** Coverage threshold in [0, 1]. */
|
|
450
|
-
coverage: { type: "f32", default: 0.48 },
|
|
451
|
-
/** Extinction multiplier in inverse metres. */
|
|
452
|
-
density: { type: "f32", default: 1 },
|
|
453
|
-
/** World-space wind velocity in metres per second. */
|
|
454
|
-
wind: { type: "array<f32, 3>", default: new Float32Array([8, 0, 2]) },
|
|
455
|
-
/** Quality controls cache resolution and bounded ray steps. */
|
|
456
|
-
quality: { type: "f32", default: CloudQualityValue.medium },
|
|
457
|
-
/** Maximum world-space distance represented by the light-space shadow map. */
|
|
458
|
-
shadowRange: { type: "f32", default: 512 }
|
|
459
|
-
});
|
|
460
|
-
function cloudQualityFromF32(value) {
|
|
461
|
-
if (value === CloudQualityValue.low) return "low";
|
|
462
|
-
if (value === CloudQualityValue.medium) return "medium";
|
|
463
|
-
if (value === CloudQualityValue.high) return "high";
|
|
464
|
-
return void 0;
|
|
465
|
-
}
|
|
466
|
-
var CUBE_CAMERA_UPDATE_ONCE = 0;
|
|
467
|
-
var CUBE_CAMERA_UPDATE_ON_DEMAND = 1;
|
|
468
|
-
var CUBE_CAMERA_UPDATE_CONTINUOUS = 2;
|
|
469
|
-
var CUBE_CAMERA_FACE_ORDER = ["+X", "-X", "+Y", "-Y", "+Z", "-Z"];
|
|
470
|
-
function cubeCameraUpdateIntentFromF32(value) {
|
|
471
|
-
switch (value) {
|
|
472
|
-
case CUBE_CAMERA_UPDATE_ONCE:
|
|
473
|
-
return "once";
|
|
474
|
-
case CUBE_CAMERA_UPDATE_ON_DEMAND:
|
|
475
|
-
return "on-demand";
|
|
476
|
-
case CUBE_CAMERA_UPDATE_CONTINUOUS:
|
|
477
|
-
return "continuous";
|
|
478
|
-
default:
|
|
479
|
-
throw new RenderIntentInvalidError("CubeCamera", value);
|
|
480
|
-
}
|
|
481
|
-
}
|
|
482
|
-
function cubeCameraUpdateIntentToF32(intent) {
|
|
483
|
-
switch (intent) {
|
|
484
|
-
case "once":
|
|
485
|
-
return CUBE_CAMERA_UPDATE_ONCE;
|
|
486
|
-
case "on-demand":
|
|
487
|
-
return CUBE_CAMERA_UPDATE_ON_DEMAND;
|
|
488
|
-
case "continuous":
|
|
489
|
-
return CUBE_CAMERA_UPDATE_CONTINUOUS;
|
|
490
|
-
}
|
|
491
|
-
}
|
|
492
|
-
var CubeCamera = defineComponent("CubeCamera", {
|
|
493
|
-
target: { type: "shared<RenderTarget>", simulationTransient: true },
|
|
494
|
-
near: { type: "f32", default: 0.1 },
|
|
495
|
-
far: { type: "f32", default: 100 },
|
|
496
|
-
updateIntent: { type: "f32", default: CUBE_CAMERA_UPDATE_ONCE },
|
|
497
|
-
requestVersion: { type: "u32", default: 0 },
|
|
498
|
-
faceBudget: { type: "u32", default: 1 }
|
|
499
|
-
});
|
|
500
|
-
var DepthOfFieldQualityValue = Object.freeze({
|
|
501
|
-
low: 0,
|
|
502
|
-
medium: 1,
|
|
503
|
-
high: 2
|
|
504
|
-
});
|
|
505
|
-
var DepthOfFieldSideValue = Object.freeze({
|
|
506
|
-
both: 0,
|
|
507
|
-
near: 1,
|
|
508
|
-
far: 2
|
|
509
|
-
});
|
|
510
|
-
var DepthOfField = defineComponent("DepthOfField", {
|
|
511
|
-
focusDistance: { type: "f32", default: 8 },
|
|
512
|
-
fStop: { type: "f32", default: 2.8 },
|
|
513
|
-
sensorHeight: { type: "f32", default: 0.024 },
|
|
514
|
-
maxRadiusPixels: { type: "f32", default: 16 },
|
|
515
|
-
quality: { type: "f32", default: DepthOfFieldQualityValue.medium },
|
|
516
|
-
blurSide: { type: "f32", default: DepthOfFieldSideValue.both }
|
|
517
|
-
});
|
|
518
|
-
function depthOfFieldQualityFromF32(value) {
|
|
519
|
-
if (value === DepthOfFieldQualityValue.low) return "low";
|
|
520
|
-
if (value === DepthOfFieldQualityValue.medium) return "medium";
|
|
521
|
-
if (value === DepthOfFieldQualityValue.high) return "high";
|
|
522
|
-
return void 0;
|
|
523
|
-
}
|
|
524
|
-
function depthOfFieldSideFromF32(value) {
|
|
525
|
-
if (value === DepthOfFieldSideValue.both) return "both";
|
|
526
|
-
if (value === DepthOfFieldSideValue.near) return "near";
|
|
527
|
-
if (value === DepthOfFieldSideValue.far) return "far";
|
|
528
|
-
return void 0;
|
|
529
|
-
}
|
|
530
|
-
|
|
531
|
-
// src/components/directional-shadow-filter.ts
|
|
532
|
-
var DirectionalShadowFilterValue = Object.freeze({
|
|
533
|
-
pcf1: 1,
|
|
534
|
-
pcf3: 2,
|
|
535
|
-
pcf5: 3,
|
|
536
|
-
pcssMedium: 4,
|
|
537
|
-
pcssHigh: 5
|
|
538
|
-
});
|
|
539
|
-
function directionalShadowQualityFromF32(value, angularRadiusRadians, maxPenumbraTexels) {
|
|
540
|
-
switch (value) {
|
|
541
|
-
case DirectionalShadowFilterValue.pcf1:
|
|
542
|
-
return { kind: "pcf", kernel: 1 };
|
|
543
|
-
case DirectionalShadowFilterValue.pcf3:
|
|
544
|
-
return { kind: "pcf", kernel: 3 };
|
|
545
|
-
case DirectionalShadowFilterValue.pcf5:
|
|
546
|
-
return { kind: "pcf", kernel: 5 };
|
|
547
|
-
case DirectionalShadowFilterValue.pcssMedium:
|
|
548
|
-
return {
|
|
549
|
-
kind: "pcss",
|
|
550
|
-
preset: "medium",
|
|
551
|
-
angularRadiusRadians,
|
|
552
|
-
maxPenumbraTexels
|
|
553
|
-
};
|
|
554
|
-
case DirectionalShadowFilterValue.pcssHigh:
|
|
555
|
-
return {
|
|
556
|
-
kind: "pcss",
|
|
557
|
-
preset: "high",
|
|
558
|
-
angularRadiusRadians,
|
|
559
|
-
maxPenumbraTexels
|
|
560
|
-
};
|
|
561
|
-
default:
|
|
562
|
-
return void 0;
|
|
563
|
-
}
|
|
564
|
-
}
|
|
565
|
-
var DirectionalLight = defineComponent("DirectionalLight", {
|
|
566
|
-
// direction is the ONLY field with no default (D-5): omitting it lands the
|
|
567
|
-
// array layer-3 all-zero [0,0,0], which the renderer owner rejects -- there is no
|
|
568
|
-
// universal default direction, so "default is illegal" forces an explicit
|
|
569
|
-
// non-zero value. color carries an explicit layer-2 default [1,1,1] (white);
|
|
570
|
-
// the array layer-3 fallback is all-zero, so the default MUST be explicit.
|
|
571
|
-
direction: { type: "array<f32, 3>" },
|
|
572
|
-
color: { type: "array<f32, 3>", default: new Float32Array([1, 1, 1]) },
|
|
573
|
-
intensity: { type: "f32", default: 1 },
|
|
574
|
-
// Shadow opt-out gate: defaults to true so zero-config spawns get shadows.
|
|
575
|
-
castShadow: { type: "bool", default: true },
|
|
576
|
-
// 9 shadow fields migrated from DirectionalLightShadow (feat-20260621 M1).
|
|
577
|
-
cascadeCount: { type: "f32", default: 4 },
|
|
578
|
-
splitLambda: { type: "f32", default: 0.75 },
|
|
579
|
-
cascadeBlend: { type: "f32", default: 0.2 },
|
|
580
|
-
mapSize: { type: "f32", default: 2048 },
|
|
581
|
-
depthBias: { type: "f32", default: 1e-5 },
|
|
582
|
-
normalBias: { type: "f32", default: 0.05 },
|
|
583
|
-
// Sole shadow coverage knob (feat replaces nearPlane/farPlane). The PSSM
|
|
584
|
-
// near end derives from the active camera near; shadowDistance is the far
|
|
585
|
-
// reach. Default 200 world units (matches UE-style "dynamic shadow
|
|
586
|
-
// distance"; the old farPlane default was 50).
|
|
587
|
-
shadowDistance: { type: "f32", default: 200 },
|
|
588
|
-
shadowFilter: {
|
|
589
|
-
type: "enum",
|
|
590
|
-
default: DirectionalShadowFilterValue.pcf3,
|
|
591
|
-
labels: DirectionalShadowFilterValue
|
|
592
|
-
},
|
|
593
|
-
shadowAngularRadius: { type: "f32", default: 465e-5 },
|
|
594
|
-
maxPenumbraTexels: { type: "f32", default: 32 }
|
|
595
|
-
});
|
|
596
|
-
var DynamicResolution = defineComponent("DynamicResolution", {
|
|
597
|
-
targetGpuMs: { type: "f32", default: 16.67 },
|
|
598
|
-
minScale: { type: "f32", default: 0.67 },
|
|
599
|
-
maxScale: { type: "f32", default: 1 }
|
|
600
|
-
});
|
|
601
|
-
var DEFAULT_DYNAMIC_RESOLUTION = Object.freeze({
|
|
602
|
-
targetGpuMs: 16.67,
|
|
603
|
-
minScale: 0.67,
|
|
604
|
-
maxScale: 1
|
|
605
|
-
});
|
|
606
|
-
function invalid2(field, value, expected) {
|
|
607
|
-
return new DynamicResolutionInvalidParameterError({ field, value, expected });
|
|
608
|
-
}
|
|
609
|
-
function validateDynamicResolutionParameters(input) {
|
|
610
|
-
const value = input ?? {};
|
|
611
|
-
const targetGpuMs = value.targetGpuMs ?? DEFAULT_DYNAMIC_RESOLUTION.targetGpuMs;
|
|
612
|
-
const minScale = value.minScale ?? DEFAULT_DYNAMIC_RESOLUTION.minScale;
|
|
613
|
-
const maxScale = value.maxScale ?? DEFAULT_DYNAMIC_RESOLUTION.maxScale;
|
|
614
|
-
if (!Number.isFinite(targetGpuMs) || targetGpuMs <= 0) {
|
|
615
|
-
return err(invalid2("targetGpuMs", targetGpuMs, "finite and greater than 0"));
|
|
616
|
-
}
|
|
617
|
-
if (!Number.isFinite(minScale) || minScale < 0.5 || minScale > 1) {
|
|
618
|
-
return err(invalid2("minScale", minScale, "finite and in [0.5, 1.0]"));
|
|
619
|
-
}
|
|
620
|
-
if (!Number.isFinite(maxScale) || maxScale < 0.5 || maxScale > 1) {
|
|
621
|
-
return err(invalid2("maxScale", maxScale, "finite and in [0.5, 1.0]"));
|
|
622
|
-
}
|
|
623
|
-
if (minScale > maxScale) {
|
|
624
|
-
return err(invalid2("minScale", minScale, "less than or equal to maxScale"));
|
|
625
|
-
}
|
|
626
|
-
return ok(Object.freeze({ targetGpuMs, minScale, maxScale }));
|
|
627
|
-
}
|
|
628
|
-
function validateDynamicResolutionCamera(input, antialias) {
|
|
629
|
-
if (input === void 0) return ok(void 0);
|
|
630
|
-
const parameters = validateDynamicResolutionParameters(input);
|
|
631
|
-
if (!parameters.ok) return parameters;
|
|
632
|
-
if (antialias !== "taa") {
|
|
633
|
-
return err(new DynamicResolutionRequiresTaaError({ antialias }));
|
|
634
|
-
}
|
|
635
|
-
return parameters;
|
|
636
|
-
}
|
|
637
|
-
var Fog = defineComponent("Fog", {
|
|
638
|
-
color: { type: "array<f32, 3>", default: new Float32Array([0.5, 0.5, 0.5]) },
|
|
639
|
-
density: { type: "f32", default: 0.01 },
|
|
640
|
-
heightFalloff: { type: "f32", default: 0 },
|
|
641
|
-
maxOpacity: { type: "f32", default: 1 }
|
|
642
|
-
});
|
|
643
|
-
var Instances = defineComponent("Instances", {
|
|
644
|
-
transforms: { type: "array<f32>" }
|
|
645
|
-
});
|
|
646
|
-
var Layer = defineComponent("Layer", {
|
|
647
|
-
value: { type: "i32", default: 0 }
|
|
648
|
-
});
|
|
649
|
-
|
|
650
|
-
// src/components/light-helpers.ts
|
|
651
|
-
var RANGE_ZERO_FALLBACK_INV_R2 = 1e8;
|
|
652
|
-
var DEG_TO_RAD = Math.PI / 180;
|
|
653
|
-
var PCSS_RADIUS_MIN = 1e-4;
|
|
654
|
-
var PCSS_RADIUS_MAX = 0.05;
|
|
655
|
-
var PCSS_PENUMBRA_MIN = 1;
|
|
656
|
-
var PCSS_PENUMBRA_MAX = 64;
|
|
657
|
-
function degToCos(deg) {
|
|
658
|
-
return Math.cos(deg * DEG_TO_RAD);
|
|
659
|
-
}
|
|
660
|
-
function computeInvRangeSquared(range) {
|
|
661
|
-
if (range === Number.POSITIVE_INFINITY) return 0;
|
|
662
|
-
if (range === 0) return RANGE_ZERO_FALLBACK_INV_R2;
|
|
663
|
-
return 1 / (range * range);
|
|
664
|
-
}
|
|
665
|
-
function validateDirection(componentName, direction) {
|
|
666
|
-
const dir = direction;
|
|
667
|
-
if (dir === void 0 || (dir[0] ?? 0) === 0 && (dir[1] ?? 0) === 0 && (dir[2] ?? 0) === 0) {
|
|
668
|
-
return new SpawnLightInvalidBoundsError(
|
|
669
|
-
componentName,
|
|
670
|
-
"direction",
|
|
671
|
-
dir === void 0 ? [0, 0, 0] : [dir[0] ?? 0, dir[1] ?? 0, dir[2] ?? 0]
|
|
672
|
-
);
|
|
673
|
-
}
|
|
674
|
-
return null;
|
|
675
|
-
}
|
|
676
|
-
function validateDirectionalLightData(data) {
|
|
677
|
-
const directionError = validateDirection(
|
|
678
|
-
"DirectionalLight",
|
|
679
|
-
data.direction
|
|
680
|
-
);
|
|
681
|
-
if (directionError !== null) return err(directionError);
|
|
682
|
-
if (data.castShadow === false) return ok(void 0);
|
|
683
|
-
const mapSize = data.mapSize ?? 2048;
|
|
684
|
-
if (mapSize < 1) {
|
|
685
|
-
return err(new ShadowInvalidConfigError("mapSize", mapSize, 1));
|
|
686
|
-
}
|
|
687
|
-
const cascadeCount = data.cascadeCount ?? 4;
|
|
688
|
-
if (cascadeCount < 1 || cascadeCount > 4 || !Number.isInteger(cascadeCount)) {
|
|
689
|
-
return err(new ShadowInvalidConfigError("cascadeCount", cascadeCount, 1, 4));
|
|
690
|
-
}
|
|
691
|
-
const splitLambda = data.splitLambda ?? 0.75;
|
|
692
|
-
if (splitLambda < 0 || splitLambda > 1) {
|
|
693
|
-
return err(new ShadowInvalidConfigError("splitLambda", splitLambda, 0, 1));
|
|
694
|
-
}
|
|
695
|
-
const cascadeBlend = data.cascadeBlend ?? 0.2;
|
|
696
|
-
if (cascadeBlend < 0 || cascadeBlend > 0.5) {
|
|
697
|
-
return err(new ShadowInvalidConfigError("cascadeBlend", cascadeBlend, 0, 0.5));
|
|
698
|
-
}
|
|
699
|
-
const shadowDistance = data.shadowDistance ?? 200;
|
|
700
|
-
if (shadowDistance <= 0) {
|
|
701
|
-
return err(new ShadowInvalidConfigError("shadowDistance", shadowDistance, 0, ">"));
|
|
702
|
-
}
|
|
703
|
-
const shadowFilter = data.shadowFilter ?? DirectionalShadowFilterValue.pcf3;
|
|
704
|
-
const allowedFilters = Object.values(DirectionalShadowFilterValue);
|
|
705
|
-
if (!Number.isFinite(shadowFilter) || !allowedFilters.includes(shadowFilter)) {
|
|
706
|
-
return err(
|
|
707
|
-
new ShadowInvalidConfigError(
|
|
708
|
-
"shadowFilter",
|
|
709
|
-
shadowFilter,
|
|
710
|
-
{ kind: "allowed-values", values: allowedFilters },
|
|
711
|
-
void 0,
|
|
712
|
-
"one of [pcf1, pcf3, pcf5, pcssMedium, pcssHigh]"
|
|
713
|
-
)
|
|
714
|
-
);
|
|
715
|
-
}
|
|
716
|
-
if (shadowFilter === DirectionalShadowFilterValue.pcssMedium || shadowFilter === DirectionalShadowFilterValue.pcssHigh) {
|
|
717
|
-
const shadowAngularRadius = data.shadowAngularRadius ?? 465e-5;
|
|
718
|
-
if (!Number.isFinite(shadowAngularRadius)) {
|
|
719
|
-
return err(
|
|
720
|
-
new ShadowInvalidConfigError("shadowAngularRadius", shadowAngularRadius, {
|
|
721
|
-
kind: "range",
|
|
722
|
-
min: PCSS_RADIUS_MIN,
|
|
723
|
-
max: PCSS_RADIUS_MAX
|
|
724
|
-
})
|
|
725
|
-
);
|
|
726
|
-
}
|
|
727
|
-
if (shadowAngularRadius < Math.fround(PCSS_RADIUS_MIN) || shadowAngularRadius > Math.fround(PCSS_RADIUS_MAX)) {
|
|
728
|
-
return err(
|
|
729
|
-
new ShadowInvalidConfigError("shadowAngularRadius", shadowAngularRadius, {
|
|
730
|
-
kind: "range",
|
|
731
|
-
min: PCSS_RADIUS_MIN,
|
|
732
|
-
max: PCSS_RADIUS_MAX
|
|
733
|
-
})
|
|
734
|
-
);
|
|
735
|
-
}
|
|
736
|
-
const maxPenumbraTexels = data.maxPenumbraTexels ?? 32;
|
|
737
|
-
if (!Number.isFinite(maxPenumbraTexels) || !Number.isInteger(maxPenumbraTexels) || maxPenumbraTexels < PCSS_PENUMBRA_MIN || maxPenumbraTexels > PCSS_PENUMBRA_MAX) {
|
|
738
|
-
return err(
|
|
739
|
-
new ShadowInvalidConfigError(
|
|
740
|
-
"maxPenumbraTexels",
|
|
741
|
-
maxPenumbraTexels,
|
|
742
|
-
{ kind: "range", min: PCSS_PENUMBRA_MIN, max: PCSS_PENUMBRA_MAX },
|
|
743
|
-
void 0,
|
|
744
|
-
"a finite integer in [1, 64]"
|
|
745
|
-
)
|
|
746
|
-
);
|
|
747
|
-
}
|
|
748
|
-
}
|
|
749
|
-
return ok(void 0);
|
|
750
|
-
}
|
|
751
|
-
function validateSpotLightData(data) {
|
|
752
|
-
const directionError = validateDirection(
|
|
753
|
-
"SpotLight",
|
|
754
|
-
data.direction
|
|
755
|
-
);
|
|
756
|
-
if (directionError !== null) return err(directionError);
|
|
757
|
-
if (data.castShadow === false) return ok(void 0);
|
|
758
|
-
const range = data.range ?? 10;
|
|
759
|
-
if (typeof range !== "number" || Number.isNaN(range) || range < 0) {
|
|
760
|
-
return err(new SpawnLightInvalidBoundsError("SpotLight", "range", range));
|
|
761
|
-
}
|
|
762
|
-
const innerConeDeg = data.innerConeDeg ?? 0;
|
|
763
|
-
const outerConeDeg = data.outerConeDeg ?? 45;
|
|
764
|
-
if (outerConeDeg > 90) {
|
|
765
|
-
return err(new SpawnLightInvalidBoundsError("SpotLight", "outerNinety", outerConeDeg));
|
|
766
|
-
}
|
|
767
|
-
if (outerConeDeg <= innerConeDeg) {
|
|
768
|
-
return err(new SpawnLightInvalidBoundsError("SpotLight", "innerOuter", outerConeDeg));
|
|
769
|
-
}
|
|
770
|
-
const mapSize = data.mapSize ?? 2048;
|
|
771
|
-
if (mapSize < 1) return err(new ShadowInvalidConfigError("mapSize", mapSize, 1));
|
|
772
|
-
const nearPlane = data.nearPlane;
|
|
773
|
-
const farPlane = data.farPlane;
|
|
774
|
-
if (nearPlane !== void 0 && farPlane !== void 0 && farPlane <= nearPlane) {
|
|
775
|
-
return err(new ShadowInvalidConfigError("farPlane", farPlane, nearPlane));
|
|
776
|
-
}
|
|
777
|
-
const pcfKernelSize = data.pcfKernelSize ?? 3;
|
|
778
|
-
if (pcfKernelSize < 1 || pcfKernelSize % 2 === 0) {
|
|
779
|
-
return err(
|
|
780
|
-
new ShadowInvalidConfigError(
|
|
781
|
-
"pcfKernelSize",
|
|
782
|
-
pcfKernelSize,
|
|
783
|
-
{ kind: "lower-bound", operator: ">=", value: 1 },
|
|
784
|
-
void 0,
|
|
785
|
-
"an odd integer >= 1"
|
|
786
|
-
)
|
|
787
|
-
);
|
|
788
|
-
}
|
|
789
|
-
const shadowIntensity = data.shadowIntensity ?? 1;
|
|
790
|
-
if (!Number.isFinite(shadowIntensity) || shadowIntensity < 0 || shadowIntensity > 1) {
|
|
791
|
-
return err(new ShadowInvalidConfigError("shadowIntensity", shadowIntensity, 0, 1));
|
|
792
|
-
}
|
|
793
|
-
return ok(void 0);
|
|
794
|
-
}
|
|
795
|
-
function validatePointLightData(data) {
|
|
796
|
-
const range = data.range ?? 10;
|
|
797
|
-
if (typeof range !== "number" || Number.isNaN(range) || range < 0) {
|
|
798
|
-
return err(new SpawnLightInvalidBoundsError("PointLight", "range", range));
|
|
799
|
-
}
|
|
800
|
-
return ok(void 0);
|
|
801
|
-
}
|
|
802
|
-
function validatePointLightShadowData(data) {
|
|
803
|
-
const mapSize = data.mapSize ?? 512;
|
|
804
|
-
if (mapSize < 1) return err(new ShadowInvalidConfigError("mapSize", mapSize, 1));
|
|
805
|
-
const nearPlane = data.nearPlane ?? 0.1;
|
|
806
|
-
const farPlane = data.farPlane ?? 25;
|
|
807
|
-
if (farPlane <= nearPlane) {
|
|
808
|
-
return err(new ShadowInvalidConfigError("farPlane", farPlane, nearPlane));
|
|
809
|
-
}
|
|
810
|
-
const pcfKernelSize = data.pcfKernelSize ?? 3;
|
|
811
|
-
if (pcfKernelSize < 1 || pcfKernelSize % 2 === 0) {
|
|
812
|
-
return err(
|
|
813
|
-
new ShadowInvalidConfigError(
|
|
814
|
-
"pcfKernelSize",
|
|
815
|
-
pcfKernelSize,
|
|
816
|
-
{ kind: "lower-bound", operator: ">=", value: 1 },
|
|
817
|
-
void 0,
|
|
818
|
-
"an odd integer >= 1"
|
|
819
|
-
)
|
|
820
|
-
);
|
|
821
|
-
}
|
|
822
|
-
return ok(void 0);
|
|
823
|
-
}
|
|
824
|
-
function validateRectAreaLightData(data) {
|
|
825
|
-
const intensity = data.intensity ?? 1;
|
|
826
|
-
if (typeof intensity !== "number" || !Number.isFinite(intensity) || intensity < 0) {
|
|
827
|
-
return err(new SpawnLightInvalidBoundsError("RectAreaLight", "intensity", intensity));
|
|
828
|
-
}
|
|
829
|
-
const color = data.color ?? [1, 1, 1];
|
|
830
|
-
if (color.length !== 3 || Array.from(color).some(
|
|
831
|
-
(value) => typeof value !== "number" || !Number.isFinite(value) || value < 0
|
|
832
|
-
)) {
|
|
833
|
-
return err(new SpawnLightInvalidBoundsError("RectAreaLight", "color", Array.from(color)));
|
|
834
|
-
}
|
|
835
|
-
for (const field of ["width", "height", "range"]) {
|
|
836
|
-
const value = data[field] ?? (field === "range" ? 10 : 1);
|
|
837
|
-
if (typeof value !== "number" || !Number.isFinite(value) || value <= 0) {
|
|
838
|
-
return err(new SpawnLightInvalidBoundsError("RectAreaLight", field, value));
|
|
839
|
-
}
|
|
840
|
-
}
|
|
841
|
-
return ok(void 0);
|
|
842
|
-
}
|
|
843
|
-
function validateLightProbeData(data) {
|
|
844
|
-
const irradiance = data.irradiance;
|
|
845
|
-
if (irradiance === void 0 || irradiance.length !== 27 || Array.from(irradiance).some((value) => typeof value !== "number" || !Number.isFinite(value))) {
|
|
846
|
-
return err(
|
|
847
|
-
new SpawnLightInvalidBoundsError(
|
|
848
|
-
"LightProbe",
|
|
849
|
-
"irradiance",
|
|
850
|
-
irradiance === void 0 ? [] : Array.from(irradiance)
|
|
851
|
-
)
|
|
852
|
-
);
|
|
853
|
-
}
|
|
854
|
-
const radius = data.radius ?? R_MIN;
|
|
855
|
-
if (typeof radius !== "number" || !Number.isFinite(radius) || radius < R_MIN) {
|
|
856
|
-
return err(new SpawnLightInvalidBoundsError("LightProbe", "radius", radius));
|
|
857
|
-
}
|
|
858
|
-
return ok(void 0);
|
|
859
|
-
}
|
|
860
|
-
var LightProbe = defineComponent("LightProbe", {
|
|
861
|
-
irradiance: { type: "array<f32, 27>" },
|
|
862
|
-
radius: { type: "f32", default: R_MIN }
|
|
863
|
-
});
|
|
864
|
-
var Lines = defineComponent(
|
|
865
|
-
"Lines",
|
|
866
|
-
{
|
|
867
|
-
widthPx: { type: "f32", default: 1 }
|
|
868
|
-
},
|
|
869
|
-
{
|
|
870
|
-
meta: {
|
|
871
|
-
quickStart: "Attach Lines to render line-list MeshAsset pairs in screen pixels.",
|
|
872
|
-
diagnostics: "Inspect widthPx at the points-lines admission boundary.",
|
|
873
|
-
recovery: "Use points-lines-invalid-style for non-finite or non-positive widthPx values.",
|
|
874
|
-
boundaries: "Lines owns raster width only; MeshFilter and MeshRenderer own geometry and material."
|
|
875
|
-
}
|
|
876
|
-
}
|
|
877
|
-
);
|
|
878
|
-
var MeshFilter = defineComponent("MeshFilter", {
|
|
879
|
-
assetHandle: { type: "shared<MeshAsset>" }
|
|
880
|
-
});
|
|
881
|
-
var MeshRenderer = defineComponent("MeshRenderer", {
|
|
882
|
-
materials: { type: "array<shared<MaterialAsset>>", default: [] }
|
|
883
|
-
});
|
|
884
|
-
var MotionBlur = defineComponent("MotionBlur", {
|
|
885
|
-
shutterAngle: { type: "f32", default: 180 },
|
|
886
|
-
maxRadiusPixels: { type: "f32", default: 32 },
|
|
887
|
-
sampleCount: { type: "f32", default: 8 },
|
|
888
|
-
targetFps: { type: "f32", default: 60 }
|
|
889
|
-
});
|
|
890
|
-
var PointLight = defineComponent("PointLight", {
|
|
891
|
-
// color carries an explicit layer-2 default [1,1,1] (white); the array
|
|
892
|
-
// layer-3 fallback is all-zero, so the default MUST be explicit (D-5).
|
|
893
|
-
color: { type: "array<f32, 3>", default: new Float32Array([1, 1, 1]) },
|
|
894
|
-
intensity: { type: "f32", default: 1 },
|
|
895
|
-
range: { type: "f32", default: 10 }
|
|
896
|
-
});
|
|
897
|
-
var PointLightShadow = defineComponent("PointLightShadow", {
|
|
898
|
-
mapSize: { type: "f32", default: 512 },
|
|
899
|
-
depthBias: { type: "f32", default: 5e-3 },
|
|
900
|
-
normalBias: { type: "f32", default: 0.05 },
|
|
901
|
-
nearPlane: { type: "f32", default: 0.1 },
|
|
902
|
-
farPlane: { type: "f32", default: 25 },
|
|
903
|
-
pcfKernelSize: { type: "f32", default: 3 }
|
|
904
|
-
});
|
|
905
|
-
var PointShapeValue = Object.freeze({
|
|
906
|
-
square: 0,
|
|
907
|
-
circle: 1
|
|
908
|
-
});
|
|
909
|
-
function pointShapeFromU32(value) {
|
|
910
|
-
switch (value) {
|
|
911
|
-
case PointShapeValue.square:
|
|
912
|
-
return "square";
|
|
913
|
-
case PointShapeValue.circle:
|
|
914
|
-
return "circle";
|
|
915
|
-
default:
|
|
916
|
-
return void 0;
|
|
917
|
-
}
|
|
918
|
-
}
|
|
919
|
-
var Points = defineComponent(
|
|
920
|
-
"Points",
|
|
921
|
-
{
|
|
922
|
-
sizePx: { type: "f32", default: 4 },
|
|
923
|
-
shape: { type: "enum", default: PointShapeValue.square, labels: PointShapeValue }
|
|
924
|
-
},
|
|
925
|
-
{
|
|
926
|
-
meta: {
|
|
927
|
-
quickStart: "Attach Points to render point-list MeshAsset vertices in screen pixels.",
|
|
928
|
-
diagnostics: "Inspect sizePx and decode shape with pointShapeFromU32.",
|
|
929
|
-
recovery: "Use points-lines-invalid-style for non-finite or non-positive sizePx values.",
|
|
930
|
-
boundaries: "Points owns raster size and shape only; MeshFilter and MeshRenderer own geometry and material."
|
|
931
|
-
}
|
|
932
|
-
}
|
|
933
|
-
);
|
|
934
|
-
var schema = {
|
|
935
|
-
shader: "string",
|
|
936
|
-
data: "buffer"
|
|
937
|
-
};
|
|
938
|
-
var PostProcessParams = defineComponent("PostProcessParams", schema);
|
|
939
|
-
var RectAreaLight = defineComponent("RectAreaLight", {
|
|
940
|
-
color: { type: "array<f32, 3>", default: new Float32Array([1, 1, 1]) },
|
|
941
|
-
intensity: { type: "f32", default: 1 },
|
|
942
|
-
width: { type: "f32", default: 1 },
|
|
943
|
-
height: { type: "f32", default: 1 },
|
|
944
|
-
range: { type: "f32", default: 10 }
|
|
945
|
-
});
|
|
946
|
-
var REFLECTION_PROBE_UPDATE_ONCE = 0;
|
|
947
|
-
var REFLECTION_PROBE_UPDATE_ON_CHANGE = 1;
|
|
948
|
-
var REFLECTION_PROBE_UPDATE_CONTINUOUS = 2;
|
|
949
|
-
function reflectionProbeUpdateIntentFromF32(value) {
|
|
950
|
-
switch (value) {
|
|
951
|
-
case REFLECTION_PROBE_UPDATE_ONCE:
|
|
952
|
-
return "once";
|
|
953
|
-
case REFLECTION_PROBE_UPDATE_ON_CHANGE:
|
|
954
|
-
return "on-change";
|
|
955
|
-
case REFLECTION_PROBE_UPDATE_CONTINUOUS:
|
|
956
|
-
return "continuous";
|
|
957
|
-
default:
|
|
958
|
-
throw new RenderIntentInvalidError("ReflectionProbe", value);
|
|
959
|
-
}
|
|
960
|
-
}
|
|
961
|
-
function reflectionProbeUpdateIntentToF32(intent) {
|
|
962
|
-
switch (intent) {
|
|
963
|
-
case "once":
|
|
964
|
-
return REFLECTION_PROBE_UPDATE_ONCE;
|
|
965
|
-
case "on-change":
|
|
966
|
-
return REFLECTION_PROBE_UPDATE_ON_CHANGE;
|
|
967
|
-
case "continuous":
|
|
968
|
-
return REFLECTION_PROBE_UPDATE_CONTINUOUS;
|
|
969
|
-
}
|
|
970
|
-
}
|
|
971
|
-
var ReflectionProbe = defineComponent("ReflectionProbe", {
|
|
972
|
-
halfExtents: { type: "array<f32, 3>", default: new Float32Array([1, 1, 1]) },
|
|
973
|
-
priority: { type: "f32", default: 0 },
|
|
974
|
-
boxProjection: { type: "bool", default: false },
|
|
975
|
-
intensity: { type: "f32", default: 1 },
|
|
976
|
-
resolution: { type: "u32", default: 256 },
|
|
977
|
-
updateIntent: { type: "f32", default: REFLECTION_PROBE_UPDATE_ONCE },
|
|
978
|
-
invalidationVersion: { type: "u32", default: 0 }
|
|
979
|
-
});
|
|
980
|
-
var SceneInstance = defineComponent(
|
|
981
|
-
"SceneInstance",
|
|
982
|
-
{
|
|
983
|
-
source: { type: "shared<SceneAsset>" },
|
|
984
|
-
mapping: { type: "array<entity>" },
|
|
985
|
-
// The unique slot is the ECS storage seam for the instance's structured
|
|
986
|
-
// runtime payload; keep the nested semantic visible to schema consumers.
|
|
987
|
-
state: { type: "unique<SceneInstanceState>", shape: "nested" }
|
|
988
|
-
},
|
|
989
|
-
{ transient: true }
|
|
990
|
-
);
|
|
991
|
-
var ScreenSpaceReflection = defineComponent("ScreenSpaceReflection", {
|
|
992
|
-
maxDistance: { type: "f32", default: 40 },
|
|
993
|
-
thickness: { type: "f32", default: 0.2 },
|
|
994
|
-
maxRoughness: { type: "f32", default: 0.6 }
|
|
995
|
-
});
|
|
996
|
-
var SKYBOX_MODE_CUBEMAP = 0;
|
|
997
|
-
var SkyboxBackground = defineComponent("SkyboxBackground", {
|
|
998
|
-
// The GPU skybox projection is render-owned presentation state; restore
|
|
999
|
-
// keeps the portable mode/rotation controls and lets the owner re-resolve
|
|
1000
|
-
// the environment asset on the target world.
|
|
1001
|
-
equirect: { type: "shared<EquirectAsset>", simulationTransient: true },
|
|
1002
|
-
mode: { type: "f32", default: SKYBOX_MODE_CUBEMAP },
|
|
1003
|
-
rotation: { type: "array<f32, 4>", default: new Float32Array([0, 0, 0, 1]) }
|
|
1004
|
-
});
|
|
1005
|
-
var Skylight = defineComponent("Skylight", {
|
|
1006
|
-
// The GPU equirect-to-cubemap projection is render-owned presentation
|
|
1007
|
-
// state. Record/restore preserves the portable lighting controls while the
|
|
1008
|
-
// render owner resolves this asset again on the target world.
|
|
1009
|
-
equirect: { type: "shared<EquirectAsset>", simulationTransient: true },
|
|
1010
|
-
// color carries an explicit layer-2 default [1,1,1] (white); the array
|
|
1011
|
-
// layer-3 fallback is all-zero, so the default MUST be explicit (D-5).
|
|
1012
|
-
color: { type: "array<f32, 3>", default: new Float32Array([1, 1, 1]) },
|
|
1013
|
-
intensity: { type: "f32", default: 1 },
|
|
1014
|
-
rotation: { type: "array<f32, 4>", default: new Float32Array([0, 0, 0, 1]) }
|
|
1015
|
-
});
|
|
1016
|
-
var SortKey = defineComponent("SortKey", {
|
|
1017
|
-
value: { type: "f32", default: 0 }
|
|
1018
|
-
});
|
|
1019
|
-
var SpotLight = defineComponent("SpotLight", {
|
|
1020
|
-
// direction has no default (D-5): omitting it lands the array layer-3
|
|
1021
|
-
// all-zero, which validate() rejects. color carries an explicit layer-2
|
|
1022
|
-
// default [1,1,1] (white); the array layer-3 fallback is all-zero.
|
|
1023
|
-
direction: { type: "array<f32, 3>" },
|
|
1024
|
-
color: { type: "array<f32, 3>", default: new Float32Array([1, 1, 1]) },
|
|
1025
|
-
intensity: { type: "f32", default: 1 },
|
|
1026
|
-
range: { type: "f32", default: 10 },
|
|
1027
|
-
innerConeDeg: { type: "f32", default: 0 },
|
|
1028
|
-
outerConeDeg: { type: "f32", default: 45 },
|
|
1029
|
-
iesProfile: { type: "shared<IesProfileAsset>" },
|
|
1030
|
-
cookie: { type: "shared<TextureAsset>" },
|
|
1031
|
-
rollDeg: { type: "f32", default: 0 },
|
|
1032
|
-
// Shadow opt-out gate: defaults to true so zero-config spawns cast shadows.
|
|
1033
|
-
castShadow: { type: "bool", default: true },
|
|
1034
|
-
// 7 shadow fields aligned with the shared light shadow vocabulary.
|
|
1035
|
-
mapSize: { type: "f32", default: 2048 },
|
|
1036
|
-
depthBias: { type: "f32", default: 5e-3 },
|
|
1037
|
-
normalBias: { type: "f32", default: 0.05 },
|
|
1038
|
-
nearPlane: { type: "f32", default: 0.1 },
|
|
1039
|
-
farPlane: { type: "f32", default: 50 },
|
|
1040
|
-
pcfKernelSize: { type: "f32", default: 3 },
|
|
1041
|
-
// Three's SpotLight.shadow.intensity is the fraction of visibility applied
|
|
1042
|
-
// to a shadowed contribution. Keep it in the author-facing [0,1] domain;
|
|
1043
|
-
// extract/record transport this one fact to surface and volume consumers.
|
|
1044
|
-
shadowIntensity: { type: "f32", default: 1 },
|
|
1045
|
-
// Shared TextureAsset identity; publication and residency remain owned by
|
|
1046
|
-
// the existing asset and GPU resource owners.
|
|
1047
|
-
projector: { type: "shared<TextureAsset>", simulationTransient: true }
|
|
1048
|
-
});
|
|
1049
|
-
var VisibilityStateValue = Object.freeze({
|
|
1050
|
-
inherited: 0,
|
|
1051
|
-
hidden: 1,
|
|
1052
|
-
visible: 2
|
|
1053
|
-
});
|
|
1054
|
-
function visibilityStateFromU32(value) {
|
|
1055
|
-
switch (value) {
|
|
1056
|
-
case VisibilityStateValue.inherited:
|
|
1057
|
-
return "inherited";
|
|
1058
|
-
case VisibilityStateValue.hidden:
|
|
1059
|
-
return "hidden";
|
|
1060
|
-
case VisibilityStateValue.visible:
|
|
1061
|
-
return "visible";
|
|
1062
|
-
default:
|
|
1063
|
-
return void 0;
|
|
1064
|
-
}
|
|
1065
|
-
}
|
|
1066
|
-
var Visibility = defineComponent(
|
|
1067
|
-
"Visibility",
|
|
1068
|
-
{
|
|
1069
|
-
state: {
|
|
1070
|
-
type: "enum",
|
|
1071
|
-
default: VisibilityStateValue.inherited,
|
|
1072
|
-
labels: VisibilityStateValue
|
|
1073
|
-
}
|
|
1074
|
-
},
|
|
1075
|
-
{
|
|
1076
|
-
meta: {
|
|
1077
|
-
quickStart: "Attach Visibility to author render participation intent.",
|
|
1078
|
-
diagnostics: "Compare the ECS state with resolveVisibility and renderer.visibilityStats.",
|
|
1079
|
-
recovery: "Use structured ECS write errors and repair the owning scene relation.",
|
|
1080
|
-
boundaries: "Visibility does not own camera, picking, lifecycle, assets, or VFX shadow policy."
|
|
1081
|
-
}
|
|
1082
|
-
}
|
|
1083
|
-
);
|
|
1084
|
-
var COMPUTED_UV_BOUNDARY_EPSILON = Number.EPSILON * 16;
|
|
1085
|
-
function freezeBarrelDistortionMapping(mapping) {
|
|
1086
|
-
const camera = mapping.camera;
|
|
1087
|
-
return Object.freeze({
|
|
1088
|
-
...mapping,
|
|
1089
|
-
...camera === void 0 ? {} : {
|
|
1090
|
-
camera: Object.freeze({
|
|
1091
|
-
projection: camera.projection,
|
|
1092
|
-
far: camera.far,
|
|
1093
|
-
viewMatrix: Object.freeze(Array.from(camera.viewMatrix)),
|
|
1094
|
-
projectionMatrix: Object.freeze(Array.from(camera.projectionMatrix))
|
|
1095
|
-
})
|
|
1096
|
-
}
|
|
1097
|
-
});
|
|
1098
|
-
}
|
|
1099
|
-
function attachBarrelDistortionCameraFrame(mapping, camera) {
|
|
1100
|
-
return freezeBarrelDistortionMapping({
|
|
1101
|
-
...mapping,
|
|
1102
|
-
camera: {
|
|
1103
|
-
projection: camera.projection,
|
|
1104
|
-
far: camera.far,
|
|
1105
|
-
viewMatrix: camera.viewMatrix,
|
|
1106
|
-
projectionMatrix: camera.projectionMatrix
|
|
1107
|
-
}
|
|
1108
|
-
});
|
|
1109
|
-
}
|
|
1110
|
-
function invalidExtent(field, value) {
|
|
1111
|
-
return new BarrelDistortionInvalidParameterError({
|
|
1112
|
-
field,
|
|
1113
|
-
value,
|
|
1114
|
-
expected: "finite and greater than 0"
|
|
1115
|
-
});
|
|
1116
|
-
}
|
|
1117
|
-
function createBarrelDistortionMapping(width, height, input) {
|
|
1118
|
-
if (!Number.isFinite(width) || width <= 0) return err(invalidExtent("width", width));
|
|
1119
|
-
if (!Number.isFinite(height) || height <= 0) return err(invalidExtent("height", height));
|
|
1120
|
-
const parameters = validateBarrelDistortionParameters(input);
|
|
1121
|
-
if (!parameters.ok) return parameters;
|
|
1122
|
-
const { strength, centerX, centerY } = parameters.value;
|
|
1123
|
-
const aspect = width / height;
|
|
1124
|
-
const radiusSquared = 4 * (aspect * aspect * Math.max(centerX, 1 - centerX) ** 2 + Math.max(centerY, 1 - centerY) ** 2);
|
|
1125
|
-
return ok(
|
|
1126
|
-
Object.freeze({
|
|
1127
|
-
width,
|
|
1128
|
-
height,
|
|
1129
|
-
aspect,
|
|
1130
|
-
strength,
|
|
1131
|
-
centerX,
|
|
1132
|
-
centerY,
|
|
1133
|
-
radiusSquared
|
|
1134
|
-
})
|
|
1135
|
-
);
|
|
1136
|
-
}
|
|
1137
|
-
function displayToSceneScale(mapping, ux, uy) {
|
|
1138
|
-
const px = 2 * mapping.aspect * (ux - mapping.centerX);
|
|
1139
|
-
const py = 2 * (uy - mapping.centerY);
|
|
1140
|
-
const t = (px * px + py * py) / mapping.radiusSquared;
|
|
1141
|
-
return (1 - mapping.strength) / (1 - mapping.strength * t);
|
|
1142
|
-
}
|
|
1143
|
-
function normalizeComputedUv(out, x, y) {
|
|
1144
|
-
if (!Number.isFinite(x) || !Number.isFinite(y)) return false;
|
|
1145
|
-
if (x < -COMPUTED_UV_BOUNDARY_EPSILON || x > 1 + COMPUTED_UV_BOUNDARY_EPSILON || y < -COMPUTED_UV_BOUNDARY_EPSILON || y > 1 + COMPUTED_UV_BOUNDARY_EPSILON) {
|
|
1146
|
-
return false;
|
|
1147
|
-
}
|
|
1148
|
-
out.x = Math.min(1, Math.max(0, x));
|
|
1149
|
-
out.y = Math.min(1, Math.max(0, y));
|
|
1150
|
-
return true;
|
|
1151
|
-
}
|
|
1152
|
-
function mapDisplayUvToSceneUv(out, mapping, ux, uy) {
|
|
1153
|
-
if (!Number.isFinite(ux) || !Number.isFinite(uy) || ux < 0 || ux > 1 || uy < 0 || uy > 1)
|
|
1154
|
-
return false;
|
|
1155
|
-
if (mapping.strength === 0) {
|
|
1156
|
-
out.x = ux;
|
|
1157
|
-
out.y = uy;
|
|
1158
|
-
return ux >= 0 && ux <= 1 && uy >= 0 && uy <= 1;
|
|
1159
|
-
}
|
|
1160
|
-
const scale = displayToSceneScale(mapping, ux, uy);
|
|
1161
|
-
return normalizeComputedUv(
|
|
1162
|
-
out,
|
|
1163
|
-
mapping.centerX + (ux - mapping.centerX) * scale,
|
|
1164
|
-
mapping.centerY + (uy - mapping.centerY) * scale
|
|
1165
|
-
);
|
|
1166
|
-
}
|
|
1167
|
-
function mapSceneUvToDisplayUv(out, mapping, ux, uy) {
|
|
1168
|
-
if (!Number.isFinite(ux) || !Number.isFinite(uy) || ux < 0 || ux > 1 || uy < 0 || uy > 1)
|
|
1169
|
-
return false;
|
|
1170
|
-
if (mapping.strength === 0) {
|
|
1171
|
-
out.x = ux;
|
|
1172
|
-
out.y = uy;
|
|
1173
|
-
return ux >= 0 && ux <= 1 && uy >= 0 && uy <= 1;
|
|
1174
|
-
}
|
|
1175
|
-
const px = 2 * mapping.aspect * (ux - mapping.centerX);
|
|
1176
|
-
const py = 2 * (uy - mapping.centerY);
|
|
1177
|
-
const sourceRadius = Math.hypot(px, py);
|
|
1178
|
-
if (sourceRadius === 0) {
|
|
1179
|
-
out.x = mapping.centerX;
|
|
1180
|
-
out.y = mapping.centerY;
|
|
1181
|
-
return true;
|
|
1182
|
-
}
|
|
1183
|
-
const discriminant = (1 - mapping.strength) ** 2 + 4 * mapping.strength * sourceRadius * sourceRadius / mapping.radiusSquared;
|
|
1184
|
-
const displayRadius = 2 * sourceRadius / (1 - mapping.strength + Math.sqrt(Math.max(0, discriminant)));
|
|
1185
|
-
const scale = displayRadius / sourceRadius;
|
|
1186
|
-
return normalizeComputedUv(
|
|
1187
|
-
out,
|
|
1188
|
-
mapping.centerX + (ux - mapping.centerX) * scale,
|
|
1189
|
-
mapping.centerY + (uy - mapping.centerY) * scale
|
|
1190
|
-
);
|
|
1191
|
-
}
|
|
1192
|
-
function validPixel(point) {
|
|
1193
|
-
return Number.isFinite(point.x) && Number.isFinite(point.y);
|
|
1194
|
-
}
|
|
1195
|
-
function mapDisplayToScene(out, mapping, displayX, displayY) {
|
|
1196
|
-
if (!Number.isFinite(displayX) || !Number.isFinite(displayY)) return false;
|
|
1197
|
-
if (displayX < 0 || displayX > mapping.width || displayY < 0 || displayY > mapping.height) {
|
|
1198
|
-
return false;
|
|
1199
|
-
}
|
|
1200
|
-
const scene = { x: 0, y: 0 };
|
|
1201
|
-
if (!mapDisplayUvToSceneUv(scene, mapping, displayX / mapping.width, displayY / mapping.height)) {
|
|
1202
|
-
return false;
|
|
1203
|
-
}
|
|
1204
|
-
out.x = scene.x * mapping.width;
|
|
1205
|
-
out.y = scene.y * mapping.height;
|
|
1206
|
-
return validPixel(out);
|
|
1207
|
-
}
|
|
1208
|
-
function mapSceneToDisplay(out, mapping, sceneX, sceneY) {
|
|
1209
|
-
if (!Number.isFinite(sceneX) || !Number.isFinite(sceneY)) return false;
|
|
1210
|
-
if (sceneX < 0 || sceneX > mapping.width || sceneY < 0 || sceneY > mapping.height) {
|
|
1211
|
-
return false;
|
|
1212
|
-
}
|
|
1213
|
-
const display = { x: 0, y: 0 };
|
|
1214
|
-
if (!mapSceneUvToDisplayUv(display, mapping, sceneX / mapping.width, sceneY / mapping.height)) {
|
|
1215
|
-
return false;
|
|
1216
|
-
}
|
|
1217
|
-
out.x = display.x * mapping.width;
|
|
1218
|
-
out.y = display.y * mapping.height;
|
|
1219
|
-
return validPixel(out);
|
|
1220
|
-
}
|
|
1221
|
-
|
|
1222
|
-
// src/errors/cloud.ts
|
|
1223
|
-
var CloudLayerInvalidParameterError = class extends Error {
|
|
1224
|
-
code = "cloud-layer-invalid-parameter";
|
|
1225
|
-
expected;
|
|
1226
|
-
hint;
|
|
1227
|
-
detail;
|
|
1228
|
-
constructor(field, value, expected) {
|
|
1229
|
-
super(`CloudLayer.${field} is invalid`);
|
|
1230
|
-
this.name = "CloudLayerInvalidParameterError";
|
|
1231
|
-
this.expected = `CloudLayer.${field} must be ${expected}`;
|
|
1232
|
-
this.hint = `set CloudLayer.${field} to ${expected}`;
|
|
1233
|
-
this.detail = { field, value, expected };
|
|
1234
|
-
}
|
|
1235
|
-
};
|
|
1236
|
-
var CloudLayerOwnerConflictError = class extends Error {
|
|
1237
|
-
code = "cloud-layer-owner-conflict";
|
|
1238
|
-
expected = "at most one CloudLayer owns a World frame";
|
|
1239
|
-
hint = "remove additional CloudLayer owners before extraction";
|
|
1240
|
-
detail;
|
|
1241
|
-
constructor(count) {
|
|
1242
|
-
super(`CloudLayer owner cardinality is ${count}`);
|
|
1243
|
-
this.name = "CloudLayerOwnerConflictError";
|
|
1244
|
-
this.detail = { count };
|
|
1245
|
-
}
|
|
1246
|
-
};
|
|
1247
|
-
var CloudLayerCacheInvalidError = class extends Error {
|
|
1248
|
-
code = "cloud-layer-cache-invalid";
|
|
1249
|
-
expected = "the density cache payload matches its reconstructible source";
|
|
1250
|
-
hint = "discard the derived cache and rebuild it from CloudLayer source facts";
|
|
1251
|
-
detail;
|
|
1252
|
-
constructor(sourceKey, reason) {
|
|
1253
|
-
super(`CloudLayer cache is invalid: ${reason}`);
|
|
1254
|
-
this.name = "CloudLayerCacheInvalidError";
|
|
1255
|
-
this.detail = { sourceKey, reason };
|
|
1256
|
-
}
|
|
1257
|
-
};
|
|
1258
|
-
var CloudLayerCapabilityMissingError = class extends Error {
|
|
1259
|
-
code = "cloud-layer-capability-missing";
|
|
1260
|
-
expected = "the selected backend exposes the capability required by the cloud lane";
|
|
1261
|
-
hint = "inspect the capability report, disable the cloud lane on this backend, or retry on a backend with the required capability";
|
|
1262
|
-
detail;
|
|
1263
|
-
constructor(capability) {
|
|
1264
|
-
super(`CloudLayer capability is unavailable: ${capability}`);
|
|
1265
|
-
this.name = "CloudLayerCapabilityMissingError";
|
|
1266
|
-
this.detail = { capability };
|
|
1267
|
-
}
|
|
1268
|
-
};
|
|
1269
|
-
var CloudLayerResourceFailureError = class extends Error {
|
|
1270
|
-
code = "cloud-layer-resource-failed";
|
|
1271
|
-
expected = "cloud resources are created, submitted and retired as one generation";
|
|
1272
|
-
hint = "keep the last-known-good cloud generation and retry after recovery";
|
|
1273
|
-
detail;
|
|
1274
|
-
constructor(detail) {
|
|
1275
|
-
super(`CloudLayer ${detail.stage} resource failed at generation ${detail.generation}`);
|
|
1276
|
-
this.name = "CloudLayerResourceFailureError";
|
|
1277
|
-
this.detail = detail;
|
|
1278
|
-
}
|
|
1279
|
-
};
|
|
1280
|
-
var CLOUD_QUALITY_PROFILES = Object.freeze({
|
|
1281
|
-
low: Object.freeze({
|
|
1282
|
-
// Preserve low-profile ray counts while keeping separate puffs from
|
|
1283
|
-
// collapsing into one bilinear cache smear.
|
|
1284
|
-
cacheResolution: 32,
|
|
1285
|
-
viewSteps: 40,
|
|
1286
|
-
shadowSteps: 12,
|
|
1287
|
-
historyWeight: 0.82,
|
|
1288
|
-
viewDistance: 1600
|
|
1289
|
-
}),
|
|
1290
|
-
medium: Object.freeze({
|
|
1291
|
-
cacheResolution: 40,
|
|
1292
|
-
viewSteps: 64,
|
|
1293
|
-
shadowSteps: 20,
|
|
1294
|
-
historyWeight: 0.9,
|
|
1295
|
-
viewDistance: 2400
|
|
1296
|
-
}),
|
|
1297
|
-
high: Object.freeze({
|
|
1298
|
-
cacheResolution: 64,
|
|
1299
|
-
viewSteps: 64,
|
|
1300
|
-
shadowSteps: 32,
|
|
1301
|
-
historyWeight: 0.94,
|
|
1302
|
-
viewDistance: 4e3
|
|
1303
|
-
})
|
|
1304
|
-
});
|
|
1305
|
-
function cloudShadowResolutionForQuality(qualityValue) {
|
|
1306
|
-
return CLOUD_QUALITY_PROFILES[qualityValue].cacheResolution * 4;
|
|
1307
|
-
}
|
|
1308
|
-
function cloudViewDistanceForQuality(qualityValue) {
|
|
1309
|
-
return CLOUD_QUALITY_PROFILES[qualityValue].viewDistance;
|
|
1310
|
-
}
|
|
1311
|
-
var CLOUD_EXTINCTION_COEFFICIENT = 0.03;
|
|
1312
|
-
var DEFAULT_CLOUD_LAYER = Object.freeze({
|
|
1313
|
-
seed: 1337,
|
|
1314
|
-
baseHeight: 120,
|
|
1315
|
-
thickness: 80,
|
|
1316
|
-
scale: 4e-3,
|
|
1317
|
-
coverage: 0.48,
|
|
1318
|
-
density: 1,
|
|
1319
|
-
wind: Object.freeze([8, 0, 2]),
|
|
1320
|
-
quality: "medium",
|
|
1321
|
-
shadowRange: 512
|
|
1322
|
-
});
|
|
1323
|
-
function invalid3(field, value, expected) {
|
|
1324
|
-
return err(new CloudLayerInvalidParameterError(field, value, expected));
|
|
1325
|
-
}
|
|
1326
|
-
function finiteRange(field, value, min, max = Number.POSITIVE_INFINITY) {
|
|
1327
|
-
if (typeof value !== "number" || !Number.isFinite(value) || value < min || value > max) {
|
|
1328
|
-
const expected = Number.isFinite(max) ? `finite and in [${min}, ${max}]` : `finite and >= ${min}`;
|
|
1329
|
-
return invalid3(field, value, expected);
|
|
1330
|
-
}
|
|
1331
|
-
return ok(value);
|
|
1332
|
-
}
|
|
1333
|
-
function quality(value) {
|
|
1334
|
-
if (typeof value === "string" && (value === "low" || value === "medium" || value === "high")) {
|
|
1335
|
-
return ok(value);
|
|
1336
|
-
}
|
|
1337
|
-
if (typeof value === "number") {
|
|
1338
|
-
const resolved = cloudQualityFromF32(value);
|
|
1339
|
-
if (resolved !== void 0) return ok(resolved);
|
|
1340
|
-
}
|
|
1341
|
-
return invalid3(
|
|
1342
|
-
"quality",
|
|
1343
|
-
value,
|
|
1344
|
-
`one of low, medium, high (codes ${CloudQualityValue.low}, ${CloudQualityValue.medium}, ${CloudQualityValue.high})`
|
|
1345
|
-
);
|
|
1346
|
-
}
|
|
1347
|
-
function wind(value) {
|
|
1348
|
-
if (value === void 0 || value === null || typeof value !== "object") {
|
|
1349
|
-
return invalid3("wind", value, "three finite world-space components");
|
|
1350
|
-
}
|
|
1351
|
-
const source = value;
|
|
1352
|
-
if (source.length !== 3) return invalid3("wind", value, "three finite world-space components");
|
|
1353
|
-
const result = [
|
|
1354
|
-
source[0] ?? Number.NaN,
|
|
1355
|
-
source[1] ?? Number.NaN,
|
|
1356
|
-
source[2] ?? Number.NaN
|
|
1357
|
-
];
|
|
1358
|
-
if (result.some((entry) => !Number.isFinite(entry) || Math.abs(entry) > 1e3)) {
|
|
1359
|
-
return invalid3("wind", value, "three finite components in [-1000, 1000]");
|
|
1360
|
-
}
|
|
1361
|
-
return ok(Object.freeze(result));
|
|
1362
|
-
}
|
|
1363
|
-
function validateCloudLayer(input) {
|
|
1364
|
-
const value = input ?? {};
|
|
1365
|
-
const seed = value.seed ?? DEFAULT_CLOUD_LAYER.seed;
|
|
1366
|
-
if (typeof seed !== "number" || !Number.isInteger(seed) || seed < 0 || seed > 4294967295) {
|
|
1367
|
-
return invalid3("seed", seed, "an integer in [0, 4294967295]");
|
|
1368
|
-
}
|
|
1369
|
-
const baseHeight = finiteRange(
|
|
1370
|
-
"baseHeight",
|
|
1371
|
-
value.baseHeight ?? DEFAULT_CLOUD_LAYER.baseHeight,
|
|
1372
|
-
-1e5,
|
|
1373
|
-
1e6
|
|
1374
|
-
);
|
|
1375
|
-
if (!baseHeight.ok) return baseHeight;
|
|
1376
|
-
const thickness = finiteRange(
|
|
1377
|
-
"thickness",
|
|
1378
|
-
value.thickness ?? DEFAULT_CLOUD_LAYER.thickness,
|
|
1379
|
-
1e-3,
|
|
1380
|
-
1e6
|
|
1381
|
-
);
|
|
1382
|
-
if (!thickness.ok) return thickness;
|
|
1383
|
-
const scale = finiteRange("scale", value.scale ?? DEFAULT_CLOUD_LAYER.scale, 1e-6, 10);
|
|
1384
|
-
if (!scale.ok) return scale;
|
|
1385
|
-
const coverage = finiteRange("coverage", value.coverage ?? DEFAULT_CLOUD_LAYER.coverage, 0, 1);
|
|
1386
|
-
if (!coverage.ok) return coverage;
|
|
1387
|
-
const density = finiteRange("density", value.density ?? DEFAULT_CLOUD_LAYER.density, 0, 32);
|
|
1388
|
-
if (!density.ok) return density;
|
|
1389
|
-
const resolvedWind = wind(value.wind ?? DEFAULT_CLOUD_LAYER.wind);
|
|
1390
|
-
if (!resolvedWind.ok) return resolvedWind;
|
|
1391
|
-
const resolvedQuality = quality(value.quality ?? DEFAULT_CLOUD_LAYER.quality);
|
|
1392
|
-
if (!resolvedQuality.ok) return resolvedQuality;
|
|
1393
|
-
const shadowRange = finiteRange(
|
|
1394
|
-
"shadowRange",
|
|
1395
|
-
value.shadowRange ?? DEFAULT_CLOUD_LAYER.shadowRange,
|
|
1396
|
-
1e-3,
|
|
1397
|
-
1e7
|
|
1398
|
-
);
|
|
1399
|
-
if (!shadowRange.ok) return shadowRange;
|
|
1400
|
-
return ok(
|
|
1401
|
-
Object.freeze({
|
|
1402
|
-
seed,
|
|
1403
|
-
baseHeight: baseHeight.value,
|
|
1404
|
-
thickness: thickness.value,
|
|
1405
|
-
scale: scale.value,
|
|
1406
|
-
coverage: coverage.value,
|
|
1407
|
-
density: density.value,
|
|
1408
|
-
wind: resolvedWind.value,
|
|
1409
|
-
quality: resolvedQuality.value,
|
|
1410
|
-
shadowRange: shadowRange.value
|
|
1411
|
-
})
|
|
1412
|
-
);
|
|
1413
|
-
}
|
|
1414
|
-
function cloudLayerSourceKey(params) {
|
|
1415
|
-
return [
|
|
1416
|
-
"cloud-layer-v1",
|
|
1417
|
-
params.seed,
|
|
1418
|
-
params.baseHeight,
|
|
1419
|
-
params.thickness,
|
|
1420
|
-
params.scale,
|
|
1421
|
-
params.coverage,
|
|
1422
|
-
params.density,
|
|
1423
|
-
params.wind[0],
|
|
1424
|
-
params.wind[1],
|
|
1425
|
-
params.wind[2],
|
|
1426
|
-
params.quality,
|
|
1427
|
-
params.shadowRange
|
|
1428
|
-
].join(":");
|
|
1429
|
-
}
|
|
1430
|
-
function cloudLayerFormationKey(params) {
|
|
1431
|
-
return [
|
|
1432
|
-
"cloud-formation-v5",
|
|
1433
|
-
params.seed,
|
|
1434
|
-
params.baseHeight,
|
|
1435
|
-
params.thickness,
|
|
1436
|
-
params.scale,
|
|
1437
|
-
params.quality
|
|
1438
|
-
].join(":");
|
|
1439
|
-
}
|
|
1440
|
-
var MAX_VOLUMETRIC_FOG_OWNERS = 8;
|
|
1441
|
-
var VolumetricFogSamplingValue = { noise: 0, density: 1 };
|
|
1442
|
-
var VolumetricFog = defineComponent("VolumetricFog", {
|
|
1443
|
-
light: { type: "entity" },
|
|
1444
|
-
spotLight: { type: "entity" },
|
|
1445
|
-
density: { type: "shared<TextureAsset>", simulationTransient: true },
|
|
1446
|
-
boundsMin: { type: "array<f32, 3>" },
|
|
1447
|
-
boundsMax: { type: "array<f32, 3>" },
|
|
1448
|
-
extinction: { type: "array<f32, 3>" },
|
|
1449
|
-
albedo: { type: "array<f32, 3>" },
|
|
1450
|
-
emission: { type: "array<f32, 3>" },
|
|
1451
|
-
anisotropy: { type: "f32", default: 0 },
|
|
1452
|
-
maxDistance: { type: "f32", default: 100 },
|
|
1453
|
-
sampling: { type: "enum", labels: VolumetricFogSamplingValue, default: 0 }
|
|
1454
|
-
});
|
|
1455
|
-
function finiteVector(value) {
|
|
1456
|
-
return value.every(Number.isFinite);
|
|
1457
|
-
}
|
|
1458
|
-
function validBounds(bounds) {
|
|
1459
|
-
if (!finiteVector(bounds.min) || !finiteVector(bounds.max)) return false;
|
|
1460
|
-
return bounds.max.every((value, index) => value > (bounds.min[index] ?? value));
|
|
1461
|
-
}
|
|
1462
|
-
function validRange(value, min, max = Infinity) {
|
|
1463
|
-
return value.every((entry) => Number.isFinite(entry) && entry >= min && entry <= max);
|
|
1464
|
-
}
|
|
1465
|
-
function validateVolumetricFog(input) {
|
|
1466
|
-
if (input.density.shape.viewDimension !== "3d" || input.density.colorSpace === "srgb") {
|
|
1467
|
-
return err(
|
|
1468
|
-
new VolumeDensityShapeMismatchError(input.density.guid, input.density.shape.viewDimension)
|
|
1469
|
-
);
|
|
1470
|
-
}
|
|
1471
|
-
if (!validBounds(input.bounds)) return err(new VolumeInvalidBoundsError(input.bounds));
|
|
1472
|
-
if (!validRange(input.extinction, 0) || !validRange(input.albedo, 0, 1) || !validRange(input.emission, 0) || !Number.isFinite(input.anisotropy) || input.anisotropy <= -1 || input.anisotropy >= 1 || !Number.isFinite(input.maxDistance) || input.maxDistance <= 0 || input.sampling !== void 0 && input.sampling !== "noise" && input.sampling !== "density") {
|
|
1473
|
-
return err(new VolumeInvalidParametersError(input));
|
|
1474
|
-
}
|
|
1475
|
-
return ok(input);
|
|
1476
|
-
}
|
|
1477
|
-
|
|
1478
|
-
// src/environment/signature.ts
|
|
1479
|
-
function sorted(items) {
|
|
1480
|
-
return [...items].sort((left, right) => left.entityKey - right.entityKey);
|
|
1481
|
-
}
|
|
1482
|
-
function environmentSignature(input) {
|
|
1483
|
-
return JSON.stringify({
|
|
1484
|
-
environments: sorted(input.environments),
|
|
1485
|
-
fogs: sorted(input.fogs),
|
|
1486
|
-
suns: sorted(input.suns)
|
|
1487
|
-
});
|
|
1488
|
-
}
|
|
1489
|
-
function environmentOnlySignature(input) {
|
|
1490
|
-
return JSON.stringify({
|
|
1491
|
-
environments: sorted(input.environments),
|
|
1492
|
-
suns: sorted(input.suns)
|
|
1493
|
-
});
|
|
1494
|
-
}
|
|
1495
|
-
function fogOnlySignature(input) {
|
|
1496
|
-
return JSON.stringify({ fogs: sorted(input.fogs) });
|
|
1497
|
-
}
|
|
1498
|
-
function environmentFactSignatures(input) {
|
|
1499
|
-
return {
|
|
1500
|
-
environmentSignature: environmentOnlySignature(input),
|
|
1501
|
-
fogSignature: fogOnlySignature(input),
|
|
1502
|
-
signature: environmentSignature(input)
|
|
1503
|
-
};
|
|
1504
|
-
}
|
|
1505
|
-
|
|
1506
|
-
// src/extract/environment.ts
|
|
1507
|
-
var ATMOSPHERE_PARAMETER_RANGES = Object.freeze({
|
|
1508
|
-
turbidity: Object.freeze({ min: 1, max: 20 }),
|
|
1509
|
-
rayleigh: Object.freeze({ min: 0, max: Number.POSITIVE_INFINITY }),
|
|
1510
|
-
mieCoefficient: Object.freeze({ min: 0, max: Number.POSITIVE_INFINITY }),
|
|
1511
|
-
mieDirectionalG: Object.freeze({ min: 0, max: 0.999 }),
|
|
1512
|
-
sunAngularRadius: Object.freeze({ min: 0, max: Number.POSITIVE_INFINITY }),
|
|
1513
|
-
circumsolarStrength: Object.freeze({ min: 0, max: 4 }),
|
|
1514
|
-
circumsolarWidth: Object.freeze({ min: 0.25, max: 4 })
|
|
1515
|
-
});
|
|
1516
|
-
function validateFogParameters(candidate) {
|
|
1517
|
-
if (candidate.color.length !== 3) {
|
|
1518
|
-
return {
|
|
1519
|
-
field: "color",
|
|
1520
|
-
value: candidate.color.length,
|
|
1521
|
-
expected: "exactly three finite channels in [0, 1]"
|
|
1522
|
-
};
|
|
1523
|
-
}
|
|
1524
|
-
for (let index = 0; index < candidate.color.length; index += 1) {
|
|
1525
|
-
const value = candidate.color[index];
|
|
1526
|
-
if (value === void 0 || !Number.isFinite(value) || value < 0 || value > 1) {
|
|
1527
|
-
return {
|
|
1528
|
-
field: `color[${index}]`,
|
|
1529
|
-
value: value ?? Number.NaN,
|
|
1530
|
-
expected: "a finite number in [0, 1]"
|
|
1531
|
-
};
|
|
1532
|
-
}
|
|
1533
|
-
}
|
|
1534
|
-
if (!Number.isFinite(candidate.density) || candidate.density < 0) {
|
|
1535
|
-
return { field: "density", value: candidate.density, expected: "a finite number >= 0" };
|
|
1536
|
-
}
|
|
1537
|
-
if (!Number.isFinite(candidate.heightFalloff) || candidate.heightFalloff < 0) {
|
|
1538
|
-
return {
|
|
1539
|
-
field: "heightFalloff",
|
|
1540
|
-
value: candidate.heightFalloff,
|
|
1541
|
-
expected: "a finite number >= 0"
|
|
1542
|
-
};
|
|
1543
|
-
}
|
|
1544
|
-
if (!Number.isFinite(candidate.maxOpacity) || candidate.maxOpacity < 0 || candidate.maxOpacity > 1) {
|
|
1545
|
-
return {
|
|
1546
|
-
field: "maxOpacity",
|
|
1547
|
-
value: candidate.maxOpacity,
|
|
1548
|
-
expected: "a finite number in [0, 1]"
|
|
1549
|
-
};
|
|
1550
|
-
}
|
|
1551
|
-
return void 0;
|
|
1552
|
-
}
|
|
1553
|
-
function validateAtmosphereParameters(parameters) {
|
|
1554
|
-
for (const field of Object.keys(ATMOSPHERE_PARAMETER_RANGES)) {
|
|
1555
|
-
const value = parameters[field];
|
|
1556
|
-
const range = ATMOSPHERE_PARAMETER_RANGES[field];
|
|
1557
|
-
if (!Number.isFinite(value) || value < range.min || value > range.max) {
|
|
1558
|
-
return new AtmosphereInvalidParameterError(field, value, range);
|
|
1559
|
-
}
|
|
1560
|
-
}
|
|
1561
|
-
return void 0;
|
|
1562
|
-
}
|
|
1563
|
-
|
|
1564
|
-
// src/environment/frame.ts
|
|
1565
|
-
var SKYLIGHT_RECOVERY_FALLBACK = Object.freeze({
|
|
1566
|
-
kind: "skylight",
|
|
1567
|
-
active: false
|
|
1568
|
-
});
|
|
1569
|
-
var EnvironmentSelectionParameterError = class extends Error {
|
|
1570
|
-
code = "environment-selection-invalid";
|
|
1571
|
-
expected;
|
|
1572
|
-
hint;
|
|
1573
|
-
detail;
|
|
1574
|
-
constructor(field, value, expected) {
|
|
1575
|
-
super(`environment selection field ${field} is invalid`);
|
|
1576
|
-
this.name = "EnvironmentSelectionParameterError";
|
|
1577
|
-
this.expected = expected;
|
|
1578
|
-
this.hint = `set ${field} to a finite value satisfying ${expected}`;
|
|
1579
|
-
this.detail = { field, value };
|
|
1580
|
-
}
|
|
1581
|
-
};
|
|
1582
|
-
var SunCardinalityError = class extends Error {
|
|
1583
|
-
code = "sun-cardinality";
|
|
1584
|
-
expected = "atmosphere has exactly one sun owner";
|
|
1585
|
-
hint = "add exactly one DirectionalLight sun for the atmosphere owner";
|
|
1586
|
-
detail;
|
|
1587
|
-
constructor(value) {
|
|
1588
|
-
super(`atmosphere sun cardinality is ${value}`);
|
|
1589
|
-
this.name = "SunCardinalityError";
|
|
1590
|
-
this.detail = { field: "sun", value };
|
|
1591
|
-
}
|
|
1592
|
-
};
|
|
1593
|
-
function freezeCandidate(candidate) {
|
|
1594
|
-
return Object.freeze(candidate);
|
|
1595
|
-
}
|
|
1596
|
-
function freezeFog(candidate) {
|
|
1597
|
-
return Object.freeze({
|
|
1598
|
-
...candidate,
|
|
1599
|
-
color: Object.freeze([...candidate.color])
|
|
1600
|
-
});
|
|
1601
|
-
}
|
|
1602
|
-
function selectEnvironment(input) {
|
|
1603
|
-
if (input.environments.length > 1) {
|
|
1604
|
-
return err(
|
|
1605
|
-
new EnvironmentSourceConflictError(
|
|
1606
|
-
[...input.environments].sort((left, right) => left.entityKey - right.entityKey).map(({ kind, entityKey, sourceKey }) => ({ kind, entityKey, sourceKey }))
|
|
1607
|
-
)
|
|
1608
|
-
);
|
|
1609
|
-
}
|
|
1610
|
-
if (input.fogs.length > 1) return err(new FogCardinalityError(input.fogs.length));
|
|
1611
|
-
const selectedFog = input.fogs[0];
|
|
1612
|
-
if (selectedFog !== void 0) {
|
|
1613
|
-
const issue = validateFogParameters(selectedFog);
|
|
1614
|
-
if (issue !== void 0) {
|
|
1615
|
-
return err(new EnvironmentSelectionParameterError(issue.field, issue.value, issue.expected));
|
|
1616
|
-
}
|
|
1617
|
-
}
|
|
1618
|
-
const selected = input.environments[0];
|
|
1619
|
-
if (selected?.kind === "atmosphere") {
|
|
1620
|
-
const invalid5 = validateAtmosphereParameters(selected.atmosphere);
|
|
1621
|
-
if (invalid5 !== void 0) return err(invalid5);
|
|
1622
|
-
}
|
|
1623
|
-
if (selected?.kind === "atmosphere" && input.suns.length !== 1) {
|
|
1624
|
-
return err(new SunCardinalityError(input.suns.length));
|
|
1625
|
-
}
|
|
1626
|
-
const source = selected === void 0 ? { kind: "none" } : selected.kind === "atmosphere" ? {
|
|
1627
|
-
kind: "atmosphere",
|
|
1628
|
-
entityKey: selected.entityKey,
|
|
1629
|
-
sourceKey: selected.sourceKey,
|
|
1630
|
-
atmosphere: Object.freeze({ ...selected.atmosphere })
|
|
1631
|
-
} : {
|
|
1632
|
-
kind: "image",
|
|
1633
|
-
entityKey: selected.entityKey,
|
|
1634
|
-
sourceKey: selected.sourceKey
|
|
1635
|
-
};
|
|
1636
|
-
const sun = input.suns[0] === void 0 ? void 0 : freezeCandidate({ ...input.suns[0] });
|
|
1637
|
-
const fog = selectedFog === void 0 ? void 0 : freezeFog(selectedFog);
|
|
1638
|
-
const signatureInput = {
|
|
1639
|
-
environments: selected === void 0 ? [] : [selected],
|
|
1640
|
-
fogs: selectedFog === void 0 ? [] : [selectedFog],
|
|
1641
|
-
suns: input.suns
|
|
1642
|
-
};
|
|
1643
|
-
const signatures = environmentFactSignatures(signatureInput);
|
|
1644
|
-
const result = {
|
|
1645
|
-
source: Object.freeze(source),
|
|
1646
|
-
fog,
|
|
1647
|
-
...signatures,
|
|
1648
|
-
revision: 0,
|
|
1649
|
-
sun
|
|
1650
|
-
};
|
|
1651
|
-
Object.defineProperty(result, "lane", { value: input.lane, enumerable: false });
|
|
1652
|
-
return ok(Object.freeze(result));
|
|
1653
|
-
}
|
|
1654
|
-
var DEPTH_OF_FIELD_PARAMS_BYTE_SIZE = 64;
|
|
1655
|
-
var MIN_F_STOP = Math.fround(0.7);
|
|
1656
|
-
var MAX_F_STOP = Math.fround(32);
|
|
1657
|
-
var MAX_LINEAR_DEPTH_RAW = Math.fround(1 - 2 ** -24);
|
|
1658
|
-
var DEFAULT_DEPTH_OF_FIELD_PARAMS = Object.freeze({
|
|
1659
|
-
focusDistance: 8,
|
|
1660
|
-
fStop: 2.8,
|
|
1661
|
-
sensorHeight: 0.024,
|
|
1662
|
-
maxRadiusPixels: 16,
|
|
1663
|
-
quality: "medium",
|
|
1664
|
-
blurSide: "both",
|
|
1665
|
-
focalLength: 0
|
|
1666
|
-
});
|
|
1667
|
-
function quantizeF32(value) {
|
|
1668
|
-
return Math.fround(value);
|
|
1669
|
-
}
|
|
1670
|
-
var DepthOfFieldValidationError = class extends Error {
|
|
1671
|
-
code;
|
|
1672
|
-
expected;
|
|
1673
|
-
hint;
|
|
1674
|
-
detail;
|
|
1675
|
-
constructor(code, detail, expected, hint) {
|
|
1676
|
-
super(`${code}: ${expected}`);
|
|
1677
|
-
this.name = "DepthOfFieldValidationError";
|
|
1678
|
-
this.code = code;
|
|
1679
|
-
this.expected = expected;
|
|
1680
|
-
this.hint = hint;
|
|
1681
|
-
this.detail = detail;
|
|
1682
|
-
}
|
|
1683
|
-
};
|
|
1684
|
-
function depthOfFieldRequestFailure(error) {
|
|
1685
|
-
return Object.freeze({
|
|
1686
|
-
code: error.code,
|
|
1687
|
-
detail: error.detail,
|
|
1688
|
-
expected: error.expected,
|
|
1689
|
-
hint: error.hint
|
|
1690
|
-
});
|
|
1691
|
-
}
|
|
1692
|
-
function resolveDepthOfFieldFrameParams(requested, requestFailure, accepted) {
|
|
1693
|
-
if (requested !== void 0) return requested;
|
|
1694
|
-
if (requestFailure === void 0 || requestFailure.code === "depth-of-field-orthographic-unsupported") {
|
|
1695
|
-
return void 0;
|
|
1696
|
-
}
|
|
1697
|
-
return accepted;
|
|
1698
|
-
}
|
|
1699
|
-
function invalid4(field, value, expected, bound) {
|
|
1700
|
-
return new DepthOfFieldValidationError(
|
|
1701
|
-
"depth-of-field-invalid-params",
|
|
1702
|
-
{ field, value, expected, ...bound === void 0 ? {} : { bound } },
|
|
1703
|
-
expected,
|
|
1704
|
-
`set ${field} to ${expected}`
|
|
1705
|
-
);
|
|
1706
|
-
}
|
|
1707
|
-
function focalLength(sensorHeight, fov) {
|
|
1708
|
-
return sensorHeight / (2 * Math.tan(fov / 2));
|
|
1709
|
-
}
|
|
1710
|
-
function opticalCocScale(params) {
|
|
1711
|
-
return params.focalLength / params.sensorHeight / (2 * params.fStop) * (params.focalLength / (params.focusDistance - params.focalLength));
|
|
1712
|
-
}
|
|
1713
|
-
function frameCocCoefficient(params, outputHeight) {
|
|
1714
|
-
return quantizeF32(quantizeF32(outputHeight) * opticalCocScale(params));
|
|
1715
|
-
}
|
|
1716
|
-
function resolveDepthOfFieldFrameValues(params, input) {
|
|
1717
|
-
const focusDistance = quantizeF32(params.focusDistance);
|
|
1718
|
-
const fStop = quantizeF32(params.fStop);
|
|
1719
|
-
const sensorHeight = quantizeF32(params.sensorHeight);
|
|
1720
|
-
const focal = quantizeF32(params.focalLength);
|
|
1721
|
-
const maxRadiusPixels = quantizeF32(params.maxRadiusPixels);
|
|
1722
|
-
const outputHeight = quantizeF32(input.outputHeight);
|
|
1723
|
-
const near = quantizeF32(input.near);
|
|
1724
|
-
const far = quantizeF32(input.far);
|
|
1725
|
-
const finitePositiveFields = [
|
|
1726
|
-
["focusDistance", focusDistance, params.focusDistance],
|
|
1727
|
-
["sensorHeight", sensorHeight, params.sensorHeight],
|
|
1728
|
-
["focalLength", focal, params.focalLength],
|
|
1729
|
-
["near", near, input.near],
|
|
1730
|
-
["far", far, input.far]
|
|
1731
|
-
];
|
|
1732
|
-
for (const [field, value, raw] of finitePositiveFields) {
|
|
1733
|
-
if (!Number.isFinite(value) || value <= 0) {
|
|
1734
|
-
return err(invalid4(field, raw, "a finite positive f32 value"));
|
|
1735
|
-
}
|
|
1736
|
-
}
|
|
1737
|
-
if (!Number.isFinite(fStop) || fStop < MIN_F_STOP || fStop > MAX_F_STOP) {
|
|
1738
|
-
return err(
|
|
1739
|
-
invalid4("fStop", params.fStop, "a finite f32 value in [0.7, 32]", [MIN_F_STOP, MAX_F_STOP])
|
|
1740
|
-
);
|
|
1741
|
-
}
|
|
1742
|
-
if (!Number.isFinite(maxRadiusPixels) || maxRadiusPixels < 0 || maxRadiusPixels > 32) {
|
|
1743
|
-
return err(
|
|
1744
|
-
invalid4("maxRadiusPixels", params.maxRadiusPixels, "a finite f32 value in [0, 32]", [0, 32])
|
|
1745
|
-
);
|
|
1746
|
-
}
|
|
1747
|
-
if (!Number.isFinite(outputHeight) || outputHeight <= 0) {
|
|
1748
|
-
return err(invalid4("outputHeight", input.outputHeight, "a finite positive f32 value"));
|
|
1749
|
-
}
|
|
1750
|
-
if (far <= near) {
|
|
1751
|
-
return err(invalid4("near/far", [input.near, input.far], "finite f32 near > 0 and far > near"));
|
|
1752
|
-
}
|
|
1753
|
-
if (focusDistance <= focal) {
|
|
1754
|
-
return err(invalid4("focusDistance", params.focusDistance, "greater than focalLength in f32"));
|
|
1755
|
-
}
|
|
1756
|
-
const depthRatio = quantizeF32(near / far);
|
|
1757
|
-
if (!Number.isFinite(depthRatio) || depthRatio <= 0) {
|
|
1758
|
-
return err(invalid4("near/far ratio", depthRatio, "a finite positive f32 value"));
|
|
1759
|
-
}
|
|
1760
|
-
for (const raw of [quantizeF32(2 ** -149), 0.5, MAX_LINEAR_DEPTH_RAW]) {
|
|
1761
|
-
const oneMinusRaw = quantizeF32(1 - raw);
|
|
1762
|
-
const weightedRatio = quantizeF32(raw * depthRatio);
|
|
1763
|
-
const denominator = quantizeF32(oneMinusRaw + weightedRatio);
|
|
1764
|
-
const distance = quantizeF32(near / denominator);
|
|
1765
|
-
if (!Number.isFinite(oneMinusRaw) || oneMinusRaw <= 0 || !Number.isFinite(weightedRatio) || !Number.isFinite(denominator) || denominator <= 0 || !Number.isFinite(distance) || distance <= 0) {
|
|
1766
|
-
return err(invalid4("linearDepth", distance, "finite positive f32 reconstruction"));
|
|
1767
|
-
}
|
|
1768
|
-
}
|
|
1769
|
-
const cocCoefficient = frameCocCoefficient(
|
|
1770
|
-
{
|
|
1771
|
-
focusDistance,
|
|
1772
|
-
fStop,
|
|
1773
|
-
sensorHeight,
|
|
1774
|
-
focalLength: focal
|
|
1775
|
-
},
|
|
1776
|
-
outputHeight
|
|
1777
|
-
);
|
|
1778
|
-
if (!Number.isFinite(cocCoefficient) || cocCoefficient <= 0) {
|
|
1779
|
-
return err(
|
|
1780
|
-
invalid4("cocCoefficient", cocCoefficient, "a finite positive value representable as f32")
|
|
1781
|
-
);
|
|
1782
|
-
}
|
|
1783
|
-
for (const [field, depth] of [
|
|
1784
|
-
["near", near],
|
|
1785
|
-
["far", far]
|
|
1786
|
-
]) {
|
|
1787
|
-
const focusOverDepth = quantizeF32(focusDistance / depth);
|
|
1788
|
-
const depthFactor = quantizeF32(1 - focusOverDepth);
|
|
1789
|
-
const radius = quantizeF32(cocCoefficient * depthFactor);
|
|
1790
|
-
if (!Number.isFinite(focusOverDepth) || !Number.isFinite(depthFactor) || !Number.isFinite(radius)) {
|
|
1791
|
-
return err(invalid4(`coc.${field}`, radius, "a finite value representable as f32"));
|
|
1792
|
-
}
|
|
1793
|
-
}
|
|
1794
|
-
return ok({
|
|
1795
|
-
focusDistance,
|
|
1796
|
-
fStop,
|
|
1797
|
-
sensorHeight,
|
|
1798
|
-
focalLength: focal,
|
|
1799
|
-
maxRadiusPixels,
|
|
1800
|
-
outputHeight,
|
|
1801
|
-
near,
|
|
1802
|
-
far,
|
|
1803
|
-
cocCoefficient
|
|
1804
|
-
});
|
|
1805
|
-
}
|
|
1806
|
-
function validateDepthOfFieldFrameParams(params, input) {
|
|
1807
|
-
const resolved = resolveDepthOfFieldFrameValues(params, input);
|
|
1808
|
-
return resolved.ok ? ok(void 0) : resolved;
|
|
1809
|
-
}
|
|
1810
|
-
function validateDepthOfFieldParams(input, camera) {
|
|
1811
|
-
if (camera?.projection === "orthographic") {
|
|
1812
|
-
return err(
|
|
1813
|
-
new DepthOfFieldValidationError(
|
|
1814
|
-
"depth-of-field-orthographic-unsupported",
|
|
1815
|
-
{ projection: "orthographic" },
|
|
1816
|
-
"DepthOfField requires a perspective Camera",
|
|
1817
|
-
"use a perspective Camera or remove the DepthOfField component"
|
|
1818
|
-
)
|
|
1819
|
-
);
|
|
1820
|
-
}
|
|
1821
|
-
const value = input ?? {};
|
|
1822
|
-
const focusDistance = quantizeF32(
|
|
1823
|
-
value.focusDistance ?? DEFAULT_DEPTH_OF_FIELD_PARAMS.focusDistance
|
|
1824
|
-
);
|
|
1825
|
-
const fStop = quantizeF32(value.fStop ?? DEFAULT_DEPTH_OF_FIELD_PARAMS.fStop);
|
|
1826
|
-
const sensorHeight = quantizeF32(
|
|
1827
|
-
value.sensorHeight ?? DEFAULT_DEPTH_OF_FIELD_PARAMS.sensorHeight
|
|
1828
|
-
);
|
|
1829
|
-
const maxRadiusPixels = quantizeF32(
|
|
1830
|
-
value.maxRadiusPixels ?? DEFAULT_DEPTH_OF_FIELD_PARAMS.maxRadiusPixels
|
|
1831
|
-
);
|
|
1832
|
-
const qualityValue = quantizeF32(value.quality ?? DepthOfFieldQualityValue.medium);
|
|
1833
|
-
const blurSideValue = quantizeF32(value.blurSide ?? DepthOfFieldSideValue.both);
|
|
1834
|
-
const quality2 = depthOfFieldQualityFromF32(qualityValue);
|
|
1835
|
-
const blurSide = depthOfFieldSideFromF32(blurSideValue);
|
|
1836
|
-
if (!Number.isFinite(focusDistance) || focusDistance <= 0) {
|
|
1837
|
-
return err(
|
|
1838
|
-
invalid4("focusDistance", value.focusDistance ?? focusDistance, "a finite positive f32 value")
|
|
1839
|
-
);
|
|
1840
|
-
}
|
|
1841
|
-
if (!Number.isFinite(fStop) || fStop < MIN_F_STOP || fStop > MAX_F_STOP) {
|
|
1842
|
-
return err(
|
|
1843
|
-
invalid4("fStop", value.fStop ?? fStop, "a finite f32 value in [0.7, 32]", [
|
|
1844
|
-
MIN_F_STOP,
|
|
1845
|
-
MAX_F_STOP
|
|
1846
|
-
])
|
|
1847
|
-
);
|
|
1848
|
-
}
|
|
1849
|
-
if (!Number.isFinite(sensorHeight) || sensorHeight <= 0) {
|
|
1850
|
-
return err(
|
|
1851
|
-
invalid4("sensorHeight", value.sensorHeight ?? sensorHeight, "a finite positive f32 value")
|
|
1852
|
-
);
|
|
1853
|
-
}
|
|
1854
|
-
if (!Number.isFinite(maxRadiusPixels) || maxRadiusPixels < 0 || maxRadiusPixels > 32) {
|
|
1855
|
-
return err(
|
|
1856
|
-
invalid4(
|
|
1857
|
-
"maxRadiusPixels",
|
|
1858
|
-
value.maxRadiusPixels ?? maxRadiusPixels,
|
|
1859
|
-
"a finite f32 value in [0, 32]",
|
|
1860
|
-
[0, 32]
|
|
1861
|
-
)
|
|
1862
|
-
);
|
|
1863
|
-
}
|
|
1864
|
-
if (quality2 === void 0) {
|
|
1865
|
-
return err(invalid4("quality", qualityValue, "DepthOfFieldQualityValue.low, medium, or high"));
|
|
1866
|
-
}
|
|
1867
|
-
if (blurSide === void 0) {
|
|
1868
|
-
return err(invalid4("blurSide", blurSideValue, "DepthOfFieldSideValue.both, near, or far"));
|
|
1869
|
-
}
|
|
1870
|
-
let focal = DEFAULT_DEPTH_OF_FIELD_PARAMS.focalLength;
|
|
1871
|
-
if (camera !== void 0) {
|
|
1872
|
-
const fov = quantizeF32(camera.fov);
|
|
1873
|
-
const near = quantizeF32(camera.near);
|
|
1874
|
-
const far = quantizeF32(camera.far);
|
|
1875
|
-
if (!Number.isFinite(fov) || fov <= 0 || fov >= Math.PI) {
|
|
1876
|
-
return err(invalid4("fov", camera.fov, "a finite f32 value in (0, PI)"));
|
|
1877
|
-
}
|
|
1878
|
-
if (!Number.isFinite(near) || !Number.isFinite(far) || near <= 0 || far <= near) {
|
|
1879
|
-
return err(
|
|
1880
|
-
invalid4("near/far", [camera.near, camera.far], "finite f32 near > 0 and far > near")
|
|
1881
|
-
);
|
|
1882
|
-
}
|
|
1883
|
-
focal = quantizeF32(focalLength(sensorHeight, fov));
|
|
1884
|
-
if (!Number.isFinite(focal) || focal <= 0) {
|
|
1885
|
-
return err(invalid4("focalLength", focal, "a finite positive f32 value"));
|
|
1886
|
-
}
|
|
1887
|
-
if (focusDistance < near || focusDistance > far) {
|
|
1888
|
-
return err(
|
|
1889
|
-
invalid4("focusDistance", focusDistance, `a value in [${near}, ${far}]`, [near, far])
|
|
1890
|
-
);
|
|
1891
|
-
}
|
|
1892
|
-
if (focusDistance <= focal) {
|
|
1893
|
-
return err(
|
|
1894
|
-
invalid4("focusDistance", focusDistance, `greater than focalLength in f32 (${focal})`)
|
|
1895
|
-
);
|
|
1896
|
-
}
|
|
1897
|
-
}
|
|
1898
|
-
return ok(
|
|
1899
|
-
Object.freeze({
|
|
1900
|
-
focusDistance,
|
|
1901
|
-
fStop,
|
|
1902
|
-
sensorHeight,
|
|
1903
|
-
maxRadiusPixels,
|
|
1904
|
-
quality: quality2,
|
|
1905
|
-
blurSide,
|
|
1906
|
-
focalLength: focal
|
|
1907
|
-
})
|
|
1908
|
-
);
|
|
1909
|
-
}
|
|
1910
|
-
function resolveDepthOfFieldParams(input, camera) {
|
|
1911
|
-
if (input === void 0) return ok(void 0);
|
|
1912
|
-
return validateDepthOfFieldParams(input, camera);
|
|
1913
|
-
}
|
|
1914
|
-
function depthOfFieldTapCount(quality2) {
|
|
1915
|
-
switch (quality2) {
|
|
1916
|
-
case "low":
|
|
1917
|
-
return 16;
|
|
1918
|
-
case "medium":
|
|
1919
|
-
return 32;
|
|
1920
|
-
case "high":
|
|
1921
|
-
return 64;
|
|
1922
|
-
}
|
|
1923
|
-
}
|
|
1924
|
-
function depthOfFieldSideCode(side) {
|
|
1925
|
-
switch (side) {
|
|
1926
|
-
case "both":
|
|
1927
|
-
return DepthOfFieldSideValue.both;
|
|
1928
|
-
case "near":
|
|
1929
|
-
return DepthOfFieldSideValue.near;
|
|
1930
|
-
case "far":
|
|
1931
|
-
return DepthOfFieldSideValue.far;
|
|
1932
|
-
}
|
|
1933
|
-
}
|
|
1934
|
-
function depthOfFieldQualityCode(quality2) {
|
|
1935
|
-
switch (quality2) {
|
|
1936
|
-
case "low":
|
|
1937
|
-
return DepthOfFieldQualityValue.low;
|
|
1938
|
-
case "medium":
|
|
1939
|
-
return DepthOfFieldQualityValue.medium;
|
|
1940
|
-
case "high":
|
|
1941
|
-
return DepthOfFieldQualityValue.high;
|
|
1942
|
-
}
|
|
1943
|
-
}
|
|
1944
|
-
function signedDepthOfFieldCoC(params, viewDepth, outputHeight) {
|
|
1945
|
-
if (!Number.isFinite(viewDepth) || viewDepth <= 0 || !Number.isFinite(outputHeight) || outputHeight <= 0 || !Number.isFinite(params.focalLength) || params.focalLength <= 0 || !Number.isFinite(params.sensorHeight) || params.sensorHeight <= 0 || !Number.isFinite(params.fStop) || params.fStop <= 0 || !Number.isFinite(params.focusDistance) || params.focusDistance <= params.focalLength) {
|
|
1946
|
-
return 0;
|
|
1947
|
-
}
|
|
1948
|
-
const focusDistance = quantizeF32(params.focusDistance);
|
|
1949
|
-
const depth = quantizeF32(viewDepth);
|
|
1950
|
-
const focalLength2 = quantizeF32(params.focalLength);
|
|
1951
|
-
const sensorHeight = quantizeF32(params.sensorHeight);
|
|
1952
|
-
const fStop = quantizeF32(params.fStop);
|
|
1953
|
-
const coefficient = frameCocCoefficient(
|
|
1954
|
-
{ focusDistance, focalLength: focalLength2, sensorHeight, fStop },
|
|
1955
|
-
outputHeight
|
|
1956
|
-
);
|
|
1957
|
-
const depthFactor = quantizeF32(1 - quantizeF32(focusDistance / depth));
|
|
1958
|
-
const radius = quantizeF32(coefficient * depthFactor);
|
|
1959
|
-
const limit = Number.isFinite(params.maxRadiusPixels) ? quantizeF32(params.maxRadiusPixels) : Number.POSITIVE_INFINITY;
|
|
1960
|
-
return Math.max(-limit, Math.min(limit, Number.isFinite(radius) ? radius : 0));
|
|
1961
|
-
}
|
|
1962
|
-
function packDepthOfFieldParams(params, input) {
|
|
1963
|
-
const frameValues = resolveDepthOfFieldFrameValues(params, input);
|
|
1964
|
-
if (!frameValues.ok) throw frameValues.error;
|
|
1965
|
-
const {
|
|
1966
|
-
focusDistance,
|
|
1967
|
-
fStop,
|
|
1968
|
-
sensorHeight,
|
|
1969
|
-
focalLength: focal,
|
|
1970
|
-
outputHeight,
|
|
1971
|
-
maxRadiusPixels,
|
|
1972
|
-
near,
|
|
1973
|
-
far,
|
|
1974
|
-
cocCoefficient
|
|
1975
|
-
} = frameValues.value;
|
|
1976
|
-
const payload = new Float32Array(DEPTH_OF_FIELD_PARAMS_BYTE_SIZE / 4);
|
|
1977
|
-
payload.set([
|
|
1978
|
-
focusDistance,
|
|
1979
|
-
fStop,
|
|
1980
|
-
sensorHeight,
|
|
1981
|
-
focal,
|
|
1982
|
-
outputHeight,
|
|
1983
|
-
maxRadiusPixels,
|
|
1984
|
-
depthOfFieldSideCode(params.blurSide),
|
|
1985
|
-
depthOfFieldQualityCode(params.quality),
|
|
1986
|
-
near,
|
|
1987
|
-
far,
|
|
1988
|
-
input.useTemporalDepth ? 1 : 0,
|
|
1989
|
-
0,
|
|
1990
|
-
// row2.w reserved
|
|
1991
|
-
cocCoefficient,
|
|
1992
|
-
// row3.x / WGSL reserved.x
|
|
1993
|
-
0,
|
|
1994
|
-
0,
|
|
1995
|
-
0
|
|
1996
|
-
]);
|
|
1997
|
-
return new Uint8Array(payload.buffer);
|
|
1998
|
-
}
|
|
1999
|
-
function hasVolumetricFogCapability(caps, shaders) {
|
|
2000
|
-
return caps.compute && caps.storageTexture && shaders !== void 0;
|
|
2001
|
-
}
|
|
2002
|
-
function resolveVolumetricFogLightPair(world, point, spot) {
|
|
2003
|
-
const expected = "PointLight + SpotLight in the same World";
|
|
2004
|
-
if (!world.get(point, Entity).ok || !world.get(spot, Entity).ok) {
|
|
2005
|
-
return {
|
|
2006
|
-
status: "unresolved",
|
|
2007
|
-
reason: "missing-entity",
|
|
2008
|
-
point,
|
|
2009
|
-
spot,
|
|
2010
|
-
expected,
|
|
2011
|
-
actual: "point or spot entity is absent from this World",
|
|
2012
|
-
hint: "assign two live entities from the same World and retry"
|
|
2013
|
-
};
|
|
2014
|
-
}
|
|
2015
|
-
if (point === spot) {
|
|
2016
|
-
return {
|
|
2017
|
-
status: "unresolved",
|
|
2018
|
-
reason: "same-entity",
|
|
2019
|
-
point,
|
|
2020
|
-
spot,
|
|
2021
|
-
expected,
|
|
2022
|
-
actual: "PointLight and SpotLight share one EntityHandle",
|
|
2023
|
-
hint: "spawn PointLight and SpotLight on two different entities"
|
|
2024
|
-
};
|
|
2025
|
-
}
|
|
2026
|
-
const pointValid = world.hasComponent(point, PointLight) && world.hasComponent(point, Transform);
|
|
2027
|
-
const spotValid = world.hasComponent(spot, SpotLight) && world.hasComponent(spot, Transform);
|
|
2028
|
-
if (!pointValid || !spotValid) {
|
|
2029
|
-
return {
|
|
2030
|
-
status: "unresolved",
|
|
2031
|
-
reason: "wrong-component",
|
|
2032
|
-
point,
|
|
2033
|
-
spot,
|
|
2034
|
-
expected,
|
|
2035
|
-
actual: `pointValid=${pointValid}; spotValid=${spotValid}`,
|
|
2036
|
-
hint: "attach PointLight and SpotLight with Transform to separate same-World entities"
|
|
2037
|
-
};
|
|
2038
|
-
}
|
|
2039
|
-
return { status: "available", mode: "point-spot", point, spot };
|
|
2040
|
-
}
|
|
2041
|
-
function resolveSelectedVolumetricLight(world, entity) {
|
|
2042
|
-
const expected = "DirectionalLight | PointLight | SpotLight";
|
|
2043
|
-
if (!world.get(entity, Entity).ok) {
|
|
2044
|
-
return {
|
|
2045
|
-
status: "unresolved",
|
|
2046
|
-
reason: "missing-entity",
|
|
2047
|
-
entity,
|
|
2048
|
-
expected,
|
|
2049
|
-
actual: "missing or foreign World entity",
|
|
2050
|
-
hint: "assign VolumetricFog.light to a live DirectionalLight or SpotLight in this World"
|
|
2051
|
-
};
|
|
2052
|
-
}
|
|
2053
|
-
const hasDirectional = world.hasComponent(entity, DirectionalLight);
|
|
2054
|
-
const hasSpot = world.hasComponent(entity, SpotLight);
|
|
2055
|
-
if (hasDirectional && hasSpot) {
|
|
2056
|
-
return {
|
|
2057
|
-
status: "unresolved",
|
|
2058
|
-
reason: "ambiguous",
|
|
2059
|
-
entity,
|
|
2060
|
-
expected,
|
|
2061
|
-
actual: "DirectionalLight + SpotLight",
|
|
2062
|
-
hint: "remove one mutually exclusive light component from the selected entity"
|
|
2063
|
-
};
|
|
2064
|
-
}
|
|
2065
|
-
if (hasDirectional) return { status: "available", entity, kind: "directional" };
|
|
2066
|
-
if (world.hasComponent(entity, PointLight) && world.hasComponent(entity, Transform)) {
|
|
2067
|
-
return { status: "available", entity, kind: "point" };
|
|
2068
|
-
}
|
|
2069
|
-
if (hasSpot && world.hasComponent(entity, Transform)) {
|
|
2070
|
-
return { status: "available", entity, kind: "spot" };
|
|
2071
|
-
}
|
|
2072
|
-
const actual = hasSpot ? "SpotLight without Transform" : world.hasComponent(entity, PointLight) ? "PointLight" : "other component";
|
|
2073
|
-
return {
|
|
2074
|
-
status: "unresolved",
|
|
2075
|
-
reason: "wrong-component",
|
|
2076
|
-
entity,
|
|
2077
|
-
expected,
|
|
2078
|
-
actual,
|
|
2079
|
-
hint: "add exactly one supported light component and a Transform for PointLight or SpotLight in the same World"
|
|
2080
|
-
};
|
|
2081
|
-
}
|
|
2082
|
-
function resolveIntegratedVolumeConsumer(resource, consumer) {
|
|
2083
|
-
return { consumer, resource };
|
|
2084
|
-
}
|
|
2085
|
-
var FACE_ORIENTATION = [
|
|
2086
|
-
{ direction: [1, 0, 0], up: [0, 1, 0] },
|
|
2087
|
-
{ direction: [-1, 0, 0], up: [0, 1, 0] },
|
|
2088
|
-
{ direction: [0, 1, 0], up: [0, 0, -1] },
|
|
2089
|
-
{ direction: [0, -1, 0], up: [0, 0, 1] },
|
|
2090
|
-
{ direction: [0, 0, 1], up: [0, 1, 0] },
|
|
2091
|
-
{ direction: [0, 0, -1], up: [0, 1, 0] }
|
|
2092
|
-
];
|
|
2093
|
-
function assertRange(near, far) {
|
|
2094
|
-
if (!Number.isFinite(near) || near <= 0 || !Number.isFinite(far) || far <= near) {
|
|
2095
|
-
throw new RangeError("CubeCamera requires finite near > 0 and far > near.");
|
|
2096
|
-
}
|
|
2097
|
-
}
|
|
2098
|
-
function buildCubeCameraFaceViews(input) {
|
|
2099
|
-
assertRange(input.near, input.far);
|
|
2100
|
-
const views = [];
|
|
2101
|
-
for (const [index, face] of CUBE_CAMERA_FACE_ORDER.entries()) {
|
|
2102
|
-
const orientation = FACE_ORIENTATION[index];
|
|
2103
|
-
if (orientation === void 0)
|
|
2104
|
-
throw new Error(`CubeCamera face orientation missing at ${index}`);
|
|
2105
|
-
const target = [
|
|
2106
|
-
(input.position[0] ?? 0) + orientation.direction[0],
|
|
2107
|
-
(input.position[1] ?? 0) + orientation.direction[1],
|
|
2108
|
-
(input.position[2] ?? 0) + orientation.direction[2]
|
|
2109
|
-
];
|
|
2110
|
-
const view = mat4.lookAt(mat4.create(), input.position, target, orientation.up);
|
|
2111
|
-
const projection = mat4.perspective(mat4.create(), Math.PI / 2, 1, input.near, input.far);
|
|
2112
|
-
const viewProjection = mat4.multiply(mat4.create(), projection, view);
|
|
2113
|
-
views.push({
|
|
2114
|
-
position: input.position,
|
|
2115
|
-
face,
|
|
2116
|
-
direction: orientation.direction,
|
|
2117
|
-
up: orientation.up,
|
|
2118
|
-
near: input.near,
|
|
2119
|
-
far: input.far,
|
|
2120
|
-
view,
|
|
2121
|
-
projection,
|
|
2122
|
-
viewProjection
|
|
2123
|
-
});
|
|
2124
|
-
}
|
|
2125
|
-
return views;
|
|
2126
|
-
}
|
|
2127
|
-
|
|
2128
|
-
// src/mesh-material-bindings.ts
|
|
2129
|
-
var EMPTY_RESIDENCY = Object.freeze({
|
|
2130
|
-
readiness: "pending",
|
|
2131
|
-
samplers: Object.freeze([]),
|
|
2132
|
-
textures: Object.freeze([])
|
|
2133
|
-
});
|
|
2134
|
-
function projectMeshMaterialBindingObservation(input) {
|
|
2135
|
-
const residency = input.bindings.map((_, index) => {
|
|
2136
|
-
const value = input.residency?.[index] ?? EMPTY_RESIDENCY;
|
|
2137
|
-
return Object.freeze({
|
|
2138
|
-
...value,
|
|
2139
|
-
samplers: Object.freeze(value.samplers.map((sampler) => Object.freeze({ ...sampler }))),
|
|
2140
|
-
textures: Object.freeze(value.textures.map((texture) => Object.freeze({ ...texture }))),
|
|
2141
|
-
...value.preparationFailure === void 0 ? {} : {
|
|
2142
|
-
preparationFailure: Object.freeze({
|
|
2143
|
-
...value.preparationFailure,
|
|
2144
|
-
...value.preparationFailure.detail === void 0 ? {} : { detail: Object.freeze({ ...value.preparationFailure.detail }) }
|
|
2145
|
-
})
|
|
2146
|
-
}
|
|
2147
|
-
});
|
|
2148
|
-
});
|
|
2149
|
-
return {
|
|
2150
|
-
worldId: input.worldId,
|
|
2151
|
-
...input.worldIdentity === void 0 ? {} : { worldIdentity: input.worldIdentity },
|
|
2152
|
-
entityKey: input.entityKey,
|
|
2153
|
-
bindings: Object.freeze([...input.bindings]),
|
|
2154
|
-
diagnostics: Object.freeze([...input.diagnostics]),
|
|
2155
|
-
residency: Object.freeze(residency)
|
|
2156
|
-
};
|
|
2157
|
-
}
|
|
2158
|
-
function summarizeMeshMaterialBindings(observations) {
|
|
2159
|
-
let ready = 0;
|
|
2160
|
-
let pending = 0;
|
|
2161
|
-
let failed = 0;
|
|
2162
|
-
let lastKnownGood = 0;
|
|
2163
|
-
let textureCount = 0;
|
|
2164
|
-
let samplerCount = 0;
|
|
2165
|
-
for (const observation of observations) {
|
|
2166
|
-
for (const residency of observation.residency) {
|
|
2167
|
-
switch (residency.readiness) {
|
|
2168
|
-
case "ready":
|
|
2169
|
-
ready += 1;
|
|
2170
|
-
break;
|
|
2171
|
-
case "pending":
|
|
2172
|
-
pending += 1;
|
|
2173
|
-
break;
|
|
2174
|
-
case "failed":
|
|
2175
|
-
failed += 1;
|
|
2176
|
-
break;
|
|
2177
|
-
case "last-known-good":
|
|
2178
|
-
lastKnownGood += 1;
|
|
2179
|
-
break;
|
|
2180
|
-
}
|
|
2181
|
-
textureCount += residency.textures.length;
|
|
2182
|
-
samplerCount += residency.samplers.length;
|
|
2183
|
-
}
|
|
2184
|
-
}
|
|
2185
|
-
return {
|
|
2186
|
-
total: ready + pending + failed + lastKnownGood,
|
|
2187
|
-
ready,
|
|
2188
|
-
pending,
|
|
2189
|
-
failed,
|
|
2190
|
-
lastKnownGood,
|
|
2191
|
-
textureCount,
|
|
2192
|
-
samplerCount
|
|
2193
|
-
};
|
|
2194
|
-
}
|
|
2195
|
-
function resolveMeshMaterialBindings(mesh, rendererOverrides, deps) {
|
|
2196
|
-
const bindings = [];
|
|
2197
|
-
const diagnostics = [];
|
|
2198
|
-
if (!Array.isArray(mesh.materialSlots)) {
|
|
2199
|
-
return { ok: false, code: "mesh-material-slots-missing" };
|
|
2200
|
-
}
|
|
2201
|
-
if (rendererOverrides.length > mesh.materialSlots.length) {
|
|
2202
|
-
diagnostics.push({
|
|
2203
|
-
code: "mesh-renderer-material-override-overflow",
|
|
2204
|
-
slotIndex: mesh.materialSlots.length
|
|
2205
|
-
});
|
|
2206
|
-
}
|
|
2207
|
-
for (let slotIndex = 0; slotIndex < mesh.materialSlots.length; slotIndex++) {
|
|
2208
|
-
const override = rendererOverrides[slotIndex] ?? 0;
|
|
2209
|
-
if (override !== 0 && deps.isValidOverride(override)) {
|
|
2210
|
-
bindings.push({ handle: override, source: "renderer-override" });
|
|
2211
|
-
continue;
|
|
2212
|
-
}
|
|
2213
|
-
if (override !== 0) {
|
|
2214
|
-
diagnostics.push({
|
|
2215
|
-
code: "mesh-renderer-material-override-invalid",
|
|
2216
|
-
slotIndex,
|
|
2217
|
-
handle: override
|
|
2218
|
-
});
|
|
2219
|
-
}
|
|
2220
|
-
const declaredDefault = mesh.materialSlots[slotIndex]?.defaultMaterial;
|
|
2221
|
-
if (declaredDefault !== void 0) {
|
|
2222
|
-
const handle = deps.resolveMeshDefault(declaredDefault);
|
|
2223
|
-
if (handle === void 0) {
|
|
2224
|
-
return {
|
|
2225
|
-
ok: false,
|
|
2226
|
-
code: "mesh-default-material-not-ready",
|
|
2227
|
-
slotIndex,
|
|
2228
|
-
defaultMaterial: declaredDefault
|
|
2229
|
-
};
|
|
2230
|
-
}
|
|
2231
|
-
bindings.push({ handle, source: "mesh-default" });
|
|
2232
|
-
continue;
|
|
2233
|
-
}
|
|
2234
|
-
bindings.push({ handle: 0, source: "engine-default" });
|
|
2235
|
-
}
|
|
2236
|
-
return { ok: true, bindings, diagnostics };
|
|
2237
|
-
}
|
|
2238
|
-
function resolveVisibility(world, hierarchy = projectHierarchy(world)) {
|
|
2239
|
-
const query = world.query({ read: [Visibility] });
|
|
2240
|
-
const visitVisibilityRows = (visit) => {
|
|
2241
|
-
if (!query.ok) return;
|
|
2242
|
-
const spans = query.value.spans();
|
|
2243
|
-
if (spans.ok) {
|
|
2244
|
-
for (const span of spans.value) {
|
|
2245
|
-
const states = span.get(Visibility).state;
|
|
2246
|
-
for (let index = 0; index < span.length; index += 1) {
|
|
2247
|
-
visit(span.entities[index], states[index] ?? 0);
|
|
2248
|
-
}
|
|
2249
|
-
}
|
|
2250
|
-
return;
|
|
2251
|
-
}
|
|
2252
|
-
for (const row of query.value) {
|
|
2253
|
-
visit(row.entity, row.get(Visibility).state);
|
|
2254
|
-
}
|
|
2255
|
-
};
|
|
2256
|
-
let intentCount = 0;
|
|
2257
|
-
let hasAnyHiddenIntent = false;
|
|
2258
|
-
visitVisibilityRows((_entity, rawState) => {
|
|
2259
|
-
intentCount += 1;
|
|
2260
|
-
if (rawState === VisibilityStateValue.hidden) {
|
|
2261
|
-
hasAnyHiddenIntent = true;
|
|
2262
|
-
}
|
|
2263
|
-
});
|
|
2264
|
-
let resolveEntity;
|
|
2265
|
-
let hasIntent;
|
|
2266
|
-
const ensureResolver = () => {
|
|
2267
|
-
if (resolveEntity !== void 0) return;
|
|
2268
|
-
const intentByEntity = /* @__PURE__ */ new Map();
|
|
2269
|
-
visitVisibilityRows((entity, rawState) => {
|
|
2270
|
-
const intent = visibilityStateFromU32(rawState);
|
|
2271
|
-
if (intent !== void 0) {
|
|
2272
|
-
intentByEntity.set(entity, intent);
|
|
2273
|
-
}
|
|
2274
|
-
});
|
|
2275
|
-
hasIntent = (entity) => intentByEntity.has(entity);
|
|
2276
|
-
const resolved = /* @__PURE__ */ new Map();
|
|
2277
|
-
const resolving = /* @__PURE__ */ new Set();
|
|
2278
|
-
resolveEntity = (entity) => {
|
|
2279
|
-
const existing = resolved.get(entity);
|
|
2280
|
-
if (existing !== void 0) return existing;
|
|
2281
|
-
if (resolving.has(entity)) return void 0;
|
|
2282
|
-
const intent = intentByEntity.get(entity) ?? "inherited";
|
|
2283
|
-
resolving.add(entity);
|
|
2284
|
-
let result;
|
|
2285
|
-
if (intent === "hidden") {
|
|
2286
|
-
result = { intent, effective: "hidden", source: "self" };
|
|
2287
|
-
} else if (intent === "visible") {
|
|
2288
|
-
result = { intent, effective: "visible", source: "self" };
|
|
2289
|
-
} else {
|
|
2290
|
-
const parent = hierarchy.getParent(entity);
|
|
2291
|
-
const parentResult = parent === void 0 ? void 0 : resolveEntity?.(parent);
|
|
2292
|
-
result = parentResult === void 0 ? { intent, effective: "visible", source: "default" } : { intent, effective: parentResult.effective, source: "parent" };
|
|
2293
|
-
}
|
|
2294
|
-
resolving.delete(entity);
|
|
2295
|
-
resolved.set(entity, result);
|
|
2296
|
-
return result;
|
|
2297
|
-
};
|
|
2298
|
-
};
|
|
2299
|
-
const snapshot = {
|
|
2300
|
-
diagnostics: hierarchy.diagnostics,
|
|
2301
|
-
hasAnyIntent: intentCount > 0,
|
|
2302
|
-
hasAnyHiddenIntent,
|
|
2303
|
-
get(entity) {
|
|
2304
|
-
ensureResolver();
|
|
2305
|
-
return hasIntent?.(entity) ? resolveEntity?.(entity) : void 0;
|
|
2306
|
-
},
|
|
2307
|
-
effective(entity) {
|
|
2308
|
-
ensureResolver();
|
|
2309
|
-
return resolveEntity?.(entity)?.effective ?? "visible";
|
|
2310
|
-
}
|
|
2311
|
-
};
|
|
2312
|
-
return snapshot;
|
|
2313
|
-
}
|
|
2314
|
-
function selectCloudLayerFrame(candidates, worldTimeSeconds = 0, sunDirection = void 0, sunRadiance = void 0) {
|
|
2315
|
-
if (candidates.length === 0) return ok(void 0);
|
|
2316
|
-
if (candidates.length > 1) return err(new CloudLayerOwnerConflictError(candidates.length));
|
|
2317
|
-
const candidate = candidates[0];
|
|
2318
|
-
if (candidate === void 0) return ok(void 0);
|
|
2319
|
-
const validated = validateCloudLayer(candidate.data);
|
|
2320
|
-
if (!validated.ok) return validated;
|
|
2321
|
-
return ok(
|
|
2322
|
-
Object.freeze({
|
|
2323
|
-
status: "available",
|
|
2324
|
-
entityKey: candidate.entityKey,
|
|
2325
|
-
sourceKey: cloudLayerSourceKey(validated.value),
|
|
2326
|
-
params: validated.value,
|
|
2327
|
-
worldTimeSeconds: Number.isFinite(worldTimeSeconds) ? Math.max(0, worldTimeSeconds) : 0,
|
|
2328
|
-
sunDirection: sunDirection === void 0 ? void 0 : Object.freeze([...sunDirection]),
|
|
2329
|
-
sunRadiance: sunRadiance === void 0 ? void 0 : Object.freeze([...sunRadiance]),
|
|
2330
|
-
revision: 1
|
|
2331
|
-
})
|
|
2332
|
-
);
|
|
2333
|
-
}
|
|
2334
|
-
function extractCloudLayer(world) {
|
|
2335
|
-
const candidates = [];
|
|
2336
|
-
try {
|
|
2337
|
-
const query = world.query({ read: [CloudLayer] });
|
|
2338
|
-
if (!query.ok) return ok(void 0);
|
|
2339
|
-
for (const row of query.value)
|
|
2340
|
-
candidates.push({ entityKey: row.entity, data: row.get(CloudLayer) });
|
|
2341
|
-
} catch {
|
|
2342
|
-
return ok(void 0);
|
|
2343
|
-
}
|
|
2344
|
-
let sunDirection;
|
|
2345
|
-
let sunRadiance;
|
|
2346
|
-
try {
|
|
2347
|
-
const query = world.query({ read: [DirectionalLight] });
|
|
2348
|
-
if (query.ok) {
|
|
2349
|
-
for (const row of query.value) {
|
|
2350
|
-
const light = row.get(DirectionalLight);
|
|
2351
|
-
const intensity = Number.isFinite(light.intensity) ? Math.max(0, light.intensity) : 0;
|
|
2352
|
-
sunDirection = [
|
|
2353
|
-
-(light.direction[0] ?? 0),
|
|
2354
|
-
-(light.direction[1] ?? -1),
|
|
2355
|
-
-(light.direction[2] ?? 0)
|
|
2356
|
-
];
|
|
2357
|
-
sunRadiance = [
|
|
2358
|
-
(light.color[0] ?? 1) * intensity,
|
|
2359
|
-
(light.color[1] ?? 1) * intensity,
|
|
2360
|
-
(light.color[2] ?? 1) * intensity
|
|
2361
|
-
];
|
|
2362
|
-
break;
|
|
2363
|
-
}
|
|
2364
|
-
}
|
|
2365
|
-
} catch {
|
|
2366
|
-
}
|
|
2367
|
-
return selectCloudLayerFrame(
|
|
2368
|
-
candidates,
|
|
2369
|
-
world.getResource(Time).elapsed,
|
|
2370
|
-
sunDirection,
|
|
2371
|
-
sunRadiance
|
|
2372
|
-
);
|
|
2373
|
-
}
|
|
2374
|
-
function extractVolumetricFog(inputs) {
|
|
2375
|
-
if (inputs.length === 0) return ok({ status: "off" });
|
|
2376
|
-
if (inputs.length > MAX_VOLUMETRIC_FOG_OWNERS)
|
|
2377
|
-
return err(new VolumeOwnerConflictError(inputs.length));
|
|
2378
|
-
const fogs = [];
|
|
2379
|
-
for (const input of inputs) {
|
|
2380
|
-
const validated = validateVolumetricFog(input);
|
|
2381
|
-
if (!validated.ok) return validated;
|
|
2382
|
-
fogs.push(validated.value);
|
|
2383
|
-
}
|
|
2384
|
-
return ok({ status: "available", fogs });
|
|
2385
|
-
}
|
|
2386
|
-
|
|
2387
|
-
export { ANTIALIAS_FXAA, ANTIALIAS_MSAA, ANTIALIAS_NONE, ANTIALIAS_TAA, Atmosphere, BLOOM_DISABLED, BLOOM_ENABLED, BarrelDistortion, CAMERA_BLOOM_INTENSITY_MAX, CAMERA_BLOOM_INTENSITY_MIN, CAMERA_BLOOM_SCATTER_MAX, CAMERA_BLOOM_SCATTER_MIN, CAMERA_BLOOM_SOFT_KNEE_MAX, CAMERA_BLOOM_SOFT_KNEE_MIN, CAMERA_BLOOM_THRESHOLD_MAX, CAMERA_BLOOM_THRESHOLD_MIN, CAMERA_EXPOSURE_MODE_AUTO, CAMERA_EXPOSURE_MODE_MANUAL, CAMERA_PROJECTION_ORTHOGRAPHIC, CAMERA_PROJECTION_PERSPECTIVE, CAMERA_TEMPERATURE_MAX, CAMERA_TEMPERATURE_MIN, CAMERA_TINT_MAX, CAMERA_TINT_MIN, CLOUD_EXTINCTION_COEFFICIENT, CLOUD_QUALITY_PROFILES, CUBE_CAMERA_FACE_ORDER, CUBE_CAMERA_UPDATE_CONTINUOUS, CUBE_CAMERA_UPDATE_ONCE, CUBE_CAMERA_UPDATE_ON_DEMAND, Camera, CameraError, CloudLayer, CloudLayerCacheInvalidError, CloudLayerCapabilityMissingError, CloudLayerInvalidParameterError, CloudLayerOwnerConflictError, CloudLayerResourceFailureError, CloudQualityValue, CubeCamera, DEFAULT_CLOUD_LAYER, DEFAULT_DEPTH_OF_FIELD_PARAMS, DEPTH_OF_FIELD_PARAMS_BYTE_SIZE, DepthOfField, DepthOfFieldQualityValue, DepthOfFieldSideValue, DepthOfFieldValidationError, DirectionalLight, DirectionalShadowFilterValue, DynamicResolution, Fog, Instances, Layer, LightProbe, Lines, MAX_VOLUMETRIC_FOG_OWNERS, MeshFilter, MeshRenderer, MotionBlur, PointLight, PointLightShadow, PointShapeValue, Points, PostProcessParams, REFLECTION_PROBE_UPDATE_CONTINUOUS, REFLECTION_PROBE_UPDATE_ONCE, REFLECTION_PROBE_UPDATE_ON_CHANGE, RectAreaLight, ReflectionProbe, SKYBOX_MODE_CUBEMAP, SKYLIGHT_RECOVERY_FALLBACK, SceneInstance, ScreenSpaceReflection, SkyboxBackground, Skylight, SortKey, SpotLight, SunCardinalityError, TONEMAP_ACES_FILMIC, TONEMAP_AGX, TONEMAP_CINEON, TONEMAP_LINEAR, TONEMAP_NEUTRAL, TONEMAP_NONE, TONEMAP_REINHARD, TONEMAP_REINHARD_EXTENDED, Visibility, VisibilityStateValue, VolumetricFog, VolumetricFogSamplingValue, antialiasFromF32, attachBarrelDistortionCameraFrame, buildCubeCameraFaceViews, cameraExposureFromColumns, cameraProjectionFromF32, cloudLayerFormationKey, cloudLayerSourceKey, cloudQualityFromF32, cloudShadowResolutionForQuality, cloudViewDistanceForQuality, computeInvRangeSquared, createBarrelDistortionMapping, cubeCameraUpdateIntentFromF32, cubeCameraUpdateIntentToF32, degToCos, depthOfFieldQualityCode, depthOfFieldQualityFromF32, depthOfFieldRequestFailure, depthOfFieldSideCode, depthOfFieldSideFromF32, depthOfFieldTapCount, directionalShadowQualityFromF32, extractCloudLayer, extractVolumetricFog, freezeBarrelDistortionMapping, hasVolumetricFogCapability, mapDisplayToScene, mapDisplayUvToSceneUv, mapSceneToDisplay, mapSceneUvToDisplayUv, orthographic, packDepthOfFieldParams, perspective, pointShapeFromU32, projectMeshMaterialBindingObservation, reflectionProbeUpdateIntentFromF32, reflectionProbeUpdateIntentToF32, resolveDepthOfFieldFrameParams, resolveDepthOfFieldParams, resolveIntegratedVolumeConsumer, resolveMeshMaterialBindings, resolveSelectedVolumetricLight, resolveVisibility, resolveVolumetricFogLightPair, selectCloudLayerFrame, selectEnvironment, signedDepthOfFieldCoC, summarizeMeshMaterialBindings, tonemapFromF32, tonemapToU32, validateBarrelDistortionParameters, validateCameraBloom, validateCameraColorGrading, validateCameraExposure, validateCloudLayer, validateDepthOfFieldFrameParams, validateDepthOfFieldParams, validateDirection, validateDirectionalLightData, validateDynamicResolutionCamera, validateDynamicResolutionParameters, validateLightProbeData, validatePointLightData, validatePointLightShadowData, validateRectAreaLightData, validateSpotLightData, validateVolumetricFog, visibilityStateFromU32 };
|
|
2388
|
-
//# sourceMappingURL=chunk-UINHLCZA.mjs.map
|
|
2389
|
-
//# sourceMappingURL=chunk-UINHLCZA.mjs.map
|