@crystaldesign/real-time-viewer-next 26.13.0-beta.2 → 26.13.0-beta.21
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/build/esm/{DeckCutoutSubsystem-6453a4f4.js → DeckCutoutSubsystem-8b702df0.js} +208 -11
- package/build/esm/{SunLensflare-46fa6ee8.js → SunLensflare-0676ae6e.js} +1 -1
- package/build/esm/{WaterSurface-10a28566.js → WaterSurface-f3e878b1.js} +4 -3
- package/build/esm/{index-428fd8ca.js → index-6f58b1ed.js} +219 -49
- package/build/esm/index.js +1 -1
- package/build/types/real-time-viewer-next/src/config/environment.config.d.ts +1 -0
- package/build/types/real-time-viewer-next/src/config/environment.config.d.ts.map +1 -1
- package/build/types/real-time-viewer-next/src/core/ArticleSettleTracker.d.ts +12 -0
- package/build/types/real-time-viewer-next/src/core/ArticleSettleTracker.d.ts.map +1 -0
- package/build/types/real-time-viewer-next/src/core/SceneRenderer.d.ts.map +1 -1
- package/build/types/real-time-viewer-next/src/core/camera/CameraController.d.ts.map +1 -1
- package/build/types/real-time-viewer-next/src/core/camera/useCameraActions.d.ts +2 -1
- package/build/types/real-time-viewer-next/src/core/camera/useCameraActions.d.ts.map +1 -1
- package/build/types/real-time-viewer-next/src/core/camera/useCameraConstraints.d.ts.map +1 -1
- package/build/types/real-time-viewer-next/src/core/dimension-lines/DimensionLines3D.d.ts.map +1 -1
- package/build/types/real-time-viewer-next/src/core/environment/deckCutout/DeckCutoutArticleSync.d.ts.map +1 -1
- package/build/types/real-time-viewer-next/src/core/environment/deckCutout/articleFootprint.d.ts.map +1 -1
- package/build/types/real-time-viewer-next/src/core/environment/deckCutout/measureArticle.d.ts +16 -0
- package/build/types/real-time-viewer-next/src/core/environment/deckCutout/measureArticle.d.ts.map +1 -1
- package/build/types/real-time-viewer-next/src/core/environment/deckCutout/measureDiagnostics.d.ts.map +1 -1
- package/build/types/real-time-viewer-next/src/core/environment/scene.config.d.ts +21 -0
- package/build/types/real-time-viewer-next/src/core/environment/scene.config.d.ts.map +1 -1
- package/build/types/real-time-viewer-next/src/core/shadows/useShadowDirty.d.ts.map +1 -1
- package/build/types/real-time-viewer-next/src/core/water/WaterSurfaceRenderer.d.ts.map +1 -1
- package/build/types/real-time-viewer-next/src/presets/villa-cliff.d.ts.map +1 -1
- package/build/types/real-time-viewer-next/src/store/slices/camera.d.ts +6 -1
- package/build/types/real-time-viewer-next/src/store/slices/camera.d.ts.map +1 -1
- package/build/types/real-time-viewer-next/src/store/slices/selection.d.ts +5 -2
- package/build/types/real-time-viewer-next/src/store/slices/selection.d.ts.map +1 -1
- package/build/types/real-time-viewer-next/src/store/slices/versions.d.ts +9 -0
- package/build/types/real-time-viewer-next/src/store/slices/versions.d.ts.map +1 -1
- package/build/types/real-time-viewer-next/src/types/camera.d.ts +9 -6
- package/build/types/real-time-viewer-next/src/types/camera.d.ts.map +1 -1
- package/build/types/real-time-viewer-next/src/utils/cameraFraming.d.ts +7 -0
- package/build/types/real-time-viewer-next/src/utils/cameraFraming.d.ts.map +1 -1
- package/build/types/real-time-viewer-next/src/utils/cameraFraming.test.d.ts +2 -0
- package/build/types/real-time-viewer-next/src/utils/cameraFraming.test.d.ts.map +1 -0
- package/build/types/real-time-viewer-next/src/utils/geoTargets.d.ts +30 -0
- package/build/types/real-time-viewer-next/src/utils/geoTargets.d.ts.map +1 -0
- package/build/umd/463.real-time-viewer-next.umd.min.js +1 -1
- package/build/umd/99.real-time-viewer-next.umd.min.js +2 -0
- package/build/umd/99.real-time-viewer-next.umd.min.js.LICENSE.txt +1 -0
- package/build/umd/real-time-viewer-next.umd.min.js +1 -1
- package/build/umd/report.html +1 -1
- package/package.json +6 -2
- package/build/umd/673.real-time-viewer-next.umd.min.js +0 -2
- package/build/umd/673.real-time-viewer-next.umd.min.js.LICENSE.txt +0 -1
package/build/types/real-time-viewer-next/src/core/environment/deckCutout/measureArticle.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Matrix4, type Object3D } from 'three';
|
|
2
|
+
import type { GeoAsset } from '../../../parser/parseRenderScript';
|
|
2
3
|
import type { ElementOverlayInfo } from '../../../types/plannerUi';
|
|
3
4
|
/** Article bounds in the deck mesh's local frame. */
|
|
4
5
|
export interface ArticleRect {
|
|
@@ -28,6 +29,13 @@ export interface ArticleMeasurement {
|
|
|
28
29
|
floorLocal: Matrix4;
|
|
29
30
|
/** Deck top in floor-local Y. */
|
|
30
31
|
floorTopY: number;
|
|
32
|
+
/**
|
|
33
|
+
* Nodes whose meshes shape the cutout outline — only set by {@link restrictToGeos}; otherwise the
|
|
34
|
+
* top-level elements do.
|
|
35
|
+
*/
|
|
36
|
+
shapeNodes?: Object3D[];
|
|
37
|
+
/** Diagnostic: which geos the measurement was restricted to. Unset for the whole article. */
|
|
38
|
+
geoScope?: string;
|
|
31
39
|
}
|
|
32
40
|
/** Top-level planner element groups (no `Element#` ancestor) — the ones the anchor moves and the projection walks. */
|
|
33
41
|
export declare function topLevelElements(elementObjects: Object3D[]): Object3D[];
|
|
@@ -46,4 +54,12 @@ export declare function shiftRect(rect: ArticleRect, delta: {
|
|
|
46
54
|
* Returns null while the article or the deck isn't in the scene yet.
|
|
47
55
|
*/
|
|
48
56
|
export declare function measureArticle(scene: Object3D, patterns: string[], elementsInfo: ReadonlyMap<string, ElementOverlayInfo>): ArticleMeasurement | null;
|
|
57
|
+
/**
|
|
58
|
+
* The measurement narrowed to the article's geos whose catalog name starts with one of the
|
|
59
|
+
* comma-separated `geoPrefix`es: the rect, the bottom and the traced outline then describe only those
|
|
60
|
+
* parts — the basin, not the stairs or cover that come with the same article. The elements still move
|
|
61
|
+
* as a whole; only what is measured changes. Falls back to the whole article, with a note in
|
|
62
|
+
* `geoScope`, when no geo matches.
|
|
63
|
+
*/
|
|
64
|
+
export declare function restrictToGeos(measurement: ArticleMeasurement, geoPrefix: string, geoAssets: readonly GeoAsset[]): ArticleMeasurement;
|
|
49
65
|
//# sourceMappingURL=measureArticle.d.ts.map
|
package/build/types/real-time-viewer-next/src/core/environment/deckCutout/measureArticle.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"measureArticle.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/environment/deckCutout/measureArticle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,OAAO,EAAa,KAAK,QAAQ,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"measureArticle.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/environment/deckCutout/measureArticle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,OAAO,EAAa,KAAK,QAAQ,EAAE,MAAM,OAAO,CAAC;AAGhE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAClE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAOnE,qDAAqD;AACrD,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,kFAAkF;AAClF,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,WAAW,CAAC;IAClB,uGAAuG;IACvG,YAAY,EAAE,MAAM,CAAC;IACrB,uEAAuE;IACvE,cAAc,EAAE,QAAQ,EAAE,CAAC;IAC3B,kEAAkE;IAClE,aAAa,EAAE,gBAAgB,EAAE,CAAC;IAClC,sFAAsF;IACtF,UAAU,EAAE,OAAO,CAAC;IACpB,0BAA0B;IAC1B,UAAU,EAAE,OAAO,CAAC;IACpB,iCAAiC;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,UAAU,CAAC,EAAE,QAAQ,EAAE,CAAC;IACxB,6FAA6F;IAC7F,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,sHAAsH;AACtH,wBAAgB,gBAAgB,CAAC,cAAc,EAAE,QAAQ,EAAE,GAAG,QAAQ,EAAE,CAOvE;AAED,8CAA8C;AAC9C,wBAAgB,SAAS,CAAC,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,GAAG,WAAW,CASvG;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,QAAQ,EACf,QAAQ,EAAE,MAAM,EAAE,EAClB,YAAY,EAAE,WAAW,CAAC,MAAM,EAAE,kBAAkB,CAAC,GACpD,kBAAkB,GAAG,IAAI,CAyD3B;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,WAAW,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,QAAQ,EAAE,GAAG,kBAAkB,CAyCrI"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"measureDiagnostics.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/environment/deckCutout/measureDiagnostics.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,6BAA6B,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACxG,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAE3D,MAAM,WAAW,eAAe;IAC9B,WAAW,EAAE,kBAAkB,CAAC;IAChC,IAAI,EAAE,6BAA6B,GAAG,IAAI,CAAC;IAC3C,YAAY,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,SAAS,EAAE,gBAAgB,CAAC;IAC5B,IAAI,EAAE,sBAAsB,CAAC;CAC9B;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,YAAY,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,eAAe,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,MAAM,CAAA;CAAE,
|
|
1
|
+
{"version":3,"file":"measureDiagnostics.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/environment/deckCutout/measureDiagnostics.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,6BAA6B,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACxG,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAE3D,MAAM,WAAW,eAAe;IAC9B,WAAW,EAAE,kBAAkB,CAAC;IAChC,IAAI,EAAE,6BAA6B,GAAG,IAAI,CAAC;IAC3C,YAAY,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,SAAS,EAAE,gBAAgB,CAAC;IAC5B,IAAI,EAAE,sBAAsB,CAAC;CAC9B;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,YAAY,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,eAAe,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,MAAM,CAAA;CAAE,CA6DxI"}
|
|
@@ -31,6 +31,13 @@ declare const DECK_CUTOUT_ARTICLE_RULE_CONFIG: import("../../config/descriptor")
|
|
|
31
31
|
* sunk basin body.
|
|
32
32
|
*/
|
|
33
33
|
footprintSliceDepth: import("../../config/descriptor").NumberField;
|
|
34
|
+
/**
|
|
35
|
+
* Shape the cutout from these geos only: comma-separated catalog geo-name prefixes (`GEO_Pool`
|
|
36
|
+
* matches `GEO_Pool`, `GEO_Pool_Rim`, …). The traced outline, the rim that places the article and
|
|
37
|
+
* sizes the water, and the fallback rect then describe the basin alone, not the stairs or cover the
|
|
38
|
+
* same article ships with. '' = the whole article; a prefix matching no geo falls back to it.
|
|
39
|
+
*/
|
|
40
|
+
geoPrefix: import("../../config/descriptor").ValueField<string>;
|
|
34
41
|
}>;
|
|
35
42
|
/**
|
|
36
43
|
* Textures + world-planar tiling for a collar that carries its own material. All maps are
|
|
@@ -197,6 +204,13 @@ declare const DECK_CUTOUT_CONFIG: import("../../config/descriptor").GroupDescrip
|
|
|
197
204
|
* sunk basin body.
|
|
198
205
|
*/
|
|
199
206
|
footprintSliceDepth: import("../../config/descriptor").NumberField;
|
|
207
|
+
/**
|
|
208
|
+
* Shape the cutout from these geos only: comma-separated catalog geo-name prefixes (`GEO_Pool`
|
|
209
|
+
* matches `GEO_Pool`, `GEO_Pool_Rim`, …). The traced outline, the rim that places the article and
|
|
210
|
+
* sizes the water, and the fallback rect then describe the basin alone, not the stairs or cover the
|
|
211
|
+
* same article ships with. '' = the whole article; a prefix matching no geo falls back to it.
|
|
212
|
+
*/
|
|
213
|
+
geoPrefix: import("../../config/descriptor").ValueField<string>;
|
|
200
214
|
}>>;
|
|
201
215
|
/**
|
|
202
216
|
* Look of the generated collar ring that bridges a footprint rule's shaped outline to the
|
|
@@ -370,6 +384,13 @@ export declare const SCENE_CONFIG: import("../../config/descriptor").GroupDescri
|
|
|
370
384
|
* sunk basin body.
|
|
371
385
|
*/
|
|
372
386
|
footprintSliceDepth: import("../../config/descriptor").NumberField;
|
|
387
|
+
/**
|
|
388
|
+
* Shape the cutout from these geos only: comma-separated catalog geo-name prefixes (`GEO_Pool`
|
|
389
|
+
* matches `GEO_Pool`, `GEO_Pool_Rim`, …). The traced outline, the rim that places the article and
|
|
390
|
+
* sizes the water, and the fallback rect then describe the basin alone, not the stairs or cover the
|
|
391
|
+
* same article ships with. '' = the whole article; a prefix matching no geo falls back to it.
|
|
392
|
+
*/
|
|
393
|
+
geoPrefix: import("../../config/descriptor").ValueField<string>;
|
|
373
394
|
}>>;
|
|
374
395
|
/**
|
|
375
396
|
* Look of the generated collar ring that bridges a footprint rule's shaped outline to the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scene.config.d.ts","sourceRoot":"","sources":["../../../../../../src/core/environment/scene.config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,KAAK,WAAW,EAAE,KAAK,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAEvF,QAAA,MAAM,mBAAmB,mCAAoC,CAAC;AAE9D;;;GAGG;AACH,QAAA,MAAM,uBAAuB;;;;;EAK3B,CAAC;AAEH;;;;;;GAMG;AACH,QAAA,MAAM,+BAA+B;IACnC,uEAAuE;;IAEvE;;;;OAIG;;IAEH;;;OAGG;;EAEH,CAAC;AAEH;;;GAGG;AACH,QAAA,MAAM,kCAAkC;IACtC,gFAAgF;;;;IAIhF,sEAAsE;;IAEtE,6FAA6F;;IAE7F,gFAAgF;;;EAGhF,CAAC;AAEH;;;GAGG;AACH,QAAA,MAAM,yBAAyB;IAC7B;;;;OAIG;;IAEH;;;;;OAKG;;IAEH,6FAA6F;;IAE7F,+FAA+F;;IAE/F,iCAAiC;;IAEjC;;;;;;;;;OASG;;QA9CH,gFAAgF;;;;QAIhF,sEAAsE;;QAEtE,6FAA6F;;QAE7F,gFAAgF;;;;EAwChF,CAAC;AAEH;;;;;;GAMG;AACH,QAAA,MAAM,kBAAkB;;IAEtB;;;;;OAKG;;IAKH;;;;;;OAMG;;;;;;;IAEH;;;;OAIG;;;;;IAcH;;;;;OAKG;;;;;QAoBD;;;;WAIG;;QAKH;;;WAGG;;QAQH;;;;;;WAMG;;;;IAUL;;;;OAIG;;;;;;;IAsBH;;;;;OAKG;;
|
|
1
|
+
{"version":3,"file":"scene.config.d.ts","sourceRoot":"","sources":["../../../../../../src/core/environment/scene.config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,KAAK,WAAW,EAAE,KAAK,c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AAG,WAAW,CAAC,OAAO,kCAAkC,CAAC,CAAC;AACpG,MAAM,MAAM,gCAAgC,GAAG,cAAc,CAAC,OAAO,kCAAkC,CAAC,CAAC;AACzG,0EAA0E;AAC1E,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useShadowDirty.d.ts","sourceRoot":"","sources":["../../../../../../src/core/shadows/useShadowDirty.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;GAWG;AACH,wBAAgB,cAAc,IAAI,IAAI,
|
|
1
|
+
{"version":3,"file":"useShadowDirty.d.ts","sourceRoot":"","sources":["../../../../../../src/core/shadows/useShadowDirty.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;GAWG;AACH,wBAAgB,cAAc,IAAI,IAAI,CA2CrC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WaterSurfaceRenderer.d.ts","sourceRoot":"","sources":["../../../../../../src/core/water/WaterSurfaceRenderer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqC,MAAM,OAAO,CAAC;AAS1D,OAAO,EAA2B,KAAK,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAI9E,MAAM,WAAW,yBAAyB;IACxC,wFAAwF;IACxF,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,sFAAsF;IACtF,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC,yDAAyD;IACzD,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACvC,kEAAkE;IAClE,SAAS,EAAE,MAAM,CAAC;IAClB,mEAAmE;IACnE,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,eAAe,EAAE,MAAM,CAAC;IACxB,yDAAyD;IACzD,kBAAkB,EAAE,MAAM,CAAC;IAC3B;;;;;;;OAOG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB,gEAAgE;IAChE,iBAAiB,EAAE,MAAM,CAAC;IAC1B,kEAAkE;IAClE,eAAe,EAAE,MAAM,CAAC;IACxB,8EAA8E;IAC9E,gBAAgB,EAAE,MAAM,CAAC;IACzB,0CAA0C;IAC1C,YAAY,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,wBAAwB,EAAE,OAAO,CAAC;IAClC,6EAA6E;IAC7E,uBAAuB,EAAE,MAAM,CAAC;IAChC,8EAA8E;IAC9E,UAAU,EAAE,MAAM,CAAC;IACnB,2EAA2E;IAC3E,gBAAgB,EAAE,gBAAgB,CAAC;CACpC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,oBAAoB,CAAC,EACnC,QAAQ,EACR,UAAU,EACV,YAAY,EACZ,SAAS,EACT,eAAe,EACf,cAAc,EACd,eAAe,EACf,kBAAkB,EAClB,QAAQ,EACR,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,YAAY,EACZ,wBAAwB,EACxB,uBAAuB,EACvB,UAAU,EACV,gBAAgB,GACjB,EAAE,yBAAyB,
|
|
1
|
+
{"version":3,"file":"WaterSurfaceRenderer.d.ts","sourceRoot":"","sources":["../../../../../../src/core/water/WaterSurfaceRenderer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqC,MAAM,OAAO,CAAC;AAS1D,OAAO,EAA2B,KAAK,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAI9E,MAAM,WAAW,yBAAyB;IACxC,wFAAwF;IACxF,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,sFAAsF;IACtF,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC,yDAAyD;IACzD,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACvC,kEAAkE;IAClE,SAAS,EAAE,MAAM,CAAC;IAClB,mEAAmE;IACnE,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,eAAe,EAAE,MAAM,CAAC;IACxB,yDAAyD;IACzD,kBAAkB,EAAE,MAAM,CAAC;IAC3B;;;;;;;OAOG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB,gEAAgE;IAChE,iBAAiB,EAAE,MAAM,CAAC;IAC1B,kEAAkE;IAClE,eAAe,EAAE,MAAM,CAAC;IACxB,8EAA8E;IAC9E,gBAAgB,EAAE,MAAM,CAAC;IACzB,0CAA0C;IAC1C,YAAY,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,wBAAwB,EAAE,OAAO,CAAC;IAClC,6EAA6E;IAC7E,uBAAuB,EAAE,MAAM,CAAC;IAChC,8EAA8E;IAC9E,UAAU,EAAE,MAAM,CAAC;IACnB,2EAA2E;IAC3E,gBAAgB,EAAE,gBAAgB,CAAC;CACpC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,oBAAoB,CAAC,EACnC,QAAQ,EACR,UAAU,EACV,YAAY,EACZ,SAAS,EACT,eAAe,EACf,cAAc,EACd,eAAe,EACf,kBAAkB,EAClB,QAAQ,EACR,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,YAAY,EACZ,wBAAwB,EACxB,uBAAuB,EACvB,UAAU,EACV,gBAAgB,GACjB,EAAE,yBAAyB,qBAoO3B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"villa-cliff.d.ts","sourceRoot":"","sources":["../../../../../src/presets/villa-cliff.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAEhE,QAAA,MAAM,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"villa-cliff.d.ts","sourceRoot":"","sources":["../../../../../src/presets/villa-cliff.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAEhE,QAAA,MAAM,MAAM,EAAE,eA8Tb,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -15,14 +15,18 @@ export type CameraAction = {
|
|
|
15
15
|
* `initialZoomPadding2D` / `initialTargetHeight` values, so analyzer edits
|
|
16
16
|
* to those fields take effect on demand. Also updates the saved-pose refs
|
|
17
17
|
* so subsequent `reset`s honor the new framing.
|
|
18
|
+
*
|
|
19
|
+
* `follow` keeps the user's view direction and relative zoom and moves only the look-at point and
|
|
20
|
+
* the fit distance (`reframeOnSceneChange: 'follow'`).
|
|
18
21
|
*/
|
|
19
22
|
| {
|
|
20
23
|
type: 'reframe';
|
|
24
|
+
follow?: boolean;
|
|
21
25
|
}
|
|
22
26
|
/**
|
|
23
27
|
* Sticky element focus (the focus engine). Reorients to the element front + per-type elevation;
|
|
24
28
|
* snapshots the pre-focus pose on entry so `unfocus` can fly back. Distinct from the one-shot
|
|
25
|
-
* `focus` framing above, which neither snapshots nor can be exited.
|
|
29
|
+
* `focus` framing above, which neither snapshots nor can be exited. `follow`: see `reframe`.
|
|
26
30
|
*/
|
|
27
31
|
| {
|
|
28
32
|
type: 'focusElement';
|
|
@@ -30,6 +34,7 @@ export type CameraAction = {
|
|
|
30
34
|
focusElevationDeg?: number;
|
|
31
35
|
frontOn?: boolean;
|
|
32
36
|
paddingScale?: number;
|
|
37
|
+
follow?: boolean;
|
|
33
38
|
}
|
|
34
39
|
/**
|
|
35
40
|
* Fly back to the pose saved when focus was first entered. With `frontOnElementName` set (shelf-
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"camera.d.ts","sourceRoot":"","sources":["../../../../../../src/store/slices/camera.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAA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,CAAC,OAAO,EAAE,OAAO,CAAC,YAAY,CAAC,KAAK,IAAI,CAAC;IAC1D;;;OAGG;IACH,qBAAqB,EAAE,OAAO,CAAC;IAC/B,wBAAwB,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IACpD,mBAAmB,EAAE,CAAC,MAAM,EAAE,YAAY,KAAK,IAAI,CAAC;IACpD,kBAAkB,EAAE,MAAM,YAAY,EAAE,CAAC;IACzC,YAAY,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C,6HAA6H;IAC7H,QAAQ,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACzD,yFAAyF;IACzF,gBAAgB,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9C,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB,kFAAkF;IAClF,YAAY,EAAE,MAAM,IAAI,CAAC;CAC1B;AAED,eAAO,MAAM,iBAAiB,EAAE,YAAY,CAAC,QAAQ,EAAE,CAAC,CAAC,+BAA+B,EAAE,KAAK,CAAC,CAAC,EAAE,EAAE,EAAE,WAAW,CA2BhH,CAAC"}
|
|
@@ -59,8 +59,11 @@ export interface FocusSlice {
|
|
|
59
59
|
focusOnElement: (elementName: string) => void;
|
|
60
60
|
/** Exit focus and fly back to the pre-focus pose. No-op when not focused. */
|
|
61
61
|
clearFocus: () => void;
|
|
62
|
-
/**
|
|
63
|
-
|
|
62
|
+
/**
|
|
63
|
+
* Recompute the focus framing for the currently focused element (e.g. after it moved). `follow`
|
|
64
|
+
* keeps the user's view direction and relative zoom (see `reframeOnSceneChange`).
|
|
65
|
+
*/
|
|
66
|
+
refocusFocused: (follow?: boolean) => void;
|
|
64
67
|
}
|
|
65
68
|
export declare const createSelectionSlice: StateCreator<RTVStore, [['zustand/subscribeWithSelector', never]], [], SelectionSlice & FocusSlice>;
|
|
66
69
|
//# sourceMappingURL=selection.d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IAAI,CAAC;IACpE;;;;;OAKG;IACH,kBAAkB,EAAE,MAAM,IAAI,CAAC;IAC/B,6FAA6F;IAC7F,kBAAkB,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,CAAC;IACzD,YAAY,EAAE,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;CAC7C;AAED;;;;GAIG;AACH,MAAM,WAAW,UAAU;IACzB,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,yFAAyF;IACzF,cAAc,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9C,6EAA6E;IAC7E,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB;;;OAGG;IACH,cAAc,EAAE,CAAC,MAAM,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;CAC5C;AA+FD,eAAO,MAAM,oBAAoB,EAAE,YAAY,CAAC,QAAQ,EAAE,CAAC,CAAC,+BAA+B,EAAE,KAAK,CAAC,CAAC,EAAE,EAAE,EAAE,cAAc,GAAG,UAAU,CAkKnI,CAAC"}
|
|
@@ -18,6 +18,15 @@ export interface VersionsSlice {
|
|
|
18
18
|
*/
|
|
19
19
|
articleVersion: number;
|
|
20
20
|
bumpArticleVersion: () => void;
|
|
21
|
+
/**
|
|
22
|
+
* The article's PLACEMENT settled: its world bounds stopped moving after a change (see
|
|
23
|
+
* `ArticleSettleTracker`). `articleVersion` fires the moment geometry mounts, before placement
|
|
24
|
+
* passes have run — the deck-cutout anchor moves the elements onto their resting spot over the
|
|
25
|
+
* following frames. Consumers that measure WHERE the article is (camera framing, orbit-target
|
|
26
|
+
* bounds) subscribe to this one instead.
|
|
27
|
+
*/
|
|
28
|
+
articleSettledVersion: number;
|
|
29
|
+
bumpArticleSettledVersion: () => void;
|
|
21
30
|
/** Environment/decor scene changed: an environment GLB (main scene or a part) mounted (`EnvironmentSceneLoader`). */
|
|
22
31
|
decorVersion: number;
|
|
23
32
|
bumpDecorVersion: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"versions.d.ts","sourceRoot":"","sources":["../../../../../../src/store/slices/versions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAIzC;;;;;;;;;GASG;AACH,MAAM,WAAW,aAAa;IAC5B;;;;OAIG;IACH,cAAc,EAAE,MAAM,CAAC;IACvB,kBAAkB,EAAE,MAAM,IAAI,CAAC;IAC/B,qHAAqH;IACrH,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,IAAI,CAAC;IAC7B;;;;OAIG;IACH,cAAc,EAAE,MAAM,CAAC;IACvB,2DAA2D;IAC3D,gBAAgB,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CAC5C;AAED,eAAO,MAAM,mBAAmB,EAAE,YAAY,CAAC,QAAQ,EAAE,CAAC,CAAC,+BAA+B,EAAE,KAAK,CAAC,CAAC,EAAE,EAAE,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"versions.d.ts","sourceRoot":"","sources":["../../../../../../src/store/slices/versions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAIzC;;;;;;;;;GASG;AACH,MAAM,WAAW,aAAa;IAC5B;;;;OAIG;IACH,cAAc,EAAE,MAAM,CAAC;IACvB,kBAAkB,EAAE,MAAM,IAAI,CAAC;IAC/B;;;;;;OAMG;IACH,qBAAqB,EAAE,MAAM,CAAC;IAC9B,yBAAyB,EAAE,MAAM,IAAI,CAAC;IACtC,qHAAqH;IACrH,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,IAAI,CAAC;IAC7B;;;;OAIG;IACH,cAAc,EAAE,MAAM,CAAC;IACvB,2DAA2D;IAC3D,gBAAgB,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CAC5C;AAED,eAAO,MAAM,mBAAmB,EAAE,YAAY,CAAC,QAAQ,EAAE,CAAC,CAAC,+BAA+B,EAAE,KAAK,CAAC,CAAC,EAAE,EAAE,EAAE,aAAa,CAYpH,CAAC"}
|
|
@@ -200,13 +200,16 @@ export interface CameraConfig {
|
|
|
200
200
|
*/
|
|
201
201
|
focusTargetYOffset?: number;
|
|
202
202
|
/**
|
|
203
|
-
*
|
|
204
|
-
*
|
|
205
|
-
*
|
|
206
|
-
*
|
|
207
|
-
*
|
|
203
|
+
* What the camera does when the placed content's bounding box changes (an element resize / config
|
|
204
|
+
* edit), once the new placement has settled: the overview framing (or, when focused, the focus
|
|
205
|
+
* framing of the focused element) is re-derived against the new geometry, and then:
|
|
206
|
+
* - `true` (default): re-fit — fly to the re-derived pose, view angle included.
|
|
207
|
+
* - `'follow'`: keep the user's view direction and relative zoom; only the look-at point and the
|
|
208
|
+
* fit distance follow the re-derived pose.
|
|
209
|
+
* - `false`: the camera stays exactly where the user left it.
|
|
210
|
+
* Selection-driven focus flights are unaffected.
|
|
208
211
|
*/
|
|
209
|
-
reframeOnSceneChange?: boolean;
|
|
212
|
+
reframeOnSceneChange?: boolean | 'follow';
|
|
210
213
|
/**
|
|
211
214
|
* Whether selecting, deselecting or focusing an element is allowed to move the camera.
|
|
212
215
|
* Default `true` (fly to the element on select, out to the overview on deselect, recenter on a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"camera.d.ts","sourceRoot":"","sources":["../../../../../src/types/camera.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,KAAK,CAAC;AAC7B,eAAO,MAAM,WAAW,OAAO,CAAC;AAIhC,eAAO,MAAM,UAAU,OAAO,CAAC;AAE/B,MAAM,MAAM,SAAS,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,S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C,QAAQ,CAAC,CAAC,CAAC,CAAC;AAEjF,0EAA0E;AAC1E,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAC5C,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,EAAE,aAAa,GAAG,aAAa,GAAG,eAAe,GAAG,eAAe,GAAG,iBAAiB,GAAG,iBAAiB,CAAC,CAQrJ,CAAC"}
|
|
@@ -31,6 +31,13 @@ export declare function computeCamera2D(ctx: CameraFrameContext): FrameResult;
|
|
|
31
31
|
* planning has no placed elements (empty scene).
|
|
32
32
|
*/
|
|
33
33
|
export declare function sceneContentBox(scene: Scene): Box3 | null;
|
|
34
|
+
/**
|
|
35
|
+
* `reframeOnSceneChange: 'follow'`: the camera keeps its current view direction and its zoom
|
|
36
|
+
* relative to the recipe's fit, around the recipe's (re-derived) look-at point. `basisDistance` is the
|
|
37
|
+
* fit distance the recipe produced before the change — a camera at half of that stays at half of the
|
|
38
|
+
* new one.
|
|
39
|
+
*/
|
|
40
|
+
export declare function followPose(recipe: FrameResult, current: FrameResult, basisDistance: number): FrameResult;
|
|
34
41
|
/**
|
|
35
42
|
* Compute the 3D (orbital) camera position to frame either the entire scene,
|
|
36
43
|
* a specific element, or a specific geo within an element.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cameraFraming.d.ts","sourceRoot":"","sources":["../../../../../src/utils/cameraFraming.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAqB,IAAI,EAAE,MAAM,OAAO,CAAC;AACzD,OAAO,KAAK,EAAE,KAAK,EAAY,MAAM,OAAO,CAAC;AAC7C,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAKnD;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,E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C,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,YAAY,CAAC;CAC5B;AAED,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC;CACjB;AAiBD;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,kBAAkB,GAAG,WAAW,CAqBpE;AAiFD;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,GAAG,IAAI,CAqBzD;AAyED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,GAAG,WAAW,CAUxG;AAeD;;;GAGG;AACH,wBAAgB,eAAe,CAC7B,GAAG,EAAE,kBAAkB,EACvB,WAAW,CAAC,EAAE,MAAM,EACpB,OAAO,CAAC,EAAE,MAAM,EAChB,oBAAoB,CAAC,EAAE,MAAM,EAC7B,OAAO,CAAC,EAAE,OAAO,EACjB,YAAY,CAAC,EAAE,MAAM,GACpB,WAAW,CAiBb;AAED;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CAAC,GAAG,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,GAAG,WAAW,CAQrG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cameraFraming.test.d.ts","sourceRoot":"","sources":["../../../../../src/utils/cameraFraming.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { Object3D } from 'three';
|
|
2
|
+
import type { GeoAsset } from '../parser/parseRenderScript';
|
|
3
|
+
/**
|
|
4
|
+
* How a catalog names a geo. Assembled geo nodes are called `` `${nodePath}/geo:${assetId}:${i}` `` —
|
|
5
|
+
* a runtime path no catalog can be authored against — so a selector is translated by the resolver
|
|
6
|
+
* instead (geo name → asset ids → nodes).
|
|
7
|
+
*/
|
|
8
|
+
export type GeoSelector =
|
|
9
|
+
/** Catalog geo name (`GeoAsset.name`, e.g. `GEO_GRIFF_L`). */
|
|
10
|
+
{
|
|
11
|
+
geoName: string;
|
|
12
|
+
}
|
|
13
|
+
/** Every geo whose catalog name starts with this — `GEO_Pool` matches `GEO_Pool`, `GEO_Pool_Rim`, … */
|
|
14
|
+
| {
|
|
15
|
+
geoNamePrefix: string;
|
|
16
|
+
}
|
|
17
|
+
/** Exact three.js node name. Escape hatch; assembly-specific. */
|
|
18
|
+
| {
|
|
19
|
+
nodeName: string;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Resolve a {@link GeoSelector} to scene nodes.
|
|
23
|
+
*
|
|
24
|
+
* Assembled geo nodes are named `` `${nodePath}/geo:${assetId}:${i}` `` (see `SceneTree`), i.e. a
|
|
25
|
+
* runtime path carrying an asset id — nothing a catalog can be authored against. A selector names
|
|
26
|
+
* the geo the way a catalog does (`GeoAsset.name`, e.g. `GEO_GRIFF_L`) and this translates:
|
|
27
|
+
* name → asset ids → nodes.
|
|
28
|
+
*/
|
|
29
|
+
export declare function resolveGeoNodes(root: Object3D, geoAssets: readonly GeoAsset[], selector: GeoSelector): Object3D[];
|
|
30
|
+
//# sourceMappingURL=geoTargets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"geoTargets.d.ts","sourceRoot":"","sources":["../../../../../src/utils/geoTargets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAE5D;;;;GAIG;AACH,MAAM,MAAM,WAAW;AACrB,8DAA8D;AAC5D;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE;AACrB,uGAAuG;GACrG;IAAE,aAAa,EAAE,MAAM,CAAA;CAAE;AAC3B,iEAAiE;GAC/D;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC;AAEzB;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,QAAQ,EAAE,EAAE,QAAQ,EAAE,WAAW,GAAG,QAAQ,EAAE,CAkBjH"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see 463.real-time-viewer-next.umd.min.js.LICENSE.txt */
|
|
2
|
-
"use strict";(self.webpackChunkCrystaldesignRealTimeViewerNext=self.webpackChunkCrystaldesignRealTimeViewerNext||[]).push([[463],{3463:(t,r,a)=>{a.r(r),a.d(r,{WaterSurface:()=>WaterSurface});var o=a(7080),i=a(7363),l=a(505),c=a(4088),u=a(6831),h=a(5590),d=a(7582),v=a(5150),p=a(2942);function _createForOfIteratorHelper(t,r){var a="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!a){if(Array.isArray(t)||(a=function _unsupportedIterableToArray(t,r){if(t){if("string"==typeof t)return _arrayLikeToArray(t,r);var a={}.toString.call(t).slice(8,-1);return"Object"===a&&t.constructor&&(a=t.constructor.name),"Map"===a||"Set"===a?Array.from(t):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?_arrayLikeToArray(t,r):void 0}}(t))||r&&t&&"number"==typeof t.length){a&&(t=a);var o=0,i=function F(){};return{s:i,n:function n(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}},e:function e(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var l,c=!0,u=!1;return{s:function s(){a=a.call(t)},n:function n(){var t=a.next();return c=t.done,t},e:function e(t){u=!0,l=t},f:function f(){try{c||null==a.return||a.return()}finally{if(u)throw l}}}}function _arrayLikeToArray(t,r){(null==r||r>t.length)&&(r=t.length);for(var a=0,o=Array(r);a<r;a++)o[a]=t[a];return o}var m=function(){return(0,d.Z)((function PoolHeightMap(){(0,h.Z)(this,PoolHeightMap),(0,v.Z)(this,"rt",void 0),(0,v.Z)(this,"overrideMaterial",void 0),(0,v.Z)(this,"camera",void 0),(0,v.Z)(this,"lastCenter",new u.Pa4(1/0,1/0,1/0)),(0,v.Z)(this,"lastHalf",new u.Pa4(0,0,0)),(0,v.Z)(this,"lastGeometryVersion",-1),(0,v.Z)(this,"age",120),this.rt=new u.dd2(256,256,{type:u.cLu,format:u.wk1,depthBuffer:!0,stencilBuffer:!1,minFilter:u.wem,magFilter:u.wem}),this.camera=new u.iKG(-1,1,1,-1,.01,1),this.overrideMaterial=new u.jyz({vertexShader:"\n uniform vec3 uVolumeCenter;\n uniform vec3 uPoolHalf;\n varying float vHeightEncoded;\n void main() {\n vec4 worldPosition = vec4(position, 1.0);\n #ifdef USE_INSTANCING\n worldPosition = instanceMatrix * worldPosition;\n #endif\n worldPosition = modelMatrix * worldPosition;\n vHeightEncoded = (worldPosition.y - uVolumeCenter.y + uPoolHalf.y) / (3.0 * uPoolHalf.y);\n gl_Position = projectionMatrix * viewMatrix * worldPosition;\n }\n",fragmentShader:"\n varying float vHeightEncoded;\n void main() {\n gl_FragColor = vec4(vHeightEncoded, 0.0, 0.0, 1.0);\n }\n",uniforms:{uVolumeCenter:{value:new u.Pa4},uPoolHalf:{value:new u.Pa4(1,1,1)}},side:u.ehD})}),[{key:"texture",get:function get(){return this.rt.texture}},{key:"updateCamera",value:function updateCamera(t,r){var a=this.camera;a.up.set(0,0,-1),a.position.set(t.x,t.y+.3,t.z),a.lookAt(t.x,t.y-r.y,t.z),a.left=-r.x,a.right=r.x,a.top=-r.z,a.bottom=r.z,a.near=.01,a.far=.3+r.y+.5,a.updateProjectionMatrix(),a.updateMatrixWorld(!0)}},{key:"renderIfNeeded",value:function renderIfNeeded(t,r,a,o,i,l){var c=this;if(this.age+=1,!(i!==this.lastGeometryVersion||!a.equals(this.lastCenter)||!o.equals(this.lastHalf)||this.age>=120))return!1;this.overrideMaterial.uniforms.uVolumeCenter.value.copy(a),this.overrideMaterial.uniforms.uPoolHalf.value.copy(o),this.updateCamera(a,o);var h,d=[],v=_createForOfIteratorHelper(l);try{for(v.s();!(h=v.n()).done;){var m=h.value;m&&m.visible&&(m.visible=!1,d.push(m))}}catch(t){v.e(t)}finally{v.f()}r.traverse((function(t){var r=t;if(t.visible){if(r.isLine||r.isPoints||r.isSprite)return t.visible=!1,void d.push(t);if(r.isMesh){var a=t,o=a.material,i=function receives(t){if(!(t instanceof u.Wid))return!1;if(t.transparent||t.opacity<1)return!1;var r=t.transmission;return!("number"==typeof r&&r>0)};(Array.isArray(o)?o.some(i):i(o))||(a.visible=!1,d.push(a))}}}));var g=r.overrideMaterial,y=r.background;try{(0,p.s)(t,{target:this.rt,clearColor:0,clearAlpha:1},(function(){t.clear(!0,!0,!1),r.background=null,r.overrideMaterial=c.overrideMaterial,t.render(r,c.camera)}))}finally{r.overrideMaterial=g,r.background=y;for(var x=0,w=d;x<w.length;x++){w[x].visible=!0}}return this.lastCenter.copy(a),this.lastHalf.copy(o),this.lastGeometryVersion=i,this.age=0,!0}},{key:"dispose",value:function dispose(){this.rt.dispose(),this.overrideMaterial.dispose()}}])}();function SceneCapture_createForOfIteratorHelper(t,r){var a="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!a){if(Array.isArray(t)||(a=function SceneCapture_unsupportedIterableToArray(t,r){if(t){if("string"==typeof t)return SceneCapture_arrayLikeToArray(t,r);var a={}.toString.call(t).slice(8,-1);return"Object"===a&&t.constructor&&(a=t.constructor.name),"Map"===a||"Set"===a?Array.from(t):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?SceneCapture_arrayLikeToArray(t,r):void 0}}(t))||r&&t&&"number"==typeof t.length){a&&(t=a);var o=0,i=function F(){};return{s:i,n:function n(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}},e:function e(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var l,c=!0,u=!1;return{s:function s(){a=a.call(t)},n:function n(){var t=a.next();return c=t.done,t},e:function e(t){u=!0,l=t},f:function f(){try{c||null==a.return||a.return()}finally{if(u)throw l}}}}function SceneCapture_arrayLikeToArray(t,r){(null==r||r>t.length)&&(r=t.length);for(var a=0,o=Array(r);a<r;a++)o[a]=t[a];return o}var g=new u.ZzF,y=function(){return(0,d.Z)((function SceneCapture(){var t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(0,h.Z)(this,SceneCapture),(0,v.Z)(this,"rt",void 0),(0,v.Z)(this,"width",0),(0,v.Z)(this,"height",0),this.rt=new u.dd2(1,1,{type:u.cLu,format:null!==(t=r.format)&&void 0!==t?t:u.wk1,depthBuffer:!0,stencilBuffer:!1,minFilter:u.wem,magFilter:u.wem}),this.width=1,this.height=1}),[{key:"texture",get:function get(){return this.rt.texture}},{key:"resizeIfNeeded",value:function resizeIfNeeded(t,r,a){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,i=Math.max(1,Math.round(t*a*o)),l=Math.max(1,Math.round(r*a*o));return(i!==this.width||l!==this.height)&&(this.rt.setSize(i,l),this.width=i,this.height=l,!0)}},{key:"render",value:function render(t,r,a,o,i,l,c){var h,d=this,v=[],m=SceneCapture_createForOfIteratorHelper(o);try{for(m.s();!(h=m.n()).done;){var y=h.value;y&&y.visible&&(y.visible=!1,v.push(y))}}catch(t){m.e(t)}finally{m.f()}c&&r.traverse((function(t){var r=t;if(r.isMesh&&r.visible){var a=r.geometry;if(a){null===a.boundingBox&&a.computeBoundingBox();var o=a.boundingBox;o&&(g.copy(o).applyMatrix4(r.matrixWorld),g.intersectsBox(c)||(r.visible=!1,v.push(r)))}}})),this.rt.scissorTest=!1;var x=r.background;r.background=null;try{(0,p.s)(t,{target:this.rt,toneMapping:u.uL9,clearAlpha:0,clippingPlanes:i},(function(){t.clear(!0,!0,!1),l&&(d.rt.scissor.copy(l),d.rt.scissorTest=!0,t.setRenderTarget(d.rt));try{t.render(r,a)}finally{d.rt.scissorTest=!1}}))}finally{r.background=x;for(var w=0,b=v;w<b.length;w++){b[w].visible=!0}}}},{key:"dispose",value:function dispose(){this.rt.dispose()}}])}(),x=a(8133),w=new u.ZzF,b=new u.iWj,S=new u.yGw,P=new u.Ltg,C=new u.Ltg,M=new u.FM8;var H=function(){return(0,d.Z)((function RefractionCapture(){(0,h.Z)(this,RefractionCapture),(0,v.Z)(this,"capture",new y),(0,v.Z)(this,"clipPlanes",[new u.JOQ(new u.Pa4(-1,0,0),0),new u.JOQ(new u.Pa4(1,0,0),0),new u.JOQ(new u.Pa4(0,-1,0),0),new u.JOQ(new u.Pa4(0,1,0),0),new u.JOQ(new u.Pa4(0,0,-1),0),new u.JOQ(new u.Pa4(0,0,1),0)]),(0,v.Z)(this,"framesSinceCapture",15),(0,v.Z)(this,"capturedViewProj",new u.yGw),(0,v.Z)(this,"capturedBox",new u.ZzF),(0,v.Z)(this,"capturedGeometryVersion",-1)}),[{key:"texture",get:function get(){return this.capture.texture}},{key:"update",value:function update(t){var r=t.renderer,a=t.camera,o=t.material,i=t.volumeCenter,l=t.poolHalf,c=this.capture.resizeIfNeeded(t.cssWidth,t.cssHeight,r.getPixelRatio(),.5);o.uniforms.uSceneColor.value=this.capture.texture,r.getDrawingBufferSize(M),o.uniforms.uResolution.value.set(1/Math.max(1,M.x),1/Math.max(1,M.y));var u=i.x,h=i.y,d=i.z,v=l.x+.25,p=l.y,m=l.z+.25;this.clipPlanes[0].constant=u+v,this.clipPlanes[1].constant=v-u,this.clipPlanes[2].constant=h,this.clipPlanes[3].constant=p-h,this.clipPlanes[4].constant=d+m,this.clipPlanes[5].constant=m-d,w.min.set(u-v,h-p-.4,d-m),w.max.set(u+v,h+.4,d+m),a.updateMatrixWorld(),S.multiplyMatrices(a.projectionMatrix,a.matrixWorldInverse),b.setFromProjectionMatrix(S);var g=t.sceneMutating||t.geometryVersion!==this.capturedGeometryVersion||!w.equals(this.capturedBox)||!function matricesApproxEqual(t,r,a){for(var o=t.elements,i=r.elements,l=0;l<16;l++)if(Math.abs(o[l]-i[l])>a)return!1;return!0}(S,this.capturedViewProj,1e-6);if(this.framesSinceCapture+=1,function isCaptureDue(t,r,a){return a||t>=(r?1:15)}(this.framesSinceCapture,g,c)&&b.intersectsBox(w)){var y=function fitScissorToBox(t,r,a,o,i,l){for(var c=1/0,u=1/0,h=-1/0,d=-1/0,v=0;v<8;v++){if(C.set(1&v?t.max.x:t.min.x,2&v?t.max.y:t.min.y,4&v?t.max.z:t.min.z,1).applyMatrix4(r),C.w<=1e-6)return!1;var p=C.x/C.w,m=C.y/C.w;p<c&&(c=p),p>h&&(h=p),m<u&&(u=m),m>d&&(d=m)}var g=i*a+1,y=i*o+1,x=Math.max(0,Math.floor((.5*c+.5)*a-g)),w=Math.max(0,Math.floor((.5*u+.5)*o-y)),b=Math.min(a,Math.ceil((.5*h+.5)*a+g)),S=Math.min(o,Math.ceil((.5*d+.5)*o+y));return!(b<=x||S<=w)&&(l.set(x,w,b-x,S-w),!0)}(w,S,this.capture.width,this.capture.height,.03,P);(0,x.Jm)(!0);try{this.capture.render(r,t.scene,a,[t.surfaceMesh],this.clipPlanes,y?P:null,w)}finally{(0,x.Jm)(!1)}this.framesSinceCapture=0,this.capturedViewProj.copy(S),this.capturedBox.copy(w),this.capturedGeometryVersion=t.geometryVersion}}},{key:"dispose",value:function dispose(){this.capture.dispose()}}])}();var z=a(7534),R="\n const float IOR_AIR = 1.0;\n const float IOR_WATER = 1.333;\n uniform vec3 light;\n uniform vec3 uPoolHalf; // (halfX, depth, halfZ) — see file header\n uniform sampler2D water;\n\n vec2 intersectCube(vec3 origin, vec3 ray, vec3 cubeMin, vec3 cubeMax) {\n vec3 tMin = (cubeMin - origin) / ray;\n vec3 tMax = (cubeMax - origin) / ray;\n vec3 t1 = min(tMin, tMax);\n vec3 t2 = max(tMin, tMax);\n float tNear = max(max(t1.x, t1.y), t1.z);\n float tFar = min(min(t2.x, t2.y), t2.z);\n return vec2(tNear, tFar);\n }\n";function heightSamplerGLSL(t,r){return"\n float ".concat(t,"(vec2 xz) {\n float encoded = texture2D(").concat(r,", xz / (2.0 * uPoolHalf.xz) + 0.5).r;\n return clamp(encoded * 3.0 * uPoolHalf.y - uPoolHalf.y, -uPoolHalf.y, 0.0);\n }\n")}function heightFieldMarchGLSL(t){var r=t.name,a=t.sampler,o=t.coarseSteps,i=t.guardShallowRays,l=["for (int k = 0; k < 3; k++) {"," p += ray * ((".concat(a,"(p.xz) - p.y) / ray.y);"),"}"],c=i?["if (ray.y < -0.001) {"].concat((0,z.Z)(l.map((function(t){return" ".concat(t)}))),["}"]):l;return"\n vec3 ".concat(r,"(vec3 origin, vec3 ray) {\n vec2 t = intersectCube(origin, ray, vec3(-uPoolHalf.x, -uPoolHalf.y, -uPoolHalf.z), vec3(uPoolHalf.x, 2.0 * uPoolHalf.y, uPoolHalf.z));\n float tEnd = max(t.y, 0.0);\n float lo = 0.0;\n float hi = tEnd;\n bool crossed = false;\n for (int i = 1; i <= ").concat(o,"; i++) {\n float ti = tEnd * float(i) / ").concat(o.toFixed(1),";\n vec3 p = origin + ray * ti;\n if (p.y <= ").concat(a,"(p.xz)) {\n hi = ti;\n crossed = true;\n break;\n }\n lo = ti;\n }\n if (!crossed) {\n vec3 p = origin + ray * tEnd;\n").concat(c.map((function(t){return" ".concat(t)})).join("\n"),"\n return p;\n }\n for (int j = 0; j < 4; j++) {\n float mid = 0.5 * (lo + hi);\n vec3 pm = origin + ray * mid;\n if (pm.y <= ").concat(a,"(pm.xz)) {\n hi = mid;\n } else {\n lo = mid;\n }\n }\n return origin + ray * (0.5 * (lo + hi));\n }\n")}var k="\n ".concat(R,"\n ").concat('\n uniform float uWaterClarity;\n uniform vec3 uWallColor; // MOD #1: replaces sampler2D tiles\n uniform vec3 uSkyHorizonColor; // MOD #2: drives sampleProceduralSky\n uniform vec3 uSkyZenithColor; // MOD #2: drives sampleProceduralSky\n uniform sampler2D causticTex;\n\n // MOD #2: replaces textureCube(sky, ray). Two-color vertical gradient.\n vec3 sampleProceduralSky(vec3 ray) {\n float t = clamp(ray.y * 0.5 + 0.5, 0.0, 1.0);\n return mix(uSkyHorizonColor, uSkyZenithColor, pow(t, 1.5));\n }\n\n // Sample the heightfield at a WORLD-METER xz position. The heightfield\n // texture\'s UV [0, 1]² spans the full pool footprint [-halfX, +halfX] ×\n // [-halfZ, +halfZ].\n vec4 sampleWaterAt(vec2 worldXZ) {\n return texture2D(water, worldXZ / (2.0 * uPoolHalf.xz) + 0.5);\n }\n\n // Sample the caustic texture for a point at WORLD-METER position. The\n // caustic texture indexes by "where would the light from this point have\n // come from at the water surface", projected back along refractedLight.\n // Mapping mirrors the caustics-vertex gl_Position write:\n // clip_xz = 0.75 * (point.xz - point.y * slope) / uPoolHalf.xz\n // Both vertex and fragment use this identical formula so reading and\n // writing into the texture are consistent across the full pool.\n vec4 sampleCausticAt(vec3 point, vec3 refractedLight) {\n vec2 lookup = (point.xz - point.y * refractedLight.xz / refractedLight.y) / uPoolHalf.xz;\n return texture2D(causticTex, 0.75 * lookup * 0.5 + 0.5);\n }\n\n vec3 getWallColor(vec3 point) {\n float scale = 0.5;\n\n vec3 wallColor;\n vec3 normal;\n // Wall detection: a tiny relative epsilon (0.1% of pool half-extent) so\n // we still recognise points sitting exactly on the wall geometry while\n // being tolerant of floating-point noise in the ray-march hit positions.\n if (abs(point.x) > uPoolHalf.x * 0.999) {\n wallColor = uWallColor; // MOD #1\n normal = vec3(-point.x, 0.0, 0.0);\n } else if (abs(point.z) > uPoolHalf.z * 0.999) {\n wallColor = uWallColor; // MOD #1\n normal = vec3(0.0, 0.0, -point.z);\n } else {\n wallColor = uWallColor; // MOD #1\n normal = vec3(0.0, 1.0, 0.0);\n }\n\n scale /= mix(length(point), 1.0, uWaterClarity); /* pool ambient occlusion */\n\n /* caustics */\n vec3 refractedLight = -refract(-light, vec3(0.0, 1.0, 0.0), IOR_AIR / IOR_WATER);\n float diffuse = max(0.0, dot(refractedLight, normal));\n vec4 info = sampleWaterAt(point.xz);\n if (point.y < info.r) {\n vec4 caustic = sampleCausticAt(point, refractedLight);\n scale += diffuse * caustic.r * 2.0 * caustic.g;\n } else {\n /* shadow for the rim of the pool */\n vec2 t = intersectCube(point, refractedLight, vec3(-uPoolHalf.x, -uPoolHalf.y, -uPoolHalf.z), vec3(uPoolHalf.x, 2.0 * uPoolHalf.y, uPoolHalf.z));\n diffuse *= 1.0 / (1.0 + exp(-200.0 / (1.0 + 10.0 * (t.y - t.x)) * (point.y + refractedLight.y * t.y - uPoolHalf.y / 6.0)));\n\n scale += diffuse * 0.5;\n }\n\n return wallColor * scale;\n }\n',"\n uniform vec3 eye;\n // Screen-space refraction inputs. The host renders the scene minus the\n // water surface itself to uSceneColor once per frame (SceneCapture.ts);\n // the surface then samples that texture at its own screen UV. This\n // replaces the demo's in-shader intersectCube + getWallColor AABB\n // raytrace so the underwater view shows the ACTUAL pool geo in the scene.\n uniform sampler2D uSceneColor;\n uniform vec2 uResolution;\n uniform float uUseScreenSpaceRefraction;\n uniform vec3 uRefractionFallbackColor;\n // Grazing-angle ceiling of the Schlick fresnel, in [fresnelBase, 1.0]. The\n // standard formula reaches 1.0 at cosI = 0, which on steep wave fronts reads\n // as harsh bright streaks (env.water.fresnelMax).\n uniform float uFresnelMax;\n // MOD #7 debug views (0 in production):\n // 4 = LANDING — ramp of the landing height the caustic composite\n // anchors to at this pixel (caustic texture .b at the marched\n // view-ray hit). Downstream of the height map AND caustics pass.\n // 5 = HEIGHTMAP — the raw PoolHeightMap capture painted over the pool\n // footprint. Upstream: exactly what the top-down pass recorded.\n uniform float uCausticDebugMode;\n // Pool receiving-geometry height map (PoolHeightMap.ts) — PRODUCTION\n // input: the SSR composite marches the view ray against it to find the\n // displayed wall/floor point. Also drives debug view 5.\n uniform sampler2D uPoolHeightMap;\n varying vec3 vWaterPos;\n\n // Landing-height debug ramp. Magenta = no data (encoded 0: cleared height\n // map texel, or a caustic ray that landed at the analytic volume floor);\n // blue = volume floor, green = mid-depth, red = waterline.\n vec3 rtvLandingRamp(float encoded) {\n if (encoded < 0.002) return vec3(1.0, 0.0, 1.0);\n float t = clamp(encoded * 3.0, 0.0, 1.0);\n return t < 0.5 ? mix(vec3(0.0, 0.2, 1.0), vec3(0.0, 1.0, 0.2), t * 2.0) : mix(vec3(0.0, 1.0, 0.2), vec3(1.0, 0.1, 0.0), t * 2.0 - 1.0);\n }\n\n ").concat(heightSamplerGLSL("rtvSampleHeight","uPoolHeightMap"),"\n\n // Height-field normal from central differences. Steep wall bands in the\n // map tilt it toward horizontal, so walls get a proper light-incidence\n // term without any analytic-AABB face detection.\n vec3 rtvHeightFieldNormal(vec2 xz) {\n float eps = uPoolHalf.x / 128.0;\n float hxp = rtvSampleHeight(xz + vec2(eps, 0.0));\n float hxm = rtvSampleHeight(xz - vec2(eps, 0.0));\n float hzp = rtvSampleHeight(xz + vec2(0.0, eps));\n float hzm = rtvSampleHeight(xz - vec2(0.0, eps));\n return normalize(vec3(hxm - hxp, 2.0 * eps, hzm - hzp));\n }\n\n /* MOD #7 — find the displayed geometry point along the straight view ray by\n marching it against the pool height map. Runs per FRAGMENT, hence the\n coarser 12-step pass; see heightFieldMarchGLSL for the algorithm. */\n ").concat(heightFieldMarchGLSL({name:"rtvMarchViewRay",sampler:"rtvSampleHeight",coarseSteps:12,guardShallowRays:!0}),"\n\n /*\n * Screen-space refraction sampler.\n *\n * gl_FragCoord.xy * uResolution (with uResolution = 1/drawingBuffer)\n * gives the current fragment's screen UV — the same UV the SceneCapture\n * target was written with, and the UV we sample at. Refraction is flat:\n * the sample is never displaced by the wave normal.\n *\n * The SceneCapture pass clips everything outside the water bbox via\n * six clipping planes installed on the renderer, so any fragment of\n * geometry that sits outside the water volume (above, below, beside\n * the pool) is discarded — those screen pixels stay at the cleared\n * alpha = 0 in the capture.\n *\n * When the sample is alpha=0 (or near-black, since a cleared capture\n * pixel reads as opaque-but-zero on some drivers) — a tall wave crest\n * peeking above the original waterline, so behind it on screen there's\n * no captured geo — return uRefractionFallbackColor, a host-configurable\n * deep-water tint surfaced as a Leva colour picker.\n */\n // Treat cleared / clipped capture pixels as a miss even if alpha is wrong.\n bool rtvSceneCaptureMissed(vec4 s) {\n return s.a < 0.5 || (s.r + s.g + s.b) < 0.02;\n }\n\n vec3 sampleScreenSpaceRefraction(vec3 viewRay, vec3 waterColor) {\n vec2 sampleUV = gl_FragCoord.xy * uResolution;\n vec4 sceneSample = texture2D(uSceneColor, sampleUV);\n\n // Live caustic composite. The capture is rendered with the caustic\n // receivers SUSPENDED (see setCausticReceiversSuspended) so still-scene\n // captures stay byte-identical for the throttle; the animated caustic\n // term is applied here every frame instead.\n //\n // MOD #7 — the hit marches the STRAIGHT view ray, not the refracted\n // one: the capture is an unrefracted straight-view render sampled at\n // the fragment's own screen UV, so the geometry displayed at this\n // fragment lies along the camera ray.\n float causticBoost = 1.0;\n vec3 refractedLight = -refract(-light, vec3(0.0, 1.0, 0.0), IOR_AIR / IOR_WATER);\n vec3 hit = rtvMarchViewRay(vWaterPos, viewRay);\n vec3 hitNormal = rtvHeightFieldNormal(hit.xz);\n float diffuseTerm = max(0.0, dot(refractedLight, hitNormal));\n vec4 info = sampleWaterAt(hit.xz);\n if (hit.y < info.r) {\n vec4 caustic = sampleCausticAt(hit, refractedLight);\n // Landing-height shadow, same rule as the receivers: a hit clearly\n // below the ray's landing is behind the surface that caught the\n // light. b == 0 is the no-data sentinel → no occlusion.\n float landingY = caustic.b * 3.0 * uPoolHalf.y - uPoolHalf.y;\n float occlusion = 1.0 - step(0.002, caustic.b) * smoothstep(0.05, 0.2, landingY - hit.y);\n // Hard ceiling on the contribution: at concave edges the tilted\n // height-field normal and the fold-compressed caustic can multiply\n // into an outline far brighter than the open-floor pattern.\n causticBoost += min(diffuseTerm * caustic.r * 2.0 * caustic.g * occlusion, 0.8);\n }\n\n // The fallback gets the boost too so a caustic band doesn't cut off\n // abruptly at the valid-sample/fallback boundary.\n if (rtvSceneCaptureMissed(sceneSample)) {\n return uRefractionFallbackColor * causticBoost;\n }\n return sceneSample.rgb * causticBoost * waterColor;\n }\n\n vec3 getSurfaceRayColor(vec3 origin, vec3 ray, vec3 waterColor) {\n vec3 color;\n if (ray.y < 0.0) {\n vec2 t = intersectCube(origin, ray, vec3(-uPoolHalf.x, -uPoolHalf.y, -uPoolHalf.z), vec3(uPoolHalf.x, 2.0 * uPoolHalf.y, uPoolHalf.z));\n color = getWallColor(origin + ray * t.y);\n } else {\n vec2 t = intersectCube(origin, ray, vec3(-uPoolHalf.x, -uPoolHalf.y, -uPoolHalf.z), vec3(uPoolHalf.x, 2.0 * uPoolHalf.y, uPoolHalf.z));\n vec3 hit = origin + ray * t.y;\n if (hit.y < uPoolHalf.y / 6.0) {\n color = getWallColor(hit);\n } else {\n color = sampleProceduralSky(ray); // MOD #2\n color += vec3(pow(max(0.0, dot(light, ray)), 5000.0)) * vec3(10.0, 8.0, 6.0);\n }\n }\n if (ray.y < 0.0) color *= waterColor;\n return color;\n }\n\n void main() {\n vec2 coord = vWaterPos.xz / (2.0 * uPoolHalf.xz) + 0.5;\n vec4 info = texture2D(water, coord);\n\n // HEIGHTMAP debug view — the raw PoolHeightMap capture over the pool\n // footprint (same UV the caustics pass samples with).\n if (uCausticDebugMode > 4.5) {\n gl_FragColor = vec4(rtvLandingRamp(texture2D(uPoolHeightMap, coord).r), 1.0);\n return;\n }\n\n // Footprint of the UN-displaced surface UV, in heightfield texels per screen pixel — taken\n // BEFORE the peaks loop so per-pixel displacement jitter cannot spike the derivative.\n vec2 hfTexels = vec2(textureSize(water, 0));\n float footprint = max(fwidth(coord.x) * hfTexels.x, fwidth(coord.y) * hfTexels.y);\n\n /* make water look more \"peaked\" */\n for (int i = 0; i < 5; i++) {\n coord += info.ba * 0.005;\n info = texture2D(water, coord);\n }\n\n // Resolution-adaptive normal smoothing (spec-AA): when one screen pixel spans several\n // heightfield texels (low effective DPR on tablets, grazing distance), the per-pixel wave\n // normal aliases into reflection/refraction sparkle. Flatten the wave component toward\n // vertical with the footprint — a no-op at 1:1 sampling, so dense desktop rendering keeps\n // its full wave detail.\n info.ba *= 1.0 / (1.0 + 1.5 * max(0.0, footprint - 1.0));\n\n vec3 normal = vec3(info.b, sqrt(max(0.0, 1.0 - dot(info.ba, info.ba))), info.a);\n vec3 incomingRay = normalize(vWaterPos - eye);\n\n /* above water */\n vec3 reflectedRay = reflect(incomingRay, normal);\n vec3 refractedRay = refract(incomingRay, normal, IOR_AIR / IOR_WATER);\n\n // LANDING debug view — the landing height the composite uses at this\n // pixel, computed with the same view-ray march as production.\n if (uCausticDebugMode > 3.5) {\n vec3 dbgRefractedLight = -refract(-light, vec3(0.0, 1.0, 0.0), IOR_AIR / IOR_WATER);\n vec3 dbgHit = rtvMarchViewRay(vWaterPos, incomingRay);\n gl_FragColor = vec4(rtvLandingRamp(sampleCausticAt(dbgHit, dbgRefractedLight).b), 1.0);\n return;\n }\n\n float fresnelBase = mix(0.25, 0.05, uWaterClarity);\n // Schlick fresnel. CRITICAL: clamp the cos-incidence term to [0, 1]\n // BEFORE the pow(). On steep wave fronts dot(normal, -incomingRay)\n // can slip slightly above 1.0 (fp error) — then 1.0 - dot becomes\n // negative and pow(negative, 3.0) is undefined in GLSL → NaN.\n // The NaN propagates into fresnel and into mix(refracted, reflected,\n // fresnel), and the framebuffer write clamps NaN to 0, producing\n // pure-black wave-front streaks. The clamp keeps fresnel a well-\n // defined float in [fresnelBase, uFresnelMax] everywhere.\n float cosI = clamp(dot(normal, -incomingRay), 0.0, 1.0);\n float fresnel = mix(fresnelBase, uFresnelMax, pow(1.0 - cosI, 3.0));\n\n vec3 abovewaterColor = mix(vec3(0.25, 1.0, 1.25), vec3(1.0), uWaterClarity);\n vec3 reflectedColor = getSurfaceRayColor(vWaterPos, reflectedRay, abovewaterColor);\n // Refraction path: screen-space sample of the captured scene texture when\n // uUseScreenSpaceRefraction is on, falling back to the demo's in-shader\n // AABB raytrace otherwise. Both paths share the same abovewaterColor tint\n // so toggling between them doesn't shift the overall hue.\n vec3 refractedColor;\n if (uUseScreenSpaceRefraction > 0.5) {\n refractedColor = sampleScreenSpaceRefraction(incomingRay, abovewaterColor);\n } else {\n refractedColor = getSurfaceRayColor(vWaterPos, refractedRay, abovewaterColor);\n }\n\n gl_FragColor = vec4(mix(refractedColor, reflectedColor, fresnel), 1.0);\n }\n"),T="\n ".concat(R,"\n uniform float uCausticIntensity; // MOD #4\n // MOD #7 — receiving-geometry height map (PoolHeightMap.ts). R channel:\n // volume-local height as (y + poolHalf.y) / (3 * poolHalf.y); the cleared\n // texture (0) decodes to the floor plane.\n uniform sampler2D uHeightMap;\n uniform float uHeightMapEnabled;\n varying vec3 oldPos;\n varying vec3 newPos;\n varying vec3 vRay;\n varying float vEdgeFade;\n\n ").concat(heightSamplerGLSL("causticSampleHeight","uHeightMap"),"\n\n /* Runs per VERTEX of the caustic mesh, so it affords a 24-step coarse pass;\n see heightFieldMarchGLSL for the algorithm. */\n ").concat(heightFieldMarchGLSL({name:"causticMarchLightRay",sampler:"causticSampleHeight",coarseSteps:24,guardShallowRays:!1}),"\n\n /* Land the ray on the receiving geometry. Without a height map: the\n demo's AABB clip + flat-floor projection. With one: march the ray\n against the height map — walls, ROUNDED CORNERS and stairs all\n terminate rays at their real position. (The analytic AABB attributes\n corner rays to the wrong wall face: square box vs rounded pool.)\n The caustic-clip lookup is invariant to where along the ray we stop. */\n vec3 project(vec3 origin, vec3 ray, vec3 refractedLight) {\n if (uHeightMapEnabled < 0.5) {\n vec2 tcube = intersectCube(origin, ray, vec3(-uPoolHalf.x, -uPoolHalf.y, -uPoolHalf.z), vec3(uPoolHalf.x, 2.0 * uPoolHalf.y, uPoolHalf.z));\n origin += ray * tcube.y;\n float tplane = (-origin.y - uPoolHalf.y) / refractedLight.y;\n return origin + refractedLight * tplane;\n }\n return causticMarchLightRay(origin, ray);\n }\n\n void main() {\n vec4 info = texture2D(water, position.xy / (2.0 * uPoolHalf.xz) + 0.5);\n info.ba *= uCausticIntensity; // MOD #4: was *= 0.5\n vec3 normal = vec3(info.b, sqrt(max(0.0, 1.0 - dot(info.ba, info.ba))), info.a);\n\n /* project the vertices along the refracted vertex ray */\n vec3 refractedLight = refract(-light, vec3(0.0, 1.0, 0.0), IOR_AIR / IOR_WATER);\n vRay = refract(-light, normal, IOR_AIR / IOR_WATER);\n oldPos = project(position.xzy, refractedLight, refractedLight);\n newPos = project(position.xzy + vec3(0.0, info.r, 0.0), vRay, refractedLight);\n\n // Concave-edge fade. Grazing light makes the landing mapping\n // near-singular at riser bases and wall coves — wave-normal jitter\n // funnels rays onto the exact corner line, which the area-ratio math\n // rewards with harsh max-brightness dashes. Fade landings that are\n // FLAT at their own position (small-radius gradient) but have a STEEP\n // feature nearby (large-radius gradient) — the signature of a concave\n // base line. Wall-FACE landings are steep at both radii and therefore\n // never faded; open floor is flat at both and also untouched.\n vEdgeFade = 1.0;\n if (uHeightMapEnabled > 0.5) {\n float epsNear = uPoolHalf.x / 128.0;\n float epsFar = uPoolHalf.x / 24.0;\n float gxN = causticSampleHeight(newPos.xz + vec2(epsNear, 0.0)) - causticSampleHeight(newPos.xz - vec2(epsNear, 0.0));\n float gzN = causticSampleHeight(newPos.xz + vec2(0.0, epsNear)) - causticSampleHeight(newPos.xz - vec2(0.0, epsNear));\n float gxF = causticSampleHeight(newPos.xz + vec2(epsFar, 0.0)) - causticSampleHeight(newPos.xz - vec2(epsFar, 0.0));\n float gzF = causticSampleHeight(newPos.xz + vec2(0.0, epsFar)) - causticSampleHeight(newPos.xz - vec2(0.0, epsFar));\n float flatHere = 1.0 - smoothstep(0.2, 0.6, length(vec2(gxN, gzN)) / (2.0 * epsNear));\n float steepNearby = smoothstep(0.25, 0.6, length(vec2(gxF, gzF)) / (2.0 * epsFar));\n vEdgeFade = 1.0 - steepNearby * flatHere;\n }\n\n // Caustic-clip output mirrors sampleCausticAt exactly: same projection,\n // same uPoolHalf.xz divide, same 0.75 margin. With slope = 0 (vertical\n // sun) this lands the pool floor [-uPoolHalf.xz, +uPoolHalf.xz] in\n // caustic-clip [-0.75, +0.75], leaving a 25% border for slanted-sun\n // projection drift.\n vec2 lookup = (newPos.xz - newPos.y * refractedLight.xz / refractedLight.y) / uPoolHalf.xz;\n gl_Position = vec4(0.75 * lookup, 0.0, 1.0);\n }\n"),A="\n ".concat(R,"\n varying vec3 oldPos;\n varying vec3 newPos;\n varying vec3 vRay;\n varying float vEdgeFade;\n\n void main() {\n /* if the triangle gets smaller, it gets brighter, and vice versa */\n float oldArea = length(dFdx(oldPos)) * length(dFdy(oldPos));\n float newArea = length(dFdx(newPos)) * length(dFdy(newPos));\n // vEdgeFade suppresses the fold-caustic line at concave height-field\n // edges (riser bases, wall coves) — see CAUSTICS_VERTEX.\n gl_FragColor = vec4(oldArea / newArea * 0.2 * vEdgeFade, 1.0, 0.0, 0.0);\n\n vec3 refractedLight = refract(-light, vec3(0.0, 1.0, 0.0), IOR_AIR / IOR_WATER);\n\n /* shadow for the rim of the pool */\n vec2 t = intersectCube(newPos, -refractedLight, vec3(-uPoolHalf.x, -uPoolHalf.y, -uPoolHalf.z), vec3(uPoolHalf.x, 2.0 * uPoolHalf.y, uPoolHalf.z));\n gl_FragColor.r *= 1.0 / (1.0 + exp(-200.0 / (1.0 + 10.0 * (t.y - t.x)) * (newPos.y - refractedLight.y * t.y - uPoolHalf.y / 6.0)));\n\n // MOD #7 — landing height into the blue channel (same normalization as\n // the height map). Consumers occlude fragments clearly below it.\n gl_FragColor.b = clamp((newPos.y + uPoolHalf.y) / (3.0 * uPoolHalf.y), 0.0, 1.0);\n }\n"),D={vertex:"\n uniform sampler2D water;\n uniform vec3 uPoolHalf;\n varying vec3 vWaterPos;\n void main() {\n vec4 info = texture2D(water, position.xz / (2.0 * uPoolHalf.xz) + 0.5);\n vWaterPos = vec3(position.x, info.r, position.z);\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position.x, info.r, position.z, 1.0);\n }\n",fragment:k},W={vertex:T,fragment:A};function ownKeys(t,r){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);r&&(o=o.filter((function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable}))),a.push.apply(a,o)}return a}function _objectSpread(t){for(var r=1;r<arguments.length;r++){var a=null!=arguments[r]?arguments[r]:{};r%2?ownKeys(Object(a),!0).forEach((function(r){(0,v.Z)(t,r,a[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):ownKeys(Object(a)).forEach((function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(a,r))}))}return t}function buildSharedUniformValues(t){var r,a,o,i,l,c,h,d;return{light:{value:(null!==(r=t.light)&&void 0!==r?r:new u.Pa4(.7071,.7071,0)).clone()},water:{value:null!==(a=t.water)&&void 0!==a?a:null},causticTex:{value:null!==(o=t.causticTex)&&void 0!==o?o:null},uPoolHalf:{value:(null!==(i=t.uPoolHalf)&&void 0!==i?i:new u.Pa4(1,1,1)).clone()},uWallColor:{value:(null!==(l=t.uWallColor)&&void 0!==l?l:new u.Pa4(.7,.78,.85)).clone()},uSkyHorizonColor:{value:(null!==(c=t.uSkyHorizonColor)&&void 0!==c?c:new u.Pa4(.78,.85,.95)).clone()},uSkyZenithColor:{value:(null!==(h=t.uSkyZenithColor)&&void 0!==h?h:new u.Pa4(.18,.36,.78)).clone()},uWaterClarity:{value:null!==(d=t.uWaterClarity)&&void 0!==d?d:0}}}function updateSharedUniforms(t,r){var a=t.uniforms;r.light&&a.light.value.copy(r.light),void 0!==r.water&&(a.water.value=r.water),void 0!==r.causticTex&&(a.causticTex.value=r.causticTex),r.uPoolHalf&&a.uPoolHalf.value.copy(r.uPoolHalf),r.uWallColor&&a.uWallColor.value.copy(r.uWallColor),r.uSkyHorizonColor&&a.uSkyHorizonColor.value.copy(r.uSkyHorizonColor),r.uSkyZenithColor&&a.uSkyZenithColor.value.copy(r.uSkyZenithColor),void 0!==r.uWaterClarity&&(a.uWaterClarity.value=r.uWaterClarity)}var L=a(82),O="\n varying vec2 coord;\n void main() {\n coord = position.xy * 0.5 + 0.5;\n gl_Position = vec4(position.xyz, 1.0);\n }\n",I="\n const float PI = 3.141592653589793;\n uniform sampler2D tSrc;\n uniform vec2 center; // pool-normalized [-1, 1]\n uniform float radius; // WORLD METERS\n uniform float strength;\n uniform vec2 poolHalf; // (vx, vz) world half-extents (meters)\n varying vec2 coord;\n void main() {\n vec4 info = texture2D(tSrc, coord);\n\n vec2 texelWorld = (coord * 2.0 - 1.0) * poolHalf;\n vec2 centerWorld = center * poolHalf;\n float drop = max(0.0, 1.0 - distance(texelWorld, centerWorld) / radius);\n drop = 0.5 - cos(drop * PI) * 0.5;\n info.r += drop * strength;\n\n gl_FragColor = info;\n }\n",Z="\n uniform sampler2D tSrc;\n uniform vec2 delta;\n uniform float damping;\n varying vec2 coord;\n void main() {\n /* get vertex info */\n vec4 info = texture2D(tSrc, coord);\n\n /* calculate average neighbor height */\n vec2 dx = vec2(delta.x, 0.0);\n vec2 dy = vec2(0.0, delta.y);\n float average = (\n texture2D(tSrc, coord - dx).r +\n texture2D(tSrc, coord - dy).r +\n texture2D(tSrc, coord + dx).r +\n texture2D(tSrc, coord + dy).r\n ) * 0.25;\n\n /* change the velocity to move toward the average */\n info.g += (average - info.r) * 2.0;\n\n /* attenuate the velocity a little so waves do not last forever */\n info.g *= damping;\n\n /* move the vertex along the velocity */\n info.r += info.g;\n\n gl_FragColor = info;\n }\n",E="\n uniform sampler2D tSrc;\n uniform vec2 delta;\n varying vec2 coord;\n void main() {\n /* get vertex info */\n vec4 info = texture2D(tSrc, coord);\n\n /* update the normal */\n vec3 dx = vec3(delta.x, texture2D(tSrc, vec2(coord.x + delta.x, coord.y)).r - info.r, 0.0);\n vec3 dy = vec3(0.0, texture2D(tSrc, vec2(coord.x, coord.y + delta.y)).r - info.r, delta.y);\n info.ba = normalize(cross(dy, dx)).xz;\n\n gl_FragColor = info;\n }\n",_=function(){return(0,d.Z)((function Heightfield(){var t,r,a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(0,h.Z)(this,Heightfield),(0,v.Z)(this,"sizeX",void 0),(0,v.Z)(this,"sizeY",void 0),(0,v.Z)(this,"delta",void 0),(0,v.Z)(this,"poolHalf",void 0),(0,v.Z)(this,"rtA",void 0),(0,v.Z)(this,"rtB",void 0),(0,v.Z)(this,"scene",void 0),(0,v.Z)(this,"camera",void 0),(0,v.Z)(this,"quad",void 0),(0,v.Z)(this,"dropMat",void 0),(0,v.Z)(this,"updateMat",void 0),(0,v.Z)(this,"normalMat",void 0),(0,v.Z)(this,"clearedOnce",!1),this.sizeX=null!==(t=a.sizeX)&&void 0!==t?t:256,this.sizeY=null!==(r=a.sizeY)&&void 0!==r?r:this.sizeX,this.delta=new u.FM8(1/this.sizeX,1/this.sizeY),this.poolHalf=new u.FM8(1,1),a.poolHalf&&this.poolHalf.copy(a.poolHalf);var o={type:u.cLu,format:u.wk1,wrapS:u.uWy,wrapT:u.uWy,magFilter:u.wem,minFilter:u.wem,depthBuffer:!1,stencilBuffer:!1};this.rtA=new u.dd2(this.sizeX,this.sizeY,o),this.rtB=new u.dd2(this.sizeX,this.sizeY,o),this.scene=new u.xsS,this.camera=new u.iKG(-1,1,1,-1,0,1),this.quad=new u.Kj0(new u._12(2,2)),this.scene.add(this.quad),this.dropMat=new u.jyz({vertexShader:O,fragmentShader:I,uniforms:{tSrc:{value:null},center:{value:new u.FM8(0,0)},radius:{value:.1},strength:{value:.01},poolHalf:{value:this.poolHalf}},depthTest:!1,depthWrite:!1}),this.updateMat=new u.jyz({vertexShader:O,fragmentShader:Z,uniforms:{tSrc:{value:null},delta:{value:this.delta},damping:{value:.995}},depthTest:!1,depthWrite:!1}),this.normalMat=new u.jyz({vertexShader:O,fragmentShader:E,uniforms:{tSrc:{value:null},delta:{value:this.delta}},depthTest:!1,depthWrite:!1})}),[{key:"currentTexture",get:function get(){return this.rtA.texture}},{key:"ensureCleared",value:function ensureCleared(t){var r=this;this.clearedOnce||((0,p.s)(t,{target:this.rtA,clearColor:0,clearAlpha:0},(function(){t.clear(!0,!0,!0),t.setRenderTarget(r.rtB),t.clear(!0,!0,!0)})),this.clearedOnce=!0)}},{key:"renderPass",value:function renderPass(t,r){this.quad.material=r,t.setRenderTarget(this.rtB),t.render(this.scene,this.camera),t.setRenderTarget(null);var a=[this.rtB,this.rtA];this.rtA=a[0],this.rtB=a[1]}},{key:"addDrop",value:function addDrop(t,r){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.1,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:.01;this.ensureCleared(t),this.dropMat.uniforms.tSrc.value=this.rtA.texture,this.dropMat.uniforms.center.value.copy(r),this.dropMat.uniforms.radius.value=a,this.dropMat.uniforms.strength.value=o,this.renderPass(t,this.dropMat)}},{key:"step",value:function step(t){this.ensureCleared(t),this.updateMat.uniforms.tSrc.value=this.rtA.texture,this.renderPass(t,this.updateMat)}},{key:"setDamping",value:function setDamping(t){this.updateMat.uniforms.damping.value=t}},{key:"updateNormals",value:function updateNormals(t){this.ensureCleared(t),this.normalMat.uniforms.tSrc.value=this.rtA.texture,this.renderPass(t,this.normalMat)}},{key:"dispose",value:function dispose(){this.rtA.dispose(),this.rtB.dispose(),this.dropMat.dispose(),this.updateMat.dispose(),this.normalMat.dispose(),this.quad.geometry.dispose()}}])}(),j=function(){return(0,d.Z)((function CausticsTexture(){var t,r,a,o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(0,h.Z)(this,CausticsTexture),(0,v.Z)(this,"size",void 0),(0,v.Z)(this,"poolHalf",void 0),(0,v.Z)(this,"rt",void 0),(0,v.Z)(this,"scene",void 0),(0,v.Z)(this,"camera",void 0),(0,v.Z)(this,"quad",void 0),(0,v.Z)(this,"material",void 0),this.size=null!==(t=o.size)&&void 0!==t?t:1024;var i=null!==(r=o.detail)&&void 0!==r?r:200;this.poolHalf=(null!==(a=o.poolHalf)&&void 0!==a?a:new u.Pa4(1,1,1)).clone(),this.rt=new u.dd2(this.size,this.size,{type:u.ywz,format:u.wk1,depthBuffer:!1,stencilBuffer:!1,generateMipmaps:!0,minFilter:u.D1R}),this.scene=new u.xsS,this.camera=new u.iKG(-1,1,1,-1,0,1),this.material=new u.jyz({vertexShader:W.vertex,fragmentShader:W.fragment,uniforms:{light:{value:new u.Pa4(.7071,.7071,0)},water:{value:null},uPoolHalf:{value:this.poolHalf.clone()},uCausticIntensity:{value:.5},uHeightMap:{value:null},uHeightMapEnabled:{value:0}},depthTest:!1,depthWrite:!1});var l=this.poolHalf.x,c=this.poolHalf.z,d=Math.max(l,c),p=i/Math.max(.001,2*d),m=Math.max(32,Math.round(2*l*p)),g=Math.max(32,Math.round(2*c*p));this.quad=new u.Kj0(new u._12(2*l,2*c,m,g),this.material),this.scene.add(this.quad)}),[{key:"texture",get:function get(){return this.rt.texture}},{key:"render",value:function render(t){var r=this;(0,p.s)(t,{target:this.rt,clearColor:0,clearAlpha:0},(function(){t.clear(!0,!1,!1),t.render(r.scene,r.camera)}))}},{key:"setHeightfield",value:function setHeightfield(t){this.material.uniforms.water.value=t}},{key:"setLight",value:function setLight(t,r,a){this.material.uniforms.light.value.set(t,r,a)}},{key:"setIntensity",value:function setIntensity(t){this.material.uniforms.uCausticIntensity.value=t}},{key:"setHeightMap",value:function setHeightMap(t){this.material.uniforms.uHeightMap.value=t,this.material.uniforms.uHeightMapEnabled.value=t?1:0}},{key:"dispose",value:function dispose(){this.rt.dispose(),this.material.dispose(),this.quad.geometry.dispose()}}])}();function useWaveSimulation_createForOfIteratorHelper(t,r){var a="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!a){if(Array.isArray(t)||(a=function useWaveSimulation_unsupportedIterableToArray(t,r){if(t){if("string"==typeof t)return useWaveSimulation_arrayLikeToArray(t,r);var a={}.toString.call(t).slice(8,-1);return"Object"===a&&t.constructor&&(a=t.constructor.name),"Map"===a||"Set"===a?Array.from(t):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?useWaveSimulation_arrayLikeToArray(t,r):void 0}}(t))||r&&t&&"number"==typeof t.length){a&&(t=a);var o=0,i=function F(){};return{s:i,n:function n(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}},e:function e(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var l,c=!0,u=!1;return{s:function s(){a=a.call(t)},n:function n(){var t=a.next();return c=t.done,t},e:function e(t){u=!0,l=t},f:function f(){try{c||null==a.return||a.return()}finally{if(u)throw l}}}}function useWaveSimulation_arrayLikeToArray(t,r){(null==r||r>t.length)&&(r=t.length);for(var a=0,o=Array(r);a<r;a++)o[a]=t[a];return o}var B=function(){return(0,d.Z)((function SubstepAccumulator(){(0,h.Z)(this,SubstepAccumulator),(0,v.Z)(this,"leftover",0)}),[{key:"take",value:function take(t,r){this.leftover+=t*Math.min(r,.06666666666666667);var a=Math.floor(this.leftover);return this.leftover-=a,a}},{key:"reset",value:function reset(){this.leftover=0}}])}();var N={off:0,overlay:1,isolate:2,mask:3,landing:4,heightmap:5};var V=a(120),U=a(7514);function WaterSurfaceRenderer(t){var r=t.position,a=t.volumeSize,o=t.sunDirection,h=t.wallColor,d=t.skyHorizonColor,v=t.skyZenithColor,p=t.heightfieldSize,g=t.causticTextureSize,y=t.substeps,x=t.ambientDropPeriod,w=t.pointerStrength,b=t.causticIntensity,S=t.waterClarity,P=t.useScreenSpaceRefraction,C=t.refractionFallbackColor,M=t.fresnelMax,z=t.causticDebugMode,R=(0,i.useRef)(null),k=(0,i.useRef)(null),T=(0,c.D)((function(t){return t.gl})),A=(0,c.D)((function(t){return t.camera})),W=(0,c.D)((function(t){return t.scene})),O=(0,c.D)((function(t){return t.size})),I=(0,i.useRef)(null);null===I.current&&(I.current=new H);var Z=(0,i.useRef)(null);null===Z.current&&(Z.current=new m);var E=(0,i.useMemo)((function(){return new u.Pa4(a[0]/2,a[1],a[2]/2)}),[a[0],a[1],a[2]]),X=function useWaveSimulation(t){var r=t.poolHalf,a=t.heightfieldSize,o=t.causticTextureSize,l=t.substeps,h=t.ambientDropPeriod,d=(0,c.D)((function(t){return t.gl})),v=(0,i.useRef)(null),p=(0,i.useRef)(null),m=(0,i.useRef)([]),g=(0,i.useRef)(!1),y=(0,i.useRef)(0),x=(0,i.useRef)(new B),w=(0,i.useMemo)((function(){var t=r.x,o=r.z,i=a/(2*Math.max(t,o));return{sizeX:Math.max(32,Math.round(2*t*i)),sizeY:Math.max(32,Math.round(2*o*i)),poolHalfX:t,poolHalfZ:o,poolDepth:r.y}}),[r.x,r.y,r.z,a]);return(0,i.useEffect)((function(){var t=new _({sizeX:w.sizeX,sizeY:w.sizeY,poolHalf:new u.FM8(w.poolHalfX,w.poolHalfZ)}),r=new j({poolHalf:new u.Pa4(w.poolHalfX,w.poolDepth,w.poolHalfZ),size:o});return v.current=t,p.current=r,g.current=!1,x.current.reset(),function(){t.dispose(),r.dispose(),v.current=null,p.current=null}}),[w,o]),{queueDrop:(0,i.useCallback)((function(t,r,a){m.current.push({center:t,radius:r,strength:a})}),[]),advance:function advance(t){var r=v.current,a=p.current;if(!r||!a)return!1;if(!g.current){for(var o=0;o<10;o++){var i=2*Math.random()-1,c=2*Math.random()-1;r.addDrop(d,new u.FM8(i,c),.3,1&o?.04:-.04)}g.current=!0}if(h>0&&(y.current+=t,y.current>=h)){y.current=0;var w=2*Math.random()-1,b=2*Math.random()-1;r.addDrop(d,new u.FM8(w,b),.24,.04)}if(m.current.length>0){var S,P=useWaveSimulation_createForOfIteratorHelper(m.current);try{for(P.s();!(S=P.n()).done;){var C=S.value;r.addDrop(d,C.center,C.radius,C.strength)}}catch(t){P.e(t)}finally{P.f()}m.current.length=0}var M=60*l;if(M>0){r.setDamping(Math.pow(.547,1/M));for(var H=x.current.take(M,t),z=0;z<H;z++)r.step(d)}return r.updateNormals(d),!0},setHeightMap:function setHeightMap(t){var r;null===(r=p.current)||void 0===r||r.setHeightMap(t)},renderCaustics:function renderCaustics(t,r){var a=v.current,o=p.current;a&&o&&(o.setHeightfield(a.currentTexture),o.setLight(t.x,t.y,t.z),o.setIntensity(r),o.render(d))},get heightTexture(){var t,r;return null!==(t=null===(r=v.current)||void 0===r?void 0:r.currentTexture)&&void 0!==t?t:null},get causticTexture(){var t,r;return null!==(t=null===(r=p.current)||void 0===r?void 0:r.texture)&&void 0!==t?t:null}}}({poolHalf:E,heightfieldSize:p,causticTextureSize:g,substeps:y,ambientDropPeriod:x}),q=function useWaterPointer(t,r){var a=(0,i.useCallback)((function(r,a){r.uv&&t(new u.FM8(2*r.uv.x-1,1-2*r.uv.y),.1,a)}),[t]);return{onPointerMove:(0,i.useCallback)((function(t){return a(t,.01*r)}),[a,r]),onPointerDown:(0,i.useCallback)((function(t){return a(t,.04*r)}),[a,r])}}(X.queueDrop,w),Y=(0,i.useMemo)((function(){var t=function segs(t){return Math.max(32,Math.min(256,Math.round(50*t)))},r=new u._12(2*E.x,2*E.z,t(2*E.x),t(2*E.z));r.rotateX(Math.PI/2);for(var a=r.attributes.normal.array,o=1;o<a.length;o+=3)a[o]=1;return r}),[E.x,E.z]),J=(0,i.useMemo)((function(){return new u._12(2*E.x,2*E.z)}),[E.x,E.z]),K=(0,i.useMemo)((function(){return new u.vBJ({colorWrite:!1,depthWrite:!1,side:u.ehD})}),[]),Q=(0,i.useMemo)((function(){return function createWaterSurfaceAboveMaterial(){var t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new u.jyz({vertexShader:D.vertex,fragmentShader:D.fragment,uniforms:_objectSpread(_objectSpread({},buildSharedUniformValues(r)),{},{eye:{value:(null!==(t=r.eye)&&void 0!==t?t:new u.Pa4(0,5,5)).clone()},uSceneColor:{value:null},uResolution:{value:new u.FM8(1,1)},uUseScreenSpaceRefraction:{value:0},uRefractionFallbackColor:{value:new u.Pa4(.039,.145,.251)},uFresnelMax:{value:1},uCausticDebugMode:{value:0},uPoolHeightMap:{value:null}}),transparent:!1,side:u.ehD})}({uPoolHalf:E.clone(),uWallColor:colorToVec3(h),uSkyHorizonColor:colorToVec3(d),uSkyZenithColor:colorToVec3(v)})}),[]);(0,i.useEffect)((function(){return function(){Y.dispose(),J.dispose()}}),[Y,J]),(0,i.useEffect)((function(){return function(){K.dispose(),Q.dispose()}}),[K,Q]),(0,i.useEffect)((function(){updateSharedUniforms(Q,{uPoolHalf:E}),L.f.poolHalf.copy(E)}),[E,Q]),(0,i.useEffect)((function(){return function(){(0,L.g)()}}),[]),(0,i.useEffect)((function(){return function(){var t,r;null===(t=I.current)||void 0===t||t.dispose(),I.current=null,null===(r=Z.current)||void 0===r||r.dispose(),Z.current=null}}),[]),(0,i.useEffect)((function(){var t=colorToVec3(h),r=colorToVec3(d),a=colorToVec3(v);updateSharedUniforms(Q,{uWallColor:t,uSkyHorizonColor:r,uSkyZenithColor:a,uWaterClarity:S})}),[h,d,v,S,Q]),(0,i.useEffect)((function(){var t=colorToVec3(C);Q.uniforms.uRefractionFallbackColor.value.copy(t)}),[C,Q]);var $=(0,i.useRef)(new u.Pa4),ee=(0,i.useRef)(new u.Pa4);return(0,c.F)((function(t,r){if(!T.getContext().isContextLost()){try{!function frameBody(){if(X.advance(r)){var t=R.current;if(t){var a=t.position;$.current.set(A.position.x-a.x,A.position.y-a.y,A.position.z-a.z)}else $.current.copy(A.position);ee.current.set(o[0],o[1],o[2]).normalize(),t&&t.getWorldPosition(L.f.volumeCenter);var i=l.tb.getState(),c=i.articleVersion+i.decorVersion,u=Z.current;u&&(u.renderIfNeeded(T,W,L.f.volumeCenter,E,c,[t]),X.setHeightMap(u.texture)),X.renderCaustics(ee.current,b),updateSharedUniforms(Q,{water:X.heightTexture,causticTex:X.causticTexture,light:ee.current}),Q.uniforms.eye.value.copy($.current);var h=I.current;h&&P&&h.update({renderer:T,scene:W,camera:A,material:Q,surfaceMesh:k.current,volumeCenter:L.f.volumeCenter,poolHalf:E,cssWidth:O.width,cssHeight:O.height,geometryVersion:c,sceneMutating:i.isDragging||null!==i.accessoryMove}),Q.uniforms.uUseScreenSpaceRefraction.value=P?1:0,Q.uniforms.uFresnelMax.value=M,L.f.waterTex=X.heightTexture,L.f.causticTex=X.causticTexture,L.f.light.copy(ee.current),function publishCausticDebugMode(t,r){var a=N[r];L.f.causticDebugMode=a<=3?a:0,t.uniforms.uCausticDebugMode.value=a}(Q,z),Q.uniforms.uPoolHeightMap.value=u?u.texture:null,L.f.enabled=!0}}()}catch(t){if(!T.getContext().isContextLost())throw t;l.tb.getState().setGLContextLost(!0)}}}),V.l.WATER_CAPTURE),(0,U.jsxs)("group",{ref:R,position:r,children:[(0,U.jsx)("mesh",{ref:k,geometry:Y,material:Q,raycast:G}),(0,U.jsx)("mesh",{geometry:J,material:K,rotation:[-Math.PI/2,0,0],onPointerMove:q.onPointerMove,onPointerDown:q.onPointerDown})]})}var G=function NOOP_RAYCAST(){};function colorToVec3(t){var r=new u.Ilk(t);return new u.Pa4(r.r,r.g,r.b)}var X=a(7067);function WaterSurface(){var t,r,a=(0,l.tb)((function(t){return t.resolvedEnvironment.water})),c=(0,l.tb)((function(t){return t.resolvedEnvironment.lighting.sun})),u=(0,l.tb)((function(t){return t.waterVolumeOverride})),h=(0,i.useState)(u),d=(0,o.Z)(h,2),v=d[0],p=d[1];(0,i.useEffect)((function(){if(u!==v){var t=window.setTimeout((function(){return p(u)}),300);return function(){return window.clearTimeout(t)}}}),[u,v]);var m=a.causticSun,g=(0,i.useMemo)((function(){return m?(0,X.mo)(m.azimuth,m.elevation):(0,X.ww)(c)}),[m,c]);return(0,U.jsx)(WaterSurfaceRenderer,{position:null!==(t=null==v?void 0:v.center)&&void 0!==t?t:a.volume.center,volumeSize:null!==(r=null==v?void 0:v.size)&&void 0!==r?r:a.volume.size,sunDirection:g,wallColor:a.wallColor,skyHorizonColor:a.skyHorizonColor,skyZenithColor:a.skyZenithColor,waterClarity:a.waterClarity,ambientDropPeriod:a.ambientDropPeriod,pointerStrength:a.pointerStrength,heightfieldSize:a.heightfieldSize,causticTextureSize:a.causticTextureSize,causticIntensity:a.causticIntensity,useScreenSpaceRefraction:a.useScreenSpaceRefraction,refractionFallbackColor:a.refractionFallbackColor,fresnelMax:a.fresnelMax,causticDebugMode:a.causticDebugMode,substeps:a.waveSpeed})}}}]);
|
|
2
|
+
"use strict";(self.webpackChunkCrystaldesignRealTimeViewerNext=self.webpackChunkCrystaldesignRealTimeViewerNext||[]).push([[463],{3463:(t,r,a)=>{a.r(r),a.d(r,{WaterSurface:()=>WaterSurface});var o=a(7080),i=a(7363),l=a(505),c=a(4088),u=a(6831),h=a(5590),d=a(7582),v=a(5150),p=a(2942);function _createForOfIteratorHelper(t,r){var a="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!a){if(Array.isArray(t)||(a=function _unsupportedIterableToArray(t,r){if(t){if("string"==typeof t)return _arrayLikeToArray(t,r);var a={}.toString.call(t).slice(8,-1);return"Object"===a&&t.constructor&&(a=t.constructor.name),"Map"===a||"Set"===a?Array.from(t):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?_arrayLikeToArray(t,r):void 0}}(t))||r&&t&&"number"==typeof t.length){a&&(t=a);var o=0,i=function F(){};return{s:i,n:function n(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}},e:function e(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var l,c=!0,u=!1;return{s:function s(){a=a.call(t)},n:function n(){var t=a.next();return c=t.done,t},e:function e(t){u=!0,l=t},f:function f(){try{c||null==a.return||a.return()}finally{if(u)throw l}}}}function _arrayLikeToArray(t,r){(null==r||r>t.length)&&(r=t.length);for(var a=0,o=Array(r);a<r;a++)o[a]=t[a];return o}var m=function(){return(0,d.Z)((function PoolHeightMap(){(0,h.Z)(this,PoolHeightMap),(0,v.Z)(this,"rt",void 0),(0,v.Z)(this,"overrideMaterial",void 0),(0,v.Z)(this,"camera",void 0),(0,v.Z)(this,"lastCenter",new u.Pa4(1/0,1/0,1/0)),(0,v.Z)(this,"lastHalf",new u.Pa4(0,0,0)),(0,v.Z)(this,"lastGeometryVersion",-1),(0,v.Z)(this,"age",120),this.rt=new u.dd2(256,256,{type:u.cLu,format:u.wk1,depthBuffer:!0,stencilBuffer:!1,minFilter:u.wem,magFilter:u.wem}),this.camera=new u.iKG(-1,1,1,-1,.01,1),this.overrideMaterial=new u.jyz({vertexShader:"\n uniform vec3 uVolumeCenter;\n uniform vec3 uPoolHalf;\n varying float vHeightEncoded;\n void main() {\n vec4 worldPosition = vec4(position, 1.0);\n #ifdef USE_INSTANCING\n worldPosition = instanceMatrix * worldPosition;\n #endif\n worldPosition = modelMatrix * worldPosition;\n vHeightEncoded = (worldPosition.y - uVolumeCenter.y + uPoolHalf.y) / (3.0 * uPoolHalf.y);\n gl_Position = projectionMatrix * viewMatrix * worldPosition;\n }\n",fragmentShader:"\n varying float vHeightEncoded;\n void main() {\n gl_FragColor = vec4(vHeightEncoded, 0.0, 0.0, 1.0);\n }\n",uniforms:{uVolumeCenter:{value:new u.Pa4},uPoolHalf:{value:new u.Pa4(1,1,1)}},side:u.ehD})}),[{key:"texture",get:function get(){return this.rt.texture}},{key:"updateCamera",value:function updateCamera(t,r){var a=this.camera;a.up.set(0,0,-1),a.position.set(t.x,t.y+.3,t.z),a.lookAt(t.x,t.y-r.y,t.z),a.left=-r.x,a.right=r.x,a.top=-r.z,a.bottom=r.z,a.near=.01,a.far=.3+r.y+.5,a.updateProjectionMatrix(),a.updateMatrixWorld(!0)}},{key:"renderIfNeeded",value:function renderIfNeeded(t,r,a,o,i,l){var c=this;if(this.age+=1,!(i!==this.lastGeometryVersion||!a.equals(this.lastCenter)||!o.equals(this.lastHalf)||this.age>=120))return!1;this.overrideMaterial.uniforms.uVolumeCenter.value.copy(a),this.overrideMaterial.uniforms.uPoolHalf.value.copy(o),this.updateCamera(a,o);var h,d=[],v=_createForOfIteratorHelper(l);try{for(v.s();!(h=v.n()).done;){var m=h.value;m&&m.visible&&(m.visible=!1,d.push(m))}}catch(t){v.e(t)}finally{v.f()}r.traverse((function(t){var r=t;if(t.visible){if(r.isLine||r.isPoints||r.isSprite)return t.visible=!1,void d.push(t);if(r.isMesh){var a=t,o=a.material,i=function receives(t){if(!(t instanceof u.Wid))return!1;if(t.transparent||t.opacity<1)return!1;var r=t.transmission;return!("number"==typeof r&&r>0)};(Array.isArray(o)?o.some(i):i(o))||(a.visible=!1,d.push(a))}}}));var g=r.overrideMaterial,y=r.background;try{(0,p.s)(t,{target:this.rt,clearColor:0,clearAlpha:1},(function(){t.clear(!0,!0,!1),r.background=null,r.overrideMaterial=c.overrideMaterial,t.render(r,c.camera)}))}finally{r.overrideMaterial=g,r.background=y;for(var x=0,w=d;x<w.length;x++){w[x].visible=!0}}return this.lastCenter.copy(a),this.lastHalf.copy(o),this.lastGeometryVersion=i,this.age=0,!0}},{key:"dispose",value:function dispose(){this.rt.dispose(),this.overrideMaterial.dispose()}}])}();function SceneCapture_createForOfIteratorHelper(t,r){var a="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!a){if(Array.isArray(t)||(a=function SceneCapture_unsupportedIterableToArray(t,r){if(t){if("string"==typeof t)return SceneCapture_arrayLikeToArray(t,r);var a={}.toString.call(t).slice(8,-1);return"Object"===a&&t.constructor&&(a=t.constructor.name),"Map"===a||"Set"===a?Array.from(t):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?SceneCapture_arrayLikeToArray(t,r):void 0}}(t))||r&&t&&"number"==typeof t.length){a&&(t=a);var o=0,i=function F(){};return{s:i,n:function n(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}},e:function e(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var l,c=!0,u=!1;return{s:function s(){a=a.call(t)},n:function n(){var t=a.next();return c=t.done,t},e:function e(t){u=!0,l=t},f:function f(){try{c||null==a.return||a.return()}finally{if(u)throw l}}}}function SceneCapture_arrayLikeToArray(t,r){(null==r||r>t.length)&&(r=t.length);for(var a=0,o=Array(r);a<r;a++)o[a]=t[a];return o}var g=new u.ZzF,y=function(){return(0,d.Z)((function SceneCapture(){var t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(0,h.Z)(this,SceneCapture),(0,v.Z)(this,"rt",void 0),(0,v.Z)(this,"width",0),(0,v.Z)(this,"height",0),this.rt=new u.dd2(1,1,{type:u.cLu,format:null!==(t=r.format)&&void 0!==t?t:u.wk1,depthBuffer:!0,stencilBuffer:!1,minFilter:u.wem,magFilter:u.wem}),this.width=1,this.height=1}),[{key:"texture",get:function get(){return this.rt.texture}},{key:"resizeIfNeeded",value:function resizeIfNeeded(t,r,a){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,i=Math.max(1,Math.round(t*a*o)),l=Math.max(1,Math.round(r*a*o));return(i!==this.width||l!==this.height)&&(this.rt.setSize(i,l),this.width=i,this.height=l,!0)}},{key:"render",value:function render(t,r,a,o,i,l,c){var h,d=this,v=[],m=SceneCapture_createForOfIteratorHelper(o);try{for(m.s();!(h=m.n()).done;){var y=h.value;y&&y.visible&&(y.visible=!1,v.push(y))}}catch(t){m.e(t)}finally{m.f()}c&&r.traverse((function(t){var r=t;if(r.isMesh&&r.visible){var a=r.geometry;if(a){null===a.boundingBox&&a.computeBoundingBox();var o=a.boundingBox;o&&(g.copy(o).applyMatrix4(r.matrixWorld),g.intersectsBox(c)||(r.visible=!1,v.push(r)))}}})),this.rt.scissorTest=!1;var x=r.background;r.background=null;try{(0,p.s)(t,{target:this.rt,toneMapping:u.uL9,clearAlpha:0,clippingPlanes:i},(function(){t.clear(!0,!0,!1),l&&(d.rt.scissor.copy(l),d.rt.scissorTest=!0,t.setRenderTarget(d.rt));try{t.render(r,a)}finally{d.rt.scissorTest=!1}}))}finally{r.background=x;for(var w=0,b=v;w<b.length;w++){b[w].visible=!0}}}},{key:"dispose",value:function dispose(){this.rt.dispose()}}])}(),x=a(8133),w=new u.ZzF,b=new u.iWj,S=new u.yGw,P=new u.Ltg,C=new u.Ltg,M=new u.FM8;var H=function(){return(0,d.Z)((function RefractionCapture(){(0,h.Z)(this,RefractionCapture),(0,v.Z)(this,"capture",new y),(0,v.Z)(this,"clipPlanes",[new u.JOQ(new u.Pa4(-1,0,0),0),new u.JOQ(new u.Pa4(1,0,0),0),new u.JOQ(new u.Pa4(0,-1,0),0),new u.JOQ(new u.Pa4(0,1,0),0),new u.JOQ(new u.Pa4(0,0,-1),0),new u.JOQ(new u.Pa4(0,0,1),0)]),(0,v.Z)(this,"framesSinceCapture",15),(0,v.Z)(this,"capturedViewProj",new u.yGw),(0,v.Z)(this,"capturedBox",new u.ZzF),(0,v.Z)(this,"capturedGeometryVersion",-1)}),[{key:"texture",get:function get(){return this.capture.texture}},{key:"update",value:function update(t){var r=t.renderer,a=t.camera,o=t.material,i=t.volumeCenter,l=t.poolHalf,c=this.capture.resizeIfNeeded(t.cssWidth,t.cssHeight,r.getPixelRatio(),.5);o.uniforms.uSceneColor.value=this.capture.texture,r.getDrawingBufferSize(M),o.uniforms.uResolution.value.set(1/Math.max(1,M.x),1/Math.max(1,M.y));var u=i.x,h=i.y,d=i.z,v=l.x+.25,p=l.y,m=l.z+.25;this.clipPlanes[0].constant=u+v,this.clipPlanes[1].constant=v-u,this.clipPlanes[2].constant=h,this.clipPlanes[3].constant=p-h,this.clipPlanes[4].constant=d+m,this.clipPlanes[5].constant=m-d,w.min.set(u-v,h-p-.4,d-m),w.max.set(u+v,h+.4,d+m),a.updateMatrixWorld(),S.multiplyMatrices(a.projectionMatrix,a.matrixWorldInverse),b.setFromProjectionMatrix(S);var g=t.sceneMutating||t.geometryVersion!==this.capturedGeometryVersion||!w.equals(this.capturedBox)||!function matricesApproxEqual(t,r,a){for(var o=t.elements,i=r.elements,l=0;l<16;l++)if(Math.abs(o[l]-i[l])>a)return!1;return!0}(S,this.capturedViewProj,1e-6);if(this.framesSinceCapture+=1,function isCaptureDue(t,r,a){return a||t>=(r?1:15)}(this.framesSinceCapture,g,c)&&b.intersectsBox(w)){var y=function fitScissorToBox(t,r,a,o,i,l){for(var c=1/0,u=1/0,h=-1/0,d=-1/0,v=0;v<8;v++){if(C.set(1&v?t.max.x:t.min.x,2&v?t.max.y:t.min.y,4&v?t.max.z:t.min.z,1).applyMatrix4(r),C.w<=1e-6)return!1;var p=C.x/C.w,m=C.y/C.w;p<c&&(c=p),p>h&&(h=p),m<u&&(u=m),m>d&&(d=m)}var g=i*a+1,y=i*o+1,x=Math.max(0,Math.floor((.5*c+.5)*a-g)),w=Math.max(0,Math.floor((.5*u+.5)*o-y)),b=Math.min(a,Math.ceil((.5*h+.5)*a+g)),S=Math.min(o,Math.ceil((.5*d+.5)*o+y));return!(b<=x||S<=w)&&(l.set(x,w,b-x,S-w),!0)}(w,S,this.capture.width,this.capture.height,.03,P);(0,x.Jm)(!0);try{this.capture.render(r,t.scene,a,[t.surfaceMesh],this.clipPlanes,y?P:null,w)}finally{(0,x.Jm)(!1)}this.framesSinceCapture=0,this.capturedViewProj.copy(S),this.capturedBox.copy(w),this.capturedGeometryVersion=t.geometryVersion}}},{key:"dispose",value:function dispose(){this.capture.dispose()}}])}();var z=a(7534),R="\n const float IOR_AIR = 1.0;\n const float IOR_WATER = 1.333;\n uniform vec3 light;\n uniform vec3 uPoolHalf; // (halfX, depth, halfZ) — see file header\n uniform sampler2D water;\n\n vec2 intersectCube(vec3 origin, vec3 ray, vec3 cubeMin, vec3 cubeMax) {\n vec3 tMin = (cubeMin - origin) / ray;\n vec3 tMax = (cubeMax - origin) / ray;\n vec3 t1 = min(tMin, tMax);\n vec3 t2 = max(tMin, tMax);\n float tNear = max(max(t1.x, t1.y), t1.z);\n float tFar = min(min(t2.x, t2.y), t2.z);\n return vec2(tNear, tFar);\n }\n";function heightSamplerGLSL(t,r){return"\n float ".concat(t,"(vec2 xz) {\n float encoded = texture2D(").concat(r,", xz / (2.0 * uPoolHalf.xz) + 0.5).r;\n return clamp(encoded * 3.0 * uPoolHalf.y - uPoolHalf.y, -uPoolHalf.y, 0.0);\n }\n")}function heightFieldMarchGLSL(t){var r=t.name,a=t.sampler,o=t.coarseSteps,i=t.guardShallowRays,l=["for (int k = 0; k < 3; k++) {"," p += ray * ((".concat(a,"(p.xz) - p.y) / ray.y);"),"}"],c=i?["if (ray.y < -0.001) {"].concat((0,z.Z)(l.map((function(t){return" ".concat(t)}))),["}"]):l;return"\n vec3 ".concat(r,"(vec3 origin, vec3 ray) {\n vec2 t = intersectCube(origin, ray, vec3(-uPoolHalf.x, -uPoolHalf.y, -uPoolHalf.z), vec3(uPoolHalf.x, 2.0 * uPoolHalf.y, uPoolHalf.z));\n float tEnd = max(t.y, 0.0);\n float lo = 0.0;\n float hi = tEnd;\n bool crossed = false;\n for (int i = 1; i <= ").concat(o,"; i++) {\n float ti = tEnd * float(i) / ").concat(o.toFixed(1),";\n vec3 p = origin + ray * ti;\n if (p.y <= ").concat(a,"(p.xz)) {\n hi = ti;\n crossed = true;\n break;\n }\n lo = ti;\n }\n if (!crossed) {\n vec3 p = origin + ray * tEnd;\n").concat(c.map((function(t){return" ".concat(t)})).join("\n"),"\n return p;\n }\n for (int j = 0; j < 4; j++) {\n float mid = 0.5 * (lo + hi);\n vec3 pm = origin + ray * mid;\n if (pm.y <= ").concat(a,"(pm.xz)) {\n hi = mid;\n } else {\n lo = mid;\n }\n }\n return origin + ray * (0.5 * (lo + hi));\n }\n")}var k="\n ".concat(R,"\n ").concat('\n uniform float uWaterClarity;\n uniform vec3 uWallColor; // MOD #1: replaces sampler2D tiles\n uniform vec3 uSkyHorizonColor; // MOD #2: drives sampleProceduralSky\n uniform vec3 uSkyZenithColor; // MOD #2: drives sampleProceduralSky\n uniform sampler2D causticTex;\n\n // MOD #2: replaces textureCube(sky, ray). Two-color vertical gradient.\n vec3 sampleProceduralSky(vec3 ray) {\n float t = clamp(ray.y * 0.5 + 0.5, 0.0, 1.0);\n return mix(uSkyHorizonColor, uSkyZenithColor, pow(t, 1.5));\n }\n\n // Sample the heightfield at a WORLD-METER xz position. The heightfield\n // texture\'s UV [0, 1]² spans the full pool footprint [-halfX, +halfX] ×\n // [-halfZ, +halfZ].\n vec4 sampleWaterAt(vec2 worldXZ) {\n return texture2D(water, worldXZ / (2.0 * uPoolHalf.xz) + 0.5);\n }\n\n // Sample the caustic texture for a point at WORLD-METER position. The\n // caustic texture indexes by "where would the light from this point have\n // come from at the water surface", projected back along refractedLight.\n // Mapping mirrors the caustics-vertex gl_Position write:\n // clip_xz = 0.75 * (point.xz - point.y * slope) / uPoolHalf.xz\n // Both vertex and fragment use this identical formula so reading and\n // writing into the texture are consistent across the full pool.\n vec4 sampleCausticAt(vec3 point, vec3 refractedLight) {\n vec2 lookup = (point.xz - point.y * refractedLight.xz / refractedLight.y) / uPoolHalf.xz;\n return texture2D(causticTex, 0.75 * lookup * 0.5 + 0.5);\n }\n\n vec3 getWallColor(vec3 point) {\n float scale = 0.5;\n\n vec3 wallColor;\n vec3 normal;\n // Wall detection: a tiny relative epsilon (0.1% of pool half-extent) so\n // we still recognise points sitting exactly on the wall geometry while\n // being tolerant of floating-point noise in the ray-march hit positions.\n if (abs(point.x) > uPoolHalf.x * 0.999) {\n wallColor = uWallColor; // MOD #1\n normal = vec3(-point.x, 0.0, 0.0);\n } else if (abs(point.z) > uPoolHalf.z * 0.999) {\n wallColor = uWallColor; // MOD #1\n normal = vec3(0.0, 0.0, -point.z);\n } else {\n wallColor = uWallColor; // MOD #1\n normal = vec3(0.0, 1.0, 0.0);\n }\n\n scale /= mix(length(point), 1.0, uWaterClarity); /* pool ambient occlusion */\n\n /* caustics */\n vec3 refractedLight = -refract(-light, vec3(0.0, 1.0, 0.0), IOR_AIR / IOR_WATER);\n float diffuse = max(0.0, dot(refractedLight, normal));\n vec4 info = sampleWaterAt(point.xz);\n if (point.y < info.r) {\n vec4 caustic = sampleCausticAt(point, refractedLight);\n scale += diffuse * caustic.r * 2.0 * caustic.g;\n } else {\n /* shadow for the rim of the pool */\n vec2 t = intersectCube(point, refractedLight, vec3(-uPoolHalf.x, -uPoolHalf.y, -uPoolHalf.z), vec3(uPoolHalf.x, 2.0 * uPoolHalf.y, uPoolHalf.z));\n diffuse *= 1.0 / (1.0 + exp(-200.0 / (1.0 + 10.0 * (t.y - t.x)) * (point.y + refractedLight.y * t.y - uPoolHalf.y / 6.0)));\n\n scale += diffuse * 0.5;\n }\n\n return wallColor * scale;\n }\n',"\n uniform vec3 eye;\n // Screen-space refraction inputs. The host renders the scene minus the\n // water surface itself to uSceneColor once per frame (SceneCapture.ts);\n // the surface then samples that texture at its own screen UV. This\n // replaces the demo's in-shader intersectCube + getWallColor AABB\n // raytrace so the underwater view shows the ACTUAL pool geo in the scene.\n uniform sampler2D uSceneColor;\n uniform vec2 uResolution;\n uniform float uUseScreenSpaceRefraction;\n uniform vec3 uRefractionFallbackColor;\n // Grazing-angle ceiling of the Schlick fresnel, in [fresnelBase, 1.0]. The\n // standard formula reaches 1.0 at cosI = 0, which on steep wave fronts reads\n // as harsh bright streaks (env.water.fresnelMax).\n uniform float uFresnelMax;\n // MOD #7 debug views (0 in production):\n // 4 = LANDING — ramp of the landing height the caustic composite\n // anchors to at this pixel (caustic texture .b at the marched\n // view-ray hit). Downstream of the height map AND caustics pass.\n // 5 = HEIGHTMAP — the raw PoolHeightMap capture painted over the pool\n // footprint. Upstream: exactly what the top-down pass recorded.\n uniform float uCausticDebugMode;\n // Pool receiving-geometry height map (PoolHeightMap.ts) — PRODUCTION\n // input: the SSR composite marches the view ray against it to find the\n // displayed wall/floor point. Also drives debug view 5.\n uniform sampler2D uPoolHeightMap;\n varying vec3 vWaterPos;\n\n // Landing-height debug ramp. Magenta = no data (encoded 0: cleared height\n // map texel, or a caustic ray that landed at the analytic volume floor);\n // blue = volume floor, green = mid-depth, red = waterline.\n vec3 rtvLandingRamp(float encoded) {\n if (encoded < 0.002) return vec3(1.0, 0.0, 1.0);\n float t = clamp(encoded * 3.0, 0.0, 1.0);\n return t < 0.5 ? mix(vec3(0.0, 0.2, 1.0), vec3(0.0, 1.0, 0.2), t * 2.0) : mix(vec3(0.0, 1.0, 0.2), vec3(1.0, 0.1, 0.0), t * 2.0 - 1.0);\n }\n\n ").concat(heightSamplerGLSL("rtvSampleHeight","uPoolHeightMap"),"\n\n // Height-field normal from central differences. Steep wall bands in the\n // map tilt it toward horizontal, so walls get a proper light-incidence\n // term without any analytic-AABB face detection.\n vec3 rtvHeightFieldNormal(vec2 xz) {\n float eps = uPoolHalf.x / 128.0;\n float hxp = rtvSampleHeight(xz + vec2(eps, 0.0));\n float hxm = rtvSampleHeight(xz - vec2(eps, 0.0));\n float hzp = rtvSampleHeight(xz + vec2(0.0, eps));\n float hzm = rtvSampleHeight(xz - vec2(0.0, eps));\n return normalize(vec3(hxm - hxp, 2.0 * eps, hzm - hzp));\n }\n\n /* MOD #7 — find the displayed geometry point along the straight view ray by\n marching it against the pool height map. Runs per FRAGMENT, hence the\n coarser 12-step pass; see heightFieldMarchGLSL for the algorithm. */\n ").concat(heightFieldMarchGLSL({name:"rtvMarchViewRay",sampler:"rtvSampleHeight",coarseSteps:12,guardShallowRays:!0}),"\n\n /*\n * Screen-space refraction sampler.\n *\n * gl_FragCoord.xy * uResolution (with uResolution = 1/drawingBuffer)\n * gives the current fragment's screen UV — the same UV the SceneCapture\n * target was written with, and the UV we sample at. Refraction is flat:\n * the sample is never displaced by the wave normal.\n *\n * The SceneCapture pass clips everything outside the water bbox via\n * six clipping planes installed on the renderer, so any fragment of\n * geometry that sits outside the water volume (above, below, beside\n * the pool) is discarded — those screen pixels stay at the cleared\n * alpha = 0 in the capture.\n *\n * When the sample is alpha=0 (or near-black, since a cleared capture\n * pixel reads as opaque-but-zero on some drivers) — a tall wave crest\n * peeking above the original waterline, so behind it on screen there's\n * no captured geo — return uRefractionFallbackColor, a host-configurable\n * deep-water tint surfaced as a Leva colour picker.\n */\n // Treat cleared / clipped capture pixels as a miss even if alpha is wrong.\n bool rtvSceneCaptureMissed(vec4 s) {\n return s.a < 0.5 || (s.r + s.g + s.b) < 0.02;\n }\n\n vec3 sampleScreenSpaceRefraction(vec3 viewRay, vec3 waterColor) {\n vec2 sampleUV = gl_FragCoord.xy * uResolution;\n vec4 sceneSample = texture2D(uSceneColor, sampleUV);\n\n // Live caustic composite. The capture is rendered with the caustic\n // receivers SUSPENDED (see setCausticReceiversSuspended) so still-scene\n // captures stay byte-identical for the throttle; the animated caustic\n // term is applied here every frame instead.\n //\n // MOD #7 — the hit marches the STRAIGHT view ray, not the refracted\n // one: the capture is an unrefracted straight-view render sampled at\n // the fragment's own screen UV, so the geometry displayed at this\n // fragment lies along the camera ray.\n float causticBoost = 1.0;\n vec3 refractedLight = -refract(-light, vec3(0.0, 1.0, 0.0), IOR_AIR / IOR_WATER);\n vec3 hit = rtvMarchViewRay(vWaterPos, viewRay);\n vec3 hitNormal = rtvHeightFieldNormal(hit.xz);\n float diffuseTerm = max(0.0, dot(refractedLight, hitNormal));\n vec4 info = sampleWaterAt(hit.xz);\n if (hit.y < info.r) {\n vec4 caustic = sampleCausticAt(hit, refractedLight);\n // Landing-height shadow, same rule as the receivers: a hit clearly\n // below the ray's landing is behind the surface that caught the\n // light. b == 0 is the no-data sentinel → no occlusion.\n float landingY = caustic.b * 3.0 * uPoolHalf.y - uPoolHalf.y;\n float occlusion = 1.0 - step(0.002, caustic.b) * smoothstep(0.05, 0.2, landingY - hit.y);\n // Hard ceiling on the contribution: at concave edges the tilted\n // height-field normal and the fold-compressed caustic can multiply\n // into an outline far brighter than the open-floor pattern.\n causticBoost += min(diffuseTerm * caustic.r * 2.0 * caustic.g * occlusion, 0.8);\n }\n\n // The fallback gets the boost too so a caustic band doesn't cut off\n // abruptly at the valid-sample/fallback boundary.\n if (rtvSceneCaptureMissed(sceneSample)) {\n return uRefractionFallbackColor * causticBoost;\n }\n return sceneSample.rgb * causticBoost * waterColor;\n }\n\n vec3 getSurfaceRayColor(vec3 origin, vec3 ray, vec3 waterColor) {\n vec3 color;\n if (ray.y < 0.0) {\n vec2 t = intersectCube(origin, ray, vec3(-uPoolHalf.x, -uPoolHalf.y, -uPoolHalf.z), vec3(uPoolHalf.x, 2.0 * uPoolHalf.y, uPoolHalf.z));\n color = getWallColor(origin + ray * t.y);\n } else {\n vec2 t = intersectCube(origin, ray, vec3(-uPoolHalf.x, -uPoolHalf.y, -uPoolHalf.z), vec3(uPoolHalf.x, 2.0 * uPoolHalf.y, uPoolHalf.z));\n vec3 hit = origin + ray * t.y;\n if (hit.y < uPoolHalf.y / 6.0) {\n color = getWallColor(hit);\n } else {\n color = sampleProceduralSky(ray); // MOD #2\n color += vec3(pow(max(0.0, dot(light, ray)), 5000.0)) * vec3(10.0, 8.0, 6.0);\n }\n }\n if (ray.y < 0.0) color *= waterColor;\n return color;\n }\n\n void main() {\n vec2 coord = vWaterPos.xz / (2.0 * uPoolHalf.xz) + 0.5;\n vec4 info = texture2D(water, coord);\n\n // HEIGHTMAP debug view — the raw PoolHeightMap capture over the pool\n // footprint (same UV the caustics pass samples with).\n if (uCausticDebugMode > 4.5) {\n gl_FragColor = vec4(rtvLandingRamp(texture2D(uPoolHeightMap, coord).r), 1.0);\n return;\n }\n\n // Footprint of the UN-displaced surface UV, in heightfield texels per screen pixel — taken\n // BEFORE the peaks loop so per-pixel displacement jitter cannot spike the derivative.\n vec2 hfTexels = vec2(textureSize(water, 0));\n float footprint = max(fwidth(coord.x) * hfTexels.x, fwidth(coord.y) * hfTexels.y);\n\n /* make water look more \"peaked\" */\n for (int i = 0; i < 5; i++) {\n coord += info.ba * 0.005;\n info = texture2D(water, coord);\n }\n\n // Resolution-adaptive normal smoothing (spec-AA): when one screen pixel spans several\n // heightfield texels (low effective DPR on tablets, grazing distance), the per-pixel wave\n // normal aliases into reflection/refraction sparkle. Flatten the wave component toward\n // vertical with the footprint — a no-op at 1:1 sampling, so dense desktop rendering keeps\n // its full wave detail.\n info.ba *= 1.0 / (1.0 + 1.5 * max(0.0, footprint - 1.0));\n\n vec3 normal = vec3(info.b, sqrt(max(0.0, 1.0 - dot(info.ba, info.ba))), info.a);\n vec3 incomingRay = normalize(vWaterPos - eye);\n\n /* above water */\n vec3 reflectedRay = reflect(incomingRay, normal);\n vec3 refractedRay = refract(incomingRay, normal, IOR_AIR / IOR_WATER);\n\n // LANDING debug view — the landing height the composite uses at this\n // pixel, computed with the same view-ray march as production.\n if (uCausticDebugMode > 3.5) {\n vec3 dbgRefractedLight = -refract(-light, vec3(0.0, 1.0, 0.0), IOR_AIR / IOR_WATER);\n vec3 dbgHit = rtvMarchViewRay(vWaterPos, incomingRay);\n gl_FragColor = vec4(rtvLandingRamp(sampleCausticAt(dbgHit, dbgRefractedLight).b), 1.0);\n return;\n }\n\n float fresnelBase = mix(0.25, 0.05, uWaterClarity);\n // Schlick fresnel. CRITICAL: clamp the cos-incidence term to [0, 1]\n // BEFORE the pow(). On steep wave fronts dot(normal, -incomingRay)\n // can slip slightly above 1.0 (fp error) — then 1.0 - dot becomes\n // negative and pow(negative, 3.0) is undefined in GLSL → NaN.\n // The NaN propagates into fresnel and into mix(refracted, reflected,\n // fresnel), and the framebuffer write clamps NaN to 0, producing\n // pure-black wave-front streaks. The clamp keeps fresnel a well-\n // defined float in [fresnelBase, uFresnelMax] everywhere.\n float cosI = clamp(dot(normal, -incomingRay), 0.0, 1.0);\n float fresnel = mix(fresnelBase, uFresnelMax, pow(1.0 - cosI, 3.0));\n\n vec3 abovewaterColor = mix(vec3(0.25, 1.0, 1.25), vec3(1.0), uWaterClarity);\n vec3 reflectedColor = getSurfaceRayColor(vWaterPos, reflectedRay, abovewaterColor);\n // Refraction path: screen-space sample of the captured scene texture when\n // uUseScreenSpaceRefraction is on, falling back to the demo's in-shader\n // AABB raytrace otherwise. Both paths share the same abovewaterColor tint\n // so toggling between them doesn't shift the overall hue.\n vec3 refractedColor;\n if (uUseScreenSpaceRefraction > 0.5) {\n refractedColor = sampleScreenSpaceRefraction(incomingRay, abovewaterColor);\n } else {\n refractedColor = getSurfaceRayColor(vWaterPos, refractedRay, abovewaterColor);\n }\n\n gl_FragColor = vec4(mix(refractedColor, reflectedColor, fresnel), 1.0);\n }\n"),T="\n ".concat(R,"\n uniform float uCausticIntensity; // MOD #4\n // MOD #7 — receiving-geometry height map (PoolHeightMap.ts). R channel:\n // volume-local height as (y + poolHalf.y) / (3 * poolHalf.y); the cleared\n // texture (0) decodes to the floor plane.\n uniform sampler2D uHeightMap;\n uniform float uHeightMapEnabled;\n varying vec3 oldPos;\n varying vec3 newPos;\n varying vec3 vRay;\n varying float vEdgeFade;\n\n ").concat(heightSamplerGLSL("causticSampleHeight","uHeightMap"),"\n\n /* Runs per VERTEX of the caustic mesh, so it affords a 24-step coarse pass;\n see heightFieldMarchGLSL for the algorithm. */\n ").concat(heightFieldMarchGLSL({name:"causticMarchLightRay",sampler:"causticSampleHeight",coarseSteps:24,guardShallowRays:!1}),"\n\n /* Land the ray on the receiving geometry. Without a height map: the\n demo's AABB clip + flat-floor projection. With one: march the ray\n against the height map — walls, ROUNDED CORNERS and stairs all\n terminate rays at their real position. (The analytic AABB attributes\n corner rays to the wrong wall face: square box vs rounded pool.)\n The caustic-clip lookup is invariant to where along the ray we stop. */\n vec3 project(vec3 origin, vec3 ray, vec3 refractedLight) {\n if (uHeightMapEnabled < 0.5) {\n vec2 tcube = intersectCube(origin, ray, vec3(-uPoolHalf.x, -uPoolHalf.y, -uPoolHalf.z), vec3(uPoolHalf.x, 2.0 * uPoolHalf.y, uPoolHalf.z));\n origin += ray * tcube.y;\n float tplane = (-origin.y - uPoolHalf.y) / refractedLight.y;\n return origin + refractedLight * tplane;\n }\n return causticMarchLightRay(origin, ray);\n }\n\n void main() {\n vec4 info = texture2D(water, position.xy / (2.0 * uPoolHalf.xz) + 0.5);\n info.ba *= uCausticIntensity; // MOD #4: was *= 0.5\n vec3 normal = vec3(info.b, sqrt(max(0.0, 1.0 - dot(info.ba, info.ba))), info.a);\n\n /* project the vertices along the refracted vertex ray */\n vec3 refractedLight = refract(-light, vec3(0.0, 1.0, 0.0), IOR_AIR / IOR_WATER);\n vRay = refract(-light, normal, IOR_AIR / IOR_WATER);\n oldPos = project(position.xzy, refractedLight, refractedLight);\n newPos = project(position.xzy + vec3(0.0, info.r, 0.0), vRay, refractedLight);\n\n // Concave-edge fade. Grazing light makes the landing mapping\n // near-singular at riser bases and wall coves — wave-normal jitter\n // funnels rays onto the exact corner line, which the area-ratio math\n // rewards with harsh max-brightness dashes. Fade landings that are\n // FLAT at their own position (small-radius gradient) but have a STEEP\n // feature nearby (large-radius gradient) — the signature of a concave\n // base line. Wall-FACE landings are steep at both radii and therefore\n // never faded; open floor is flat at both and also untouched.\n vEdgeFade = 1.0;\n if (uHeightMapEnabled > 0.5) {\n float epsNear = uPoolHalf.x / 128.0;\n float epsFar = uPoolHalf.x / 24.0;\n float gxN = causticSampleHeight(newPos.xz + vec2(epsNear, 0.0)) - causticSampleHeight(newPos.xz - vec2(epsNear, 0.0));\n float gzN = causticSampleHeight(newPos.xz + vec2(0.0, epsNear)) - causticSampleHeight(newPos.xz - vec2(0.0, epsNear));\n float gxF = causticSampleHeight(newPos.xz + vec2(epsFar, 0.0)) - causticSampleHeight(newPos.xz - vec2(epsFar, 0.0));\n float gzF = causticSampleHeight(newPos.xz + vec2(0.0, epsFar)) - causticSampleHeight(newPos.xz - vec2(0.0, epsFar));\n float flatHere = 1.0 - smoothstep(0.2, 0.6, length(vec2(gxN, gzN)) / (2.0 * epsNear));\n float steepNearby = smoothstep(0.25, 0.6, length(vec2(gxF, gzF)) / (2.0 * epsFar));\n vEdgeFade = 1.0 - steepNearby * flatHere;\n }\n\n // Caustic-clip output mirrors sampleCausticAt exactly: same projection,\n // same uPoolHalf.xz divide, same 0.75 margin. With slope = 0 (vertical\n // sun) this lands the pool floor [-uPoolHalf.xz, +uPoolHalf.xz] in\n // caustic-clip [-0.75, +0.75], leaving a 25% border for slanted-sun\n // projection drift.\n vec2 lookup = (newPos.xz - newPos.y * refractedLight.xz / refractedLight.y) / uPoolHalf.xz;\n gl_Position = vec4(0.75 * lookup, 0.0, 1.0);\n }\n"),A="\n ".concat(R,"\n varying vec3 oldPos;\n varying vec3 newPos;\n varying vec3 vRay;\n varying float vEdgeFade;\n\n void main() {\n /* if the triangle gets smaller, it gets brighter, and vice versa */\n float oldArea = length(dFdx(oldPos)) * length(dFdy(oldPos));\n float newArea = length(dFdx(newPos)) * length(dFdy(newPos));\n // vEdgeFade suppresses the fold-caustic line at concave height-field\n // edges (riser bases, wall coves) — see CAUSTICS_VERTEX.\n gl_FragColor = vec4(oldArea / newArea * 0.2 * vEdgeFade, 1.0, 0.0, 0.0);\n\n vec3 refractedLight = refract(-light, vec3(0.0, 1.0, 0.0), IOR_AIR / IOR_WATER);\n\n /* shadow for the rim of the pool */\n vec2 t = intersectCube(newPos, -refractedLight, vec3(-uPoolHalf.x, -uPoolHalf.y, -uPoolHalf.z), vec3(uPoolHalf.x, 2.0 * uPoolHalf.y, uPoolHalf.z));\n gl_FragColor.r *= 1.0 / (1.0 + exp(-200.0 / (1.0 + 10.0 * (t.y - t.x)) * (newPos.y - refractedLight.y * t.y - uPoolHalf.y / 6.0)));\n\n // MOD #7 — landing height into the blue channel (same normalization as\n // the height map). Consumers occlude fragments clearly below it.\n gl_FragColor.b = clamp((newPos.y + uPoolHalf.y) / (3.0 * uPoolHalf.y), 0.0, 1.0);\n }\n"),D={vertex:"\n uniform sampler2D water;\n uniform vec3 uPoolHalf;\n varying vec3 vWaterPos;\n void main() {\n vec4 info = texture2D(water, position.xz / (2.0 * uPoolHalf.xz) + 0.5);\n vWaterPos = vec3(position.x, info.r, position.z);\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position.x, info.r, position.z, 1.0);\n }\n",fragment:k},W={vertex:T,fragment:A};function ownKeys(t,r){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);r&&(o=o.filter((function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable}))),a.push.apply(a,o)}return a}function _objectSpread(t){for(var r=1;r<arguments.length;r++){var a=null!=arguments[r]?arguments[r]:{};r%2?ownKeys(Object(a),!0).forEach((function(r){(0,v.Z)(t,r,a[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):ownKeys(Object(a)).forEach((function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(a,r))}))}return t}function buildSharedUniformValues(t){var r,a,o,i,l,c,h,d;return{light:{value:(null!==(r=t.light)&&void 0!==r?r:new u.Pa4(.7071,.7071,0)).clone()},water:{value:null!==(a=t.water)&&void 0!==a?a:null},causticTex:{value:null!==(o=t.causticTex)&&void 0!==o?o:null},uPoolHalf:{value:(null!==(i=t.uPoolHalf)&&void 0!==i?i:new u.Pa4(1,1,1)).clone()},uWallColor:{value:(null!==(l=t.uWallColor)&&void 0!==l?l:new u.Pa4(.7,.78,.85)).clone()},uSkyHorizonColor:{value:(null!==(c=t.uSkyHorizonColor)&&void 0!==c?c:new u.Pa4(.78,.85,.95)).clone()},uSkyZenithColor:{value:(null!==(h=t.uSkyZenithColor)&&void 0!==h?h:new u.Pa4(.18,.36,.78)).clone()},uWaterClarity:{value:null!==(d=t.uWaterClarity)&&void 0!==d?d:0}}}function updateSharedUniforms(t,r){var a=t.uniforms;r.light&&a.light.value.copy(r.light),void 0!==r.water&&(a.water.value=r.water),void 0!==r.causticTex&&(a.causticTex.value=r.causticTex),r.uPoolHalf&&a.uPoolHalf.value.copy(r.uPoolHalf),r.uWallColor&&a.uWallColor.value.copy(r.uWallColor),r.uSkyHorizonColor&&a.uSkyHorizonColor.value.copy(r.uSkyHorizonColor),r.uSkyZenithColor&&a.uSkyZenithColor.value.copy(r.uSkyZenithColor),void 0!==r.uWaterClarity&&(a.uWaterClarity.value=r.uWaterClarity)}var L=a(82),O="\n varying vec2 coord;\n void main() {\n coord = position.xy * 0.5 + 0.5;\n gl_Position = vec4(position.xyz, 1.0);\n }\n",I="\n const float PI = 3.141592653589793;\n uniform sampler2D tSrc;\n uniform vec2 center; // pool-normalized [-1, 1]\n uniform float radius; // WORLD METERS\n uniform float strength;\n uniform vec2 poolHalf; // (vx, vz) world half-extents (meters)\n varying vec2 coord;\n void main() {\n vec4 info = texture2D(tSrc, coord);\n\n vec2 texelWorld = (coord * 2.0 - 1.0) * poolHalf;\n vec2 centerWorld = center * poolHalf;\n float drop = max(0.0, 1.0 - distance(texelWorld, centerWorld) / radius);\n drop = 0.5 - cos(drop * PI) * 0.5;\n info.r += drop * strength;\n\n gl_FragColor = info;\n }\n",Z="\n uniform sampler2D tSrc;\n uniform vec2 delta;\n uniform float damping;\n varying vec2 coord;\n void main() {\n /* get vertex info */\n vec4 info = texture2D(tSrc, coord);\n\n /* calculate average neighbor height */\n vec2 dx = vec2(delta.x, 0.0);\n vec2 dy = vec2(0.0, delta.y);\n float average = (\n texture2D(tSrc, coord - dx).r +\n texture2D(tSrc, coord - dy).r +\n texture2D(tSrc, coord + dx).r +\n texture2D(tSrc, coord + dy).r\n ) * 0.25;\n\n /* change the velocity to move toward the average */\n info.g += (average - info.r) * 2.0;\n\n /* attenuate the velocity a little so waves do not last forever */\n info.g *= damping;\n\n /* move the vertex along the velocity */\n info.r += info.g;\n\n gl_FragColor = info;\n }\n",E="\n uniform sampler2D tSrc;\n uniform vec2 delta;\n varying vec2 coord;\n void main() {\n /* get vertex info */\n vec4 info = texture2D(tSrc, coord);\n\n /* update the normal */\n vec3 dx = vec3(delta.x, texture2D(tSrc, vec2(coord.x + delta.x, coord.y)).r - info.r, 0.0);\n vec3 dy = vec3(0.0, texture2D(tSrc, vec2(coord.x, coord.y + delta.y)).r - info.r, delta.y);\n info.ba = normalize(cross(dy, dx)).xz;\n\n gl_FragColor = info;\n }\n",_=function(){return(0,d.Z)((function Heightfield(){var t,r,a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(0,h.Z)(this,Heightfield),(0,v.Z)(this,"sizeX",void 0),(0,v.Z)(this,"sizeY",void 0),(0,v.Z)(this,"delta",void 0),(0,v.Z)(this,"poolHalf",void 0),(0,v.Z)(this,"rtA",void 0),(0,v.Z)(this,"rtB",void 0),(0,v.Z)(this,"scene",void 0),(0,v.Z)(this,"camera",void 0),(0,v.Z)(this,"quad",void 0),(0,v.Z)(this,"dropMat",void 0),(0,v.Z)(this,"updateMat",void 0),(0,v.Z)(this,"normalMat",void 0),(0,v.Z)(this,"clearedOnce",!1),this.sizeX=null!==(t=a.sizeX)&&void 0!==t?t:256,this.sizeY=null!==(r=a.sizeY)&&void 0!==r?r:this.sizeX,this.delta=new u.FM8(1/this.sizeX,1/this.sizeY),this.poolHalf=new u.FM8(1,1),a.poolHalf&&this.poolHalf.copy(a.poolHalf);var o={type:u.cLu,format:u.wk1,wrapS:u.uWy,wrapT:u.uWy,magFilter:u.wem,minFilter:u.wem,depthBuffer:!1,stencilBuffer:!1};this.rtA=new u.dd2(this.sizeX,this.sizeY,o),this.rtB=new u.dd2(this.sizeX,this.sizeY,o),this.scene=new u.xsS,this.camera=new u.iKG(-1,1,1,-1,0,1),this.quad=new u.Kj0(new u._12(2,2)),this.scene.add(this.quad),this.dropMat=new u.jyz({vertexShader:O,fragmentShader:I,uniforms:{tSrc:{value:null},center:{value:new u.FM8(0,0)},radius:{value:.1},strength:{value:.01},poolHalf:{value:this.poolHalf}},depthTest:!1,depthWrite:!1}),this.updateMat=new u.jyz({vertexShader:O,fragmentShader:Z,uniforms:{tSrc:{value:null},delta:{value:this.delta},damping:{value:.995}},depthTest:!1,depthWrite:!1}),this.normalMat=new u.jyz({vertexShader:O,fragmentShader:E,uniforms:{tSrc:{value:null},delta:{value:this.delta}},depthTest:!1,depthWrite:!1})}),[{key:"currentTexture",get:function get(){return this.rtA.texture}},{key:"ensureCleared",value:function ensureCleared(t){var r=this;this.clearedOnce||((0,p.s)(t,{target:this.rtA,clearColor:0,clearAlpha:0},(function(){t.clear(!0,!0,!0),t.setRenderTarget(r.rtB),t.clear(!0,!0,!0)})),this.clearedOnce=!0)}},{key:"renderPass",value:function renderPass(t,r){this.quad.material=r,t.setRenderTarget(this.rtB),t.render(this.scene,this.camera),t.setRenderTarget(null);var a=[this.rtB,this.rtA];this.rtA=a[0],this.rtB=a[1]}},{key:"addDrop",value:function addDrop(t,r){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.1,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:.01;this.ensureCleared(t),this.dropMat.uniforms.tSrc.value=this.rtA.texture,this.dropMat.uniforms.center.value.copy(r),this.dropMat.uniforms.radius.value=a,this.dropMat.uniforms.strength.value=o,this.renderPass(t,this.dropMat)}},{key:"step",value:function step(t){this.ensureCleared(t),this.updateMat.uniforms.tSrc.value=this.rtA.texture,this.renderPass(t,this.updateMat)}},{key:"setDamping",value:function setDamping(t){this.updateMat.uniforms.damping.value=t}},{key:"updateNormals",value:function updateNormals(t){this.ensureCleared(t),this.normalMat.uniforms.tSrc.value=this.rtA.texture,this.renderPass(t,this.normalMat)}},{key:"dispose",value:function dispose(){this.rtA.dispose(),this.rtB.dispose(),this.dropMat.dispose(),this.updateMat.dispose(),this.normalMat.dispose(),this.quad.geometry.dispose()}}])}(),j=function(){return(0,d.Z)((function CausticsTexture(){var t,r,a,o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(0,h.Z)(this,CausticsTexture),(0,v.Z)(this,"size",void 0),(0,v.Z)(this,"poolHalf",void 0),(0,v.Z)(this,"rt",void 0),(0,v.Z)(this,"scene",void 0),(0,v.Z)(this,"camera",void 0),(0,v.Z)(this,"quad",void 0),(0,v.Z)(this,"material",void 0),this.size=null!==(t=o.size)&&void 0!==t?t:1024;var i=null!==(r=o.detail)&&void 0!==r?r:200;this.poolHalf=(null!==(a=o.poolHalf)&&void 0!==a?a:new u.Pa4(1,1,1)).clone(),this.rt=new u.dd2(this.size,this.size,{type:u.ywz,format:u.wk1,depthBuffer:!1,stencilBuffer:!1,generateMipmaps:!0,minFilter:u.D1R}),this.scene=new u.xsS,this.camera=new u.iKG(-1,1,1,-1,0,1),this.material=new u.jyz({vertexShader:W.vertex,fragmentShader:W.fragment,uniforms:{light:{value:new u.Pa4(.7071,.7071,0)},water:{value:null},uPoolHalf:{value:this.poolHalf.clone()},uCausticIntensity:{value:.5},uHeightMap:{value:null},uHeightMapEnabled:{value:0}},depthTest:!1,depthWrite:!1});var l=this.poolHalf.x,c=this.poolHalf.z,d=Math.max(l,c),p=i/Math.max(.001,2*d),m=Math.max(32,Math.round(2*l*p)),g=Math.max(32,Math.round(2*c*p));this.quad=new u.Kj0(new u._12(2*l,2*c,m,g),this.material),this.scene.add(this.quad)}),[{key:"texture",get:function get(){return this.rt.texture}},{key:"render",value:function render(t){var r=this;(0,p.s)(t,{target:this.rt,clearColor:0,clearAlpha:0},(function(){t.clear(!0,!1,!1),t.render(r.scene,r.camera)}))}},{key:"setHeightfield",value:function setHeightfield(t){this.material.uniforms.water.value=t}},{key:"setLight",value:function setLight(t,r,a){this.material.uniforms.light.value.set(t,r,a)}},{key:"setIntensity",value:function setIntensity(t){this.material.uniforms.uCausticIntensity.value=t}},{key:"setHeightMap",value:function setHeightMap(t){this.material.uniforms.uHeightMap.value=t,this.material.uniforms.uHeightMapEnabled.value=t?1:0}},{key:"dispose",value:function dispose(){this.rt.dispose(),this.material.dispose(),this.quad.geometry.dispose()}}])}();function useWaveSimulation_createForOfIteratorHelper(t,r){var a="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!a){if(Array.isArray(t)||(a=function useWaveSimulation_unsupportedIterableToArray(t,r){if(t){if("string"==typeof t)return useWaveSimulation_arrayLikeToArray(t,r);var a={}.toString.call(t).slice(8,-1);return"Object"===a&&t.constructor&&(a=t.constructor.name),"Map"===a||"Set"===a?Array.from(t):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?useWaveSimulation_arrayLikeToArray(t,r):void 0}}(t))||r&&t&&"number"==typeof t.length){a&&(t=a);var o=0,i=function F(){};return{s:i,n:function n(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}},e:function e(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var l,c=!0,u=!1;return{s:function s(){a=a.call(t)},n:function n(){var t=a.next();return c=t.done,t},e:function e(t){u=!0,l=t},f:function f(){try{c||null==a.return||a.return()}finally{if(u)throw l}}}}function useWaveSimulation_arrayLikeToArray(t,r){(null==r||r>t.length)&&(r=t.length);for(var a=0,o=Array(r);a<r;a++)o[a]=t[a];return o}var B=function(){return(0,d.Z)((function SubstepAccumulator(){(0,h.Z)(this,SubstepAccumulator),(0,v.Z)(this,"leftover",0)}),[{key:"take",value:function take(t,r){this.leftover+=t*Math.min(r,.06666666666666667);var a=Math.floor(this.leftover);return this.leftover-=a,a}},{key:"reset",value:function reset(){this.leftover=0}}])}();var N={off:0,overlay:1,isolate:2,mask:3,landing:4,heightmap:5};var V=a(120),U=a(7514);function WaterSurfaceRenderer(t){var r=t.position,a=t.volumeSize,o=t.sunDirection,h=t.wallColor,d=t.skyHorizonColor,v=t.skyZenithColor,p=t.heightfieldSize,g=t.causticTextureSize,y=t.substeps,x=t.ambientDropPeriod,w=t.pointerStrength,b=t.causticIntensity,S=t.waterClarity,P=t.useScreenSpaceRefraction,C=t.refractionFallbackColor,M=t.fresnelMax,z=t.causticDebugMode,R=(0,i.useRef)(null),k=(0,i.useRef)(null),T=(0,c.D)((function(t){return t.gl})),A=(0,c.D)((function(t){return t.camera})),W=(0,c.D)((function(t){return t.scene})),O=(0,c.D)((function(t){return t.size})),I=(0,i.useRef)(null);null===I.current&&(I.current=new H);var Z=(0,i.useRef)(null);null===Z.current&&(Z.current=new m);var E=(0,i.useMemo)((function(){return new u.Pa4(a[0]/2,a[1],a[2]/2)}),[a[0],a[1],a[2]]),X=function useWaveSimulation(t){var r=t.poolHalf,a=t.heightfieldSize,o=t.causticTextureSize,l=t.substeps,h=t.ambientDropPeriod,d=(0,c.D)((function(t){return t.gl})),v=(0,i.useRef)(null),p=(0,i.useRef)(null),m=(0,i.useRef)([]),g=(0,i.useRef)(!1),y=(0,i.useRef)(0),x=(0,i.useRef)(new B),w=(0,i.useMemo)((function(){var t=r.x,o=r.z,i=a/(2*Math.max(t,o));return{sizeX:Math.max(32,Math.round(2*t*i)),sizeY:Math.max(32,Math.round(2*o*i)),poolHalfX:t,poolHalfZ:o,poolDepth:r.y}}),[r.x,r.y,r.z,a]);return(0,i.useEffect)((function(){var t=new _({sizeX:w.sizeX,sizeY:w.sizeY,poolHalf:new u.FM8(w.poolHalfX,w.poolHalfZ)}),r=new j({poolHalf:new u.Pa4(w.poolHalfX,w.poolDepth,w.poolHalfZ),size:o});return v.current=t,p.current=r,g.current=!1,x.current.reset(),function(){t.dispose(),r.dispose(),v.current=null,p.current=null}}),[w,o]),{queueDrop:(0,i.useCallback)((function(t,r,a){m.current.push({center:t,radius:r,strength:a})}),[]),advance:function advance(t){var r=v.current,a=p.current;if(!r||!a)return!1;if(!g.current){for(var o=0;o<10;o++){var i=2*Math.random()-1,c=2*Math.random()-1;r.addDrop(d,new u.FM8(i,c),.3,1&o?.04:-.04)}g.current=!0}if(h>0&&(y.current+=t,y.current>=h)){y.current=0;var w=2*Math.random()-1,b=2*Math.random()-1;r.addDrop(d,new u.FM8(w,b),.24,.04)}if(m.current.length>0){var S,P=useWaveSimulation_createForOfIteratorHelper(m.current);try{for(P.s();!(S=P.n()).done;){var C=S.value;r.addDrop(d,C.center,C.radius,C.strength)}}catch(t){P.e(t)}finally{P.f()}m.current.length=0}var M=60*l;if(M>0){r.setDamping(Math.pow(.547,1/M));for(var H=x.current.take(M,t),z=0;z<H;z++)r.step(d)}return r.updateNormals(d),!0},setHeightMap:function setHeightMap(t){var r;null===(r=p.current)||void 0===r||r.setHeightMap(t)},renderCaustics:function renderCaustics(t,r){var a=v.current,o=p.current;a&&o&&(o.setHeightfield(a.currentTexture),o.setLight(t.x,t.y,t.z),o.setIntensity(r),o.render(d))},get heightTexture(){var t,r;return null!==(t=null===(r=v.current)||void 0===r?void 0:r.currentTexture)&&void 0!==t?t:null},get causticTexture(){var t,r;return null!==(t=null===(r=p.current)||void 0===r?void 0:r.texture)&&void 0!==t?t:null}}}({poolHalf:E,heightfieldSize:p,causticTextureSize:g,substeps:y,ambientDropPeriod:x}),q=function useWaterPointer(t,r){var a=(0,i.useCallback)((function(r,a){r.uv&&t(new u.FM8(2*r.uv.x-1,1-2*r.uv.y),.1,a)}),[t]);return{onPointerMove:(0,i.useCallback)((function(t){return a(t,.01*r)}),[a,r]),onPointerDown:(0,i.useCallback)((function(t){return a(t,.04*r)}),[a,r])}}(X.queueDrop,w),Y=(0,i.useMemo)((function(){var t=function segs(t){return Math.max(32,Math.min(256,Math.round(50*t)))},r=new u._12(2*E.x,2*E.z,t(2*E.x),t(2*E.z));r.rotateX(Math.PI/2);for(var a=r.attributes.normal.array,o=1;o<a.length;o+=3)a[o]=1;return r}),[E.x,E.z]),J=(0,i.useMemo)((function(){return new u._12(2*E.x,2*E.z)}),[E.x,E.z]),K=(0,i.useMemo)((function(){return new u.vBJ({colorWrite:!1,depthWrite:!1,side:u.ehD})}),[]),Q=(0,i.useMemo)((function(){return function createWaterSurfaceAboveMaterial(){var t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new u.jyz({vertexShader:D.vertex,fragmentShader:D.fragment,uniforms:_objectSpread(_objectSpread({},buildSharedUniformValues(r)),{},{eye:{value:(null!==(t=r.eye)&&void 0!==t?t:new u.Pa4(0,5,5)).clone()},uSceneColor:{value:null},uResolution:{value:new u.FM8(1,1)},uUseScreenSpaceRefraction:{value:0},uRefractionFallbackColor:{value:new u.Pa4(.039,.145,.251)},uFresnelMax:{value:1},uCausticDebugMode:{value:0},uPoolHeightMap:{value:null}}),transparent:!1,side:u.ehD})}({uPoolHalf:E.clone(),uWallColor:colorToVec3(h),uSkyHorizonColor:colorToVec3(d),uSkyZenithColor:colorToVec3(v)})}),[]);(0,i.useEffect)((function(){return function(){Y.dispose(),J.dispose()}}),[Y,J]),(0,i.useEffect)((function(){return function(){K.dispose(),Q.dispose()}}),[K,Q]),(0,i.useEffect)((function(){updateSharedUniforms(Q,{uPoolHalf:E}),L.f.poolHalf.copy(E)}),[E,Q]),(0,i.useEffect)((function(){return function(){(0,L.g)()}}),[]),(0,i.useEffect)((function(){return function(){var t,r;null===(t=I.current)||void 0===t||t.dispose(),I.current=null,null===(r=Z.current)||void 0===r||r.dispose(),Z.current=null}}),[]),(0,i.useEffect)((function(){var t=colorToVec3(h),r=colorToVec3(d),a=colorToVec3(v);updateSharedUniforms(Q,{uWallColor:t,uSkyHorizonColor:r,uSkyZenithColor:a,uWaterClarity:S})}),[h,d,v,S,Q]),(0,i.useEffect)((function(){var t=colorToVec3(C);Q.uniforms.uRefractionFallbackColor.value.copy(t)}),[C,Q]);var $=(0,i.useRef)(new u.Pa4),ee=(0,i.useRef)(new u.Pa4);return(0,c.F)((function(t,r){if(!T.getContext().isContextLost()){try{!function frameBody(){if(X.advance(r)){var t=R.current;if(t){var a=t.position;$.current.set(A.position.x-a.x,A.position.y-a.y,A.position.z-a.z)}else $.current.copy(A.position);ee.current.set(o[0],o[1],o[2]).normalize(),t&&t.getWorldPosition(L.f.volumeCenter);var i=l.tb.getState(),c=i.articleVersion+i.articleSettledVersion+i.decorVersion,u=Z.current;u&&(u.renderIfNeeded(T,W,L.f.volumeCenter,E,c,[t]),X.setHeightMap(u.texture)),X.renderCaustics(ee.current,b),updateSharedUniforms(Q,{water:X.heightTexture,causticTex:X.causticTexture,light:ee.current}),Q.uniforms.eye.value.copy($.current);var h=I.current;h&&P&&h.update({renderer:T,scene:W,camera:A,material:Q,surfaceMesh:k.current,volumeCenter:L.f.volumeCenter,poolHalf:E,cssWidth:O.width,cssHeight:O.height,geometryVersion:c,sceneMutating:i.isDragging||null!==i.accessoryMove}),Q.uniforms.uUseScreenSpaceRefraction.value=P?1:0,Q.uniforms.uFresnelMax.value=M,L.f.waterTex=X.heightTexture,L.f.causticTex=X.causticTexture,L.f.light.copy(ee.current),function publishCausticDebugMode(t,r){var a=N[r];L.f.causticDebugMode=a<=3?a:0,t.uniforms.uCausticDebugMode.value=a}(Q,z),Q.uniforms.uPoolHeightMap.value=u?u.texture:null,L.f.enabled=!0}}()}catch(t){if(!T.getContext().isContextLost())throw t;l.tb.getState().setGLContextLost(!0)}}}),V.l.WATER_CAPTURE),(0,U.jsxs)("group",{ref:R,position:r,children:[(0,U.jsx)("mesh",{ref:k,geometry:Y,material:Q,raycast:G}),(0,U.jsx)("mesh",{geometry:J,material:K,rotation:[-Math.PI/2,0,0],onPointerMove:q.onPointerMove,onPointerDown:q.onPointerDown})]})}var G=function NOOP_RAYCAST(){};function colorToVec3(t){var r=new u.Ilk(t);return new u.Pa4(r.r,r.g,r.b)}var X=a(7067);function WaterSurface(){var t,r,a=(0,l.tb)((function(t){return t.resolvedEnvironment.water})),c=(0,l.tb)((function(t){return t.resolvedEnvironment.lighting.sun})),u=(0,l.tb)((function(t){return t.waterVolumeOverride})),h=(0,i.useState)(u),d=(0,o.Z)(h,2),v=d[0],p=d[1];(0,i.useEffect)((function(){if(u!==v){var t=window.setTimeout((function(){return p(u)}),300);return function(){return window.clearTimeout(t)}}}),[u,v]);var m=a.causticSun,g=(0,i.useMemo)((function(){return m?(0,X.mo)(m.azimuth,m.elevation):(0,X.ww)(c)}),[m,c]);return(0,U.jsx)(WaterSurfaceRenderer,{position:null!==(t=null==v?void 0:v.center)&&void 0!==t?t:a.volume.center,volumeSize:null!==(r=null==v?void 0:v.size)&&void 0!==r?r:a.volume.size,sunDirection:g,wallColor:a.wallColor,skyHorizonColor:a.skyHorizonColor,skyZenithColor:a.skyZenithColor,waterClarity:a.waterClarity,ambientDropPeriod:a.ambientDropPeriod,pointerStrength:a.pointerStrength,heightfieldSize:a.heightfieldSize,causticTextureSize:a.causticTextureSize,causticIntensity:a.causticIntensity,useScreenSpaceRefraction:a.useScreenSpaceRefraction,refractionFallbackColor:a.refractionFallbackColor,fresnelMax:a.fresnelMax,causticDebugMode:a.causticDebugMode,substeps:a.waveSpeed})}}}]);
|