@equinor/videx-3d 2.0.0 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-DKAquGKk.js +2820 -0
- package/dist/chunk-DsUZyEG_.js +16 -0
- package/dist/generators.js +512 -727
- package/dist/main.js +7182 -10552
- package/dist/sdk.js +2 -787
- package/dist/src/sdk/materials/shaderLib/procedural-normal.glsl +274 -0
- package/dist/types/components/Ocean/Ocean.d.ts +333 -0
- package/dist/types/components/Ocean/index.d.ts +6 -0
- package/dist/types/components/Ocean/ocean-bed-material.d.ts +60 -0
- package/dist/types/components/Ocean/ocean-contact.d.ts +39 -0
- package/dist/types/components/Ocean/ocean-material.d.ts +145 -0
- package/dist/types/components/Ocean/ocean-sampler.d.ts +93 -0
- package/dist/types/components/Ocean/ocean-volume-material.d.ts +54 -0
- package/dist/types/components/Tanker/Tanker.d.ts +47 -0
- package/dist/types/components/Tanker/TankerSuperstructure.d.ts +23 -0
- package/dist/types/components/Tanker/tanker-geometry-builder.d.ts +21 -0
- package/dist/types/components/Wellbores/Casings/CasingMaterial.d.ts +229 -1
- package/dist/types/components/Wellbores/Casings/CasingSection.d.ts +6 -1
- package/dist/types/components/Wellbores/Casings/Casings.d.ts +45 -4
- package/dist/types/components/Wellbores/Casings/casings-defs.d.ts +44 -0
- package/dist/types/components/Wellbores/Casings/index.d.ts +2 -1
- package/dist/types/main.d.ts +1 -0
- package/dist/types/rendering/Pass.d.ts +10 -1
- package/dist/types/rendering/RenderingPipeline.d.ts +10 -1
- package/dist/types/rendering/debug/DebugBoxOutputPass.d.ts +22 -0
- package/dist/types/rendering/debug/DebugPatternPass.d.ts +30 -0
- package/dist/types/rendering/fxaa-resolver.d.ts +25 -0
- package/dist/types/rendering/index.d.ts +1 -0
- package/dist/types/rendering/passes/AnnotationsPass.d.ts +1 -0
- package/dist/types/rendering/passes/FXAAPass.d.ts +11 -6
- package/dist/types/rendering/passes/OITRenderPass.d.ts +147 -0
- package/dist/types/rendering/passes/OutputPass.d.ts +9 -0
- package/dist/types/rendering/passes/RenderPass.d.ts +2 -0
- package/dist/types/rendering/passes/index.d.ts +0 -2
- package/dist/types/rendering/smaa-resolver.d.ts +58 -0
- package/dist/types/rendering/taa-resolver.d.ts +161 -0
- package/dist/types/rendering/temporal-resolver.d.ts +152 -0
- package/dist/types/sdk/geometries/boundary-loops.d.ts +38 -0
- package/dist/types/sdk/geometries/geometry-attributes.d.ts +37 -0
- package/dist/types/sdk/geometries/grid-sampling.d.ts +50 -0
- package/dist/types/sdk/geometries/ocean-geometry.d.ts +288 -0
- package/dist/types/sdk/geometries/packing.d.ts +1 -1
- package/dist/types/sdk/geometries/tessellation.d.ts +25 -0
- package/dist/types/sdk/index.d.ts +5 -0
- package/dist/types/sdk/utils/vector-operations.d.ts +7 -0
- package/package.json +11 -18
- package/dist/chunk-61X6qE5N.js +0 -981
- package/dist/chunk-ChG5d4HC.js +0 -675
- package/dist/chunk-DuRASjkF.js +0 -17
- package/dist/chunk-M-Pcc_Yg.js +0 -689
- package/dist/types/rendering/passes/SMAAPass.d.ts +0 -40
- package/dist/types/rendering/passes/TAAPass.d.ts +0 -94
- /package/dist/{shaderLib → src/sdk/materials/shaderLib}/color-conversion.glsl +0 -0
- /package/dist/{shaderLib → src/sdk/materials/shaderLib}/colors.glsl +0 -0
- /package/dist/{shaderLib → src/sdk/materials/shaderLib}/glyphs.glsl +0 -0
- /package/dist/{shaderLib → src/sdk/materials/shaderLib}/oit.glsl +0 -0
- /package/dist/{shaderLib → src/sdk/materials/shaderLib}/random.glsl +0 -0
- /package/dist/{shaderLib → src/sdk/materials/shaderLib}/remap.glsl +0 -0
- /package/dist/{shaderLib → src/sdk/materials/shaderLib}/render-number.glsl +0 -0
- /package/dist/{shaderLib → src/sdk/materials/shaderLib}/render-text.glsl +0 -0
- /package/dist/{shaderLib → src/sdk/materials/shaderLib}/rotation.glsl +0 -0
- /package/dist/{shaderLib → src/sdk/materials/shaderLib}/sdf-functions.glsl +0 -0
- /package/dist/textures/{normal_map.jpg → public/normal_map.jpg} +0 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { OceanContact } from './ocean-material';
|
|
2
|
+
/**
|
|
3
|
+
* A function returning a floating object's current contact footprint (in the
|
|
4
|
+
* ocean's local frame), or `null` when it is temporarily not touching the water
|
|
5
|
+
* (so it can be skipped). Read every frame by the enclosing `<Ocean>`, so it
|
|
6
|
+
* should reflect the object's live position/heading.
|
|
7
|
+
*/
|
|
8
|
+
export type OceanContactSource = () => OceanContact | null;
|
|
9
|
+
/**
|
|
10
|
+
* Registry provided by an `<Ocean>` so its floating children can contribute
|
|
11
|
+
* contact-foam footprints. Floating components register a source and are
|
|
12
|
+
* unregistered automatically on unmount.
|
|
13
|
+
*/
|
|
14
|
+
export interface OceanContactRegistry {
|
|
15
|
+
/** Register a footprint source; returns a function that unregisters it. */
|
|
16
|
+
register(source: OceanContactSource): () => void;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Context carrying the enclosing `<Ocean>`'s {@link OceanContactRegistry}, or
|
|
20
|
+
* `null` when the component is not rendered inside an `<Ocean>`.
|
|
21
|
+
*/
|
|
22
|
+
export declare const OceanContactContext: import('react').Context<OceanContactRegistry | null>;
|
|
23
|
+
/**
|
|
24
|
+
* Register a floating object's contact footprint with the enclosing `<Ocean>`
|
|
25
|
+
* so it spreads foam where it meets the water. Reusable by any floating
|
|
26
|
+
* component: pass a function that returns the object's current footprint (centre,
|
|
27
|
+
* heading and half-extents) each frame.
|
|
28
|
+
*
|
|
29
|
+
* No-op when there is no enclosing `<Ocean>` or when `enabled` is `false`. The
|
|
30
|
+
* source function is read through a ref, so it can close over changing values
|
|
31
|
+
* without re-registering every render.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* useOceanContact(
|
|
35
|
+
* () => ({ x, z, heading, halfLength, halfWidth, foamWidth }),
|
|
36
|
+
* enabled,
|
|
37
|
+
* );
|
|
38
|
+
*/
|
|
39
|
+
export declare function useOceanContact(getContact: OceanContactSource, enabled?: boolean): void;
|
|
@@ -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
|
+
}
|
|
@@ -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,5 +1,137 @@
|
|
|
1
1
|
import { MeshStandardMaterial, MeshStandardMaterialParameters, Uniform, WebGLProgramParametersWithUniforms } from 'three';
|
|
2
|
+
/**
|
|
3
|
+
* Parameters accepted by {@link CasingMaterial}. A `MeshStandardMaterial` at heart, so
|
|
4
|
+
* it takes the familiar PBR knobs (`color`, `roughness`, `metalness`, `emissive`,
|
|
5
|
+
* `envMap`, `envMapIntensity`, ...) plus the casing texture-UV units and the grouped
|
|
6
|
+
* {@link CasingEffects | effects} below.
|
|
7
|
+
*
|
|
8
|
+
* @expand
|
|
9
|
+
*/
|
|
10
|
+
export type CasingMaterialParameters = MeshStandardMaterialParameters & {
|
|
11
|
+
/** UV units for the base `map` (and the aoMap/lightMap/emissiveMap/metalnessMap/
|
|
12
|
+
* roughnessMap group): `'normalized'` = 0..1 around/along, `'world'` = object-space
|
|
13
|
+
* distance (arc length x trajectory distance) so `texture.repeat` becomes a density
|
|
14
|
+
* that stays consistent across sections of different radius and length. Default
|
|
15
|
+
* `'normalized'`. */
|
|
16
|
+
mapUvUnits?: 'normalized' | 'world';
|
|
17
|
+
/** UV units for `normalMap` / `bumpMap`, independent of `mapUvUnits`. Default
|
|
18
|
+
* `'normalized'`. */
|
|
19
|
+
normalMapUvUnits?: 'normalized' | 'world';
|
|
20
|
+
/** Grouped casing stylization effects (silhouette outline, section edge shading,
|
|
21
|
+
* procedural weathering, per-section variation and micro-normal surface detail).
|
|
22
|
+
* Every sub-effect is optional and independent; omitted ones fall back to their
|
|
23
|
+
* defaults (mostly off). */
|
|
24
|
+
effects?: CasingEffects;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Composable casing stylization effects for {@link CasingMaterial}. Every field is
|
|
28
|
+
* optional and independent; the procedural surface-detail layers (`granular`,
|
|
29
|
+
* `brushed`, `scratches`) simply sum. Strengths default to 0 (off) unless noted.
|
|
30
|
+
* @expand
|
|
31
|
+
*/
|
|
32
|
+
export type CasingEffects = {
|
|
33
|
+
/** View-space silhouette darkening that outlines each shell, helping nested strings
|
|
34
|
+
* read apart (especially under slicing / auto-slice). */
|
|
35
|
+
silhouette?: {
|
|
36
|
+
/** 0-1 strength (0 = off). Default 0. */
|
|
37
|
+
strength?: number;
|
|
38
|
+
/** Exponent tightening the rim toward the edge (higher = tighter). Default 3. */
|
|
39
|
+
power?: number;
|
|
40
|
+
};
|
|
41
|
+
/** Darkening at each section's own top/bottom edges. */
|
|
42
|
+
edgeShading?: {
|
|
43
|
+
/** 0-1 strength (0 = off). Default 0. */
|
|
44
|
+
strength?: number;
|
|
45
|
+
/** Distance in metres the darkening reaches from each edge, independent of section
|
|
46
|
+
* length. Default 0.2. */
|
|
47
|
+
width?: number;
|
|
48
|
+
};
|
|
49
|
+
/** Procedural wear/tear/spill (no textures), pinned in world space. */
|
|
50
|
+
weathering?: {
|
|
51
|
+
/** 0-1 strength (0 = off). Default 0. */
|
|
52
|
+
strength?: number;
|
|
53
|
+
/** Noise frequency in cells per real-world metre (lower = larger, sparser smears).
|
|
54
|
+
* Default 1.5. */
|
|
55
|
+
scale?: number;
|
|
56
|
+
/** 0-1 per-material multiplier (1 = full wear, 0 = none) so a preset such as the
|
|
57
|
+
* matte shoe can resist the weathering. Default 1. */
|
|
58
|
+
resistance?: number;
|
|
59
|
+
};
|
|
60
|
+
/** 0-1 per-section wear variation so adjacent telescoping strings read apart by
|
|
61
|
+
* looking differently worn rather than by a colour/value ramp. Default 0. */
|
|
62
|
+
sectionVariation?: number;
|
|
63
|
+
/** 0-1 performance vs. quality of the procedural surface detail (a fill-rate knob;
|
|
64
|
+
* off-effects always cost nothing regardless). Lower = cheaper: fewer weathering fbm
|
|
65
|
+
* octaves (2 at 0 .. 4 at 1) and the coarse/long scratch family only runs at >= 0.66.
|
|
66
|
+
* 1 = full-detail reference. Default 0.6. */
|
|
67
|
+
detailQuality?: number;
|
|
68
|
+
/** Isotropic value-noise bumps. */
|
|
69
|
+
granular?: {
|
|
70
|
+
/** 0-1 strength (0 = off). Default 0. */
|
|
71
|
+
strength?: number;
|
|
72
|
+
/** Cells per world (object-distance) unit. Default 2. */
|
|
73
|
+
frequency?: number;
|
|
74
|
+
/** 1-5 fbm octaves. Default 3. */
|
|
75
|
+
octaves?: number;
|
|
76
|
+
/** 0-1 stretch of the cells along the trajectory axis. Default 0. */
|
|
77
|
+
anisotropy?: number;
|
|
78
|
+
};
|
|
79
|
+
/** Directional fine grain (many thin parallel ridges). */
|
|
80
|
+
brushed?: {
|
|
81
|
+
/** 0-1 strength (0 = off). Default 0. */
|
|
82
|
+
strength?: number;
|
|
83
|
+
/** Cells per world (object-distance) unit. Default 2. */
|
|
84
|
+
frequency?: number;
|
|
85
|
+
/** 1-5 fbm octaves. Default 3. */
|
|
86
|
+
octaves?: number;
|
|
87
|
+
/** Grain direction in radians (0 = along the trajectory axis; non-zero angles
|
|
88
|
+
* reintroduce a faint seam on a full shell). Default 0. */
|
|
89
|
+
angle?: number;
|
|
90
|
+
/** 0-1 line thinness. Default 0.5. */
|
|
91
|
+
sharpness?: number;
|
|
92
|
+
/** 0-1 blend from an irregular grain (0) to regular, evenly-spaced flutes (1).
|
|
93
|
+
* Default 0. */
|
|
94
|
+
uniformity?: number;
|
|
95
|
+
};
|
|
96
|
+
/** Sparse, hair-thin surface scuffs that glint under changing light (their relief is
|
|
97
|
+
* kept very shallow - visibility comes from a localized polish, not depth). */
|
|
98
|
+
scratches?: {
|
|
99
|
+
/** 0-1 strength (0 = off). Default 0. */
|
|
100
|
+
strength?: number;
|
|
101
|
+
/** Cells per world (object-distance) unit. Default 10. */
|
|
102
|
+
frequency?: number;
|
|
103
|
+
/** Scratch direction in radians (0 = along the trajectory axis). Default 0. */
|
|
104
|
+
angle?: number;
|
|
105
|
+
/** 0-1 how many scratches survive. Default 0.4. */
|
|
106
|
+
density?: number;
|
|
107
|
+
/** Average scratch length multiplier (>0). Default 0.6. */
|
|
108
|
+
length?: number;
|
|
109
|
+
/** 0-1 how much the scratch direction drifts. Default 1. */
|
|
110
|
+
wander?: number;
|
|
111
|
+
/** 0-1 groove width, frequency-independent (world-scaled, hair/needle-thin:
|
|
112
|
+
* ~0.02..0.12mm half-width). Default 0.15. */
|
|
113
|
+
width?: number;
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
/**
|
|
117
|
+
* Physically-based (PBR) material for `Casings` / `CasingSection`. A
|
|
118
|
+
* `MeshStandardMaterial` at its core - so casings pick up real image-based
|
|
119
|
+
* reflections from the scene `environment`, exactly matching neighbouring
|
|
120
|
+
* `CompletionTools` - with the casing-specific stylization (procedural weathering,
|
|
121
|
+
* granular/brushed/scratch micro-normal detail, silhouette darkening and edge shading)
|
|
122
|
+
* spliced into its shaders via `onBeforeCompile`, and the slicing/vertex
|
|
123
|
+
* transform driven by the same custom attributes as the picking material.
|
|
124
|
+
*
|
|
125
|
+
* OIT-capable via {@link makeOitCompatible} so casings participate in the
|
|
126
|
+
* `OITRenderPass` hybrid pipeline (a no-op in the default render loop).
|
|
127
|
+
*/
|
|
2
128
|
export declare class CasingMaterial extends MeshStandardMaterial {
|
|
129
|
+
isCasingMaterial: boolean;
|
|
130
|
+
private _weathering;
|
|
131
|
+
private _wearResistance;
|
|
132
|
+
private _wellLength;
|
|
133
|
+
/** Custom uniforms bound into the patched program in `onBeforeCompile` and
|
|
134
|
+
* shared by reference with the OIT variants so per-frame updates propagate. */
|
|
3
135
|
uniforms: {
|
|
4
136
|
sizeMultiplier: Uniform<number>;
|
|
5
137
|
radius: Uniform<number>;
|
|
@@ -7,8 +139,40 @@ export declare class CasingMaterial extends MeshStandardMaterial {
|
|
|
7
139
|
sliceOffset: Uniform<number>;
|
|
8
140
|
sliceAngle: Uniform<number>;
|
|
9
141
|
autoSlicePosition: Uniform<boolean>;
|
|
142
|
+
sectionVariation: Uniform<number>;
|
|
143
|
+
silhouette: Uniform<number>;
|
|
144
|
+
silhouettePower: Uniform<number>;
|
|
145
|
+
edgeShading: Uniform<number>;
|
|
146
|
+
edgeShadingWidth: Uniform<number>;
|
|
147
|
+
sectionIndex: Uniform<number>;
|
|
148
|
+
detailFadeNear: Uniform<number>;
|
|
149
|
+
detailFadeFar: Uniform<number>;
|
|
150
|
+
detailQuality: Uniform<number>;
|
|
151
|
+
schematic: Uniform<number>;
|
|
152
|
+
mapUvWorld: Uniform<number>;
|
|
153
|
+
normalMapUvWorld: Uniform<number>;
|
|
154
|
+
wellLength: Uniform<number>;
|
|
155
|
+
granularStrength: Uniform<number>;
|
|
156
|
+
granularFrequency: Uniform<number>;
|
|
157
|
+
granularOctaves: Uniform<number>;
|
|
158
|
+
granularAnisotropy: Uniform<number>;
|
|
159
|
+
brushedStrength: Uniform<number>;
|
|
160
|
+
brushedFrequency: Uniform<number>;
|
|
161
|
+
brushedOctaves: Uniform<number>;
|
|
162
|
+
brushedAngle: Uniform<number>;
|
|
163
|
+
brushedSharpness: Uniform<number>;
|
|
164
|
+
brushedUniformity: Uniform<number>;
|
|
165
|
+
scratchStrength: Uniform<number>;
|
|
166
|
+
scratchFrequency: Uniform<number>;
|
|
167
|
+
scratchAngle: Uniform<number>;
|
|
168
|
+
scratchDensity: Uniform<number>;
|
|
169
|
+
scratchLength: Uniform<number>;
|
|
170
|
+
scratchWander: Uniform<number>;
|
|
171
|
+
scratchWidth: Uniform<number>;
|
|
172
|
+
weathering: Uniform<number>;
|
|
173
|
+
weatheringScale: Uniform<number>;
|
|
10
174
|
};
|
|
11
|
-
constructor(
|
|
175
|
+
constructor(parameters?: CasingMaterialParameters);
|
|
12
176
|
get sizeMultiplier(): number;
|
|
13
177
|
set sizeMultiplier(v: number);
|
|
14
178
|
get radius(): number;
|
|
@@ -21,5 +185,69 @@ export declare class CasingMaterial extends MeshStandardMaterial {
|
|
|
21
185
|
set sliceAngle(v: number);
|
|
22
186
|
get autoSlicePosition(): boolean;
|
|
23
187
|
set autoSlicePosition(v: boolean);
|
|
188
|
+
/** 0-1 strength of the per-section wear variation: how much each section's
|
|
189
|
+
* procedural wear is offset (seed) and scaled (amount) by its index, so adjacent
|
|
190
|
+
* telescoping strings read apart by looking differently worn rather than by a
|
|
191
|
+
* colour/value ramp. */
|
|
192
|
+
get sectionVariation(): number;
|
|
193
|
+
set sectionVariation(v: number);
|
|
194
|
+
/** 0-1 strength of the view-space silhouette darkening (outlines each shell). */
|
|
195
|
+
get silhouette(): number;
|
|
196
|
+
set silhouette(v: number);
|
|
197
|
+
/** Exponent tightening the silhouette rim toward the edge (higher = tighter). Default 3. */
|
|
198
|
+
get silhouettePower(): number;
|
|
199
|
+
set silhouettePower(v: number);
|
|
200
|
+
/** 0-1 strength of the edge shading (darkening at each section's own top/bottom edges). */
|
|
201
|
+
get edgeShading(): number;
|
|
202
|
+
set edgeShading(v: number);
|
|
203
|
+
/** Distance in metres the edge shading reaches from each section edge. Default 0.2. */
|
|
204
|
+
get edgeShadingWidth(): number;
|
|
205
|
+
set edgeShadingWidth(v: number);
|
|
206
|
+
/** Index of this section within the wellbore's casing stack, used to seed the
|
|
207
|
+
* per-section variation of the stylization effects. */
|
|
208
|
+
get sectionIndex(): number;
|
|
209
|
+
set sectionIndex(v: number);
|
|
210
|
+
/** 0-1 performance vs. quality of the procedural surface detail (fill-rate knob).
|
|
211
|
+
* Lower = cheaper (fewer weathering fbm octaves; the coarse scratch family only runs
|
|
212
|
+
* at >= 0.66); 1 = full-detail reference. */
|
|
213
|
+
get detailQuality(): number;
|
|
214
|
+
set detailQuality(v: number);
|
|
215
|
+
/** Unlit "schematic" shading mode: flat material `color` + `silhouette` outline only,
|
|
216
|
+
* with all lighting/env, textures and realism detail ignored. Set by the `Casings`
|
|
217
|
+
* component's `schematic` prop; the slice is locked separately (component side). */
|
|
218
|
+
get schematic(): boolean;
|
|
219
|
+
set schematic(v: boolean);
|
|
220
|
+
/** 0-1 strength of the procedural wear/tear/spill surface detail (no textures). The
|
|
221
|
+
* effective amount is scaled per-material by {@link wearResistance}. */
|
|
222
|
+
get weathering(): number;
|
|
223
|
+
set weathering(v: number);
|
|
224
|
+
/** 0-1 per-material wear multiplier (1 = full wear, 0 = none). Lets material presets
|
|
225
|
+
* (e.g. the matte shoe) resist the procedural weathering the component applies
|
|
226
|
+
* globally via {@link weathering}. */
|
|
227
|
+
get wearResistance(): number;
|
|
228
|
+
set wearResistance(v: number);
|
|
229
|
+
/** Weathering noise frequency in cells per real-world metre (lower = larger,
|
|
230
|
+
* sparser smears). */
|
|
231
|
+
get weatheringScale(): number;
|
|
232
|
+
set weatheringScale(v: number);
|
|
233
|
+
/** Real-world total length (metres) of the whole wellbore trajectory. Uploaded as a
|
|
234
|
+
* uniform and used by the vertex shader to derive each section's physical length
|
|
235
|
+
* (`vSectionLength`) and the along-axis coordinate (`casingAxial`). The weathering is
|
|
236
|
+
* pinned in world space (via `vWorldPos`) and does not use it. */
|
|
237
|
+
get wellLength(): number;
|
|
238
|
+
set wellLength(v: number);
|
|
239
|
+
/** UV units for the base `map` group. `'world'` uses object-space distance so
|
|
240
|
+
* `texture.repeat` is a radius/length-consistent density. */
|
|
241
|
+
get mapUvUnits(): 'normalized' | 'world';
|
|
242
|
+
set mapUvUnits(v: 'normalized' | 'world');
|
|
243
|
+
/** UV units for `normalMap` / `bumpMap`, independent of {@link mapUvUnits}. */
|
|
244
|
+
get normalMapUvUnits(): 'normalized' | 'world';
|
|
245
|
+
set normalMapUvUnits(v: 'normalized' | 'world');
|
|
246
|
+
/** Grouped casing stylization effects (silhouette, edge shading, weathering,
|
|
247
|
+
* per-section variation and the granular/brushed/scratch micro-normal layers).
|
|
248
|
+
* Reading returns the current settings reconstructed from the uniforms. Assigning
|
|
249
|
+
* applies the whole group at once - omitted sub-effects reset to their defaults. */
|
|
250
|
+
get effects(): CasingEffects;
|
|
251
|
+
set effects(v: CasingEffects | undefined);
|
|
24
252
|
onBeforeCompile(parameters: WebGLProgramParametersWithUniforms): void;
|
|
25
253
|
}
|