@woosh/meep-engine 2.43.1 → 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/bvh2/aabb3/aabb3_array_combine.js +2 -2
- package/core/collection/RingBuffer.js +4 -2
- package/core/collection/RingBuffer.spec.js +59 -0
- package/core/collection/array/ArrayIteratorRandom.js +1 -1
- package/core/collection/{ArrayUtils.spec.js → array/arrayPickBestElement.spec.js} +1 -1
- package/core/collection/array/arrayPickBestElements.js +51 -0
- package/core/collection/array/arrayPickMinElement.js +43 -0
- package/core/collection/array/arrayQuickSort.js +1 -1
- package/core/collection/array/arraySetSortingDiff.js +1 -1
- package/core/collection/array/arraySwapElements.js +12 -0
- package/core/collection/array/array_range_equal_strict.js +22 -0
- package/core/collection/array/groupArrayBy.js +42 -0
- package/core/collection/array/isArrayEqual.js +50 -0
- package/core/collection/array/randomMultipleFromArray.js +34 -0
- package/core/collection/array/randomizeArrayElementOrder.js +23 -0
- package/core/color/sRGB_to_linear.js +9 -4
- package/core/geom/2d/convex-hull/convex_hull_monotone_2d.js +1 -1
- package/core/geom/3d/aabb/aabb3_build_frustum.js +1 -1
- package/core/geom/3d/aabb/compute_aabb_from_points.js +1 -1
- package/core/geom/3d/frustum/frustum3_computeNearestPointToPoint.js +3 -1
- package/core/geom/3d/morton/v3_morton_encode_transformed.spec.js +20 -0
- package/core/geom/3d/plane/orient3d_fast.js +11 -10
- package/core/geom/3d/plane/orient3d_robust.js +41 -0
- package/core/geom/3d/plane/plane_computeConvex3PlaneIntersection.js +0 -23
- package/core/geom/3d/plane/plane_three_compute_convex3_plane_intersection.js +24 -0
- package/core/geom/3d/shape/UnionShape3D.js +1 -1
- 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/README.md +10 -1
- package/core/geom/3d/tetrahedra/TetrahedralMesh.js +650 -0
- package/core/geom/3d/tetrahedra/TetrahedralMesh.spec.js +233 -0
- package/core/geom/3d/tetrahedra/build_tetrahedral_mesh_buffer_geometry.js +75 -0
- package/core/geom/3d/tetrahedra/compute_bounding_simplex_3d.js +2 -2
- package/core/geom/3d/tetrahedra/compute_bounding_simplex_3d.spec.js +4 -4
- package/core/geom/3d/tetrahedra/delaunay/Cavity.js +49 -7
- package/core/geom/3d/tetrahedra/delaunay/compute_delaunay_tetrahedral_mesh.js +51 -17
- package/core/geom/3d/tetrahedra/delaunay/debug_validate_mesh.js +19 -0
- package/core/geom/3d/tetrahedra/delaunay/fill_in_a_cavity.js +191 -0
- package/core/geom/3d/tetrahedra/delaunay/push_boundary_with_validation.js +27 -0
- package/core/geom/3d/tetrahedra/delaunay/tetrahedral_mesh_compute_cavity.js +59 -43
- package/core/geom/3d/tetrahedra/delaunay/tetrahedral_mesh_compute_sub_determinant.js +77 -0
- package/core/geom/3d/tetrahedra/delaunay/tetrahedral_mesh_compute_sub_determinant.spec.js +30 -0
- package/core/geom/3d/tetrahedra/delaunay/tetrahedral_mesh_walk_towards_containing_tetrahedron.js +58 -0
- 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} +11 -13
- 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/tetrahedron_compute_signed_volume.js +83 -0
- package/core/geom/3d/tetrahedra/tetrahedron_compute_signed_volume.spec.js +24 -0
- package/core/geom/3d/tetrahedra/tetrahedron_contains_point.spec.js +66 -0
- package/core/geom/3d/tetrahedra/validate_tetrahedral_mesh.js +166 -0
- package/core/geom/3d/util/make_justified_point_grid.js +31 -0
- package/core/geom/Bezier.js +0 -27
- package/core/geom/Plane.js +0 -4
- package/core/geom/packing/miniball/Subspan.js +2 -2
- package/core/geom/v3_lerp.js +6 -1
- package/core/math/isqrt.js +28 -0
- package/core/math/isqrt.spec.js +9 -0
- package/core/math/max.spec.js +25 -0
- package/core/math/min2.spec.js +25 -0
- package/core/model/node-graph/node/NodeInstance.js +3 -3
- package/core/primitives/strings/prefixTree/PrefixTreeLeaf.js +1 -1
- package/core/process/delay.js +5 -0
- package/core/process/task/util/randomCountTask.js +1 -1
- 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/editor/ecs/component/editors/primitive/ArrayEditor.js +1 -1
- package/editor/tools/v2/BlenderCameraOrientationGizmo.js +6 -0
- package/editor/view/ecs/components/common/AutoCanvasView.js +13 -25
- package/engine/EngineHarness.js +11 -5
- package/engine/asset/AssetManager.d.ts +5 -1
- package/engine/asset/AssetManager.js +50 -15
- package/engine/asset/AssetManager.spec.js +17 -11
- package/engine/asset/AssetRequest.js +57 -0
- package/engine/asset/loaders/ArrayBufferLoader.js +22 -0
- package/engine/asset/loaders/AssetLoader.js +1 -1
- package/engine/ecs/System.js +1 -1
- package/engine/ecs/dynamic_actions/DynamicActorSystem.js +1 -1
- package/engine/ecs/terrain/ecs/TerrainSystem.js +7 -1
- package/engine/ecs/transform/copy_three_transform.js +15 -0
- package/engine/graphics/FrameRunner.js +5 -9
- package/engine/graphics/ecs/animation/animator/AnimationClipDefinition.js +1 -1
- package/engine/graphics/ecs/animation/animator/graph/definition/AnimationGraphDefinition.js +1 -1
- package/engine/graphics/ecs/camera/Camera.js +1 -10
- package/engine/graphics/ecs/camera/CameraSystem.js +8 -8
- package/engine/graphics/ecs/camera/ProjectionType.js +9 -0
- package/engine/graphics/ecs/camera/build_three_camera_object.js +3 -3
- package/engine/graphics/ecs/decal/v2/prototypeDecalSystem.js +59 -4
- 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/VertexDataSpec.js +1 -1
- package/engine/graphics/geometry/instancing/InstancedMeshGroup.js +2 -2
- package/engine/graphics/impostors/octahedral/prototypeBaker.js +3 -3
- package/engine/graphics/micron/plugin/GLTFAssetTransformer.js +1 -1
- package/engine/graphics/micron/plugin/MicronRenderPlugin.js +3 -1
- package/engine/graphics/particles/node-based/codegen/modules/FunctionSignature.js +1 -1
- package/engine/graphics/render/forward_plus/LightManager.js +1 -1
- package/engine/graphics/render/forward_plus/LightManager.spec.js +4 -0
- package/engine/graphics/render/forward_plus/computeFrustumCorners.js +4 -2
- package/engine/graphics/render/forward_plus/prototype/prototypeLightManager.js +2 -2
- package/engine/graphics/render/layers/RenderLayerUtils.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/shaders/DenoiseShader.js +1 -1
- package/engine/graphics/texture/atlas/AtlasPatch.js +11 -3
- package/engine/graphics/texture/atlas/CachingTextureAtlas.js +2 -2
- package/engine/graphics/texture/atlas/TextureAtlas.js +22 -4
- package/engine/graphics/texture/atlas/TextureAtlas.spec.js +22 -0
- package/engine/graphics/texture/sampler/Sampler2D.js +0 -64
- package/engine/graphics/texture/sampler/Sampler2D.spec.js +2 -1
- package/engine/graphics/texture/sampler/sampler2d_combine.js +67 -0
- package/engine/intelligence/behavior/ecs/BehaviorSystem.spec.js +0 -3
- package/engine/intelligence/blackboard/AbstractBlackboard.d.ts +1 -1
- package/engine/network/PriorityFetch.js +192 -0
- package/engine/simulation/DormandPrince.js +1 -1
- package/engine/ui/DraggableAspect.js +0 -1
- package/generation/grid/generation/road/GridTaskGenerateRoads.js +1 -1
- package/package.json +2 -1
- package/samples/terrain/from_image_2.js +127 -82
- package/view/elements/CanvasView.js +7 -1
- package/view/elements/image/HTMLElementCacheKey.js +1 -1
- package/view/util/DomSizeObserver.js +3 -5
- package/core/collection/ArrayUtils.js +0 -263
- package/core/geom/3d/tetrahedra/delaunay/tetrahedral_mesh_walk_toward_cavity.js +0 -48
- package/core/geom/3d/tetrahedra/hxt/a.js +0 -524
- package/core/geom/3d/tetrahedra/hxt/hxt.js +0 -140
- package/core/geom/3d/tetrahedra/hxt/hxt.wasm +0 -0
- package/core/geom/3d/tetrahedra/tetrahedra_collection.js +0 -383
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
//
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Sample value from a 3-band spherical harmonic defined by 9 coefficients
|
|
5
|
+
*
|
|
6
|
+
* @see https://github.com/mrdoob/three.js/blob/d081c5a3501d272d19375fab1b01fedf9df29b22/src/math/SphericalHarmonics3.js#L55
|
|
7
|
+
* @see https://graphics.stanford.edu/papers/envmap/envmap.pdf
|
|
8
|
+
* @see https://www.ppsloan.org/publications/StupidSH36.pdf
|
|
9
|
+
* @param {number[]} result Result will be written here
|
|
10
|
+
* @param {number} result_offset
|
|
11
|
+
* @param {number[]} harmonics coefficients are read from here
|
|
12
|
+
* @param {number} harmonics_offset offset into coefficients array where to start reading the data
|
|
13
|
+
* @param {number} dimension_count number of encoded dimensions, this is essentially a shortcut for multiple harmonics being read at the same time, such as with RGB values
|
|
14
|
+
* @param {number[]} direction 3d vector read from here, we will read 3 values from here to sample spherical harmonic, direction is assumed to be normalized
|
|
15
|
+
* @param {number} direction_offset offset into direction array
|
|
16
|
+
*/
|
|
17
|
+
export function sh3_sample_by_direction(
|
|
18
|
+
result, result_offset,
|
|
19
|
+
harmonics, harmonics_offset,
|
|
20
|
+
dimension_count,
|
|
21
|
+
direction, direction_offset
|
|
22
|
+
) {
|
|
23
|
+
const x = direction[direction_offset];
|
|
24
|
+
const y = direction[direction_offset + 1];
|
|
25
|
+
const z = direction[direction_offset + 2];
|
|
26
|
+
|
|
27
|
+
let channel_value;
|
|
28
|
+
|
|
29
|
+
for (let i = 0; i < dimension_count; i++) {
|
|
30
|
+
|
|
31
|
+
// band 0
|
|
32
|
+
channel_value = harmonics[harmonics_offset + i] * 0.282095;
|
|
33
|
+
|
|
34
|
+
// band 1
|
|
35
|
+
channel_value += harmonics[harmonics_offset + dimension_count + i] * 0.488603 * y;
|
|
36
|
+
channel_value += harmonics[harmonics_offset + dimension_count * 2 + i] * 0.488603 * z;
|
|
37
|
+
channel_value += harmonics[harmonics_offset + dimension_count * 3 + i] * 0.488603 * x;
|
|
38
|
+
|
|
39
|
+
// band 2
|
|
40
|
+
channel_value += harmonics[harmonics_offset + dimension_count * 4 + i] * 1.092548 * (x * y);
|
|
41
|
+
channel_value += harmonics[harmonics_offset + dimension_count * 5 + i] * 1.092548 * (y * z);
|
|
42
|
+
channel_value += harmonics[harmonics_offset + dimension_count * 6 + i] * 0.315392 * (3.0 * z * z - 1.0);
|
|
43
|
+
channel_value += harmonics[harmonics_offset + dimension_count * 7 + i] * 1.092548 * (x * z);
|
|
44
|
+
channel_value += harmonics[harmonics_offset + dimension_count * 8 + i] * 0.546274 * (x * x - y * y);
|
|
45
|
+
|
|
46
|
+
// write out
|
|
47
|
+
result[result_offset + i] = channel_value;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
*
|
|
4
|
+
* c1 = 0.42904276540489171563379376569857; // 4 * Â2.Y22 = 1/4 * sqrt(15.PI)
|
|
5
|
+
* c2 = 0.51166335397324424423977581244463; // 0.5 * Â1.Y10 = 1/2 * sqrt(PI/3)
|
|
6
|
+
* c3 = 0.24770795610037568833406429782001; // Â2.Y20 = 1/16 * sqrt(5.PI)
|
|
7
|
+
* c4 = 0.88622692545275801364908374167057; // Â0.Y00 = 1/2 * sqrt(PI)
|
|
8
|
+
*
|
|
9
|
+
* @see https://github.com/mrdoob/three.js/blob/d081c5a3501d272d19375fab1b01fedf9df29b22/src/math/SphericalHarmonics3.js#L85
|
|
10
|
+
* @see https://graphics.stanford.edu/papers/envmap/envmap.pdf
|
|
11
|
+
* @see https://www.ppsloan.org/publications/StupidSH36.pdf
|
|
12
|
+
*
|
|
13
|
+
* @param {number[]} result Result will be written here
|
|
14
|
+
* @param {number} result_offset
|
|
15
|
+
* @param {number[]} harmonics coefficients are read from here
|
|
16
|
+
* @param {number} harmonics_offset offset into coefficients array where to start reading the data
|
|
17
|
+
* @param {number} dimension_count number of encoded dimensions, this is essentially a shortcut for multiple harmonics being read at the same time, such as with RGB values
|
|
18
|
+
* @param {number[]} direction 3d vector read from here, we will read 3 values from here to sample spherical harmonic, direction is assumed to be normalized
|
|
19
|
+
* @param {number} direction_offset offset into direction array
|
|
20
|
+
*/
|
|
21
|
+
export function sh3_sample_irradiance_by_direction(
|
|
22
|
+
result, result_offset,
|
|
23
|
+
harmonics, harmonics_offset,
|
|
24
|
+
dimension_count,
|
|
25
|
+
direction, direction_offset
|
|
26
|
+
) {
|
|
27
|
+
const x = direction[direction_offset];
|
|
28
|
+
const y = direction[direction_offset + 1];
|
|
29
|
+
const z = direction[direction_offset + 2];
|
|
30
|
+
|
|
31
|
+
let channel_value;
|
|
32
|
+
|
|
33
|
+
for (let i = 0; i < dimension_count; i++) {
|
|
34
|
+
|
|
35
|
+
// band 0
|
|
36
|
+
channel_value = harmonics[harmonics_offset + i] * 0.88622692545275801364908374167057;
|
|
37
|
+
|
|
38
|
+
// band 1
|
|
39
|
+
channel_value += harmonics[harmonics_offset + dimension_count + i] * 2.0 * 0.51166335397324424423977581244463 * y;
|
|
40
|
+
channel_value += harmonics[harmonics_offset + dimension_count * 2 + i] * 2.0 * 0.51166335397324424423977581244463 * z;
|
|
41
|
+
channel_value += harmonics[harmonics_offset + dimension_count * 3 + i] * 2.0 * 0.51166335397324424423977581244463 * x;
|
|
42
|
+
|
|
43
|
+
// band 2
|
|
44
|
+
channel_value += harmonics[harmonics_offset + dimension_count * 4 + i] * 2.0 * 0.42904276540489171563379376569857 * x * y;
|
|
45
|
+
channel_value += harmonics[harmonics_offset + dimension_count * 5 + i] * 2.0 * 0.42904276540489171563379376569857 * y * z;
|
|
46
|
+
channel_value += harmonics[harmonics_offset + dimension_count * 6 + i] * (3 * z * z - 1) * 0.24770795610037568833406429782001;
|
|
47
|
+
channel_value += harmonics[harmonics_offset + dimension_count * 7 + i] * 2.0 * 0.42904276540489171563379376569857 * x * z;
|
|
48
|
+
channel_value += harmonics[harmonics_offset + dimension_count * 8 + i] * 0.42904276540489171563379376569857 * (x * x - y * y);
|
|
49
|
+
|
|
50
|
+
// write out
|
|
51
|
+
result[result_offset + i] = channel_value;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
collection of tools for working with tetrahedra (3d simplex)
|
|
2
2
|
|
|
3
|
-
The main feature is tetrahedrasation (triangulation in 3d space)
|
|
3
|
+
The main feature is tetrahedrasation (triangulation in 3d space)
|
|
4
|
+
|
|
5
|
+
### Optimization
|
|
6
|
+
|
|
7
|
+
Optimize tetrahedrons to reduce number of thin and long tetras ([link](https://gitlab.onelab.info/gmsh/gmsh/-/blob/master/contrib/hxt/tetMesh/src/HXTSPR.c))
|
|
8
|
+
|
|
9
|
+
## lighting
|
|
10
|
+
[Ray-Traced Irradiance Fields (Presented by NVIDIA)](https://www.youtube.com/watch?v=KufJBCTdn_o)
|
|
11
|
+
https://www.youtube.com/watch?v=pYY7iiVkyYE
|
|
12
|
+
|
|
4
13
|
|
|
5
14
|
References
|
|
6
15
|
---
|