@woosh/meep-engine 2.162.0 → 2.163.1
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/README.md +1 -1
- package/package.json +1 -1
- package/src/core/color/xyz/rgb_to_xyz.d.ts +3 -3
- package/src/core/color/xyz/rgb_to_xyz.d.ts.map +1 -1
- package/src/core/color/xyz/rgb_to_xyz.js +2 -2
- package/src/core/color/xyz/xyz_to_rgb.d.ts +3 -3
- package/src/core/color/xyz/xyz_to_rgb.d.ts.map +1 -1
- package/src/core/color/xyz/xyz_to_rgb.js +2 -2
- package/src/core/geom/vec3/v3_array_scale.d.ts +11 -0
- package/src/core/geom/vec3/v3_array_scale.d.ts.map +1 -0
- package/src/core/geom/vec3/v3_array_scale.js +18 -0
- package/src/engine/EngineHarness.js +3 -3
- package/src/engine/graphics/ecs/path/tube/build/makeTubeGeometry.js +218 -202
- package/src/engine/graphics/ecs/path/tube/build/make_cap.d.ts.map +1 -1
- package/src/engine/graphics/ecs/path/tube/build/make_cap.js +11 -2
- package/src/engine/graphics/sh3/path_tracer/make_sky_hosek.d.ts.map +1 -1
- package/src/engine/graphics/sh3/path_tracer/make_sky_hosek.js +45 -44
- package/src/engine/graphics/sh3/sky/hosek/sky_hosek_compute_irradiance_by_direction.d.ts +5 -7
- package/src/engine/graphics/sh3/sky/hosek/sky_hosek_compute_irradiance_by_direction.d.ts.map +1 -1
- package/src/engine/graphics/sh3/sky/hosek/sky_hosek_compute_irradiance_by_direction.js +388 -395
|
@@ -1,44 +1,45 @@
|
|
|
1
|
-
import {
|
|
2
|
-
sky_hosek_compute_irradiance_by_direction,
|
|
3
|
-
sky_hosek_precompute
|
|
4
|
-
} from "../sky/hosek/sky_hosek_compute_irradiance_by_direction.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
const
|
|
25
|
-
const d_y = direction[direction_offset + 1];
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
d_x
|
|
31
|
-
d_y
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
v3[
|
|
39
|
-
v3[
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
1
|
+
import {
|
|
2
|
+
sky_hosek_compute_irradiance_by_direction,
|
|
3
|
+
sky_hosek_precompute
|
|
4
|
+
} from "../sky/hosek/sky_hosek_compute_irradiance_by_direction.js";
|
|
5
|
+
import { v3_array_scale } from "../../../../core/geom/vec3/v3_array_scale.js";
|
|
6
|
+
import { v3_array_normalize } from "../../../../core/geom/vec3/v3_array_normalize.js";
|
|
7
|
+
import { array_copy } from "../../../../core/collection/array/array_copy.js";
|
|
8
|
+
import { max2 } from "../../../../core/math/max2.js";
|
|
9
|
+
|
|
10
|
+
export function make_sky_hosek(sun = [0, 1, 0], turbidity = 1, overcast = 0, albedo = [0, 0, 0]) {
|
|
11
|
+
const coeffs = new Float32Array(27);
|
|
12
|
+
const rad = new Float32Array([1, 1, 1]);
|
|
13
|
+
const sun_position = new Float32Array([sun[0], sun[1], sun[2]]);
|
|
14
|
+
|
|
15
|
+
v3_array_normalize(sun_position, 0, sun_position, 0);
|
|
16
|
+
|
|
17
|
+
sky_hosek_precompute(coeffs, rad, sun_position, turbidity, albedo, overcast);
|
|
18
|
+
|
|
19
|
+
const v3 = [];
|
|
20
|
+
|
|
21
|
+
const value_scale = 8e-5;
|
|
22
|
+
|
|
23
|
+
return (result, result_offset, direction, direction_offset) => {
|
|
24
|
+
const d_x = direction[direction_offset];
|
|
25
|
+
const d_y = direction[direction_offset + 1];
|
|
26
|
+
const d_z = direction[direction_offset + 2];
|
|
27
|
+
|
|
28
|
+
sky_hosek_compute_irradiance_by_direction(
|
|
29
|
+
v3, coeffs, rad, sun_position,
|
|
30
|
+
d_x,
|
|
31
|
+
d_y,
|
|
32
|
+
d_z,
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
v3_array_scale(v3, 0, v3, 0, value_scale);
|
|
36
|
+
|
|
37
|
+
// clamp sky contribution
|
|
38
|
+
v3[0] = max2(0, v3[0]);
|
|
39
|
+
v3[1] = max2(0, v3[1]);
|
|
40
|
+
v3[2] = max2(0, v3[2]);
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
array_copy(v3, 0, result, result_offset, 3);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -1,24 +1,22 @@
|
|
|
1
|
-
/// <reference types="gl-matrix/index.js" />
|
|
2
1
|
/**
|
|
3
2
|
* @see https://github.com/andrewwillmott/sun-sky/blob/master/SunSky.cpp
|
|
4
3
|
* @param {number[]} mCoeffsXYZ output, float[3][9], Hosek 9-term distribution coefficients
|
|
5
4
|
* @param {number[]} mRadXYZ output, vec3, Overall average radiance
|
|
6
|
-
* @param {
|
|
5
|
+
* @param {number[]|Float32Array} sun_direction direction to the sun, engine frame (+Y up)
|
|
7
6
|
* @param {number} turbidity should be between 1 and 10
|
|
8
|
-
* @param {
|
|
7
|
+
* @param {number[]|Float32Array} rgbAlbedo albedo in linear color space (make sure it's not sRGB)
|
|
9
8
|
* @param {number} overcast
|
|
10
9
|
*/
|
|
11
|
-
export function sky_hosek_precompute(mCoeffsXYZ: number[], mRadXYZ: number[], sun_direction:
|
|
10
|
+
export function sky_hosek_precompute(mCoeffsXYZ: number[], mRadXYZ: number[], sun_direction: number[] | Float32Array, turbidity: number, rgbAlbedo: number[] | Float32Array, overcast: number): void;
|
|
12
11
|
/**
|
|
13
12
|
*
|
|
14
13
|
* @param {number[]|Float32Array} out vec3 in RGB color space
|
|
15
14
|
* @param {number[]|Float32Array} mCoeffsXYZ float[3][9]
|
|
16
15
|
* @param {number[]|Float32Array} mRadXYZ vec3
|
|
17
|
-
* @param {number[]|Float32Array} mToSun vec3
|
|
16
|
+
* @param {number[]|Float32Array} mToSun vec3, direction to the sun, engine frame (+Y up)
|
|
18
17
|
* @param {number} direction_x
|
|
19
|
-
* @param {number} direction_y
|
|
18
|
+
* @param {number} direction_y up axis (engine +Y up)
|
|
20
19
|
* @param {number} direction_z
|
|
21
20
|
*/
|
|
22
21
|
export function sky_hosek_compute_irradiance_by_direction(out: number[] | Float32Array, mCoeffsXYZ: number[] | Float32Array, mRadXYZ: number[] | Float32Array, mToSun: number[] | Float32Array, direction_x: number, direction_y: number, direction_z: number): void;
|
|
23
|
-
import { vec3 } from "gl-matrix";
|
|
24
22
|
//# sourceMappingURL=sky_hosek_compute_irradiance_by_direction.d.ts.map
|
package/src/engine/graphics/sh3/sky/hosek/sky_hosek_compute_irradiance_by_direction.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sky_hosek_compute_irradiance_by_direction.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/sh3/sky/hosek/sky_hosek_compute_irradiance_by_direction.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sky_hosek_compute_irradiance_by_direction.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/sh3/sky/hosek/sky_hosek_compute_irradiance_by_direction.js"],"names":[],"mappings":"AAyNA;;;;;;;;GAQG;AACH,iDAPW,MAAM,EAAE,WACR,MAAM,EAAE,iBACR,MAAM,EAAE,GAAC,YAAY,aACrB,MAAM,aACN,MAAM,EAAE,GAAC,YAAY,YACrB,MAAM,QAgHhB;AAGD;;;;;;;;;GASG;AACH,+DARW,MAAM,EAAE,GAAC,YAAY,cACrB,MAAM,EAAE,GAAC,YAAY,WACrB,MAAM,EAAE,GAAC,YAAY,UACrB,MAAM,EAAE,GAAC,YAAY,eACrB,MAAM,eACN,MAAM,eACN,MAAM,QAwChB"}
|