@forgeax/engine-render 0.1.32 → 0.1.33
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 +379 -33
- package/dist/assembly/analytic-fog-registration.d.ts +3 -0
- package/dist/assembly/analytic-fog-registration.d.ts.map +1 -0
- package/dist/assembly/fxaa-registration.d.ts +4 -0
- package/dist/assembly/fxaa-registration.d.ts.map +1 -0
- package/dist/assembly/lod-observation.d.ts +4 -0
- package/dist/assembly/lod-observation.d.ts.map +1 -0
- package/dist/assembly/motion-blur-registration.d.ts +3 -0
- package/dist/assembly/motion-blur-registration.d.ts.map +1 -0
- package/dist/assembly/renderer-facade.d.ts.map +1 -1
- package/dist/assembly/temporal-post-process-prewarm.d.ts +13 -0
- package/dist/assembly/temporal-post-process-prewarm.d.ts.map +1 -0
- package/dist/assembly/webgpu-ready-contract.d.ts +4 -3
- package/dist/assembly/webgpu-ready-contract.d.ts.map +1 -1
- package/dist/assembly/webgpu-ready.d.ts +1 -1
- package/dist/assembly/webgpu-ready.d.ts.map +1 -1
- package/dist/assembly/webgpu-renderer.d.ts.map +1 -1
- package/dist/bloom-admission.d.ts +13 -0
- package/dist/bloom-admission.d.ts.map +1 -0
- package/dist/{chunk-DRR7D3KX.mjs → chunk-3RTCJTH4.mjs} +12 -9
- package/dist/chunk-3RTCJTH4.mjs.map +1 -0
- package/dist/{chunk-S665NJNF.mjs → chunk-LEAXOMYJ.mjs} +3 -3
- package/dist/{chunk-S665NJNF.mjs.map → chunk-LEAXOMYJ.mjs.map} +1 -1
- package/dist/{chunk-6TFBXLRJ.mjs → chunk-NB2S7ZRX.mjs} +155 -11
- package/dist/chunk-NB2S7ZRX.mjs.map +1 -0
- package/dist/{chunk-LULCA3OF.mjs → chunk-NNQL7CB3.mjs} +4 -4
- package/dist/{chunk-LULCA3OF.mjs.map → chunk-NNQL7CB3.mjs.map} +1 -1
- package/dist/{chunk-4NNZQCL3.mjs → chunk-OO3DRYK7.mjs} +66 -200
- package/dist/chunk-OO3DRYK7.mjs.map +1 -0
- package/dist/{chunk-GWCEMDVR.mjs → chunk-PLAXOOX5.mjs} +232 -7
- package/dist/chunk-PLAXOOX5.mjs.map +1 -0
- package/dist/{chunk-JRIPCMYC.mjs → chunk-VOZWDM3L.mjs} +283 -193
- package/dist/chunk-VOZWDM3L.mjs.map +1 -0
- package/dist/{chunk-JCIRYQ4V.mjs → chunk-ZDQWGQW7.mjs} +10 -4
- package/dist/chunk-ZDQWGQW7.mjs.map +1 -0
- package/dist/components/atmosphere.d.ts +2 -0
- package/dist/components/atmosphere.d.ts.map +1 -1
- package/dist/components/camera.d.ts +20 -4
- package/dist/components/camera.d.ts.map +1 -1
- package/dist/components/mesh-filter.d.ts +6 -5
- package/dist/components/mesh-filter.d.ts.map +1 -1
- package/dist/components/motion-blur.d.ts +1 -0
- package/dist/components/motion-blur.d.ts.map +1 -1
- package/dist/construct-renderer.mjs +2865 -526
- package/dist/construct-renderer.mjs.map +1 -1
- package/dist/device/gpu-residency.d.ts +6 -0
- package/dist/device/gpu-residency.d.ts.map +1 -1
- package/dist/environment/analytic-fog.d.ts +6 -0
- package/dist/environment/analytic-fog.d.ts.map +1 -0
- package/dist/errors/render.d.ts +6 -2
- package/dist/errors/render.d.ts.map +1 -1
- package/dist/extract/camera.d.ts.map +1 -1
- package/dist/extract/contracts.d.ts +7 -0
- package/dist/extract/contracts.d.ts.map +1 -1
- package/dist/extract/environment.d.ts +2 -0
- package/dist/extract/environment.d.ts.map +1 -1
- package/dist/features/error-reporting.d.ts +13 -0
- package/dist/features/error-reporting.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/motion-blur/motion-blur-feature.d.ts +20 -2
- package/dist/features/motion-blur/motion-blur-feature.d.ts.map +1 -1
- package/dist/features/motion-blur/motion-blur-params.d.ts +21 -0
- package/dist/features/motion-blur/motion-blur-params.d.ts.map +1 -1
- package/dist/features/motion-blur/motion-blur-runtime.d.ts +54 -0
- package/dist/features/motion-blur/motion-blur-runtime.d.ts.map +1 -0
- package/dist/features/plan.d.ts +7 -4
- package/dist/features/plan.d.ts.map +1 -1
- package/dist/features/prepared-gpu-work.d.ts +9 -5
- package/dist/features/prepared-gpu-work.d.ts.map +1 -1
- package/dist/features/render-graph-compute.d.ts.map +1 -1
- package/dist/features/render-graph-contribution.d.ts.map +1 -1
- package/dist/gpu-driven/material-artifacts.d.ts.map +1 -1
- package/dist/gpu-driven/prepared-draw.d.ts +7 -0
- package/dist/gpu-driven/prepared-draw.d.ts.map +1 -1
- package/dist/gpu-driven/production-raster.d.ts +3 -1
- package/dist/gpu-driven/production-raster.d.ts.map +1 -1
- package/dist/gpu-driven/view-gpu.d.ts +9 -0
- package/dist/gpu-driven/view-gpu.d.ts.map +1 -1
- package/dist/gpu-scene.d.ts +6 -1
- package/dist/gpu-scene.d.ts.map +1 -1
- package/dist/index.d.ts +5 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +5 -5
- package/dist/inspection-types.d.ts +43 -2
- package/dist/inspection-types.d.ts.map +1 -1
- package/dist/instances.d.ts +8 -1
- package/dist/instances.d.ts.map +1 -1
- package/dist/internal.mjs +6 -6
- package/dist/pipeline/standard-post.d.ts +28 -19
- package/dist/pipeline/standard-post.d.ts.map +1 -1
- package/dist/pipeline-spec.d.ts +2 -2
- package/dist/record/frame-snapshot.d.ts +3 -0
- package/dist/record/frame-snapshot.d.ts.map +1 -1
- package/dist/record/frame-targets.d.ts.map +1 -1
- package/dist/record/frame.d.ts +5 -2
- package/dist/record/frame.d.ts.map +1 -1
- package/dist/record/main-pass-geometry.d.ts.map +1 -1
- package/dist/record/mesh-ssbo.d.ts +6 -5
- package/dist/record/mesh-ssbo.d.ts.map +1 -1
- package/dist/record/render-context.d.ts +12 -28
- package/dist/record/render-context.d.ts.map +1 -1
- package/dist/record/shadow-pass.d.ts.map +1 -1
- package/dist/record/skybox-post-pass.d.ts +5 -3
- package/dist/record/skybox-post-pass.d.ts.map +1 -1
- package/dist/record/typed-frame-graph.d.ts +1 -1
- package/dist/record/typed-frame-graph.d.ts.map +1 -1
- package/dist/recovery/render-system-candidate.d.ts.map +1 -1
- package/dist/render-contract.d.ts +24 -4
- package/dist/render-contract.d.ts.map +1 -1
- package/dist/render-pipeline.d.ts +3 -1
- package/dist/render-pipeline.d.ts.map +1 -1
- package/dist/render-system-extract-tail.d.ts.map +1 -1
- package/dist/render-system-extract.d.ts +8 -1
- package/dist/render-system-extract.d.ts.map +1 -1
- package/dist/render-system.d.ts +7 -1
- package/dist/render-system.d.ts.map +1 -1
- package/dist/scene/render-scene.d.ts +2 -0
- package/dist/scene/render-scene.d.ts.map +1 -1
- package/dist/temporal/frame-coordinator.d.ts.map +1 -1
- package/dist/temporal/frame.d.ts +7 -0
- package/dist/temporal/frame.d.ts.map +1 -1
- package/dist/temporal/index.mjs +5 -5
- package/dist/temporal/view.d.ts +6 -1
- package/dist/temporal/view.d.ts.map +1 -1
- package/dist/typed-render-graph-primitives.d.ts +10 -7
- package/dist/typed-render-graph-primitives.d.ts.map +1 -1
- package/dist/volume/component.d.ts +0 -1
- package/dist/volume/component.d.ts.map +1 -1
- package/dist/volume/passes.d.ts.map +1 -1
- package/dist/volume/temporal.d.ts +3 -1
- package/dist/volume/temporal.d.ts.map +1 -1
- package/package.json +21 -21
- package/src/__tests__/analytic-fog-graph.unit.test.ts +199 -0
- package/src/__tests__/analytic-fog-optics.unit.test.ts +38 -0
- package/src/__tests__/bloom-exact-zero.unit.test.ts +112 -18
- package/src/__tests__/bloom-lifecycle.integration.test.ts +17 -4
- package/src/__tests__/dynamic-resolution-plugin.integration.test.ts +20 -0
- package/src/__tests__/environment-fog-lanes.integration.test.ts +14 -0
- package/src/__tests__/environment-selection.unit.test.ts +12 -0
- package/src/__tests__/factory-contract.integration.test.ts +331 -68
- package/src/__tests__/frame-camera-selection.unit.test.ts +39 -1
- package/src/__tests__/frame-plan-contract.unit.test.ts +2 -0
- package/src/__tests__/gpu-driven-indirect-raster-evidence.ts +2 -1
- package/src/__tests__/gpu-driven-shadow-views.dawn.test.ts +1 -1
- package/src/__tests__/gpu-driven-shadow-views.integration.test.ts +1 -1
- package/src/__tests__/gpu-driven-view-gpu-evidence.ts +11 -0
- package/src/__tests__/gpu-resource-store-stride.unit.test.ts +12 -0
- package/src/__tests__/gpu-scene.unit.test.ts +91 -0
- package/src/__tests__/instances-store.unit.test.ts +75 -0
- package/src/__tests__/mesh-submission-lifetime.unit.test.ts +31 -0
- package/src/__tests__/motion-blur-compute.dawn.test.ts +583 -0
- package/src/__tests__/prepared-gpu-driven-pbr.integration.test.ts +21 -0
- package/src/__tests__/prepared-graphics-lifecycle.unit.test.ts +86 -0
- package/src/__tests__/public-surface.test-d.ts +8 -0
- package/src/__tests__/render-error-code-owner.test-d.ts +2 -0
- package/src/__tests__/render-feature-error-reporting.unit.test.ts +24 -0
- package/src/__tests__/render-feature-stage-fault-recovery.unit.test.ts +23 -0
- package/src/__tests__/render-scene-temporal-retry.unit.test.ts +31 -0
- package/src/__tests__/renderer-frame-transaction.integration.test.ts +7 -1
- package/src/__tests__/shader-manifest-fixture.ts +4 -4
- package/src/__tests__/skinned-shadow-caster.test.ts +2 -0
- package/src/__tests__/standard-lighting-write.unit.test.ts +2 -1
- package/src/__tests__/standard-pipeline.dawn.test.ts +1 -1
- package/src/__tests__/standard-pipeline.integration.test.ts +18 -8
- package/src/__tests__/temporal-reset-matrix.unit.test.ts +10 -0
- package/src/__tests__/temporal-view.unit.test.ts +2 -1
- package/src/__tests__/typed-pipeline-topology.unit.test.ts +20 -4
- package/src/__tests__/volume-optics-oracle.unit.test.ts +3 -1
- package/src/__tests__/volumetric-fog-budget-recovery.integration.test.ts +177 -13
- package/src/__tests__/volumetric-fog-stage-readback.dawn.test.ts +447 -61
- package/src/__tests__/volumetric-fog-temporal.unit.test.ts +27 -0
- package/src/__tests__/volumetric-fog-topology.unit.test.ts +19 -3
- package/src/assembly/analytic-fog-registration.ts +14 -0
- package/src/assembly/fxaa-registration.ts +17 -0
- package/src/assembly/lod-observation.ts +12 -0
- package/src/assembly/motion-blur-registration.ts +17 -0
- package/src/assembly/renderer-facade.ts +2 -0
- package/src/assembly/temporal-post-process-prewarm.ts +40 -0
- package/src/assembly/webgpu-ready-contract.ts +8 -3
- package/src/assembly/webgpu-ready.ts +181 -245
- package/src/assembly/webgpu-renderer.ts +16 -31
- package/src/bloom-admission.ts +21 -0
- package/src/components/__tests__/motion-blur.unit.test.ts +1 -0
- package/src/components/atmosphere.ts +4 -0
- package/src/components/camera.ts +66 -10
- package/src/components/mesh-filter.ts +11 -9
- package/src/components/motion-blur.ts +1 -0
- package/src/device/gpu-residency.ts +56 -12
- package/src/environment/analytic-fog.ts +44 -0
- package/src/environment/background.ts +2 -2
- package/src/errors/render.ts +14 -1
- package/src/extract/camera.ts +20 -7
- package/src/extract/contracts.ts +7 -0
- package/src/extract/environment.ts +4 -0
- package/src/features/error-reporting.ts +78 -0
- package/src/features/host.ts +25 -12
- package/src/features/motion-blur/__tests__/motion-blur-feature.unit.test.ts +111 -1
- package/src/features/motion-blur/__tests__/motion-blur-params.unit.test.ts +58 -3
- package/src/features/motion-blur/motion-blur-feature.ts +1519 -15
- package/src/features/motion-blur/motion-blur-params.ts +70 -2
- package/src/features/motion-blur/motion-blur-runtime.ts +176 -0
- package/src/features/plan.ts +25 -8
- package/src/features/prepared-gpu-work.ts +86 -35
- package/src/features/render-graph-compute.ts +13 -5
- package/src/features/render-graph-contribution.ts +2 -0
- package/src/gpu-driven/material-artifacts.ts +2 -7
- package/src/gpu-driven/prepared-draw.ts +15 -10
- package/src/gpu-driven/production-raster.ts +83 -7
- package/src/gpu-driven/view-gpu.ts +17 -0
- package/src/gpu-scene.ts +188 -21
- package/src/index.ts +32 -0
- package/src/inspection-types.ts +60 -2
- package/src/instances.ts +80 -1
- package/src/pipeline/standard-post.ts +307 -78
- package/src/pipeline-spec.ts +5 -5
- package/src/points-lines/__tests__/view-ubo.unit.test.ts +2 -1
- package/src/record/__tests__/temporal-payload.unit.test.ts +2 -1
- package/src/record/frame-snapshot.ts +5 -1
- package/src/record/frame-targets.ts +10 -6
- package/src/record/frame.ts +163 -22
- package/src/record/main-pass-geometry.ts +30 -1
- package/src/record/main-pass-sprite-draws.ts +6 -1
- package/src/record/mesh-ssbo.ts +43 -6
- package/src/record/render-context.ts +12 -28
- package/src/record/shadow-pass.ts +6 -1
- package/src/record/skybox-post-pass.ts +122 -196
- package/src/record/typed-frame-graph.ts +153 -9
- package/src/recovery/render-system-candidate.ts +22 -10
- package/src/render-contract.ts +23 -4
- package/src/render-pipeline.ts +6 -1
- package/src/render-system-extract-tail.ts +16 -0
- package/src/render-system-extract.ts +45 -13
- package/src/render-system.ts +255 -120
- package/src/scene/render-scene.ts +85 -4
- package/src/temporal/__tests__/temporal-frame-transaction.unit.test.ts +36 -0
- package/src/temporal/frame-coordinator.ts +8 -1
- package/src/temporal/frame.ts +20 -0
- package/src/temporal/view.ts +13 -2
- package/src/typed-render-graph-primitives.ts +121 -48
- package/src/volume/component.ts +0 -1
- package/src/volume/passes.ts +8 -4
- package/src/volume/resources.ts +1 -1
- package/src/volume/temporal.ts +11 -0
- package/dist/chunk-4NNZQCL3.mjs.map +0 -1
- package/dist/chunk-6TFBXLRJ.mjs.map +0 -1
- package/dist/chunk-DRR7D3KX.mjs.map +0 -1
- package/dist/chunk-GWCEMDVR.mjs.map +0 -1
- package/dist/chunk-JCIRYQ4V.mjs.map +0 -1
- package/dist/chunk-JRIPCMYC.mjs.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RenderIntentInvalidError, DynamicResolutionRequiresTaaError, ShadowInvalidConfigError, VolumeOwnerConflictError, VolumeDensityShapeMismatchError, VolumeInvalidBoundsError, VolumeInvalidParametersError, DynamicResolutionInvalidParameterError } from './chunk-
|
|
1
|
+
import { RenderIntentInvalidError, DynamicResolutionRequiresTaaError, ShadowInvalidConfigError, EnvironmentSourceConflictError, FogCardinalityError, VolumeOwnerConflictError, VolumeDensityShapeMismatchError, VolumeInvalidBoundsError, VolumeInvalidParametersError, DynamicResolutionInvalidParameterError, AtmosphereInvalidParameterError } from './chunk-NB2S7ZRX.mjs';
|
|
2
2
|
import { defineComponent, Entity } from '@forgeax/engine-ecs';
|
|
3
3
|
import { TONEMAP_SHADER_MODE } from '@forgeax/engine-shader';
|
|
4
4
|
import { R_MIN, err, ok } from '@forgeax/engine-types';
|
|
@@ -11,7 +11,11 @@ var Atmosphere = defineComponent("Atmosphere", {
|
|
|
11
11
|
rayleigh: { type: "f32", default: 1 },
|
|
12
12
|
mieCoefficient: { type: "f32", default: 5e-3 },
|
|
13
13
|
mieDirectionalG: { type: "f32", default: 0.8 },
|
|
14
|
-
sunAngularRadius: { type: "f32", default: 4675e-6 }
|
|
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 }
|
|
15
19
|
});
|
|
16
20
|
var CAMERA_PROJECTION_PERSPECTIVE = 0;
|
|
17
21
|
var CAMERA_PROJECTION_ORTHOGRAPHIC = 1;
|
|
@@ -199,6 +203,14 @@ function antialiasFromF32(value) {
|
|
|
199
203
|
}
|
|
200
204
|
var BLOOM_DISABLED = 0;
|
|
201
205
|
var BLOOM_ENABLED = 1;
|
|
206
|
+
var CAMERA_BLOOM_INTENSITY_MIN = 0;
|
|
207
|
+
var CAMERA_BLOOM_INTENSITY_MAX = 8;
|
|
208
|
+
var CAMERA_BLOOM_THRESHOLD_MIN = 0;
|
|
209
|
+
var CAMERA_BLOOM_THRESHOLD_MAX = 65504;
|
|
210
|
+
var CAMERA_BLOOM_SOFT_KNEE_MIN = 0;
|
|
211
|
+
var CAMERA_BLOOM_SOFT_KNEE_MAX = 1;
|
|
212
|
+
var CAMERA_BLOOM_SCATTER_MIN = 0;
|
|
213
|
+
var CAMERA_BLOOM_SCATTER_MAX = 0.95;
|
|
202
214
|
function bloomEnabledFromF32(value) {
|
|
203
215
|
if (value === BLOOM_DISABLED) return "off";
|
|
204
216
|
if (value === BLOOM_ENABLED) return "on";
|
|
@@ -210,6 +222,40 @@ function bloomEnabledFromF32(value) {
|
|
|
210
222
|
"select Camera bloom off or on"
|
|
211
223
|
);
|
|
212
224
|
}
|
|
225
|
+
function validateBloomRange(field, value, min, max) {
|
|
226
|
+
if (!Number.isFinite(value) || value < min || value > max) {
|
|
227
|
+
throw cameraError(
|
|
228
|
+
"camera-bloom-invalid",
|
|
229
|
+
field,
|
|
230
|
+
value,
|
|
231
|
+
`a finite value in [${min}, ${max}]`,
|
|
232
|
+
`set Camera.${field} to a finite value in [${min}, ${max}]`
|
|
233
|
+
);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
function validateCameraBloom(bloom, threshold, intensity, softKnee, scatter) {
|
|
237
|
+
const enabled = bloomEnabledFromF32(bloom);
|
|
238
|
+
validateBloomRange(
|
|
239
|
+
"bloomThreshold",
|
|
240
|
+
threshold,
|
|
241
|
+
CAMERA_BLOOM_THRESHOLD_MIN,
|
|
242
|
+
CAMERA_BLOOM_THRESHOLD_MAX
|
|
243
|
+
);
|
|
244
|
+
validateBloomRange(
|
|
245
|
+
"bloomIntensity",
|
|
246
|
+
intensity,
|
|
247
|
+
CAMERA_BLOOM_INTENSITY_MIN,
|
|
248
|
+
CAMERA_BLOOM_INTENSITY_MAX
|
|
249
|
+
);
|
|
250
|
+
validateBloomRange(
|
|
251
|
+
"bloomSoftKnee",
|
|
252
|
+
softKnee,
|
|
253
|
+
CAMERA_BLOOM_SOFT_KNEE_MIN,
|
|
254
|
+
CAMERA_BLOOM_SOFT_KNEE_MAX
|
|
255
|
+
);
|
|
256
|
+
validateBloomRange("bloomScatter", scatter, CAMERA_BLOOM_SCATTER_MIN, CAMERA_BLOOM_SCATTER_MAX);
|
|
257
|
+
return enabled;
|
|
258
|
+
}
|
|
213
259
|
var Camera = defineComponent("Camera", {
|
|
214
260
|
fov: { type: "f32" },
|
|
215
261
|
aspect: { type: "f32" },
|
|
@@ -236,7 +282,8 @@ var Camera = defineComponent("Camera", {
|
|
|
236
282
|
bloom: { type: "f32", default: 0 },
|
|
237
283
|
bloomThreshold: { type: "f32", default: 1 },
|
|
238
284
|
bloomIntensity: { type: "f32", default: 1 },
|
|
239
|
-
|
|
285
|
+
bloomSoftKnee: { type: "f32", default: 0.5 },
|
|
286
|
+
bloomScatter: { type: "f32", default: 0.7 },
|
|
240
287
|
// M1 target camera role: zero means this camera is eligible for display;
|
|
241
288
|
// non-zero shared targets are auxiliary producers whose views and receipt
|
|
242
289
|
// promotion remain owned by Renderer.
|
|
@@ -777,7 +824,8 @@ var MeshRenderer = defineComponent("MeshRenderer", {
|
|
|
777
824
|
var MotionBlur = defineComponent("MotionBlur", {
|
|
778
825
|
shutterAngle: { type: "f32", default: 180 },
|
|
779
826
|
maxRadiusPixels: { type: "f32", default: 32 },
|
|
780
|
-
sampleCount: { type: "f32", default: 8 }
|
|
827
|
+
sampleCount: { type: "f32", default: 8 },
|
|
828
|
+
targetFps: { type: "f32", default: 60 }
|
|
781
829
|
});
|
|
782
830
|
var PointLight = defineComponent("PointLight", {
|
|
783
831
|
// color carries an explicit layer-2 default [1,1,1] (white); the array
|
|
@@ -973,6 +1021,183 @@ var Visibility = defineComponent(
|
|
|
973
1021
|
}
|
|
974
1022
|
}
|
|
975
1023
|
);
|
|
1024
|
+
|
|
1025
|
+
// src/environment/signature.ts
|
|
1026
|
+
function sorted(items) {
|
|
1027
|
+
return [...items].sort((left, right) => left.entityKey - right.entityKey);
|
|
1028
|
+
}
|
|
1029
|
+
function environmentSignature(input) {
|
|
1030
|
+
return JSON.stringify({
|
|
1031
|
+
environments: sorted(input.environments),
|
|
1032
|
+
fogs: sorted(input.fogs),
|
|
1033
|
+
suns: sorted(input.suns)
|
|
1034
|
+
});
|
|
1035
|
+
}
|
|
1036
|
+
function environmentOnlySignature(input) {
|
|
1037
|
+
return JSON.stringify({
|
|
1038
|
+
environments: sorted(input.environments),
|
|
1039
|
+
suns: sorted(input.suns)
|
|
1040
|
+
});
|
|
1041
|
+
}
|
|
1042
|
+
function fogOnlySignature(input) {
|
|
1043
|
+
return JSON.stringify({ fogs: sorted(input.fogs) });
|
|
1044
|
+
}
|
|
1045
|
+
function environmentFactSignatures(input) {
|
|
1046
|
+
return {
|
|
1047
|
+
environmentSignature: environmentOnlySignature(input),
|
|
1048
|
+
fogSignature: fogOnlySignature(input),
|
|
1049
|
+
signature: environmentSignature(input)
|
|
1050
|
+
};
|
|
1051
|
+
}
|
|
1052
|
+
|
|
1053
|
+
// src/extract/environment.ts
|
|
1054
|
+
var ATMOSPHERE_PARAMETER_RANGES = Object.freeze({
|
|
1055
|
+
turbidity: Object.freeze({ min: 1, max: 20 }),
|
|
1056
|
+
rayleigh: Object.freeze({ min: 0, max: Number.POSITIVE_INFINITY }),
|
|
1057
|
+
mieCoefficient: Object.freeze({ min: 0, max: Number.POSITIVE_INFINITY }),
|
|
1058
|
+
mieDirectionalG: Object.freeze({ min: 0, max: 0.999 }),
|
|
1059
|
+
sunAngularRadius: Object.freeze({ min: 0, max: Number.POSITIVE_INFINITY }),
|
|
1060
|
+
circumsolarStrength: Object.freeze({ min: 0, max: 4 }),
|
|
1061
|
+
circumsolarWidth: Object.freeze({ min: 0.25, max: 4 })
|
|
1062
|
+
});
|
|
1063
|
+
function validateFogParameters(candidate) {
|
|
1064
|
+
if (candidate.color.length !== 3) {
|
|
1065
|
+
return {
|
|
1066
|
+
field: "color",
|
|
1067
|
+
value: candidate.color.length,
|
|
1068
|
+
expected: "exactly three finite channels in [0, 1]"
|
|
1069
|
+
};
|
|
1070
|
+
}
|
|
1071
|
+
for (let index = 0; index < candidate.color.length; index += 1) {
|
|
1072
|
+
const value = candidate.color[index];
|
|
1073
|
+
if (value === void 0 || !Number.isFinite(value) || value < 0 || value > 1) {
|
|
1074
|
+
return {
|
|
1075
|
+
field: `color[${index}]`,
|
|
1076
|
+
value: value ?? Number.NaN,
|
|
1077
|
+
expected: "a finite number in [0, 1]"
|
|
1078
|
+
};
|
|
1079
|
+
}
|
|
1080
|
+
}
|
|
1081
|
+
if (!Number.isFinite(candidate.density) || candidate.density < 0) {
|
|
1082
|
+
return { field: "density", value: candidate.density, expected: "a finite number >= 0" };
|
|
1083
|
+
}
|
|
1084
|
+
if (!Number.isFinite(candidate.heightFalloff) || candidate.heightFalloff < 0) {
|
|
1085
|
+
return {
|
|
1086
|
+
field: "heightFalloff",
|
|
1087
|
+
value: candidate.heightFalloff,
|
|
1088
|
+
expected: "a finite number >= 0"
|
|
1089
|
+
};
|
|
1090
|
+
}
|
|
1091
|
+
if (!Number.isFinite(candidate.maxOpacity) || candidate.maxOpacity < 0 || candidate.maxOpacity > 1) {
|
|
1092
|
+
return {
|
|
1093
|
+
field: "maxOpacity",
|
|
1094
|
+
value: candidate.maxOpacity,
|
|
1095
|
+
expected: "a finite number in [0, 1]"
|
|
1096
|
+
};
|
|
1097
|
+
}
|
|
1098
|
+
return void 0;
|
|
1099
|
+
}
|
|
1100
|
+
function validateAtmosphereParameters(parameters) {
|
|
1101
|
+
for (const field of Object.keys(ATMOSPHERE_PARAMETER_RANGES)) {
|
|
1102
|
+
const value = parameters[field];
|
|
1103
|
+
const range = ATMOSPHERE_PARAMETER_RANGES[field];
|
|
1104
|
+
if (!Number.isFinite(value) || value < range.min || value > range.max) {
|
|
1105
|
+
return new AtmosphereInvalidParameterError(field, value, range);
|
|
1106
|
+
}
|
|
1107
|
+
}
|
|
1108
|
+
return void 0;
|
|
1109
|
+
}
|
|
1110
|
+
|
|
1111
|
+
// src/environment/frame.ts
|
|
1112
|
+
var SKYLIGHT_RECOVERY_FALLBACK = Object.freeze({
|
|
1113
|
+
kind: "skylight",
|
|
1114
|
+
active: false
|
|
1115
|
+
});
|
|
1116
|
+
var EnvironmentSelectionParameterError = class extends Error {
|
|
1117
|
+
code = "environment-selection-invalid";
|
|
1118
|
+
expected;
|
|
1119
|
+
hint;
|
|
1120
|
+
detail;
|
|
1121
|
+
constructor(field, value, expected) {
|
|
1122
|
+
super(`environment selection field ${field} is invalid`);
|
|
1123
|
+
this.name = "EnvironmentSelectionParameterError";
|
|
1124
|
+
this.expected = expected;
|
|
1125
|
+
this.hint = `set ${field} to a finite value satisfying ${expected}`;
|
|
1126
|
+
this.detail = { field, value };
|
|
1127
|
+
}
|
|
1128
|
+
};
|
|
1129
|
+
var SunCardinalityError = class extends Error {
|
|
1130
|
+
code = "sun-cardinality";
|
|
1131
|
+
expected = "atmosphere has exactly one sun owner";
|
|
1132
|
+
hint = "add exactly one DirectionalLight sun for the atmosphere owner";
|
|
1133
|
+
detail;
|
|
1134
|
+
constructor(value) {
|
|
1135
|
+
super(`atmosphere sun cardinality is ${value}`);
|
|
1136
|
+
this.name = "SunCardinalityError";
|
|
1137
|
+
this.detail = { field: "sun", value };
|
|
1138
|
+
}
|
|
1139
|
+
};
|
|
1140
|
+
function freezeCandidate(candidate) {
|
|
1141
|
+
return Object.freeze(candidate);
|
|
1142
|
+
}
|
|
1143
|
+
function freezeFog(candidate) {
|
|
1144
|
+
return Object.freeze({
|
|
1145
|
+
...candidate,
|
|
1146
|
+
color: Object.freeze([...candidate.color])
|
|
1147
|
+
});
|
|
1148
|
+
}
|
|
1149
|
+
function selectEnvironment(input) {
|
|
1150
|
+
if (input.environments.length > 1) {
|
|
1151
|
+
return err(
|
|
1152
|
+
new EnvironmentSourceConflictError(
|
|
1153
|
+
[...input.environments].sort((left, right) => left.entityKey - right.entityKey).map(({ kind, entityKey, sourceKey }) => ({ kind, entityKey, sourceKey }))
|
|
1154
|
+
)
|
|
1155
|
+
);
|
|
1156
|
+
}
|
|
1157
|
+
if (input.fogs.length > 1) return err(new FogCardinalityError(input.fogs.length));
|
|
1158
|
+
const selectedFog = input.fogs[0];
|
|
1159
|
+
if (selectedFog !== void 0) {
|
|
1160
|
+
const issue = validateFogParameters(selectedFog);
|
|
1161
|
+
if (issue !== void 0) {
|
|
1162
|
+
return err(new EnvironmentSelectionParameterError(issue.field, issue.value, issue.expected));
|
|
1163
|
+
}
|
|
1164
|
+
}
|
|
1165
|
+
const selected = input.environments[0];
|
|
1166
|
+
if (selected?.kind === "atmosphere") {
|
|
1167
|
+
const invalid3 = validateAtmosphereParameters(selected.atmosphere);
|
|
1168
|
+
if (invalid3 !== void 0) return err(invalid3);
|
|
1169
|
+
}
|
|
1170
|
+
if (selected?.kind === "atmosphere" && input.suns.length !== 1) {
|
|
1171
|
+
return err(new SunCardinalityError(input.suns.length));
|
|
1172
|
+
}
|
|
1173
|
+
const source = selected === void 0 ? { kind: "none" } : selected.kind === "atmosphere" ? {
|
|
1174
|
+
kind: "atmosphere",
|
|
1175
|
+
entityKey: selected.entityKey,
|
|
1176
|
+
sourceKey: selected.sourceKey,
|
|
1177
|
+
atmosphere: Object.freeze({ ...selected.atmosphere })
|
|
1178
|
+
} : {
|
|
1179
|
+
kind: "image",
|
|
1180
|
+
entityKey: selected.entityKey,
|
|
1181
|
+
sourceKey: selected.sourceKey
|
|
1182
|
+
};
|
|
1183
|
+
const sun = input.suns[0] === void 0 ? void 0 : freezeCandidate({ ...input.suns[0] });
|
|
1184
|
+
const fog = selectedFog === void 0 ? void 0 : freezeFog(selectedFog);
|
|
1185
|
+
const signatureInput = {
|
|
1186
|
+
environments: selected === void 0 ? [] : [selected],
|
|
1187
|
+
fogs: selectedFog === void 0 ? [] : [selectedFog],
|
|
1188
|
+
suns: input.suns
|
|
1189
|
+
};
|
|
1190
|
+
const signatures = environmentFactSignatures(signatureInput);
|
|
1191
|
+
const result = {
|
|
1192
|
+
source: Object.freeze(source),
|
|
1193
|
+
fog,
|
|
1194
|
+
...signatures,
|
|
1195
|
+
revision: 0,
|
|
1196
|
+
sun
|
|
1197
|
+
};
|
|
1198
|
+
Object.defineProperty(result, "lane", { value: input.lane, enumerable: false });
|
|
1199
|
+
return ok(Object.freeze(result));
|
|
1200
|
+
}
|
|
976
1201
|
var DEPTH_OF_FIELD_PARAMS_BYTE_SIZE = 64;
|
|
977
1202
|
var MIN_F_STOP = Math.fround(0.7);
|
|
978
1203
|
var MAX_F_STOP = Math.fround(32);
|
|
@@ -1677,6 +1902,6 @@ function extractVolumetricFog(inputs) {
|
|
|
1677
1902
|
return ok({ status: "available", fog: validated.value });
|
|
1678
1903
|
}
|
|
1679
1904
|
|
|
1680
|
-
export { ANTIALIAS_FXAA, ANTIALIAS_MSAA, ANTIALIAS_NONE, ANTIALIAS_TAA, Atmosphere, BLOOM_DISABLED, BLOOM_ENABLED, 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, CUBE_CAMERA_FACE_ORDER, CUBE_CAMERA_UPDATE_CONTINUOUS, CUBE_CAMERA_UPDATE_ONCE, CUBE_CAMERA_UPDATE_ON_DEMAND, Camera, CameraError, CubeCamera, DEFAULT_DEPTH_OF_FIELD_PARAMS, DEPTH_OF_FIELD_PARAMS_BYTE_SIZE, DepthOfField, DepthOfFieldQualityValue, DepthOfFieldSideValue, DepthOfFieldValidationError, DirectionalLight, DirectionalShadowFilterValue, DynamicResolution, Fog, Instances, Layer, LightProbe, Lines, 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, SceneInstance, ScreenSpaceReflection, SkyboxBackground, Skylight, SortKey, SpotLight, TONEMAP_ACES_FILMIC, TONEMAP_AGX, TONEMAP_CINEON, TONEMAP_LINEAR, TONEMAP_NEUTRAL, TONEMAP_NONE, TONEMAP_REINHARD, TONEMAP_REINHARD_EXTENDED, Visibility, VisibilityStateValue, VolumetricFog, antialiasFromF32,
|
|
1681
|
-
//# sourceMappingURL=chunk-
|
|
1682
|
-
//# sourceMappingURL=chunk-
|
|
1905
|
+
export { ANTIALIAS_FXAA, ANTIALIAS_MSAA, ANTIALIAS_NONE, ANTIALIAS_TAA, Atmosphere, BLOOM_DISABLED, BLOOM_ENABLED, 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, CUBE_CAMERA_FACE_ORDER, CUBE_CAMERA_UPDATE_CONTINUOUS, CUBE_CAMERA_UPDATE_ONCE, CUBE_CAMERA_UPDATE_ON_DEMAND, Camera, CameraError, CubeCamera, DEFAULT_DEPTH_OF_FIELD_PARAMS, DEPTH_OF_FIELD_PARAMS_BYTE_SIZE, DepthOfField, DepthOfFieldQualityValue, DepthOfFieldSideValue, DepthOfFieldValidationError, DirectionalLight, DirectionalShadowFilterValue, DynamicResolution, Fog, Instances, Layer, LightProbe, Lines, 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, antialiasFromF32, buildCubeCameraFaceViews, cameraExposureFromColumns, cameraProjectionFromF32, computeInvRangeSquared, cubeCameraUpdateIntentFromF32, cubeCameraUpdateIntentToF32, degToCos, depthOfFieldQualityCode, depthOfFieldQualityFromF32, depthOfFieldRequestFailure, depthOfFieldSideCode, depthOfFieldSideFromF32, depthOfFieldTapCount, directionalShadowQualityFromF32, extractVolumetricFog, hasVolumetricFogCapability, orthographic, packDepthOfFieldParams, perspective, pointShapeFromU32, projectMeshMaterialBindingObservation, reflectionProbeUpdateIntentFromF32, reflectionProbeUpdateIntentToF32, resolveDepthOfFieldFrameParams, resolveDepthOfFieldParams, resolveIntegratedVolumeConsumer, resolveMeshMaterialBindings, resolveSelectedVolumetricLight, resolveVisibility, resolveVolumetricFogLightPair, selectEnvironment, signedDepthOfFieldCoC, summarizeMeshMaterialBindings, tonemapFromF32, tonemapToU32, validateCameraBloom, validateCameraColorGrading, validateCameraExposure, validateDepthOfFieldFrameParams, validateDepthOfFieldParams, validateDirection, validateDirectionalLightData, validateDynamicResolutionCamera, validateDynamicResolutionParameters, validateLightProbeData, validatePointLightData, validatePointLightShadowData, validateRectAreaLightData, validateSpotLightData, validateVolumetricFog, visibilityStateFromU32 };
|
|
1906
|
+
//# sourceMappingURL=chunk-PLAXOOX5.mjs.map
|
|
1907
|
+
//# sourceMappingURL=chunk-PLAXOOX5.mjs.map
|