1 | import { Color, ColorRepresentation } from "../math/Color.js";
|
2 |
|
3 | export interface FogExp2JSON {
|
4 | type: string;
|
5 | name: string;
|
6 | color: number;
|
7 | density: number;
|
8 | }
|
9 |
|
10 | /**
|
11 | * This class contains the parameters that define exponential squared fog, which gives a clear view near the camera and a faster than exponentially densening fog farther from the camera.
|
12 | * @example
|
13 | * ```typescript
|
14 | * const scene = new THREE.Scene();
|
15 | * scene.fog = new THREE.FogExp2(0xcccccc, 0.002);
|
16 | * ```
|
17 | * @see Example: {@link https://threejs.org/examples/#webgl_geometry_terrain | webgl geometry terrain}
|
18 | * @see {@link https://threejs.org/docs/index.html#api/en/scenes/FogExp2 | Official Documentation}
|
19 | * @see {@link https://github.com/mrdoob/three.js/blob/master/src/scenes/FogExp2.js | Source}
|
20 | */
|
21 | export class FogExp2 {
|
22 | /**
|
23 | * The color parameter is passed to the {@link THREE.Color | Color} constructor to set the color property
|
24 | * @remarks Color can be a hexadecimal integer or a CSS-style string.
|
25 | * @param color
|
26 | * @param density Expects a `Float`
|
27 | */
|
28 | constructor(color: ColorRepresentation, density?: number);
|
29 |
|
30 | /**
|
31 | * Read-only flag to check if a given object is of type { FogExp2}.
|
32 | * This is a _constant_ value
|
33 | * `true`
|
34 | */
|
35 | readonly isFogExp2: true;
|
36 |
|
37 | /**
|
38 | * Optional name of the object
|
39 | * @remarks _(doesn't need to be unique)_.
|
40 | * @defaultValue `""`
|
41 | */
|
42 | name: string;
|
43 |
|
44 | /**
|
45 | * Fog color.
|
46 | * @remarks If set to black, far away objects will be rendered black.
|
47 | */
|
48 | color: Color;
|
49 |
|
50 | /**
|
51 | * Defines how fast the fog will grow dense.
|
52 | * @defaultValue `0.00025`
|
53 | * @remarks Expects a `Float`
|
54 | */
|
55 | density: number;
|
56 |
|
57 | /**
|
58 | * Returns a new {@link FogExp2} instance with the same parameters as this one.
|
59 | */
|
60 | clone(): FogExp2;
|
61 |
|
62 | /**
|
63 | * Return {@link FogExp2} data in JSON format.
|
64 | */
|
65 | toJSON(): FogExp2JSON;
|
66 | }
|