@ignifx/core 0.17.0 → 0.18.0
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/dist/{environment-CMpzGXTz.js → environment-DZ6WUHbm.js} +2 -2
- package/dist/{environment-CMpzGXTz.js.map → environment-DZ6WUHbm.js.map} +1 -1
- package/dist/{hdr-output-BrUvpAsE.js → hdr-output-Dbv0lhFl.js} +4 -3
- package/dist/{hdr-output-BrUvpAsE.js.map → hdr-output-Dbv0lhFl.js.map} +1 -1
- package/dist/{ignifx-error-Der0bpHK.js → ignifx-error-B8ByiSfJ.js} +10 -1
- package/dist/ignifx-error-B8ByiSfJ.js.map +1 -0
- package/dist/index.d.ts +110 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +836 -35
- package/dist/index.js.map +1 -1
- package/dist/light-probe-asset-B60_X-yN.js +331 -0
- package/dist/light-probe-asset-B60_X-yN.js.map +1 -0
- package/dist/light-probes-DkYN89Qw.js +284 -0
- package/dist/light-probes-DkYN89Qw.js.map +1 -0
- package/dist/{material-plugin-B-hartHR.js → material-plugin-CiAmriQ_.js} +2 -2
- package/dist/{material-plugin-B-hartHR.js.map → material-plugin-CiAmriQ_.js.map} +1 -1
- package/dist/{post-effect-CuoYvrhb.js → post-effect-CQnlX1RH.js} +2 -2
- package/dist/{post-effect-CuoYvrhb.js.map → post-effect-CQnlX1RH.js.map} +1 -1
- package/dist/{post-effect-compiler-Bps8QbiJ.js → post-effect-compiler-C_7HTHZy.js} +3 -3
- package/dist/{post-effect-compiler-Bps8QbiJ.js.map → post-effect-compiler-C_7HTHZy.js.map} +1 -1
- package/dist/{prefab-overrides-76IhcF-e.d.ts → prefab-overrides-BLQn5yHS.d.ts} +231 -7
- package/dist/prefab-overrides-BLQn5yHS.d.ts.map +1 -0
- package/dist/{prefab-overrides-DGiGTSN-.js → prefab-overrides-DT-wHHAJ.js} +2 -2
- package/dist/{prefab-overrides-DGiGTSN-.js.map → prefab-overrides-DT-wHHAJ.js.map} +1 -1
- package/dist/prefab.d.ts +1 -1
- package/dist/prefab.js +1 -1
- package/dist/{reflection-probe-C0pzGrG_.js → reflection-probe-DlVsl3zJ.js} +3 -3
- package/dist/{reflection-probe-C0pzGrG_.js.map → reflection-probe-DlVsl3zJ.js.map} +1 -1
- package/dist/{reflection-probes-B8_vK9YR.js → reflection-probes-B8S9WnVX.js} +3 -3
- package/dist/{reflection-probes-B8_vK9YR.js.map → reflection-probes-B8S9WnVX.js.map} +1 -1
- package/dist/{render-path-Be7WgN7r.js → render-path-D11i_7X8.js} +3 -2
- package/dist/{render-path-Be7WgN7r.js.map → render-path-D11i_7X8.js.map} +1 -1
- package/dist/{scene-color-passes-DlNr-qyZ.js → scene-color-passes-B93qTOka.js} +35 -12
- package/dist/scene-color-passes-B93qTOka.js.map +1 -0
- package/dist/{shader-material-Cjfq7nFS.js → shader-material-C2_UCYdO.js} +5 -5
- package/dist/{shader-material-Cjfq7nFS.js.map → shader-material-C2_UCYdO.js.map} +1 -1
- package/dist/{shader-material-DCjYDdkh.js → shader-material-CaAkv5nT.js} +2 -2
- package/dist/{shader-material-DCjYDdkh.js.map → shader-material-CaAkv5nT.js.map} +1 -1
- package/dist/{shader-pragma-cjEC-EPK.js → shader-pragma-DmZpxGUo.js} +2 -2
- package/dist/{shader-pragma-cjEC-EPK.js.map → shader-pragma-DmZpxGUo.js.map} +1 -1
- package/dist/{surface-shader-D40hXQ8c.js → surface-shader-BeDRofOV.js} +4 -4
- package/dist/{surface-shader-D40hXQ8c.js.map → surface-shader-BeDRofOV.js.map} +1 -1
- package/package.json +1 -1
- package/dist/ignifx-error-Der0bpHK.js.map +0 -1
- package/dist/prefab-overrides-76IhcF-e.d.ts.map +0 -1
- package/dist/scene-color-passes-DlNr-qyZ.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import { a as CORE_ERROR_MESSAGES, c as THIRD_PARTY_ERROR_PREFIX, i as isIgnifxError, l as isValidErrorCode, n as assertNever, o as CoreErrorCode, r as formatErrorMessage, s as ErrorRange, t as IgnifxError } from "./ignifx-error-
|
|
2
|
-
import { A as vec2, B as readPickedTag, C as layerMask, D as record, E as quat, F as raycastScene, G as toComponentHandle, H as Component, I as raycastSceneWhere, J as assertNoInheritedFieldNames, K as toEntityHandle, L as readOwnerTag, M as vec4, N as FieldKind, O as str, P as createPickRay, R as readPickedIdentity, S as i32, T as optional, U as componentInternals, V as setPickRay, W as INVALID_HANDLE, X as defineSchema, Y as createDefaults, Z as Signal, _ as custom, a as EDITOR_ONLY_METADATA_KEY, b as f32, c as assertRenderTextureSize, d as array, f as asset, g as curve, h as componentRef, j as vec3, k as u32, l as bindFrameCameras, m as color, n as ReflectionProbe, o as RENDER_TEXTURE_MAX_SIZE, p as bool, q as applyInit, s as RenderTextureImpl, t as REFLECTION_PROBE_REFRESH_MODES, u as renderTextureUnusableError, v as entityRef, w as map, x as f64, y as enumOf, z as readPickedMeshName } from "./reflection-probe-
|
|
3
|
-
import { A as asJsonArray, B as normalizeExtension, C as encodeValue, D as indexPath, E as childPath, L as isAbsoluteAddress, M as setOwnJsonProperty, N as SchemaIssueCode, O as isArray, P as issue, R as joinRoot, S as encodeProps, T as VECTOR_COMPONENTS, V as splitFragment, _ as describeSchema, a as SceneAssetToken, b as decodeProps, c as findSceneDependency, d as SCENE_FILE_FORMAT, f as SCENE_FORMAT_VERSION, g as stringifySceneFile, h as sceneFileJsonSchema, i as parseOverridePath, j as asJsonObject, k as isPlainObject, l as SCENE_ASSET_TYPE, m as isSceneFileHeader, n as revertOverrides, o as computeSceneHash, p as describeSceneFileFormat, r as applyOverrides, s as createSceneAsset, t as applyOverridesToAsset, u as SCENE_FILE_EXTENSIONS, v as toJsonSchema, w as COLOR_CHANNELS, x as decodeValue, y as canonicalizeNumber, z as matchExtension } from "./prefab-overrides-
|
|
1
|
+
import { a as CORE_ERROR_MESSAGES, c as THIRD_PARTY_ERROR_PREFIX, i as isIgnifxError, l as isValidErrorCode, n as assertNever, o as CoreErrorCode, r as formatErrorMessage, s as ErrorRange, t as IgnifxError } from "./ignifx-error-B8ByiSfJ.js";
|
|
2
|
+
import { A as vec2, B as readPickedTag, C as layerMask, D as record, E as quat, F as raycastScene, G as toComponentHandle, H as Component, I as raycastSceneWhere, J as assertNoInheritedFieldNames, K as toEntityHandle, L as readOwnerTag, M as vec4, N as FieldKind, O as str, P as createPickRay, R as readPickedIdentity, S as i32, T as optional, U as componentInternals, V as setPickRay, W as INVALID_HANDLE, X as defineSchema, Y as createDefaults, Z as Signal, _ as custom, a as EDITOR_ONLY_METADATA_KEY, b as f32, c as assertRenderTextureSize, d as array, f as asset, g as curve, h as componentRef, j as vec3, k as u32, l as bindFrameCameras, m as color, n as ReflectionProbe, o as RENDER_TEXTURE_MAX_SIZE, p as bool, q as applyInit, s as RenderTextureImpl, t as REFLECTION_PROBE_REFRESH_MODES, u as renderTextureUnusableError, v as entityRef, w as map, x as f64, y as enumOf, z as readPickedMeshName } from "./reflection-probe-DlVsl3zJ.js";
|
|
3
|
+
import { A as asJsonArray, B as normalizeExtension, C as encodeValue, D as indexPath, E as childPath, L as isAbsoluteAddress, M as setOwnJsonProperty, N as SchemaIssueCode, O as isArray, P as issue, R as joinRoot, S as encodeProps, T as VECTOR_COMPONENTS, V as splitFragment, _ as describeSchema, a as SceneAssetToken, b as decodeProps, c as findSceneDependency, d as SCENE_FILE_FORMAT, f as SCENE_FORMAT_VERSION, g as stringifySceneFile, h as sceneFileJsonSchema, i as parseOverridePath, j as asJsonObject, k as isPlainObject, l as SCENE_ASSET_TYPE, m as isSceneFileHeader, n as revertOverrides, o as computeSceneHash, p as describeSceneFileFormat, r as applyOverrides, s as createSceneAsset, t as applyOverridesToAsset, u as SCENE_FILE_EXTENSIONS, v as toJsonSchema, w as COLOR_CHANNELS, x as decodeValue, y as canonicalizeNumber, z as matchExtension } from "./prefab-overrides-DT-wHHAJ.js";
|
|
4
4
|
import { _ as smoothStep, a as clamp, c as deltaAngleDegrees, d as lerpAngleDegrees, f as moveTowards, g as sign, h as repeat, i as approximately, l as inverseLerp, m as radToDeg, n as EPSILON, o as clamp01, p as pingPong, r as RAD_TO_DEG, s as degToRad, t as DEG_TO_RAD, u as lerp, v as wrapAngleDegrees } from "./math-utils-BcDnL-gi.js";
|
|
5
5
|
import { n as Mat4, r as basisToQuatToRef, t as MAT4_IDENTITY } from "./mat4-D6exvAuO.js";
|
|
6
6
|
import { a as localRotation, d as setNodeName, f as setNodeSelfVisible, i as localPosition, l as readWorldMatrix, m as worldMatrixVersion, n as disposeNode, o as localScale, p as tagNode, r as linkParent, s as parentNode, t as createNode, u as reparentKeepingWorld } from "./node-DznSvwap.js";
|
|
7
7
|
import { t as Color } from "./color-DrR6GFTd.js";
|
|
8
|
-
import { a as readSceneImageProcessing, c as setSceneEnvironmentRotation, l as setSceneFog, n as installSceneEnvironment, o as setSceneClearColor, r as loadSceneEnvironment, s as setSceneEnvironmentBlur, t as TONE_MAPPING_NAMES, u as setSceneImageProcessingOptions } from "./environment-
|
|
8
|
+
import { a as readSceneImageProcessing, c as setSceneEnvironmentRotation, l as setSceneFog, n as installSceneEnvironment, o as setSceneClearColor, r as loadSceneEnvironment, s as setSceneEnvironmentBlur, t as TONE_MAPPING_NAMES, u as setSceneImageProcessingOptions } from "./environment-DZ6WUHbm.js";
|
|
9
9
|
import { a as markMaterialDirty, c as setPbrBaseColor, i as createStandardMaterialFromProps, l as setPbrMetallicRoughness, n as createDefaultMaterial, r as createPbrMaterialFromProps, s as setMaterialAlpha, t as MATERIAL_ALPHA_MODES } from "./material-CGk5mAah.js";
|
|
10
10
|
import { A as setMeshReceiveShadows, C as overrideSubtreeMaterials, D as setMeshId, E as setMeshBounds, F as updateMeshPositions$1, I as updateMeshUvs$1, M as setMeshSubtreeVisible, N as updateMeshColors$1, O as setMeshMaterial, P as updateMeshNormals$1, S as disposeMeshTemplate, T as removeMeshFromScene, _ as createMeshFromGeometry, a as VEC3_ONE, b as createTorusMesh, c as VEC3_ZERO, d as cloneMeshUnderNode, f as collectSubtreeMeshes, g as createGroundMesh, h as createCylinderMesh, i as VEC3_LEFT, j as setMeshRenderOrder, k as setMeshPickable, l as Vec3, m as createCapsuleMesh, n as VEC3_DOWN, o as VEC3_RIGHT, p as createBoxMesh, r as VEC3_FORWARD, s as VEC3_UP, t as VEC3_BACKWARD, u as addMeshToScene, v as createPlaneMesh, w as recomputeMeshBounds, x as detachMeshBounds, y as createSphereMesh } from "./vec3-Cc19wl4r.js";
|
|
11
|
-
import { a as
|
|
12
|
-
import { n as
|
|
11
|
+
import { a as LightProbeAsset, c as readLightProbeFile, d as writeLightProbeFile, i as LIGHT_PROBE_FORMAT_VERSION, l as readLightProbeGrid, n as LIGHT_PROBE_FILE_EXTENSIONS, o as createLightProbeAsset, r as LIGHT_PROBE_FILE_FORMAT, t as LIGHT_PROBE_ASSET_TYPE, u as sampleLightProbes } from "./light-probe-asset-B60_X-yN.js";
|
|
12
|
+
import { a as postEffectValuesCodec, i as declaredTextureBinding, n as POST_EFFECT_FUNCTION, r as customEffect, t as POST_EFFECT_BUILTIN_UNIFORMS } from "./post-effect-CQnlX1RH.js";
|
|
13
|
+
import { n as installOffscreenRenderPath } from "./render-path-D11i_7X8.js";
|
|
13
14
|
import { a as SHADER_BLEND_MODES, c as SHADER_KINDS, d as SURFACE_HOOK_NAMES, f as SURFACE_UNIFORM_BLOCK, i as SHADER_ATTRIBUTE_NAMES, l as SHADER_TEXTURE_FALLBACKS, o as SHADER_CULL_MODES, r as LITE_SYSTEM_UNIFORM_NAMES, s as SHADER_INSTANCING_MODES, t as IGNIFX_UNIFORM_NAMES, u as SHADER_UNIFORM_TYPES } from "./shader-declaration-5q__jycG.js";
|
|
14
|
-
import { a as defineMaterialPlugin, i as MATERIAL_PLUGIN_SAMPLER_BUDGET, n as MATERIAL_PLUGIN_DEFAULT_PRIORITY, o as isLiteMaterialPluginPoint, r as MATERIAL_PLUGIN_RESERVED_NAMES, t as LITE_MATERIAL_PLUGIN_POINTS } from "./material-plugin-
|
|
15
|
+
import { a as defineMaterialPlugin, i as MATERIAL_PLUGIN_SAMPLER_BUDGET, n as MATERIAL_PLUGIN_DEFAULT_PRIORITY, o as isLiteMaterialPluginPoint, r as MATERIAL_PLUGIN_RESERVED_NAMES, t as LITE_MATERIAL_PLUGIN_POINTS } from "./material-plugin-CiAmriQ_.js";
|
|
15
16
|
import { acquireTexture, addTask, addToScene, buildFrameGraphTask, captureScreenshot, cloneTransformNode, createBloomPostProcessTask, createCsmDirectionalShadowGenerator, createDirectionalLight, createEngine, createEsmDirectionalShadowGenerator, createFontFromBuffer, createFreeCamera, createGpuPicker, createHemisphericLight, createImageProcessingTask, createMeshFromData, createNullEngine, createPcfDirectionalShadowGenerator, createPcfSpotlightShadowGenerator, createPointLight, createRenderTarget, createSceneContext, createSmaaPostProcessTask, createSpotLight, createStorageBuffer, createTexture2DFromPixels, disableOrthographicCamera, disposeEngine, disposePicker, disposeScene, disposeStorageBuffer, enableBoneControl, enableDeviceLostSceneRecovery, enableMaterialPlugins, enableMaterialStencil, enableOrthographicCamera, enablePbrLightmap, enableSkeletonShadows, enableStandardSkeleton, forceWebGpuDeviceLossForTesting, getEffectiveAspectRatio, getFrameGraph, getProjectionMatrix, getRenderTaskGpuTimings, getViewMatrix, getViewProjectionMatrix, isPbrMaterial, isShaderMaterial, loadTexture2D, onBeforeRender, pickAsync, rebuildSceneRenderables, registerScene, registerSceneWithShadowSupport, releaseTexture, removeFromScene, renderFrame, resizeEngine, resolveCameraViewport, setGpuTimingEnabled, setRenderTaskGpuTimingEnabled, setShadowTaskCasterMeshes, setSubtreeVisible, setSurfaceSize, startEngine, stopEngine, updateStorageBuffer, updateTexture2DFromPixels } from "@babylonjs/lite";
|
|
16
17
|
//#region src/assets/types.ts
|
|
17
18
|
/**
|
|
@@ -3902,7 +3903,7 @@ function createServiceKey(name) {
|
|
|
3902
3903
|
*
|
|
3903
3904
|
* @public
|
|
3904
3905
|
*/
|
|
3905
|
-
const VERSION = "0.
|
|
3906
|
+
const VERSION = "0.18.0";
|
|
3906
3907
|
//#endregion
|
|
3907
3908
|
//#region src/assets/delivery-system.ts
|
|
3908
3909
|
/**
|
|
@@ -5493,7 +5494,7 @@ let surfaceLayer = null;
|
|
|
5493
5494
|
* @internal
|
|
5494
5495
|
*/
|
|
5495
5496
|
async function loadShaderSupport() {
|
|
5496
|
-
const loaded = shaderLayer ?? await import("./shader-material-
|
|
5497
|
+
const loaded = shaderLayer ?? await import("./shader-material-C2_UCYdO.js").then((n) => n.n);
|
|
5497
5498
|
shaderLayer = loaded;
|
|
5498
5499
|
await loaded.loadShaderMaterialAdapter();
|
|
5499
5500
|
return loaded;
|
|
@@ -5516,7 +5517,7 @@ function shaderSupport() {
|
|
|
5516
5517
|
* @internal
|
|
5517
5518
|
*/
|
|
5518
5519
|
async function loadSurfaceShaderSupport() {
|
|
5519
|
-
const loaded = surfaceLayer ?? await import("./surface-shader-
|
|
5520
|
+
const loaded = surfaceLayer ?? await import("./surface-shader-BeDRofOV.js");
|
|
5520
5521
|
surfaceLayer = loaded;
|
|
5521
5522
|
return loaded;
|
|
5522
5523
|
}
|
|
@@ -6693,6 +6694,16 @@ var MeshAsset = class {
|
|
|
6693
6694
|
return this.#isDisposed;
|
|
6694
6695
|
}
|
|
6695
6696
|
/**
|
|
6697
|
+
* The vertex arrays the asset was built from, for CPU-side work such as a light-probe bake.
|
|
6698
|
+
*
|
|
6699
|
+
* @returns The arrays for a mesh built with {@link MeshAsset.fromData}; `null` for a primitive.
|
|
6700
|
+
*
|
|
6701
|
+
* @internal
|
|
6702
|
+
*/
|
|
6703
|
+
get cpuGeometry() {
|
|
6704
|
+
return this.#geometry;
|
|
6705
|
+
}
|
|
6706
|
+
/**
|
|
6696
6707
|
* How many vertices the geometry has.
|
|
6697
6708
|
*
|
|
6698
6709
|
* @remarks
|
|
@@ -8527,6 +8538,69 @@ function toSpotConfig(settings) {
|
|
|
8527
8538
|
return config;
|
|
8528
8539
|
}
|
|
8529
8540
|
//#endregion
|
|
8541
|
+
//#region src/render/gpu/light-probe-host.ts
|
|
8542
|
+
/**
|
|
8543
|
+
* The renderer's handle on light probes (GI B2): it loads the light-probe chunk (`./light-probes.ts`)
|
|
8544
|
+
* the first frame a world has a `LightProbeVolume` and forwards every frame to it. Device-only, like
|
|
8545
|
+
* the rest of `src/render/gpu/`: a headless renderer never creates one.
|
|
8546
|
+
*
|
|
8547
|
+
* @internal
|
|
8548
|
+
*/
|
|
8549
|
+
var LightProbeHost = class {
|
|
8550
|
+
#engine;
|
|
8551
|
+
#scene;
|
|
8552
|
+
#onError;
|
|
8553
|
+
#runtime = null;
|
|
8554
|
+
#isLoading = false;
|
|
8555
|
+
#isDisposed = false;
|
|
8556
|
+
/**
|
|
8557
|
+
* Creates the host; nothing loads until a volume exists.
|
|
8558
|
+
*
|
|
8559
|
+
* @param engine - The engine.
|
|
8560
|
+
* @param scene - The registered render scene.
|
|
8561
|
+
* @param onError - Where a failed chunk load goes.
|
|
8562
|
+
*/
|
|
8563
|
+
constructor(engine, scene, onError) {
|
|
8564
|
+
this.#engine = engine;
|
|
8565
|
+
this.#scene = scene;
|
|
8566
|
+
this.#onError = onError;
|
|
8567
|
+
}
|
|
8568
|
+
/**
|
|
8569
|
+
* Whether the chunk is loaded and a grid lights the scene.
|
|
8570
|
+
*
|
|
8571
|
+
* @returns `true` while a volume's grid is applied to the materials.
|
|
8572
|
+
*/
|
|
8573
|
+
get isLighting() {
|
|
8574
|
+
return this.#runtime?.isLighting === true;
|
|
8575
|
+
}
|
|
8576
|
+
/**
|
|
8577
|
+
* Runs one frame of light-probe work, loading the chunk first when a volume exists.
|
|
8578
|
+
*
|
|
8579
|
+
* @param volumes - Every `LightProbeVolume` in the world.
|
|
8580
|
+
*/
|
|
8581
|
+
update(volumes) {
|
|
8582
|
+
if (this.#runtime !== null) {
|
|
8583
|
+
this.#runtime.update(volumes);
|
|
8584
|
+
return;
|
|
8585
|
+
}
|
|
8586
|
+
if (volumes.length === 0 || this.#isLoading || this.#isDisposed) return;
|
|
8587
|
+
this.#isLoading = true;
|
|
8588
|
+
import("./light-probes-DkYN89Qw.js").then((module) => module.createLightProbeRuntime(this.#engine, this.#scene)).then((created) => {
|
|
8589
|
+
if (this.#isDisposed) {
|
|
8590
|
+
created.dispose();
|
|
8591
|
+
return;
|
|
8592
|
+
}
|
|
8593
|
+
this.#runtime = created;
|
|
8594
|
+
}).catch(this.#onError);
|
|
8595
|
+
}
|
|
8596
|
+
/** Takes the grid off every material and frees it. Idempotent. */
|
|
8597
|
+
dispose() {
|
|
8598
|
+
this.#isDisposed = true;
|
|
8599
|
+
this.#runtime?.dispose();
|
|
8600
|
+
this.#runtime = null;
|
|
8601
|
+
}
|
|
8602
|
+
};
|
|
8603
|
+
//#endregion
|
|
8530
8604
|
//#region src/render/gpu/reflection-probe-host.ts
|
|
8531
8605
|
/**
|
|
8532
8606
|
* The renderer's handle on reflection probes (GI B1): it loads the probe chunk
|
|
@@ -8576,7 +8650,7 @@ var ReflectionProbeHost = class {
|
|
|
8576
8650
|
}
|
|
8577
8651
|
if (probes.length === 0 || this.#isLoading || this.#isDisposed) return;
|
|
8578
8652
|
this.#isLoading = true;
|
|
8579
|
-
import("./reflection-probes-
|
|
8653
|
+
import("./reflection-probes-B8S9WnVX.js").then(async (module) => module.createReflectionProbeRuntime(this.#engine, this.#scene)).then((created) => {
|
|
8580
8654
|
if (this.#isDisposed) {
|
|
8581
8655
|
created.dispose();
|
|
8582
8656
|
return;
|
|
@@ -9643,6 +9717,8 @@ var RendererImpl = class {
|
|
|
9643
9717
|
#ambientOcclusion = null;
|
|
9644
9718
|
/** The reflection probes' host, created on the first frame of a canvas-backed app (GI B1). */
|
|
9645
9719
|
#reflectionProbes = null;
|
|
9720
|
+
/** The light probes' host, created with the reflection probes' one (GI B2). */
|
|
9721
|
+
#lightProbes = null;
|
|
9646
9722
|
/** The TAA passes (`../lite/gpu/taa.ts`), when `rendering.taa` installed them. */
|
|
9647
9723
|
#taa = null;
|
|
9648
9724
|
#defaultMaterial = null;
|
|
@@ -10472,28 +10548,31 @@ var RendererImpl = class {
|
|
|
10472
10548
|
this.#ambientOcclusion?.update(this.#isSceneRegistered);
|
|
10473
10549
|
}
|
|
10474
10550
|
/**
|
|
10475
|
-
* The
|
|
10476
|
-
*
|
|
10477
|
-
*
|
|
10478
|
-
* on a headless
|
|
10551
|
+
* The baked-lighting components' per-frame work (GI Phase 2): `ReflectionProbe` (B1) captures
|
|
10552
|
+
* what is due and points each lit PBR material at its probe; `LightProbeVolume` (B2) keeps the
|
|
10553
|
+
* winning grid on every lit PBR material. Each loads its own chunk the first time a world has one
|
|
10554
|
+
* of its components. The `PreRender` system calls it every frame; it does nothing on a headless
|
|
10555
|
+
* app.
|
|
10479
10556
|
*
|
|
10480
10557
|
* @param world - The world being reconciled.
|
|
10481
10558
|
* @param probes - Every `ReflectionProbe` in it.
|
|
10559
|
+
* @param volumes - Every `LightProbeVolume` in it.
|
|
10482
10560
|
*
|
|
10483
10561
|
* @internal
|
|
10484
10562
|
*/
|
|
10485
|
-
|
|
10486
|
-
if (!this.isHeadless) this.#
|
|
10563
|
+
updateBakedLighting(world, probes, volumes) {
|
|
10564
|
+
if (!this.isHeadless) this.#updateBakedLighting(world, probes, volumes);
|
|
10487
10565
|
}
|
|
10488
10566
|
/**
|
|
10489
|
-
* {@link RendererImpl.
|
|
10567
|
+
* {@link RendererImpl.updateBakedLighting} on a canvas-backed app.
|
|
10490
10568
|
*
|
|
10491
10569
|
* @param world - The world being reconciled.
|
|
10492
10570
|
* @param probes - Every `ReflectionProbe` in it.
|
|
10571
|
+
* @param volumes - Every `LightProbeVolume` in it.
|
|
10493
10572
|
*/
|
|
10494
|
-
#
|
|
10573
|
+
#updateBakedLighting(world, probes, volumes) {
|
|
10495
10574
|
if (this.#isDisposed || !this.#isSceneRegistered) return;
|
|
10496
|
-
|
|
10575
|
+
const onError = (error) => {
|
|
10497
10576
|
this.#app.onError.emit({
|
|
10498
10577
|
error,
|
|
10499
10578
|
source: "system",
|
|
@@ -10501,8 +10580,21 @@ var RendererImpl = class {
|
|
|
10501
10580
|
entity: null,
|
|
10502
10581
|
component: null
|
|
10503
10582
|
});
|
|
10504
|
-
}
|
|
10583
|
+
};
|
|
10584
|
+
this.#reflectionProbes ??= new ReflectionProbeHost(this.engine, this.scene, onError);
|
|
10585
|
+
this.#lightProbes ??= new LightProbeHost(this.engine, this.scene, onError);
|
|
10505
10586
|
this.#reflectionProbes.update(world, probes, (this.#presenter?.hdr ?? null) !== null);
|
|
10587
|
+
this.#lightProbes.update(volumes);
|
|
10588
|
+
}
|
|
10589
|
+
/**
|
|
10590
|
+
* The light probes' host, for tests and diagnostics.
|
|
10591
|
+
*
|
|
10592
|
+
* @returns The host, or `null` on a headless app and before the first frame.
|
|
10593
|
+
*
|
|
10594
|
+
* @internal
|
|
10595
|
+
*/
|
|
10596
|
+
get lightProbeHost() {
|
|
10597
|
+
return this.#lightProbes;
|
|
10506
10598
|
}
|
|
10507
10599
|
/**
|
|
10508
10600
|
* The reflection probes' host, for tests and diagnostics.
|
|
@@ -10751,6 +10843,8 @@ var RendererImpl = class {
|
|
|
10751
10843
|
this.#ambientOcclusion = null;
|
|
10752
10844
|
this.#reflectionProbes?.dispose();
|
|
10753
10845
|
this.#reflectionProbes = null;
|
|
10846
|
+
this.#lightProbes?.dispose();
|
|
10847
|
+
this.#lightProbes = null;
|
|
10754
10848
|
this.#sceneInputsHost?.dispose();
|
|
10755
10849
|
this.#sceneInputsHost = null;
|
|
10756
10850
|
this.#taa = null;
|
|
@@ -11320,6 +11414,70 @@ function instancedMeshRendererSchema() {
|
|
|
11320
11414
|
});
|
|
11321
11415
|
}
|
|
11322
11416
|
//#endregion
|
|
11417
|
+
//#region src/render/light-probe-volume.ts
|
|
11418
|
+
/**
|
|
11419
|
+
* Lights PBR materials with a baked light-probe grid instead of the scene environment's diffuse
|
|
11420
|
+
* light (`docs/plan/2026-11-gi-phase-2-execution-plan.md`, step B2).
|
|
11421
|
+
*
|
|
11422
|
+
* @remarks
|
|
11423
|
+
* Every lit PBR material samples the grid per pixel, blending the eight probes around it, so moving
|
|
11424
|
+
* objects and shared materials need nothing extra. Outside the grid the nearest edge probes apply.
|
|
11425
|
+
* Reflections still come from the `Environment` or a `ReflectionProbe`. With a `PostProcessStack`'s
|
|
11426
|
+
* `ssgi` on, the diffuse term is `P − (1 − environmentDiffuse)·E` (probes `P`, environment `E`),
|
|
11427
|
+
* because SSGI's discount applies to the environment and the probes replace it after. The volume needs a loaded
|
|
11428
|
+
* `Environment` and a canvas; its GPU code loads only once a world has one, and headless it does
|
|
11429
|
+
* nothing. When several volumes are enabled, the most recently created one wins.
|
|
11430
|
+
*
|
|
11431
|
+
* @example
|
|
11432
|
+
* ```ts
|
|
11433
|
+
* const probes = await app.assets.loadAsync<LightProbeAsset>("lighting/hall.probes.json");
|
|
11434
|
+
* world.createEntity("Probes").addComponent(LightProbeVolume, { probes });
|
|
11435
|
+
* ```
|
|
11436
|
+
*
|
|
11437
|
+
* @beta
|
|
11438
|
+
*/
|
|
11439
|
+
var LightProbeVolume = class LightProbeVolume extends Component {
|
|
11440
|
+
/** The namespaced registration id. */
|
|
11441
|
+
static typeId = "ignifx/LightProbeVolume";
|
|
11442
|
+
/** What the component does, in one line, for an inspector. */
|
|
11443
|
+
static description = "Lights PBR materials with a baked light-probe grid instead of the environment's diffuse light.";
|
|
11444
|
+
/** One volume per entity. */
|
|
11445
|
+
static allowMultiple = false;
|
|
11446
|
+
/** The serialized field declarations (ADR-0004). */
|
|
11447
|
+
static schema = lightProbeVolumeSchema();
|
|
11448
|
+
/** Applies the schema defaults, exactly as `Component.define` would. */
|
|
11449
|
+
constructor() {
|
|
11450
|
+
super();
|
|
11451
|
+
Object.assign(this, createDefaults(LightProbeVolume.schema));
|
|
11452
|
+
}
|
|
11453
|
+
/**
|
|
11454
|
+
* The grid this volume lights with right now.
|
|
11455
|
+
*
|
|
11456
|
+
* @returns The loaded asset, or `null` while there is none or it is still loading.
|
|
11457
|
+
*
|
|
11458
|
+
* @internal
|
|
11459
|
+
*/
|
|
11460
|
+
loadedProbes() {
|
|
11461
|
+
const handle = this.probes;
|
|
11462
|
+
return handle !== null && handle.state === "loaded" ? handle.value : null;
|
|
11463
|
+
}
|
|
11464
|
+
};
|
|
11465
|
+
/**
|
|
11466
|
+
* Builds the component's declared fields.
|
|
11467
|
+
*
|
|
11468
|
+
* @returns The schema. Built inside a function: module scope holds declarations and immutable
|
|
11469
|
+
* constants only (`CONSTITUTION.md` §3.5).
|
|
11470
|
+
*/
|
|
11471
|
+
function lightProbeVolumeSchema() {
|
|
11472
|
+
return defineSchema({
|
|
11473
|
+
probes: asset(LightProbeAsset, { tooltip: "The baked .probes.json grid." }),
|
|
11474
|
+
intensity: f32(1, {
|
|
11475
|
+
min: 0,
|
|
11476
|
+
tooltip: "A multiplier on the probes' light."
|
|
11477
|
+
})
|
|
11478
|
+
});
|
|
11479
|
+
}
|
|
11480
|
+
//#endregion
|
|
11323
11481
|
//#region src/lite/light.ts
|
|
11324
11482
|
/**
|
|
11325
11483
|
* Creates a directional light in world space, pointing along `+Z` until it is posed.
|
|
@@ -12736,6 +12894,25 @@ function createFontLoader() {
|
|
|
12736
12894
|
};
|
|
12737
12895
|
}
|
|
12738
12896
|
//#endregion
|
|
12897
|
+
//#region src/render/loaders/light-probe-loader.ts
|
|
12898
|
+
/**
|
|
12899
|
+
* Builds the loader for `.probes.json` light-probe grids (GI Phase 2, step B2). It needs no device,
|
|
12900
|
+
* so a grid loads in Node too.
|
|
12901
|
+
*
|
|
12902
|
+
* @returns The loader to register with `ctx.registerAssetLoader`.
|
|
12903
|
+
*
|
|
12904
|
+
* @beta
|
|
12905
|
+
*/
|
|
12906
|
+
function createLightProbeLoader() {
|
|
12907
|
+
return {
|
|
12908
|
+
type: LIGHT_PROBE_ASSET_TYPE,
|
|
12909
|
+
extensions: LIGHT_PROBE_FILE_EXTENSIONS,
|
|
12910
|
+
async load(ctx) {
|
|
12911
|
+
return new LightProbeAsset(readLightProbeFile(await ctx.fetchJson(), ctx.address));
|
|
12912
|
+
}
|
|
12913
|
+
};
|
|
12914
|
+
}
|
|
12915
|
+
//#endregion
|
|
12739
12916
|
//#region src/render/shader-material-definition.ts
|
|
12740
12917
|
/**
|
|
12741
12918
|
* Builds a `"shader"` material declaration, recording the addresses of the handles it is given.
|
|
@@ -13959,6 +14136,44 @@ function assertDecoderIncluded(app, address, group) {
|
|
|
13959
14136
|
throw decoderLeftOut(address, group);
|
|
13960
14137
|
}
|
|
13961
14138
|
/**
|
|
14139
|
+
* Throws `IGX-0509` for a `.basis` texture in a project that serves its own decoders, before
|
|
14140
|
+
* anything is fetched.
|
|
14141
|
+
*
|
|
14142
|
+
* @remarks
|
|
14143
|
+
* Lite 1.34's `loadBasisTexture2D` fetches `basis_transcoder.js` and its WebAssembly from
|
|
14144
|
+
* `cdn.babylonjs.com` and has no setter for the location (`lib/texture/basis-loader.js`), so the
|
|
14145
|
+
* transcoder cannot be served locally like the KTX2 decoder. A manifest that lists the KTX2 decoder
|
|
14146
|
+
* comes from `@ignifx/vite-plugin`, whose builds load no code from a network host and whose
|
|
14147
|
+
* packaged games refuse other origins (`script-src 'self'`); there a `.basis` file fails here, with
|
|
14148
|
+
* a message that says to convert it to `.ktx2`. Elsewhere Lite still tries its CDN, and the texture
|
|
14149
|
+
* loader turns a refused script into the same error.
|
|
14150
|
+
*
|
|
14151
|
+
* @param app - The app whose manifest to read.
|
|
14152
|
+
* @param address - The texture being loaded, for the message.
|
|
14153
|
+
* @throws An {@link IgnifxError} with code `IGX-0509` when the manifest lists the KTX2 decoder.
|
|
14154
|
+
*
|
|
14155
|
+
* @internal
|
|
14156
|
+
*/
|
|
14157
|
+
function assertBasisLoadable(app, address) {
|
|
14158
|
+
if (app.assets.manifest.entries.some((entry) => entry.address === "babylon.ktx2Decoder.js")) throw basisTranscoderRemote(address);
|
|
14159
|
+
}
|
|
14160
|
+
/**
|
|
14161
|
+
* Builds the `IGX-0509` error.
|
|
14162
|
+
*
|
|
14163
|
+
* @param address - The `.basis` texture being loaded.
|
|
14164
|
+
* @param cause - What Lite's load failed with, when it got that far.
|
|
14165
|
+
* @returns The error to throw.
|
|
14166
|
+
*
|
|
14167
|
+
* @internal
|
|
14168
|
+
*/
|
|
14169
|
+
function basisTranscoderRemote(address, cause) {
|
|
14170
|
+
return new IgnifxError(CoreErrorCode.basisTranscoderRemote, `${address} is a .basis texture, whose transcoder Babylon Lite loads only from cdn.babylonjs.com, which ignifx does not load code from: convert it to .ktx2.`, {
|
|
14171
|
+
context: { asset: address },
|
|
14172
|
+
hint: "Re-encode the texture as .ktx2 (for example `basisu -ktx2 texture.png`). It holds the same Basis payload, and its decoder ships with @ignifx/core.",
|
|
14173
|
+
...cause === void 0 ? {} : { cause }
|
|
14174
|
+
});
|
|
14175
|
+
}
|
|
14176
|
+
/**
|
|
13962
14177
|
* Throws `IGX-0508` when a glTF file uses an extension whose decoder the build left out. The check
|
|
13963
14178
|
* reads the file's `extensionsUsed` only when the manifest marks some decoder as left out.
|
|
13964
14179
|
*
|
|
@@ -14285,7 +14500,7 @@ let effectLayer = null;
|
|
|
14285
14500
|
* @internal
|
|
14286
14501
|
*/
|
|
14287
14502
|
async function loadPostEffectSupport() {
|
|
14288
|
-
const [compiler, effects] = await Promise.all([compilerLayer ?? import("./post-effect-compiler-
|
|
14503
|
+
const [compiler, effects] = await Promise.all([compilerLayer ?? import("./post-effect-compiler-C_7HTHZy.js"), effectLayer ?? import("./effect-task-CMbuO6Kb.js")]);
|
|
14289
14504
|
compilerLayer = compiler;
|
|
14290
14505
|
effectLayer = effects;
|
|
14291
14506
|
}
|
|
@@ -14423,7 +14638,7 @@ function createShaderLoader() {
|
|
|
14423
14638
|
type: SHADER_ASSET_TYPE,
|
|
14424
14639
|
extensions: SHADER_FILE_EXTENSIONS,
|
|
14425
14640
|
async load(ctx) {
|
|
14426
|
-
const [source, pragma] = await Promise.all([ctx.fetchText(), import("./shader-pragma-
|
|
14641
|
+
const [source, pragma] = await Promise.all([ctx.fetchText(), import("./shader-pragma-DmZpxGUo.js")]);
|
|
14427
14642
|
const declaration = pragma.parseShaderDeclaration(source, ctx.address);
|
|
14428
14643
|
await loadShaderSupport();
|
|
14429
14644
|
if (declaration.kind === "surface") await loadSurfaceShaderSupport();
|
|
@@ -15048,7 +15263,8 @@ function readString$1(block, key, fallback) {
|
|
|
15048
15263
|
*
|
|
15049
15264
|
* `.png`, `.jpg`, `.jpeg` and `.webp` go to `loadTexture2D` and the browser's image decoder.
|
|
15050
15265
|
* `.ktx2` goes to Lite's KTX2 loader and `.basis` to its Basis loader, which transcode to the
|
|
15051
|
-
* device's best compressed format (`
|
|
15266
|
+
* device's best compressed format (a `.basis` file fails with `IGX-0509` wherever Lite's CDN-only
|
|
15267
|
+
* transcoder cannot load, see `assertBasisLoadable`) (`src/lite/gpu/decoders.ts` lists the targets); handing either
|
|
15052
15268
|
* to `createImageBitmap` fails with "The source image could not be decoded". The asset type stays
|
|
15053
15269
|
* `texture` for all six, so the choice is made here, from the address's extension — the one name a
|
|
15054
15270
|
* manifest entry, a hashed build URL and a hand-written `{ type: "texture" }` load all keep. Before
|
|
@@ -15088,10 +15304,11 @@ function createTextureLoader() {
|
|
|
15088
15304
|
const options = readTextureImportOptions(ctx.meta);
|
|
15089
15305
|
const container = textureContainerOf(ctx.address, ctx.url);
|
|
15090
15306
|
if (container === "ktx2") assertDecoderIncluded(ctx.app, ctx.address, "ktx2");
|
|
15307
|
+
if (container === "basis") assertBasisLoadable(ctx.app, ctx.address);
|
|
15091
15308
|
if (ctx.app.isHeadless) return new TextureAsset(ctx.address, null, options);
|
|
15092
15309
|
ctx.reportProgress(0);
|
|
15093
15310
|
if (container !== "image") await configureDecoders(ctx.app);
|
|
15094
|
-
const texture = await loadByContainer(container, ctx.lite.engine, ctx.url, toLiteTextureOptions(options));
|
|
15311
|
+
const texture = await loadByContainer(container, ctx.address, ctx.lite.engine, ctx.url, toLiteTextureOptions(options));
|
|
15095
15312
|
ctx.reportProgress(1);
|
|
15096
15313
|
return new TextureAsset(ctx.address, texture, options);
|
|
15097
15314
|
},
|
|
@@ -15141,14 +15358,18 @@ function textureContainerOf(address, url) {
|
|
|
15141
15358
|
* Loads a texture with the Lite loader its container needs.
|
|
15142
15359
|
*
|
|
15143
15360
|
* @param container - What the file is.
|
|
15361
|
+
* @param address - The asset address, for an error.
|
|
15144
15362
|
* @param engine - The engine that owns the GPU texture.
|
|
15145
15363
|
* @param url - Where to fetch it from.
|
|
15146
15364
|
* @param options - Lite's texture options, from the sidecar.
|
|
15147
15365
|
* @returns The texture.
|
|
15148
15366
|
*/
|
|
15149
|
-
function loadByContainer(container, engine, url, options) {
|
|
15367
|
+
function loadByContainer(container, address, engine, url, options) {
|
|
15150
15368
|
if (container === "ktx2") return loadKtx2Texture(engine, url, options);
|
|
15151
|
-
if (container === "basis") return loadBasisTexture(engine, url, options)
|
|
15369
|
+
if (container === "basis") return loadBasisTexture(engine, url, options).catch((error) => {
|
|
15370
|
+
if (error instanceof Error && error.message.startsWith("Basis: failed to load")) throw basisTranscoderRemote(address, error);
|
|
15371
|
+
throw error;
|
|
15372
|
+
});
|
|
15152
15373
|
return loadTexture(engine, url, options);
|
|
15153
15374
|
}
|
|
15154
15375
|
//#endregion
|
|
@@ -16898,7 +17119,7 @@ var ScreenSpaceEffects = class {
|
|
|
16898
17119
|
async #build(renderer, contact, ssgi, generation) {
|
|
16899
17120
|
const [inputs, wiring, contactModule, ssgiModule] = await Promise.all([
|
|
16900
17121
|
renderer.acquireSceneInputs(),
|
|
16901
|
-
import("./scene-color-passes-
|
|
17122
|
+
import("./scene-color-passes-B93qTOka.js"),
|
|
16902
17123
|
contact === null ? null : import("./contact-shadows-T523EXaP.js"),
|
|
16903
17124
|
ssgi === null ? null : import("./ssgi-Dm-maZrc.js")
|
|
16904
17125
|
]);
|
|
@@ -17601,7 +17822,7 @@ var RenderSyncSystem = class {
|
|
|
17601
17822
|
topologyChanged = this.#applyEnvironment(world) || topologyChanged;
|
|
17602
17823
|
renderer.refreshClearColor();
|
|
17603
17824
|
renderer.updateAmbientOcclusion();
|
|
17604
|
-
renderer.
|
|
17825
|
+
renderer.updateBakedLighting(world, world.components(ReflectionProbe), world.components(LightProbeVolume));
|
|
17605
17826
|
this.#applyStacks(world);
|
|
17606
17827
|
this.#areCastersDirty = this.#areCastersDirty || castersChanged;
|
|
17607
17828
|
if (renderer.materialCacheResets.unconfirmed && !this.#isRebuildDue && !renderer.isRebuildInFlight) this.#rebuildRenderables();
|
|
@@ -21311,7 +21532,7 @@ var TweenChannel = class {
|
|
|
21311
21532
|
this.key = key;
|
|
21312
21533
|
this.kind = kind;
|
|
21313
21534
|
this.assigns = assigns;
|
|
21314
|
-
read(destination, this.to);
|
|
21535
|
+
read$1(destination, this.to);
|
|
21315
21536
|
}
|
|
21316
21537
|
/**
|
|
21317
21538
|
* Latches the starting value. Called when the tween's delay elapses, not when it is created, so a
|
|
@@ -21321,7 +21542,7 @@ var TweenChannel = class {
|
|
|
21321
21542
|
*/
|
|
21322
21543
|
capture(target) {
|
|
21323
21544
|
const current = readField(target, this.key);
|
|
21324
|
-
if (current !== void 0) read(current, this.from);
|
|
21545
|
+
if (current !== void 0) read$1(current, this.from);
|
|
21325
21546
|
}
|
|
21326
21547
|
/**
|
|
21327
21548
|
* Writes the interpolated value at `t`.
|
|
@@ -21410,7 +21631,7 @@ function slerpInto(a, b, t, out) {
|
|
|
21410
21631
|
* @param value - The number or vector-like value.
|
|
21411
21632
|
* @param out - The scratch to fill.
|
|
21412
21633
|
*/
|
|
21413
|
-
function read(value, out) {
|
|
21634
|
+
function read$1(value, out) {
|
|
21414
21635
|
if (typeof value === "number") {
|
|
21415
21636
|
out.x = value;
|
|
21416
21637
|
return;
|
|
@@ -22110,7 +22331,8 @@ function registerRendering(ctx) {
|
|
|
22110
22331
|
Model,
|
|
22111
22332
|
Environment,
|
|
22112
22333
|
PostProcessStack,
|
|
22113
|
-
ReflectionProbe
|
|
22334
|
+
ReflectionProbe,
|
|
22335
|
+
LightProbeVolume
|
|
22114
22336
|
]);
|
|
22115
22337
|
ctx.registerAssetLoader(createTextureLoader());
|
|
22116
22338
|
ctx.registerAssetLoader(createModelLoader());
|
|
@@ -22118,6 +22340,7 @@ function registerRendering(ctx) {
|
|
|
22118
22340
|
ctx.registerAssetLoader(createEnvironmentLoader());
|
|
22119
22341
|
ctx.registerAssetLoader(createFontLoader());
|
|
22120
22342
|
ctx.registerAssetLoader(createShaderLoader());
|
|
22343
|
+
ctx.registerAssetLoader(createLightProbeLoader());
|
|
22121
22344
|
ctx.registerAssetLoader({
|
|
22122
22345
|
type: STORAGE_BUFFER_ASSET_TYPE,
|
|
22123
22346
|
extensions: [],
|
|
@@ -24293,7 +24516,7 @@ async function createRenderEngine(canvas, options, features) {
|
|
|
24293
24516
|
if (hdr) {
|
|
24294
24517
|
const knobs = features.autoExposure ?? null;
|
|
24295
24518
|
const exposure = knobs === null ? null : await import("./auto-exposure-uzPn0beO.js");
|
|
24296
|
-
presenter = (await import("./hdr-output-
|
|
24519
|
+
presenter = (await import("./hdr-output-Dbv0lhFl.js")).installHdrRenderPath(engine, scene, exposure === null || knobs === null ? void 0 : (hdrTexture) => exposure.installAutoExposure(engine, scene, hdrTexture, knobs));
|
|
24297
24520
|
} else if (offscreen) presenter = installOffscreenRenderPath(engine, scene);
|
|
24298
24521
|
return {
|
|
24299
24522
|
engine,
|
|
@@ -32857,6 +33080,524 @@ var Vec4 = class Vec4 {
|
|
|
32857
33080
|
}
|
|
32858
33081
|
};
|
|
32859
33082
|
//#endregion
|
|
33083
|
+
//#region src/render/light-probe-bake.ts
|
|
33084
|
+
/**
|
|
33085
|
+
* The CPU light-probe bake (`docs/plan/2026-11-gi-phase-2-execution-plan.md`, step B4): one bounce
|
|
33086
|
+
* of diffuse light, needing no device, so it runs headless, in a tool, or in a test.
|
|
33087
|
+
*
|
|
33088
|
+
* - **Geometry.** Triangles of every enabled `MeshRenderer` whose mesh was built with
|
|
33089
|
+
* `MeshAsset.fromData`, moved to world space. Primitives and glTF models keep their triangles on
|
|
33090
|
+
* the GPU side only and are skipped; {@link LightProbeBakeResult.skipped} counts them.
|
|
33091
|
+
* - **Per probe.** `rays` directions on a Fibonacci sphere. A hit returns the surface's albedo (the
|
|
33092
|
+
* material's base or diffuse colour, decoded to linear) times the direct light there, with a
|
|
33093
|
+
* shadow ray per directional, point or spot light and the hemispheric lights unshadowed. A miss
|
|
33094
|
+
* returns `sky` plus the hemispheric lights. Directional, point and spot lights the probe sees are
|
|
33095
|
+
* added exactly, as clamped-cosine lobes. Spot cones are ignored.
|
|
33096
|
+
* - **Units.** Lite's: a white surface lit by the result shows `c0 + c1·n.y + c2·n.z + c3·n.x`, so a
|
|
33097
|
+
* uniform sky of radiance `L` bakes to `c0 = L`, and a directional light of intensity `I` to
|
|
33098
|
+
* `c0 = I/4` and a first-order term of `I/2` along its direction.
|
|
33099
|
+
*/
|
|
33100
|
+
/** The basis factors: `Y00² · 4π` is 1 and `(2/3) · Y1m² · 4π` is 2, per sample. */
|
|
33101
|
+
const BAND1_PER_SAMPLE = 2;
|
|
33102
|
+
/** How far a shadow or bounce ray starts off the surface, in metres. */
|
|
33103
|
+
const SURFACE_OFFSET = .001;
|
|
33104
|
+
/** The golden angle, `π·(3 − √5)` radians, for the Fibonacci sphere. */
|
|
33105
|
+
const GOLDEN_ANGLE = 2.399963229728653;
|
|
33106
|
+
/** The most rays one probe may trace. */
|
|
33107
|
+
const MAX_RAYS = 4096;
|
|
33108
|
+
/**
|
|
33109
|
+
* Bakes a light-probe grid from a world's mesh renderers and lights, on the CPU.
|
|
33110
|
+
*
|
|
33111
|
+
* @remarks
|
|
33112
|
+
* One bounce, first-order harmonics, deterministic. Only meshes built with `MeshAsset.fromData`
|
|
33113
|
+
* cast and bounce light (see {@link LightProbeBakeResult.skipped}). Cost grows with probes × rays ×
|
|
33114
|
+
* triangles; it is meant for small scenes and tools, not for every frame.
|
|
33115
|
+
*
|
|
33116
|
+
* The bake is asynchronous: it yields to the host after each probe, reports progress through
|
|
33117
|
+
* `onProgress`, and stops at the next probe once `signal` aborts.
|
|
33118
|
+
*
|
|
33119
|
+
* @param world - The world to bake. Its meshes and lights are read once, when the bake starts.
|
|
33120
|
+
* @param options - The grid, the quality, and the cancellation and progress hooks.
|
|
33121
|
+
* @returns The grid and what was traced.
|
|
33122
|
+
* @throws IgnifxError with code `IGX-0734`, before tracing anything, for a grid the `.probes.json`
|
|
33123
|
+
* format cannot hold (whole counts, `counts.x` ≤ 1024, `counts.y × counts.z` ≤ 4096, finite
|
|
33124
|
+
* `origin` and positive `cellSize`), `rays` outside 1–4096, or a `maxDistance` that is not finite
|
|
33125
|
+
* and positive. The promise rejects with `signal.reason` when the bake is aborted.
|
|
33126
|
+
*
|
|
33127
|
+
* @example
|
|
33128
|
+
* ```ts
|
|
33129
|
+
* const baked = await bakeLightProbes(world, {
|
|
33130
|
+
* origin: { x: -4, y: 0.5, z: -4 },
|
|
33131
|
+
* cellSize: { x: 2, y: 2, z: 2 },
|
|
33132
|
+
* counts: { x: 5, y: 2, z: 5 },
|
|
33133
|
+
* });
|
|
33134
|
+
* world.createEntity("Probes").addComponent(LightProbeVolume, { probes: createLightProbeAsset(app, baked.data) });
|
|
33135
|
+
* ```
|
|
33136
|
+
*
|
|
33137
|
+
* @beta
|
|
33138
|
+
*/
|
|
33139
|
+
async function bakeLightProbes(world, options) {
|
|
33140
|
+
const settings = readBakeOptions(options);
|
|
33141
|
+
options.signal?.throwIfAborted();
|
|
33142
|
+
const { scene, skipped } = collectTriangles(world);
|
|
33143
|
+
const lights = collectLights(world);
|
|
33144
|
+
const { origin, cellSize, counts } = settings.grid;
|
|
33145
|
+
const total = counts.x * counts.y * counts.z;
|
|
33146
|
+
const coefficients = [];
|
|
33147
|
+
for (let probe = 0; probe < total; probe += 1) {
|
|
33148
|
+
const i = probe % counts.x;
|
|
33149
|
+
const j = Math.floor(probe / counts.x) % counts.y;
|
|
33150
|
+
const k = Math.floor(probe / (counts.x * counts.y));
|
|
33151
|
+
coefficients.push(...bakeProbe(scene, lights, origin.x + i * cellSize.x, origin.y + j * cellSize.y, origin.z + k * cellSize.z, settings));
|
|
33152
|
+
options.onProgress?.(probe + 1, total);
|
|
33153
|
+
await yieldToHost();
|
|
33154
|
+
options.signal?.throwIfAborted();
|
|
33155
|
+
}
|
|
33156
|
+
return {
|
|
33157
|
+
data: {
|
|
33158
|
+
origin,
|
|
33159
|
+
cellSize,
|
|
33160
|
+
counts,
|
|
33161
|
+
coefficients
|
|
33162
|
+
},
|
|
33163
|
+
triangles: scene.count,
|
|
33164
|
+
skipped
|
|
33165
|
+
};
|
|
33166
|
+
}
|
|
33167
|
+
/**
|
|
33168
|
+
* Checks a bake's options before any work.
|
|
33169
|
+
*
|
|
33170
|
+
* @param options - The options.
|
|
33171
|
+
* @returns The checked settings.
|
|
33172
|
+
* @throws IgnifxError with code `IGX-0734` naming the first problem.
|
|
33173
|
+
*/
|
|
33174
|
+
function readBakeOptions(options) {
|
|
33175
|
+
const grid = readLightProbeGrid({
|
|
33176
|
+
origin: options.origin,
|
|
33177
|
+
cellSize: options.cellSize,
|
|
33178
|
+
counts: options.counts
|
|
33179
|
+
});
|
|
33180
|
+
if (typeof grid === "string") throw fail(grid);
|
|
33181
|
+
const rays = options.rays ?? 128;
|
|
33182
|
+
if (!Number.isSafeInteger(rays) || rays < 1 || rays > MAX_RAYS) throw fail(`rays must be a whole number from 1 to ${String(MAX_RAYS)}`);
|
|
33183
|
+
const maxDistance = options.maxDistance ?? 100;
|
|
33184
|
+
if (!Number.isFinite(maxDistance) || maxDistance <= 0) throw fail("maxDistance must be a finite number above 0");
|
|
33185
|
+
return {
|
|
33186
|
+
grid,
|
|
33187
|
+
rays,
|
|
33188
|
+
maxDistance,
|
|
33189
|
+
sky: linearRgb(options.sky ?? {
|
|
33190
|
+
r: 0,
|
|
33191
|
+
g: 0,
|
|
33192
|
+
b: 0,
|
|
33193
|
+
a: 1
|
|
33194
|
+
}, false)
|
|
33195
|
+
};
|
|
33196
|
+
}
|
|
33197
|
+
/**
|
|
33198
|
+
* The error for a bake option.
|
|
33199
|
+
*
|
|
33200
|
+
* @param problem - What is wrong.
|
|
33201
|
+
* @returns The error.
|
|
33202
|
+
*/
|
|
33203
|
+
function fail(problem) {
|
|
33204
|
+
return new IgnifxError(CoreErrorCode.invalidLightProbeBake, `bakeLightProbes(): ${problem}.`, { context: { problem } });
|
|
33205
|
+
}
|
|
33206
|
+
/**
|
|
33207
|
+
* Lets the host run before the next probe.
|
|
33208
|
+
*
|
|
33209
|
+
* @returns A promise that settles on a later task.
|
|
33210
|
+
*/
|
|
33211
|
+
function yieldToHost() {
|
|
33212
|
+
return new Promise((resolve) => {
|
|
33213
|
+
setTimeout(resolve, 0);
|
|
33214
|
+
});
|
|
33215
|
+
}
|
|
33216
|
+
/**
|
|
33217
|
+
* Bakes one probe.
|
|
33218
|
+
*
|
|
33219
|
+
* @param scene - The triangles.
|
|
33220
|
+
* @param lights - The lights.
|
|
33221
|
+
* @param px - The probe's world X.
|
|
33222
|
+
* @param py - The probe's world Y.
|
|
33223
|
+
* @param pz - The probe's world Z.
|
|
33224
|
+
* @param settings - The checked options.
|
|
33225
|
+
* @returns Its 12 coefficients.
|
|
33226
|
+
*/
|
|
33227
|
+
function bakeProbe(scene, lights, px, py, pz, settings) {
|
|
33228
|
+
const { rays, maxDistance, sky } = settings;
|
|
33229
|
+
const hit = {
|
|
33230
|
+
distance: 0,
|
|
33231
|
+
nx: 0,
|
|
33232
|
+
ny: 0,
|
|
33233
|
+
nz: 0,
|
|
33234
|
+
triangle: -1
|
|
33235
|
+
};
|
|
33236
|
+
const radiance = [
|
|
33237
|
+
0,
|
|
33238
|
+
0,
|
|
33239
|
+
0
|
|
33240
|
+
];
|
|
33241
|
+
const sh = Array.from({ length: 12 }, () => 0);
|
|
33242
|
+
for (let ray = 0; ray < rays; ray += 1) {
|
|
33243
|
+
const [dx, dy, dz] = fibonacciDirection(ray, rays);
|
|
33244
|
+
if (trace(scene, px, py, pz, dx, dy, dz, maxDistance, hit)) shadeHit(scene, lights, hit, px + dx * hit.distance, py + dy * hit.distance, pz + dz * hit.distance, radiance);
|
|
33245
|
+
else missRadiance(lights, sky, dx, dy, dz, radiance);
|
|
33246
|
+
for (let channel = 0; channel < 3; channel += 1) {
|
|
33247
|
+
const value = read(radiance, channel);
|
|
33248
|
+
sh[channel] = read(sh, channel) + value / rays;
|
|
33249
|
+
sh[3 + channel] = read(sh, 3 + channel) + BAND1_PER_SAMPLE * value * dy / rays;
|
|
33250
|
+
sh[6 + channel] = read(sh, 6 + channel) + BAND1_PER_SAMPLE * value * dz / rays;
|
|
33251
|
+
sh[9 + channel] = read(sh, 9 + channel) + BAND1_PER_SAMPLE * value * dx / rays;
|
|
33252
|
+
}
|
|
33253
|
+
}
|
|
33254
|
+
addDirectLobes(scene, lights, px, py, pz, sh);
|
|
33255
|
+
return sh;
|
|
33256
|
+
}
|
|
33257
|
+
/**
|
|
33258
|
+
* The `index`-th of `count` evenly spread unit directions.
|
|
33259
|
+
*
|
|
33260
|
+
* @param index - The direction's index.
|
|
33261
|
+
* @param count - How many there are.
|
|
33262
|
+
* @returns The direction.
|
|
33263
|
+
*/
|
|
33264
|
+
function fibonacciDirection(index, count) {
|
|
33265
|
+
const y = 1 - 2 * (index + .5) / count;
|
|
33266
|
+
const radius = Math.sqrt(Math.max(0, 1 - y * y));
|
|
33267
|
+
const angle = GOLDEN_ANGLE * index;
|
|
33268
|
+
return [
|
|
33269
|
+
Math.cos(angle) * radius,
|
|
33270
|
+
y,
|
|
33271
|
+
Math.sin(angle) * radius
|
|
33272
|
+
];
|
|
33273
|
+
}
|
|
33274
|
+
/**
|
|
33275
|
+
* Gathers the world-space triangles of every enabled mesh renderer with CPU geometry.
|
|
33276
|
+
*
|
|
33277
|
+
* @param world - The world.
|
|
33278
|
+
* @returns The triangles and how many renderers had none.
|
|
33279
|
+
*/
|
|
33280
|
+
function collectTriangles(world) {
|
|
33281
|
+
const vertices = [];
|
|
33282
|
+
const albedo = [];
|
|
33283
|
+
let skipped = 0;
|
|
33284
|
+
for (const renderer of world.components(MeshRenderer)) {
|
|
33285
|
+
if (!renderer.isEnabledInHierarchy) continue;
|
|
33286
|
+
const handle = renderer.mesh;
|
|
33287
|
+
const geometry = handle !== null && handle.state === "loaded" ? handle.value.cpuGeometry : null;
|
|
33288
|
+
if (geometry === null) {
|
|
33289
|
+
skipped += 1;
|
|
33290
|
+
continue;
|
|
33291
|
+
}
|
|
33292
|
+
const rgb = surfaceAlbedo(renderer);
|
|
33293
|
+
const m = renderer.entity.transform.worldMatrix;
|
|
33294
|
+
const { positions, indices } = geometry;
|
|
33295
|
+
for (let index = 0; index < indices.length; index += 1) {
|
|
33296
|
+
const vertex = read(indices, index) * 3;
|
|
33297
|
+
const x = read(positions, vertex);
|
|
33298
|
+
const y = read(positions, vertex + 1);
|
|
33299
|
+
const z = read(positions, vertex + 2);
|
|
33300
|
+
vertices.push(read(m, 0) * x + read(m, 4) * y + read(m, 8) * z + read(m, 12), read(m, 1) * x + read(m, 5) * y + read(m, 9) * z + read(m, 13), read(m, 2) * x + read(m, 6) * y + read(m, 10) * z + read(m, 14));
|
|
33301
|
+
if (index % 3 === 2) albedo.push(...rgb);
|
|
33302
|
+
}
|
|
33303
|
+
}
|
|
33304
|
+
return {
|
|
33305
|
+
scene: {
|
|
33306
|
+
vertices: Float64Array.from(vertices),
|
|
33307
|
+
albedo: Float64Array.from(albedo),
|
|
33308
|
+
count: albedo.length / 3
|
|
33309
|
+
},
|
|
33310
|
+
skipped
|
|
33311
|
+
};
|
|
33312
|
+
}
|
|
33313
|
+
/**
|
|
33314
|
+
* A renderer's diffuse colour: its first material's base (PBR) or diffuse (Standard) colour.
|
|
33315
|
+
*
|
|
33316
|
+
* @param renderer - The renderer.
|
|
33317
|
+
* @returns Linear RGB; mid grey when the material says nothing usable.
|
|
33318
|
+
*/
|
|
33319
|
+
function surfaceAlbedo(renderer) {
|
|
33320
|
+
const handle = renderer.materials[0] ?? null;
|
|
33321
|
+
const definition = handle !== null && handle.state === "loaded" ? handle.value.definition : null;
|
|
33322
|
+
if (definition?.kind === "pbr") return linearRgb(definition.baseColor, true).map((channel) => channel * (1 - definition.metallic));
|
|
33323
|
+
if (definition?.kind === "standard") return linearRgb(definition.diffuse, true);
|
|
33324
|
+
return [
|
|
33325
|
+
.5,
|
|
33326
|
+
.5,
|
|
33327
|
+
.5
|
|
33328
|
+
];
|
|
33329
|
+
}
|
|
33330
|
+
/**
|
|
33331
|
+
* Collects the enabled lights, in linear RGB times intensity.
|
|
33332
|
+
*
|
|
33333
|
+
* @param world - The world.
|
|
33334
|
+
* @returns The lights.
|
|
33335
|
+
*/
|
|
33336
|
+
function collectLights(world) {
|
|
33337
|
+
const out = [];
|
|
33338
|
+
for (const light of world.components(Light)) {
|
|
33339
|
+
if (!light.isEnabledInHierarchy || light.intensity <= 0) continue;
|
|
33340
|
+
const rgb = linearRgb(light.color, true).map((channel) => channel * light.intensity);
|
|
33341
|
+
const transform = light.entity.transform;
|
|
33342
|
+
if (light.type === "directional") {
|
|
33343
|
+
const forward = transform.forward;
|
|
33344
|
+
out.push({
|
|
33345
|
+
kind: "directional",
|
|
33346
|
+
to: [
|
|
33347
|
+
-forward.x,
|
|
33348
|
+
-forward.y,
|
|
33349
|
+
-forward.z
|
|
33350
|
+
],
|
|
33351
|
+
rgb
|
|
33352
|
+
});
|
|
33353
|
+
} else if (light.type === "hemispheric") {
|
|
33354
|
+
const up = transform.up;
|
|
33355
|
+
const ground = linearRgb(light.groundColor, true).map((channel) => channel * light.intensity);
|
|
33356
|
+
out.push({
|
|
33357
|
+
kind: "hemispheric",
|
|
33358
|
+
up: [
|
|
33359
|
+
up.x,
|
|
33360
|
+
up.y,
|
|
33361
|
+
up.z
|
|
33362
|
+
],
|
|
33363
|
+
sky: rgb,
|
|
33364
|
+
ground
|
|
33365
|
+
});
|
|
33366
|
+
} else {
|
|
33367
|
+
const at = transform.position;
|
|
33368
|
+
out.push({
|
|
33369
|
+
kind: "point",
|
|
33370
|
+
at: [
|
|
33371
|
+
at.x,
|
|
33372
|
+
at.y,
|
|
33373
|
+
at.z
|
|
33374
|
+
],
|
|
33375
|
+
range: light.range,
|
|
33376
|
+
rgb
|
|
33377
|
+
});
|
|
33378
|
+
}
|
|
33379
|
+
}
|
|
33380
|
+
return out;
|
|
33381
|
+
}
|
|
33382
|
+
/**
|
|
33383
|
+
* The radiance a surface hit sends back: albedo times the direct light there.
|
|
33384
|
+
*
|
|
33385
|
+
* @param scene - The triangles.
|
|
33386
|
+
* @param lights - The lights.
|
|
33387
|
+
* @param hit - The hit.
|
|
33388
|
+
* @param x - The hit's world X.
|
|
33389
|
+
* @param y - The hit's world Y.
|
|
33390
|
+
* @param z - The hit's world Z.
|
|
33391
|
+
* @param out - Receives linear RGB.
|
|
33392
|
+
*/
|
|
33393
|
+
function shadeHit(scene, lights, hit, x, y, z, out) {
|
|
33394
|
+
out.fill(0);
|
|
33395
|
+
const ox = x + hit.nx * SURFACE_OFFSET;
|
|
33396
|
+
const oy = y + hit.ny * SURFACE_OFFSET;
|
|
33397
|
+
const oz = z + hit.nz * SURFACE_OFFSET;
|
|
33398
|
+
const shadow = {
|
|
33399
|
+
distance: 0,
|
|
33400
|
+
nx: 0,
|
|
33401
|
+
ny: 0,
|
|
33402
|
+
nz: 0,
|
|
33403
|
+
triangle: -1
|
|
33404
|
+
};
|
|
33405
|
+
for (const light of lights) {
|
|
33406
|
+
if (light.kind === "hemispheric") {
|
|
33407
|
+
const t = .5 + .5 * (hit.nx * light.up[0] + hit.ny * light.up[1] + hit.nz * light.up[2]);
|
|
33408
|
+
for (let channel = 0; channel < 3; channel += 1) out[channel] = read(out, channel) + read(light.ground, channel) * (1 - t) + read(light.sky, channel) * t;
|
|
33409
|
+
continue;
|
|
33410
|
+
}
|
|
33411
|
+
const toward = towardLight(light, ox, oy, oz);
|
|
33412
|
+
if (toward === null) continue;
|
|
33413
|
+
const [lx, ly, lz, distance, falloff] = toward;
|
|
33414
|
+
const cosine = hit.nx * lx + hit.ny * ly + hit.nz * lz;
|
|
33415
|
+
if (cosine <= 0 || trace(scene, ox, oy, oz, lx, ly, lz, distance, shadow)) continue;
|
|
33416
|
+
for (let channel = 0; channel < 3; channel += 1) out[channel] = read(out, channel) + read(light.rgb, channel) * cosine * falloff;
|
|
33417
|
+
}
|
|
33418
|
+
const base = hit.triangle * 3;
|
|
33419
|
+
for (let channel = 0; channel < 3; channel += 1) out[channel] = read(out, channel) * read(scene.albedo, base + channel);
|
|
33420
|
+
}
|
|
33421
|
+
/**
|
|
33422
|
+
* The radiance of a ray that hit nothing: the sky and the hemispheric lights.
|
|
33423
|
+
*
|
|
33424
|
+
* @param lights - The lights.
|
|
33425
|
+
* @param sky - The sky's linear RGB.
|
|
33426
|
+
* @param dx - The ray's X.
|
|
33427
|
+
* @param dy - The ray's Y.
|
|
33428
|
+
* @param dz - The ray's Z.
|
|
33429
|
+
* @param out - Receives linear RGB.
|
|
33430
|
+
*/
|
|
33431
|
+
function missRadiance(lights, sky, dx, dy, dz, out) {
|
|
33432
|
+
for (let channel = 0; channel < 3; channel += 1) out[channel] = read(sky, channel);
|
|
33433
|
+
for (const light of lights) if (light.kind === "hemispheric") {
|
|
33434
|
+
const above = dx * light.up[0] + dy * light.up[1] + dz * light.up[2] >= 0;
|
|
33435
|
+
for (let channel = 0; channel < 3; channel += 1) out[channel] = read(out, channel) + read(above ? light.sky : light.ground, channel);
|
|
33436
|
+
}
|
|
33437
|
+
}
|
|
33438
|
+
/**
|
|
33439
|
+
* Adds the directional, point and spot lights a probe sees as clamped-cosine lobes.
|
|
33440
|
+
*
|
|
33441
|
+
* @param scene - The triangles.
|
|
33442
|
+
* @param lights - The lights.
|
|
33443
|
+
* @param x - The probe's X.
|
|
33444
|
+
* @param y - The probe's Y.
|
|
33445
|
+
* @param z - The probe's Z.
|
|
33446
|
+
* @param sh - The probe's 12 coefficients, added to.
|
|
33447
|
+
*/
|
|
33448
|
+
function addDirectLobes(scene, lights, x, y, z, sh) {
|
|
33449
|
+
const shadow = {
|
|
33450
|
+
distance: 0,
|
|
33451
|
+
nx: 0,
|
|
33452
|
+
ny: 0,
|
|
33453
|
+
nz: 0,
|
|
33454
|
+
triangle: -1
|
|
33455
|
+
};
|
|
33456
|
+
for (const light of lights) {
|
|
33457
|
+
if (light.kind === "hemispheric") continue;
|
|
33458
|
+
const toward = towardLight(light, x, y, z);
|
|
33459
|
+
if (toward === null) continue;
|
|
33460
|
+
const [lx, ly, lz, distance, falloff] = toward;
|
|
33461
|
+
if (trace(scene, x, y, z, lx, ly, lz, distance, shadow)) continue;
|
|
33462
|
+
for (let channel = 0; channel < 3; channel += 1) {
|
|
33463
|
+
const energy = read(light.rgb, channel) * falloff;
|
|
33464
|
+
sh[channel] = read(sh, channel) + energy / 4;
|
|
33465
|
+
sh[3 + channel] = read(sh, 3 + channel) + energy / 2 * ly;
|
|
33466
|
+
sh[6 + channel] = read(sh, 6 + channel) + energy / 2 * lz;
|
|
33467
|
+
sh[9 + channel] = read(sh, 9 + channel) + energy / 2 * lx;
|
|
33468
|
+
}
|
|
33469
|
+
}
|
|
33470
|
+
}
|
|
33471
|
+
/**
|
|
33472
|
+
* The unit direction to a light, how far it is, and its distance falloff.
|
|
33473
|
+
*
|
|
33474
|
+
* @param light - A directional or point light.
|
|
33475
|
+
* @param x - The point's X.
|
|
33476
|
+
* @param y - The point's Y.
|
|
33477
|
+
* @param z - The point's Z.
|
|
33478
|
+
* @returns `[dx, dy, dz, distance, falloff]`, or `null` beyond a point light's range or at its centre.
|
|
33479
|
+
*/
|
|
33480
|
+
function towardLight(light, x, y, z) {
|
|
33481
|
+
if (light.kind === "directional") return [
|
|
33482
|
+
light.to[0],
|
|
33483
|
+
light.to[1],
|
|
33484
|
+
light.to[2],
|
|
33485
|
+
Number.POSITIVE_INFINITY,
|
|
33486
|
+
1
|
|
33487
|
+
];
|
|
33488
|
+
const dx = light.at[0] - x;
|
|
33489
|
+
const dy = light.at[1] - y;
|
|
33490
|
+
const dz = light.at[2] - z;
|
|
33491
|
+
const distance = Math.hypot(dx, dy, dz);
|
|
33492
|
+
if (distance < 1e-6 || light.range > 0 && distance > light.range) return null;
|
|
33493
|
+
return [
|
|
33494
|
+
dx / distance,
|
|
33495
|
+
dy / distance,
|
|
33496
|
+
dz / distance,
|
|
33497
|
+
distance,
|
|
33498
|
+
1 / (distance * distance)
|
|
33499
|
+
];
|
|
33500
|
+
}
|
|
33501
|
+
/**
|
|
33502
|
+
* Finds the nearest triangle a ray hits (Möller–Trumbore, both faces).
|
|
33503
|
+
*
|
|
33504
|
+
* @param scene - The triangles.
|
|
33505
|
+
* @param ox - The ray origin's X.
|
|
33506
|
+
* @param oy - The ray origin's Y.
|
|
33507
|
+
* @param oz - The ray origin's Z.
|
|
33508
|
+
* @param dx - The unit direction's X.
|
|
33509
|
+
* @param dy - The unit direction's Y.
|
|
33510
|
+
* @param dz - The unit direction's Z.
|
|
33511
|
+
* @param maxDistance - How far to look.
|
|
33512
|
+
* @param out - Receives the hit, its normal turned to face the ray.
|
|
33513
|
+
* @returns Whether anything was hit.
|
|
33514
|
+
*/
|
|
33515
|
+
function trace(scene, ox, oy, oz, dx, dy, dz, maxDistance, out) {
|
|
33516
|
+
const v = scene.vertices;
|
|
33517
|
+
let nearest = maxDistance;
|
|
33518
|
+
let found = -1;
|
|
33519
|
+
for (let triangle = 0; triangle < scene.count; triangle += 1) {
|
|
33520
|
+
const b = triangle * 9;
|
|
33521
|
+
const ax = read(v, b);
|
|
33522
|
+
const ay = read(v, b + 1);
|
|
33523
|
+
const az = read(v, b + 2);
|
|
33524
|
+
const e1x = read(v, b + 3) - ax;
|
|
33525
|
+
const e1y = read(v, b + 4) - ay;
|
|
33526
|
+
const e1z = read(v, b + 5) - az;
|
|
33527
|
+
const e2x = read(v, b + 6) - ax;
|
|
33528
|
+
const e2y = read(v, b + 7) - ay;
|
|
33529
|
+
const e2z = read(v, b + 8) - az;
|
|
33530
|
+
const px = dy * e2z - dz * e2y;
|
|
33531
|
+
const py = dz * e2x - dx * e2z;
|
|
33532
|
+
const pz = dx * e2y - dy * e2x;
|
|
33533
|
+
const det = e1x * px + e1y * py + e1z * pz;
|
|
33534
|
+
if (Math.abs(det) < 1e-12) continue;
|
|
33535
|
+
const inv = 1 / det;
|
|
33536
|
+
const tx = ox - ax;
|
|
33537
|
+
const ty = oy - ay;
|
|
33538
|
+
const tz = oz - az;
|
|
33539
|
+
const u = (tx * px + ty * py + tz * pz) * inv;
|
|
33540
|
+
if (u < 0 || u > 1) continue;
|
|
33541
|
+
const qx = ty * e1z - tz * e1y;
|
|
33542
|
+
const qy = tz * e1x - tx * e1z;
|
|
33543
|
+
const qz = tx * e1y - ty * e1x;
|
|
33544
|
+
const w = (dx * qx + dy * qy + dz * qz) * inv;
|
|
33545
|
+
if (w < 0 || u + w > 1) continue;
|
|
33546
|
+
const distance = (e2x * qx + e2y * qy + e2z * qz) * inv;
|
|
33547
|
+
if (distance > 1e-6 && distance < nearest) {
|
|
33548
|
+
nearest = distance;
|
|
33549
|
+
found = triangle;
|
|
33550
|
+
}
|
|
33551
|
+
}
|
|
33552
|
+
if (found < 0) return false;
|
|
33553
|
+
const b = found * 9;
|
|
33554
|
+
const e1x = read(v, b + 3) - read(v, b);
|
|
33555
|
+
const e1y = read(v, b + 4) - read(v, b + 1);
|
|
33556
|
+
const e1z = read(v, b + 5) - read(v, b + 2);
|
|
33557
|
+
const e2x = read(v, b + 6) - read(v, b);
|
|
33558
|
+
const e2y = read(v, b + 7) - read(v, b + 1);
|
|
33559
|
+
const e2z = read(v, b + 8) - read(v, b + 2);
|
|
33560
|
+
let nx = e1y * e2z - e1z * e2y;
|
|
33561
|
+
let ny = e1z * e2x - e1x * e2z;
|
|
33562
|
+
let nz = e1x * e2y - e1y * e2x;
|
|
33563
|
+
const length = Math.hypot(nx, ny, nz) || 1;
|
|
33564
|
+
const facing = nx * dx + ny * dy + nz * dz > 0 ? -1 : 1;
|
|
33565
|
+
nx = nx / length * facing;
|
|
33566
|
+
ny = ny / length * facing;
|
|
33567
|
+
nz = nz / length * facing;
|
|
33568
|
+
out.distance = nearest;
|
|
33569
|
+
out.nx = nx;
|
|
33570
|
+
out.ny = ny;
|
|
33571
|
+
out.nz = nz;
|
|
33572
|
+
out.triangle = found;
|
|
33573
|
+
return true;
|
|
33574
|
+
}
|
|
33575
|
+
/**
|
|
33576
|
+
* A colour as three linear channels.
|
|
33577
|
+
*
|
|
33578
|
+
* @param colour - The colour.
|
|
33579
|
+
* @param isSrgb - Whether it is stored sRGB-encoded.
|
|
33580
|
+
* @returns Linear RGB.
|
|
33581
|
+
*/
|
|
33582
|
+
function linearRgb(colour, isSrgb) {
|
|
33583
|
+
const decode = (channel) => isSrgb ? Color.srgbToLinear(channel) : channel;
|
|
33584
|
+
return [
|
|
33585
|
+
decode(colour.r),
|
|
33586
|
+
decode(colour.g),
|
|
33587
|
+
decode(colour.b)
|
|
33588
|
+
];
|
|
33589
|
+
}
|
|
33590
|
+
/**
|
|
33591
|
+
* Reads one number of an array, `0` past its end.
|
|
33592
|
+
*
|
|
33593
|
+
* @param values - The array.
|
|
33594
|
+
* @param index - The index.
|
|
33595
|
+
* @returns The number.
|
|
33596
|
+
*/
|
|
33597
|
+
function read(values, index) {
|
|
33598
|
+
return values[index] ?? 0;
|
|
33599
|
+
}
|
|
33600
|
+
//#endregion
|
|
32860
33601
|
//#region src/transform/transform-schema.ts
|
|
32861
33602
|
/**
|
|
32862
33603
|
* The entity transform as a schema: the fields of a scene file's `transform` block, so an
|
|
@@ -32974,9 +33715,11 @@ function describeSchemas() {
|
|
|
32974
33715
|
"ignifx/Environment": describeSchema("ignifx/Environment", Environment.schema, { description: Environment.description }),
|
|
32975
33716
|
"ignifx/PostProcessStack": describeSchema("ignifx/PostProcessStack", PostProcessStack.schema, { description: PostProcessStack.description }),
|
|
32976
33717
|
"ignifx/ReflectionProbe": describeSchema("ignifx/ReflectionProbe", ReflectionProbe.schema, { description: ReflectionProbe.description }),
|
|
33718
|
+
"ignifx/LightProbeVolume": describeSchema("ignifx/LightProbeVolume", LightProbeVolume.schema, { description: LightProbeVolume.description }),
|
|
32977
33719
|
"ignifx/scene-file": describeSceneFileFormat(),
|
|
32978
33720
|
"ignifx/material-file": describeMaterialFileFormat(),
|
|
32979
33721
|
"ignifx/environment-file": describeEnvironmentFileFormat(),
|
|
33722
|
+
"ignifx/light-probe-file": describeLightProbeFileFormat(),
|
|
32980
33723
|
"ignifx/mesh-file": describeMeshFileFormat()
|
|
32981
33724
|
};
|
|
32982
33725
|
}
|
|
@@ -33281,6 +34024,64 @@ function describeMeshFileFormat() {
|
|
|
33281
34024
|
}
|
|
33282
34025
|
};
|
|
33283
34026
|
}
|
|
34027
|
+
/**
|
|
34028
|
+
* Describes the `.probes.json` light-probe grid format (GI Phase 2, step B2).
|
|
34029
|
+
*
|
|
34030
|
+
* @returns The description of the top-level file fields.
|
|
34031
|
+
*
|
|
34032
|
+
* @beta
|
|
34033
|
+
*/
|
|
34034
|
+
function describeLightProbeFileFormat() {
|
|
34035
|
+
return {
|
|
34036
|
+
title: "Light probe file",
|
|
34037
|
+
format: LIGHT_PROBE_FILE_FORMAT,
|
|
34038
|
+
description: "A regular grid of baked light probes: first-order spherical harmonics of the diffuse light at each probe.",
|
|
34039
|
+
fields: {
|
|
34040
|
+
format: {
|
|
34041
|
+
kind: "str",
|
|
34042
|
+
default: LIGHT_PROBE_FILE_FORMAT,
|
|
34043
|
+
description: `Always "${LIGHT_PROBE_FILE_FORMAT}".`
|
|
34044
|
+
},
|
|
34045
|
+
formatVersion: {
|
|
34046
|
+
kind: "u32",
|
|
34047
|
+
default: 1,
|
|
34048
|
+
description: "The file format version; 1 before ignifx 1.0."
|
|
34049
|
+
},
|
|
34050
|
+
origin: {
|
|
34051
|
+
kind: "vec3",
|
|
34052
|
+
default: {
|
|
34053
|
+
x: 0,
|
|
34054
|
+
y: 0,
|
|
34055
|
+
z: 0
|
|
34056
|
+
},
|
|
34057
|
+
description: "World position of probe (0, 0, 0)."
|
|
34058
|
+
},
|
|
34059
|
+
cellSize: {
|
|
34060
|
+
kind: "vec3",
|
|
34061
|
+
default: {
|
|
34062
|
+
x: 1,
|
|
34063
|
+
y: 1,
|
|
34064
|
+
z: 1
|
|
34065
|
+
},
|
|
34066
|
+
description: "Distance between neighbouring probes per axis, in metres; positive."
|
|
34067
|
+
},
|
|
34068
|
+
counts: {
|
|
34069
|
+
kind: "vec3",
|
|
34070
|
+
default: {
|
|
34071
|
+
x: 1,
|
|
34072
|
+
y: 1,
|
|
34073
|
+
z: 1
|
|
34074
|
+
},
|
|
34075
|
+
description: "Probes per axis, whole numbers from 1; counts.x at most 1024, counts.y × counts.z at most 4096."
|
|
34076
|
+
},
|
|
34077
|
+
coefficients: {
|
|
34078
|
+
kind: "array",
|
|
34079
|
+
default: [],
|
|
34080
|
+
description: "12 linear-RGB floats per probe (c0, c1, c2, c3; diffuse light for normal n is c0 + c1·n.y + c2·n.z + c3·n.x), X fastest, then Y, then Z."
|
|
34081
|
+
}
|
|
34082
|
+
}
|
|
34083
|
+
};
|
|
34084
|
+
}
|
|
33284
34085
|
//#endregion
|
|
33285
34086
|
//#region src/serialization/instance-lookup.ts
|
|
33286
34087
|
/**
|
|
@@ -34745,6 +35546,6 @@ function settingsJsonSchema(app) {
|
|
|
34745
35546
|
};
|
|
34746
35547
|
}
|
|
34747
35548
|
//#endregion
|
|
34748
|
-
export { AMBIENT_OCCLUSION_QUALITIES, ASSET_DIAGNOSTICS_COUNTERS, ASSET_DIAGNOSTICS_GROUP, ASSET_MANIFEST_FORMAT, ASSET_MANIFEST_VERSION, AssetLoadError, CANVAS_ALPHA_MODES, CORE_ERROR_MESSAGES, Camera, Color, Component, ComponentRegistry, CoreErrorCode, DEFAULT_ASSET_CONCURRENCY, DEFAULT_ASSET_ROOT, DEFAULT_BRDF_LUT_ADDRESS, DEFAULT_LAYER, DEFAULT_MEMORY_SINK_LIMIT, DEFAULT_STORAGE_NAMESPACE, DEG_TO_RAD, Diagnostics, EASINGS, EASING_NAMES, EDITOR_ONLY_METADATA_KEY, EMPTY_ASSET_MANIFEST, ENVIRONMENT_ASSET_TYPE, ENVIRONMENT_FILE_EXTENSION, ENVIRONMENT_FILE_EXTENSIONS, ENVIRONMENT_FILE_FORMAT, ENVIRONMENT_FORMAT_VERSION, EPSILON, Entity, Environment, EnvironmentAsset, ErrorRange, FOG_MODE_NAMES, FONT_ASSET_TYPE, FONT_FILE_EXTENSIONS, FRAME_HISTORY_LENGTH, FieldKind, FontAsset, IGNIFX_UNIFORM_NAMES, INVALID_HANDLE, IgnifxError, IndexedDbStorageBackend, InstancedMeshRenderer, LIGHT_TYPES, LITE_MATERIAL_PLUGIN_POINTS, LITE_SYSTEM_UNIFORM_NAMES, LOG_LEVEL_SEVERITY, LayerMask, LayerTable, Light, LogLevel, MAT4_IDENTITY, MATERIAL_ALPHA_MODES, MATERIAL_ASSET_TYPE, MATERIAL_FILE_EXTENSION, MATERIAL_FILE_FORMAT, MATERIAL_FORMAT_VERSION, MATERIAL_KINDS, MATERIAL_PLUGIN_DEFAULT_PRIORITY, MATERIAL_PLUGIN_RESERVED_NAMES, MATERIAL_PLUGIN_SAMPLER_BUDGET, MAX_LAYERS, MAX_ULID_TIME_MS, MESH_ASSET_TYPE, MESH_FILE_EXTENSION, MESH_FILE_FORMAT, MESH_FORMAT_VERSION, MESH_PRIMITIVES, MESH_PRIMITIVE_OPTIONS, MODEL_ASSET_TYPE, MODEL_FILE_EXTENSIONS, Mat4, MaterialAsset, MemoryStorageBackend, MeshAsset, MeshRenderer, Model, ModelAsset, NAMESPACE_SEGMENT_MAX_LENGTH, PBR_TEXTURE_SLOTS, PHASES, PHASE_COUNT, PHASE_NAMES, POST_EFFECT_BUILTIN_UNIFORMS, POST_EFFECT_FUNCTION, PROJECTIONS, Phase, PhysicsCallbackName, PostProcessStack, QUAT_IDENTITY, Quat, RAD_TO_DEG, REFLECTION_PROBE_REFRESH_MODES, RENDERING_QUALITIES, RENDERING_SETTINGS_SECTION, RENDER_DIAGNOSTICS_COUNTERS, RENDER_DIAGNOSTICS_GROUP, RENDER_TEXTURE_MAX_SIZE, RESERVED_LAYER_NAMES, ReflectionProbe, SCENE_ASSET_TYPE, SCENE_FILE_EXTENSIONS, SCENE_FILE_FORMAT, SCENE_FORMAT_VERSION, SETTINGS_DESCRIPTION_FORMAT, SHADER_ASSET_TYPE, SHADER_ATTRIBUTE_NAMES, SHADER_BLEND_MODES, SHADER_CULL_MODES, SHADER_FILE_EXTENSIONS, SHADER_INSTANCING_MODES, SHADER_KINDS, SHADER_TEXTURE_FALLBACKS, SHADER_UNIFORM_TYPES, SHADOW_TECHNIQUES, STANDARD_TEXTURE_SLOTS, STORAGE_BUFFER_ASSET_TYPE, STORAGE_KEY_MAX_LENGTH, SURFACE_HOOK_NAMES, SURFACE_UNIFORM_BLOCK, SceneAssetToken, SceneInstance, SchemaIssueCode, Script, ScriptCallbackKind, ShaderAsset, Signal, StorageBufferAsset, TEXTURE_ASSET_TYPE, THIRD_PARTY_ERROR_PREFIX, TONE_MAPPING_NAMES, TWEEN_LOOP_FOREVER, TWEEN_SYSTEM_ORDER, TWEEN_VALUE_KINDS, TagSet, TextureAsset, Transform, Tween, UidRemap, VEC2_ONE, VEC2_ZERO, VEC3_BACKWARD, VEC3_DOWN, VEC3_FORWARD, VEC3_LEFT, VEC3_ONE, VEC3_RIGHT, VEC3_UP, VEC3_ZERO, VERSION, Vec2, Vec3, Vec4, World, addComponentFromRecord, applyInit, applyOverridesToAsset, approximately, array, assertNever, assertSceneDependenciesLoaded, asset, assetRef, binaryAssetLoader, bool, canonicalizeNumber, clamp, clamp01, color, componentRef, computeSceneHash, coreExtension, createApp, createAssetManifest, createConsoleSink, createCryptoRandom, createDefaults, createDiagnosticsGroup, createEnvironmentLoader, createErrorCodeRegistry, createFileStorageBackend, createFontLoader, createFrameSample, createLayerTable, createLogger, createManualClock, createMaterialAsset, createMaterialLoader, createMemorySink, createMeshLoader, createModelLoader, createPerformanceClock, createRay, createSceneAsset, createSceneLoader, createSeededRandom, createServiceKey, createShaderLoader, createStorageBufferAsset, createTextureLoader, createUlidFactory, curve, custom, customEffect, decodeProps, decodeValue, defaultAutoExposureSettings, defaultRenderingSettings, defineExtension, defineMaterialPlugin, defineSchema, degToRad, deltaAngleDegrees, describeEnvironmentFileFormat, describeMaterialFileFormat, describeMeshFileFormat, describeRegisteredSchemas, describeSceneFileFormat, describeSchema, describeSchemas, describeSettings, encodeProps, encodeValue, entityRef, enumOf, environmentDefinition, f32, f64, forceRendererDeviceLossForTesting, formatErrorMessage, generateUlid, i32, instanceComponentAt, instanceEntityAt, instantiateScene, inverseLerp, isAssetRef, isIgnifxError, isLiteMaterialPluginPoint, isSceneFileHeader, isUlid, isValidErrorCode, isWebGpuAvailable, jsonAssetLoader, layerMask, lerp, lerpAngleDegrees, loadSceneDependencies, map, meshFileJsonSchema, moveTowards, optional, parseOverridePath, pbrMaterialDefinition, pingPong, platformInternals, quat, radToDeg, record, repeat, resetFrameSample, resolveEase, revertOverrides, sceneFileJsonSchema, serializeComponent, serializeEntity, serializeScene, settingsJsonSchema, shaderMaterialDefinition, sign, smoothStep, standardMaterialDefinition, storageInternals, str, stringifySceneFile, textAssetLoader, toJsonSchema, transformSchema, u32, validateProps, validateSceneFile, validateValue, vec2, vec3, vec4, waitFixedUpdate, waitSeconds, waitSecondsRealtime, waitUntil, waitWhile, wrapAngleDegrees };
|
|
35549
|
+
export { AMBIENT_OCCLUSION_QUALITIES, ASSET_DIAGNOSTICS_COUNTERS, ASSET_DIAGNOSTICS_GROUP, ASSET_MANIFEST_FORMAT, ASSET_MANIFEST_VERSION, AssetLoadError, CANVAS_ALPHA_MODES, CORE_ERROR_MESSAGES, Camera, Color, Component, ComponentRegistry, CoreErrorCode, DEFAULT_ASSET_CONCURRENCY, DEFAULT_ASSET_ROOT, DEFAULT_BRDF_LUT_ADDRESS, DEFAULT_LAYER, DEFAULT_MEMORY_SINK_LIMIT, DEFAULT_STORAGE_NAMESPACE, DEG_TO_RAD, Diagnostics, EASINGS, EASING_NAMES, EDITOR_ONLY_METADATA_KEY, EMPTY_ASSET_MANIFEST, ENVIRONMENT_ASSET_TYPE, ENVIRONMENT_FILE_EXTENSION, ENVIRONMENT_FILE_EXTENSIONS, ENVIRONMENT_FILE_FORMAT, ENVIRONMENT_FORMAT_VERSION, EPSILON, Entity, Environment, EnvironmentAsset, ErrorRange, FOG_MODE_NAMES, FONT_ASSET_TYPE, FONT_FILE_EXTENSIONS, FRAME_HISTORY_LENGTH, FieldKind, FontAsset, IGNIFX_UNIFORM_NAMES, INVALID_HANDLE, IgnifxError, IndexedDbStorageBackend, InstancedMeshRenderer, LIGHT_PROBE_ASSET_TYPE, LIGHT_PROBE_FILE_EXTENSIONS, LIGHT_PROBE_FILE_FORMAT, LIGHT_PROBE_FORMAT_VERSION, LIGHT_TYPES, LITE_MATERIAL_PLUGIN_POINTS, LITE_SYSTEM_UNIFORM_NAMES, LOG_LEVEL_SEVERITY, LayerMask, LayerTable, Light, LightProbeAsset, LightProbeVolume, LogLevel, MAT4_IDENTITY, MATERIAL_ALPHA_MODES, MATERIAL_ASSET_TYPE, MATERIAL_FILE_EXTENSION, MATERIAL_FILE_FORMAT, MATERIAL_FORMAT_VERSION, MATERIAL_KINDS, MATERIAL_PLUGIN_DEFAULT_PRIORITY, MATERIAL_PLUGIN_RESERVED_NAMES, MATERIAL_PLUGIN_SAMPLER_BUDGET, MAX_LAYERS, MAX_ULID_TIME_MS, MESH_ASSET_TYPE, MESH_FILE_EXTENSION, MESH_FILE_FORMAT, MESH_FORMAT_VERSION, MESH_PRIMITIVES, MESH_PRIMITIVE_OPTIONS, MODEL_ASSET_TYPE, MODEL_FILE_EXTENSIONS, Mat4, MaterialAsset, MemoryStorageBackend, MeshAsset, MeshRenderer, Model, ModelAsset, NAMESPACE_SEGMENT_MAX_LENGTH, PBR_TEXTURE_SLOTS, PHASES, PHASE_COUNT, PHASE_NAMES, POST_EFFECT_BUILTIN_UNIFORMS, POST_EFFECT_FUNCTION, PROJECTIONS, Phase, PhysicsCallbackName, PostProcessStack, QUAT_IDENTITY, Quat, RAD_TO_DEG, REFLECTION_PROBE_REFRESH_MODES, RENDERING_QUALITIES, RENDERING_SETTINGS_SECTION, RENDER_DIAGNOSTICS_COUNTERS, RENDER_DIAGNOSTICS_GROUP, RENDER_TEXTURE_MAX_SIZE, RESERVED_LAYER_NAMES, ReflectionProbe, SCENE_ASSET_TYPE, SCENE_FILE_EXTENSIONS, SCENE_FILE_FORMAT, SCENE_FORMAT_VERSION, SETTINGS_DESCRIPTION_FORMAT, SHADER_ASSET_TYPE, SHADER_ATTRIBUTE_NAMES, SHADER_BLEND_MODES, SHADER_CULL_MODES, SHADER_FILE_EXTENSIONS, SHADER_INSTANCING_MODES, SHADER_KINDS, SHADER_TEXTURE_FALLBACKS, SHADER_UNIFORM_TYPES, SHADOW_TECHNIQUES, STANDARD_TEXTURE_SLOTS, STORAGE_BUFFER_ASSET_TYPE, STORAGE_KEY_MAX_LENGTH, SURFACE_HOOK_NAMES, SURFACE_UNIFORM_BLOCK, SceneAssetToken, SceneInstance, SchemaIssueCode, Script, ScriptCallbackKind, ShaderAsset, Signal, StorageBufferAsset, TEXTURE_ASSET_TYPE, THIRD_PARTY_ERROR_PREFIX, TONE_MAPPING_NAMES, TWEEN_LOOP_FOREVER, TWEEN_SYSTEM_ORDER, TWEEN_VALUE_KINDS, TagSet, TextureAsset, Transform, Tween, UidRemap, VEC2_ONE, VEC2_ZERO, VEC3_BACKWARD, VEC3_DOWN, VEC3_FORWARD, VEC3_LEFT, VEC3_ONE, VEC3_RIGHT, VEC3_UP, VEC3_ZERO, VERSION, Vec2, Vec3, Vec4, World, addComponentFromRecord, applyInit, applyOverridesToAsset, approximately, array, assertNever, assertSceneDependenciesLoaded, asset, assetRef, bakeLightProbes, binaryAssetLoader, bool, canonicalizeNumber, clamp, clamp01, color, componentRef, computeSceneHash, coreExtension, createApp, createAssetManifest, createConsoleSink, createCryptoRandom, createDefaults, createDiagnosticsGroup, createEnvironmentLoader, createErrorCodeRegistry, createFileStorageBackend, createFontLoader, createFrameSample, createLayerTable, createLightProbeAsset, createLightProbeLoader, createLogger, createManualClock, createMaterialAsset, createMaterialLoader, createMemorySink, createMeshLoader, createModelLoader, createPerformanceClock, createRay, createSceneAsset, createSceneLoader, createSeededRandom, createServiceKey, createShaderLoader, createStorageBufferAsset, createTextureLoader, createUlidFactory, curve, custom, customEffect, decodeProps, decodeValue, defaultAutoExposureSettings, defaultRenderingSettings, defineExtension, defineMaterialPlugin, defineSchema, degToRad, deltaAngleDegrees, describeEnvironmentFileFormat, describeLightProbeFileFormat, describeMaterialFileFormat, describeMeshFileFormat, describeRegisteredSchemas, describeSceneFileFormat, describeSchema, describeSchemas, describeSettings, encodeProps, encodeValue, entityRef, enumOf, environmentDefinition, f32, f64, forceRendererDeviceLossForTesting, formatErrorMessage, generateUlid, i32, instanceComponentAt, instanceEntityAt, instantiateScene, inverseLerp, isAssetRef, isIgnifxError, isLiteMaterialPluginPoint, isSceneFileHeader, isUlid, isValidErrorCode, isWebGpuAvailable, jsonAssetLoader, layerMask, lerp, lerpAngleDegrees, loadSceneDependencies, map, meshFileJsonSchema, moveTowards, optional, parseOverridePath, pbrMaterialDefinition, pingPong, platformInternals, quat, radToDeg, record, repeat, resetFrameSample, resolveEase, revertOverrides, sampleLightProbes, sceneFileJsonSchema, serializeComponent, serializeEntity, serializeScene, settingsJsonSchema, shaderMaterialDefinition, sign, smoothStep, standardMaterialDefinition, storageInternals, str, stringifySceneFile, textAssetLoader, toJsonSchema, transformSchema, u32, validateProps, validateSceneFile, validateValue, vec2, vec3, vec4, waitFixedUpdate, waitSeconds, waitSecondsRealtime, waitUntil, waitWhile, wrapAngleDegrees, writeLightProbeFile };
|
|
34749
35550
|
|
|
34750
35551
|
//# sourceMappingURL=index.js.map
|