@woosh/meep-engine 2.43.3 → 2.43.4
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/core/binary/BinaryBuffer.js +13 -1
- package/core/binary/BitSet.js +2 -2
- package/core/collection/array/array_range_equal_strict.js +22 -0
- package/core/color/sRGB_to_linear.js +9 -4
- package/core/geom/3d/plane/orient3d_fast.js +3 -0
- package/core/geom/3d/plane/orient3d_robust.js +41 -0
- package/core/geom/3d/sphere/harmonics/README.md +15 -0
- package/core/geom/3d/sphere/harmonics/sh3_add.js +21 -0
- package/core/geom/3d/sphere/harmonics/sh3_dering_optimize_positive.js +618 -0
- package/core/geom/3d/sphere/harmonics/sh3_sample_by_direction.js +49 -0
- package/core/geom/3d/sphere/harmonics/sh3_sample_irradiance_by_direction.js +53 -0
- package/core/geom/3d/tetrahedra/TetrahedralMesh.js +251 -68
- package/core/geom/3d/tetrahedra/TetrahedralMesh.spec.js +80 -3
- package/core/geom/3d/tetrahedra/build_tetrahedral_mesh_buffer_geometry.js +75 -0
- package/core/geom/3d/tetrahedra/delaunay/Cavity.js +5 -1
- package/core/geom/3d/tetrahedra/delaunay/compute_delaunay_tetrahedral_mesh.js +30 -31
- package/core/geom/3d/tetrahedra/delaunay/fill_in_a_cavity.js +54 -18
- package/core/geom/3d/tetrahedra/delaunay/push_boundary_with_validation.js +27 -0
- package/core/geom/3d/tetrahedra/delaunay/tetrahedral_mesh_compute_cavity.js +89 -0
- package/core/geom/3d/tetrahedra/delaunay/{tetrahedral_mesh_walk_toward_cavity.js → tetrahedral_mesh_walk_towards_containing_tetrahedron.js} +15 -12
- package/core/geom/3d/tetrahedra/delaunay/validate_cavity_boundary.js +60 -0
- package/core/geom/3d/tetrahedra/{point_in_tetrahedron_circumsphere.js → in_sphere_fast.js} +2 -4
- package/core/geom/3d/tetrahedra/in_sphere_robust.js +53 -0
- package/core/geom/3d/tetrahedra/prototypeTetrahedraBuilder.js +44 -35
- package/core/geom/3d/tetrahedra/validate_tetrahedral_mesh.js +85 -38
- package/core/geom/3d/util/make_justified_point_grid.js +31 -0
- package/core/process/delay.js +5 -0
- package/editor/Editor.js +3 -0
- package/editor/ecs/component/editors/ecs/ParameterLookupTableEditor.js +195 -11
- package/editor/ecs/component/editors/ecs/ParameterTrackSetEditor.js +16 -0
- package/editor/ecs/component/editors/ecs/ParticleEmitterLayerEditor.js +4 -0
- package/engine/EngineHarness.js +11 -5
- package/engine/ecs/terrain/ecs/TerrainSystem.js +7 -1
- package/engine/ecs/transform/copy_three_transform.js +15 -0
- package/engine/graphics/ecs/light/Light.js +6 -1
- package/engine/graphics/ecs/light/LightSystem.d.ts +1 -1
- package/engine/graphics/ecs/mesh-v2/three_object_to_entity_composition.js +2 -17
- package/engine/graphics/geometry/instancing/InstancedMeshGroup.js +2 -2
- package/engine/graphics/sh3/LightProbeVolume.js +595 -0
- package/engine/graphics/sh3/SH3VisualisationMaterial.js +79 -0
- package/engine/graphics/sh3/prototypeSH3Probe.js +427 -0
- package/engine/graphics/sh3/visualise_probe.js +40 -0
- package/engine/graphics/texture/atlas/TextureAtlas.js +15 -3
- package/engine/intelligence/blackboard/AbstractBlackboard.d.ts +1 -1
- package/package.json +2 -1
- package/samples/terrain/from_image_2.js +127 -82
- package/core/geom/3d/tetrahedra/delaunay/tetrahedral_mesh_compute_cavity2.js +0 -224
- package/core/geom/3d/tetrahedra/delaunay/tetrahedral_mesh_insert_point.js +0 -98
|
@@ -343,7 +343,7 @@ export class BinaryBuffer {
|
|
|
343
343
|
*
|
|
344
344
|
* @param {number} destination_offset starting index in the destination array
|
|
345
345
|
* @param {number} length number of elements to read
|
|
346
|
-
* @param {Uint32Array} destination
|
|
346
|
+
* @param {Uint32Array|number[]|ArrayLike<number>} destination
|
|
347
347
|
*/
|
|
348
348
|
readUint32Array(destination, destination_offset, length) {
|
|
349
349
|
for (let i = 0; i < length; i++) {
|
|
@@ -707,6 +707,18 @@ export class BinaryBuffer {
|
|
|
707
707
|
this.position = end;
|
|
708
708
|
}
|
|
709
709
|
|
|
710
|
+
/**
|
|
711
|
+
*
|
|
712
|
+
* @param {Uint32Array|number[]|ArrayLike<number>} source
|
|
713
|
+
* @param {number} source_offset
|
|
714
|
+
* @param {number} length
|
|
715
|
+
*/
|
|
716
|
+
writeUint32Array(source, source_offset, length) {
|
|
717
|
+
for (let i = 0; i < length; i++) {
|
|
718
|
+
this.writeUint32(source[source_offset + i]);
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
|
|
710
722
|
/**
|
|
711
723
|
*
|
|
712
724
|
* @param {Uint8Array|Uint8ClampedArray} array
|
package/core/binary/BitSet.js
CHANGED
|
@@ -403,9 +403,9 @@ BitSet.prototype.set = function (bitIndex, value) {
|
|
|
403
403
|
|
|
404
404
|
if (bitIndex === this.__length - 1) {
|
|
405
405
|
// trim down set size potentially
|
|
406
|
-
const newLastSetBit = this.previousSetBit(bitIndex);
|
|
406
|
+
// const newLastSetBit = this.previousSetBit(bitIndex);
|
|
407
407
|
|
|
408
|
-
this.__setLength(
|
|
408
|
+
this.__setLength(bitIndex );
|
|
409
409
|
}
|
|
410
410
|
}
|
|
411
411
|
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks that elements in supplied arrays are exactly equal within a certain range defined by a pair of offsets and element count (length)
|
|
3
|
+
* @template T
|
|
4
|
+
* @param {T[]} a
|
|
5
|
+
* @param {number} offset_a
|
|
6
|
+
* @param {T[]} b
|
|
7
|
+
* @param {number} offset_b
|
|
8
|
+
* @param {number} length
|
|
9
|
+
* @returns {boolean}
|
|
10
|
+
*/
|
|
11
|
+
export function array_range_equal_strict(a, offset_a, b, offset_b, length) {
|
|
12
|
+
|
|
13
|
+
for (let i = 0; i < length; i++) {
|
|
14
|
+
|
|
15
|
+
if (a[offset_a + i] !== b[offset_b + i]) {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @param {number} c
|
|
4
|
+
* @return {number|number}
|
|
5
|
+
*/
|
|
6
|
+
export function convert_channel_sRGB_to_linear(c) {
|
|
2
7
|
return (c < 0.04045) ? c * 0.0773993808 : Math.pow(c * 0.9478672986 + 0.0521327014, 2.4);
|
|
3
8
|
}
|
|
4
9
|
|
|
@@ -10,7 +15,7 @@ function convert(c) {
|
|
|
10
15
|
* @param {number} input_offset
|
|
11
16
|
*/
|
|
12
17
|
export function sRGB_to_linear(output, output_offset, input, input_offset) {
|
|
13
|
-
output[output_offset] =
|
|
14
|
-
output[output_offset + 1] =
|
|
15
|
-
output[output_offset + 2] =
|
|
18
|
+
output[output_offset] = convert_channel_sRGB_to_linear(input[input_offset]);
|
|
19
|
+
output[output_offset + 1] = convert_channel_sRGB_to_linear(input[input_offset + 1]);
|
|
20
|
+
output[output_offset + 2] = convert_channel_sRGB_to_linear(input[input_offset + 2]);
|
|
16
21
|
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
+
* Non-robust
|
|
3
|
+
*
|
|
2
4
|
* Return a positive value if the point pd lies below the
|
|
3
5
|
* plane passing through pa, pb, and pc; "below" is defined so
|
|
4
6
|
* that pa, pb, and pc appear in counterclockwise order when
|
|
@@ -43,3 +45,4 @@ export function orient3d_fast(points, a, b, c, d) {
|
|
|
43
45
|
+ bdx * (cdy * adz - cdz * ady)
|
|
44
46
|
+ cdx * (ady * bdz - adz * bdy);
|
|
45
47
|
}
|
|
48
|
+
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { orient3d } from "robust-predicates";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @param {number[]} points
|
|
6
|
+
* @param {number} a index of point a
|
|
7
|
+
* @param {number} b index of point b
|
|
8
|
+
* @param {number} c index of point c
|
|
9
|
+
* @param {number} d index of point d
|
|
10
|
+
* @returns {number}
|
|
11
|
+
*/
|
|
12
|
+
export function orient3d_robust(
|
|
13
|
+
points,
|
|
14
|
+
a, b, c, d
|
|
15
|
+
) {
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
const a3 = a * 3;
|
|
19
|
+
const b3 = b * 3;
|
|
20
|
+
const c3 = c * 3;
|
|
21
|
+
const d3 = d * 3;
|
|
22
|
+
|
|
23
|
+
const ax = points[a3];
|
|
24
|
+
const ay = points[a3 + 1];
|
|
25
|
+
const az = points[a3 + 2];
|
|
26
|
+
|
|
27
|
+
const bx = points[b3];
|
|
28
|
+
const by = points[b3 + 1];
|
|
29
|
+
const bz = points[b3 + 2];
|
|
30
|
+
|
|
31
|
+
const cx = points[c3];
|
|
32
|
+
const cy = points[c3 + 1];
|
|
33
|
+
const cz = points[c3 + 2];
|
|
34
|
+
|
|
35
|
+
const dx = points[d3];
|
|
36
|
+
const dy = points[d3 + 1];
|
|
37
|
+
const dz = points[d3 + 2];
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
return orient3d(ax, ay, az, bx, by, bz, cx, cy, cz, dx, dy, dz);
|
|
41
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
Tools for working with spherical harmonics.
|
|
2
|
+
|
|
3
|
+
Mostly intended for shading and global illumination.
|
|
4
|
+
|
|
5
|
+
## De-ringing
|
|
6
|
+
There are basically 3 approaches,
|
|
7
|
+
* one is filtering using some kind of a smoothing function such as Lanczos
|
|
8
|
+
* Optimization of the polynomial (generally to remove negative values)
|
|
9
|
+
* Piece-wise reconstruction
|
|
10
|
+
|
|
11
|
+
### References:
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
* 2008 - GDC - Stupid Spherical Harmonics (SH) Tricks by Peter-Pike Sloan
|
|
15
|
+
* [Computing product of 2 sphecial harmonics](https://github.com/ruba/cortex-vfx/blob/c256b7274516a02fa64a0260351b86f1d6ebe8c2/include/IECore/SphericalHarmonicsAlgo.inl)
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
//
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Add two spherical harmonics with 3 bands (9 coefficients)
|
|
5
|
+
*
|
|
6
|
+
* @param {number[]} result
|
|
7
|
+
* @param {number} result_offset
|
|
8
|
+
* @param {number[]} input_0
|
|
9
|
+
* @param {number} input_0_offset
|
|
10
|
+
* @param {number[]} input_1
|
|
11
|
+
* @param {number} input_1_offset
|
|
12
|
+
* @param {number} dimension_count
|
|
13
|
+
*/
|
|
14
|
+
export function sh3_add(result, result_offset, input_0, input_0_offset, input_1, input_1_offset, dimension_count) {
|
|
15
|
+
const n = 9 * dimension_count;
|
|
16
|
+
|
|
17
|
+
for (let i = 0; i < n; i++) {
|
|
18
|
+
result[result_offset + i] = input_0[input_0_offset + i] + input_1[input_1_offset + i];
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
}
|