@woosh/meep-engine 2.114.0 → 2.115.0
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 +92 -53
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +92 -53
- package/editor/ecs/component/editors/Sampler2DEditor.js +3 -3
- package/package.json +1 -1
- package/src/core/binary/clz32.d.ts +7 -0
- package/src/core/binary/clz32.d.ts.map +1 -0
- package/src/core/binary/clz32.js +37 -0
- package/src/core/binary/is_data_url.d.ts.map +1 -1
- package/src/core/binary/is_data_url.js +1 -0
- package/src/core/binary/makeArrayBuffer.d.ts.map +1 -1
- package/src/core/binary/makeArrayBuffer.js +1 -0
- package/src/core/binary/msb_32.d.ts +7 -1
- package/src/core/binary/msb_32.d.ts.map +1 -1
- package/src/core/binary/msb_32.js +3 -12
- package/src/core/collection/RingBuffer.d.ts +1 -1
- package/src/core/collection/RingBuffer.js +1 -1
- package/src/core/collection/array/combine_hash.js +1 -1
- package/src/core/{primitives → collection}/array/compareArrays.d.ts.map +1 -1
- package/src/core/{primitives → collection}/array/computeIntegerArrayHash.d.ts.map +1 -1
- package/src/core/{primitives → collection}/array/computeStridedArrayHash.d.ts.map +1 -1
- package/src/core/{primitives → collection}/array/computeStridedIntegerArrayHash.d.ts.map +1 -1
- package/src/core/collection/array/randomMultipleFromArray.d.ts +6 -6
- package/src/core/collection/array/randomMultipleFromArray.d.ts.map +1 -1
- package/src/core/collection/array/randomMultipleFromArray.js +5 -5
- package/src/core/collection/array/typed/sparse_typed_array_hash.js +1 -1
- package/src/core/collection/array/typed/typedArrayConstructorByInstance.d.ts.map +1 -0
- package/src/core/geom/2d/Rectangle.d.ts.map +1 -1
- package/src/core/geom/2d/Rectangle.js +18 -5
- package/src/core/geom/2d/aabb/aabb2_overlap_exists.d.ts.map +1 -1
- package/src/core/geom/2d/aabb/aabb2_overlap_exists.js +4 -1
- package/src/core/geom/2d/convex-hull/fixed_convex_hull_humus.d.ts +3 -3
- package/src/core/geom/2d/convex-hull/fixed_convex_hull_humus.d.ts.map +1 -1
- package/src/core/geom/2d/convex-hull/fixed_convex_hull_humus.js +11 -4
- package/src/core/geom/2d/convex-hull/fixed_convex_hull_relaxation.js +2 -2
- package/src/core/geom/2d/convex-hull/orientation3_array.js +2 -2
- package/src/core/geom/2d/intersect_ray_2d.d.ts.map +1 -1
- package/src/core/geom/2d/intersect_ray_2d.js +5 -5
- package/src/core/geom/2d/{compute_triangle_area_2d.d.ts → triangle2d_compute_area.d.ts} +2 -2
- package/src/core/geom/2d/triangle2d_compute_area.d.ts.map +1 -0
- package/src/core/geom/2d/{compute_triangle_area_2d.js → triangle2d_compute_area.js} +1 -1
- package/src/core/geom/2d/triangle2d_contains_point.d.ts +14 -0
- package/src/core/geom/2d/triangle2d_contains_point.d.ts.map +1 -0
- package/src/core/geom/2d/triangle2d_contains_point.js +39 -0
- package/src/core/geom/2d/triangle2d_get_barycentric.d.ts +2 -2
- package/src/core/geom/2d/triangle2d_get_barycentric.d.ts.map +1 -1
- package/src/core/geom/2d/triangle2d_get_barycentric.js +1 -1
- package/src/core/geom/Vector2.d.ts.map +1 -1
- package/src/core/geom/Vector2.js +2 -2
- package/src/core/math/bessel_3.d.ts +1 -1
- package/src/core/math/bessel_3.js +1 -1
- package/src/core/math/computeWholeDivisorLow.d.ts +1 -1
- package/src/core/math/computeWholeDivisorLow.d.ts.map +1 -1
- package/src/core/math/computeWholeDivisorLow.js +8 -5
- package/src/core/math/interval/separation1D.d.ts.map +1 -0
- package/src/core/math/{separation1D.js → interval/separation1D.js} +3 -3
- package/src/core/math/solveQuadratic.d.ts.map +1 -1
- package/src/core/math/solveQuadratic.js +10 -0
- package/src/core/model/object/compareValues.js +3 -3
- package/src/engine/EntityCreator.d.ts +11 -11
- package/src/engine/EntityCreator.d.ts.map +1 -1
- package/src/engine/EntityCreator.js +2 -4
- package/src/engine/ecs/grid/HeightMap2NormalMap.js +2 -2
- package/src/engine/ecs/grid/NormalMap2AOMap.js +3 -3
- package/src/engine/graphics/impostors/octahedral/util/build_cutout_from_atlas_by_alpha.d.ts +2 -2
- package/src/engine/graphics/impostors/octahedral/util/build_cutout_from_atlas_by_alpha.d.ts.map +1 -1
- package/src/engine/graphics/impostors/octahedral/util/build_cutout_from_atlas_by_alpha.js +5 -55
- package/src/engine/graphics/impostors/octahedral/util/sampler2d_build_cutout.d.ts +9 -0
- package/src/engine/graphics/impostors/octahedral/util/sampler2d_build_cutout.d.ts.map +1 -0
- package/src/engine/graphics/impostors/octahedral/util/sampler2d_build_cutout.js +64 -0
- package/src/engine/graphics/sh3/path_tracer/material/MaterialConverter.js +2 -2
- package/src/engine/graphics/texture/sampler/Sampler2D.d.ts.map +1 -1
- package/src/engine/graphics/texture/sampler/Sampler2D.js +4 -2
- package/src/engine/graphics/texture/sampler/filter/kaiser_bessel_window.js +1 -1
- package/src/engine/graphics/texture/sampler/filter/sampler2d_scale_down_generic.js +1 -1
- package/src/engine/graphics/texture/sampler/sampler2d_multiply_vector.d.ts +8 -0
- package/src/engine/graphics/texture/sampler/sampler2d_multiply_vector.d.ts.map +1 -0
- package/src/engine/graphics/texture/sampler/{sampler_multiply_vector.js → sampler2d_multiply_vector.js} +1 -1
- package/src/engine/graphics/texture/sampler/sampler2d_to_float32_texture.d.ts +8 -0
- package/src/engine/graphics/texture/sampler/sampler2d_to_float32_texture.d.ts.map +1 -0
- package/src/engine/graphics/texture/sampler/{sampler2DToFloat32Texture.js → sampler2d_to_float32_texture.js} +2 -2
- package/src/engine/graphics/texture/sampler/util/drawSamplerHTML.d.ts.map +1 -1
- package/src/engine/graphics/texture/sampler/util/drawSamplerHTML.js +3 -1
- package/src/engine/grid/obstacle/GridObstacle.d.ts.map +1 -1
- package/src/engine/grid/obstacle/GridObstacle.js +1 -1
- package/src/engine/physics/computeInterceptPoint.js +20 -6
- package/src/engine/physics/mls-mpm/MLS_MPM.d.ts.map +1 -1
- package/src/engine/physics/mls-mpm/MLS_MPM.js +14 -17
- package/src/core/UUID.d.ts +0 -6
- package/src/core/UUID.d.ts.map +0 -1
- package/src/core/UUID.js +0 -21
- package/src/core/geom/2d/compute_triangle_area_2d.d.ts.map +0 -1
- package/src/core/geom/2d/convex-hull/orientation3.d.ts +0 -12
- package/src/core/geom/2d/convex-hull/orientation3.d.ts.map +0 -1
- package/src/core/geom/2d/convex-hull/orientation3.js +0 -489
- package/src/core/geom/2d/convex-hull/orientation3_v2.d.ts +0 -9
- package/src/core/geom/2d/convex-hull/orientation3_v2.d.ts.map +0 -1
- package/src/core/geom/2d/convex-hull/orientation3_v2.js +0 -12
- package/src/core/math/separation1D.d.ts.map +0 -1
- package/src/engine/graphics/texture/sampler/sampler2DToFloat32Texture.d.ts +0 -8
- package/src/engine/graphics/texture/sampler/sampler2DToFloat32Texture.d.ts.map +0 -1
- package/src/engine/graphics/texture/sampler/sampler_multiply_vector.d.ts +0 -8
- package/src/engine/graphics/texture/sampler/sampler_multiply_vector.d.ts.map +0 -1
- package/src/engine/graphics/texture/sampler/typedArrayConstructorByInstance.d.ts.map +0 -1
- package/src/engine/save/storage/InMemoryLocalStorage.d.ts +0 -6
- package/src/engine/save/storage/InMemoryLocalStorage.d.ts.map +0 -1
- package/src/engine/save/storage/InMemoryLocalStorage.js +0 -13
- /package/src/core/{primitives → collection}/array/compareArrays.d.ts +0 -0
- /package/src/core/{primitives → collection}/array/compareArrays.js +0 -0
- /package/src/core/{primitives → collection}/array/computeIntegerArrayHash.d.ts +0 -0
- /package/src/core/{primitives → collection}/array/computeIntegerArrayHash.js +0 -0
- /package/src/core/{primitives → collection}/array/computeStridedArrayHash.d.ts +0 -0
- /package/src/core/{primitives → collection}/array/computeStridedArrayHash.js +0 -0
- /package/src/core/{primitives → collection}/array/computeStridedIntegerArrayHash.d.ts +0 -0
- /package/src/core/{primitives → collection}/array/computeStridedIntegerArrayHash.js +0 -0
- /package/src/{engine/graphics/texture/sampler → core/collection/array/typed}/typedArrayConstructorByInstance.d.ts +0 -0
- /package/src/{engine/graphics/texture/sampler → core/collection/array/typed}/typedArrayConstructorByInstance.js +0 -0
- /package/src/core/math/{separation1D.d.ts → interval/separation1D.d.ts} +0 -0
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { array_copy } from "../../../../../core/collection/array/array_copy.js";
|
|
2
|
+
import { compute_polygon_area_2d } from "../../../../../core/geom/2d/compute_polygon_area_2d.js";
|
|
3
|
+
import { convex_hull_jarvis_2d } from "../../../../../core/geom/2d/convex-hull/convex_hull_jarvis_2d.js";
|
|
4
|
+
import { fixed_convex_hull_relaxation } from "../../../../../core/geom/2d/convex-hull/fixed_convex_hull_relaxation.js";
|
|
5
|
+
import {
|
|
6
|
+
make_edge_condition_channel_threshold
|
|
7
|
+
} from "../../../texture/sampler/search/make_edge_condition_channel_threshold.js";
|
|
8
|
+
import { sampler2d_find_pixels } from "../../../texture/sampler/search/sampler2d_find_pixels.js";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
*
|
|
12
|
+
* @param {Sampler2D} accumulator
|
|
13
|
+
* @param {number} vertex_limit
|
|
14
|
+
* @param {number} frame_size
|
|
15
|
+
* @returns {Float32Array}
|
|
16
|
+
*/
|
|
17
|
+
export function sampler2d_build_cutout(accumulator, vertex_limit, frame_size) {
|
|
18
|
+
const edge_pixels = sampler2d_find_pixels(accumulator, make_edge_condition_channel_threshold(0, 5));
|
|
19
|
+
|
|
20
|
+
// filtered pixels
|
|
21
|
+
const filtered_edge_pixels = [];
|
|
22
|
+
|
|
23
|
+
const half_pixel = 0.5;
|
|
24
|
+
|
|
25
|
+
for (let i = 0; i < edge_pixels.length; i += 2) {
|
|
26
|
+
const x = edge_pixels[i];
|
|
27
|
+
const y = edge_pixels[i + 1];
|
|
28
|
+
|
|
29
|
+
filtered_edge_pixels.push(x - half_pixel, y - half_pixel);
|
|
30
|
+
filtered_edge_pixels.push(x + half_pixel, y - half_pixel);
|
|
31
|
+
filtered_edge_pixels.push(x + half_pixel, y + half_pixel);
|
|
32
|
+
filtered_edge_pixels.push(x - half_pixel, y + half_pixel);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const hull_point_indices = convex_hull_jarvis_2d(filtered_edge_pixels, filtered_edge_pixels.length / 2);
|
|
36
|
+
|
|
37
|
+
const hull_points = [];
|
|
38
|
+
|
|
39
|
+
for (let i = 0; i < hull_point_indices.length; i++) {
|
|
40
|
+
const hpi = hull_point_indices[i];
|
|
41
|
+
|
|
42
|
+
array_copy(filtered_edge_pixels, hpi * 2, hull_points, i * 2, 2);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const cutout_points = new Float32Array(vertex_limit * 2);
|
|
46
|
+
|
|
47
|
+
fixed_convex_hull_relaxation(cutout_points, 0, vertex_limit, hull_points, hull_point_indices.length);
|
|
48
|
+
|
|
49
|
+
const area = compute_polygon_area_2d(cutout_points, vertex_limit);
|
|
50
|
+
|
|
51
|
+
console.log(`Cutout area: ${area}`);
|
|
52
|
+
|
|
53
|
+
if (area >= 0.99 && vertex_limit >= 4) {
|
|
54
|
+
// default back to aligned quad, produced result is a degradation
|
|
55
|
+
return new Float32Array([
|
|
56
|
+
0, 0,
|
|
57
|
+
accumulator.width, 0,
|
|
58
|
+
accumulator.width, accumulator.height,
|
|
59
|
+
0, accumulator.height
|
|
60
|
+
]);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return cutout_points;
|
|
64
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Color } from "three";
|
|
2
2
|
import { convertTexture2Sampler2D } from "../../../texture/sampler/convertTexture2Sampler2D.js";
|
|
3
|
-
import {
|
|
3
|
+
import { sampler2d_multiply_vector } from "../../../texture/sampler/sampler2d_multiply_vector.js";
|
|
4
4
|
import { iterate_three_material_textures } from "../../../three/material/iterate_three_material_textures.js";
|
|
5
5
|
import { StandardMaterial } from "./StandardMaterial.js";
|
|
6
6
|
import { StandardTexture } from "./StandardTexture.js";
|
|
@@ -94,7 +94,7 @@ export class MaterialConverter {
|
|
|
94
94
|
|
|
95
95
|
tinted_diffuse.sampler = tinted_diffuse.sampler.clone();
|
|
96
96
|
|
|
97
|
-
|
|
97
|
+
sampler2d_multiply_vector(tinted_diffuse.sampler, result.diffuse.sampler, material.color.toArray());
|
|
98
98
|
|
|
99
99
|
result.diffuse = tinted_diffuse;
|
|
100
100
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Sampler2D.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/texture/sampler/Sampler2D.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Sampler2D.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/texture/sampler/Sampler2D.js"],"names":[],"mappings":"AAmBA;;;;GAIG;AACH;IAk8BI;;;;;;OAMG;IACH,6DAFY,SAAS,CAKpB;IAED;;;;;;OAMG;IACH,sDAFY,SAAS,CAKpB;IAED;;;;;;OAMG;IACH,uDAFY,SAAS,CAKpB;IAED;;;;;;OAMG;IACH,uDAFY,SAAS,CAKpB;IAED;;;;;;OAMG;IACH,qDAFY,SAAS,CAKpB;IAED;;;;;;OAMG;IACH,sDAFY,SAAS,CAKpB;IAED;;;;;;OAMG;IACH,sDAFY,SAAS,CAKpB;IAED;;;;;;OAMG;IACH,wDAFY,SAAS,CAKpB;IAED;;;;;;OAMG;IACH,wDAFY,SAAS,CAKpB;IA3iCD;;;;;;;OAOG;IACH,mBANW,UAAU,MAAM,CAAC,GAAC,MAAM,EAAE,GAAC,iBAAiB,GAAC,UAAU,GAAC,WAAW,GAAC,WAAW,GAAC,SAAS,GAAC,UAAU,GAAC,UAAU,GAAC,YAAY,GAAC,YAAY,aACzI,MAAM,UACN,MAAM,WACN,MAAM,EAmDhB;IA7BG;;;OAGG;IACH,cAAkB;IAElB;;;OAGG;IACH,eAAoB;IAEpB;;;OAGG;IACH,iBAAwB;IAExB;;;OAGG;IACH,MAFU,MAAM,EAAE,GAAC,iBAAiB,GAAC,UAAU,GAAC,WAAW,GAAC,WAAW,GAAC,SAAS,GAAC,UAAU,GAAC,UAAU,GAAC,YAAY,GAAC,YAAY,CAEjH;IAEhB;;;OAGG;IACH,SAFU,MAAM,CAEA;IAGpB;;;;;;;OAOG;IACH,OALW,MAAM,KACN,MAAM,UACN,qCAA+B,GAC7B,MAAM,CAIlB;IAED;;;;;OAKG;IACH,sBAJW,MAAM,KACN,MAAM,UACN,MAAM,EAAE,QAQlB;IAED;;;;;;OAMG;IACH,6BALW,MAAM,KACN,MAAM,WACN,MAAM,GACJ,MAAM,CAOlB;IAED;;;;;;;OAOG;IACH,2BALW,MAAM,KACN,MAAM,WACN,MAAM,GACJ,MAAM,CA2DlB;IAED;;;;;OAKG;IACH,mBAJW,MAAM,KACN,MAAM,UACN,MAAM,EAAE,QAQlB;IAED;;;;;;OAMG;IACH,iBALW,MAAM,KACN,MAAM,UACN,MAAM,EAAE,GAAC,YAAY,GAAC,YAAY,iBAClC,MAAM,QAUhB;IAED;;;;;;OAMG;IACH,0BALW,MAAM,KACN,MAAM,WACN,MAAM,GACJ,MAAM,CAOlB;IAED;;;;;;;OAOG;IACH,wBALW,MAAM,KACN,MAAM,WACN,MAAM,GACJ,MAAM,CAgFlB;IAED;;;;;;OAMG;IACH,oBALW,MAAM,KACN,MAAM,UACN,MAAM,EAAE,GAAC,YAAY,kBACrB,MAAM,QAUhB;IAED;;;;;;OAMG;IACH,kBALW,MAAM,KACN,MAAM,UACN,MAAM,EAAE,GAAC,YAAY,GAAC,YAAY,kBAClC,MAAM,QAWhB;IAED;;;;;;OAMG;IACH,2BALW,MAAM,KACN,MAAM,WACN,MAAM,GACL,MAAM,CAOjB;IAED;;;;;;OAMG;IACH,yBALW,MAAM,KACN,MAAM,WACN,MAAM,GACJ,MAAM,CAiFlB;IAED;;;;;OAKG;IACH,mBAJW,MAAM,KACN,MAAM,UACN,MAAM,EAAE,GAAC,UAAU,MAAM,CAAC,QAUpC;IAED;;;;;;OAMG;IACH,eALW,MAAM,KACN,MAAM,WACN,MAAM,GACJ,MAAM,CAalB;IAED;;;;;OAKG;IACH,QAJW,MAAM,KACN,MAAM,UACN,MAAM,EAAE,QAalB;IAED;;;;;OAKG;IACH,SAJW,MAAM,KACN,MAAM,QACN,MAAM,EAAE,GAAC,UAAU,MAAM,CAAC,QAapC;IAED;;;;;;OAMG;IACH,UALW,MAAM,KACN,MAAM,WACN,2BAAuB,OAajC;IAED;;;;;OAKG;IACH,eAJW,MAAM,KACN,MAAM,GACJ,MAAM,CAIlB;IAED;;;;OAIG;IACH,mBAHW,MAAM,yBAUhB;IAED;;;;;;;;;OASG;IACH,aARW,SAAS,qHAoDnB;IAGD;;;;;;;OAOG;IACH,oEA8BC;IAED;;;;OAIG;IACH,2BAHW,MAAM,SACN,MAAM,QAYhB;IAED;;;;;;;OAOG;IACH,iEAFW,aAAc,QAqCxB;IAED;;;;;;OAMG;IACH,gBALW,MAAM,KACN,MAAM,WACN,MAAM,SACN,MAAM,QAqBhB;IAED;;;;;OAKG;IACH,OAJW,MAAM,KACN,MAAM,SACN,MAAM,EAAE,GAAC,YAAY,QAe/B;IAED;;;;;;;OAOG;IACH,wBALW,MAAM,WACN,MAAM,UACN,MAAM,sBAyBhB;IAED;;;;;OAKG;IACH,UAJW,MAAM,KACN,MAAM,iBACN,OAAO,QAyDjB;IAED;;;OAGG;IACH,mBAFY,MAAM,CAYjB;IAED;;;;OAIG;IACH,cAHW,SAAS,GACR,OAAO,CAYlB;IAED;;;OAGG;IACH,QAFY,MAAM,CAYjB;IAGD;;OAEG;IACH,SAFa,SAAS,CAerB;IAED;;;;;;MAUC;IAED;;;;;;aAwBC;IAgHL;;;OAGG;IACH,sBAFU,OAAO,CAEc;CAN9B;;kBAUS,MAAM"}
|
|
@@ -3,17 +3,19 @@ import { Base64 } from "../../../../core/binary/Base64.js";
|
|
|
3
3
|
import {
|
|
4
4
|
compute_typed_array_constructor_from_data_type
|
|
5
5
|
} from "../../../../core/binary/type/DataType2TypedArrayConstructorMapping.js";
|
|
6
|
+
import { computeStridedIntegerArrayHash } from "../../../../core/collection/array/computeStridedIntegerArrayHash.js";
|
|
6
7
|
import {
|
|
7
8
|
compute_binary_data_type_from_typed_array
|
|
8
9
|
} from "../../../../core/collection/array/typed/compute_binary_data_type_from_typed_array.js";
|
|
9
10
|
import { is_typed_array_equals } from "../../../../core/collection/array/typed/is_typed_array_equals.js";
|
|
11
|
+
import {
|
|
12
|
+
typedArrayConstructorByInstance
|
|
13
|
+
} from "../../../../core/collection/array/typed/typedArrayConstructorByInstance.js";
|
|
10
14
|
import { clamp } from "../../../../core/math/clamp.js";
|
|
11
15
|
import { lerp } from "../../../../core/math/lerp.js";
|
|
12
16
|
import { max2 } from "../../../../core/math/max2.js";
|
|
13
17
|
import { min2 } from "../../../../core/math/min2.js";
|
|
14
18
|
import { interpolate_bicubic } from "../../../../core/math/spline/interpolate_bicubic.js";
|
|
15
|
-
import { computeStridedIntegerArrayHash } from "../../../../core/primitives/array/computeStridedIntegerArrayHash.js";
|
|
16
|
-
import { typedArrayConstructorByInstance } from "./typedArrayConstructorByInstance.js";
|
|
17
19
|
|
|
18
20
|
/**
|
|
19
21
|
* Data Texture class, providing an abstraction around 2d numerical arrays, mostly for sampling purposes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sampler2d_multiply_vector.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/texture/sampler/sampler2d_multiply_vector.js"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,uFAFW,MAAM,EAAE,QAkBlB"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* @param {Sampler2D} input
|
|
5
5
|
* @param {number[]} vector
|
|
6
6
|
*/
|
|
7
|
-
export function
|
|
7
|
+
export function sampler2d_multiply_vector(output, input, vector) {
|
|
8
8
|
|
|
9
9
|
const pixel_count = input.width * input.height;
|
|
10
10
|
const item_size = input.itemSize;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sampler2d_to_float32_texture.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/texture/sampler/sampler2d_to_float32_texture.js"],"names":[],"mappings":"AAMA;;;;GAIG;AACH,kEAFa,WAAW,CA2BvB;4BApCwF,OAAO"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { ClampToEdgeWrapping, DataTexture, FloatType, LinearFilter, NearestFilter } from "three";
|
|
2
2
|
import { assert } from "../../../../core/assert.js";
|
|
3
|
+
import { BinaryDataType } from "../../../../core/binary/type/BinaryDataType.js";
|
|
3
4
|
import { channelCountToThreeTextureFormat } from "../channelCountToThreeTextureFormat.js";
|
|
4
5
|
import { computeThreeTextureInternalFormatFromDataType } from "../computeThreeTextureInternalFormatFromDataType.js";
|
|
5
|
-
import { BinaryDataType } from "../../../../core/binary/type/BinaryDataType.js";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
*
|
|
9
9
|
* @param {Sampler2D} sampler
|
|
10
10
|
* @returns {DataTexture}
|
|
11
11
|
*/
|
|
12
|
-
export function
|
|
12
|
+
export function sampler2d_to_float32_texture(sampler) {
|
|
13
13
|
assert.ok(sampler.data instanceof Float32Array);
|
|
14
14
|
|
|
15
15
|
const width = sampler.width;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drawSamplerHTML.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/texture/sampler/util/drawSamplerHTML.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"drawSamplerHTML.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/texture/sampler/util/drawSamplerHTML.js"],"names":[],"mappings":"AAOA;;;;;;;;;GASG;AACH,4CARW,WAAW,WACX,SAAS,KACT,MAAM,KACN,MAAM,SACN,MAAM,UACN,MAAM,QACN,MAAM,QA6BhB;0BAxCyB,iBAAiB"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import {
|
|
2
|
+
typedArrayConstructorByInstance
|
|
3
|
+
} from "../../../../../core/collection/array/typed/typedArrayConstructorByInstance.js";
|
|
1
4
|
import { sampler2d_scale } from "../resize/sampler2d_scale.js";
|
|
2
5
|
import { Sampler2D } from "../Sampler2D.js";
|
|
3
6
|
import sampler2d_to_html_canvas from "../sampler2d_to_html_canvas.js";
|
|
4
|
-
import { typedArrayConstructorByInstance } from "../typedArrayConstructorByInstance.js";
|
|
5
7
|
|
|
6
8
|
/**
|
|
7
9
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GridObstacle.d.ts","sourceRoot":"","sources":["../../../../../src/engine/grid/obstacle/GridObstacle.js"],"names":[],"mappings":";AAMA;IA0NI,sCAMC;IA/ND,eAAW;IAEX;;;OAGG;IACH,eAFU,OAAO,CAEQ;IAEzB;;;;OAIG;IACH,UAHW,MAAM,KACN,MAAM,QAiChB;IAED;;;;;;OAMG;IACH,sBALW,MAAM,WACN,MAAM,qCAmChB;IAED;;;;;OAKG;IACH,aAJW,MAAM,KACN,MAAM,GACJ,MAAM,CAWlB;IAED;;;;;OAKG;IACH,cAJW,MAAM,KACN,MAAM,SACN,MAAM,QAShB;IAED;;;;;OAKG;IACH,iBAJW,MAAM,KACN,MAAM,GACJ,OAAO,CAYnB;IAED;;;;;;OAMG;IACH,mBALW,MAAM,KACN,MAAM,iBACN,MAAM,EAAE,GACN,OAAO,CAoDnB;IAED;;;MAKC;IAED;;;aAaC;IAUD;;;OAGG;IACH,QAFa,MAAM,CAOlB;IAED;;;;OAIG;IACH,cAHW,YAAY,GACV,OAAO,CAQnB;CACJ;;;;
|
|
1
|
+
{"version":3,"file":"GridObstacle.d.ts","sourceRoot":"","sources":["../../../../../src/engine/grid/obstacle/GridObstacle.js"],"names":[],"mappings":";AAMA;IA0NI,sCAMC;IA/ND,eAAW;IAEX;;;OAGG;IACH,eAFU,OAAO,CAEQ;IAEzB;;;;OAIG;IACH,UAHW,MAAM,KACN,MAAM,QAiChB;IAED;;;;;;OAMG;IACH,sBALW,MAAM,WACN,MAAM,qCAmChB;IAED;;;;;OAKG;IACH,aAJW,MAAM,KACN,MAAM,GACJ,MAAM,CAWlB;IAED;;;;;OAKG;IACH,cAJW,MAAM,KACN,MAAM,SACN,MAAM,QAShB;IAED;;;;;OAKG;IACH,iBAJW,MAAM,KACN,MAAM,GACJ,OAAO,CAYnB;IAED;;;;;;OAMG;IACH,mBALW,MAAM,KACN,MAAM,iBACN,MAAM,EAAE,GACN,OAAO,CAoDnB;IAED;;;MAKC;IAED;;;aAaC;IAUD;;;OAGG;IACH,QAFa,MAAM,CAOlB;IAED;;;;OAIG;IACH,cAHW,YAAY,GACV,OAAO,CAQnB;CACJ;;;;oBA3PmB,+BAA+B"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { assert } from "../../../core/assert.js";
|
|
2
2
|
import { combine_hash } from "../../../core/collection/array/combine_hash.js";
|
|
3
|
+
import { computeIntegerArrayHash } from "../../../core/collection/array/computeIntegerArrayHash.js";
|
|
3
4
|
import { isArrayEqualStrict } from "../../../core/collection/array/isArrayEqualStrict.js";
|
|
4
5
|
import Vector2 from '../../../core/geom/Vector2.js';
|
|
5
|
-
import { computeIntegerArrayHash } from "../../../core/primitives/array/computeIntegerArrayHash.js";
|
|
6
6
|
|
|
7
7
|
class GridObstacle {
|
|
8
8
|
data = [1];
|
|
@@ -2,13 +2,14 @@ import { v3_dot } from "../../core/geom/vec3/v3_dot.js";
|
|
|
2
2
|
import { solveQuadratic } from "../../core/math/solveQuadratic.js";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Given position of the source point, and target moving at a constant velocity, compute intercept.
|
|
6
|
+
* Simple example would be {@link target} being enemy running, and {@link source} being position of our archer, given that the arrow speed is {@link sourceSpeed}, where should the archer aim at in order to hit the moving target?
|
|
6
7
|
* @param {Vector3} result
|
|
7
8
|
* @param {Vector3} source
|
|
8
9
|
* @param {Vector3} target
|
|
9
10
|
* @param {Vector3} targetVelocity
|
|
10
11
|
* @param {number} sourceSpeed
|
|
11
|
-
* @return {boolean}
|
|
12
|
+
* @return {boolean} true iff there is at least oen real solution
|
|
12
13
|
*/
|
|
13
14
|
function computeInterceptPoint(result, source, target, targetVelocity, sourceSpeed) {
|
|
14
15
|
const d_ts_x = target.x - source.x;
|
|
@@ -30,15 +31,28 @@ function computeInterceptPoint(result, source, target, targetVelocity, sourceSpe
|
|
|
30
31
|
|
|
31
32
|
// Find smallest positive solution
|
|
32
33
|
if (root_count > 0) {
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
const root_0 = ts[0];
|
|
35
|
+
const root_1 = ts[1];
|
|
36
|
+
|
|
37
|
+
let t = Math.min(root_0, root_1);
|
|
38
|
+
|
|
39
|
+
if (t < 0) {
|
|
40
|
+
// one of the roots is negative, which would produce imaginary solution, so let's try to pick the other one
|
|
41
|
+
t = Math.max(root_0, root_1);
|
|
42
|
+
}
|
|
36
43
|
|
|
37
44
|
if (t > 0) {
|
|
38
|
-
|
|
45
|
+
|
|
46
|
+
result.copy(targetVelocity);
|
|
47
|
+
result.multiplyScalar(t);
|
|
48
|
+
result.add(target);
|
|
49
|
+
|
|
39
50
|
return true;
|
|
51
|
+
|
|
40
52
|
}
|
|
41
53
|
|
|
54
|
+
// if we got to this point, that means that both roots are imaginary, so there is no real solution
|
|
55
|
+
|
|
42
56
|
}
|
|
43
57
|
return false;
|
|
44
58
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MLS_MPM.d.ts","sourceRoot":"","sources":["../../../../../src/engine/physics/mls-mpm/MLS_MPM.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MLS_MPM.d.ts","sourceRoot":"","sources":["../../../../../src/engine/physics/mls-mpm/MLS_MPM.js"],"names":[],"mappings":"AAwHA;IAGQ,iBAAmB;IAGnB;;;;;OAKG;IACH,MAFU,YAAY,CAEiB;IAI3C;;;OAGG;IACH,YAFW,MAAM,QAwVhB;IAED,0CAeC;CACJ"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { m2_multiply } from "../../../core/geom/mat2/m2_multiply.js";
|
|
3
|
-
import { m2_multiply_transposed } from "../../../core/geom/mat2/m2_multiply_transposed.js";
|
|
1
|
+
import { m2_add } from "../../../core/geom/mat2/m2_add.js";
|
|
4
2
|
import { m2_determinant } from "../../../core/geom/mat2/m2_determinant.js";
|
|
3
|
+
import { m2_multiply } from "../../../core/geom/mat2/m2_multiply.js";
|
|
5
4
|
import { m2_multiply_scalar } from "../../../core/geom/mat2/m2_multiply_scalar.js";
|
|
6
|
-
import {
|
|
5
|
+
import { m2_multiply_transposed } from "../../../core/geom/mat2/m2_multiply_transposed.js";
|
|
7
6
|
import { m2_sub_transposed } from "../../../core/geom/mat2/m2_sub_transposed.js";
|
|
7
|
+
import { clamp } from "../../../core/math/clamp.js";
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -14,22 +14,16 @@ import { m2_sub_transposed } from "../../../core/geom/mat2/m2_sub_transposed.js"
|
|
|
14
14
|
* @param {number[]} m
|
|
15
15
|
*/
|
|
16
16
|
function polar_decomp(R, S, m) {
|
|
17
|
-
|
|
18
|
-
const y = m[2] - m[1];
|
|
19
|
-
|
|
20
|
-
const scale = 1.0 / Math.sqrt(x * x + y * y);
|
|
21
|
-
|
|
22
|
-
const c = x * scale;
|
|
23
|
-
const s = y * scale;
|
|
24
|
-
|
|
25
|
-
R[0] = c;
|
|
26
|
-
R[1] = s;
|
|
27
|
-
R[2] = -s;
|
|
28
|
-
R[3] = c;
|
|
17
|
+
polar_decomp_noS(R, m);
|
|
29
18
|
|
|
30
19
|
m2_multiply(S, m, R);
|
|
31
20
|
}
|
|
32
21
|
|
|
22
|
+
/**
|
|
23
|
+
*
|
|
24
|
+
* @param {number[]} R
|
|
25
|
+
* @param {number[]} m
|
|
26
|
+
*/
|
|
33
27
|
function polar_decomp_noS(R, m) { // transposed as in taichi
|
|
34
28
|
const x = m[0] + m[3];
|
|
35
29
|
const y = m[2] - m[1];
|
|
@@ -119,7 +113,10 @@ function svd(U, S, V, sig, m) { // transposed as in taichi
|
|
|
119
113
|
|
|
120
114
|
const dimensions = 2;
|
|
121
115
|
|
|
122
|
-
const m2_indentity = [
|
|
116
|
+
const m2_indentity = [
|
|
117
|
+
1, 0,
|
|
118
|
+
0, 1
|
|
119
|
+
];
|
|
123
120
|
|
|
124
121
|
export class MLS_MPMSolver {
|
|
125
122
|
constructor() {
|
package/src/core/UUID.d.ts
DELETED
package/src/core/UUID.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"UUID.d.ts","sourceRoot":"","sources":["../../../src/core/UUID.js"],"names":[],"mappings":";;;;AAEA;;;;;GAKG;AACH,yBAFa,MAAM,CAIlB"}
|
package/src/core/UUID.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { UUID } from "../engine/ecs/guid/UUID.js";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Generates a variant 4 fully random UUID in string format
|
|
5
|
-
* @deprecated
|
|
6
|
-
* NOTE: Prefer to use UUID component class instead as that implementation is more robust and has better entropy when it comes to randomness
|
|
7
|
-
* @returns {string}
|
|
8
|
-
*/
|
|
9
|
-
function uuid() {
|
|
10
|
-
return UUID.string();
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* @deprecated
|
|
15
|
-
*/
|
|
16
|
-
export default {
|
|
17
|
-
/**
|
|
18
|
-
* @deprecated
|
|
19
|
-
*/
|
|
20
|
-
generate: uuid
|
|
21
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"compute_triangle_area_2d.d.ts","sourceRoot":"","sources":["../../../../../src/core/geom/2d/compute_triangle_area_2d.js"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,6CARW,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,GACJ,MAAM,CAclB"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
* @param {number} ax
|
|
4
|
-
* @param {number} ay
|
|
5
|
-
* @param {number} bx
|
|
6
|
-
* @param {number} by
|
|
7
|
-
* @param {number} cx
|
|
8
|
-
* @param {number} cy
|
|
9
|
-
* @returns {number}
|
|
10
|
-
*/
|
|
11
|
-
export function orientation3(ax: number, ay: number, bx: number, by: number, cx: number, cy: number): number;
|
|
12
|
-
//# sourceMappingURL=orientation3.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"orientation3.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/2d/convex-hull/orientation3.js"],"names":[],"mappings":"AA+bA;;;;;;;;;GASG;AACH,iCARW,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,GACJ,MAAM,CAiClB"}
|