@equinor/videx-3d 1.1.1 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/README.md +120 -120
  2. package/dist/chunk-DKAquGKk.js +2820 -0
  3. package/dist/chunk-DsUZyEG_.js +16 -0
  4. package/dist/generators.js +512 -716
  5. package/dist/main.js +6909 -8947
  6. package/dist/sdk.js +2 -785
  7. package/dist/src/sdk/materials/shaderLib/oit.glsl +106 -0
  8. package/dist/types/components/Annotations/AutoUpdate.d.ts +1 -1
  9. package/dist/types/components/Annotations/index.d.ts +2 -2
  10. package/dist/types/components/Annotations/types.d.ts +3 -1
  11. package/dist/types/components/Annotations/update-annotations.d.ts +10 -0
  12. package/dist/types/components/EventEmitter/picking-helper.d.ts +23 -1
  13. package/dist/types/components/Ocean/Ocean.d.ts +333 -0
  14. package/dist/types/components/Ocean/index.d.ts +6 -0
  15. package/dist/types/components/Ocean/ocean-bed-material.d.ts +60 -0
  16. package/dist/types/components/Ocean/ocean-contact.d.ts +39 -0
  17. package/dist/types/components/Ocean/ocean-material.d.ts +145 -0
  18. package/dist/types/components/Ocean/ocean-sampler.d.ts +93 -0
  19. package/dist/types/components/Ocean/ocean-volume-material.d.ts +54 -0
  20. package/dist/types/components/Surfaces/Surface.d.ts +8 -1
  21. package/dist/types/components/Surfaces/SurfaceMaterial.d.ts +3 -0
  22. package/dist/types/components/Surfaces/surface-defs.d.ts +1 -0
  23. package/dist/types/components/Tanker/Tanker.d.ts +47 -0
  24. package/dist/types/components/Tanker/TankerSuperstructure.d.ts +23 -0
  25. package/dist/types/components/Tanker/tanker-geometry-builder.d.ts +21 -0
  26. package/dist/types/generators/surface-generator.d.ts +1 -1
  27. package/dist/types/layers/layers.d.ts +4 -0
  28. package/dist/types/main.d.ts +1 -0
  29. package/dist/types/rendering/OitMaterial.d.ts +59 -0
  30. package/dist/types/rendering/Pass.d.ts +16 -0
  31. package/dist/types/rendering/RenderingPipeline.d.ts +46 -0
  32. package/dist/types/rendering/debug/DebugBoxOutputPass.d.ts +22 -0
  33. package/dist/types/rendering/debug/DebugPatternPass.d.ts +30 -0
  34. package/dist/types/rendering/fullscreen-renderer.d.ts +1 -0
  35. package/dist/types/rendering/fxaa-resolver.d.ts +25 -0
  36. package/dist/types/rendering/gpu-timer.d.ts +46 -0
  37. package/dist/types/rendering/index.d.ts +8 -1
  38. package/dist/types/rendering/oit-material.d.ts +122 -0
  39. package/dist/types/{components/Annotations/annotations-renderer.d.ts → rendering/passes/AnnotationsPass.d.ts} +14 -4
  40. package/dist/types/rendering/passes/FXAAPass.d.ts +17 -0
  41. package/dist/types/rendering/passes/OITRenderPass.d.ts +429 -0
  42. package/dist/types/rendering/passes/OutputPass.d.ts +19 -0
  43. package/dist/types/rendering/passes/RenderPass.d.ts +10 -0
  44. package/dist/types/rendering/passes/index.d.ts +4 -0
  45. package/dist/types/rendering/rendering-state.d.ts +59 -0
  46. package/dist/types/rendering/smaa-resolver.d.ts +58 -0
  47. package/dist/types/rendering/taa-resolver.d.ts +161 -0
  48. package/dist/types/rendering/temporal-resolver.d.ts +152 -0
  49. package/dist/types/sdk/geometries/boundary-loops.d.ts +38 -0
  50. package/dist/types/sdk/geometries/geometry-attributes.d.ts +37 -0
  51. package/dist/types/sdk/geometries/grid-sampling.d.ts +50 -0
  52. package/dist/types/sdk/geometries/ocean-geometry.d.ts +288 -0
  53. package/dist/types/sdk/geometries/packing.d.ts +1 -1
  54. package/dist/types/sdk/geometries/tessellation.d.ts +25 -0
  55. package/dist/types/sdk/index.d.ts +5 -0
  56. package/dist/types/sdk/utils/elevation-map.d.ts +23 -0
  57. package/dist/types/sdk/utils/trigonometry.d.ts +4 -1
  58. package/dist/types/sdk/utils/vector-operations.d.ts +7 -0
  59. package/package.json +9 -10
  60. package/dist/chunk-BlPg4RjP.js +0 -689
  61. package/dist/chunk-CnY6Tmof.js +0 -358
  62. package/dist/chunk-DuRASjkF.js +0 -17
  63. package/dist/chunk-iY0wQ9Z6.js +0 -887
  64. package/dist/types/rendering/render-passes.d.ts +0 -16
  65. /package/dist/{shaderLib → src/sdk/materials/shaderLib}/color-conversion.glsl +0 -0
  66. /package/dist/{shaderLib → src/sdk/materials/shaderLib}/colors.glsl +0 -0
  67. /package/dist/{shaderLib → src/sdk/materials/shaderLib}/glyphs.glsl +0 -0
  68. /package/dist/{shaderLib → src/sdk/materials/shaderLib}/random.glsl +0 -0
  69. /package/dist/{shaderLib → src/sdk/materials/shaderLib}/remap.glsl +0 -0
  70. /package/dist/{shaderLib → src/sdk/materials/shaderLib}/render-number.glsl +0 -0
  71. /package/dist/{shaderLib → src/sdk/materials/shaderLib}/render-text.glsl +0 -0
  72. /package/dist/{shaderLib → src/sdk/materials/shaderLib}/rotation.glsl +0 -0
  73. /package/dist/{shaderLib → src/sdk/materials/shaderLib}/sdf-functions.glsl +0 -0
  74. /package/dist/textures/{normal_map.jpg → public/normal_map.jpg} +0 -0
@@ -0,0 +1,145 @@
1
+ import { Color, ShaderMaterial, ShaderMaterialParameters, Vector2, Vector3 } from 'three';
2
+ export type OceanMaterialParameters = ShaderMaterialParameters & {
3
+ waveCount?: number;
4
+ detailOctaves?: number;
5
+ contactCount?: number;
6
+ };
7
+ /**
8
+ * An oriented footprint of a floating object resting on the ocean surface, used
9
+ * to spread contact foam around it. All values are in the ocean's local frame
10
+ * (sea level = local y 0).
11
+ */
12
+ export type OceanContact = {
13
+ /** Footprint centre X (local). */
14
+ x: number;
15
+ /** Footprint centre Z (local). */
16
+ z: number;
17
+ /** Heading in radians (rotation about +Y). */
18
+ heading: number;
19
+ /** Half-extent along the heading (e.g. half the hull length). */
20
+ halfLength: number;
21
+ /** Half-extent across the heading (e.g. half the beam). */
22
+ halfWidth: number;
23
+ /** Width (m) of the foam band straddling the footprint edge. */
24
+ foamWidth: number;
25
+ /**
26
+ * Foam strength multiplier (0 = none, 1 = full). Contact foam is independent
27
+ * of the wind-driven `foamAmount`, so this controls how much foam the object
28
+ * generates. Default `1`.
29
+ */
30
+ intensity?: number;
31
+ /**
32
+ * How much the foam is reduced toward the bow/stern (the forward axis), 0..1.
33
+ * 0 = an even collar all around; 1 = foam only along the sides (where a hull
34
+ * pushes the most water). Default `0`.
35
+ */
36
+ endFalloff?: number;
37
+ };
38
+ /**
39
+ * Stylized, OIT-compatible ocean surface material.
40
+ *
41
+ * The wave field is a discrete set of directional components sampled from a
42
+ * JONSWAP spectrum tuned for the North Sea (gamma = 3.3), driven by a single
43
+ * physical input: the wind speed (m/s, U10). Peak frequency, wavelength and
44
+ * significant wave height follow the standard Pierson-Moskowitz/JONSWAP
45
+ * relations, so the wave sizes and spacing are physically plausible (e.g.
46
+ * U = 10 m/s gives Hs ~ 2.1 m and a peak wavelength ~ 88 m). The spectrum is
47
+ * sampled on the CPU whenever the wind changes and uploaded as uniform arrays;
48
+ * the shaders just sum the components.
49
+ *
50
+ * All wave/foam animation is evaluated in world X/Z space so it tiles
51
+ * seamlessly across patched geometry. The material is wired for the
52
+ * OITRenderPass via {@link attachOitVariants}; because its OIT variants share
53
+ * this material's `uniforms` object by reference, animated uniforms (time,
54
+ * wind, colours) stay live through every transparency pass.
55
+ */
56
+ export declare class OceanMaterial extends ShaderMaterial {
57
+ isOceanMaterial: boolean;
58
+ private _waveCount;
59
+ private _waveHeightScale;
60
+ private _directionalSpread;
61
+ private _contactCount;
62
+ constructor(parameters?: OceanMaterialParameters);
63
+ /**
64
+ * (Re)sample the JONSWAP spectrum into the wave-component uniform arrays from
65
+ * the current wind speed/direction. Cheap (a few iterations) and only called
66
+ * when the wind/height inputs change, never per frame.
67
+ */
68
+ private updateWaves;
69
+ get time(): number;
70
+ set time(value: number);
71
+ get windDirection(): Vector2;
72
+ set windDirection(value: Vector2);
73
+ get windSpeed(): number;
74
+ set windSpeed(value: number);
75
+ /** Wave height multiplier applied on top of the spectrum's physical Hs. */
76
+ get amplitude(): number;
77
+ set amplitude(value: number);
78
+ /** Angular spread (radians) of the wave directions around the wind. */
79
+ get directionalSpread(): number;
80
+ set directionalSpread(value: number);
81
+ /** Significant wave height (m) derived from the current wind/height scale. */
82
+ get significantHeight(): number;
83
+ get steepness(): number;
84
+ set steepness(value: number);
85
+ get displacement(): number;
86
+ set displacement(value: number);
87
+ get deepColor(): Color;
88
+ set deepColor(value: Color | string | number);
89
+ get shallowColor(): Color;
90
+ set shallowColor(value: Color | string | number);
91
+ get waterOpacity(): number;
92
+ set waterOpacity(value: number);
93
+ /** Strength of the large-scale tonal variation (currents / slicks). */
94
+ get tonalVariation(): number;
95
+ set tonalVariation(value: number);
96
+ /**
97
+ * Approximate size of the large-scale tonal variation patches, in kilometers.
98
+ * Larger values give broader, slower-changing current/slick fields; smaller
99
+ * values break the water up into finer patches.
100
+ */
101
+ get tonalScale(): number;
102
+ set tonalScale(value: number);
103
+ /**
104
+ * Crispness of the tonal variation patch boundaries. 0 keeps the soft FBM
105
+ * gradient; higher values (up to 1) narrow the transition band so the
106
+ * currents/slicks read as distinct, well-defined regions.
107
+ */
108
+ get tonalSharpness(): number;
109
+ set tonalSharpness(value: number);
110
+ /** Colour the water drifts toward in the tonal variation (current / algae / pollution tint). */
111
+ get tonalColor(): Color;
112
+ set tonalColor(value: Color | string | number);
113
+ get skyColor(): Color;
114
+ set skyColor(value: Color | string | number);
115
+ get horizonColor(): Color;
116
+ set horizonColor(value: Color | string | number);
117
+ get reflectionIntensity(): number;
118
+ set reflectionIntensity(value: number);
119
+ get sunDirection(): Vector3;
120
+ set sunDirection(value: Vector3);
121
+ get sunColor(): Color;
122
+ set sunColor(value: Color | string | number);
123
+ get sunShininess(): number;
124
+ set sunShininess(value: number);
125
+ get foamColor(): Color;
126
+ set foamColor(value: Color | string | number);
127
+ get foamAmount(): number;
128
+ set foamAmount(value: number);
129
+ get fresnelPower(): number;
130
+ set fresnelPower(value: number);
131
+ get detailScale(): number;
132
+ set detailScale(value: number);
133
+ get detailStrength(): number;
134
+ set detailStrength(value: number);
135
+ /** Maximum number of contact footprints this material can render at once. */
136
+ get contactCount(): number;
137
+ /**
138
+ * Upload the current set of floating-object contact footprints. Excess
139
+ * entries beyond {@link contactCount} are ignored. Cheap: it only copies into
140
+ * the preallocated uniform vectors, so it is safe to call every frame.
141
+ */
142
+ setContacts(contacts: OceanContact[]): void;
143
+ /** Clear all contact footprints (no contact foam). */
144
+ clearContacts(): void;
145
+ }
@@ -0,0 +1,93 @@
1
+ import { RefObject } from 'react';
2
+ import { Object3D } from 'three';
3
+ import { OceanMaterial } from './ocean-material';
4
+ /**
5
+ * Read-only sampler for the live ocean surface. Lets non-rendering code (e.g.
6
+ * floating objects) query the water height at any world X/Z, in sync with the
7
+ * animated wave field shown on screen.
8
+ *
9
+ * The height is summed from the same spectral wave components the shader uses
10
+ * (`uWaveA`/`uWaveB` + `uTime`, read by reference from the material), so it
11
+ * always matches the current sea state, wind and animation time. The optional
12
+ * Gerstner horizontal displacement and the render-time footprint LOD fade are
13
+ * intentionally ignored — they are visual-only refinements, not needed for a
14
+ * plausible floating response, and skipping them keeps sampling cheap.
15
+ *
16
+ * Coordinates are in the Ocean group's local frame (sea level = local y 0),
17
+ * which equals world space for the typical flat, unrotated planar ocean.
18
+ */
19
+ export interface OceanSampler {
20
+ /** Water surface height (local y) at the given local X/Z. */
21
+ getHeightAt(x: number, z: number): number;
22
+ /** Significant wave height (m) of the current sea state. */
23
+ readonly significantHeight: number;
24
+ }
25
+ /**
26
+ * Create an {@link OceanSampler} bound to an {@link OceanMaterial}. The sampler
27
+ * reads the material's wave uniforms by reference, so it reflects sea-state and
28
+ * time changes without any extra wiring.
29
+ */
30
+ export declare function createOceanSampler(material: OceanMaterial): OceanSampler;
31
+ /**
32
+ * Context carrying the current {@link OceanSampler}. An `<Ocean>` provides this
33
+ * to its children; floating components read it (directly or via
34
+ * {@link useBuoyancy}) to follow the waves. `null` when the component is not
35
+ * rendered inside an `<Ocean>` (so consumers can fall back to a static pose).
36
+ */
37
+ export declare const OceanSamplerContext: import('react').Context<OceanSampler | null>;
38
+ /**
39
+ * Access the {@link OceanSampler} provided by an enclosing `<Ocean>`, or `null`
40
+ * when there is none.
41
+ */
42
+ export declare function useOceanSampler(): OceanSampler | null;
43
+ /** A body-frame sample point `[x, z]` taken at the object's waterline (y 0). */
44
+ export type BuoyancyPoint = [x: number, z: number];
45
+ /**
46
+ * Options for {@link useBuoyancy}.
47
+ */
48
+ export type BuoyancyOptions = {
49
+ /**
50
+ * Sample points in the object's local X/Z (at its waterline). Required.
51
+ *
52
+ * Place them at the true hull extents (e.g. bow / stern / port / starboard):
53
+ * this is how the object's length and width feed into the motion. Waves
54
+ * shorter than the span between points decorrelate, so the fitted plane
55
+ * yields little pitch/roll (a long ship barely reacts to short chop), while
56
+ * swells longer than the object move it as a whole.
57
+ */
58
+ points: BuoyancyPoint[];
59
+ /** Master switch; when `false` the object is left untouched. Default `true`. */
60
+ enabled?: boolean;
61
+ /**
62
+ * Response rate (per second) of the heave/pitch/roll smoothing. Higher snaps
63
+ * to the waves faster; lower is more sluggish. Default `3`.
64
+ */
65
+ damping?: number;
66
+ /**
67
+ * Relative mass / inertia of the object (default `1`). Models how heavy the
68
+ * object is: the effective response rate is divided by this, so a heavier
69
+ * object follows the surface more slowly and its motion amplitude shrinks for
70
+ * fast waves it cannot keep up with. Use a value relative to a "typical"
71
+ * object of its kind (e.g. `weight / referenceWeight`).
72
+ */
73
+ mass?: number;
74
+ };
75
+ /**
76
+ * Make an object float on the ocean by following the wave field provided by an
77
+ * enclosing `<Ocean>`. Reusable for any floating component: pass a ref to the
78
+ * object's group and a few body-frame sample points (e.g. bow / stern / port /
79
+ * starboard at the waterline).
80
+ *
81
+ * Each frame the water height is sampled at those points (accounting for the
82
+ * object's current heading and X/Z position) and a plane is fitted to them to
83
+ * drive:
84
+ * - heave → `position.y` (mean surface height),
85
+ * - pitch → `rotation.z` (fore/aft slope),
86
+ * - roll → `rotation.x` (port/starboard slope),
87
+ * each critically-damped toward its target so the motion stays smooth and
88
+ * frame-rate independent. The object's heading (`rotation.y`) is left untouched.
89
+ *
90
+ * No-op when there is no enclosing `<Ocean>` (the object keeps its static pose).
91
+ * Allocation-free and only a handful of cheap samples per frame.
92
+ */
93
+ export declare function useBuoyancy(ref: RefObject<Object3D | null>, options: BuoyancyOptions): void;
@@ -0,0 +1,54 @@
1
+ import { Color, ShaderMaterial, ShaderMaterialParameters, Vector4 } from 'three';
2
+ export type OceanVolumeMaterialParameters = ShaderMaterialParameters & {
3
+ waveCount?: number;
4
+ };
5
+ /**
6
+ * OIT-compatible water-body (volume) material for the side walls of an ocean
7
+ * box. Shades the walls as a transparent, depth-tinted blue body (a fog-like
8
+ * tint that builds up with view distance), so the interior reads as water both
9
+ * when the camera is inside the box and when looking in from outside. Rendered
10
+ * double-sided so the walls are visible from either side. Shares the surface's
11
+ * deep and shallow colours so the body matches the surface.
12
+ *
13
+ * The wall's top ring follows the same spectral wave displacement as the ocean
14
+ * surface (tapered to zero at the sea bed) so the rim stays sealed when vertex
15
+ * displacement is enabled. Share the surface's wave tables via
16
+ * {@link OceanVolumeMaterial.setWaveTables} so the walls move in lock-step.
17
+ *
18
+ * Wired for the OITRenderPass via {@link attachOitVariants} (variants share this
19
+ * material's `uniforms` by reference, so animated uniforms stay live).
20
+ */
21
+ export declare class OceanVolumeMaterial extends ShaderMaterial {
22
+ isOceanVolumeMaterial: boolean;
23
+ constructor(parameters?: OceanVolumeMaterialParameters);
24
+ /**
25
+ * Point this material's wave-component uniform arrays at the surface
26
+ * material's tables (by reference) so the displaced wall top ring tracks the
27
+ * surface waves with no extra per-frame work. The surface mutates those
28
+ * Vector4s in place when the sea state changes, so the walls update for free.
29
+ */
30
+ setWaveTables(waveA: Vector4[], waveB: Vector4[]): void;
31
+ get time(): number;
32
+ set time(value: number);
33
+ /** Gerstner choppiness applied to the displaced top-ring swells. */
34
+ get steepness(): number;
35
+ set steepness(value: number);
36
+ /** Top-ring vertex displacement amount (0 = flat top edge, clamped to [0, 1]). */
37
+ get displacement(): number;
38
+ set displacement(value: number);
39
+ get deepColor(): Color;
40
+ set deepColor(value: Color | string | number);
41
+ get shallowColor(): Color;
42
+ set shallowColor(value: Color | string | number);
43
+ /** Per-meter tint build-up through the water body. */
44
+ get fogDensity(): number;
45
+ set fogDensity(value: number);
46
+ /** Densest tint reached far through the water (0..1). */
47
+ get maxOpacity(): number;
48
+ set maxOpacity(value: number);
49
+ /** Animated brightness shimmer amount (0 = off). */
50
+ get shimmer(): number;
51
+ set shimmer(value: number);
52
+ get masterOpacity(): number;
53
+ set masterOpacity(value: number);
54
+ }
@@ -28,6 +28,13 @@ export type SurfaceProps = CommonComponentProps & PointerEvents & {
28
28
  wireframe?: boolean;
29
29
  normalMap?: Texture;
30
30
  normalScale?: Vec2;
31
+ /**
32
+ * Precompute the surface normals into a compact texture instead of deriving
33
+ * them per-fragment from the elevation map. This skips the normal recompute
34
+ * the shader otherwise repeats across the order-independent transparency
35
+ * passes, at the cost of a little extra texture memory. Defaults to `false`.
36
+ */
37
+ precomputeNormals?: boolean;
31
38
  debug?: boolean;
32
39
  };
33
40
  /**
@@ -43,4 +50,4 @@ export type SurfaceProps = CommonComponentProps & PointerEvents & {
43
50
  *
44
51
  * @group Components
45
52
  */
46
- export declare const Surface: ({ meta, color, colorRamp, rampMin, rampMax, reverseRamp, useColorRamp, showContours, contoursInterval, contoursColorMode, contoursColorModeFactor, contoursThickness, contoursColor, opacity, priority, maxError, doubleSide, wireframe, normalMap, normalScale, name, userData, receiveShadow, castShadow, layers, position, renderOrder, visible, debug, onPointerClick, onPointerEnter, onPointerLeave, onPointerMove, }: SurfaceProps) => import("react/jsx-runtime").JSX.Element | null;
53
+ export declare const Surface: ({ meta, color, colorRamp, rampMin, rampMax, reverseRamp, useColorRamp, showContours, contoursInterval, contoursColorMode, contoursColorModeFactor, contoursThickness, contoursColor, opacity, priority, maxError, doubleSide, wireframe, normalMap, normalScale, precomputeNormals, name, userData, receiveShadow, castShadow, layers, position, renderOrder, visible, debug, onPointerClick, onPointerEnter, onPointerLeave, onPointerMove, }: SurfaceProps) => import("react/jsx-runtime").JSX.Element | null;
@@ -20,6 +20,7 @@ export type SurfaceMaterialParameters = ShaderMaterialParameters & MeshLambertMa
20
20
  contoursColor?: string | number | Color;
21
21
  elevationTexture?: Texture;
22
22
  normalTexture?: Texture;
23
+ usePrecomputedNormals?: boolean;
23
24
  debug?: boolean;
24
25
  };
25
26
  /**
@@ -48,6 +49,8 @@ export declare class SurfaceMaterial extends ShaderMaterial {
48
49
  set showContours(value: any);
49
50
  get debug(): any;
50
51
  set debug(value: any);
52
+ get usePrecomputedNormals(): any;
53
+ set usePrecomputedNormals(value: any);
51
54
  dispose(): void;
52
55
  onBeforeCompile(): void;
53
56
  }
@@ -4,4 +4,5 @@ export declare const surfaceTextures = "surfaceTextures";
4
4
  export type SurfaceGeometryResponse = PackedBufferGeometry;
5
5
  export type SurfaceTexturesResponse = {
6
6
  elevationImageBuffer: Float32Array;
7
+ normalImageBuffer?: Uint8Array;
7
8
  };
@@ -0,0 +1,47 @@
1
+ import { TankerDetails } from './TankerSuperstructure';
2
+ export type TankerProps = {
3
+ length?: number;
4
+ width?: number;
5
+ height?: number;
6
+ waterline?: number;
7
+ wireframe?: boolean;
8
+ lengthSegments?: number;
9
+ profileSegments?: number;
10
+ bowLength?: number;
11
+ bowRoundness?: number;
12
+ details?: TankerDetails;
13
+ lowerHullColor?: string;
14
+ upperHullColor?: string;
15
+ deckColor?: string;
16
+ stripeColor?: string;
17
+ superstructureColor?: string;
18
+ /**
19
+ * Float on the waves when rendered inside an `<Ocean>` (heave/pitch/roll
20
+ * driven by the live wave field). No effect outside an `<Ocean>`. Default
21
+ * `true`.
22
+ */
23
+ buoyancy?: boolean;
24
+ /**
25
+ * Displacement in tonnes. Heavier vessels follow the waves more sluggishly
26
+ * (more inertia); lighter ones bob more readily. Default `120000` (Aframax).
27
+ */
28
+ weight?: number;
29
+ /**
30
+ * Spread foam where the hull meets the water when rendered inside an
31
+ * `<Ocean>`. No effect outside an `<Ocean>`. Default `true`.
32
+ */
33
+ contactFoam?: boolean;
34
+ /**
35
+ * Overall scale of the contact foam (0 = none, 1 = full). The actual amount
36
+ * also rises with how much the hull is moving (heave/pitch/roll), so it is
37
+ * stronger in rougher seas and subtle when the vessel sits still. Default `1`.
38
+ */
39
+ contactFoamIntensity?: number;
40
+ /**
41
+ * How much the contact foam is reduced toward the bow and stern, 0..1. 0 = an
42
+ * even collar all around the hull; 1 = foam only along the sides. Default
43
+ * `0.6` (a tanker pushes most water along its long flat sides).
44
+ */
45
+ contactFoamEndFalloff?: number;
46
+ };
47
+ export declare const Tanker: ({ length, width, height, waterline, lengthSegments, profileSegments, bowLength, bowRoundness, wireframe, details, lowerHullColor, upperHullColor, deckColor, stripeColor, superstructureColor, buoyancy, weight, contactFoam, contactFoamIntensity, contactFoamEndFalloff, }: TankerProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,23 @@
1
+ export type TankerDetails = 'low' | 'medium' | 'high';
2
+ export type TankerSuperstructureProps = {
3
+ length: number;
4
+ width: number;
5
+ height: number;
6
+ waterline: number;
7
+ details?: TankerDetails;
8
+ color?: string;
9
+ wireframe?: boolean;
10
+ };
11
+ /**
12
+ * Deck superstructure for the {@link Tanker}: an aft accommodation block with a
13
+ * bridge and a funnel/chimney (always present), plus extra fittings that scale
14
+ * in with the `details` level (railings, helideck, masts, antennas, pipe rack).
15
+ *
16
+ * All dimensions are derived from the ship's dimensions so the structure scales
17
+ * with the hull. Parts are built from Three.js primitives and overlap their
18
+ * supports slightly to stay free of z-fighting.
19
+ *
20
+ * Coordinate frame matches the hull: origin at the waterline midship, bow +X,
21
+ * up +Y, starboard +Z; the top deck sits at y = height - waterline.
22
+ */
23
+ export declare const TankerSuperstructure: ({ length, width, height, waterline, details, color, wireframe, }: TankerSuperstructureProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,21 @@
1
+ import * as THREE from 'three';
2
+ interface TankerHullParams {
3
+ length: number;
4
+ width: number;
5
+ height: number;
6
+ waterline: number;
7
+ lengthSegments: number;
8
+ profileSegments: number;
9
+ bowLength: number;
10
+ bowRoundness: number;
11
+ }
12
+ /**
13
+ * Creates a THREE.BufferGeometry for an oil tanker hull
14
+ * Uses a loft/sweep approach: sweep a cross-section profile along the ship's length
15
+ * and adding bow and stern sections to close the hull.
16
+ *
17
+ * Coordinate frame: origin at the waterline, midship. Bow faces +X, vertical is +Y,
18
+ * starboard is +Z. Keel sits at y = -waterline, deck at y = height - waterline.
19
+ */
20
+ export declare function createTankerHull(params?: Partial<TankerHullParams>): THREE.BufferGeometry;
21
+ export {};
@@ -1,4 +1,4 @@
1
1
  import { SurfaceTexturesResponse } from '../main';
2
2
  import { PackedBufferGeometry, ReadonlyStore } from '../sdk';
3
- export declare function generateSurfaceTexturesData(this: ReadonlyStore, id: string): Promise<SurfaceTexturesResponse | null>;
3
+ export declare function generateSurfaceTexturesData(this: ReadonlyStore, id: string, computeNormals?: boolean): Promise<SurfaceTexturesResponse | null>;
4
4
  export declare function generateSurfaceGeometry(this: ReadonlyStore, id: string, maxError?: number): Promise<PackedBufferGeometry | null>;
@@ -1,5 +1,9 @@
1
1
  import { Layers } from 'three';
2
2
  export declare const LAYERS: {
3
+ OIT_EXCLUDED: number;
4
+ FORCE_OPAQUE: number;
5
+ OVERLAY: number;
6
+ EMISSIVE: number;
3
7
  NOT_EMITTER: number;
4
8
  EMITTER: number;
5
9
  };
@@ -9,6 +9,7 @@ export * from './components/Grids';
9
9
  export * from './components/Highlighter';
10
10
  export * from './components/Html';
11
11
  export * from './components/ObservableGroup/ObservableGroup';
12
+ export * from './components/Ocean';
12
13
  export * from './components/SDFTest/SDFTest';
13
14
  export * from './components/Surfaces';
14
15
  export * from './components/Symbol';
@@ -0,0 +1,59 @@
1
+ import { Side } from 'three';
2
+ /**
3
+ * Props for {@link OitMaterial}.
4
+ * @expand
5
+ */
6
+ export type OitMaterialProps = {
7
+ /**
8
+ * Force a specific `side` on the OIT variants (e.g. `DoubleSide`). Defaults to
9
+ * the material's own side.
10
+ */
11
+ side?: Side;
12
+ /**
13
+ * Names of custom uniform-container properties on the material to share by
14
+ * reference with the per-pass variants. Only needed for non-`ShaderMaterial`
15
+ * materials that read a custom uniforms object in `onBeforeCompile`.
16
+ */
17
+ shareUniforms?: string[];
18
+ /**
19
+ * Names of value properties (e.g. `color`, `metalness`) to keep live on the
20
+ * per-pass variants of a cloned built-in material. See
21
+ * {@link OitMaterialOptions.syncProperties}. Ignored for `ShaderMaterial`s
22
+ * (already live via shared uniforms).
23
+ */
24
+ syncProperties?: string[];
25
+ /**
26
+ * - `inject` (default): patch the material's shaders at compile time (stock or
27
+ * inline materials whose shader does not already include `oit.glsl`).
28
+ * - `attach`: the material's shader already `#include`s `oit.glsl` and calls
29
+ * `oitProcess` (library materials); only wire up the variant machinery.
30
+ */
31
+ mode?: 'inject' | 'attach';
32
+ };
33
+ /**
34
+ * A declarative helper that makes the material of its parent `mesh` participate in
35
+ * the {@link OITRenderPass} pipeline, so transparent inline materials are resolved
36
+ * order-independently instead of being treated as opaque occluders.
37
+ *
38
+ * Drop it in as a sibling of the material, inside the `mesh`:
39
+ *
40
+ * ```tsx
41
+ * <mesh geometry={geometry}>
42
+ * <shaderMaterial
43
+ * uniforms={uniforms}
44
+ * vertexShader={vertexShader}
45
+ * fragmentShader={fragmentShader}
46
+ * transparent
47
+ * />
48
+ * <OitMaterial side={DoubleSide} />
49
+ * </mesh>
50
+ * ```
51
+ *
52
+ * It renders an invisible, empty `object3D` purely to locate the parent mesh; the
53
+ * wiring is idempotent and a no-op outside the OIT pipeline.
54
+ *
55
+ * @group Rendering
56
+ * @see {@link makeOitCompatible}
57
+ * @see {@link attachOitVariants}
58
+ */
59
+ export declare function OitMaterial({ side, shareUniforms, syncProperties, mode, }: OitMaterialProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,16 @@
1
+ import { Color, WebGLRenderer, WebGLRenderTarget } from 'three';
2
+ export declare abstract class Pass {
3
+ writeToScreen: boolean;
4
+ /**
5
+ * Explicit background for passes that clear the frame (e.g. {@link RenderPass} and
6
+ * the OIT opaque clear). When set, the pass clears to this colour/alpha instead of
7
+ * the renderer's current clear state, giving a single source of truth so the
8
+ * background is identical regardless of which base pass renders the scene. When
9
+ * `null` the pass falls back to the renderer's current clear colour/alpha.
10
+ */
11
+ clearColor: Color | null;
12
+ clearAlpha: number;
13
+ setSize?(width: number, height: number, pixelRatio: number): void;
14
+ dispose?(): void;
15
+ abstract render(renderer: WebGLRenderer, buffer: WebGLRenderTarget): void;
16
+ }
@@ -0,0 +1,46 @@
1
+ import { Pass } from './Pass';
2
+ /**
3
+ * Props for the {@link RenderingPipeline} component.
4
+ * @expand
5
+ */
6
+ export type RenderingPipelineProps = {
7
+ /** Ordered list of passes to execute every frame. */
8
+ passes: Pass[];
9
+ /**
10
+ * Multisample count (MSAA) for the main render target. Defaults to 0.
11
+ *
12
+ * This applies hardware MSAA to the pipeline's shared render target and is only
13
+ * meaningful for an opaque {@link RenderPass}-based pipeline. When the base pass
14
+ * is an {@link OITRenderPass}, keep this at `0`: OIT renders into its own
15
+ * multi-target buffers, so pipeline-level MSAA would add cost without
16
+ * anti-aliasing the resolved result. Use {@link OITRenderPass.opaqueSamples}
17
+ * instead to multisample the opaque sub-pass inside OIT.
18
+ */
19
+ samples?: number;
20
+ /** Render target supersampling factor. Defaults to 1. */
21
+ supersample?: number;
22
+ /** Frame priority (passed to `useFrame`). Defaults to 1. */
23
+ priority?: number;
24
+ };
25
+ /**
26
+ * Generic render pipeline component that runs an ordered list of {@link Pass} objects
27
+ * against a shared `WebGLRenderTarget` (color + depth texture). Use it to compose
28
+ * custom rendering pipelines — e.g. a {@link OITRenderPass} based pipeline for
29
+ * order-independent transparency.
30
+ *
31
+ * @example
32
+ * ```tsx
33
+ * const passes = useMemo(
34
+ * () => [new OITRenderPass(scene, camera), new OutputPass()],
35
+ * [scene, camera],
36
+ * );
37
+ * return <RenderingPipeline passes={passes} />;
38
+ * ```
39
+ *
40
+ * @group Components
41
+ * @category Rendering
42
+ * @see {@link Pass}
43
+ * @see {@link OITRenderPass}
44
+ * @see {@link OutputPass}
45
+ */
46
+ export declare const RenderingPipeline: ({ passes, samples, supersample, priority, }: RenderingPipelineProps) => null;
@@ -0,0 +1,22 @@
1
+ import { RawShaderMaterial, WebGLRenderer, WebGLRenderTarget } from 'three';
2
+ import { FullscreenRenderer } from '../fullscreen-renderer';
3
+ import { Pass } from '../Pass';
4
+ /**
5
+ * Alternative output pass that performs an explicit NxN box downsample of the
6
+ * supersampled buffer straight to the screen. Intended purely as an A/B reference
7
+ * against the mipmap-based {@link OutputPass}: with the same scene/pattern and
8
+ * supersample factor, the only difference is the resample filter, which isolates
9
+ * whether the perceived aliasing comes from the downsample step.
10
+ *
11
+ * Tone mapping is not applied here (only sRGB / linear output encode), so pair it
12
+ * with tone mapping = none for a fair comparison. Story/debug only.
13
+ */
14
+ export declare class DebugBoxOutputPass extends Pass {
15
+ fullscreenRenderer: FullscreenRenderer;
16
+ material: RawShaderMaterial;
17
+ supersample: number;
18
+ constructor(supersample?: number);
19
+ setSize(width: number, height: number): void;
20
+ render(renderer: WebGLRenderer, buffer: WebGLRenderTarget): void;
21
+ dispose(): void;
22
+ }
@@ -0,0 +1,30 @@
1
+ import { RawShaderMaterial, WebGLRenderer, WebGLRenderTarget } from 'three';
2
+ import { FullscreenRenderer } from '../fullscreen-renderer';
3
+ import { Pass } from '../Pass';
4
+ /**
5
+ * Named test signals produced by {@link DebugPatternPass}.
6
+ * - `zonePlate` / `grid` / `checker`: high-frequency signals for anti-aliasing /
7
+ * supersampling / downsample inspection.
8
+ * - `gradient` / `colorBars` / `grayStep` / `grayCard`: known linear values for
9
+ * colour-space and tone-mapping verification.
10
+ */
11
+ export type DebugPattern = 'zonePlate' | 'grid' | 'checker' | 'gradient' | 'colorBars' | 'grayStep' | 'grayCard';
12
+ /**
13
+ * Debug pass that overwrites the shared pipeline buffer with a synthetic test
14
+ * signal (see {@link DebugPattern}). It writes *linear* values at the buffer's
15
+ * (supersampled) resolution, replacing scene geometry so the rest of the pipeline
16
+ * — supersample downsample, tone mapping and output colour-space encode — can be
17
+ * validated against a known input.
18
+ *
19
+ * Story/debug only — not part of the public rendering API.
20
+ */
21
+ export declare class DebugPatternPass extends Pass {
22
+ fullscreenRenderer: FullscreenRenderer;
23
+ material: RawShaderMaterial;
24
+ constructor(pattern?: DebugPattern, scale?: number);
25
+ set pattern(value: DebugPattern);
26
+ set scale(value: number);
27
+ setSize(width: number, height: number): void;
28
+ render(renderer: WebGLRenderer, buffer: WebGLRenderTarget): void;
29
+ dispose(): void;
30
+ }
@@ -4,6 +4,7 @@ export declare class FullscreenRenderer {
4
4
  mesh: Mesh;
5
5
  copyMaterial: RawShaderMaterial;
6
6
  constructor();
7
+ dispose(): void;
7
8
  renderMaterial(renderer: WebGLRenderer, buffer: WebGLRenderTarget | null, material: Material): void;
8
9
  renderTexture(renderer: WebGLRenderer, buffer: WebGLRenderTarget | null, texture: Texture, opacity?: number): void;
9
10
  }