@woosh/meep-engine 2.108.4 → 2.109.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/build/meep.cjs +101 -61
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +101 -61
- package/package.json +1 -1
- package/src/core/assert.d.ts +2 -2
- package/src/core/assert.d.ts.map +1 -1
- package/src/core/assert.js +1 -1
- package/src/core/binary/BitSet.d.ts +6 -0
- package/src/core/binary/BitSet.d.ts.map +1 -1
- package/src/core/binary/BitSet.js +14 -42
- package/src/core/binary/align_32.d.ts +7 -0
- package/src/core/binary/align_32.d.ts.map +1 -0
- package/src/core/binary/align_32.js +8 -0
- package/src/core/binary/align_32.spec.d.ts +2 -0
- package/src/core/binary/align_32.spec.d.ts.map +1 -0
- package/src/core/binary/align_32.spec.js +11 -0
- package/src/core/binary/align_4.js +2 -1
- package/src/core/binary/align_4.spec.d.ts +2 -0
- package/src/core/binary/align_4.spec.d.ts.map +1 -0
- package/src/core/binary/align_4.spec.js +20 -0
- package/src/core/binary/{de_interleave_bits_by_2.d.ts → de_interleave_2_bits.d.ts} +1 -1
- package/src/core/binary/de_interleave_2_bits.d.ts.map +1 -0
- package/src/core/binary/de_interleave_2_bits.spec.js +1 -1
- package/src/core/binary/hex2dec.spec.d.ts +2 -0
- package/src/core/binary/hex2dec.spec.d.ts.map +1 -0
- package/src/core/binary/hex2dec.spec.js +22 -0
- package/src/core/binary/lsb_32.d.ts +9 -0
- package/src/core/binary/lsb_32.d.ts.map +1 -0
- package/src/core/binary/lsb_32.js +12 -0
- package/src/core/binary/msb_32.d.ts +2 -0
- package/src/core/binary/msb_32.d.ts.map +1 -0
- package/src/core/binary/msb_32.js +20 -0
- package/src/core/binary/msb_lut_de_bruijn.d.ts +7 -0
- package/src/core/binary/msb_lut_de_bruijn.d.ts.map +1 -0
- package/src/core/binary/msb_lut_de_bruijn.js +9 -0
- package/src/core/binary/split_by_2.spec.d.ts +2 -0
- package/src/core/binary/split_by_2.spec.d.ts.map +1 -0
- package/src/core/binary/split_by_2.spec.js +22 -0
- package/src/core/bvh2/bvh3/ebvh_build_for_geometry_morton.d.ts +4 -1
- package/src/core/bvh2/bvh3/ebvh_build_for_geometry_morton.d.ts.map +1 -1
- package/src/core/bvh2/bvh3/ebvh_build_for_geometry_morton.js +16 -7
- package/src/core/bvh2/bvh3/ebvh_build_hierarchy.js +1 -1
- package/src/core/bvh2/bvh3/query/bvh_query_user_data_ray.d.ts.map +1 -1
- package/src/core/bvh2/bvh3/query/bvh_query_user_data_ray.js +12 -7
- package/src/core/geom/2d/circle/circle_circumference.d.ts +7 -0
- package/src/core/geom/2d/circle/circle_circumference.d.ts.map +1 -0
- package/src/core/geom/2d/circle/circle_circumference.js +12 -0
- package/src/core/geom/2d/compute_polygon_area_2d.d.ts.map +1 -1
- package/src/core/geom/2d/compute_polygon_area_2d.js +6 -4
- package/src/core/geom/2d/lt-grid/LooseTightGrid.js +1 -1
- package/src/core/geom/2d/triangle2d_get_barycentric.d.ts +2 -2
- package/src/core/geom/2d/triangle2d_get_barycentric.js +2 -2
- package/src/core/geom/3d/Ray3.d.ts +19 -0
- package/src/core/geom/3d/Ray3.d.ts.map +1 -0
- package/src/core/geom/3d/Ray3.js +27 -0
- package/src/core/geom/3d/ray/ray3_shift_origin_along_direction.d.ts +10 -0
- package/src/core/geom/3d/ray/ray3_shift_origin_along_direction.d.ts.map +1 -0
- package/src/core/geom/3d/ray/ray3_shift_origin_along_direction.js +35 -0
- package/src/core/geom/3d/sphere/harmonics/compute_legendre_polynomial.d.ts +1 -0
- package/src/core/geom/3d/sphere/harmonics/compute_legendre_polynomial.d.ts.map +1 -0
- package/src/core/geom/3d/sphere/harmonics/compute_legendre_polynomial.js +0 -0
- package/src/core/geom/3d/sphere/harmonics/sh3_convolve_with_cosine_kernel.d.ts +9 -0
- package/src/core/geom/3d/sphere/harmonics/sh3_convolve_with_cosine_kernel.d.ts.map +1 -0
- package/src/core/geom/3d/sphere/harmonics/sh3_convolve_with_cosine_kernel.js +26 -0
- package/src/core/geom/3d/sphere/harmonics/sh3_dering_optimize_positive.d.ts.map +1 -1
- package/src/core/geom/3d/sphere/harmonics/sh3_dering_optimize_positive.js +2 -4
- package/src/core/geom/3d/sphere/harmonics/sh3_rotate_bl.d.ts +8 -0
- package/src/core/geom/3d/sphere/harmonics/sh3_rotate_bl.d.ts.map +1 -0
- package/src/core/geom/3d/sphere/harmonics/sh3_rotate_bl.js +94 -0
- package/src/core/geom/3d/sphere/harmonics/sh3_rotate_filament.d.ts +8 -0
- package/src/core/geom/3d/sphere/harmonics/sh3_rotate_filament.d.ts.map +1 -0
- package/src/core/geom/3d/sphere/harmonics/{sh3_rotate.js → sh3_rotate_filament.js} +5 -2
- package/src/core/geom/3d/sphere/harmonics/sh3_vector_accumulate.d.ts +12 -0
- package/src/core/geom/3d/sphere/harmonics/sh3_vector_accumulate.d.ts.map +1 -0
- package/src/core/geom/3d/sphere/harmonics/sh3_vector_accumulate.js +40 -0
- package/src/core/geom/3d/sphere/harmonics/sh3_vector_accumulate.spec.d.ts +2 -0
- package/src/core/geom/3d/sphere/harmonics/sh3_vector_accumulate.spec.d.ts.map +1 -0
- package/src/core/geom/3d/sphere/harmonics/sh3_vector_accumulate.spec.js +27 -0
- package/src/core/geom/3d/sphere/harmonics/sh_compute_K.d.ts +3 -3
- package/src/core/geom/3d/sphere/harmonics/sh_compute_K.js +3 -3
- package/src/core/geom/3d/tetrahedra/delaunay/tetrahedral_mesh_build_from_grid.d.ts.map +1 -1
- package/src/core/geom/3d/tetrahedra/delaunay/tetrahedral_mesh_build_from_grid.js +29 -14
- package/src/core/geom/Quaternion.js +1 -1
- package/src/core/geom/vec/vector_copy.d.ts +10 -0
- package/src/core/geom/vec/vector_copy.d.ts.map +1 -0
- package/src/core/geom/vec/vector_copy.js +13 -0
- package/src/core/{math/vector_nd_dot.d.ts → geom/vec/vector_dot.d.ts} +2 -2
- package/src/core/geom/vec/vector_dot.d.ts.map +1 -0
- package/src/core/{math/vector_nd_dot.js → geom/vec/vector_dot.js} +1 -1
- package/src/core/{math/vector_nd_normalize.d.ts → geom/vec/vector_normalize.d.ts} +2 -2
- package/src/core/geom/vec/vector_normalize.d.ts.map +1 -0
- package/src/core/{math/vector_nd_normalize.js → geom/vec/vector_normalize.js} +1 -1
- package/src/core/geom/vec/vector_normalize.spec.d.ts +2 -0
- package/src/core/geom/vec/vector_normalize.spec.d.ts.map +1 -0
- package/src/core/{math/vector_nd_normalize.spec.js → geom/vec/vector_normalize.spec.js} +3 -3
- package/src/core/geom/vec/vector_scale_array.d.ts +11 -0
- package/src/core/geom/vec/vector_scale_array.d.ts.map +1 -0
- package/src/core/geom/vec/vector_scale_array.js +31 -0
- package/src/core/geom/vec3/v3_dot_array_array.js +2 -0
- package/src/core/geom/vec3/v3_matrix4_multiply.d.ts +10 -0
- package/src/core/geom/vec3/v3_matrix4_multiply.d.ts.map +1 -0
- package/src/core/geom/vec3/v3_matrix4_multiply.js +27 -0
- package/src/core/geom/vec3/v3_shift_along_direction.d.ts +14 -0
- package/src/core/geom/vec3/v3_shift_along_direction.d.ts.map +1 -0
- package/src/core/geom/vec3/v3_shift_along_direction.js +23 -0
- package/src/core/math/compute_legendre_polynomial.d.ts +10 -0
- package/src/core/math/compute_legendre_polynomial.d.ts.map +1 -0
- package/src/core/math/compute_legendre_polynomial.js +46 -0
- package/src/core/math/statistics/softmax.d.ts +11 -0
- package/src/core/math/statistics/softmax.d.ts.map +1 -0
- package/src/core/math/statistics/softmax.js +24 -0
- package/src/core/math/statistics/softmax.spec.d.ts +2 -0
- package/src/core/math/statistics/softmax.spec.d.ts.map +1 -0
- package/src/core/math/statistics/softmax.spec.js +9 -0
- package/src/core/model/node-graph/node/NodeInstance.d.ts.map +1 -1
- package/src/core/model/node-graph/node/NodeInstance.js +18 -0
- package/src/engine/ecs/transform/Transform.d.ts.map +1 -1
- package/src/engine/ecs/transform/Transform.js +19 -4
- package/src/engine/graphics/ecs/camera/CameraSystem.d.ts.map +1 -1
- package/src/engine/graphics/ecs/camera/CameraSystem.js +25 -13
- package/src/engine/graphics/geometry/decode_attribute_value.d.ts +10 -0
- package/src/engine/graphics/geometry/decode_attribute_value.d.ts.map +1 -0
- package/src/engine/graphics/geometry/decode_attribute_value.js +28 -0
- package/src/engine/graphics/geometry/geometry_construct_triangle_normal.d.ts +11 -0
- package/src/engine/graphics/geometry/geometry_construct_triangle_normal.d.ts.map +1 -0
- package/src/engine/graphics/geometry/geometry_construct_triangle_normal.js +31 -0
- package/src/engine/graphics/sh3/fromCubeRenderTarget.d.ts.map +1 -1
- package/src/engine/graphics/sh3/fromCubeRenderTarget.js +14 -17
- package/src/engine/graphics/sh3/lpv/LightProbeVolume.d.ts +3 -2
- package/src/engine/graphics/sh3/lpv/LightProbeVolume.d.ts.map +1 -1
- package/src/engine/graphics/sh3/lpv/LightProbeVolume.js +21 -97
- package/src/engine/graphics/sh3/lpv/PathTracerProbeRenderer.d.ts.map +1 -1
- package/src/engine/graphics/sh3/lpv/PathTracerProbeRenderer.js +8 -15
- package/src/engine/graphics/sh3/lpv/WebGLCubeProbeRenderer.d.ts +1 -0
- package/src/engine/graphics/sh3/lpv/WebGLCubeProbeRenderer.d.ts.map +1 -1
- package/src/engine/graphics/sh3/lpv/WebGLCubeProbeRenderer.js +6 -2
- package/src/engine/graphics/sh3/path_tracer/{GeometryBVHBatched.d.ts → BufferedGeometryBVH.d.ts} +9 -2
- package/src/engine/graphics/sh3/path_tracer/BufferedGeometryBVH.d.ts.map +1 -0
- package/src/engine/graphics/sh3/path_tracer/{GeometryBVHBatched.js → BufferedGeometryBVH.js} +84 -5
- package/src/engine/graphics/sh3/path_tracer/PathTracedMesh.d.ts +6 -4
- package/src/engine/graphics/sh3/path_tracer/PathTracedMesh.d.ts.map +1 -1
- package/src/engine/graphics/sh3/path_tracer/PathTracedMesh.js +54 -8
- package/src/engine/graphics/sh3/path_tracer/PathTracedScene.d.ts +6 -10
- package/src/engine/graphics/sh3/path_tracer/PathTracedScene.d.ts.map +1 -1
- package/src/engine/graphics/sh3/path_tracer/PathTracedScene.js +41 -47
- package/src/engine/graphics/sh3/path_tracer/material/MaterialConverter.d.ts +11 -0
- package/src/engine/graphics/sh3/path_tracer/material/MaterialConverter.d.ts.map +1 -0
- package/src/engine/graphics/sh3/path_tracer/material/MaterialConverter.js +102 -0
- package/src/engine/graphics/sh3/path_tracer/material/StandardMaterial.d.ts +9 -0
- package/src/engine/graphics/sh3/path_tracer/material/StandardMaterial.d.ts.map +1 -0
- package/src/engine/graphics/sh3/path_tracer/material/StandardMaterial.js +17 -0
- package/src/engine/graphics/sh3/path_tracer/material/StandardTexture.d.ts +31 -0
- package/src/engine/graphics/sh3/path_tracer/material/StandardTexture.d.ts.map +1 -0
- package/src/engine/graphics/sh3/path_tracer/material/StandardTexture.js +85 -0
- package/src/engine/graphics/sh3/path_tracer/material/TextureFilter.d.ts +14 -0
- package/src/engine/graphics/sh3/path_tracer/material/TextureFilter.d.ts.map +1 -0
- package/src/engine/graphics/sh3/path_tracer/material/TextureFilter.js +17 -0
- package/src/engine/graphics/sh3/path_tracer/material/TextureWrapping.d.ts +7 -0
- package/src/engine/graphics/sh3/path_tracer/material/TextureWrapping.d.ts.map +1 -0
- package/src/engine/graphics/sh3/path_tracer/material/TextureWrapping.js +9 -0
- package/src/engine/graphics/sh3/path_tracer/prototypePathTracer.js +104 -9
- package/src/engine/graphics/sh3/path_tracer/texture/sample_material.d.ts +1 -2
- package/src/engine/graphics/sh3/path_tracer/texture/sample_material.d.ts.map +1 -1
- package/src/engine/graphics/sh3/path_tracer/texture/sample_material.js +50 -23
- package/src/engine/graphics/sh3/prototypeSH3Probe.js +79 -29
- package/src/engine/graphics/sh3/visualise_spherical_harmonic_sphere.d.ts +11 -1
- package/src/engine/graphics/sh3/visualise_spherical_harmonic_sphere.d.ts.map +1 -1
- package/src/engine/graphics/sh3/visualise_spherical_harmonic_sphere.js +33 -16
- package/src/engine/graphics/texture/sampler/one_pixel_sampler_uint8.d.ts +8 -0
- package/src/engine/graphics/texture/sampler/one_pixel_sampler_uint8.d.ts.map +1 -0
- package/src/engine/graphics/texture/sampler/one_pixel_sampler_uint8.js +10 -0
- package/src/engine/graphics/texture/sampler/sampler_multiply_vector.d.ts +8 -0
- package/src/engine/graphics/texture/sampler/sampler_multiply_vector.d.ts.map +1 -0
- package/src/engine/graphics/texture/sampler/sampler_multiply_vector.js +23 -0
- package/src/engine/sound/material/detector/terrain/TerrainSoundMaterialSurfaceDetector.d.ts.map +1 -1
- package/src/engine/sound/material/detector/terrain/TerrainSoundMaterialSurfaceDetector.js +6 -6
- package/src/core/binary/de_interleave_bits_by_2.d.ts.map +0 -1
- package/src/core/geom/3d/sphere/harmonics/sh3_rotate.d.ts +0 -8
- package/src/core/geom/3d/sphere/harmonics/sh3_rotate.d.ts.map +0 -1
- package/src/core/math/vector_nd_dot.d.ts.map +0 -1
- package/src/core/math/vector_nd_normalize.d.ts.map +0 -1
- package/src/core/math/vector_nd_normalize.spec.d.ts +0 -2
- package/src/core/math/vector_nd_normalize.spec.d.ts.map +0 -1
- package/src/engine/graphics/sh3/path_tracer/GeometryBVHBatched.d.ts.map +0 -1
- /package/src/core/binary/{de_interleave_bits_by_2.js → de_interleave_2_bits.js} +0 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { sh3_vector_accumulate } from "./sh3_vector_accumulate.js";
|
|
2
|
+
|
|
3
|
+
test("basics", () => {
|
|
4
|
+
const out = [
|
|
5
|
+
1, 2,
|
|
6
|
+
3,4, 5,6,7,8,
|
|
7
|
+
9,10, 11,12, 13,14, 15,16, 17,18
|
|
8
|
+
];
|
|
9
|
+
const basis = [
|
|
10
|
+
2,
|
|
11
|
+
3, 5, 7,
|
|
12
|
+
11, 13, 17, 19, 23
|
|
13
|
+
];
|
|
14
|
+
|
|
15
|
+
sh3_vector_accumulate(
|
|
16
|
+
out, 0,
|
|
17
|
+
basis, 0,
|
|
18
|
+
[-3, 5], 0,
|
|
19
|
+
2
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
expect(out).toEqual([
|
|
23
|
+
-5, 12,
|
|
24
|
+
-6, 19, -10, 31, -14, 43,
|
|
25
|
+
-24, 65, -28, 77, -38, 99, -42, 111, -52, 133
|
|
26
|
+
]);
|
|
27
|
+
});
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* computes K(m
|
|
2
|
+
* computes K(l,m) normalization constant
|
|
3
3
|
* @see "Deringing Spherical Harmonics" by Peter-Pike Sloan
|
|
4
|
+
* @param {number} l band
|
|
4
5
|
* @param {number} m
|
|
5
|
-
* @param {number} l
|
|
6
6
|
* @returns {number}
|
|
7
7
|
*/
|
|
8
|
-
export function sh_compute_K(
|
|
8
|
+
export function sh_compute_K(l: number, m: number): number;
|
|
9
9
|
//# sourceMappingURL=sh_compute_K.d.ts.map
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { factorial } from "../../../../math/factorial.js";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* computes K(m
|
|
4
|
+
* computes K(l,m) normalization constant
|
|
5
5
|
* @see "Deringing Spherical Harmonics" by Peter-Pike Sloan
|
|
6
|
+
* @param {number} l band
|
|
6
7
|
* @param {number} m
|
|
7
|
-
* @param {number} l
|
|
8
8
|
* @returns {number}
|
|
9
9
|
*/
|
|
10
|
-
export function sh_compute_K(
|
|
10
|
+
export function sh_compute_K(l, m) {
|
|
11
11
|
|
|
12
12
|
const a = (2 * l + 1) * factorial(l - Math.abs(m))
|
|
13
13
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tetrahedral_mesh_build_from_grid.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/geom/3d/tetrahedra/delaunay/tetrahedral_mesh_build_from_grid.js"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,gFANW,MAAM,EAAE,gCAER,MAAM,iBACN,MAAM,iBACN,MAAM,
|
|
1
|
+
{"version":3,"file":"tetrahedral_mesh_build_from_grid.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/geom/3d/tetrahedra/delaunay/tetrahedral_mesh_build_from_grid.js"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,gFANW,MAAM,EAAE,gCAER,MAAM,iBACN,MAAM,iBACN,MAAM,QA4IhB"}
|
|
@@ -87,29 +87,44 @@ export function tetrahedral_mesh_build_from_grid(
|
|
|
87
87
|
for (let z = 1; z < resolution_z; z++) {
|
|
88
88
|
for (let y = 1; y < resolution_y; y++) {
|
|
89
89
|
for (let x = 1; x < resolution_x; x++) {
|
|
90
|
-
const
|
|
91
|
-
const
|
|
92
|
-
const
|
|
93
|
-
const
|
|
94
|
-
const
|
|
95
|
-
const
|
|
96
|
-
const
|
|
97
|
-
const
|
|
90
|
+
const A = vertex_position_to_index(x - 1, y - 1, z - 1);
|
|
91
|
+
const B = vertex_position_to_index(x - 1, y - 1, z);
|
|
92
|
+
const C = vertex_position_to_index(x - 1, y, z - 1);
|
|
93
|
+
const D = vertex_position_to_index(x - 1, y, z);
|
|
94
|
+
const E = vertex_position_to_index(x, y - 1, z - 1);
|
|
95
|
+
const F = vertex_position_to_index(x, y - 1, z);
|
|
96
|
+
const G = vertex_position_to_index(x, y, z - 1);
|
|
97
|
+
const H = vertex_position_to_index(x, y, z);
|
|
98
|
+
|
|
99
|
+
// const p000 = vertex_position_to_index(x - 1, y - 1, z - 1);
|
|
100
|
+
// const p001 = vertex_position_to_index(x - 1, y - 1, z);
|
|
101
|
+
// const p010 = vertex_position_to_index(x - 1, y, z - 1);
|
|
102
|
+
// const p011 = vertex_position_to_index(x - 1, y, z);
|
|
103
|
+
// const p100 = vertex_position_to_index(x, y - 1, z - 1);
|
|
104
|
+
// const p101 = vertex_position_to_index(x, y - 1, z);
|
|
105
|
+
// const p110 = vertex_position_to_index(x, y, z - 1);
|
|
106
|
+
// const p111 = vertex_position_to_index(x, y, z);
|
|
98
107
|
|
|
99
108
|
|
|
100
109
|
// Tessellate the grid volume into six tetrahedra per grid cell.
|
|
101
110
|
|
|
102
111
|
// prism 1
|
|
103
|
-
const tet_0 = make_cell(
|
|
104
|
-
const tet_1 = make_cell(
|
|
105
|
-
const tet_2 = make_cell(
|
|
112
|
+
const tet_0 = make_cell(E, F, G, A);
|
|
113
|
+
const tet_1 = make_cell(A, B, F, G);
|
|
114
|
+
const tet_2 = make_cell(A, C, B, G);
|
|
106
115
|
|
|
107
116
|
// prism 2
|
|
108
|
-
const tet_3 = make_cell(
|
|
109
|
-
const tet_4 = make_cell(
|
|
110
|
-
const tet_5 = make_cell(
|
|
117
|
+
const tet_3 = make_cell(E, G, H, A);
|
|
118
|
+
const tet_4 = make_cell(A, H, D, G);
|
|
119
|
+
const tet_5 = make_cell(A, D, C, G);
|
|
111
120
|
|
|
112
121
|
// link newly created tetrahedrons
|
|
122
|
+
mesh.setNeighbour(tet_0, 1, (tet_3 << 2) & 2);
|
|
123
|
+
mesh.setNeighbour(tet_3, 2, (tet_0 << 2) & 1);
|
|
124
|
+
|
|
125
|
+
mesh.setNeighbour(tet_0, 1, (tet_1 << 2) & 2);
|
|
126
|
+
mesh.setNeighbour(tet_1, 2, (tet_0 << 2) & 1);
|
|
127
|
+
|
|
113
128
|
// TODO implement
|
|
114
129
|
|
|
115
130
|
if (x > 1) {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @param {number[]} out
|
|
4
|
+
* @param {number} out_offset
|
|
5
|
+
* @param {number[]} input
|
|
6
|
+
* @param {number} input_offset
|
|
7
|
+
* @param {number} length
|
|
8
|
+
*/
|
|
9
|
+
export function vector_copy(out: number[], out_offset: number, input: number[], input_offset: number, length: number): void;
|
|
10
|
+
//# sourceMappingURL=vector_copy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vector_copy.d.ts","sourceRoot":"","sources":["../../../../../src/core/geom/vec/vector_copy.js"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,iCANW,MAAM,EAAE,cACR,MAAM,SACN,MAAM,EAAE,gBACR,MAAM,UACN,MAAM,QAIhB"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { array_copy } from "../../collection/array/array_copy.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @param {number[]} out
|
|
6
|
+
* @param {number} out_offset
|
|
7
|
+
* @param {number[]} input
|
|
8
|
+
* @param {number} input_offset
|
|
9
|
+
* @param {number} length
|
|
10
|
+
*/
|
|
11
|
+
export function vector_copy(out, out_offset, input, input_offset, length) {
|
|
12
|
+
array_copy(input, input_offset, out, out_offset, length);
|
|
13
|
+
}
|
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* @param {number} n number of dimensions
|
|
6
6
|
* @return {number}
|
|
7
7
|
*/
|
|
8
|
-
export function
|
|
9
|
-
//# sourceMappingURL=
|
|
8
|
+
export function vector_dot(a: number[] | Float32Array | Float64Array, b: number[] | Float32Array | Float64Array, n: number): number;
|
|
9
|
+
//# sourceMappingURL=vector_dot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vector_dot.d.ts","sourceRoot":"","sources":["../../../../../src/core/geom/vec/vector_dot.js"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,8BALW,MAAM,EAAE,GAAC,YAAY,GAAC,YAAY,KAClC,MAAM,EAAE,GAAC,YAAY,GAAC,YAAY,KAClC,MAAM,GACL,MAAM,CAUjB"}
|
|
@@ -4,5 +4,5 @@
|
|
|
4
4
|
* @param {number[]|Float32Array|Float64Array} data
|
|
5
5
|
* @param {number} [length] number of dimensions
|
|
6
6
|
*/
|
|
7
|
-
export function
|
|
8
|
-
//# sourceMappingURL=
|
|
7
|
+
export function vector_normalize(result: number[] | Float32Array | Float64Array, data: number[] | Float32Array | Float64Array, length?: number): void;
|
|
8
|
+
//# sourceMappingURL=vector_normalize.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vector_normalize.d.ts","sourceRoot":"","sources":["../../../../../src/core/geom/vec/vector_normalize.js"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,yCAJW,MAAM,EAAE,GAAC,YAAY,GAAC,YAAY,QAClC,MAAM,EAAE,GAAC,YAAY,GAAC,YAAY,WAClC,MAAM,QAoBhB"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* @param {number[]|Float32Array|Float64Array} data
|
|
5
5
|
* @param {number} [length] number of dimensions
|
|
6
6
|
*/
|
|
7
|
-
export function
|
|
7
|
+
export function vector_normalize(result, data, length = data.length) {
|
|
8
8
|
|
|
9
9
|
let magnitude2 = 0;
|
|
10
10
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vector_normalize.spec.d.ts","sourceRoot":"","sources":["../../../../../src/core/geom/vec/vector_normalize.spec.js"],"names":[],"mappings":""}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { vector_normalize } from "./vector_normalize.js";
|
|
2
2
|
|
|
3
3
|
test("1d vector normalization", () => {
|
|
4
4
|
const v = [7];
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
vector_normalize(v, v, 1);
|
|
7
7
|
|
|
8
8
|
expect(v[0]).toBeCloseTo(1);
|
|
9
9
|
|
|
10
10
|
v[0] = -13;
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
vector_normalize(v, v, 1);
|
|
13
13
|
|
|
14
14
|
expect(v[0]).toBeCloseTo(-1);
|
|
15
15
|
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @param {number[]|Float32Array|Float64Array} out
|
|
4
|
+
* @param {number} out_offset
|
|
5
|
+
* @param {number[]|Float32Array|Float64Array} input
|
|
6
|
+
* @param {number} input_offset
|
|
7
|
+
* @param {number} dimensions
|
|
8
|
+
* @param {number} scale
|
|
9
|
+
*/
|
|
10
|
+
export function vector_scale_array(out: number[] | Float32Array | Float64Array, out_offset: number, input: number[] | Float32Array | Float64Array, input_offset: number, dimensions: number, scale: number): void;
|
|
11
|
+
//# sourceMappingURL=vector_scale_array.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vector_scale_array.d.ts","sourceRoot":"","sources":["../../../../../src/core/geom/vec/vector_scale_array.js"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,wCAPW,MAAM,EAAE,GAAC,YAAY,GAAC,YAAY,cAClC,MAAM,SACN,MAAM,EAAE,GAAC,YAAY,GAAC,YAAY,gBAClC,MAAM,cACN,MAAM,SACN,MAAM,QAqBhB"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { assert } from "../../assert.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @param {number[]|Float32Array|Float64Array} out
|
|
6
|
+
* @param {number} out_offset
|
|
7
|
+
* @param {number[]|Float32Array|Float64Array} input
|
|
8
|
+
* @param {number} input_offset
|
|
9
|
+
* @param {number} dimensions
|
|
10
|
+
* @param {number} scale
|
|
11
|
+
*/
|
|
12
|
+
export function vector_scale_array(
|
|
13
|
+
out, out_offset,
|
|
14
|
+
input, input_offset,
|
|
15
|
+
dimensions,
|
|
16
|
+
scale) {
|
|
17
|
+
|
|
18
|
+
assert.isArrayLike(out, 'out');
|
|
19
|
+
assert.isNonNegativeInteger(out_offset, 'out_offset');
|
|
20
|
+
|
|
21
|
+
assert.isArrayLike(input, 'input');
|
|
22
|
+
assert.isNonNegativeInteger(input_offset, 'input_offset');
|
|
23
|
+
|
|
24
|
+
assert.isNonNegativeInteger(dimensions, 'dimensions');
|
|
25
|
+
assert.isNumber(scale, 'scale');
|
|
26
|
+
|
|
27
|
+
for (let i = 0; i < dimensions; i++) {
|
|
28
|
+
out[out_offset + i] = input[input_offset + i] * scale;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Perform matrix multiplication on a 3d vector
|
|
3
|
+
* @param {number[]|Float32Array} output
|
|
4
|
+
* @param {number} output_offset
|
|
5
|
+
* @param {number[]|Float32Array} input
|
|
6
|
+
* @param {number} input_offset
|
|
7
|
+
* @param {number[]|Float32Array} m4
|
|
8
|
+
*/
|
|
9
|
+
export function v3_matrix4_multiply(output: number[] | Float32Array, output_offset: number, input: number[] | Float32Array, input_offset: number, m4: number[] | Float32Array): void;
|
|
10
|
+
//# sourceMappingURL=v3_matrix4_multiply.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"v3_matrix4_multiply.d.ts","sourceRoot":"","sources":["../../../../../src/core/geom/vec3/v3_matrix4_multiply.js"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,4CANW,MAAM,EAAE,GAAC,YAAY,iBACrB,MAAM,SACN,MAAM,EAAE,GAAC,YAAY,gBACrB,MAAM,MACN,MAAM,EAAE,GAAC,YAAY,QAoB/B"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Perform matrix multiplication on a 3d vector
|
|
3
|
+
* @param {number[]|Float32Array} output
|
|
4
|
+
* @param {number} output_offset
|
|
5
|
+
* @param {number[]|Float32Array} input
|
|
6
|
+
* @param {number} input_offset
|
|
7
|
+
* @param {number[]|Float32Array} m4
|
|
8
|
+
*/
|
|
9
|
+
export function v3_matrix4_multiply(
|
|
10
|
+
output, output_offset,
|
|
11
|
+
input, input_offset,
|
|
12
|
+
m4
|
|
13
|
+
) {
|
|
14
|
+
const x = input[input_offset];
|
|
15
|
+
const y = input[input_offset + 1];
|
|
16
|
+
const z = input[input_offset + 2];
|
|
17
|
+
|
|
18
|
+
const w = 1 / (m4[3] * x + m4[7] * y + m4[11] * z + m4[15]);
|
|
19
|
+
|
|
20
|
+
const _x = (m4[0] * x + m4[4] * y + m4[8] * z + m4[12]) * w;
|
|
21
|
+
const _y = (m4[1] * x + m4[5] * y + m4[9] * z + m4[13]) * w;
|
|
22
|
+
const _z = (m4[2] * x + m4[6] * y + m4[10] * z + m4[14]) * w;
|
|
23
|
+
|
|
24
|
+
output[output_offset] = _x;
|
|
25
|
+
output[output_offset + 1] = _y;
|
|
26
|
+
output[output_offset + 2] = _z;
|
|
27
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @param {number[]|Float32Array} output
|
|
4
|
+
* @param {number} output_offset
|
|
5
|
+
* @param {number} origin_x
|
|
6
|
+
* @param {number} origin_y
|
|
7
|
+
* @param {number} origin_z
|
|
8
|
+
* @param {number} direction_x
|
|
9
|
+
* @param {number} direction_y
|
|
10
|
+
* @param {number} direction_z
|
|
11
|
+
* @param {number} distance
|
|
12
|
+
*/
|
|
13
|
+
export function v3_shift_along_direction(output: number[] | Float32Array, output_offset: number, origin_x: number, origin_y: number, origin_z: number, direction_x: number, direction_y: number, direction_z: number, distance: number): void;
|
|
14
|
+
//# sourceMappingURL=v3_shift_along_direction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"v3_shift_along_direction.d.ts","sourceRoot":"","sources":["../../../../../src/core/geom/vec3/v3_shift_along_direction.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,iDAVW,MAAM,EAAE,GAAC,YAAY,iBACrB,MAAM,YACN,MAAM,YACN,MAAM,YACN,MAAM,eACN,MAAM,eACN,MAAM,eACN,MAAM,YACN,MAAM,QAYhB"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @param {number[]|Float32Array} output
|
|
4
|
+
* @param {number} output_offset
|
|
5
|
+
* @param {number} origin_x
|
|
6
|
+
* @param {number} origin_y
|
|
7
|
+
* @param {number} origin_z
|
|
8
|
+
* @param {number} direction_x
|
|
9
|
+
* @param {number} direction_y
|
|
10
|
+
* @param {number} direction_z
|
|
11
|
+
* @param {number} distance
|
|
12
|
+
*/
|
|
13
|
+
export function v3_shift_along_direction(
|
|
14
|
+
output, output_offset,
|
|
15
|
+
origin_x, origin_y, origin_z,
|
|
16
|
+
direction_x, direction_y, direction_z,
|
|
17
|
+
distance
|
|
18
|
+
) {
|
|
19
|
+
|
|
20
|
+
output[output_offset + 0] = origin_x + direction_x * distance;
|
|
21
|
+
output[output_offset + 1] = origin_y + direction_y * distance;
|
|
22
|
+
output[output_offset + 2] = origin_z + direction_z * distance;
|
|
23
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Computes associated Legendre Polynomial P(l,m,x) at x
|
|
3
|
+
* Useful in Spherical Harmonics coefficient computation
|
|
4
|
+
* @param {number} l band
|
|
5
|
+
* @param {number} m
|
|
6
|
+
* @param {number} x
|
|
7
|
+
* @returns {number}
|
|
8
|
+
*/
|
|
9
|
+
export function compute_legendre_polynomial(l: number, m: number, x: number): number;
|
|
10
|
+
//# sourceMappingURL=compute_legendre_polynomial.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compute_legendre_polynomial.d.ts","sourceRoot":"","sources":["../../../../src/core/math/compute_legendre_polynomial.js"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,+CALW,MAAM,KACN,MAAM,KACN,MAAM,GACJ,MAAM,CAuClB"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Computes associated Legendre Polynomial P(l,m,x) at x
|
|
3
|
+
* Useful in Spherical Harmonics coefficient computation
|
|
4
|
+
* @param {number} l band
|
|
5
|
+
* @param {number} m
|
|
6
|
+
* @param {number} x
|
|
7
|
+
* @returns {number}
|
|
8
|
+
*/
|
|
9
|
+
export function compute_legendre_polynomial(l, m, x) {
|
|
10
|
+
// based on code from https://github.com/jan-van-bergen/SphericalHarmonicLighting/blob/2b214b3451859ded07ea4e41fb2aa8d2a44ab579/SphericalHarmonicsLighting/SphericalHarmonics.cpp#L61
|
|
11
|
+
|
|
12
|
+
// Apply rule 2; P m m
|
|
13
|
+
let pmm = 1.0;
|
|
14
|
+
if (m > 0) {
|
|
15
|
+
const somx2 = Math.sqrt((1.0 - x) * (1.0 + x));
|
|
16
|
+
let fact = 1.0;
|
|
17
|
+
|
|
18
|
+
for (let i = 1; i <= m; i++) {
|
|
19
|
+
pmm *= (-fact) * somx2;
|
|
20
|
+
fact += 2.0;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// If l is equal to m then P m m is already the right answer
|
|
25
|
+
if (l === m) {
|
|
26
|
+
return pmm;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// Use rule 3 once
|
|
30
|
+
let pmmp1 = x * (2.0 * m + 1.0) * pmm;
|
|
31
|
+
|
|
32
|
+
if (l === m + 1) {
|
|
33
|
+
return pmmp1;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// Iterate rule 1 until the right answer is found
|
|
37
|
+
let pll = 0.0;
|
|
38
|
+
|
|
39
|
+
for (let ll = m + 2; ll <= l; ll++) {
|
|
40
|
+
pll = ((2.0 * ll - 1.0) * x * pmmp1 - (ll + m - 1.0) * pmm) / (ll - m);
|
|
41
|
+
pmm = pmmp1;
|
|
42
|
+
pmmp1 = pll;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return pll;
|
|
46
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Normalized exponential function, converts vector of size K into probability distribution of K possible outcomes
|
|
3
|
+
* Useful in neural network implementations
|
|
4
|
+
* @see https://en.wikipedia.org/wiki/Softmax_function
|
|
5
|
+
* @param {number[]|Float32Array} z input vector
|
|
6
|
+
* @param {number} i Element in vector Z to compute softmax for
|
|
7
|
+
* @param {number} k Should be >= 1, typically dimension of Z
|
|
8
|
+
* @returns {number}
|
|
9
|
+
*/
|
|
10
|
+
export function softmax(z: number[] | Float32Array, i: number, k: number): number;
|
|
11
|
+
//# sourceMappingURL=softmax.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"softmax.d.ts","sourceRoot":"","sources":["../../../../../src/core/math/statistics/softmax.js"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,2BALW,MAAM,EAAE,GAAC,YAAY,KACrB,MAAM,KACN,MAAM,GACJ,MAAM,CAgBlB"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Normalized exponential function, converts vector of size K into probability distribution of K possible outcomes
|
|
3
|
+
* Useful in neural network implementations
|
|
4
|
+
* @see https://en.wikipedia.org/wiki/Softmax_function
|
|
5
|
+
* @param {number[]|Float32Array} z input vector
|
|
6
|
+
* @param {number} i Element in vector Z to compute softmax for
|
|
7
|
+
* @param {number} k Should be >= 1, typically dimension of Z
|
|
8
|
+
* @returns {number}
|
|
9
|
+
*/
|
|
10
|
+
export function softmax(z, i, k) {
|
|
11
|
+
|
|
12
|
+
const ezi = Math.exp(z[i]);
|
|
13
|
+
|
|
14
|
+
// NOTE that if we want to compute softmax for an entire vector, it could be far more efficient
|
|
15
|
+
let sum = 0;
|
|
16
|
+
|
|
17
|
+
for (let j = 1; j < k; j++) {
|
|
18
|
+
|
|
19
|
+
sum += Math.exp(z[j]);
|
|
20
|
+
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return ezi / sum;
|
|
24
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"softmax.spec.d.ts","sourceRoot":"","sources":["../../../../../src/core/math/statistics/softmax.spec.js"],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NodeInstance.d.ts","sourceRoot":"","sources":["../../../../../../src/core/model/node-graph/node/NodeInstance.js"],"names":[],"mappings":"AAcA;;;;GAIG;AACH;IAEI;;;;OAIG;IACH,aAFU,MAAM,CAEE;IAElB;;;OAGG;IACH,6BAAmB;IAEnB;;;OAGG;IACH,WAFU,yBAAyB,EAAE,CAEtB;IAEf;;;OAGG;IACH,gBAAgB;IAEhB;;;OAGG;IACH,qBAAmB;IAEnB;;;OAGG;IACH,aAFU,gBAAgB,CAED;IAEzB;;;;;;OAMG;IACH,wBAFU,MAAM,CAEE;IAElB;;OAEG;IACH;QACI;;;WAGG;mCADO,OAAO,MAAM,WAAO;QAG9B;;;WAGG;iCADO,OAAO,MAAM,MAAI;QAG3B;;;WAGG;mCADO,OAAO,MAAM,MAAI;QAI3B;;;;WAIG;qCADO,yCAAyC,YAAY,CAAC;MAGlE;IAEF;;;;;;OAMG;IACH,yBALW,MAAM,aACN,aAAa,UACb,YAAY,GACV,MAAM,CAsBlB;IAED;;;OAGG;IACH,gDAEC;IAED;;;OAGG;IACH,+CAEC;IAGD;;;OAGG;IACH,mCAEC;IAED;;;;OAIG;IACH,kCAEC;IAED;;;;OAIG;IACH,mBAHW,MAAM,oBAKhB;IAED;;;;OAIG;IACH,mBAHW,MAAM,OAKhB;IAED;;;;OAIG;IACH,yBAHW,MAAM,KAOhB;IAED;;;;OAIG;IACH,2BAHW,MAAM,oBAmChB;IAED;;;;OAIG;IACH,oBAHW,MAAM,GACJ,OAAO,CAkBnB;IAED;;;OAGG;IACH,uCAQC;IAED,wBAIC;IAED;;;OAGG;IACH,mDA+BC;IAED;;;;OAIG;IACH,qBAHW,MAAM,GACJ,yBAAyB,GAAC,SAAS,CAoB/C;IAED,eAEC;IAED;;;;OAIG;IACH,cAHW,YAAY,GACV,OAAO,CAQnB;IAED,mBAEC;IAIL;;;OAGG;IACH,yBAFU,OAAO,CAEoB;CAPpC;
|
|
1
|
+
{"version":3,"file":"NodeInstance.d.ts","sourceRoot":"","sources":["../../../../../../src/core/model/node-graph/node/NodeInstance.js"],"names":[],"mappings":"AAcA;;;;GAIG;AACH;IAEI;;;;OAIG;IACH,aAFU,MAAM,CAEE;IAElB;;;OAGG;IACH,6BAAmB;IAEnB;;;OAGG;IACH,WAFU,yBAAyB,EAAE,CAEtB;IAEf;;;OAGG;IACH,gBAAgB;IAEhB;;;OAGG;IACH,qBAAmB;IAEnB;;;OAGG;IACH,aAFU,gBAAgB,CAED;IAEzB;;;;;;OAMG;IACH,wBAFU,MAAM,CAEE;IAElB;;OAEG;IACH;QACI;;;WAGG;mCADO,OAAO,MAAM,WAAO;QAG9B;;;WAGG;iCADO,OAAO,MAAM,MAAI;QAG3B;;;WAGG;mCADO,OAAO,MAAM,MAAI;QAI3B;;;;WAIG;qCADO,yCAAyC,YAAY,CAAC;MAGlE;IAEF;;;;;;OAMG;IACH,yBALW,MAAM,aACN,aAAa,UACb,YAAY,GACV,MAAM,CAsBlB;IAED;;;OAGG;IACH,gDAEC;IAED;;;OAGG;IACH,+CAEC;IAGD;;;OAGG;IACH,mCAEC;IAED;;;;OAIG;IACH,kCAEC;IAED;;;;OAIG;IACH,mBAHW,MAAM,oBAKhB;IAED;;;;OAIG;IACH,mBAHW,MAAM,OAKhB;IAED;;;;OAIG;IACH,yBAHW,MAAM,KAOhB;IAED;;;;OAIG;IACH,2BAHW,MAAM,oBAmChB;IAED;;;;OAIG;IACH,oBAHW,MAAM,GACJ,OAAO,CAkBnB;IAED;;;OAGG;IACH,uCAQC;IAED,wBAIC;IAED;;;OAGG;IACH,mDA+BC;IAED;;;;OAIG;IACH,qBAHW,MAAM,GACJ,yBAAyB,GAAC,SAAS,CAoB/C;IAED;;;;OAIG;IACH,6BAHW,MAAM,GACJ,SAAS,GAAC,yBAAyB,CAa/C;IAED,eAEC;IAED;;;;OAIG;IACH,cAHW,YAAY,GACV,OAAO,CAQnB;IAED,mBAEC;IAIL;;;OAGG;IACH,yBAFU,OAAO,CAEoB;CAPpC;0CA5WyC,gCAAgC;iBAHzD,kCAAkC;mBAChC,kCAAkC;8BAGvB,oBAAoB"}
|
|
@@ -329,6 +329,24 @@ export class NodeInstance {
|
|
|
329
329
|
return undefined;
|
|
330
330
|
}
|
|
331
331
|
|
|
332
|
+
/**
|
|
333
|
+
*
|
|
334
|
+
* @param {string} name
|
|
335
|
+
* @returns {undefined|NodeInstancePortReference}
|
|
336
|
+
*/
|
|
337
|
+
getFirstEndpointByName(name) {
|
|
338
|
+
assert.isString(name, 'name');
|
|
339
|
+
|
|
340
|
+
const ports = this.description.getPortsByName(name);
|
|
341
|
+
|
|
342
|
+
if (ports.length === 0) {
|
|
343
|
+
return undefined;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
return this.getEndpoint(ports[0].id);
|
|
347
|
+
|
|
348
|
+
}
|
|
349
|
+
|
|
332
350
|
hash() {
|
|
333
351
|
return this.id;
|
|
334
352
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Transform.d.ts","sourceRoot":"","sources":["../../../../../src/engine/ecs/transform/Transform.js"],"names":[],"mappings":"AAsBA;;;GAGG;AACH;IAwQI;;;;OAIG;IACH,4BAFa,SAAS,CAQrB;
|
|
1
|
+
{"version":3,"file":"Transform.d.ts","sourceRoot":"","sources":["../../../../../src/engine/ecs/transform/Transform.js"],"names":[],"mappings":"AAsBA;;;GAGG;AACH;IAwQI;;;;OAIG;IACH,4BAFa,SAAS,CAQrB;IAED;;;;OAIG;IACH,uBAHW,MAAM,EAAE,GAAC,YAAY,GACnB,SAAS,CAQrB;IAuDD;;;;;OAKG;IACH,wCAJW,UAAU,gBACV,OAAO,wBAajB;IArWD;;;OAGG;IACH,mBAHU,OAAO,CAGe;IAEhC;;;OAGG;IACH,mBAHU,UAAU,CAGkB;IAEtC;;;OAGG;IACH,gBAHU,OAAO,CAGY;IAE7B;;;;OAIG;IACH,iBAFU,YAAY,CAEC;IAEvB;;;;OAIG;IACH,OAFU,MAAM,CAEM;IAOtB;;;;OAIG;IACH,uBAMC;IAED;;;OAGG;IACH,kBAMC;IAED;;;OAGG;IACH,qBAMC;IAED;;;;OAIG;IACH,kDAIC;IAED;;;;OAIG;IACH,oDAIC;IAYD;;;;OAIG;IACH,cAHW,MAAM,GAAC,cAAc,GACnB,IAAI,CAIhB;IAED;;;;OAIG;IACH,gBAHW,MAAM,GAAC,cAAc,GACnB,IAAI,CAIhB;IAED;;;;OAIG;IACH,gBAHW,MAAM,GAAC,cAAc,SACrB,OAAO,QAQjB;IAED;;;;OAIG;IACH,cAHW,MAAM,GAAC,cAAc,GACnB,OAAO,CAInB;IAED;;OAEG;IACH,qBAEC;IAED;;;;OAIG;IACH,eAHW,OAAO,OACP,OAAO,QAmBjB;IAED,0BAwBC;IAED;;;;MAMC;IAED;;;OAGG;IACH,YAFW,SAAS,QAenB;IAED;;;OAGG;IACH,SAFa,SAAS,CAQrB;IAED;;;;OAIG;IACH,cAHW,SAAS,GACP,OAAO,CAMnB;IAED;;;OAGG;IACH,QAFa,MAAM,CAKlB;IA4BD;;;;OAIG;IACH,sBAHW,SAAS,KACT,SAAS,QAMnB;IAED;;;OAGG;IACH,oBAFW,OAAK,MAAM,EAAE,GAAC,YAAY,QAgBpC;IAED;;;OAGG;IACH,kBAFW,MAAM,EAAE,GAAC,YAAY,QAI/B;IAED;;;;;OAKG;IACH,qBAEC;IAED,mBAEC;IA2BL;;;OAGG;IACH,sBAFU,OAAO,CAEc;;CAZ9B;;kBAIS,MAAM;;oBA/XI,+BAA+B;uBAD5B,kCAAkC;+BAE1B,qBAAqB"}
|
|
@@ -301,6 +301,19 @@ export class Transform {
|
|
|
301
301
|
return result;
|
|
302
302
|
}
|
|
303
303
|
|
|
304
|
+
/**
|
|
305
|
+
*
|
|
306
|
+
* @param {number[]|Float32Array} mat
|
|
307
|
+
* @returns {Transform}
|
|
308
|
+
*/
|
|
309
|
+
static fromMatrix(mat) {
|
|
310
|
+
const result = new Transform();
|
|
311
|
+
|
|
312
|
+
result.fromMatrix4(mat);
|
|
313
|
+
|
|
314
|
+
return result;
|
|
315
|
+
}
|
|
316
|
+
|
|
304
317
|
/**
|
|
305
318
|
* Multiply two transforms, result it written into this one
|
|
306
319
|
* @param {Transform} a
|
|
@@ -314,17 +327,19 @@ export class Transform {
|
|
|
314
327
|
|
|
315
328
|
/**
|
|
316
329
|
*
|
|
317
|
-
* @param {mat4|number[]|Float32Array}
|
|
330
|
+
* @param {mat4|number[]|Float32Array} matrix
|
|
318
331
|
*/
|
|
319
|
-
fromMatrix4(
|
|
332
|
+
fromMatrix4(matrix) {
|
|
333
|
+
assert.isArrayLike(matrix, 'matrix');
|
|
334
|
+
|
|
320
335
|
// we know we are changing the matrix, so we're going to need to disable the flag that sets matrix from position/rotation/scale changes
|
|
321
336
|
const ad = this.getFlag(TransformFlags.AutomaticChangeDetection);
|
|
322
337
|
|
|
323
338
|
this.clearFlag(TransformFlags.AutomaticChangeDetection);
|
|
324
339
|
|
|
325
|
-
this.matrix.set(
|
|
340
|
+
this.matrix.set(matrix);
|
|
326
341
|
|
|
327
|
-
decompose_matrix_4_array(
|
|
342
|
+
decompose_matrix_4_array(matrix, this.position, this.rotation, this.scale);
|
|
328
343
|
|
|
329
344
|
// restore value of the flag
|
|
330
345
|
this.writeFlag(TransformFlags.AutomaticChangeDetection, ad);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CameraSystem.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/ecs/camera/CameraSystem.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CameraSystem.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/ecs/camera/CameraSystem.js"],"names":[],"mappings":"AAgBA;;;;GAIG;AACH,4DAHW,YAAY,8BAmBtB;AAED;IA+NI;;;;OAIG;IACH,8EAOC;IAED;;;;OAIG;IACH,0DAFa;QAAC,SAAS,EAAC,CAAC,MAAM,GAAC,SAAS,CAAC,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAC,CAc1D;IAED;;;;OAIG;IACH,uEAFoB,YAAY,EAAE,gBAqBjC;IAvRD;;;;OAIG;IACH,sCAmDC;IAhDG,WAA2B;IAE3B,mDAAuC;IAEvC,8DAEC;IAQD;;OAEG;IACH,yBAAwB;IAExB,kBAAoB;IAKpB;;;;;OAKG;IACH,+BAeC;IAED,sBAAwB;IAI5B;;;;;OAKG;IACH,aAHW,MAAM,aADN,SAAS,uBAyEnB;IAED;;;;;OAKG;IACH,eAHW,MAAM,aADN,SAAS,uBAiBnB;IAED,0EAqDC;IAED,2EAQC;CA4DJ;uBAtTsB,aAAa;uBALb,wBAAwB;0BACrB,qCAAqC;4CAFnB,uDAAuD;wCAJ1D,OAAO"}
|