babylonjs-toolkit 9.34.10 → 9.34.100
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/lib/babylon.toolkit.d.ts +1249 -971
- package/lib/babylon.toolkit.js +1 -1
- package/lib/index.d.ts +1249 -971
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ declare namespace TOOLKIT {
|
|
|
7
7
|
* @class SceneManager - All rights reserved (c) 2024 Mackey Kinard
|
|
8
8
|
*/
|
|
9
9
|
class SceneManager {
|
|
10
|
-
/** Gets the toolkit framework version string (9.34.
|
|
10
|
+
/** Gets the toolkit framework version string (9.34.100 - R1) */
|
|
11
11
|
static get Version(): string;
|
|
12
12
|
/** Gets the toolkit framework copyright notice */
|
|
13
13
|
static get Copyright(): string;
|
|
@@ -4318,7 +4318,8 @@ declare namespace TOOLKIT {
|
|
|
4318
4318
|
* and `distances[N-1]` doubles as the cull threshold. Unchanged HYBRID strategy: every level one mesh =>
|
|
4319
4319
|
* native `master.addLODLevel(distances[i-1], mesh)` plus a final `addLODLevel(cull, null)` band (an
|
|
4320
4320
|
* InstancedMesh master keeps the legacy dispose of its unused detail levels); any level with >1 mesh =>
|
|
4321
|
-
* the scene's shared switcher (`_setupLevelOfDetailSwitcher`)
|
|
4321
|
+
* the scene's shared switcher (`_setupLevelOfDetailSwitcher`), as has a level authored away from LOD0, because
|
|
4322
|
+
* Babylon draws a native level with its master's matrix (`UnityLodGroups.RequiresSwitcher`).
|
|
4322
4323
|
* - `coverages` only (every headless export - there is no scene-view camera to turn heights into
|
|
4323
4324
|
* distances, F-M.57): Unity's own rule, `UnityLodAndLights.SelectCoverageLevel` on the screen-relative
|
|
4324
4325
|
* height `worldSize * lodBias / (2 * tan(vfov / 2) * distance)` of the group, through the same switcher.
|
|
@@ -6236,7 +6237,12 @@ declare namespace TOOLKIT {
|
|
|
6236
6237
|
static RegisterShaders(): void;
|
|
6237
6238
|
/** The head-of-chain pass that writes min(c, MaxRadiance) and replaces NaN with 0 (WGSL on WebGPU). */
|
|
6238
6239
|
static CreateSanitizePass(scene: BABYLON.Scene, camera: BABYLON.Camera, textureType: number): BABYLON.PostProcess;
|
|
6239
|
-
|
|
6240
|
+
/**
|
|
6241
|
+
* The scene's exported toolkit metadata.
|
|
6242
|
+
* @param scene The scene.
|
|
6243
|
+
* @returns The metadata, or null.
|
|
6244
|
+
*/
|
|
6245
|
+
static SceneMetadata(scene: BABYLON.Scene): any;
|
|
6240
6246
|
private static State;
|
|
6241
6247
|
private static ApplyBinding;
|
|
6242
6248
|
}
|
|
@@ -6454,6 +6460,14 @@ declare namespace TOOLKIT {
|
|
|
6454
6460
|
* @param light A Babylon light (reads `diffuse` and `metadata.toolkit.colorTemperature`), or null.
|
|
6455
6461
|
*/
|
|
6456
6462
|
static UnityLinearLightColor(light: any): BABYLON.Color3;
|
|
6463
|
+
/**
|
|
6464
|
+
* Gives a toolkit light the colour Unity lights with in a Linear project (`UnityLinearLightColor`) and marks it, so every later
|
|
6465
|
+
* conversion returns it unchanged. An HDRP parity export and a Gamma project keep the exported colour.
|
|
6466
|
+
* @param light A Babylon light built from an export, with `metadata.toolkit`.
|
|
6467
|
+
* @param scene The scene, whose toolkit metadata names the colour space.
|
|
6468
|
+
* @returns True when the colour was converted.
|
|
6469
|
+
*/
|
|
6470
|
+
static LinearizeLightColor(light: BABYLON.Light, scene: BABYLON.Scene): boolean;
|
|
6457
6471
|
/** Keys already warned about, so a per-parse or per-frame code path reports each problem once. */
|
|
6458
6472
|
private static Warned;
|
|
6459
6473
|
/**
|
|
@@ -6733,6 +6747,17 @@ declare namespace TOOLKIT {
|
|
|
6733
6747
|
* not a clamp, brings it to the display.
|
|
6734
6748
|
*/
|
|
6735
6749
|
static SpecularEnvironmentLevel(reflection: number, units: string, levelMax: number): number;
|
|
6750
|
+
/**
|
|
6751
|
+
* The scale for Unity's ambient probe on a scene environment. A physical environment's level is its sky's normalisation (the sky's
|
|
6752
|
+
* mean luminance), and PBR multiplies the locked SH by that level too, so the probe must carry its inverse or the ambient drops by
|
|
6753
|
+
* the sky's mean. A parity scene does this while it binds the SH, and a relative environment keeps its level. Pure.
|
|
6754
|
+
* @param ambientIntensity The scene's ambient intensity.
|
|
6755
|
+
* @param environmentLevel The environment texture's level, or null when the export has no environment file.
|
|
6756
|
+
* @param units The normalised `environment.units`.
|
|
6757
|
+
* @param isParity True on an HDRP parity scene.
|
|
6758
|
+
* @returns The scale for `generateSphericalHarmonics`.
|
|
6759
|
+
*/
|
|
6760
|
+
static EnvironmentAmbientScale(ambientIntensity: number, environmentLevel: number, units: string, isParity: boolean): number;
|
|
6736
6761
|
/**
|
|
6737
6762
|
* Warns once when an export marks its sky as baked but carries no environment block (hdrp-sky D19) - the
|
|
6738
6763
|
* silent failure this feature closed. Returns true when it warned. The skybox fallback still runs.
|
|
@@ -6842,7 +6867,7 @@ declare namespace TOOLKIT {
|
|
|
6842
6867
|
/** Set once the invisible-light skip is installed, so it is never wrapped twice. */
|
|
6843
6868
|
_tkSkipInvisible?: boolean;
|
|
6844
6869
|
/**
|
|
6845
|
-
* True while PREWARM's WebGPU pipeline stage draws this map with all its casters (SceneShaderWarmup.
|
|
6870
|
+
* True while PREWARM's WebGPU pipeline stage draws this map with all its casters (SceneShaderWarmup.DrawShadowMapsFully):
|
|
6846
6871
|
* the invisible-light skip is bypassed, so a light out of view at the reveal still builds its caster pipelines.
|
|
6847
6872
|
*/
|
|
6848
6873
|
_tkPrewarmDrawAll?: boolean;
|
|
@@ -7635,6 +7660,21 @@ declare namespace TOOLKIT {
|
|
|
7635
7660
|
static ShadowMapsRendered(scene: BABYLON.Scene, camera: BABYLON.Camera): boolean;
|
|
7636
7661
|
/** T12.5: fill the targets by copying the main pass's colour target before its transparents (URP's CopyColorPass). False = re-render the opaque scene (the T12.4 path). */
|
|
7637
7662
|
static UseCopy: boolean;
|
|
7663
|
+
/** `BABYLON.ConversionMode.None`. */
|
|
7664
|
+
private static readonly COPY_PLAIN;
|
|
7665
|
+
/** `BABYLON.ConversionMode.ToLinearSpace`. */
|
|
7666
|
+
private static readonly COPY_TO_LINEAR;
|
|
7667
|
+
/**
|
|
7668
|
+
* The conversion the copy needs so the target stays linear, as Unity's opaque texture is. A camera without HDR leaves image
|
|
7669
|
+
* processing to the materials (Babylon's LDR chain), so the colour target the copy reads holds display-encoded colour; a graph
|
|
7670
|
+
* that took that for linear reads Scene Color about three times too bright in the shadows. Pure.
|
|
7671
|
+
* @param imageProcessing The scene's image processing configuration, or null.
|
|
7672
|
+
* @returns The conversion mode to pass to `CopyTextureToTexture.copy`.
|
|
7673
|
+
*/
|
|
7674
|
+
static CopyConversionFor(imageProcessing: {
|
|
7675
|
+
isEnabled: boolean;
|
|
7676
|
+
applyByPostProcess: boolean;
|
|
7677
|
+
}): number;
|
|
7638
7678
|
/** Whether a rendering group's transparent queue holds a sub-mesh drawn with one of `materials` (the copy's trigger). Pure. */
|
|
7639
7679
|
static QueueSamples(subMeshes: any, materials: any): boolean;
|
|
7640
7680
|
/**
|
|
@@ -7648,6 +7688,41 @@ declare namespace TOOLKIT {
|
|
|
7648
7688
|
private static CopyNow;
|
|
7649
7689
|
}
|
|
7650
7690
|
}
|
|
7691
|
+
declare namespace TOOLKIT {
|
|
7692
|
+
/** The `metadata.urp` scene block (DR-4.6). Its sky and fog keep the `hdrp` block shapes, which the sky code reads untyped. */
|
|
7693
|
+
interface IUrpSceneBlock {
|
|
7694
|
+
version: number;
|
|
7695
|
+
sky?: any;
|
|
7696
|
+
fog?: any;
|
|
7697
|
+
clouds?: any;
|
|
7698
|
+
}
|
|
7699
|
+
/**
|
|
7700
|
+
* One place that answers "which physical sky block does this export carry", so the sky and fog code stays free of pipeline
|
|
7701
|
+
* checks. An HDRP parity export reads `metadata.hdrp`, and a URP export reads `metadata.urp`.
|
|
7702
|
+
*/
|
|
7703
|
+
class PhysicalSkyBlock {
|
|
7704
|
+
/** Lowest `urp` block version this runtime reads. */
|
|
7705
|
+
static readonly UrpBlockVersion: number;
|
|
7706
|
+
/**
|
|
7707
|
+
* The scene's `urp` block.
|
|
7708
|
+
* @param metadata - Scene metadata, which is untyped across the toolkit.
|
|
7709
|
+
* @returns The block, or null when the export has none.
|
|
7710
|
+
*/
|
|
7711
|
+
static UrpBlock(metadata: any): TOOLKIT.IUrpSceneBlock;
|
|
7712
|
+
/**
|
|
7713
|
+
* The physical sky block of an export.
|
|
7714
|
+
* @param metadata - Scene metadata.
|
|
7715
|
+
* @returns `hdrp.sky` on an HDRP parity export, `urp.sky` on a URP export, otherwise null.
|
|
7716
|
+
*/
|
|
7717
|
+
static SkyOf(metadata: any): any;
|
|
7718
|
+
/**
|
|
7719
|
+
* The fog block read by the physical sky's fog pass.
|
|
7720
|
+
* @param metadata - Scene metadata.
|
|
7721
|
+
* @returns `hdrp.fog` on an HDRP parity export, `urp.fog` on a URP export, otherwise null.
|
|
7722
|
+
*/
|
|
7723
|
+
static FogOf(metadata: any): any;
|
|
7724
|
+
}
|
|
7725
|
+
}
|
|
7651
7726
|
/** Babylon Toolkit Namespace */
|
|
7652
7727
|
declare namespace TOOLKIT {
|
|
7653
7728
|
/**
|
|
@@ -8688,6 +8763,13 @@ declare namespace TOOLKIT {
|
|
|
8688
8763
|
* uniform and non-uniform; a game registers its pooled copies).
|
|
8689
8764
|
*/
|
|
8690
8765
|
static WarmScaleVariantsOnReveal: boolean;
|
|
8766
|
+
/**
|
|
8767
|
+
* False leaves the levels of a native LOD group (Babylon `addLODLevel`) to the camera's distance during the WebGPU pipeline stage: a
|
|
8768
|
+
* level no warm camera selected at the reveal (a stump's LOD1 on a hillside the opening view sees only at LOD0 or culled) then built
|
|
8769
|
+
* its GPU pipeline the first time the game's camera came into its band. True (default) has every frame of the stage select the next
|
|
8770
|
+
* level of every native LOD group in turn (CycleNativeLodLevels), in the main pass and in every shadow map.
|
|
8771
|
+
*/
|
|
8772
|
+
static WarmNativeLodLevelsOnReveal: boolean;
|
|
8691
8773
|
/**
|
|
8692
8774
|
* Optional units (hidden meshes, render passes) are given up this long (ms) after every required unit is ready and no unit
|
|
8693
8775
|
* has become ready since, once each was checked: the grace restarts whenever a unit becomes ready, so a queue still finishing
|
|
@@ -9544,21 +9626,33 @@ declare namespace TOOLKIT {
|
|
|
9544
9626
|
*/
|
|
9545
9627
|
private static RestoreShadowCasterLists;
|
|
9546
9628
|
/**
|
|
9547
|
-
* Makes every
|
|
9548
|
-
*
|
|
9549
|
-
* built no caster pipelines and they compiled the first time it came into
|
|
9550
|
-
* `_tkPrewarmDrawAll` (the gate then asks Babylon only)
|
|
9551
|
-
*
|
|
9629
|
+
* Makes every shadow map that culls its casters, or whose render is skipped, draw all its casters during the pipeline stage:
|
|
9630
|
+
* - a point or spot map gated by LightingConversions.SkipInvisiblePunctualShadowMap is skipped while its light is out of view, so
|
|
9631
|
+
* on WebGPU a light the camera cannot see at the reveal built no caster pipelines and they compiled the first time it came into
|
|
9632
|
+
* view (a late compile mid-race); it gets `_tkPrewarmDrawAll` (the gate then asks Babylon only);
|
|
9633
|
+
* - a map with one of the toolkit's caster culling lists (HasCasterCullingList: the Unity culling, or the terrain's) drops every
|
|
9634
|
+
* caster outside its pass, so a directional cascade drew only the casters near the opening view and a prop the camera reached
|
|
9635
|
+
* later built its shadow pipeline then (a late pipeline after a camera cut).
|
|
9636
|
+
* Each such map has its caster culling list set aside (Babylon draws the whole renderList) and renders again on the next frame.
|
|
9637
|
+
* RestoreFullShadowMaps undoes it.
|
|
9552
9638
|
* @param scene - The scene being prewarmed.
|
|
9553
|
-
* @returns What was changed, for
|
|
9639
|
+
* @returns What was changed, for RestoreFullShadowMaps.
|
|
9640
|
+
*/
|
|
9641
|
+
private static DrawShadowMapsFully;
|
|
9642
|
+
/**
|
|
9643
|
+
* True when the shadow map's custom render list is one of the toolkit's caster cullings: LightingConversions.ApplyUnityCasterCulling
|
|
9644
|
+
* marks its function `tkCasterCulling`, and TerrainBuilder.InstallCasterCulling, which wraps it on a scene with terrain, marks
|
|
9645
|
+
* its own `tkTerrainCulling`.
|
|
9646
|
+
* @param shadowMap - The shadow map.
|
|
9647
|
+
* @returns True for a caster-culled map.
|
|
9554
9648
|
*/
|
|
9555
|
-
|
|
9649
|
+
static HasCasterCullingList(shadowMap: BABYLON.RenderTargetTexture): boolean;
|
|
9556
9650
|
/**
|
|
9557
|
-
* Puts back what
|
|
9558
|
-
*
|
|
9559
|
-
* @param draws - What
|
|
9651
|
+
* Puts back what DrawShadowMapsFully changed: the draw-all flag is cleared and each map gets its caster culling list back, unless
|
|
9652
|
+
* something else installed a list meanwhile.
|
|
9653
|
+
* @param draws - What DrawShadowMapsFully changed.
|
|
9560
9654
|
*/
|
|
9561
|
-
private static
|
|
9655
|
+
private static RestoreFullShadowMaps;
|
|
9562
9656
|
/** Frames each material of a material variant is drawn for in a row by the pipeline stage (AlternateMaterialVariants). */
|
|
9563
9657
|
private static readonly MATERIAL_VARIANT_FRAMES;
|
|
9564
9658
|
/** Per scene: meshes that also draw with another material during play (WarmMaterialVariant). */
|
|
@@ -9702,6 +9796,28 @@ declare namespace TOOLKIT {
|
|
|
9702
9796
|
* @param draw - What AlternateScaleVariants changed (null: nothing).
|
|
9703
9797
|
*/
|
|
9704
9798
|
private static RestoreScaleVariants;
|
|
9799
|
+
/**
|
|
9800
|
+
* The meshes a native LOD master can draw (Babylon `addLODLevel`): the master itself, then each level's mesh in order. The cull
|
|
9801
|
+
* band's null level and a mesh listed twice are left out.
|
|
9802
|
+
* @param mesh - Any mesh.
|
|
9803
|
+
* @returns The sequence, or an empty array when the mesh has no LOD levels.
|
|
9804
|
+
*/
|
|
9805
|
+
static NativeLodSequence(mesh: BABYLON.AbstractMesh): BABYLON.AbstractMesh[];
|
|
9806
|
+
/**
|
|
9807
|
+
* Makes the frames of the reveal-time pipeline stage select every native LOD level in turn: frame n draws level n modulo the
|
|
9808
|
+
* group's level count for every native LOD master, through `scene.customLODSelector`, which Babylon asks for the main pass and for
|
|
9809
|
+
* every render target (shadow maps included). Without it a level drew only where a warm camera's distance selected it, so a LOD1
|
|
9810
|
+
* the opening view never reached built its GPU pipeline after the reveal. Meshes without levels keep the scene's own selection.
|
|
9811
|
+
* @param scene - The scene being prewarmed.
|
|
9812
|
+
* @returns What to undo (RestoreNativeLodLevels), or null when the scene has no native LOD group or WarmNativeLodLevelsOnReveal is false.
|
|
9813
|
+
*/
|
|
9814
|
+
static CycleNativeLodLevels(scene: BABYLON.Scene): TOOLKIT.INativeLodCycle;
|
|
9815
|
+
/**
|
|
9816
|
+
* Ends CycleNativeLodLevels: the scene's own LOD selector is given back, unless something else replaced the cycle's meanwhile.
|
|
9817
|
+
* @param scene - The scene being prewarmed.
|
|
9818
|
+
* @param cycle - What CycleNativeLodLevels changed (null: nothing).
|
|
9819
|
+
*/
|
|
9820
|
+
static RestoreNativeLodLevels(scene: BABYLON.Scene, cycle: TOOLKIT.INativeLodCycle): void;
|
|
9705
9821
|
/**
|
|
9706
9822
|
* Forces (or stops forcing) each mesh's other scaling state. While forced, the mesh's own `_updateNonUniformScalingState` property
|
|
9707
9823
|
* keeps the other state through the frame's world-matrix updates (and the state is set at once for a mesh whose matrix is not
|
|
@@ -9796,6 +9912,7 @@ declare namespace TOOLKIT {
|
|
|
9796
9912
|
* @param deadline - SceneShaderWarmup.NowMs() after which the stage stops waiting.
|
|
9797
9913
|
* @param phases - The camera phases, in order; null draws the game's own camera(s).
|
|
9798
9914
|
* @param onProgress - Called after each frame with the compiled and requested pipeline counts.
|
|
9915
|
+
* @param settleFrames - Consecutive quiet frames that end a phase (a LOD cycle needs one full cycle; default PIPELINE_SETTLE_FRAMES).
|
|
9799
9916
|
* @returns Resolves true when the deadline passed before every phase was quiet.
|
|
9800
9917
|
*/
|
|
9801
9918
|
private static WaitForPipelinesPerCamera;
|
|
@@ -9812,8 +9929,9 @@ declare namespace TOOLKIT {
|
|
|
9812
9929
|
*/
|
|
9813
9930
|
private static RunCameraPhasesAsync;
|
|
9814
9931
|
/**
|
|
9815
|
-
* Renders frames (the render loop keeps running) until the scene's draws request no new pipeline for
|
|
9816
|
-
* frames and none is still compiling, or the deadline passes. Reports `onProgress(compiled,
|
|
9932
|
+
* Renders frames (the render loop keeps running) until the scene's draws request no new pipeline for `settleFrames` consecutive
|
|
9933
|
+
* frames (default PIPELINE_SETTLE_FRAMES) and none is still compiling, or the deadline passes. Reports `onProgress(compiled,
|
|
9934
|
+
* requested)` after each frame.
|
|
9817
9935
|
*/
|
|
9818
9936
|
private static WaitForPipelines;
|
|
9819
9937
|
/**
|
|
@@ -10531,6 +10649,21 @@ declare namespace TOOLKIT {
|
|
|
10531
10649
|
/** The frame observer that switches the variant. */
|
|
10532
10650
|
frameObserver: BABYLON.Observer<BABYLON.Scene>;
|
|
10533
10651
|
}
|
|
10652
|
+
/** @hidden The native LOD selection the reveal-time pipeline stage forces in turn (CycleNativeLodLevels). */
|
|
10653
|
+
interface INativeLodCycle {
|
|
10654
|
+
/** Each native LOD master and the meshes it can draw, master first (NativeLodSequence). */
|
|
10655
|
+
sequences: Map<BABYLON.AbstractMesh, BABYLON.AbstractMesh[]>;
|
|
10656
|
+
/** The longest sequence: the frames one full cycle takes. */
|
|
10657
|
+
length: number;
|
|
10658
|
+
/** Frames drawn since the cycle began; frame n selects level n modulo a sequence's length. */
|
|
10659
|
+
frameIndex: number;
|
|
10660
|
+
/** The scene's own LOD selector, given back by RestoreNativeLodLevels (null when it had none). */
|
|
10661
|
+
previousSelector: (mesh: BABYLON.AbstractMesh, camera: BABYLON.Camera) => BABYLON.Nullable<BABYLON.AbstractMesh>;
|
|
10662
|
+
/** The selector the cycle installed. */
|
|
10663
|
+
selector: (mesh: BABYLON.AbstractMesh, camera: BABYLON.Camera) => BABYLON.Nullable<BABYLON.AbstractMesh>;
|
|
10664
|
+
/** The frame observer that advances frameIndex. */
|
|
10665
|
+
frameObserver: BABYLON.Observer<BABYLON.Scene>;
|
|
10666
|
+
}
|
|
10534
10667
|
/** @hidden A hidden particle emitter the particle stage lets draw (ShowHiddenEmittersForDraws). */
|
|
10535
10668
|
interface IHiddenEmitterDraw {
|
|
10536
10669
|
/** The emitter node. */
|
|
@@ -10591,6 +10724,13 @@ declare namespace TOOLKIT {
|
|
|
10591
10724
|
}
|
|
10592
10725
|
/** @hidden A render target's custom render list (RenderTargetTexture.getCustomRenderList). */
|
|
10593
10726
|
type CustomRenderListFunction = (layerOrFace: number, renderList: readonly BABYLON.AbstractMesh[], renderListLength: number) => BABYLON.AbstractMesh[];
|
|
10727
|
+
/** @hidden The marks the toolkit's caster culling lists carry on their function (SceneShaderWarmup.HasCasterCullingList). */
|
|
10728
|
+
interface ICasterCullingListMarks {
|
|
10729
|
+
/** Set by LightingConversions.ApplyUnityCasterCulling. */
|
|
10730
|
+
tkCasterCulling?: boolean;
|
|
10731
|
+
/** Set by TerrainBuilder.InstallCasterCulling. */
|
|
10732
|
+
tkTerrainCulling?: boolean;
|
|
10733
|
+
}
|
|
10594
10734
|
/** @hidden A shadow map whose custom render list the reveal-time pipeline stage wrapped (KeepHiddenCastersInShadowMaps). */
|
|
10595
10735
|
interface IShadowCasterListWrap {
|
|
10596
10736
|
/** The shadow map. */
|
|
@@ -10600,8 +10740,8 @@ declare namespace TOOLKIT {
|
|
|
10600
10740
|
/** The wrapper that keeps the shown hidden casters. */
|
|
10601
10741
|
keptList: TOOLKIT.CustomRenderListFunction;
|
|
10602
10742
|
}
|
|
10603
|
-
/** @hidden A
|
|
10604
|
-
interface
|
|
10743
|
+
/** @hidden A gated or caster-culled shadow map the reveal-time pipeline stage draws with all its casters (DrawShadowMapsFully). */
|
|
10744
|
+
interface IShadowMapFullDraw {
|
|
10605
10745
|
/** The shadow map. */
|
|
10606
10746
|
shadowMap: BABYLON.RenderTargetTexture;
|
|
10607
10747
|
/** Its caster culling list, set aside during the stage. */
|
|
@@ -11769,6 +11909,17 @@ declare namespace TOOLKIT {
|
|
|
11769
11909
|
smoothDeltaTime: number;
|
|
11770
11910
|
frame: number;
|
|
11771
11911
|
}
|
|
11912
|
+
/** One shader global component advanced every frame by scene time, for values Unity's scripts drive at runtime. */
|
|
11913
|
+
interface IShaderGlobalDriver {
|
|
11914
|
+
/** The global's Unity reference name. */
|
|
11915
|
+
name: string;
|
|
11916
|
+
/** The vector component advanced: 0 x, 1 y, 2 z, 3 w. */
|
|
11917
|
+
component: number;
|
|
11918
|
+
/** Units per second. */
|
|
11919
|
+
rate: number;
|
|
11920
|
+
/** The value is wrapped by subtracting this when it passes it. Zero means no wrap. */
|
|
11921
|
+
wrap: number;
|
|
11922
|
+
}
|
|
11772
11923
|
/**
|
|
11773
11924
|
* Unity's shader globals for transpiled Shader Graph classes (shadergraph-transpiler-complete-coverage D16, D18).
|
|
11774
11925
|
*
|
|
@@ -11787,6 +11938,8 @@ declare namespace TOOLKIT {
|
|
|
11787
11938
|
* generated material of a scene animates in lockstep.
|
|
11788
11939
|
*/
|
|
11789
11940
|
class ShaderGlobals {
|
|
11941
|
+
/** The Vector4 member each `IShaderGlobalDriver.component` index names. */
|
|
11942
|
+
private static readonly DriverComponentNames;
|
|
11790
11943
|
private static _version;
|
|
11791
11944
|
private static _floats;
|
|
11792
11945
|
private static _vectors;
|
|
@@ -11820,6 +11973,19 @@ declare namespace TOOLKIT {
|
|
|
11820
11973
|
* scene's first frame.
|
|
11821
11974
|
*/
|
|
11822
11975
|
static LoadSceneGlobals(scene: BABYLON.Scene, block: any): void;
|
|
11976
|
+
/**
|
|
11977
|
+
* Advances exported shader globals every frame, so a value Unity's scripts drive at runtime keeps moving in the browser.
|
|
11978
|
+
* Adds one observer per scene, and only when the export lists a driver.
|
|
11979
|
+
* @param scene - The scene whose clock drives the values.
|
|
11980
|
+
* @param drivers - The exported drivers, or null.
|
|
11981
|
+
*/
|
|
11982
|
+
static LoadSceneDrivers(scene: BABYLON.Scene, drivers: TOOLKIT.IShaderGlobalDriver[]): void;
|
|
11983
|
+
/**
|
|
11984
|
+
* Advances one driver in place. The stored Vector4 is mutated, so a frame allocates nothing. Bumps the version.
|
|
11985
|
+
* @param driver - The driver to advance.
|
|
11986
|
+
* @param deltaSeconds - Seconds since the last frame.
|
|
11987
|
+
*/
|
|
11988
|
+
private static AdvanceDriver;
|
|
11823
11989
|
/** The scene clock (registered on first use, removed when the scene is disposed). */
|
|
11824
11990
|
static GetClock(scene: BABYLON.Scene): TOOLKIT.IShaderClock;
|
|
11825
11991
|
}
|
|
@@ -12167,6 +12333,15 @@ declare namespace TOOLKIT {
|
|
|
12167
12333
|
static ApplyInstanceBlock(instance: BABYLON.InstancedMesh, block: any, sub?: number): boolean;
|
|
12168
12334
|
/** The clone of one material with a property block applied (null when the material is not a toolkit custom material). */
|
|
12169
12335
|
static CloneWithBlock(material: BABYLON.Material, block: any, meshId: number, loadTexture?: (info: any, done: (texture: BABYLON.BaseTexture) => void) => void): BABYLON.Material;
|
|
12336
|
+
/**
|
|
12337
|
+
* Keeps the exporter's "not carried" list for the scene summary. Schedules the summary itself,
|
|
12338
|
+
* so a scene with no graph material still prints it.
|
|
12339
|
+
* @param scene - The scene the export belongs to.
|
|
12340
|
+
* @param entries - The `exportreport` metadata list; absent or empty when the export lost nothing.
|
|
12341
|
+
*/
|
|
12342
|
+
static RecordExportReport(scene: BABYLON.Scene, entries: TOOLKIT.IExportReportEntry[]): void;
|
|
12343
|
+
/** Prints the exporter's list as one collapsed group, then forgets it so a later flush does not repeat it. */
|
|
12344
|
+
private static PrintExportReport;
|
|
12170
12345
|
/** One warning for the missing classes, then one console.groupCollapsed per scene; clears the record. */
|
|
12171
12346
|
static FlushSceneSummary(scene: BABYLON.Scene): void;
|
|
12172
12347
|
}
|
|
@@ -12190,6 +12365,19 @@ declare namespace TOOLKIT {
|
|
|
12190
12365
|
/** T32.1: the pending quiet-period timer and its latest flush time. */
|
|
12191
12366
|
timer?: any;
|
|
12192
12367
|
deadline?: number;
|
|
12368
|
+
/** The exporter's "not carried" list, until the summary prints it. */
|
|
12369
|
+
exportReport?: IExportReportEntry[];
|
|
12370
|
+
}
|
|
12371
|
+
/** One line of `metadata.exportreport`: something the export could not carry to the browser. */
|
|
12372
|
+
interface IExportReportEntry {
|
|
12373
|
+
/** The report group, such as `Renderer features`. */
|
|
12374
|
+
feature: string;
|
|
12375
|
+
/** Why the items do not reach the browser. */
|
|
12376
|
+
reason: string;
|
|
12377
|
+
/** Every distinct item name. */
|
|
12378
|
+
items: string[];
|
|
12379
|
+
/** How many times the exporter met this, which can exceed `items.length`. */
|
|
12380
|
+
count: number;
|
|
12193
12381
|
}
|
|
12194
12382
|
/**
|
|
12195
12383
|
* shadergraph-transpiler-complete-coverage X2: the ShadowDepthWrapper of a graph class that casts through its own shader
|
|
@@ -14124,10 +14312,18 @@ declare namespace TOOLKIT {
|
|
|
14124
14312
|
static readonly FADE_SPEEDTREE: number;
|
|
14125
14313
|
/** Unity's LODGroup.crossFadeAnimationDuration default (the terrain trees use the same, TerrainTrees.FADE_SECONDS). */
|
|
14126
14314
|
static FADE_SECONDS: number;
|
|
14315
|
+
/** Largest offset, in meters, at which a level still draws correctly with its master's world matrix. */
|
|
14316
|
+
static readonly NATIVE_TRANSFORM_TOLERANCE_METERS: number;
|
|
14317
|
+
/** Largest difference in one rotation or scale matrix element between a level and its master. */
|
|
14318
|
+
static readonly NATIVE_BASIS_TOLERANCE: number;
|
|
14319
|
+
/** The indices of a matrix's rotation and scale elements. */
|
|
14320
|
+
private static readonly BASIS_ELEMENTS;
|
|
14127
14321
|
/**
|
|
14128
14322
|
* H-a: the group's world size and local reference point from the exported `lodsize` (LODGroup.size, local) and
|
|
14129
|
-
* `lodcenter` (LODGroup.localReferencePoint
|
|
14130
|
-
*
|
|
14323
|
+
* `lodcenter` (LODGroup.localReferencePoint with its x negated). The node's world matrix takes Unity's local axes, so
|
|
14324
|
+
* x is negated back here: the world point then equals Unity's `transform.TransformPoint(localReferencePoint)`.
|
|
14325
|
+
* Unity's world size is the size times the largest absolute lossy scale. Null when the export has neither (older
|
|
14326
|
+
* exports: the mesh boxes are used).
|
|
14131
14327
|
*/
|
|
14132
14328
|
static ExportedSize(root: BABYLON.TransformNode, metadata: any): {
|
|
14133
14329
|
worldSize: number;
|
|
@@ -14138,6 +14334,32 @@ declare namespace TOOLKIT {
|
|
|
14138
14334
|
useDistances: boolean;
|
|
14139
14335
|
thresholds: number[];
|
|
14140
14336
|
};
|
|
14337
|
+
/**
|
|
14338
|
+
* Whether every level can be drawn by Babylon's native LOD, which draws a detail level with its master's world
|
|
14339
|
+
* matrix and ignores the detail's own. Levels authored with different pivots must use the shared switcher, or they
|
|
14340
|
+
* appear displaced by the difference. Reads each node's own matrix, so a mesh that is already a detail level is
|
|
14341
|
+
* judged by its own transform too.
|
|
14342
|
+
* @param master The LOD0 mesh.
|
|
14343
|
+
* @param details The lower levels' meshes.
|
|
14344
|
+
* @returns True when each detail's world transform matches the master's within the tolerances.
|
|
14345
|
+
*/
|
|
14346
|
+
static LevelsShareTransform(master: BABYLON.AbstractMesh, details: BABYLON.AbstractMesh[]): boolean;
|
|
14347
|
+
/**
|
|
14348
|
+
* Whether two world matrices place a mesh at the same spot within the native tolerances.
|
|
14349
|
+
* @param first One world matrix.
|
|
14350
|
+
* @param second The other world matrix.
|
|
14351
|
+
* @returns True when their translations and their rotation and scale elements match.
|
|
14352
|
+
*/
|
|
14353
|
+
private static MatricesShareTransform;
|
|
14354
|
+
/**
|
|
14355
|
+
* Whether a group must run on the shared switcher instead of Babylon's native LOD, on either native entry point
|
|
14356
|
+
* (coverages or the legacy distances): it cross-fades, a level has several renderers, or a level sits away from
|
|
14357
|
+
* LOD0's world transform. Instanced masters answer like any other: their legacy handling stays with the caller.
|
|
14358
|
+
* @param meshLevels The resolved meshes of each level, LOD0 first.
|
|
14359
|
+
* @param fadeMode The group's FADE_* mode.
|
|
14360
|
+
* @returns True when only the switcher can draw the group as authored.
|
|
14361
|
+
*/
|
|
14362
|
+
static RequiresSwitcher(meshLevels: BABYLON.AbstractMesh[][], fadeMode: number): boolean;
|
|
14141
14363
|
/** Exported fade mode name => FADE_*. */
|
|
14142
14364
|
static ParseFadeMode(mode: string): number;
|
|
14143
14365
|
/** Scene-wide QualitySettings.lodBias (the exported `lodbias`, 1 when absent). */
|
|
@@ -14198,7 +14420,10 @@ declare namespace TOOLKIT {
|
|
|
14198
14420
|
* group culls below the last coverage, and an orthographic camera (whose Babylon LOD distance is minZ) gets
|
|
14199
14421
|
* 0 / 1e30 thresholds that pick Unity's distance-independent level. They are recomputed only when the camera,
|
|
14200
14422
|
* its fov / fov mode / aspect / projection / ortho size, or the LOD bias change.
|
|
14201
|
-
* `details[k - 1]` is level k's mesh. Returns false (nothing registered) when the levels cannot be native
|
|
14423
|
+
* `details[k - 1]` is level k's mesh. Returns false (nothing registered) when the levels cannot be native: a level
|
|
14424
|
+
* authored away from LOD0 (LevelsShareTransform), or a master with instances. An InstancedMesh follows its source's
|
|
14425
|
+
* LOD levels while the switcher toggles that same instance, so such a master joins its instances on the switcher and
|
|
14426
|
+
* every level has one owner.
|
|
14202
14427
|
*/
|
|
14203
14428
|
addNativeGroup(master: BABYLON.Mesh, details: BABYLON.Mesh[], coverages: number[], worldSize: number): boolean;
|
|
14204
14429
|
get nativeGroupCount(): number;
|
|
@@ -34735,129 +34960,6 @@ declare namespace PROJECT {
|
|
|
34735
34960
|
bindForSubMesh(uniformBuffer: BABYLON.UniformBuffer, scene: BABYLON.Scene, engine: BABYLON.AbstractEngine, subMesh: BABYLON.SubMesh): void;
|
|
34736
34961
|
}
|
|
34737
34962
|
}
|
|
34738
|
-
declare namespace PROJECT {
|
|
34739
|
-
/**
|
|
34740
|
-
* Babylon toolkit default camera system class
|
|
34741
|
-
* @class DefaultCameraSystem - All rights reserved (c) 2020 Mackey Kinard
|
|
34742
|
-
* @deprecated This class is considered legacy and may be removed in future versions.
|
|
34743
|
-
*/
|
|
34744
|
-
class DefaultCameraSystem extends TOOLKIT.ScriptComponent {
|
|
34745
|
-
protected static PlayerOneCamera: BABYLON.FreeCamera;
|
|
34746
|
-
protected static PlayerTwoCamera: BABYLON.FreeCamera;
|
|
34747
|
-
protected static PlayerThreeCamera: BABYLON.FreeCamera;
|
|
34748
|
-
protected static PlayerFourCamera: BABYLON.FreeCamera;
|
|
34749
|
-
protected static XRExperienceHelper: BABYLON.WebXRDefaultExperience;
|
|
34750
|
-
private static multiPlayerView;
|
|
34751
|
-
private static multiPlayerCount;
|
|
34752
|
-
private static multiPlayerCameras;
|
|
34753
|
-
private static stereoCameras;
|
|
34754
|
-
private static startupMode;
|
|
34755
|
-
private static cameraReady;
|
|
34756
|
-
private static cameraInstance;
|
|
34757
|
-
static IsCameraSystemReady(): boolean;
|
|
34758
|
-
/** Register handler that is triggered when the webxr experience helper has been created */
|
|
34759
|
-
static OnXRExperienceHelperObservable: BABYLON.Observable<BABYLON.WebXRDefaultExperience>;
|
|
34760
|
-
/** Default Follow Speed */
|
|
34761
|
-
static FOLLOW_SPEED: number;
|
|
34762
|
-
private mainCamera;
|
|
34763
|
-
private cameraType;
|
|
34764
|
-
private cameraInertia;
|
|
34765
|
-
private cameraController;
|
|
34766
|
-
private immersiveOptions;
|
|
34767
|
-
private arcRotateConfig;
|
|
34768
|
-
private multiPlayerSetup;
|
|
34769
|
-
private fullScreenToggle;
|
|
34770
|
-
private setPointerLock;
|
|
34771
|
-
private setCameraTarget;
|
|
34772
|
-
private setSpatialAudio;
|
|
34773
|
-
protected m_cameraRig: BABYLON.TargetCamera;
|
|
34774
|
-
isMainCamera(): boolean;
|
|
34775
|
-
getCameraType(): number;
|
|
34776
|
-
getTargetTransform(): BABYLON.TransformNode;
|
|
34777
|
-
setTargetTransform(target: BABYLON.TransformNode): void;
|
|
34778
|
-
enableSpatialAudio(value: boolean): void;
|
|
34779
|
-
constructor(transform: BABYLON.TransformNode, scene: BABYLON.Scene, properties?: any, alias?: string);
|
|
34780
|
-
protected awake(): void;
|
|
34781
|
-
protected start(): void;
|
|
34782
|
-
protected update(): void;
|
|
34783
|
-
protected destroy(): void;
|
|
34784
|
-
protected awakeCameraSystemState(): void;
|
|
34785
|
-
protected startCameraSystemState(): Promise<void>;
|
|
34786
|
-
protected updateCameraSystemState(): void;
|
|
34787
|
-
protected cleanCameraSystemState(): void;
|
|
34788
|
-
protected destroyCameraSystemState(): void;
|
|
34789
|
-
/*********************************************/
|
|
34790
|
-
/** Follow Target Camera Controller Helpers */
|
|
34791
|
-
/*********************************************/
|
|
34792
|
-
targetCameraOffset: BABYLON.Vector3;
|
|
34793
|
-
getCameraPivotPosition(): BABYLON.Vector3;
|
|
34794
|
-
getCameraPivotRotation(): BABYLON.Quaternion;
|
|
34795
|
-
getCameraBoomNode(): BABYLON.TransformNode;
|
|
34796
|
-
getCameraTransform(): BABYLON.TransformNode;
|
|
34797
|
-
private cameraNode;
|
|
34798
|
-
private cameraPivot;
|
|
34799
|
-
private cameraDistance;
|
|
34800
|
-
private cameraPivotOffset;
|
|
34801
|
-
private cameraBoomPosition;
|
|
34802
|
-
private dollyDirection;
|
|
34803
|
-
private rotationEulers;
|
|
34804
|
-
private scaledCamDirection;
|
|
34805
|
-
private scaledMaxDirection;
|
|
34806
|
-
private parentNodePosition;
|
|
34807
|
-
private maximumCameraPos;
|
|
34808
|
-
private cameraRaycastShape;
|
|
34809
|
-
private targetRotationVector;
|
|
34810
|
-
private resetCameraRotation;
|
|
34811
|
-
private updateCameraController;
|
|
34812
|
-
getBoomArmMaxDistance(): number;
|
|
34813
|
-
setBoomArmMaxDistance(distance: number): void;
|
|
34814
|
-
setSmoothBoomArmLength(length: number, speed: number, updateMaxDistance?: boolean): void;
|
|
34815
|
-
private smoothBoomArmLength;
|
|
34816
|
-
private smoothBoomArmSpeed;
|
|
34817
|
-
private updateSmoothBoomArmLength;
|
|
34818
|
-
static EnableTracking(value: boolean): void;
|
|
34819
|
-
static IsTrackingEnabled(): boolean;
|
|
34820
|
-
static SetAutoUpdate(value: boolean): void;
|
|
34821
|
-
static IsAutoUpdateEnabled(): boolean;
|
|
34822
|
-
static GetFollowTarget(): BABYLON.TransformNode;
|
|
34823
|
-
static SetFollowTarget(target: BABYLON.TransformNode): void;
|
|
34824
|
-
static ResetFollowTarget(): void;
|
|
34825
|
-
static UpdateFollowTarget(): void;
|
|
34826
|
-
/** Get the WebXR default experience helper */
|
|
34827
|
-
static GetWebXR(): BABYLON.WebXRDefaultExperience;
|
|
34828
|
-
/** Is universal camera system in WebXR mode */
|
|
34829
|
-
static IsInWebXR(): boolean;
|
|
34830
|
-
/** Setup navigation mesh for WebXR */
|
|
34831
|
-
private static SetupNavigationWebXR;
|
|
34832
|
-
/** Get main camera rig for the scene */
|
|
34833
|
-
static GetMainCamera(scene: BABYLON.Scene, detach?: boolean): BABYLON.FreeCamera;
|
|
34834
|
-
/** Get universal camera rig for desired player */
|
|
34835
|
-
static GetPlayerCamera(scene: BABYLON.Scene, player?: TOOLKIT.PlayerNumber, detach?: boolean): BABYLON.FreeCamera;
|
|
34836
|
-
/** Get camera transform node for desired player */
|
|
34837
|
-
static GetCameraTransform(scene: BABYLON.Scene, player?: TOOLKIT.PlayerNumber): BABYLON.TransformNode;
|
|
34838
|
-
/** Are stereo side side camera services available. */
|
|
34839
|
-
static IsStereoCameras(): boolean;
|
|
34840
|
-
/** Are local multi player view services available. */
|
|
34841
|
-
static IsMultiPlayerView(): boolean;
|
|
34842
|
-
/** Get the current local multi player count */
|
|
34843
|
-
static GetMultiPlayerCount(): number;
|
|
34844
|
-
/** Activates current local multi player cameras. */
|
|
34845
|
-
static ActivateMultiPlayerCameras(scene: BABYLON.Scene): boolean;
|
|
34846
|
-
/** Disposes current local multiplayer cameras */
|
|
34847
|
-
static DisposeMultiPlayerCameras(): void;
|
|
34848
|
-
/** Sets the multi player camera view layout */
|
|
34849
|
-
static SetMultiPlayerViewLayout(scene: BABYLON.Scene, totalNumPlayers: number): boolean;
|
|
34850
|
-
}
|
|
34851
|
-
/*********************************************/
|
|
34852
|
-
/** Camera Editor Properties Support Classes */
|
|
34853
|
-
/*********************************************/
|
|
34854
|
-
interface IEditorArcRtotate {
|
|
34855
|
-
alpha: number;
|
|
34856
|
-
beta: number;
|
|
34857
|
-
radius: number;
|
|
34858
|
-
target: TOOLKIT.IUnityVector3;
|
|
34859
|
-
}
|
|
34860
|
-
}
|
|
34861
34963
|
declare namespace PROJECT {
|
|
34862
34964
|
/**
|
|
34863
34965
|
* Babylon Script Component
|
|
@@ -35061,811 +35163,6 @@ declare namespace PROJECT {
|
|
|
35061
35163
|
protected destroy(): void;
|
|
35062
35164
|
}
|
|
35063
35165
|
}
|
|
35064
|
-
declare namespace PROJECT {
|
|
35065
|
-
/**
|
|
35066
|
-
* Babylon Script Component (LEGACY)
|
|
35067
|
-
* @class RemotePlayerController
|
|
35068
|
-
* @deprecated This class is considered legacy and may be removed in future versions.
|
|
35069
|
-
*/
|
|
35070
|
-
class RemotePlayerController extends TOOLKIT.ScriptComponent {
|
|
35071
|
-
updateStateParams: boolean;
|
|
35072
|
-
smoothMotionTime: number;
|
|
35073
|
-
smoothInputVectors: boolean;
|
|
35074
|
-
private animator;
|
|
35075
|
-
private animationStateParams;
|
|
35076
|
-
constructor(transform: BABYLON.TransformNode, scene: BABYLON.Scene, properties?: any, alias?: string);
|
|
35077
|
-
protected awake(): void;
|
|
35078
|
-
protected update(): void;
|
|
35079
|
-
protected destroy(): void;
|
|
35080
|
-
/** Finds the remote player's `TOOLKIT.Animator`, on this node or on the first child that carries one. */
|
|
35081
|
-
private attachAnimationController;
|
|
35082
|
-
private validateAnimationStateParams;
|
|
35083
|
-
}
|
|
35084
|
-
}
|
|
35085
|
-
declare namespace PROJECT {
|
|
35086
|
-
/**
|
|
35087
|
-
* Babylon toolkit standard player controller class (LEGACY)
|
|
35088
|
-
* @class StandardPlayerController - All rights reserved (c) 2020 Mackey Kinard
|
|
35089
|
-
* @deprecated This class is considered legacy and may be removed in future versions.
|
|
35090
|
-
*/
|
|
35091
|
-
class StandardPlayerController extends TOOLKIT.ScriptComponent {
|
|
35092
|
-
static MIN_VERTICAL_VELOCITY: number;
|
|
35093
|
-
static MIN_GROUND_DISTANCE: number;
|
|
35094
|
-
static MIN_MOVE_EPSILON: number;
|
|
35095
|
-
static MIN_TIMER_OFFSET: number;
|
|
35096
|
-
static MIN_SLOPE_LIMIT: number;
|
|
35097
|
-
static PLAYER_HEIGHT: string;
|
|
35098
|
-
enableInput: boolean;
|
|
35099
|
-
attachCamera: boolean;
|
|
35100
|
-
rotateCamera: boolean;
|
|
35101
|
-
mouseWheel: boolean;
|
|
35102
|
-
toggleView: boolean;
|
|
35103
|
-
freeLooking: boolean;
|
|
35104
|
-
requireSprintButton: boolean;
|
|
35105
|
-
gravitationalForce: number;
|
|
35106
|
-
minFallVelocity: number;
|
|
35107
|
-
verticalStepSpeed: number;
|
|
35108
|
-
minStepUpHeight: number;
|
|
35109
|
-
rigidBodyMass: number;
|
|
35110
|
-
airbornTimeout: number;
|
|
35111
|
-
maxAngle: number;
|
|
35112
|
-
speedFactor: number;
|
|
35113
|
-
rootMotion: boolean;
|
|
35114
|
-
moveSpeed: number;
|
|
35115
|
-
walkSpeed: number;
|
|
35116
|
-
lookSpeed: number;
|
|
35117
|
-
jumpSpeed: number;
|
|
35118
|
-
jumpDelay: number;
|
|
35119
|
-
eyesHeight: number;
|
|
35120
|
-
pivotHeight: number;
|
|
35121
|
-
maxDistance: number;
|
|
35122
|
-
scrollSpeed: number;
|
|
35123
|
-
topLookLimit: number;
|
|
35124
|
-
downLookLimit: number;
|
|
35125
|
-
lowTurnSpeed: number;
|
|
35126
|
-
highTurnSpeed: number;
|
|
35127
|
-
smoothDampTime: number;
|
|
35128
|
-
smoothInputVectors: boolean;
|
|
35129
|
-
smoothAcceleration: boolean;
|
|
35130
|
-
accelerationSpeed: number;
|
|
35131
|
-
decelerationSpeed: number;
|
|
35132
|
-
avatarSkinTag: string;
|
|
35133
|
-
climbVolumeTag: string;
|
|
35134
|
-
vaultVolumeTag: string;
|
|
35135
|
-
maxHeightRanges: any;
|
|
35136
|
-
useClimbSystem: boolean;
|
|
35137
|
-
distanceFactor: number;
|
|
35138
|
-
cameraSmoothing: number;
|
|
35139
|
-
cameraCollisions: boolean;
|
|
35140
|
-
inputMagnitude: number;
|
|
35141
|
-
/** Unity StarterAssetsInputs.analogMovement: true drives the MotionSpeed parameter with the input magnitude (gamepad sticks), false keeps it at 1 (keyboard). */
|
|
35142
|
-
analogMovement: boolean;
|
|
35143
|
-
landingEpsilon: number;
|
|
35144
|
-
minimumDistance: number;
|
|
35145
|
-
movementAllowed: boolean;
|
|
35146
|
-
playerInputX: number;
|
|
35147
|
-
playerInputZ: number;
|
|
35148
|
-
playerMouseX: number;
|
|
35149
|
-
playerMouseY: number;
|
|
35150
|
-
runKeyRequired: boolean;
|
|
35151
|
-
buttonRun: number;
|
|
35152
|
-
keyboardRun: number;
|
|
35153
|
-
buttonJump: number;
|
|
35154
|
-
keyboardJump: number;
|
|
35155
|
-
buttonCamera: number;
|
|
35156
|
-
keyboardCamera: number;
|
|
35157
|
-
postNetworkAttributes: boolean;
|
|
35158
|
-
playerNumber: TOOLKIT.PlayerNumber;
|
|
35159
|
-
boomPosition: BABYLON.Vector3;
|
|
35160
|
-
airbornVelocity: BABYLON.Vector3;
|
|
35161
|
-
movementVelocity: BABYLON.Vector3;
|
|
35162
|
-
targetCameraOffset: BABYLON.Vector3;
|
|
35163
|
-
isAnimationEnabled(): boolean;
|
|
35164
|
-
isRunButtonPressed(): boolean;
|
|
35165
|
-
isJumpButtonPressed(): boolean;
|
|
35166
|
-
getPlayerJumped(): boolean;
|
|
35167
|
-
getPlayerJumping(): boolean;
|
|
35168
|
-
getPlayerFalling(): boolean;
|
|
35169
|
-
getPlayerSliding(): boolean;
|
|
35170
|
-
getPlayerGrounded(): boolean;
|
|
35171
|
-
getFallTriggered(): boolean;
|
|
35172
|
-
getMovementSpeed(): number;
|
|
35173
|
-
getCameraBoomNode(): BABYLON.TransformNode;
|
|
35174
|
-
getCameraTransform(): BABYLON.TransformNode;
|
|
35175
|
-
getAnimator(): TOOLKIT.Animator;
|
|
35176
|
-
getVerticalVelocity(): number;
|
|
35177
|
-
getCharacterController(): TOOLKIT.CharacterController;
|
|
35178
|
-
getPlayerLookRotation(): BABYLON.Vector3;
|
|
35179
|
-
getPlayerMoveDirection(): PROJECT.PlayerMoveDirection;
|
|
35180
|
-
getInputMovementVector(): BABYLON.Vector3;
|
|
35181
|
-
getInputMagnitudeValue(): number;
|
|
35182
|
-
getCameraPivotPosition(): BABYLON.Vector3;
|
|
35183
|
-
getCameraPivotRotation(): BABYLON.Quaternion;
|
|
35184
|
-
rayClimbOffset: number;
|
|
35185
|
-
rayClimbLength: number;
|
|
35186
|
-
getClimbContact(): boolean;
|
|
35187
|
-
getClimbContactNode(): BABYLON.TransformNode;
|
|
35188
|
-
getClimbContactPoint(): BABYLON.Vector3;
|
|
35189
|
-
getClimbContactAngle(): number;
|
|
35190
|
-
getClimbContactNormal(): BABYLON.Vector3;
|
|
35191
|
-
getClimbContactDistance(): number;
|
|
35192
|
-
canClimbObstaclePredicate: (action: number) => boolean;
|
|
35193
|
-
rayHeightOffset: number;
|
|
35194
|
-
rayHeightLength: number;
|
|
35195
|
-
getHeightContact(): boolean;
|
|
35196
|
-
getHeightContactNode(): BABYLON.TransformNode;
|
|
35197
|
-
getHeightContactPoint(): BABYLON.Vector3;
|
|
35198
|
-
getHeightContactAngle(): number;
|
|
35199
|
-
getHeightContactNormal(): BABYLON.Vector3;
|
|
35200
|
-
getHeightContactDistance(): number;
|
|
35201
|
-
private abstractMesh;
|
|
35202
|
-
private cameraDistance;
|
|
35203
|
-
private forwardCamera;
|
|
35204
|
-
private avatarRadius;
|
|
35205
|
-
private groundingObject;
|
|
35206
|
-
private groundingCallback;
|
|
35207
|
-
private dollyDirection;
|
|
35208
|
-
private cameraEulers;
|
|
35209
|
-
private rotationEulers;
|
|
35210
|
-
private cameraPivotOffset;
|
|
35211
|
-
private cameraForwardVector;
|
|
35212
|
-
private cameraRightVector;
|
|
35213
|
-
private desiredForwardVector;
|
|
35214
|
-
private desiredRightVector;
|
|
35215
|
-
private lastRotationQuaternion;
|
|
35216
|
-
private scaledCamDirection;
|
|
35217
|
-
private scaledMaxDirection;
|
|
35218
|
-
private parentNodePosition;
|
|
35219
|
-
private maximumCameraPos;
|
|
35220
|
-
private tempWorldPosition;
|
|
35221
|
-
private cameraRaycastShape;
|
|
35222
|
-
private defaultRaycastGroup;
|
|
35223
|
-
private defaultRaycastMask;
|
|
35224
|
-
private cameraRaycastMask;
|
|
35225
|
-
private avatarSkins;
|
|
35226
|
-
private cameraNode;
|
|
35227
|
-
private cameraPivot;
|
|
35228
|
-
private navigationAgent;
|
|
35229
|
-
private characterController;
|
|
35230
|
-
private verticalVelocity;
|
|
35231
|
-
private smoothMotionSpeed;
|
|
35232
|
-
private movementSpeed;
|
|
35233
|
-
private isRunPressed;
|
|
35234
|
-
private isJumpPressed;
|
|
35235
|
-
private isCharacterSliding;
|
|
35236
|
-
private isCharacterFalling;
|
|
35237
|
-
private isCharacterGrounded;
|
|
35238
|
-
private isCharacterFallTriggered;
|
|
35239
|
-
private isCharacterJumpFrame;
|
|
35240
|
-
private isCharacterJumping;
|
|
35241
|
-
private isCharacterLanding;
|
|
35242
|
-
private isCharacterRising;
|
|
35243
|
-
private isCharacterNavigating;
|
|
35244
|
-
private navigationAngularSpeed;
|
|
35245
|
-
private updateStateParams;
|
|
35246
|
-
private animationStateParams;
|
|
35247
|
-
private sphereCollisionShape;
|
|
35248
|
-
private hasGroundedContact;
|
|
35249
|
-
private showDebugColliders;
|
|
35250
|
-
private colliderVisibility;
|
|
35251
|
-
private colliderRenderGroup;
|
|
35252
|
-
private groundCheckDistance;
|
|
35253
|
-
private deltaTime;
|
|
35254
|
-
private minJumpTimer;
|
|
35255
|
-
private delayJumpTimer;
|
|
35256
|
-
private playerControl;
|
|
35257
|
-
private canPlayerJump;
|
|
35258
|
-
private animator;
|
|
35259
|
-
private lastJumpVelocity;
|
|
35260
|
-
private inputMovementVector;
|
|
35261
|
-
private playerLookRotation;
|
|
35262
|
-
private playerRotationVector;
|
|
35263
|
-
private playerMovementVelocity;
|
|
35264
|
-
private playerRotationQuaternion;
|
|
35265
|
-
private playerMoveDirection;
|
|
35266
|
-
private forwardDirection;
|
|
35267
|
-
private downDirection;
|
|
35268
|
-
private climbContact;
|
|
35269
|
-
private climbContactNode;
|
|
35270
|
-
private climbContactAngle;
|
|
35271
|
-
private climbContactPoint;
|
|
35272
|
-
private climbContactNormal;
|
|
35273
|
-
private climbContactDistance;
|
|
35274
|
-
private climbSensorLine;
|
|
35275
|
-
private offsetClimbRaycastPosition;
|
|
35276
|
-
private startClimbRaycastPosition;
|
|
35277
|
-
private endClimbRaycastPosition;
|
|
35278
|
-
private heightContact;
|
|
35279
|
-
private heightContactNode;
|
|
35280
|
-
private heightContactAngle;
|
|
35281
|
-
private heightContactPoint;
|
|
35282
|
-
private heightContactNormal;
|
|
35283
|
-
private heightContactDistance;
|
|
35284
|
-
private heightSensorLine;
|
|
35285
|
-
private offsetHeightRaycastPosition;
|
|
35286
|
-
private startHeightRaycastPosition;
|
|
35287
|
-
private endHeightRaycastPosition;
|
|
35288
|
-
protected m_velocityOffset: BABYLON.Vector3;
|
|
35289
|
-
protected m_actualVelocity: BABYLON.Vector3;
|
|
35290
|
-
protected m_linearVelocity: BABYLON.Vector3;
|
|
35291
|
-
protected m_lastPosition: BABYLON.Vector3;
|
|
35292
|
-
protected m_positionCenter: BABYLON.Vector3;
|
|
35293
|
-
protected m_scaledVelocity: number;
|
|
35294
|
-
protected playerDrawVelocity: number;
|
|
35295
|
-
constructor(transform: BABYLON.TransformNode, scene: BABYLON.Scene, properties?: any, alias?: string);
|
|
35296
|
-
protected awake(): void;
|
|
35297
|
-
protected start(): void;
|
|
35298
|
-
protected after(): void;
|
|
35299
|
-
protected update(): void;
|
|
35300
|
-
protected destroy(): void;
|
|
35301
|
-
/** Register handler that is triggered before the controller has been updated */
|
|
35302
|
-
onPreUpdateObservable: BABYLON.Observable<BABYLON.TransformNode>;
|
|
35303
|
-
/** Register handler that is triggered before the controller movement has been applied */
|
|
35304
|
-
onBeforeMoveObservable: BABYLON.Observable<BABYLON.TransformNode>;
|
|
35305
|
-
/** Register handler that is triggered after the controller has been updated */
|
|
35306
|
-
onPostUpdateObservable: BABYLON.Observable<BABYLON.TransformNode>;
|
|
35307
|
-
/** Register handler that is triggered after player input has been updated */
|
|
35308
|
-
onPlayerInputObservable: BABYLON.Observable<BABYLON.TransformNode>;
|
|
35309
|
-
/** Register handler that is triggered when player position should be updated */
|
|
35310
|
-
onPlayerPositionObservable: BABYLON.Observable<BABYLON.TransformNode>;
|
|
35311
|
-
/** Register handler that is triggered after performing action has been updated */
|
|
35312
|
-
onUpdateActionObservable: BABYLON.Observable<BABYLON.TransformNode>;
|
|
35313
|
-
/** Observer on the Animator's `onAnimatorMoveObservable` while this controller takes root motion (D19, D20); null otherwise. */
|
|
35314
|
-
private animatorMoveObserver;
|
|
35315
|
-
/** The Animator's exported `applyRootMotion`, restored when this controller stops taking root motion. */
|
|
35316
|
-
private exportedApplyRootMotion;
|
|
35317
|
-
/** The last Animator tick's horizontal root-motion velocity (world, metres per second), moved by the character controller when `rootMotion` is on. */
|
|
35318
|
-
private readonly rootMotionVelocity;
|
|
35319
|
-
/**
|
|
35320
|
-
* Registers the `onAnimatorMoveObservable` taker while root motion drives the player (`rootMotion` locomotion or a
|
|
35321
|
-
* root-motion action) and removes it otherwise. The Animator may sit on a child model node, so the taker moves this
|
|
35322
|
-
* player node rather than letting the built-in path move the model (D19, D20, D29).
|
|
35323
|
-
*/
|
|
35324
|
-
private syncAnimatorMoveTaker;
|
|
35325
|
-
/**
|
|
35326
|
-
* The `onAnimatorMove` taker: a root-motion action moves and turns the player node; otherwise the horizontal root
|
|
35327
|
-
* velocity is kept for the character controller's next move.
|
|
35328
|
-
* @param animator The Animator that ticked.
|
|
35329
|
-
*/
|
|
35330
|
-
private onAnimatorMove;
|
|
35331
|
-
private isPerformingAction;
|
|
35332
|
-
private isRootMotionAction;
|
|
35333
|
-
private isActionInterruptable;
|
|
35334
|
-
private afterActionHandler;
|
|
35335
|
-
private performActionTimer;
|
|
35336
|
-
private performActionNumber;
|
|
35337
|
-
private playerRotationSpeed;
|
|
35338
|
-
private rotatePlayerTowards;
|
|
35339
|
-
private matchStartTime;
|
|
35340
|
-
private matchTargetTime;
|
|
35341
|
-
private matchTargetOffset;
|
|
35342
|
-
private matchTargetHeight;
|
|
35343
|
-
private lockTargetHeight;
|
|
35344
|
-
private lastStartHeight;
|
|
35345
|
-
private lastTargetHeight;
|
|
35346
|
-
private lastTargetNormal;
|
|
35347
|
-
private lastTargetRotation;
|
|
35348
|
-
private lastDeltaPosition;
|
|
35349
|
-
private lastDeltaRotation;
|
|
35350
|
-
/** The eased player height of the height match (world metres). */
|
|
35351
|
-
private smoothedPlayerHeight;
|
|
35352
|
-
/** The SmoothDamp velocity of the height match (`x` holds it). */
|
|
35353
|
-
private readonly playerHeightVelocity;
|
|
35354
|
-
/** Full path hash of the base-layer state the running action entered; valid while `actionStateEntered`. */
|
|
35355
|
-
private actionStateHash;
|
|
35356
|
-
/** True once the running action's state was entered, so its exit ends the action. */
|
|
35357
|
-
private actionStateEntered;
|
|
35358
|
-
getIsPerformingAction(): boolean;
|
|
35359
|
-
getIsRootMotionAction(): boolean;
|
|
35360
|
-
getIsActionInterruptable(): boolean;
|
|
35361
|
-
playActionAnimation(action: number, interruptableAction?: boolean, enableRootMotion?: boolean, afterActionComplete?: () => void): void;
|
|
35362
|
-
resetActionAnimationState(): void;
|
|
35363
|
-
/** Advances the action timer that drives the height match (the root motion itself is applied by the move taker). */
|
|
35364
|
-
private updateAnimationActionState;
|
|
35365
|
-
/**
|
|
35366
|
-
* Applies a root-motion action's world root delta to the player node: the height match replaces the vertical delta
|
|
35367
|
-
* between the match start and target times, and the player either turns toward the climb surface or by the root
|
|
35368
|
-
* rotation delta. Called from the `onAnimatorMove` taker.
|
|
35369
|
-
* @param animator The Animator that ticked.
|
|
35370
|
-
*/
|
|
35371
|
-
private applyActionRootMotion;
|
|
35372
|
-
/**
|
|
35373
|
-
* The height match: from `matchStartTime` the vertical delta eases the player toward the target height
|
|
35374
|
-
* (`lastTargetHeight + matchTargetOffset`, Unity SmoothDamp over the match window); once `matchTargetTime` passes it
|
|
35375
|
-
* snaps to the target height once.
|
|
35376
|
-
* @param deltaTime The frame delta in seconds.
|
|
35377
|
-
*/
|
|
35378
|
-
private applyHeightMatch;
|
|
35379
|
-
/**
|
|
35380
|
-
* Turns the player toward the climb surface (facing into its normal) at `playerRotationSpeed`, while touching it.
|
|
35381
|
-
* @param deltaTime The frame delta in seconds.
|
|
35382
|
-
*/
|
|
35383
|
-
private rotateTowardsClimbSurface;
|
|
35384
|
-
/** Set the player world position */
|
|
35385
|
-
setWorldPosition(x: number, y: number, z: number): void;
|
|
35386
|
-
/** TODO */
|
|
35387
|
-
setPlayerControl(mode: PROJECT.PlayerInputControl): void;
|
|
35388
|
-
/** TODO */
|
|
35389
|
-
togglePlayerControl(): void;
|
|
35390
|
-
private showAvatarSkins;
|
|
35391
|
-
/** TODO */
|
|
35392
|
-
attachPlayerCamera(player: TOOLKIT.PlayerNumber): void;
|
|
35393
|
-
private ikLeftFootTarget;
|
|
35394
|
-
private ikLeftPoleTarget;
|
|
35395
|
-
private ikRightFootTarget;
|
|
35396
|
-
private ikRightPoleTarget;
|
|
35397
|
-
private abstractSkinMesh;
|
|
35398
|
-
private rootBoneTransform;
|
|
35399
|
-
private leftFootTransform;
|
|
35400
|
-
private leftFootPoleOffset;
|
|
35401
|
-
private leftFootMaxAngle;
|
|
35402
|
-
private rightFootTransform;
|
|
35403
|
-
private rightFootPoleOffset;
|
|
35404
|
-
private rightFootMaxAngle;
|
|
35405
|
-
private ikLeftController;
|
|
35406
|
-
private ikRightController;
|
|
35407
|
-
onAnimatorIK: () => void;
|
|
35408
|
-
getPlayerMesh(): BABYLON.AbstractMesh;
|
|
35409
|
-
getRootHipBone(): BABYLON.Bone;
|
|
35410
|
-
getLeftFootBone(): BABYLON.Bone;
|
|
35411
|
-
getRightFootBone(): BABYLON.Bone;
|
|
35412
|
-
getLeftFootTarget(): BABYLON.Mesh;
|
|
35413
|
-
getRightFootTarget(): BABYLON.Mesh;
|
|
35414
|
-
getLeftFootPoleTarget(): BABYLON.Mesh;
|
|
35415
|
-
getRightFootPoleTarget(): BABYLON.Mesh;
|
|
35416
|
-
getRootBoneTransform(): BABYLON.TransformNode;
|
|
35417
|
-
getLeftFootTransform(): BABYLON.TransformNode;
|
|
35418
|
-
getRightFootTransform(): BABYLON.TransformNode;
|
|
35419
|
-
getLeftFootController(): BABYLON.BoneIKController;
|
|
35420
|
-
getRightFootController(): BABYLON.BoneIKController;
|
|
35421
|
-
isGroundedFootIKActive(): boolean;
|
|
35422
|
-
setupBoneControllers(): void;
|
|
35423
|
-
/**
|
|
35424
|
-
* Finds the player's `TOOLKIT.Animator` (on this node or a child model), ends a running action when its action state
|
|
35425
|
-
* exits, runs `onAnimatorIK` or the foot IK controllers in the Animator's IK pass, and takes root motion when
|
|
35426
|
-
* `rootMotion` is on.
|
|
35427
|
-
*/
|
|
35428
|
-
private attachAnimationController;
|
|
35429
|
-
/**
|
|
35430
|
-
* Records the base-layer state a running action enters, so that state's exit can end the action.
|
|
35431
|
-
* @param change The entered state.
|
|
35432
|
-
*/
|
|
35433
|
-
private onAnimatorStateEnter;
|
|
35434
|
-
/**
|
|
35435
|
-
* Ends a running action when its action state exits.
|
|
35436
|
-
* @param change The exited state.
|
|
35437
|
-
*/
|
|
35438
|
-
private onAnimatorStateExit;
|
|
35439
|
-
/** The Animator's IK pass: the script's `onAnimatorIK` when set, else the foot IK controllers. */
|
|
35440
|
-
private onAnimatorIKPass;
|
|
35441
|
-
private updateAnimatorTargetMeshes;
|
|
35442
|
-
/** TODO */
|
|
35443
|
-
enableCharacterController(state: boolean): void;
|
|
35444
|
-
/** TODO */
|
|
35445
|
-
resetPlayerRotation(): void;
|
|
35446
|
-
/** TODO */
|
|
35447
|
-
resetPlayerJumpingState(): void;
|
|
35448
|
-
private awakePlayerController;
|
|
35449
|
-
private startPlayerController;
|
|
35450
|
-
private updatePlayerPosition;
|
|
35451
|
-
private updatePlayerController;
|
|
35452
|
-
private afterPlayerController;
|
|
35453
|
-
private updateCharacterController;
|
|
35454
|
-
private updateCameraController;
|
|
35455
|
-
getBoomArmMaxDistance(): number;
|
|
35456
|
-
setBoomArmMaxDistance(distance: number): void;
|
|
35457
|
-
setSmoothBoomArmLength(length: number, speed: number, updateMaxDistance?: boolean): void;
|
|
35458
|
-
private smoothBoomArmLength;
|
|
35459
|
-
private smoothBoomArmSpeed;
|
|
35460
|
-
private updateSmoothBoomArmLength;
|
|
35461
|
-
private castPhysicsClimbingVolumeRay;
|
|
35462
|
-
private castPhysicsHeightCheckVolumeRay;
|
|
35463
|
-
private getCheckedVerticalVelocity;
|
|
35464
|
-
private destroyPlayerController;
|
|
35465
|
-
private validateAnimationStateParams;
|
|
35466
|
-
/** Fills a missing params object with the defaults, and merges keys added since a params object was exported (motionSpeed). */
|
|
35467
|
-
static ApplyAnimationStateParamDefaults(params: PROJECT.AnimationStateParams): PROJECT.AnimationStateParams;
|
|
35468
|
-
}
|
|
35469
|
-
/**
|
|
35470
|
-
* Babylon Interface Definition
|
|
35471
|
-
* @interface AnimationStateParams
|
|
35472
|
-
*/
|
|
35473
|
-
interface AnimationStateParams {
|
|
35474
|
-
moveDirection: string;
|
|
35475
|
-
inputMagnitude: string;
|
|
35476
|
-
horizontalInput: string;
|
|
35477
|
-
verticalInput: string;
|
|
35478
|
-
mouseXInput: string;
|
|
35479
|
-
mouseYInput: string;
|
|
35480
|
-
heightInput: string;
|
|
35481
|
-
speedInput: string;
|
|
35482
|
-
/** Speed multiplier parameter of the Starter Assets controller (Unity sets MotionSpeed every frame). */
|
|
35483
|
-
motionSpeed?: string;
|
|
35484
|
-
jumpFrame: string;
|
|
35485
|
-
jumpState: string;
|
|
35486
|
-
actionState: string;
|
|
35487
|
-
fallingState: string;
|
|
35488
|
-
slidingState: string;
|
|
35489
|
-
groundedState: string;
|
|
35490
|
-
}
|
|
35491
|
-
/**
|
|
35492
|
-
* Babylon Enum Definition
|
|
35493
|
-
* @interface PlayerInputControl
|
|
35494
|
-
*/
|
|
35495
|
-
enum PlayerInputControl {
|
|
35496
|
-
FirstPersonStrafing = 0,
|
|
35497
|
-
ThirdPersonStrafing = 1
|
|
35498
|
-
}
|
|
35499
|
-
/**
|
|
35500
|
-
* Babylon Enum Definition
|
|
35501
|
-
* @interface PlayerMoveDirection
|
|
35502
|
-
*/
|
|
35503
|
-
enum PlayerMoveDirection {
|
|
35504
|
-
Stationary = 0,
|
|
35505
|
-
Forward = 1,
|
|
35506
|
-
ForwardLeft = 2,
|
|
35507
|
-
ForwardRight = 3,
|
|
35508
|
-
Backward = 4,
|
|
35509
|
-
BackwardLeft = 5,
|
|
35510
|
-
BackwardRight = 6,
|
|
35511
|
-
StrafingLeft = 7,
|
|
35512
|
-
StrafingRight = 8
|
|
35513
|
-
}
|
|
35514
|
-
/**
|
|
35515
|
-
* Babylon Enum Definition
|
|
35516
|
-
* @interface ActionAnimationType
|
|
35517
|
-
*/
|
|
35518
|
-
enum ActionAnimationType {
|
|
35519
|
-
Neutral = 0,
|
|
35520
|
-
StepUp = 1,
|
|
35521
|
-
JumpUp = 2,
|
|
35522
|
-
ClimbUp = 3,
|
|
35523
|
-
VaultOver = 4
|
|
35524
|
-
}
|
|
35525
|
-
}
|
|
35526
|
-
declare namespace PROJECT {
|
|
35527
|
-
/**
|
|
35528
|
-
* Babylon toolkit third person player controller class (LEGACY)
|
|
35529
|
-
* @class ThirdPersonPlayerController - All rights reserved (c) 2020 Mackey Kinard
|
|
35530
|
-
* @deprecated This class is considered legacy and may be removed in future versions.
|
|
35531
|
-
*/
|
|
35532
|
-
class ThirdPersonPlayerController extends TOOLKIT.ScriptComponent {
|
|
35533
|
-
static MIN_VERTICAL_VELOCITY: number;
|
|
35534
|
-
static MIN_GROUND_DISTANCE: number;
|
|
35535
|
-
static MIN_MOVE_EPSILON: number;
|
|
35536
|
-
static MIN_TIMER_OFFSET: number;
|
|
35537
|
-
static MIN_SLOPE_LIMIT: number;
|
|
35538
|
-
static PLAYER_HEIGHT: string;
|
|
35539
|
-
enableInput: boolean;
|
|
35540
|
-
attachCamera: boolean;
|
|
35541
|
-
mouseWheel: boolean;
|
|
35542
|
-
requireSprintButton: boolean;
|
|
35543
|
-
gravitationalForce: number;
|
|
35544
|
-
minFallVelocity: number;
|
|
35545
|
-
verticalStepSpeed: number;
|
|
35546
|
-
minStepUpHeight: number;
|
|
35547
|
-
rigidBodyMass: number;
|
|
35548
|
-
airbornTimeout: number;
|
|
35549
|
-
maxAngle: number;
|
|
35550
|
-
speedFactor: number;
|
|
35551
|
-
rootMotion: boolean;
|
|
35552
|
-
moveSpeed: number;
|
|
35553
|
-
walkSpeed: number;
|
|
35554
|
-
jumpSpeed: number;
|
|
35555
|
-
jumpDelay: number;
|
|
35556
|
-
lowTurnSpeed: number;
|
|
35557
|
-
highTurnSpeed: number;
|
|
35558
|
-
smoothDampTime: number;
|
|
35559
|
-
smoothInputVectors: boolean;
|
|
35560
|
-
smoothAcceleration: boolean;
|
|
35561
|
-
accelerationSpeed: number;
|
|
35562
|
-
decelerationSpeed: number;
|
|
35563
|
-
climbVolumeTag: string;
|
|
35564
|
-
vaultVolumeTag: string;
|
|
35565
|
-
maxHeightRanges: any;
|
|
35566
|
-
useClimbSystem: boolean;
|
|
35567
|
-
distanceFactor: number;
|
|
35568
|
-
inputMagnitude: number;
|
|
35569
|
-
/** Unity StarterAssetsInputs.analogMovement: true drives the MotionSpeed parameter with the input magnitude (gamepad sticks), false keeps it at 1 (keyboard). */
|
|
35570
|
-
analogMovement: boolean;
|
|
35571
|
-
landingEpsilon: number;
|
|
35572
|
-
minimumDistance: number;
|
|
35573
|
-
movementAllowed: boolean;
|
|
35574
|
-
playerInputX: number;
|
|
35575
|
-
playerInputZ: number;
|
|
35576
|
-
playerMouseX: number;
|
|
35577
|
-
playerMouseY: number;
|
|
35578
|
-
runKeyRequired: boolean;
|
|
35579
|
-
buttonRun: number;
|
|
35580
|
-
keyboardRun: number;
|
|
35581
|
-
buttonJump: number;
|
|
35582
|
-
keyboardJump: number;
|
|
35583
|
-
buttonCamera: number;
|
|
35584
|
-
keyboardCamera: number;
|
|
35585
|
-
postNetworkAttributes: boolean;
|
|
35586
|
-
playerNumber: TOOLKIT.PlayerNumber;
|
|
35587
|
-
airbornVelocity: BABYLON.Vector3;
|
|
35588
|
-
movementVelocity: BABYLON.Vector3;
|
|
35589
|
-
isAnimationEnabled(): boolean;
|
|
35590
|
-
isRunButtonPressed(): boolean;
|
|
35591
|
-
isJumpButtonPressed(): boolean;
|
|
35592
|
-
getPlayerJumped(): boolean;
|
|
35593
|
-
getPlayerJumping(): boolean;
|
|
35594
|
-
getPlayerFalling(): boolean;
|
|
35595
|
-
getPlayerSliding(): boolean;
|
|
35596
|
-
getPlayerGrounded(): boolean;
|
|
35597
|
-
getFallTriggered(): boolean;
|
|
35598
|
-
getMovementSpeed(): number;
|
|
35599
|
-
getAnimator(): TOOLKIT.Animator;
|
|
35600
|
-
getVerticalVelocity(): number;
|
|
35601
|
-
getCharacterController(): TOOLKIT.CharacterController;
|
|
35602
|
-
getPlayerLookRotation(): BABYLON.Vector3;
|
|
35603
|
-
getPlayerMoveDirection(): PROJECT.PlayerMoveDirection;
|
|
35604
|
-
getInputMovementVector(): BABYLON.Vector3;
|
|
35605
|
-
getInputMagnitudeValue(): number;
|
|
35606
|
-
rayClimbOffset: number;
|
|
35607
|
-
rayClimbLength: number;
|
|
35608
|
-
getClimbContact(): boolean;
|
|
35609
|
-
getClimbContactNode(): BABYLON.TransformNode;
|
|
35610
|
-
getClimbContactPoint(): BABYLON.Vector3;
|
|
35611
|
-
getClimbContactAngle(): number;
|
|
35612
|
-
getClimbContactNormal(): BABYLON.Vector3;
|
|
35613
|
-
getClimbContactDistance(): number;
|
|
35614
|
-
canClimbObstaclePredicate: (action: number) => boolean;
|
|
35615
|
-
rayHeightOffset: number;
|
|
35616
|
-
rayHeightLength: number;
|
|
35617
|
-
getHeightContact(): boolean;
|
|
35618
|
-
getHeightContactNode(): BABYLON.TransformNode;
|
|
35619
|
-
getHeightContactPoint(): BABYLON.Vector3;
|
|
35620
|
-
getHeightContactAngle(): number;
|
|
35621
|
-
getHeightContactNormal(): BABYLON.Vector3;
|
|
35622
|
-
getHeightContactDistance(): number;
|
|
35623
|
-
private freeCamera;
|
|
35624
|
-
private cameraForwardVector;
|
|
35625
|
-
private cameraRightVector;
|
|
35626
|
-
private desiredForwardVector;
|
|
35627
|
-
private desiredRightVector;
|
|
35628
|
-
private lastRotationQuaternion;
|
|
35629
|
-
private avatarSkins;
|
|
35630
|
-
private avatarRadius;
|
|
35631
|
-
private navigationAgent;
|
|
35632
|
-
private characterController;
|
|
35633
|
-
private verticalVelocity;
|
|
35634
|
-
private smoothMotionSpeed;
|
|
35635
|
-
private movementSpeed;
|
|
35636
|
-
private isRunPressed;
|
|
35637
|
-
private isJumpPressed;
|
|
35638
|
-
private isCharacterSliding;
|
|
35639
|
-
private isCharacterFalling;
|
|
35640
|
-
private isCharacterGrounded;
|
|
35641
|
-
private isCharacterFallTriggered;
|
|
35642
|
-
private isCharacterJumpFrame;
|
|
35643
|
-
private isCharacterJumping;
|
|
35644
|
-
private isCharacterRising;
|
|
35645
|
-
private isCharacterLanding;
|
|
35646
|
-
private isCharacterNavigating;
|
|
35647
|
-
private navigationAngularSpeed;
|
|
35648
|
-
private updateStateParams;
|
|
35649
|
-
private animationStateParams;
|
|
35650
|
-
private sphereCollisionShape;
|
|
35651
|
-
private hasGroundedContact;
|
|
35652
|
-
private showDebugColliders;
|
|
35653
|
-
private colliderVisibility;
|
|
35654
|
-
private colliderRenderGroup;
|
|
35655
|
-
private groundCheckDistance;
|
|
35656
|
-
private deltaTime;
|
|
35657
|
-
private delayJumpTimer;
|
|
35658
|
-
private canPlayerJump;
|
|
35659
|
-
private animator;
|
|
35660
|
-
private lastJumpVelocity;
|
|
35661
|
-
private inputMovementVector;
|
|
35662
|
-
private playerLookRotation;
|
|
35663
|
-
private playerMovementVelocity;
|
|
35664
|
-
private playerRotationQuaternion;
|
|
35665
|
-
private playerMoveDirection;
|
|
35666
|
-
private forwardDirection;
|
|
35667
|
-
private downDirection;
|
|
35668
|
-
private climbContact;
|
|
35669
|
-
private climbContactNode;
|
|
35670
|
-
private climbContactAngle;
|
|
35671
|
-
private climbContactPoint;
|
|
35672
|
-
private climbContactNormal;
|
|
35673
|
-
private climbContactDistance;
|
|
35674
|
-
private climbSensorLine;
|
|
35675
|
-
private offsetClimbRaycastPosition;
|
|
35676
|
-
private startClimbRaycastPosition;
|
|
35677
|
-
private endClimbRaycastPosition;
|
|
35678
|
-
private heightContact;
|
|
35679
|
-
private heightContactNode;
|
|
35680
|
-
private heightContactAngle;
|
|
35681
|
-
private heightContactPoint;
|
|
35682
|
-
private heightContactNormal;
|
|
35683
|
-
private heightContactDistance;
|
|
35684
|
-
private heightSensorLine;
|
|
35685
|
-
private offsetHeightRaycastPosition;
|
|
35686
|
-
private startHeightRaycastPosition;
|
|
35687
|
-
private endHeightRaycastPosition;
|
|
35688
|
-
protected m_velocityOffset: BABYLON.Vector3;
|
|
35689
|
-
protected m_actualVelocity: BABYLON.Vector3;
|
|
35690
|
-
protected m_linearVelocity: BABYLON.Vector3;
|
|
35691
|
-
protected m_lastPosition: BABYLON.Vector3;
|
|
35692
|
-
protected m_positionCenter: BABYLON.Vector3;
|
|
35693
|
-
protected m_scaledVelocity: number;
|
|
35694
|
-
protected playerDrawVelocity: number;
|
|
35695
|
-
constructor(transform: BABYLON.TransformNode, scene: BABYLON.Scene, properties?: any, alias?: string);
|
|
35696
|
-
protected awake(): void;
|
|
35697
|
-
protected start(): void;
|
|
35698
|
-
protected after(): void;
|
|
35699
|
-
protected update(): void;
|
|
35700
|
-
protected destroy(): void;
|
|
35701
|
-
/** Character controller position
|
|
35702
|
-
* @deprecated Moved to default camera controller
|
|
35703
|
-
* @see PROJECT.DefaultCameraSystem
|
|
35704
|
-
*/
|
|
35705
|
-
boomPosition: BABYLON.Vector3;
|
|
35706
|
-
/** Register handler that is triggered before the controller has been updated */
|
|
35707
|
-
onPreUpdateObservable: BABYLON.Observable<BABYLON.TransformNode>;
|
|
35708
|
-
/** Register handler that is triggered before the controller movement has been applied */
|
|
35709
|
-
onBeforeMoveObservable: BABYLON.Observable<BABYLON.TransformNode>;
|
|
35710
|
-
/** Register handler that is triggered after the controller has been updated */
|
|
35711
|
-
onPostUpdateObservable: BABYLON.Observable<BABYLON.TransformNode>;
|
|
35712
|
-
/** Register handler that is triggered after player input has been updated */
|
|
35713
|
-
onPlayerInputObservable: BABYLON.Observable<BABYLON.TransformNode>;
|
|
35714
|
-
/** Register handler that is triggered when player position should be updated */
|
|
35715
|
-
onPlayerPositionObservable: BABYLON.Observable<BABYLON.TransformNode>;
|
|
35716
|
-
/** Register handler that is triggered after performing action has been updated */
|
|
35717
|
-
onUpdateActionObservable: BABYLON.Observable<BABYLON.TransformNode>;
|
|
35718
|
-
/** Register handler that is triggered after animation state has been updated */
|
|
35719
|
-
onAnimationStateObservable: BABYLON.Observable<BABYLON.TransformNode>;
|
|
35720
|
-
/** Observer on the Animator's `onAnimatorMoveObservable` while this controller takes root motion (D19, D20); null otherwise. */
|
|
35721
|
-
private animatorMoveObserver;
|
|
35722
|
-
/** The Animator's exported `applyRootMotion`, restored when this controller stops taking root motion. */
|
|
35723
|
-
private exportedApplyRootMotion;
|
|
35724
|
-
/** The last Animator tick's horizontal root-motion velocity (world, metres per second), moved by the character controller when `rootMotion` is on. */
|
|
35725
|
-
private readonly rootMotionVelocity;
|
|
35726
|
-
/**
|
|
35727
|
-
* Registers the `onAnimatorMoveObservable` taker while root motion drives the player (`rootMotion` locomotion or a
|
|
35728
|
-
* root-motion action) and removes it otherwise. The Animator may sit on a child model node, so the taker moves this
|
|
35729
|
-
* player node rather than letting the built-in path move the model (D19, D20, D29).
|
|
35730
|
-
*/
|
|
35731
|
-
private syncAnimatorMoveTaker;
|
|
35732
|
-
/**
|
|
35733
|
-
* The `onAnimatorMove` taker: a root-motion action moves and turns the player node; otherwise the horizontal root
|
|
35734
|
-
* velocity is kept for the character controller's next move.
|
|
35735
|
-
* @param animator The Animator that ticked.
|
|
35736
|
-
*/
|
|
35737
|
-
private onAnimatorMove;
|
|
35738
|
-
private isPerformingAction;
|
|
35739
|
-
private isRootMotionAction;
|
|
35740
|
-
private isActionInterruptable;
|
|
35741
|
-
private afterActionHandler;
|
|
35742
|
-
private performActionTimer;
|
|
35743
|
-
private performActionNumber;
|
|
35744
|
-
private playerRotationSpeed;
|
|
35745
|
-
private rotatePlayerTowards;
|
|
35746
|
-
private matchStartTime;
|
|
35747
|
-
private matchTargetTime;
|
|
35748
|
-
private matchTargetOffset;
|
|
35749
|
-
private matchTargetHeight;
|
|
35750
|
-
private lockTargetHeight;
|
|
35751
|
-
private lastStartHeight;
|
|
35752
|
-
private lastTargetHeight;
|
|
35753
|
-
private lastTargetNormal;
|
|
35754
|
-
private lastTargetRotation;
|
|
35755
|
-
private lastDeltaPosition;
|
|
35756
|
-
private lastDeltaRotation;
|
|
35757
|
-
/** The eased player height of the height match (world metres). */
|
|
35758
|
-
private smoothedPlayerHeight;
|
|
35759
|
-
/** The SmoothDamp velocity of the height match (`x` holds it). */
|
|
35760
|
-
private readonly playerHeightVelocity;
|
|
35761
|
-
/** Full path hash of the base-layer state the running action entered; valid while `actionStateEntered`. */
|
|
35762
|
-
private actionStateHash;
|
|
35763
|
-
/** True once the running action's state was entered, so its exit ends the action. */
|
|
35764
|
-
private actionStateEntered;
|
|
35765
|
-
getIsPerformingAction(): boolean;
|
|
35766
|
-
getIsRootMotionAction(): boolean;
|
|
35767
|
-
getIsActionInterruptable(): boolean;
|
|
35768
|
-
playActionAnimation(action: number, interruptableAction?: boolean, enableRootMotion?: boolean, afterActionComplete?: () => void): void;
|
|
35769
|
-
resetActionAnimationState(): void;
|
|
35770
|
-
/** Advances the action timer that drives the height match (the root motion itself is applied by the move taker). */
|
|
35771
|
-
private updateAnimationActionState;
|
|
35772
|
-
/**
|
|
35773
|
-
* Applies a root-motion action's world root delta to the player node: the height match replaces the vertical delta
|
|
35774
|
-
* between the match start and target times, and the player either turns toward the climb surface or by the root
|
|
35775
|
-
* rotation delta. Called from the `onAnimatorMove` taker.
|
|
35776
|
-
* @param animator The Animator that ticked.
|
|
35777
|
-
*/
|
|
35778
|
-
private applyActionRootMotion;
|
|
35779
|
-
/**
|
|
35780
|
-
* The height match: from `matchStartTime` the vertical delta eases the player toward the target height
|
|
35781
|
-
* (`lastTargetHeight + matchTargetOffset`, Unity SmoothDamp over the match window); once `matchTargetTime` passes it
|
|
35782
|
-
* snaps to the target height once.
|
|
35783
|
-
* @param deltaTime The frame delta in seconds.
|
|
35784
|
-
*/
|
|
35785
|
-
private applyHeightMatch;
|
|
35786
|
-
/**
|
|
35787
|
-
* Turns the player toward the climb surface (facing into its normal) at `playerRotationSpeed`, while touching it.
|
|
35788
|
-
* @param deltaTime The frame delta in seconds.
|
|
35789
|
-
*/
|
|
35790
|
-
private rotateTowardsClimbSurface;
|
|
35791
|
-
/** Set the player world position */
|
|
35792
|
-
setWorldPosition(x: number, y: number, z: number): void;
|
|
35793
|
-
private ikLeftFootTarget;
|
|
35794
|
-
private ikLeftPoleTarget;
|
|
35795
|
-
private ikRightFootTarget;
|
|
35796
|
-
private ikRightPoleTarget;
|
|
35797
|
-
private abstractSkinMesh;
|
|
35798
|
-
private rootBoneTransform;
|
|
35799
|
-
private leftFootTransform;
|
|
35800
|
-
private leftFootPoleOffset;
|
|
35801
|
-
private leftFootMaxAngle;
|
|
35802
|
-
private rightFootTransform;
|
|
35803
|
-
private rightFootPoleOffset;
|
|
35804
|
-
private rightFootMaxAngle;
|
|
35805
|
-
private ikLeftController;
|
|
35806
|
-
private ikRightController;
|
|
35807
|
-
onAnimatorIK: () => void;
|
|
35808
|
-
getPlayerMesh(): BABYLON.AbstractMesh;
|
|
35809
|
-
getRootHipBone(): BABYLON.Bone;
|
|
35810
|
-
getLeftFootBone(): BABYLON.Bone;
|
|
35811
|
-
getRightFootBone(): BABYLON.Bone;
|
|
35812
|
-
getLeftFootTarget(): BABYLON.Mesh;
|
|
35813
|
-
getRightFootTarget(): BABYLON.Mesh;
|
|
35814
|
-
getLeftFootPoleTarget(): BABYLON.Mesh;
|
|
35815
|
-
getRightFootPoleTarget(): BABYLON.Mesh;
|
|
35816
|
-
getRootBoneTransform(): BABYLON.TransformNode;
|
|
35817
|
-
getLeftFootTransform(): BABYLON.TransformNode;
|
|
35818
|
-
getRightFootTransform(): BABYLON.TransformNode;
|
|
35819
|
-
getLeftFootController(): BABYLON.BoneIKController;
|
|
35820
|
-
getRightFootController(): BABYLON.BoneIKController;
|
|
35821
|
-
isGroundedFootIKActive(): boolean;
|
|
35822
|
-
setupBoneControllers(): void;
|
|
35823
|
-
/**
|
|
35824
|
-
* Finds the player's `TOOLKIT.Animator` (on this node or a child model), ends a running action when its action state
|
|
35825
|
-
* exits, runs `onAnimatorIK` or the foot IK controllers in the Animator's IK pass, and takes root motion when
|
|
35826
|
-
* `rootMotion` is on.
|
|
35827
|
-
*/
|
|
35828
|
-
private attachAnimationController;
|
|
35829
|
-
/**
|
|
35830
|
-
* Records the base-layer state a running action enters, so that state's exit can end the action.
|
|
35831
|
-
* @param change The entered state.
|
|
35832
|
-
*/
|
|
35833
|
-
private onAnimatorStateEnter;
|
|
35834
|
-
/**
|
|
35835
|
-
* Ends a running action when its action state exits.
|
|
35836
|
-
* @param change The exited state.
|
|
35837
|
-
*/
|
|
35838
|
-
private onAnimatorStateExit;
|
|
35839
|
-
/** The Animator's IK pass: the script's `onAnimatorIK` when set, else the foot IK controllers. */
|
|
35840
|
-
private onAnimatorIKPass;
|
|
35841
|
-
private updateAnimatorTargetMeshes;
|
|
35842
|
-
/** TODO */
|
|
35843
|
-
enableCharacterController(state: boolean): void;
|
|
35844
|
-
/** TODO */
|
|
35845
|
-
resetPlayerJumpingState(): void;
|
|
35846
|
-
private awakePlayerController;
|
|
35847
|
-
private startPlayerController;
|
|
35848
|
-
private updatePlayerPosition;
|
|
35849
|
-
private updatePlayerController;
|
|
35850
|
-
private afterPlayerController;
|
|
35851
|
-
private updateCharacterController;
|
|
35852
|
-
private castPhysicsClimbingVolumeRay;
|
|
35853
|
-
private castPhysicsHeightCheckVolumeRay;
|
|
35854
|
-
private getCheckedVerticalVelocity;
|
|
35855
|
-
private destroyPlayerController;
|
|
35856
|
-
private validateAnimationStateParams;
|
|
35857
|
-
/** Fills a missing params object with the defaults, and merges keys added since a params object was exported (motionSpeed). */
|
|
35858
|
-
static ApplyAnimationStateParamDefaults(params: PROJECT.AnimationStateParams): PROJECT.AnimationStateParams;
|
|
35859
|
-
}
|
|
35860
|
-
/**
|
|
35861
|
-
* Babylon Enum Definition
|
|
35862
|
-
* @interface ThirdPersonControl
|
|
35863
|
-
*/
|
|
35864
|
-
enum ThirdPersonControl {
|
|
35865
|
-
ThirdPersonTurning = 0,
|
|
35866
|
-
ThirdPersonForward = 1
|
|
35867
|
-
}
|
|
35868
|
-
}
|
|
35869
35166
|
declare namespace PROJECT {
|
|
35870
35167
|
/**
|
|
35871
35168
|
* Babylon Script Component
|
|
@@ -58425,10 +57722,20 @@ declare namespace TOOLKIT {
|
|
|
58425
57722
|
static AllUniforms(): string[];
|
|
58426
57723
|
private static AllUniformsBase;
|
|
58427
57724
|
private static registered;
|
|
58428
|
-
/** The scene's `hdrp.fog`
|
|
57725
|
+
/** The scene's fog block: `hdrp.fog` on a parity scene, `urp.fog` on a URP physical sky scene, otherwise null. */
|
|
58429
57726
|
static FogBlock(scene: BABYLON.Scene): any;
|
|
58430
|
-
/** The sky the aerial perspective comes from: the live PhysicallyBasedSky when it runs, else the
|
|
57727
|
+
/** The sky the aerial perspective comes from: the live PhysicallyBasedSky when it runs, else the export's physical sky block. */
|
|
58431
57728
|
static SkyOf(scene: BABYLON.Scene): any;
|
|
57729
|
+
/**
|
|
57730
|
+
* Binds `fogChain` for a URP physical sky, whose pass runs after everything where Unity's runs before transparents. x = the chain
|
|
57731
|
+
* holds display values (decode, composite in linear, encode), y = a water surface exists, z = its height in metres, so a ray that
|
|
57732
|
+
* meets the water first takes no fog, w = the fog is on, which makes Unity's opaque pass give sky pixels aerial perspective up to
|
|
57733
|
+
* the fog's maximum distance (measured: the Morning preset's zenith 0.023 without it, 0.046 with it). A parity scene binds zero.
|
|
57734
|
+
* @param effect The fog effect.
|
|
57735
|
+
* @param scene The scene.
|
|
57736
|
+
* @param fog The scene's fog block, or null.
|
|
57737
|
+
*/
|
|
57738
|
+
private static BindChain;
|
|
58432
57739
|
/** The fog inputs of this frame (computed once per render id). */
|
|
58433
57740
|
static Frame(scene: BABYLON.Scene, fog: any): IHdrpFogFrame;
|
|
58434
57741
|
/** The view depth at and beyond which a pixel is sky: the nearest face of an infinite-distance sky mesh (none -> 1e30). */
|
|
@@ -58473,6 +57780,21 @@ declare namespace TOOLKIT {
|
|
|
58473
57780
|
static AmbientGlsl(): string;
|
|
58474
57781
|
/** WGSL twin of `AmbientGlsl`. */
|
|
58475
57782
|
static AmbientWgsl(): string;
|
|
57783
|
+
/**
|
|
57784
|
+
* The PhysicallyBasedSky aerial perspective at distance `tFrag` along `dir` (AtmosphericScattering.hlsl
|
|
57785
|
+
* `EvaluateAtmosphericScattering`, sky part): the in-scatter from the sky's froxel LUT (`apLut`, sampled at screen `uv`) and
|
|
57786
|
+
* the opacity from the optical depth, with the sky's artistic horizon / zenith tint. Shared by this pass and the volumetric
|
|
57787
|
+
* clouds (at their mean cloud distance). Needs the atmosphere uniforms (HdrpPbSkyShaders.GlslUniforms + GlslCommon) and
|
|
57788
|
+
* a `sampler2DArray apLut` declared first.
|
|
57789
|
+
* @returns GLSL source.
|
|
57790
|
+
*/
|
|
57791
|
+
static AerialPerspectiveGlsl(): string;
|
|
57792
|
+
/**
|
|
57793
|
+
* WGSL twin of AerialPerspectiveGlsl (`fogAerialPerspective` returns a `FogAerial`). Needs the atmosphere uniforms and
|
|
57794
|
+
* `apLut` / `apLutSampler` declared first.
|
|
57795
|
+
* @returns WGSL source.
|
|
57796
|
+
*/
|
|
57797
|
+
static AerialPerspectiveWgsl(): string;
|
|
58476
57798
|
static GlslHelpers(prefix: string): string;
|
|
58477
57799
|
static WgslHelpers(prefix: string): string;
|
|
58478
57800
|
private static Glsl;
|
|
@@ -58814,6 +58136,21 @@ declare namespace TOOLKIT {
|
|
|
58814
58136
|
requested: boolean;
|
|
58815
58137
|
captured: boolean;
|
|
58816
58138
|
}, nowSeconds: number, frame: number, precomputationHash: string, lightHash: string, updateMode: number, updatePeriod: number): boolean;
|
|
58139
|
+
/** ProbeRenderOutcome: nothing changes. */
|
|
58140
|
+
static readonly ProbeRenderKept: number;
|
|
58141
|
+
/** ProbeRenderOutcome: the render is the requested capture, ready for the prefilter. */
|
|
58142
|
+
static readonly ProbeCaptureAccepted: number;
|
|
58143
|
+
/** ProbeRenderOutcome: the render did not draw the sky, so the capture is taken again on the next frame. */
|
|
58144
|
+
static readonly ProbeCaptureRetry: number;
|
|
58145
|
+
/**
|
|
58146
|
+
* What one finished probe render means for the live environment. A requested capture stands only when the sky was drawn;
|
|
58147
|
+
* a render that did not draw it, while a capture waits for its prefilter, has replaced that capture, so it is taken again.
|
|
58148
|
+
* @param capturing - True while a capture is requested.
|
|
58149
|
+
* @param pendingFilter - True while an accepted capture waits for its prefilter.
|
|
58150
|
+
* @param drewSky - True when the sky material was ready for this render.
|
|
58151
|
+
* @returns ProbeRenderKept, ProbeCaptureAccepted or ProbeCaptureRetry.
|
|
58152
|
+
*/
|
|
58153
|
+
static ProbeRenderOutcome(capturing: boolean, pendingFilter: boolean, drewSky: boolean): number;
|
|
58817
58154
|
/** D34: the ambient SH - Dynamic (1) → the live read-back once it exists, else the exported static SH; Static (0) → the exported SH. */
|
|
58818
58155
|
static SelectAmbientSh(skyAmbientMode: number, readback: BABYLON.SphericalHarmonics, exported: BABYLON.SphericalHarmonics): BABYLON.SphericalHarmonics;
|
|
58819
58156
|
/** The polynomial scale that leaves diffuse = SH x indirect.diffuse after the environment level (pe x indirect.reflection) multiplies it. */
|
|
@@ -58899,6 +58236,8 @@ declare namespace TOOLKIT {
|
|
|
58899
58236
|
private filtering;
|
|
58900
58237
|
private pendingFilter;
|
|
58901
58238
|
private capturing;
|
|
58239
|
+
/** True when the probe's current render draws the sky (its material is ready), so the render can stand as a capture. */
|
|
58240
|
+
private probeDrawsSky;
|
|
58902
58241
|
private shReading;
|
|
58903
58242
|
/** The live capture's ambient, pre-scaled harmonics in physical units (Dynamic ambient), null until the first read-back. */
|
|
58904
58243
|
private readbackHarmonics;
|
|
@@ -58915,6 +58254,10 @@ declare namespace TOOLKIT {
|
|
|
58915
58254
|
private apRequested;
|
|
58916
58255
|
private apCamera;
|
|
58917
58256
|
private readonly startTime;
|
|
58257
|
+
/** Multiplies the exported sun intensity to the strength the sky scatters (`sky.sunintensityscale`, 1 on HDRP). */
|
|
58258
|
+
private readonly sunIntensityScale;
|
|
58259
|
+
/** The sky's stars (`params.spaceemissionurl`), or null. */
|
|
58260
|
+
private readonly spaceCube;
|
|
58918
58261
|
private constructor();
|
|
58919
58262
|
/** "live" or "baked: <reason>" (Inspector read-out). */
|
|
58920
58263
|
get mode(): string;
|
|
@@ -58934,7 +58277,25 @@ declare namespace TOOLKIT {
|
|
|
58934
58277
|
private writeCloudUniforms;
|
|
58935
58278
|
/** The cloud ambient: the sky's ambient SH at (0, -1, 0), physical (CloudLayerCommon `SampleSH9(_AmbientProbeBuffer, down)`). */
|
|
58936
58279
|
private cloudAmbient;
|
|
58280
|
+
/**
|
|
58281
|
+
* The sky's ambient probe in one direction, physical and before the indirect-diffuse scale - the ambient the cloud layer and
|
|
58282
|
+
* the volumetric clouds (TOOLKIT.VolumetricClouds) light with.
|
|
58283
|
+
* @param direction The world direction.
|
|
58284
|
+
* @returns The ambient radiance, black when the sky has no ambient yet.
|
|
58285
|
+
*/
|
|
58286
|
+
ambientAt(direction: BABYLON.Vector3): BABYLON.Color3;
|
|
58937
58287
|
private cloudLayers;
|
|
58288
|
+
/**
|
|
58289
|
+
* Loads the sky's exported space emission cube (`params.spaceemissionurl`).
|
|
58290
|
+
* @returns The cube, or null when the export has none.
|
|
58291
|
+
*/
|
|
58292
|
+
private loadSpaceEmission;
|
|
58293
|
+
/**
|
|
58294
|
+
* The `pbSpace` uniform: emission multiplier, cosine and sine of the Y rotation, and the X sign that takes a right-handed scene
|
|
58295
|
+
* direction back to Unity's left-handed cube.
|
|
58296
|
+
* @returns The uniform value.
|
|
58297
|
+
*/
|
|
58298
|
+
private spaceEmissionUniform;
|
|
58938
58299
|
private loadCloudMap;
|
|
58939
58300
|
private bindEffect;
|
|
58940
58301
|
/**
|
|
@@ -58945,6 +58306,12 @@ declare namespace TOOLKIT {
|
|
|
58945
58306
|
* @param capturing True before the probe renders its faces, false after.
|
|
58946
58307
|
*/
|
|
58947
58308
|
setProbeCapture(capturing: boolean): void;
|
|
58309
|
+
/**
|
|
58310
|
+
* True when the sky draws straight to display values: on a non-parity scene with no image-processing pass, materials encode
|
|
58311
|
+
* for display themselves, and the sky's raw radiance would otherwise sit among them as linear values.
|
|
58312
|
+
* @returns True for a scene whose image processing runs inside materials.
|
|
58313
|
+
*/
|
|
58314
|
+
private encodesForDisplay;
|
|
58948
58315
|
private applyMaterialUniforms;
|
|
58949
58316
|
/** D37: the colour of every interacting light on surfaces x HDRP's atmospheric attenuation at the camera. */
|
|
58950
58317
|
private attenuateSuns;
|
|
@@ -63394,6 +62761,210 @@ declare namespace TOOLKIT {
|
|
|
63394
62761
|
private onDataLoaded;
|
|
63395
62762
|
}
|
|
63396
62763
|
}
|
|
62764
|
+
declare namespace TOOLKIT {
|
|
62765
|
+
/** One node kept around the camera while it is under water, as FollowPlayerSystem does in Unity. */
|
|
62766
|
+
interface IMeshWaterFollower {
|
|
62767
|
+
/** Node id. */
|
|
62768
|
+
node: string;
|
|
62769
|
+
/** World offset from the camera, in metres. */
|
|
62770
|
+
offset: number[];
|
|
62771
|
+
/** Local scale set once at start, or null to leave the node's own. */
|
|
62772
|
+
scale: number[] | null;
|
|
62773
|
+
}
|
|
62774
|
+
/** Underwater state of a water surface drawn by an ordinary mesh. */
|
|
62775
|
+
interface IMeshWaterUnderwater {
|
|
62776
|
+
/** Height the camera is compared with, in metres. It can differ from the drawn surface: Unity URP Water sits 0.1 m below it. */
|
|
62777
|
+
sealevel: number;
|
|
62778
|
+
/** Raw RGB keys of the fog gradient (`Gradient.Evaluate`), sampled evenly from surface to `fogdepth`. Empty leaves the fog alone. */
|
|
62779
|
+
fogcolors: number[][];
|
|
62780
|
+
/** Added to each fog colour channel that is zero or more, then clamped to 1. A negative channel adds nothing. */
|
|
62781
|
+
fogcolormultiplier: number[];
|
|
62782
|
+
/** Metres of depth over which the gradient runs. */
|
|
62783
|
+
fogdepth: number;
|
|
62784
|
+
/** Fog density in Babylon's terms: Unity's value with the same export factor as `metadata.fogdensity`. */
|
|
62785
|
+
fogdensity: number;
|
|
62786
|
+
/** Linear fog start in metres. */
|
|
62787
|
+
fogstart: number;
|
|
62788
|
+
/** Linear fog end in metres. */
|
|
62789
|
+
fogend: number;
|
|
62790
|
+
/** The sun's raw colour (`Light.color`), which multiplies the fog; white when the effect has no light. */
|
|
62791
|
+
suncolor: number[];
|
|
62792
|
+
/** Node ids of `TOOLKIT.PostProcessor` volumes enabled only under water. */
|
|
62793
|
+
volumenodes: string[];
|
|
62794
|
+
/** Node ids enabled only under water. */
|
|
62795
|
+
shownodes: string[];
|
|
62796
|
+
/** Node ids rotated Euler(180, 0, 0) while under water. */
|
|
62797
|
+
flipnodes: string[];
|
|
62798
|
+
/** Nodes kept around the camera while under water. */
|
|
62799
|
+
follownodes: TOOLKIT.IMeshWaterFollower[];
|
|
62800
|
+
}
|
|
62801
|
+
/** Exported properties of `TOOLKIT.MeshWaterSurface`. */
|
|
62802
|
+
interface IMeshWaterSurfaceProperties {
|
|
62803
|
+
/** World height of the still surface in metres. */
|
|
62804
|
+
sealevel: number;
|
|
62805
|
+
/** Vertical wave amplitude in metres (the material's `_WaveSteepness`), zero for a flat surface. */
|
|
62806
|
+
waveamplitude: number;
|
|
62807
|
+
/** Wave phase speed in radians per second (the material's `_WaveSpeed / 20`). */
|
|
62808
|
+
wavespeed: number;
|
|
62809
|
+
/** The underwater state, or null when the scene has none: the surface then only answers height queries. */
|
|
62810
|
+
underwater: TOOLKIT.IMeshWaterUnderwater | null;
|
|
62811
|
+
}
|
|
62812
|
+
/**
|
|
62813
|
+
* Water drawn by an ordinary mesh with a transpiled graph. It answers height queries in the shape of
|
|
62814
|
+
* `HdrpWaterSurface`, and turns the underwater look on and off as one state switch: each frame it compares the active camera with
|
|
62815
|
+
* sea level, and on a crossing it writes the scene's fog values, enables the listed volumes and nodes, plays their particles, and
|
|
62816
|
+
* turns the listed nodes over. `scene.fogMode` is never written, so no material recompiles, and a scene with fog off has no underwater fog, as in Unity.
|
|
62817
|
+
* @class MeshWaterSurface - All rights reserved (c) 2024 Mackey Kinard
|
|
62818
|
+
*/
|
|
62819
|
+
class MeshWaterSurface extends TOOLKIT.ScriptComponent {
|
|
62820
|
+
/** The class name of the volumes this component switches. */
|
|
62821
|
+
private static readonly POST_PROCESSOR_CLASS;
|
|
62822
|
+
/** The class name of the particle systems this component plays. */
|
|
62823
|
+
private static readonly PARTICLES_CLASS;
|
|
62824
|
+
/** `ParticleSystemStopBehavior.StopEmittingAndClear`, because Unity deactivates the object in the same step. */
|
|
62825
|
+
private static readonly STOP_AND_CLEAR;
|
|
62826
|
+
/** CanvasTools doubles Unity's linear fog end on scene intake, so the underwater end takes the same factor. */
|
|
62827
|
+
private static readonly LINEAR_FOG_END_SCALE;
|
|
62828
|
+
/** The scene's water surface, by `scene.uniqueId`. */
|
|
62829
|
+
private static Registry;
|
|
62830
|
+
/** The exported properties. */
|
|
62831
|
+
private waterProperties;
|
|
62832
|
+
/** True between `enterUnderwater` and `leaveUnderwater`. */
|
|
62833
|
+
private isUnderwater;
|
|
62834
|
+
/** One fog colour, reused each frame. */
|
|
62835
|
+
private readonly fogColorChannels;
|
|
62836
|
+
/** The scene's fog colour above water, saved at the first switch. */
|
|
62837
|
+
private readonly surfaceFogColor;
|
|
62838
|
+
/** The scene's fog density above water. */
|
|
62839
|
+
private surfaceFogDensity;
|
|
62840
|
+
/** The scene's linear fog start above water. */
|
|
62841
|
+
private surfaceFogStart;
|
|
62842
|
+
/** The scene's linear fog end above water. */
|
|
62843
|
+
private surfaceFogEnd;
|
|
62844
|
+
/** Nodes enabled only under water. */
|
|
62845
|
+
private shownNodes;
|
|
62846
|
+
/** Particle systems on the shown nodes, played only under water. */
|
|
62847
|
+
private shownParticles;
|
|
62848
|
+
/** Volume nodes enabled only under water. */
|
|
62849
|
+
private volumeNodes;
|
|
62850
|
+
/** Nodes turned over while under water. */
|
|
62851
|
+
private flippedNodes;
|
|
62852
|
+
/** Nodes kept around the camera while under water. */
|
|
62853
|
+
private followers;
|
|
62854
|
+
/** One follower position, reused each frame. */
|
|
62855
|
+
private readonly followPosition;
|
|
62856
|
+
/**
|
|
62857
|
+
* Created by the scene loader from the exported component.
|
|
62858
|
+
* @param transform - The water root.
|
|
62859
|
+
* @param scene - The scene.
|
|
62860
|
+
* @param properties - The exported `IMeshWaterSurfaceProperties`.
|
|
62861
|
+
* @param alias - The class name the component registers under.
|
|
62862
|
+
*/
|
|
62863
|
+
constructor(transform: BABYLON.TransformNode, scene: BABYLON.Scene, properties?: any, alias?: string);
|
|
62864
|
+
/**
|
|
62865
|
+
* The scene's water surface. One per scene is the supported case; a second replaces the first with one warning.
|
|
62866
|
+
* @param scene - The scene to look in.
|
|
62867
|
+
* @returns The surface, or null when the scene has none.
|
|
62868
|
+
*/
|
|
62869
|
+
static Get(scene: BABYLON.Scene): TOOLKIT.MeshWaterSurface;
|
|
62870
|
+
/**
|
|
62871
|
+
* Reads the exported properties and registers the surface.
|
|
62872
|
+
* Runs before the first frame, so game code can query heights from its own `start`.
|
|
62873
|
+
*/
|
|
62874
|
+
protected awake(): void;
|
|
62875
|
+
/**
|
|
62876
|
+
* Builds the components on the nodes shown only under water, which stay asleep while their node is disabled. Their particle
|
|
62877
|
+
* systems then join the reveal-time warm-up, so the first dip compiles nothing.
|
|
62878
|
+
*/
|
|
62879
|
+
protected ready(): void;
|
|
62880
|
+
/** Finds the listed nodes once. A camera that starts under water enters the state at once, as Unity's `Start` does. */
|
|
62881
|
+
protected start(): void;
|
|
62882
|
+
/** Runs the state switch for the active camera. Allocates nothing on a frame without a crossing. */
|
|
62883
|
+
protected update(): void;
|
|
62884
|
+
/** Drops the surface from the registry and puts the scene back as it was above water. */
|
|
62885
|
+
protected destroy(): void;
|
|
62886
|
+
/** @returns World height of the still surface in metres. */
|
|
62887
|
+
getSeaLevel(): number;
|
|
62888
|
+
/** @returns World height of the surface now: `sealevel + sin(clockSeconds * wavespeed) * waveamplitude`. */
|
|
62889
|
+
getSurfaceHeight(): number;
|
|
62890
|
+
/**
|
|
62891
|
+
* @param camera - The camera to measure.
|
|
62892
|
+
* @returns Metres of the camera above the surface, negative under water.
|
|
62893
|
+
*/
|
|
62894
|
+
getCameraHeight(camera: BABYLON.Camera): number;
|
|
62895
|
+
/**
|
|
62896
|
+
* True at or below the height the Unity underwater component compares with. That height ignores the wave, so a camera
|
|
62897
|
+
* resting at the surface does not flicker between the two states.
|
|
62898
|
+
* @param camera - The camera to test.
|
|
62899
|
+
* @returns True when the underwater state applies to this camera.
|
|
62900
|
+
*/
|
|
62901
|
+
isCameraUnderwater(camera: BABYLON.Camera): boolean;
|
|
62902
|
+
/**
|
|
62903
|
+
* Mirrors `HdrpWaterSurface.ProjectPointOnWaterSurface`. The surface is one flat height, so the search ends at once.
|
|
62904
|
+
* @param searchParameters - `targetPositionWS` may be a `Vector3` or a number array.
|
|
62905
|
+
* @returns The surface point under the target, or null without a target.
|
|
62906
|
+
*/
|
|
62907
|
+
ProjectPointOnWaterSurface(searchParameters: TOOLKIT.IHdrpWaterSearchParameters): TOOLKIT.IHdrpWaterSearchResult;
|
|
62908
|
+
/**
|
|
62909
|
+
* Mirrors `HdrpWaterSurface.FindWaterSurfaceHeight`.
|
|
62910
|
+
* @param searchParameters - As `ProjectPointOnWaterSurface`.
|
|
62911
|
+
* @returns The surface point under the target, or null without a target.
|
|
62912
|
+
*/
|
|
62913
|
+
FindWaterSurfaceHeight(searchParameters: TOOLKIT.IHdrpWaterSearchParameters): TOOLKIT.IHdrpWaterSearchResult;
|
|
62914
|
+
/**
|
|
62915
|
+
* Resolves node ids, skipping one the export no longer holds.
|
|
62916
|
+
* @param nodeIds - Exported node ids.
|
|
62917
|
+
* @returns The nodes found.
|
|
62918
|
+
*/
|
|
62919
|
+
private findNodes;
|
|
62920
|
+
/**
|
|
62921
|
+
* Finds the particle systems to start and stop: Unity's underwater component does this from script, so they are authored stopped.
|
|
62922
|
+
* @param nodes - The shown nodes.
|
|
62923
|
+
* @returns The systems found.
|
|
62924
|
+
*/
|
|
62925
|
+
private findParticles;
|
|
62926
|
+
/**
|
|
62927
|
+
* Works out a node's two rotations once. Unity turns the plane over because it draws front faces only. The node stays
|
|
62928
|
+
* live: a static water mesh loads with a frozen world matrix, which would ignore the turn.
|
|
62929
|
+
* @param node - The node to turn over.
|
|
62930
|
+
* @returns The node and its rotations.
|
|
62931
|
+
*/
|
|
62932
|
+
private prepareFlip;
|
|
62933
|
+
/**
|
|
62934
|
+
* Resolves the follow list and sets each node's fixed scale.
|
|
62935
|
+
* @param follownodes - The exported list, absent on an older export.
|
|
62936
|
+
* @returns The followers found.
|
|
62937
|
+
*/
|
|
62938
|
+
private prepareFollowers;
|
|
62939
|
+
/** Saves the surface fog, writes the underwater fog, and turns on everything that shows only below the surface. */
|
|
62940
|
+
private enterUnderwater;
|
|
62941
|
+
/** Restores the surface fog and turns off everything `enterUnderwater` turned on. */
|
|
62942
|
+
private leaveUnderwater;
|
|
62943
|
+
/**
|
|
62944
|
+
* Saves the scene's fog and writes the underwater distances and density. The density takes the scene intake's scale for its mode.
|
|
62945
|
+
* @param underwater - The underwater block.
|
|
62946
|
+
*/
|
|
62947
|
+
private writeUnderwaterFog;
|
|
62948
|
+
/** Puts the scene's fog back exactly as it was. */
|
|
62949
|
+
private restoreSurfaceFog;
|
|
62950
|
+
/**
|
|
62951
|
+
* Switches the listed volumes. The node goes first because `IsVolumeEnabled` also tests it.
|
|
62952
|
+
* @param enabled - The new state.
|
|
62953
|
+
*/
|
|
62954
|
+
private setVolumesEnabled;
|
|
62955
|
+
/**
|
|
62956
|
+
* Writes the fog colour of the current depth, as the Unity underwater component does each frame, in the same raw
|
|
62957
|
+
* colour values as `metadata.fogcolor`.
|
|
62958
|
+
* @param depthMeters - Metres below the surface, zero or more.
|
|
62959
|
+
*/
|
|
62960
|
+
private updateFog;
|
|
62961
|
+
/**
|
|
62962
|
+
* Keeps the horizon box and the particles around the camera, as `FollowPlayerSystem.LateUpdate` does.
|
|
62963
|
+
* @param camera - The active camera.
|
|
62964
|
+
*/
|
|
62965
|
+
private updateFollowers;
|
|
62966
|
+
}
|
|
62967
|
+
}
|
|
63397
62968
|
/** Babylon Toolkit Namespace */
|
|
63398
62969
|
declare namespace TOOLKIT {
|
|
63399
62970
|
/**
|
|
@@ -68154,6 +67725,11 @@ declare namespace TOOLKIT {
|
|
|
68154
67725
|
* @returns True for a Cinemachine volume.
|
|
68155
67726
|
*/
|
|
68156
67727
|
private isCinemachineVolume;
|
|
67728
|
+
/**
|
|
67729
|
+
* True for a volume the exporter marked `role: "switched"`, which a component turns on later.
|
|
67730
|
+
* @returns True for a switched volume.
|
|
67731
|
+
*/
|
|
67732
|
+
private isSwitchedVolume;
|
|
68157
67733
|
/** Whether this volume contributes: `SetVolumeEnabled` and its node's own enabled state. */
|
|
68158
67734
|
IsVolumeEnabled(): boolean;
|
|
68159
67735
|
/** True while the per-frame local-volume observer is registered (only scenes with local volumes register one). */
|
|
@@ -69766,6 +69342,8 @@ declare namespace TOOLKIT {
|
|
|
69766
69342
|
static readonly VOLUME_TYPES: string[];
|
|
69767
69343
|
/** cinemachine-port D25: the `role` the exporter writes on a Cinemachine camera's volume. */
|
|
69768
69344
|
static readonly CINEMACHINE_VOLUME_ROLE: string;
|
|
69345
|
+
/** The `role` of a volume `TOOLKIT.MeshWaterSurface` switches on below the surface. */
|
|
69346
|
+
static readonly SWITCHED_VOLUME_ROLE: string;
|
|
69769
69347
|
/** PPv2 `GradingMode` enum (`ColorGrading.gradingMode`): 0 LowDefinitionRange, 1 HighDefinitionRange (default), 2 External. */
|
|
69770
69348
|
static readonly GRADING_MODES: string[];
|
|
69771
69349
|
/** Unity `RenderingPath` names as exported in `renderingpath`; PPv2 renders SSR only on `DeferredShading`. */
|
|
@@ -78843,6 +78421,23 @@ declare namespace TOOLKIT {
|
|
|
78843
78421
|
* @returns The body, or null when there is no collider to build it from.
|
|
78844
78422
|
*/
|
|
78845
78423
|
static CreateComplexCompoundBody(scene: BABYLON.Scene, entity: BABYLON.TransformNode, childItems: TOOLKIT.PhyscisContainerData[], rootMeshShape: BABYLON.PhysicsShape, motionType: BABYLON.PhysicsMotionType, physics: any, mass: number, centerOfMass: BABYLON.Vector3, layermask: number, filtermask: number): BABYLON.PhysicsBody;
|
|
78424
|
+
/**
|
|
78425
|
+
* Marks what the loader may dispose once a complex compound child has given its collider to the root's body: a node
|
|
78426
|
+
* that exists only to carry the collider goes whole, while a node that also renders stays and only loses its
|
|
78427
|
+
* `.Collider` mesh. A LOD level with a BoxCollider is such a node: disposing it would remove the visible mesh,
|
|
78428
|
+
* and with it every lower level, which stay blocked by a disposed LOD master.
|
|
78429
|
+
* @param entity The compound child node.
|
|
78430
|
+
*/
|
|
78431
|
+
private static MarkCompoundChildForDisposal;
|
|
78432
|
+
/**
|
|
78433
|
+
* Whether a node is a mesh Unity renders, shadow-only renderers included. Having vertices is not enough: with the
|
|
78434
|
+
* exporter's "Default Collision Proxy" on, a collider whose renderer is absent or disabled gets a generated box.
|
|
78435
|
+
* The exporter writes `metadata.toolkit.renderer` only for a present, enabled renderer whenever physics is exported,
|
|
78436
|
+
* and it writes one on a `.Collider` mesh too, so that name is ruled out first.
|
|
78437
|
+
* @param node A node.
|
|
78438
|
+
* @returns True when the node draws in Unity.
|
|
78439
|
+
*/
|
|
78440
|
+
private static RendersItself;
|
|
78846
78441
|
protected static CreateCompoundPhysicsShapeAndBody(scene: BABYLON.Scene, root: BABYLON.TransformNode, entity: BABYLON.TransformNode, element: any, impostortype: number, staticfriction: number, dynamicfriction: number, restitution: number, fcombine: number, rcombine: number, sitems: TOOLKIT.PhyscisContainerData[], item: TOOLKIT.PhyscisContainerData, center: any, complex: boolean, trigger: boolean, persist: boolean, layer: number, filter: number): void;
|
|
78847
78442
|
protected static CreateHeightFieldTerrainShapeFromMesh(terrainMesh: BABYLON.Mesh, scaleX: number, scaleZ: number): any;
|
|
78848
78443
|
static GetPhysicsHeapSize(): number;
|
|
@@ -80344,7 +79939,8 @@ declare namespace TOOLKIT {
|
|
|
80344
79939
|
getOwnedParticleSystems(): BABYLON.IParticleSystem[];
|
|
80345
79940
|
/**
|
|
80346
79941
|
* True when nothing of the system is drawn and it is drawn as quads, so a warm draw can show it (mesh / graph renderers draw through
|
|
80347
|
-
* meshes): idle (never started), or playing but held by culling with no live particle.
|
|
79942
|
+
* meshes): idle (never started), or playing but held by culling with no live particle. A system whose object was inactive at
|
|
79943
|
+
* export (`enabled: false`) counts too: script activates it later, and without this draw its first show builds a GPU pipeline.
|
|
80348
79944
|
*/
|
|
80349
79945
|
canBeginWarmupDraw(): boolean;
|
|
80350
79946
|
/** Starts the warm draw: one invisible particle, the clock, RNG and emission bookkeeping untouched (SceneShaderWarmup reveal-time pass). */
|
|
@@ -83723,6 +83319,10 @@ declare namespace TOOLKIT {
|
|
|
83723
83319
|
*/
|
|
83724
83320
|
class TerrainBuilder extends TOOLKIT.ScriptComponent {
|
|
83725
83321
|
private static _registry;
|
|
83322
|
+
/** worldToUnityUV's inverse world matrix: height queries run every frame and must not allocate one per call. */
|
|
83323
|
+
private static readonly ScratchInverse;
|
|
83324
|
+
/** worldToUnityUV's terrain-local position. */
|
|
83325
|
+
private static readonly ScratchLocal;
|
|
83726
83326
|
readonly onBuiltObservable: BABYLON.Observable<TOOLKIT.TerrainBuilder>;
|
|
83727
83327
|
/** Loading progress of this terrain, stage by stage (see ITerrainLoadProgress). */
|
|
83728
83328
|
readonly onLoadProgressObservable: BABYLON.Observable<TOOLKIT.ITerrainLoadProgress>;
|
|
@@ -83880,6 +83480,37 @@ declare namespace TOOLKIT {
|
|
|
83880
83480
|
protected destroy(): void;
|
|
83881
83481
|
private disposeParts;
|
|
83882
83482
|
private buildAsync;
|
|
83483
|
+
/**
|
|
83484
|
+
* Finds this tile's four neighbours (D17). Reads each one's heights from its contract, because its heightfield may not be built yet.
|
|
83485
|
+
* @returns The neighbours, or null when the tile stands alone.
|
|
83486
|
+
*/
|
|
83487
|
+
private resolveEdgeNeighbors;
|
|
83488
|
+
/**
|
|
83489
|
+
* One axis neighbour of this tile.
|
|
83490
|
+
* @param tiles The scene's registered tiles.
|
|
83491
|
+
* @param neighborId The exported node id, or null.
|
|
83492
|
+
* @param useIds True when the export carries neighbour ids, so adjacency is not tested.
|
|
83493
|
+
* @param offsetX -1 or 1 along Unity x, else 0.
|
|
83494
|
+
* @param offsetZ -1 or 1 along Unity z, else 0.
|
|
83495
|
+
* @returns The neighbour's heights, or null when there is no matching tile.
|
|
83496
|
+
*/
|
|
83497
|
+
private edgeNeighborFor;
|
|
83498
|
+
/**
|
|
83499
|
+
* D17: tiles continue each other's normals only with equal resolution and equal x and z size.
|
|
83500
|
+
* @param other Another registered tile.
|
|
83501
|
+
* @returns True when a shared edge lines up sample for sample.
|
|
83502
|
+
*/
|
|
83503
|
+
private canShareEdgeWith;
|
|
83504
|
+
/**
|
|
83505
|
+
* DR-6.2 rectangle adjacency, for an export without neighbour ids: both tiles allow auto connect, share a grouping id, and
|
|
83506
|
+
* the other tile's origin sits one tile size away in this tile's Unity space. Measured in that space, it holds under any
|
|
83507
|
+
* parent transform, where comparing world axes would swap neighbours below a mirrored root.
|
|
83508
|
+
* @param other Another registered tile.
|
|
83509
|
+
* @param offsetX -1 or 1 along Unity x, else 0.
|
|
83510
|
+
* @param offsetZ -1 or 1 along Unity z, else 0.
|
|
83511
|
+
* @returns True when the other tile is this tile's neighbour on that side.
|
|
83512
|
+
*/
|
|
83513
|
+
private isAdjacentTile;
|
|
83883
83514
|
/** Shows or hides the built trees and details as drawTreesAndFoliage says (on a change, and once the parts are built). */
|
|
83884
83515
|
private applyTreesAndFoliageVisibility;
|
|
83885
83516
|
/**
|
|
@@ -84036,6 +83667,13 @@ declare namespace TOOLKIT {
|
|
|
84036
83667
|
private static NowMs;
|
|
84037
83668
|
/** [u, v] of a world position in Unity terrain space (unclamped), or null before the contract is known. */
|
|
84038
83669
|
private worldToUnityUV;
|
|
83670
|
+
/**
|
|
83671
|
+
* True when a world position lies on this tile's rectangle, widened by a tolerance.
|
|
83672
|
+
* @param worldPosition The world position.
|
|
83673
|
+
* @param tolerance Slack in metres on every side.
|
|
83674
|
+
* @returns False outside the widened rectangle, or before the contract is known.
|
|
83675
|
+
*/
|
|
83676
|
+
private containsWorldPosition;
|
|
84039
83677
|
/** Height relative to the terrain (Unity semantics), clamped to the terrain rect. */
|
|
84040
83678
|
SampleHeight(worldPosition: BABYLON.Vector3): number;
|
|
84041
83679
|
/** Local height at normalised (u, v). */
|
|
@@ -84050,7 +83688,13 @@ declare namespace TOOLKIT {
|
|
|
84050
83688
|
private static Unregister;
|
|
84051
83689
|
/** Every registered (valid-contract) terrain of the scene. */
|
|
84052
83690
|
static GetTerrains(scene: BABYLON.Scene): TOOLKIT.TerrainBuilder[];
|
|
84053
|
-
/**
|
|
83691
|
+
/**
|
|
83692
|
+
* The terrain whose rect contains the world position (the last registered wins overlaps), or null. A point that misses
|
|
83693
|
+
* every rect by Float32 rounding on a shared tile edge gets a second scan with TERRAIN_EDGE_TOLERANCE_METERS of slack.
|
|
83694
|
+
* @param scene The scene.
|
|
83695
|
+
* @param worldPosition The world position.
|
|
83696
|
+
* @returns The terrain under the position, or null when none covers it.
|
|
83697
|
+
*/
|
|
84054
83698
|
static GetTerrainAt(scene: BABYLON.Scene, worldPosition: BABYLON.Vector3): TOOLKIT.TerrainBuilder;
|
|
84055
83699
|
/** World Y of the terrain surface under a world position, or null when no terrain covers it. */
|
|
84056
83700
|
static GetWorldHeightAt(scene: BABYLON.Scene, worldPosition: BABYLON.Vector3): number;
|
|
@@ -84174,6 +83818,20 @@ declare namespace TOOLKIT {
|
|
|
84174
83818
|
wavelength: number;
|
|
84175
83819
|
} | null;
|
|
84176
83820
|
}
|
|
83821
|
+
/** The heights of one neighbouring tile, enough to continue a central difference across a shared edge. */
|
|
83822
|
+
interface ITerrainEdgeNeighbor {
|
|
83823
|
+
/** The neighbour's 16-bit heights, z outer, index = z * resolution + x. */
|
|
83824
|
+
heights: Uint16Array;
|
|
83825
|
+
/** The neighbour's height scale in metres (`size[1]`), which may differ from this tile's. */
|
|
83826
|
+
heightScale: number;
|
|
83827
|
+
}
|
|
83828
|
+
/** The four axis neighbours of a tile in Unity terrain space: left -x, right +x, top +z, bottom -z. */
|
|
83829
|
+
interface ITerrainEdgeNeighbors {
|
|
83830
|
+
left: ITerrainEdgeNeighbor | null;
|
|
83831
|
+
right: ITerrainEdgeNeighbor | null;
|
|
83832
|
+
top: ITerrainEdgeNeighbor | null;
|
|
83833
|
+
bottom: ITerrainEdgeNeighbor | null;
|
|
83834
|
+
}
|
|
84177
83835
|
interface ITerrainContract {
|
|
84178
83836
|
contract: number;
|
|
84179
83837
|
name: string;
|
|
@@ -84396,14 +84054,6 @@ declare namespace TOOLKIT {
|
|
|
84396
84054
|
}[];
|
|
84397
84055
|
/** The layer's main-pass host with room for at least count instances (created or grown on demand). */
|
|
84398
84056
|
private ensureMain;
|
|
84399
|
-
/**
|
|
84400
|
-
* Babylon's thinInstanceSetBuffer("matrix") keeps the old previous-world buffer (created on the first draw once the scene
|
|
84401
|
-
* needs previous world matrices, e.g. HDRP motion blur velocity), and every draw then writes the grown count into it - on
|
|
84402
|
-
* WebGPU that invalidates the whole frame. Rebuilt at the new size the way Babylon's own _thinInstanceUpdateBufferSize does:
|
|
84403
|
-
* merely disposing it leaves its four previousWorld vertex buffers on the geometry, and the next pipeline then counts them
|
|
84404
|
-
* as four separate buffers (past WebGPU's 8).
|
|
84405
|
-
*/
|
|
84406
|
-
private static ResizePreviousMatrices;
|
|
84407
84057
|
/** The main host's tint buffer: Babylon's "color" for mesh layers, "tkGrassTint" for texture grass (TerrainGrassPlugin). */
|
|
84408
84058
|
private static TintBuffer;
|
|
84409
84059
|
/** XZ distance from the camera (Unity-local metres) to the chunk rect. */
|
|
@@ -84576,6 +84226,14 @@ declare namespace TOOLKIT {
|
|
|
84576
84226
|
* Keyed on the material's type and shader name, never on a graph, scene or material name.
|
|
84577
84227
|
*/
|
|
84578
84228
|
static IsGraphMaterial(material: BABYLON.Material): boolean;
|
|
84229
|
+
/**
|
|
84230
|
+
* True when a Shader Graph class alone decides how its mesh moves, so the toolkit adds no sway. In Unity a terrain tree or
|
|
84231
|
+
* mesh detail on a Shader Graph gets no engine wind: only what the graph computes moves it, and the transpiled class
|
|
84232
|
+
* already does that. A SpeedTree material is the exception, because its wind comes from data its host may not carry.
|
|
84233
|
+
* @param material The source material of a tree or detail host.
|
|
84234
|
+
* @returns True when MODE_TREE and MODE_SWAY must be left out.
|
|
84235
|
+
*/
|
|
84236
|
+
static GraphOwnsMotion(material: BABYLON.Material): boolean;
|
|
84579
84237
|
getClassName(): string;
|
|
84580
84238
|
isCompatible(shaderLanguage: BABYLON.ShaderLanguage): boolean;
|
|
84581
84239
|
/** Installs (or extends, OR-ing the modes) the plugin on a material. Idempotent per material (metadata.tkFoliage). */
|
|
@@ -84889,6 +84547,8 @@ declare namespace TOOLKIT {
|
|
|
84889
84547
|
private _errors;
|
|
84890
84548
|
private _minH;
|
|
84891
84549
|
private _maxH;
|
|
84550
|
+
/** The tile's axis neighbours, null when it stands alone, so border normals stay one-sided. */
|
|
84551
|
+
private edgeNeighbors;
|
|
84892
84552
|
constructor(contract: TOOLKIT.ITerrainContract, heights: Uint16Array);
|
|
84893
84553
|
get cellSizeX(): number;
|
|
84894
84554
|
get cellSizeZ(): number;
|
|
@@ -84898,6 +84558,12 @@ declare namespace TOOLKIT {
|
|
|
84898
84558
|
sampleHeight(x: number, z: number): number;
|
|
84899
84559
|
/** Terrain-local normal (handedness applied to x). */
|
|
84900
84560
|
normalAt(u: number, v: number, out: number[]): void;
|
|
84561
|
+
/**
|
|
84562
|
+
* Sets the tiles whose heights continue this tile's normals across its shared edges. Call it before any normal is read:
|
|
84563
|
+
* the normal textures are built once from normalAt.
|
|
84564
|
+
* @param neighbors The axis neighbours, or null when the tile stands alone.
|
|
84565
|
+
*/
|
|
84566
|
+
setEdgeNeighbors(neighbors: TOOLKIT.ITerrainEdgeNeighbors): void;
|
|
84901
84567
|
/** Fills the holes grid from TerrainImages pixels (R channel, > 127 = solid). Image row 0 = terrain z 0. */
|
|
84902
84568
|
setHoles(pixels: Uint8ClampedArray, width: number): void;
|
|
84903
84569
|
private cellX;
|
|
@@ -84953,8 +84619,19 @@ declare namespace TOOLKIT {
|
|
|
84953
84619
|
static DecodeHeight(value: number, sizeY: number): number;
|
|
84954
84620
|
/** Bilinear local height at normalised (u, v), both clamped to 0..1. */
|
|
84955
84621
|
static SampleHeightBilinear(h: Uint16Array, R: number, sizeY: number, u: number, v: number): number;
|
|
84956
|
-
/**
|
|
84957
|
-
|
|
84622
|
+
/**
|
|
84623
|
+
* Central difference at the nearest sample, normalised [x, y, z] into out. A border sample continues across its shared
|
|
84624
|
+
* edge into a neighbouring tile, each height decoded with its own tile's scale, so both tiles compute the same normal
|
|
84625
|
+
* on the edge. A border sample without a neighbour stays one-sided.
|
|
84626
|
+
* @param h The tile's heights, z outer.
|
|
84627
|
+
* @param R The tile's samples per side.
|
|
84628
|
+
* @param size The tile's size [x, y, z] in metres.
|
|
84629
|
+
* @param u Unity-space normalised x, clamped to 0..1.
|
|
84630
|
+
* @param v Unity-space normalised z, clamped to 0..1.
|
|
84631
|
+
* @param out Receives the unit normal.
|
|
84632
|
+
* @param neighbors The tile's axis neighbours, or null when it stands alone.
|
|
84633
|
+
*/
|
|
84634
|
+
static SampleNormal(h: Uint16Array, R: number, size: number[], u: number, v: number, out: number[], neighbors?: TOOLKIT.ITerrainEdgeNeighbors): void;
|
|
84958
84635
|
/** handedness 0 → -x */
|
|
84959
84636
|
static UnityToLocalX(x: number, handedness: number): number;
|
|
84960
84637
|
/** handedness 0 → -yaw */
|
|
@@ -85309,7 +84986,8 @@ declare namespace TOOLKIT {
|
|
|
85309
84986
|
}
|
|
85310
84987
|
/**
|
|
85311
84988
|
* Terrain trees (unity-terrain-system-parity D15-D18, D29, D41, Design Reference §4.4, §14). Every prototype LOD renderer
|
|
85312
|
-
* becomes one thin-instance host parented to the terrain node.
|
|
84989
|
+
* becomes one thin-instance host parented to the terrain node. Hosts start small and grow to what is really drawn (D18), and
|
|
84990
|
+
* every tile's hosts draw one scene-owned copy of each prototype's geometry (D19). Each update selects a Unity LODGroup level per instance
|
|
85313
84991
|
* (relative height, maxfulllod, 0.5 s dithered crossfade), culls by distance and frustum, and rewrites the host buffers.
|
|
85314
84992
|
* Instances outside the frustum but inside the terrain's shadow reach still go to the casting hosts, so trees behind
|
|
85315
84993
|
* the camera cast into view (D44). Instances are visited through a 64 m grid (D45). Tree colliders are one static
|
|
@@ -85327,6 +85005,12 @@ declare namespace TOOLKIT {
|
|
|
85327
85005
|
private static readonly NO_PROBE_RECORD;
|
|
85328
85006
|
/** cos(0.5 deg): a smaller dot between light directions counts as the light turning. */
|
|
85329
85007
|
private static readonly LIGHT_TURN_DOT;
|
|
85008
|
+
/** The clone state a shared host must keep to draw as the renderer mesh does: winding, render group, layer, sort order, vertex colours, bones. */
|
|
85009
|
+
private static readonly HOST_DRAW_STATE;
|
|
85010
|
+
/** Per scene (uniqueId): one hidden mesh per "<templateid>|<lod>|<source uniqueId>", whose GPU buffers every tile's hosts share (D19). */
|
|
85011
|
+
private static PreparedHosts;
|
|
85012
|
+
/** The probe buffer a host holds now: growth replaces it, and the host's dispose must free the current one. */
|
|
85013
|
+
private static ProbeBuffers;
|
|
85330
85014
|
/** Per-scene clones of prototype materials, keyed "<templateid>|<material uniqueId>" (D41), with a reference count. */
|
|
85331
85015
|
private static _materials;
|
|
85332
85016
|
private _owner;
|
|
@@ -85340,6 +85024,8 @@ declare namespace TOOLKIT {
|
|
|
85340
85024
|
private _colliderShapes;
|
|
85341
85025
|
private _distance;
|
|
85342
85026
|
private _built;
|
|
85027
|
+
/** True once a host of this tile fell back to its own geometry, so the warning prints once per tile. */
|
|
85028
|
+
private _warnedUniqueHost;
|
|
85343
85029
|
private _n;
|
|
85344
85030
|
private _proto;
|
|
85345
85031
|
private _local;
|
|
@@ -85410,14 +85096,24 @@ declare namespace TOOLKIT {
|
|
|
85410
85096
|
* @returns A new array of caster meshes.
|
|
85411
85097
|
*/
|
|
85412
85098
|
getCasterMeshes(): BABYLON.AbstractMesh[];
|
|
85413
|
-
/**
|
|
85099
|
+
/**
|
|
85100
|
+
* Host count, instances drawn per host, and instances the hosts and caster slots have room for (diagnostics).
|
|
85101
|
+
* @returns The numbers; capacity counts every host and slot.
|
|
85102
|
+
*/
|
|
85414
85103
|
getStats(): {
|
|
85415
85104
|
hosts: number;
|
|
85416
85105
|
instances: number;
|
|
85417
85106
|
drawn: number;
|
|
85418
85107
|
visibleHosts: number;
|
|
85419
85108
|
colliders: boolean;
|
|
85109
|
+
capacity: number;
|
|
85420
85110
|
};
|
|
85111
|
+
/**
|
|
85112
|
+
* How many prepared prototype geometries a scene holds (tests and diagnostics).
|
|
85113
|
+
* @param scene The scene.
|
|
85114
|
+
* @returns One per (template, LOD, source) in use, 0 when the scene has no trees.
|
|
85115
|
+
*/
|
|
85116
|
+
static PreparedHostCount(scene: BABYLON.Scene): number;
|
|
85421
85117
|
/**
|
|
85422
85118
|
* Builds the tree instancer from the terrain contract: one camera host per LOD renderer of each prototype (plus the
|
|
85423
85119
|
* caster slots of each casting host, terrain-performance D8), registers the shadow casters with the owner, decodes the
|
|
@@ -85428,9 +85124,9 @@ declare namespace TOOLKIT {
|
|
|
85428
85124
|
/**
|
|
85429
85125
|
* Creates the hosts of one prototype (§4.4 step 1): one thin-instance host per renderer mesh of each LOD level, with the
|
|
85430
85126
|
* host's shadow-casting flag, its light-probe use and, for a casting host, its caster slots (terrain-performance D8).
|
|
85431
|
-
* @param
|
|
85432
|
-
* @param
|
|
85433
|
-
* @param
|
|
85127
|
+
* @param prototype The exported tree prototype.
|
|
85128
|
+
* @param template The prototype's template node in the scene.
|
|
85129
|
+
* @param instanceCount The prototype's instance count: the ceiling each host and slot can grow to (D18).
|
|
85434
85130
|
* @returns The prototype's runtime data, or null when no LOD produced a host.
|
|
85435
85131
|
*/
|
|
85436
85132
|
private buildPrototype;
|
|
@@ -85441,6 +85137,19 @@ declare namespace TOOLKIT {
|
|
|
85441
85137
|
* TerrainProbePlugin) over `probes` (every record starts at "no probe") - and the probe plugin on its material(s).
|
|
85442
85138
|
*/
|
|
85443
85139
|
static AttachProbeBuffer(host: BABYLON.Mesh, probes: Float32Array): BABYLON.Buffer;
|
|
85140
|
+
/**
|
|
85141
|
+
* One instanced buffer over a host's probe records, bound as the three vec4 views of TerrainProbePlugin.
|
|
85142
|
+
* @param host The host mesh.
|
|
85143
|
+
* @param probes The packed records, TerrainProbePlugin.STRIDE each.
|
|
85144
|
+
* @returns The new buffer.
|
|
85145
|
+
*/
|
|
85146
|
+
private static CreateProbeBuffer;
|
|
85147
|
+
/**
|
|
85148
|
+
* Gives a grown host a probe buffer of its new size. The plugin stays attached, and the views' attribute names do not
|
|
85149
|
+
* change, so no shader recompiles.
|
|
85150
|
+
* @param host The host whose probes array was replaced.
|
|
85151
|
+
*/
|
|
85152
|
+
private static ResizeProbeBuffer;
|
|
85444
85153
|
/**
|
|
85445
85154
|
* X10 fix loop 2: samples the scene's light-probe network once per instance (spatially ordered by the D45 grid so each
|
|
85446
85155
|
* tetrahedral walk starts in the previous instance's cell), at the instance's world position (ProbeSampleHeight 0).
|
|
@@ -85497,12 +85206,49 @@ declare namespace TOOLKIT {
|
|
|
85497
85206
|
* @throws Error when the source has no index buffer, no vertex buffers, or a vertex buffer without a GPU wrapper.
|
|
85498
85207
|
*/
|
|
85499
85208
|
static CreateSharedHost(scene: BABYLON.Scene, source: BABYLON.Mesh, name: string): BABYLON.Mesh;
|
|
85209
|
+
/**
|
|
85210
|
+
* The mesh a renderer's geometry is drawn from: a copy baked into prototype space, in one interleaved buffer.
|
|
85211
|
+
* @param source The renderer's mesh.
|
|
85212
|
+
* @param templateWorldInverse The inverse world matrix of the prototype's template.
|
|
85213
|
+
* @param name The new mesh's name.
|
|
85214
|
+
* @returns The mesh, or null when the source cannot be cloned.
|
|
85215
|
+
*/
|
|
85216
|
+
private static BakeHostGeometry;
|
|
85217
|
+
/**
|
|
85218
|
+
* The scene's one hidden copy of a prototype renderer's geometry (D19): it owns the GPU buffers every tile's hosts draw, so
|
|
85219
|
+
* a tile's dispose never frees another tile's geometry. Lives until the scene is disposed.
|
|
85220
|
+
* @param prototype The exported tree prototype.
|
|
85221
|
+
* @param lod The LOD level.
|
|
85222
|
+
* @param source The renderer's mesh.
|
|
85223
|
+
* @param templateWorldInverse The inverse world matrix of the prototype's template.
|
|
85224
|
+
* @returns The prepared mesh, or null when the source cannot be cloned.
|
|
85225
|
+
*/
|
|
85226
|
+
private prepareHostGeometry;
|
|
85227
|
+
/**
|
|
85228
|
+
* Today's path for an engine without shared GPU buffers: the tile keeps its own geometry copy, so its trees never vanish.
|
|
85229
|
+
* @param source The renderer's mesh.
|
|
85230
|
+
* @param templateWorldInverse The inverse world matrix of the prototype's template.
|
|
85231
|
+
* @param name The host's name.
|
|
85232
|
+
* @param reason Why sharing failed, for the warning.
|
|
85233
|
+
* @returns The host, or null when the source cannot be cloned.
|
|
85234
|
+
*/
|
|
85235
|
+
private createUniqueHost;
|
|
85236
|
+
/**
|
|
85237
|
+
* One camera host of this tile: the scene's prepared geometry (D19) with this tile's own instance buffers.
|
|
85238
|
+
* @param prototype The exported tree prototype.
|
|
85239
|
+
* @param lod The LOD level.
|
|
85240
|
+
* @param source The renderer's mesh.
|
|
85241
|
+
* @param templateWorldInverse The inverse world matrix of the prototype's template.
|
|
85242
|
+
* @param matrices The host's first instance matrices.
|
|
85243
|
+
* @param fades The host's first LOD fades.
|
|
85244
|
+
* @returns The host, or null when the source cannot be cloned.
|
|
85245
|
+
*/
|
|
85500
85246
|
private createHost;
|
|
85501
85247
|
/**
|
|
85502
85248
|
* Builds the CASTER_SLOTS caster-only meshes of a casting host (terrain-performance D8). When GPU sharing fails the host keeps
|
|
85503
85249
|
* no slots and casts itself, as before.
|
|
85504
85250
|
* @param host The casting host.
|
|
85505
|
-
* @param capacity Instances each slot can hold
|
|
85251
|
+
* @param capacity Instances each slot can hold at first; it grows to the host's capacityCeiling (D18).
|
|
85506
85252
|
*/
|
|
85507
85253
|
private createCasterSlots;
|
|
85508
85254
|
/**
|
|
@@ -85524,6 +85270,7 @@ declare namespace TOOLKIT {
|
|
|
85524
85270
|
/**
|
|
85525
85271
|
* D41: one clone per (prototype, source material), named "<material>.<prototype>", with the foliage plugin attached.
|
|
85526
85272
|
* T8: a SpeedTree 8 material on a host with wind vertex data gets its own clone without the MODE_TREE bend.
|
|
85273
|
+
* A Shader Graph tree gets no bend either, because only its graph moves it in Unity (TerrainFoliagePlugin.GraphOwnsMotion).
|
|
85527
85274
|
* @param p The exported tree prototype.
|
|
85528
85275
|
* @param lod The LOD level of the host.
|
|
85529
85276
|
* @param source The renderer's material (a MultiMaterial is cloned per sub-material).
|
|
@@ -85668,12 +85415,19 @@ declare namespace TOOLKIT {
|
|
|
85668
85415
|
private static KthSmallest;
|
|
85669
85416
|
/**
|
|
85670
85417
|
* Appends instance `instanceIndex` to a host or slot: its matrix, the fade, its probe SH when the target binds probes (a "no probe" record while the scene's network is switched off), and the
|
|
85671
|
-
* instance's sphere in the target's terrain-local box. A full target ignores the instance.
|
|
85418
|
+
* instance's sphere in the target's terrain-local box. A full target grows (D18); one at its ceiling ignores the instance.
|
|
85672
85419
|
* @param target The camera host or caster slot.
|
|
85673
85420
|
* @param instanceIndex The instance index.
|
|
85674
85421
|
* @param fade The LOD fade value (1 steady; signed crossfade weight otherwise).
|
|
85675
85422
|
*/
|
|
85676
85423
|
private appendInstance;
|
|
85424
|
+
/**
|
|
85425
|
+
* Gives a full host or slot larger arrays, keeping the instances written so far (D18). The GPU buffers follow in uploadTarget.
|
|
85426
|
+
* @param target The camera host or caster slot.
|
|
85427
|
+
* @param ceiling The most instances the target can ever hold.
|
|
85428
|
+
* @returns False when the target is already at its ceiling.
|
|
85429
|
+
*/
|
|
85430
|
+
private static GrowTarget;
|
|
85677
85431
|
/**
|
|
85678
85432
|
* True when any host of a prototype's LOD level casts shadows (billboard LODs and castshadows:false renderers do not).
|
|
85679
85433
|
* @param hosts The instancer's hosts.
|
|
@@ -85700,6 +85454,21 @@ declare namespace TOOLKIT {
|
|
|
85700
85454
|
* @param shadowOnly True when the instance is outside the view (state 2).
|
|
85701
85455
|
*/
|
|
85702
85456
|
private writeCaster;
|
|
85457
|
+
/**
|
|
85458
|
+
* Binds a grown host's or slot's new arrays. Each set uploads its whole array, so the frame needs no partial update.
|
|
85459
|
+
* @param target The camera host or caster slot.
|
|
85460
|
+
*/
|
|
85461
|
+
private static RebindGrownTarget;
|
|
85462
|
+
/**
|
|
85463
|
+
* Babylon's thinInstanceSetBuffer("matrix") keeps the old previous-world buffer (created on the first draw once the scene
|
|
85464
|
+
* needs previous world matrices, e.g. HDRP motion blur velocity), and every draw then writes the grown count into it - on
|
|
85465
|
+
* WebGPU that invalidates the whole frame. Rebuilt at the new size the way Babylon's own _thinInstanceUpdateBufferSize does:
|
|
85466
|
+
* merely disposing it leaves its four previousWorld vertex buffers on the geometry, and the next pipeline then counts them
|
|
85467
|
+
* as four separate buffers (past WebGPU's 8).
|
|
85468
|
+
* @param mesh The grown thin-instance mesh.
|
|
85469
|
+
* @param matrices Its new instance matrices.
|
|
85470
|
+
*/
|
|
85471
|
+
static ResizePreviousMatrices(mesh: BABYLON.Mesh, matrices: Float32Array): void;
|
|
85703
85472
|
/**
|
|
85704
85473
|
* Uploads a host's or slot's instances written this update: count, matrices, fades, the probe buffer when bound, the bounding
|
|
85705
85474
|
* box, and visibility (an empty target is hidden; a slot must be visible to cast). An empty slot is also disabled, and a
|
|
@@ -93296,6 +93065,515 @@ declare namespace TOOLKIT {
|
|
|
93296
93065
|
private static crosses;
|
|
93297
93066
|
}
|
|
93298
93067
|
}
|
|
93068
|
+
declare namespace TOOLKIT {
|
|
93069
|
+
/** The exported curves of `urp.clouds`: 64 samples each over the layer height (CloudExportMath.CloudCurveSamples). */
|
|
93070
|
+
interface ICloudCurves {
|
|
93071
|
+
density?: number[];
|
|
93072
|
+
erosion?: number[];
|
|
93073
|
+
ambientocclusion?: number[];
|
|
93074
|
+
}
|
|
93075
|
+
/** One noise sidecar: its url, relative to the scene folder, and its volume edge in texels. */
|
|
93076
|
+
interface ICloudNoiseFile {
|
|
93077
|
+
url: string;
|
|
93078
|
+
size: number;
|
|
93079
|
+
}
|
|
93080
|
+
/**
|
|
93081
|
+
* The exported `urp.clouds` block (DR-4.6): the VolumetricClouds Volume fields under their lowercased names, the renderer
|
|
93082
|
+
* feature's resolution scale, the curves and the noise sidecars. Every value may be missing from an older export.
|
|
93083
|
+
*/
|
|
93084
|
+
interface IUrpCloudsBlock {
|
|
93085
|
+
state?: boolean;
|
|
93086
|
+
localclouds?: boolean;
|
|
93087
|
+
resolutionscale?: number;
|
|
93088
|
+
densitymultiplier?: number;
|
|
93089
|
+
shapefactor?: number;
|
|
93090
|
+
shapescale?: number;
|
|
93091
|
+
shapeoffset?: number[];
|
|
93092
|
+
coveragevariation?: number;
|
|
93093
|
+
coveragepatternsize?: number;
|
|
93094
|
+
coveragegapamount?: number;
|
|
93095
|
+
coveragepatternoffset?: number[];
|
|
93096
|
+
erosionfactor?: number;
|
|
93097
|
+
erosionscale?: number;
|
|
93098
|
+
microerosion?: boolean;
|
|
93099
|
+
microerosionfactor?: number;
|
|
93100
|
+
microerosionscale?: number;
|
|
93101
|
+
bottomaltitude?: number;
|
|
93102
|
+
altituderange?: number;
|
|
93103
|
+
earthcurvature?: number;
|
|
93104
|
+
globalspeed?: number;
|
|
93105
|
+
globalorientation?: number;
|
|
93106
|
+
shapespeedmultiplier?: number;
|
|
93107
|
+
erosionspeedmultiplier?: number;
|
|
93108
|
+
altitudedistortion?: number;
|
|
93109
|
+
verticalshapewindspeed?: number;
|
|
93110
|
+
verticalerosionwindspeed?: number;
|
|
93111
|
+
cloudmapspeedmultiplier?: number;
|
|
93112
|
+
ambientlightprobedimmer?: number;
|
|
93113
|
+
sunlightdimmer?: number;
|
|
93114
|
+
erosionocclusion?: number;
|
|
93115
|
+
scatteringtint?: number[];
|
|
93116
|
+
powdereffectintensity?: number;
|
|
93117
|
+
multiscattering?: number;
|
|
93118
|
+
temporalaccumulationfactor?: number;
|
|
93119
|
+
perceptualblending?: number;
|
|
93120
|
+
numprimarysteps?: number;
|
|
93121
|
+
longraysamplemultiplier?: number;
|
|
93122
|
+
numlightsteps?: number;
|
|
93123
|
+
fadeinmode?: number;
|
|
93124
|
+
fadeinstart?: number;
|
|
93125
|
+
fadeindistance?: number;
|
|
93126
|
+
curves?: TOOLKIT.ICloudCurves;
|
|
93127
|
+
noise?: {
|
|
93128
|
+
worley?: TOOLKIT.ICloudNoiseFile;
|
|
93129
|
+
erosion?: TOOLKIT.ICloudNoiseFile;
|
|
93130
|
+
};
|
|
93131
|
+
}
|
|
93132
|
+
/** The two `urp.sky` fields the clouds read: the planet and the sun's intensity scale. */
|
|
93133
|
+
interface ICloudSkyFields {
|
|
93134
|
+
planet?: {
|
|
93135
|
+
radius?: number;
|
|
93136
|
+
renderingspace?: number;
|
|
93137
|
+
center?: number[];
|
|
93138
|
+
};
|
|
93139
|
+
sunintensityscale?: number;
|
|
93140
|
+
}
|
|
93141
|
+
/** One tier's march settings (DR-6.4). */
|
|
93142
|
+
interface ICloudTierSettings {
|
|
93143
|
+
/** Cloud target size as a fraction of the render size. */
|
|
93144
|
+
resolutionScale: number;
|
|
93145
|
+
/** Primary march steps. */
|
|
93146
|
+
primarySteps: number;
|
|
93147
|
+
/** How much longer rays may multiply their step count. */
|
|
93148
|
+
longRayMultiplier: number;
|
|
93149
|
+
/** Light march steps toward the sun. */
|
|
93150
|
+
lightSteps: number;
|
|
93151
|
+
}
|
|
93152
|
+
/**
|
|
93153
|
+
* unity-gaia-terrain-port T19 / T20: the pure maths of the volumetric clouds - shell intersection, step size, tier settings and
|
|
93154
|
+
* the curve texture - free of Babylon so the tests run it without a scene.
|
|
93155
|
+
*/
|
|
93156
|
+
class VolumetricCloudsMath {
|
|
93157
|
+
/** The lowest tier: clouds are never switched off, only coarser. */
|
|
93158
|
+
static readonly LowestTier: number;
|
|
93159
|
+
/**
|
|
93160
|
+
* Where a ray enters and leaves the cloud shell (the local-clouds case of `IntersectCloudVolume`).
|
|
93161
|
+
* @param rayOrigin - Ray origin in planet space (relative to the planet centre), metres.
|
|
93162
|
+
* @param rayDirection - Normalised ray direction.
|
|
93163
|
+
* @param innerRadius - Radius of the layer bottom, metres from the planet centre.
|
|
93164
|
+
* @param outerRadius - Radius of the layer top, metres from the planet centre.
|
|
93165
|
+
* @param planetRadius - Planet radius for the earth-shadow test below the layer. Defaults to `innerRadius` (no test lost for a ray going up).
|
|
93166
|
+
* @returns `[entry, exit]` in metres along the ray, or null when the ray misses the shell or the planet hides it.
|
|
93167
|
+
*/
|
|
93168
|
+
static ShellInterval(rayOrigin: number[], rayDirection: number[], innerRadius: number, outerRadius: number, planetRadius?: number): number[];
|
|
93169
|
+
/**
|
|
93170
|
+
* The primary step length before the long-ray refinement (`TraceVolumetricRay`).
|
|
93171
|
+
* @param shellLength - Metres of the ray inside the shell.
|
|
93172
|
+
* @param steps - Primary step count.
|
|
93173
|
+
* @param maximumStep - The largest step, metres (layer thickness / 8).
|
|
93174
|
+
* @returns The step length in metres.
|
|
93175
|
+
*/
|
|
93176
|
+
static StepSize(shellLength: number, steps: number, maximumStep: number): number;
|
|
93177
|
+
/**
|
|
93178
|
+
* The largest primary step (`_MaxStepSize`, layer thickness / 8), lengthened when a tier marches fewer steps than authored so
|
|
93179
|
+
* the march still reaches as far as Unity's, up to CLOUD_MAX_STEP_STRETCH times.
|
|
93180
|
+
* @param altitudeRange - Layer thickness, metres.
|
|
93181
|
+
* @param authoredSteps - The Volume's primary steps (missing gives no stretch).
|
|
93182
|
+
* @param tierSteps - The tier's primary steps.
|
|
93183
|
+
* @returns The largest step, metres.
|
|
93184
|
+
*/
|
|
93185
|
+
static MaximumStep(altitudeRange: number, authoredSteps: number, tierSteps: number): number;
|
|
93186
|
+
/**
|
|
93187
|
+
* The march settings of one tier (DR-6.4): every value is the authored one capped by the tier's CLOUD_TIER_CAPS row. Tier 0 caps
|
|
93188
|
+
* at the browser ceiling; tiers 1 and 2 lower the resolution, long-ray refinement and light steps but keep 64 primary steps.
|
|
93189
|
+
* @param tier - 0, 1 or 2 (clamped).
|
|
93190
|
+
* @param authored - The `urp.clouds` block.
|
|
93191
|
+
* @returns The settings.
|
|
93192
|
+
*/
|
|
93193
|
+
static TierSettings(tier: number, authored: TOOLKIT.IUrpCloudsBlock): TOOLKIT.ICloudTierSettings;
|
|
93194
|
+
/**
|
|
93195
|
+
* The tier clouds start at: 1 on a phone-width viewport or a GPU whose textures stop below 8192, otherwise 0.
|
|
93196
|
+
* @param maximumTextureSize - `engine.getCaps().maxTextureSize`.
|
|
93197
|
+
* @param viewportCssWidth - The canvas width in CSS pixels.
|
|
93198
|
+
* @returns The starting tier.
|
|
93199
|
+
*/
|
|
93200
|
+
static StartTier(maximumTextureSize: number, viewportCssWidth: number): number;
|
|
93201
|
+
/**
|
|
93202
|
+
* True when the camera moved far enough in one frame to be a cut, so the temporal history no longer matches.
|
|
93203
|
+
* @param previousPosition - Last frame's camera position, or null on the first frame.
|
|
93204
|
+
* @param currentPosition - This frame's camera position.
|
|
93205
|
+
* @returns True for a cut (or the first frame).
|
|
93206
|
+
*/
|
|
93207
|
+
static IsCameraCut(previousPosition: number[], currentPosition: number[]): boolean;
|
|
93208
|
+
/**
|
|
93209
|
+
* The 64 x 1 curve texture (`PrepareCustomLutData`): density in red (zero at both ends), erosion in green, one minus ambient
|
|
93210
|
+
* occlusion in blue, each clamped to 0..1. Missing curves give white, as the cloud feature does without a density curve.
|
|
93211
|
+
* @param density - 64 density samples over the layer height.
|
|
93212
|
+
* @param erosion - 64 erosion samples.
|
|
93213
|
+
* @param ambientOcclusion - 64 ambient occlusion samples.
|
|
93214
|
+
* @returns RGBA floats, 64 texels.
|
|
93215
|
+
*/
|
|
93216
|
+
static PackCurves(density: number[], erosion: number[], ambientOcclusion: number[]): Float32Array;
|
|
93217
|
+
/**
|
|
93218
|
+
* Both hits of a sphere centred on the planet (`IntersectSphere`), or a negative pair when the ray misses.
|
|
93219
|
+
* @param sphereRadius - Sphere radius, metres.
|
|
93220
|
+
* @param cosChi - Cosine between the ray and the up vector at the origin.
|
|
93221
|
+
* @param radialDistance - Distance of the origin from the planet centre, metres.
|
|
93222
|
+
* @returns `[near, far]` distances along the ray.
|
|
93223
|
+
*/
|
|
93224
|
+
private static IntersectSphere;
|
|
93225
|
+
}
|
|
93226
|
+
/**
|
|
93227
|
+
* unity-gaia-terrain-port T20 / T21 (DR-6.4, amended): decides the cloud tier from what a tier saves, not from the whole frame.
|
|
93228
|
+
* Frame times are averaged over windows of CLOUD_TIER_WINDOW_FRAMES frames. A second steady window over CLOUD_TIER_BUDGET_MS steps
|
|
93229
|
+
* down one tier on trial; if the next window is not at least CLOUD_TIER_MINIMUM_SAVING faster, the clouds were not what made the frame
|
|
93230
|
+
* slow, so the previous tier comes back and the tier stays there for the scene. A step that saves time stays, and a later slow
|
|
93231
|
+
* window may try the next tier. The tier never goes above the starting tier, and clouds are never switched off.
|
|
93232
|
+
*/
|
|
93233
|
+
class VolumetricCloudsTier {
|
|
93234
|
+
/** The tier now drawn. */
|
|
93235
|
+
tier: number;
|
|
93236
|
+
/** True once a trial step saved nothing: the tier no longer changes. */
|
|
93237
|
+
isSettled: boolean;
|
|
93238
|
+
private windowMilliseconds;
|
|
93239
|
+
private windowFrames;
|
|
93240
|
+
/** The mean frame time of the window before the step on trial, or 0 when no step is on trial. */
|
|
93241
|
+
private meanBeforeStep;
|
|
93242
|
+
/** The previous window's mean frame time, or 0 before the first window. */
|
|
93243
|
+
private previousMean;
|
|
93244
|
+
/**
|
|
93245
|
+
* Starts tracking at a tier.
|
|
93246
|
+
* @param startTier - The starting tier (VolumetricCloudsMath.StartTier).
|
|
93247
|
+
*/
|
|
93248
|
+
constructor(startTier: number);
|
|
93249
|
+
/**
|
|
93250
|
+
* Adds one frame.
|
|
93251
|
+
* @param frameMilliseconds - The frame's duration (engine.getDeltaTime()).
|
|
93252
|
+
* @returns True when this frame closed a window that changed the tier (a trial step down, or the restore of one).
|
|
93253
|
+
*/
|
|
93254
|
+
addFrame(frameMilliseconds: number): boolean;
|
|
93255
|
+
}
|
|
93256
|
+
/**
|
|
93257
|
+
* unity-gaia-terrain-port T19 / T20 (D16): the URP volumetric clouds (`urp.clouds`) drawn in the browser. One fragment pass marches
|
|
93258
|
+
* the clouds into a half-float target at the authored resolution scale, limited by the camera depth copy, and a full-screen mesh
|
|
93259
|
+
* composites them as the first transparent of the main rendering group, so water draws over the clouds and terrain hides them.
|
|
93260
|
+
* A temporal pass reprojects last frame's clouds and blends them in (`temporalaccumulationfactor`), and the march settings step
|
|
93261
|
+
* down a tier when frames run slow (DR-6.4).
|
|
93262
|
+
* One instance per scene, on `scene._tkVolumetricClouds`. Cloud shadows on the ground and the clouds' own ambient probe are not
|
|
93263
|
+
* carried (the export reports it).
|
|
93264
|
+
*/
|
|
93265
|
+
class VolumetricClouds {
|
|
93266
|
+
/** The composite mesh's name. */
|
|
93267
|
+
static readonly MeshName: string;
|
|
93268
|
+
/**
|
|
93269
|
+
* Creates the scene's clouds when the export carries a `urp.clouds` block and the engine can render half-float targets.
|
|
93270
|
+
* @param scene - The scene being loaded.
|
|
93271
|
+
* @param metadata - The scene metadata.
|
|
93272
|
+
* @param root - The scene's root url, which the noise urls are relative to.
|
|
93273
|
+
* @returns The clouds, or null when there are none to draw.
|
|
93274
|
+
*/
|
|
93275
|
+
static TryCreate(scene: BABYLON.Scene, metadata: unknown, root: string): TOOLKIT.VolumetricClouds;
|
|
93276
|
+
/**
|
|
93277
|
+
* The scene's clouds.
|
|
93278
|
+
* @param scene - The scene.
|
|
93279
|
+
* @returns The live clouds, or null.
|
|
93280
|
+
*/
|
|
93281
|
+
static Get(scene: BABYLON.Scene): TOOLKIT.VolumetricClouds;
|
|
93282
|
+
/** The scene the clouds draw in. */
|
|
93283
|
+
readonly scene: BABYLON.Scene;
|
|
93284
|
+
/** The exported `urp.clouds` block. */
|
|
93285
|
+
readonly block: TOOLKIT.IUrpCloudsBlock;
|
|
93286
|
+
/** True once disposed. */
|
|
93287
|
+
disposed: boolean;
|
|
93288
|
+
/** The tier now drawn (DR-6.4). */
|
|
93289
|
+
tier: number;
|
|
93290
|
+
private readonly sky;
|
|
93291
|
+
private readonly root;
|
|
93292
|
+
private readonly isLocal;
|
|
93293
|
+
/** True when the live sky draws aerial perspective, so the march hazes the clouds at their distance (`CLOUD_AERIAL`). */
|
|
93294
|
+
private hasAerial;
|
|
93295
|
+
/** Bound to `apLut` until the sky's aerial perspective exists (a 1 x 1 x 1 black layer). */
|
|
93296
|
+
private placeholderAerial;
|
|
93297
|
+
private readonly planetRadius;
|
|
93298
|
+
private readonly planetCenter;
|
|
93299
|
+
private readonly scatteringTint;
|
|
93300
|
+
private settings;
|
|
93301
|
+
private worleyTexture;
|
|
93302
|
+
private erosionTexture;
|
|
93303
|
+
private curveTexture;
|
|
93304
|
+
private placeholderDepth;
|
|
93305
|
+
private marchTarget;
|
|
93306
|
+
private renderer;
|
|
93307
|
+
private marchPass;
|
|
93308
|
+
private temporalPass;
|
|
93309
|
+
/** Ping-pong history at cloud resolution: the temporal pass reads one and writes the other. */
|
|
93310
|
+
private readonly historyTargets;
|
|
93311
|
+
private historyIndex;
|
|
93312
|
+
private hasHistory;
|
|
93313
|
+
private compositeMesh;
|
|
93314
|
+
private compositeMaterial;
|
|
93315
|
+
private isReady;
|
|
93316
|
+
private isPending;
|
|
93317
|
+
private preExposure;
|
|
93318
|
+
private preExposureBinding;
|
|
93319
|
+
private frameSeed;
|
|
93320
|
+
private readonly windOffset;
|
|
93321
|
+
private verticalShapeOffset;
|
|
93322
|
+
private verticalErosionOffset;
|
|
93323
|
+
private sceneDepth;
|
|
93324
|
+
private beforeRenderObserver;
|
|
93325
|
+
private afterRenderObserver;
|
|
93326
|
+
private tierTracker;
|
|
93327
|
+
private targetWidth;
|
|
93328
|
+
private targetHeight;
|
|
93329
|
+
private lastCamera;
|
|
93330
|
+
private sunLight;
|
|
93331
|
+
private ambientSource;
|
|
93332
|
+
private ambientCaptureCount;
|
|
93333
|
+
private readonly previousEye;
|
|
93334
|
+
private readonly currentEye;
|
|
93335
|
+
private hasPreviousEye;
|
|
93336
|
+
private beforeTargetsObserver;
|
|
93337
|
+
private afterTargetsObserver;
|
|
93338
|
+
private disposeObserver;
|
|
93339
|
+
private readonly mirror;
|
|
93340
|
+
private readonly inverseViewProjection;
|
|
93341
|
+
/** Last frame's view-projection (Babylon space), for the temporal reprojection. */
|
|
93342
|
+
private readonly previousViewProjection;
|
|
93343
|
+
/** Last frame's view-projection taking Unity-space points, bound to the temporal pass. */
|
|
93344
|
+
private readonly previousViewProjectionUnity;
|
|
93345
|
+
private readonly sunDirection;
|
|
93346
|
+
private readonly cameraForward;
|
|
93347
|
+
/** The camera's local forward axis: +Z, or -Z in a right-handed scene. */
|
|
93348
|
+
private readonly localForward;
|
|
93349
|
+
private readonly ambientTop;
|
|
93350
|
+
private readonly ambientBottom;
|
|
93351
|
+
/**
|
|
93352
|
+
* Builds the passes and starts loading the noise. The scene's loading is held until both noise volumes are uploaded and every
|
|
93353
|
+
* shader compiled, so the first frame has clouds and no compile follows the reveal.
|
|
93354
|
+
* @param scene - The scene.
|
|
93355
|
+
* @param block - The `urp.clouds` block.
|
|
93356
|
+
* @param sky - The `urp.sky` block (planet), or null.
|
|
93357
|
+
* @param root - The scene's root url.
|
|
93358
|
+
*/
|
|
93359
|
+
private constructor();
|
|
93360
|
+
/** Releases every target, texture, mesh and observer, and the scene's loading if it is still held. */
|
|
93361
|
+
dispose(): void;
|
|
93362
|
+
/** Creates the curve texture, the march target and pass, and the composite mesh. */
|
|
93363
|
+
private createPasses;
|
|
93364
|
+
/**
|
|
93365
|
+
* One half-float RGBA target at cloud resolution, sampled bilinearly and clamped.
|
|
93366
|
+
* @param name - Target name.
|
|
93367
|
+
* @param textureType - Half float, or float where half-float targets cannot render.
|
|
93368
|
+
* @returns The target.
|
|
93369
|
+
*/
|
|
93370
|
+
private createCloudTarget;
|
|
93371
|
+
/**
|
|
93372
|
+
* The 64 x 1 half-float curve texture (density, erosion, ambient occlusion), sampled with a repeating bilinear sampler as
|
|
93373
|
+
* Unity's `s_linear_repeat_sampler` does.
|
|
93374
|
+
* @returns The texture.
|
|
93375
|
+
*/
|
|
93376
|
+
private createCurveTexture;
|
|
93377
|
+
/**
|
|
93378
|
+
* The composite: a clip-space quad drawn as the first transparent of the default rendering group, blending
|
|
93379
|
+
* `scene x transmittance + scattering`. It is hidden while render targets (probes, reflections) draw.
|
|
93380
|
+
* @param language - The shader language of the engine.
|
|
93381
|
+
*/
|
|
93382
|
+
private createCompositeMesh;
|
|
93383
|
+
/**
|
|
93384
|
+
* Loads both noise sidecars into wrapping single-channel 3D textures.
|
|
93385
|
+
* @returns True when both loaded. On a failure one warning prints and the clouds do not draw (the sky still does).
|
|
93386
|
+
*/
|
|
93387
|
+
private loadNoise;
|
|
93388
|
+
/**
|
|
93389
|
+
* One noise volume: `size³` bytes, x fastest, then y, then slice, as CloudExportMath.FlipbookToVolume wrote them.
|
|
93390
|
+
* @param name - Texture name.
|
|
93391
|
+
* @param buffer - The sidecar bytes.
|
|
93392
|
+
* @param size - Volume edge in texels.
|
|
93393
|
+
* @returns The texture, or null (with one warning) when the file has the wrong length.
|
|
93394
|
+
*/
|
|
93395
|
+
private createNoiseTexture;
|
|
93396
|
+
/** Polls until the noise is uploaded and every shader compiled, then starts drawing and releases the scene's loading. */
|
|
93397
|
+
private waitUntilReady;
|
|
93398
|
+
/** Lets the scene finish loading (once). */
|
|
93399
|
+
private releasePending;
|
|
93400
|
+
/**
|
|
93401
|
+
* Advances the wind, sizes the targets, marches the clouds and blends in the reprojected history. The composite then reads
|
|
93402
|
+
* the new history (or the march itself when the accumulation factor is off, as Unity's `denoiseClouds`).
|
|
93403
|
+
*/
|
|
93404
|
+
private render;
|
|
93405
|
+
/**
|
|
93406
|
+
* True when the colour buffer holds display-encoded values: a non-parity scene whose image processing runs in the materials
|
|
93407
|
+
* (the sky encodes for display and the fog pass decodes the same way, HdrpPhysicallyBasedSky.encodesForDisplay).
|
|
93408
|
+
* @returns True to encode the composite.
|
|
93409
|
+
*/
|
|
93410
|
+
private isDisplayEncoded;
|
|
93411
|
+
/**
|
|
93412
|
+
* Resets the temporal history on the first frame, a camera switch or a cut (a move above CLOUD_CAMERA_CUT_METERS in one frame).
|
|
93413
|
+
* @param camera - The active camera.
|
|
93414
|
+
*/
|
|
93415
|
+
private trackCamera;
|
|
93416
|
+
/**
|
|
93417
|
+
* DR-6.4: one frame into the tier window; a slow window steps the clouds down one tier, resizes the targets once and reports it.
|
|
93418
|
+
*/
|
|
93419
|
+
private updateTier;
|
|
93420
|
+
/** Reports once each authored value the starting tier lowers (tier 0 holds the browser ceiling). */
|
|
93421
|
+
private reportLoweredSettings;
|
|
93422
|
+
/**
|
|
93423
|
+
* Accumulates the wind offsets like VolumetricCloudsURP: kilometres per hour along the global orientation, wrapped.
|
|
93424
|
+
* @param deltaSeconds - Seconds since the last frame.
|
|
93425
|
+
*/
|
|
93426
|
+
private advanceWind;
|
|
93427
|
+
/** Resizes the cloud targets (once) when the render size or the tier's resolution scale changed; the history restarts. */
|
|
93428
|
+
private resizeTargets;
|
|
93429
|
+
/**
|
|
93430
|
+
* Sets the cloud target size: the render size times the tier's resolution scale, at least 1 pixel.
|
|
93431
|
+
* @returns True when the size changed.
|
|
93432
|
+
*/
|
|
93433
|
+
private updateTargetSize;
|
|
93434
|
+
/**
|
|
93435
|
+
* Binds the march uniforms. Each vec4 packs (VolumetricCloudsURP.UpdateMaterialProperties):
|
|
93436
|
+
* cloudEye = camera position · cloudForward = (camera forward, x mirror sign) · cloudCamera = (far plane, depth copy bound, frame seed,
|
|
93437
|
+
* pre-exposure) · cloudPlanet = (planet centre, radius) · cloudLayer = (bottom radius, top radius, largest step, primary steps)
|
|
93438
|
+
* · cloudSteps = (long ray multiplier, light steps, fade start, fade distance) · cloudShape = (shape scale, shape factor,
|
|
93439
|
+
* erosion scale, erosion factor) · cloudDetail = (erosion occlusion, micro erosion scale, micro erosion factor, density)
|
|
93440
|
+
* · cloudShapeOffset = (offset x, offset z, offset y, altitude distortion) · cloudWind = (wind direction, wind offset)
|
|
93441
|
+
* · cloudWindSpeed = (shape speed, erosion speed, vertical shape offset, vertical erosion offset) · cloudCoverage = (variation,
|
|
93442
|
+
* inverse pattern size, gap amount) · cloudScattering = (multi scattering, powder) · cloudTint · cloudSunDirection (toward the
|
|
93443
|
+
* sun) · cloudSunColor · cloudAmbientTop / Bottom. Positions and directions are mirrored into Unity's space.
|
|
93444
|
+
* @param effect - The march effect.
|
|
93445
|
+
*/
|
|
93446
|
+
private bindMarch;
|
|
93447
|
+
/**
|
|
93448
|
+
* The sun and ambient terms: the first interacting directional light's colour (already attenuated by the sky) times its
|
|
93449
|
+
* intensity, the sky's sun scale and the sun dimmer, and the sky's ambient probe evaluated up and down times the probe dimmer.
|
|
93450
|
+
* @param effect - The march effect.
|
|
93451
|
+
* @param mirrorX - -1 in a right-handed scene, else 1.
|
|
93452
|
+
*/
|
|
93453
|
+
private bindLighting;
|
|
93454
|
+
/**
|
|
93455
|
+
* Binds the live sky's aerial perspective (its froxel LUT, camera and atmosphere uniforms) for the haze at cloud distance.
|
|
93456
|
+
* Until the sky has built the LUT (its first frames) the placeholder is bound and the haze is skipped.
|
|
93457
|
+
* @param effect - The march effect.
|
|
93458
|
+
*/
|
|
93459
|
+
private bindAerial;
|
|
93460
|
+
/**
|
|
93461
|
+
* The sun: the first interacting directional light, looked up again only when the cached one is gone or switched off. Its
|
|
93462
|
+
* world direction (parent rotation applied) is written to `sunDirection` without allocating.
|
|
93463
|
+
* @returns The sun, or null when the scene has no enabled directional light.
|
|
93464
|
+
*/
|
|
93465
|
+
private resolveSun;
|
|
93466
|
+
/**
|
|
93467
|
+
* Re-evaluates the ambient up and down only when its source changed (the live sky captured again, or a new environment), so
|
|
93468
|
+
* the per-frame bind does not allocate: the live sky's ambient probe, else the environment's polynomial, else the scene's
|
|
93469
|
+
* ambient colour.
|
|
93470
|
+
*/
|
|
93471
|
+
private refreshAmbient;
|
|
93472
|
+
/**
|
|
93473
|
+
* Binds the temporal pass: this frame's march, last frame's history and view-projection (into Unity's space), and
|
|
93474
|
+
* `cloudCamera` = (far plane, depth copy bound, history valid, accumulation factor).
|
|
93475
|
+
* @param effect - The temporal effect.
|
|
93476
|
+
*/
|
|
93477
|
+
private bindTemporal;
|
|
93478
|
+
/**
|
|
93479
|
+
* Unity hands the shader `white - tint x 0.75` through Material.SetColor, which linearises it.
|
|
93480
|
+
* @param tint - The authored scattering tint (sRGB components).
|
|
93481
|
+
* @returns The linear extinction tint.
|
|
93482
|
+
*/
|
|
93483
|
+
private static LinearScatteringTint;
|
|
93484
|
+
/**
|
|
93485
|
+
* The canvas width in CSS pixels (the render width when there is no canvas).
|
|
93486
|
+
* @param scene - The scene.
|
|
93487
|
+
* @returns The width.
|
|
93488
|
+
*/
|
|
93489
|
+
private static CanvasCssWidth;
|
|
93490
|
+
}
|
|
93491
|
+
}
|
|
93492
|
+
declare namespace TOOLKIT {
|
|
93493
|
+
/**
|
|
93494
|
+
* unity-gaia-terrain-port T19 (D16): the GLSL and WGSL sources of the volumetric clouds - a line-for-line fragment port of the
|
|
93495
|
+
* cloud march (`TraceVolumetricRay`, `EvaluateCloudProperties`, the two-octave light march `EvaluateSunTransmittance`) and of the
|
|
93496
|
+
* combine pass. Every shader is registered in `ShaderStore` (GLSL) and `ShaderStoreWGSL` (WGSL) as twins.
|
|
93497
|
+
* No `;` inside `//` comments of a shader string, no sampler function parameters, WGSL samplers at module scope.
|
|
93498
|
+
* Defines: `CLOUD_LOCAL` (the camera flies through the layer, Unity's `_LOCAL_VOLUMETRIC_CLOUDS`), `CLOUD_MICRO_EROSION`, and
|
|
93499
|
+
* `CLOUD_AERIAL`: the sky's aerial perspective at the mean cloud distance, as Unity's clouds combine pass with
|
|
93500
|
+
* `PHYSICALLY_BASED_SKY` (VolumetricClouds.shader, `EvaluateAtmosphericScattering` at cloud depth). It reuses the fog pass's
|
|
93501
|
+
* shared function (HdrpFogPass.AerialPerspectiveGlsl / Wgsl), so clouds take the in-scatter and extinction terrain takes at
|
|
93502
|
+
* the same distance.
|
|
93503
|
+
*/
|
|
93504
|
+
class VolumetricCloudsShaders {
|
|
93505
|
+
/** The march pass: scattering in rgb, transmittance in alpha, one fragment per cloud-target pixel. */
|
|
93506
|
+
static readonly MarchName: string;
|
|
93507
|
+
/** The full-screen composite drawn as the first transparent. */
|
|
93508
|
+
static readonly CompositeName: string;
|
|
93509
|
+
/** The temporal pass: reprojects last frame's clouds and blends them in (pass 3, Temporal Denoising). */
|
|
93510
|
+
static readonly TemporalName: string;
|
|
93511
|
+
/** Every vec4 / mat4 uniform of the temporal pass. */
|
|
93512
|
+
static readonly TemporalUniforms: string[];
|
|
93513
|
+
/** The samplers of the temporal pass. */
|
|
93514
|
+
static readonly TemporalSamplers: string[];
|
|
93515
|
+
/** Every vec4 / mat4 uniform of the march pass, in declaration order. */
|
|
93516
|
+
static readonly MarchUniforms: string[];
|
|
93517
|
+
/** The samplers of the march pass. */
|
|
93518
|
+
static readonly MarchSamplers: string[];
|
|
93519
|
+
/** The extra sampler of the march when `CLOUD_AERIAL` is on: the live sky's aerial perspective froxels. */
|
|
93520
|
+
static readonly AerialSampler: string;
|
|
93521
|
+
/** The extra uniform of the march when `CLOUD_AERIAL` is on: (camera - planet centre, 1 when the LUT is bound). */
|
|
93522
|
+
static readonly AerialCameraUniform: string;
|
|
93523
|
+
private static registered;
|
|
93524
|
+
/** Registers every cloud shader once (GLSL in ShadersStore, WGSL in ShadersStoreWGSL). */
|
|
93525
|
+
static Register(): void;
|
|
93526
|
+
/**
|
|
93527
|
+
* Every source, GLSL then WGSL (tests scan them for `;` inside `//` comments).
|
|
93528
|
+
* @returns The shader strings.
|
|
93529
|
+
*/
|
|
93530
|
+
static AllSources(): string[];
|
|
93531
|
+
/** The march pass uniforms. The packing of each vec4 is documented on `VolumetricClouds.bindMarch`. */
|
|
93532
|
+
private static GlslMarchUniforms;
|
|
93533
|
+
/** Constants of VolumetricCloudsUtilities.hlsl. */
|
|
93534
|
+
private static GlslConstants;
|
|
93535
|
+
/** Ray and shell geometry: sphere intersections in planet space (`cloudPlanet.xyz` is the planet centre, `.w` its radius). */
|
|
93536
|
+
private static GlslGeometry;
|
|
93537
|
+
/** Cloud density: coverage pattern, shape and erosion noise, the curve texture (`EvaluateCloudProperties`). */
|
|
93538
|
+
private static GlslDensity;
|
|
93539
|
+
/** Lighting: phase function, powder effect and the light march toward the sun (`EvaluateSunTransmittance`, `EvaluateCloud`). */
|
|
93540
|
+
private static GlslLighting;
|
|
93541
|
+
/** The aerial perspective declarations and functions of the march (only under `CLOUD_AERIAL`). */
|
|
93542
|
+
private static GlslAerial;
|
|
93543
|
+
/** The march pass (`frag` of pass 0 and `TraceVolumetricRay`). */
|
|
93544
|
+
private static GlslMarch;
|
|
93545
|
+
/** A clip-space quad: positions are already in clip space, the uv follows them. */
|
|
93546
|
+
private static GlslCompositeVertex;
|
|
93547
|
+
/**
|
|
93548
|
+
* Pass 1 (Combine): blending gives scene x transmittance + scattering (premultiplied, alpha = 1 - transmittance). When the
|
|
93549
|
+
* colour buffer holds display-encoded values (`cloudDisplayEncoded` = 1: a non-parity scene whose image processing runs in
|
|
93550
|
+
* the materials, as the sky and fog pass assume), the wanted `encode(L x T + S)` is not linear in the encoded scene `d`,
|
|
93551
|
+
* so the blend uses the straight line through its two ends: `encode(S)` at d = 0 and `encode(T + S)` at d = 1, that is
|
|
93552
|
+
* `encode(S) + d x (encode(T + S) - encode(S))` (the slope from the scattering's luminance). It is exact where the cloud
|
|
93553
|
+
* is clear or opaque and within a few hundredths over a bright sky, where a plain `T^(1/gamma)` overshoots cloud edges.
|
|
93554
|
+
*/
|
|
93555
|
+
private static GlslCompositeFragment;
|
|
93556
|
+
/**
|
|
93557
|
+
* Pass 3 (Temporal Denoising): the history is reprojected with last frame's view-projection at the distance where the ray
|
|
93558
|
+
* enters the cloud layer (or the scene depth, when nearer), clamped to the current colour's 5-tap box and blended in by
|
|
93559
|
+
* the accumulation factor, faded by the reprojection velocity. Transmittance stays the current frame's, as in Unity.
|
|
93560
|
+
* `cloudCamera` = (far plane, depth copy bound, history valid, accumulation factor), `cloudTexel` = (1 / width, 1 / height).
|
|
93561
|
+
*/
|
|
93562
|
+
private static GlslTemporal;
|
|
93563
|
+
/** The march pass uniforms (WGSL twin of GlslMarchUniforms). */
|
|
93564
|
+
private static WgslMarchUniforms;
|
|
93565
|
+
private static WgslConstants;
|
|
93566
|
+
private static WgslGeometry;
|
|
93567
|
+
private static WgslDensity;
|
|
93568
|
+
private static WgslLighting;
|
|
93569
|
+
/** WGSL twin of GlslAerial. */
|
|
93570
|
+
private static WgslAerial;
|
|
93571
|
+
private static WgslMarch;
|
|
93572
|
+
private static WgslCompositeVertex;
|
|
93573
|
+
private static WgslCompositeFragment;
|
|
93574
|
+
private static WgslTemporal;
|
|
93575
|
+
}
|
|
93576
|
+
}
|
|
93299
93577
|
/** Babylon Toolkit Namespace */
|
|
93300
93578
|
declare namespace TOOLKIT {
|
|
93301
93579
|
/**
|