@woosh/meep-engine 2.102.0 → 2.104.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.
Files changed (71) hide show
  1. package/build/meep.cjs +57 -40
  2. package/build/meep.min.js +1 -1
  3. package/build/meep.module.js +57 -40
  4. package/package.json +1 -1
  5. package/src/core/geom/2d/circle/Circle.d.ts +0 -8
  6. package/src/core/geom/2d/circle/Circle.d.ts.map +1 -1
  7. package/src/core/geom/2d/circle/Circle.js +85 -85
  8. package/src/core/geom/ConicRay.d.ts +3 -1
  9. package/src/core/geom/ConicRay.d.ts.map +1 -1
  10. package/src/core/geom/ConicRay.js +7 -5
  11. package/src/core/geom/Vector1.d.ts.map +1 -1
  12. package/src/core/geom/Vector1.js +3 -0
  13. package/src/core/geom/Vector2.d.ts.map +1 -1
  14. package/src/core/geom/Vector2.js +6 -3
  15. package/src/core/geom/Vector3.js +1 -1
  16. package/src/core/geom/vec3/v3_angle_cos_between.spec.d.ts +2 -0
  17. package/src/core/geom/vec3/v3_angle_cos_between.spec.d.ts.map +1 -0
  18. package/src/core/geom/vec3/v3_angle_cos_between.spec.js +124 -0
  19. package/src/core/geom/vec3/v3_distance_above_plane.d.ts +13 -4
  20. package/src/core/geom/vec3/v3_distance_sqr.d.ts +12 -1
  21. package/src/core/geom/vec3/v3_length.d.ts +9 -1
  22. package/src/core/lang/reactive/compileReactiveExpression.d.ts.map +1 -1
  23. package/src/core/lang/reactive/compileReactiveExpression.js +1 -3
  24. package/src/core/lang/reactive/pegjs/ReactivePegCompiler.d.ts.map +1 -1
  25. package/src/core/lang/reactive/pegjs/ReactivePegCompiler.js +11 -5
  26. package/src/core/math/PI_RECIPROCAL.d.ts +6 -0
  27. package/src/core/math/PI_RECIPROCAL.d.ts.map +1 -0
  28. package/src/core/math/PI_RECIPROCAL.js +5 -0
  29. package/src/core/math/newton_solver_1d.d.ts +4 -3
  30. package/src/core/math/newton_solver_1d.d.ts.map +1 -1
  31. package/src/core/math/newton_solver_1d.js +4 -3
  32. package/src/core/math/physics/brdf/D_GGX.d.ts.map +1 -1
  33. package/src/core/math/physics/brdf/D_GGX.js +4 -1
  34. package/src/core/math/physics/brdf/brdf_burley.d.ts.map +1 -1
  35. package/src/core/math/physics/brdf/brdf_burley.js +5 -1
  36. package/src/core/math/physics/irradiance/interpolate_irradiance_smith.d.ts.map +1 -1
  37. package/src/core/math/physics/irradiance/interpolate_irradiance_smith.js +3 -3
  38. package/src/core/primitives/strings/insert_after.spec.d.ts +2 -0
  39. package/src/core/primitives/strings/insert_after.spec.d.ts.map +1 -0
  40. package/src/core/primitives/strings/insert_after.spec.js +16 -0
  41. package/src/core/primitives/strings/insert_before.spec.d.ts +2 -0
  42. package/src/core/primitives/strings/insert_before.spec.d.ts.map +1 -0
  43. package/src/core/primitives/strings/insert_before.spec.js +16 -0
  44. package/src/core/process/executor/ConcurrentExecutor.d.ts.map +1 -1
  45. package/src/core/process/executor/ConcurrentExecutor.js +10 -4
  46. package/src/core/time/current_time_in_seconds.d.ts.map +1 -1
  47. package/src/core/time/current_time_in_seconds.js +1 -1
  48. package/src/engine/animation/curve/compute_curve_aabb.d.ts.map +1 -1
  49. package/src/engine/animation/curve/compute_curve_aabb.js +19 -16
  50. package/src/engine/ecs/fow/FogOfWar.d.ts.map +1 -1
  51. package/src/engine/ecs/fow/FogOfWar.js +10 -10
  52. package/src/engine/ecs/fow/FogOfWar.spec.js +5 -6
  53. package/src/engine/google/loadGTAG.d.ts +7 -0
  54. package/src/engine/google/loadGTAG.d.ts.map +1 -0
  55. package/src/engine/google/loadGTAG.js +32 -0
  56. package/src/engine/graphics/texture/sampler/distance/computeUnsignedDistanceField.d.ts.map +1 -1
  57. package/src/engine/graphics/texture/sampler/distance/computeUnsignedDistanceField.js +6 -1
  58. package/src/engine/graphics/texture/sampler/distance/computeUnsignedDistanceField_Chamfer.d.ts.map +1 -1
  59. package/src/engine/graphics/texture/sampler/distance/computeUnsignedDistanceField_Chamfer.js +17 -1
  60. package/src/engine/input/devices/PointerDevice.d.ts.map +1 -1
  61. package/src/engine/input/devices/PointerDevice.js +15 -5
  62. package/src/engine/metrics/GoogleAnalyticsMetrics.d.ts +2 -1
  63. package/src/engine/metrics/GoogleAnalyticsMetrics.d.ts.map +1 -1
  64. package/src/engine/metrics/GoogleAnalyticsMetrics.js +4 -39
  65. package/src/engine/notify/NotificationLog.d.ts +1 -2
  66. package/src/engine/notify/NotificationLog.d.ts.map +1 -1
  67. package/src/engine/notify/NotificationLog.js +33 -32
  68. package/src/core/lang/reactive/nearley/Reactive.ne +0 -87
  69. package/src/engine/compression/CompressionService.d.ts +0 -19
  70. package/src/engine/compression/CompressionService.d.ts.map +0 -1
  71. package/src/engine/compression/CompressionService.js +0 -144
@@ -0,0 +1,124 @@
1
+ import { v3_angle_cos_between } from "./v3_angle_cos_between.js";
2
+
3
+ function validate_result(value) {
4
+ expect(typeof value).toBe("number");
5
+ expect(value).not.toBeNaN();
6
+ expect(value).toBeGreaterThanOrEqual(-1);
7
+ expect(value).toBeLessThanOrEqual(1);
8
+ }
9
+
10
+ test("zero-length vectors produce valid results", () => {
11
+
12
+ validate_result(v3_angle_cos_between(
13
+ 0, 0, 0,
14
+ 0, 0, 0
15
+ ));
16
+
17
+ validate_result(v3_angle_cos_between(
18
+ 1, 0, 0,
19
+ 0, 0, 0
20
+ ));
21
+
22
+ validate_result(v3_angle_cos_between(
23
+ 0, 1, 0,
24
+ 0, 0, 0
25
+ ));
26
+
27
+ validate_result(v3_angle_cos_between(
28
+ 0, 0, 1,
29
+ 0, 0, 0
30
+ ));
31
+
32
+ validate_result(v3_angle_cos_between(
33
+ 0, 0, 0,
34
+ 1, 0, 0
35
+ ));
36
+
37
+ validate_result(v3_angle_cos_between(
38
+ 0, 0, 0,
39
+ 0, 1, 0
40
+ ));
41
+
42
+ validate_result(v3_angle_cos_between(
43
+ 0, 0, 0,
44
+ 0, 0, 1
45
+ ));
46
+
47
+ });
48
+ test("Right angles", () => {
49
+
50
+ expect(v3_angle_cos_between(
51
+ 1, 0, 0,
52
+ 0, 1, 0
53
+ )).toBeCloseTo(0);
54
+
55
+ expect(v3_angle_cos_between(
56
+ 1, 0, 0,
57
+ 0, 0, 1
58
+ )).toBeCloseTo(0);
59
+
60
+ expect(v3_angle_cos_between(
61
+ -1, 0, 0,
62
+ 0, 1, 0
63
+ )).toBeCloseTo(0);
64
+
65
+ expect(v3_angle_cos_between(
66
+ -1, 0, 0,
67
+ 0, 0, 1
68
+ )).toBeCloseTo(0);
69
+
70
+ expect(v3_angle_cos_between(
71
+ 0, 1, 0,
72
+ 1, 0, 0
73
+ )).toBeCloseTo(0);
74
+
75
+ expect(v3_angle_cos_between(
76
+ 0, 1, 0,
77
+ 0, 0, 1
78
+ )).toBeCloseTo(0);
79
+
80
+ expect(v3_angle_cos_between(
81
+ 0, -1, 0,
82
+ 1, 0, 0
83
+ )).toBeCloseTo(0);
84
+
85
+ expect(v3_angle_cos_between(
86
+ 0, -1, 0,
87
+ 0, 0, 1
88
+ )).toBeCloseTo(0);
89
+
90
+ expect(v3_angle_cos_between(
91
+ 0, 0, 1,
92
+ 1, 0, 0
93
+ )).toBeCloseTo(0);
94
+
95
+ expect(v3_angle_cos_between(
96
+ 0, 0, 1,
97
+ 0, 1, 0
98
+ )).toBeCloseTo(0);
99
+
100
+ expect(v3_angle_cos_between(
101
+ 0, 0, -1,
102
+ 1, 0, 0
103
+ )).toBeCloseTo(0);
104
+
105
+ expect(v3_angle_cos_between(
106
+ 0, 0, -1,
107
+ 0, 1, 0
108
+ )).toBeCloseTo(0);
109
+
110
+ });
111
+
112
+ test("non-uniform vectors", () => {
113
+
114
+ expect(v3_angle_cos_between(
115
+ 3, 0, 0,
116
+ 0, 7, 0
117
+ )).toBeCloseTo(0);
118
+
119
+ expect(v3_angle_cos_between(
120
+ -3, 0, 0,
121
+ 0, 7, 0
122
+ )).toBeCloseTo(0);
123
+
124
+ });
@@ -1,4 +1,13 @@
1
- export declare function v3_distance_above_plane(
2
- x: number, y: number, z: number,
3
- normalX: number, normalY: number, normalZ: number, planeConstant: number
4
- ): number
1
+ /**
2
+ * Orthogonal distance of a point to a plane, the distance is positive when the point lies above the plane and negative when the point is below
3
+ * @param {number} x
4
+ * @param {number} y
5
+ * @param {number} z
6
+ * @param {number} normalX
7
+ * @param {number} normalY
8
+ * @param {number} normalZ
9
+ * @param {number} planeConstant
10
+ * @returns {number}
11
+ */
12
+ export function v3_distance_above_plane(x: number, y: number, z: number, normalX: number, normalY: number, normalZ: number, planeConstant: number): number;
13
+ //# sourceMappingURL=v3_distance_above_plane.d.ts.map
@@ -1 +1,12 @@
1
- export function v3_distance_sqr(x0: number, y0: number, z0: number, x1: number, y1: number, z1: number): number
1
+ /**
2
+ *
3
+ * @param {number} x0
4
+ * @param {number} y0
5
+ * @param {number} z0
6
+ * @param {number} x1
7
+ * @param {number} y1
8
+ * @param {number} z1
9
+ * @returns {number}
10
+ */
11
+ export function v3_distance_sqr(x0: number, y0: number, z0: number, x1: number, y1: number, z1: number): number;
12
+ //# sourceMappingURL=v3_distance_sqr.d.ts.map
@@ -1 +1,9 @@
1
- export declare function v3_length(x: number, y: number, z: number): number
1
+ /**
2
+ *
3
+ * @param {number} x
4
+ * @param {number} y
5
+ * @param {number} z
6
+ * @returns {number}
7
+ */
8
+ export function v3_length(x: number, y: number, z: number): number;
9
+ //# sourceMappingURL=v3_length.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"compileReactiveExpression.d.ts","sourceRoot":"","sources":["../../../../../src/core/lang/reactive/compileReactiveExpression.js"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,4EAQC"}
1
+ {"version":3,"file":"compileReactiveExpression.d.ts","sourceRoot":"","sources":["../../../../../src/core/lang/reactive/compileReactiveExpression.js"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,4EAMC"}
@@ -12,7 +12,5 @@ export function compileReactiveExpression(code) {
12
12
 
13
13
  const parseTree = ReactivePegParser.INSTANCE.parse(code);
14
14
 
15
- const expression = ReactivePegCompiler.compile(parseTree);
16
-
17
- return expression;
15
+ return ReactivePegCompiler.compile(parseTree);
18
16
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ReactivePegCompiler.d.ts","sourceRoot":"","sources":["../../../../../../src/core/lang/reactive/pegjs/ReactivePegCompiler.js"],"names":[],"mappings":"AAqHA;IAKI;;;;OAIG;IACH,oDAEC;CACJ"}
1
+ {"version":3,"file":"ReactivePegCompiler.d.ts","sourceRoot":"","sources":["../../../../../../src/core/lang/reactive/pegjs/ReactivePegCompiler.js"],"names":[],"mappings":"AA8HA;IAEI;;;;OAIG;IACH,oDAEC;CACJ"}
@@ -1,3 +1,4 @@
1
+ import { assert } from "../../../assert.js";
1
2
  import { ReactiveAdd } from "../../../model/reactive/model/arithmetic/ReactiveAdd.js";
2
3
  import { ReactiveDivide } from "../../../model/reactive/model/arithmetic/ReactiveDivide.js";
3
4
  import { ReactiveMultiply } from "../../../model/reactive/model/arithmetic/ReactiveMultiply.js";
@@ -110,16 +111,21 @@ const Compiler_Types = {
110
111
  * @param {{type:string}} node
111
112
  */
112
113
  function compile(node) {
113
- const c = Compiler_Types[node.type];
114
+ const node_type = node.type;
114
115
 
115
- return c(node);
116
- }
116
+ assert.isString(node_type, 'node.type');
117
117
 
118
- export class ReactivePegCompiler {
119
- constructor() {
118
+ const type_compiler = Compiler_Types[node_type];
120
119
 
120
+ if (type_compiler === undefined) {
121
+ throw new Error(`Unsupported node type '${node_type}'`);
121
122
  }
122
123
 
124
+ return type_compiler(node);
125
+ }
126
+
127
+ export class ReactivePegCompiler {
128
+
123
129
  /**
124
130
  *
125
131
  * @param {Object} syntaxTree
@@ -0,0 +1,6 @@
1
+ /**
2
+ * 1 / pi
3
+ * @type {number}
4
+ */
5
+ export const PI_RECIPROCAL: number;
6
+ //# sourceMappingURL=PI_RECIPROCAL.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PI_RECIPROCAL.d.ts","sourceRoot":"","sources":["../../../../src/core/math/PI_RECIPROCAL.js"],"names":[],"mappings":"AAAA;;;GAGG;AACH,4BAFU,MAAM,CAEyB"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * 1 / pi
3
+ * @type {number}
4
+ */
5
+ export const PI_RECIPROCAL = 1 / Math.PI;
@@ -1,10 +1,11 @@
1
1
  /**
2
- * Newtonian solver, works by moving along the curve in the direction of gradient
2
+ * Newtonian solver, works by moving along the curve in the direction of gradient.
3
+ * Solving for f(x) = 0
3
4
  * @param {function(number):number} f Function for which we are trying to solve
4
- * @param {number} xStart
5
+ * @param {number} xStart initial guess for input value
5
6
  * @param {number} [max_steps]
6
7
  * @param {number} [eps]
7
- * @returns {number}
8
+ * @returns {number} value for X where function is close to 0 or exactly at 0
8
9
  */
9
10
  export function newton_solver_1d(f: (arg0: number) => number, xStart: number, max_steps?: number, eps?: number): number;
10
11
  //# sourceMappingURL=newton_solver_1d.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"newton_solver_1d.d.ts","sourceRoot":"","sources":["../../../../src/core/math/newton_solver_1d.js"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,2CANoB,MAAM,KAAE,MAAM,UACvB,MAAM,cACN,MAAM,QACN,MAAM,GACJ,MAAM,CAuBlB"}
1
+ {"version":3,"file":"newton_solver_1d.d.ts","sourceRoot":"","sources":["../../../../src/core/math/newton_solver_1d.js"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,2CANoB,MAAM,KAAE,MAAM,UACvB,MAAM,cACN,MAAM,QACN,MAAM,GACJ,MAAM,CAuBlB"}
@@ -1,10 +1,11 @@
1
1
  /**
2
- * Newtonian solver, works by moving along the curve in the direction of gradient
2
+ * Newtonian solver, works by moving along the curve in the direction of gradient.
3
+ * Solving for f(x) = 0
3
4
  * @param {function(number):number} f Function for which we are trying to solve
4
- * @param {number} xStart
5
+ * @param {number} xStart initial guess for input value
5
6
  * @param {number} [max_steps]
6
7
  * @param {number} [eps]
7
- * @returns {number}
8
+ * @returns {number} value for X where function is close to 0 or exactly at 0
8
9
  */
9
10
  export function newton_solver_1d(
10
11
  f,
@@ -1 +1 @@
1
- {"version":3,"file":"D_GGX.d.ts","sourceRoot":"","sources":["../../../../../../src/core/math/physics/brdf/D_GGX.js"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,2BAJW,MAAM,aACN,MAAM,GACJ,MAAM,CAOlB"}
1
+ {"version":3,"file":"D_GGX.d.ts","sourceRoot":"","sources":["../../../../../../src/core/math/physics/brdf/D_GGX.js"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,2BAJW,MAAM,aACN,MAAM,GACJ,MAAM,CAQlB"}
@@ -1,3 +1,5 @@
1
+ import { PI_RECIPROCAL } from "../../PI_RECIPROCAL.js";
2
+
1
3
  /**
2
4
  * GGX diffuse distribution function
3
5
  * @see https://google.github.io/filament/Filament.md.html#listing_diffusebrdf
@@ -7,7 +9,8 @@
7
9
  */
8
10
  export function D_GGX(NoH, roughness) {
9
11
  const a = NoH * roughness;
12
+
10
13
  const k = roughness / (1 - NoH * NoH + a * a);
11
14
 
12
- return k * k * (1 / Math.PI);
15
+ return k * k * PI_RECIPROCAL;
13
16
  }
@@ -1 +1 @@
1
- {"version":3,"file":"brdf_burley.d.ts","sourceRoot":"","sources":["../../../../../../src/core/math/physics/brdf/brdf_burley.js"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;GAaG;AACH,iCANW,MAAM,OACN,MAAM,OACN,MAAM,aACN,MAAM,GACJ,MAAM,CAOlB"}
1
+ {"version":3,"file":"brdf_burley.d.ts","sourceRoot":"","sources":["../../../../../../src/core/math/physics/brdf/brdf_burley.js"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;GAaG;AACH,iCANW,MAAM,OACN,MAAM,OACN,MAAM,aACN,MAAM,GACJ,MAAM,CASlB"}
@@ -1,3 +1,5 @@
1
+ import { PI_RECIPROCAL } from "../../PI_RECIPROCAL.js";
2
+
1
3
  function F_Schlick(u, f0, f90) {
2
4
 
3
5
  return f0 + (f90 - f0) * Math.pow(1.0 - u, 5.0);
@@ -19,7 +21,9 @@ function F_Schlick(u, f0, f90) {
19
21
  */
20
22
  export function brdf_burley(NoV, NoL, LoH, roughness) {
21
23
  const f90 = 0.5 + 2.0 * roughness * LoH * LoH;
24
+
22
25
  const lightScatter = F_Schlick(NoL, 1.0, f90);
23
26
  const viewScatter = F_Schlick(NoV, 1.0, f90);
24
- return lightScatter * viewScatter * (1.0 / Math.PI);
27
+
28
+ return lightScatter * viewScatter * PI_RECIPROCAL;
25
29
  }
@@ -1 +1 @@
1
- {"version":3,"file":"interpolate_irradiance_smith.d.ts","sourceRoot":"","sources":["../../../../../../src/core/math/physics/irradiance/interpolate_irradiance_smith.js"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,uDALW,MAAM,OACN,MAAM,OACN,MAAM,GACL,MAAM,CA+BjB"}
1
+ {"version":3,"file":"interpolate_irradiance_smith.d.ts","sourceRoot":"","sources":["../../../../../../src/core/math/physics/irradiance/interpolate_irradiance_smith.js"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AACH,uDALW,MAAM,OACN,MAAM,OACN,MAAM,GACL,MAAM,CA4BjB"}
@@ -1,3 +1,6 @@
1
+ // const k = Math.sqrt( (2*0.1*0.1)/Math.PI);
2
+ const k = 0.07978845608028655;
3
+
1
4
  /**
2
5
  * Using Smith inverse-square bounded approximation
3
6
  * @see "An Inexpensive BRDF Model for Physically-based Rendering" by Christophe Schlick
@@ -24,14 +27,11 @@ export function interpolate_irradiance_smith(distance, min, max) {
24
27
  where G is the fall-off
25
28
  */
26
29
 
27
- // const k = Math.sqrt( (2*0.1*0.1)/Math.PI);
28
30
 
29
31
  const range = max - min;
30
32
 
31
33
  const v = (distance - min) / range;
32
34
 
33
- const k = 0.07978845608028655;
34
-
35
35
  const fall_off = v / (v - k * v + k);
36
36
 
37
37
  return 1 - fall_off;
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=insert_after.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"insert_after.spec.d.ts","sourceRoot":"","sources":["../../../../../src/core/primitives/strings/insert_after.spec.js"],"names":[],"mappings":""}
@@ -0,0 +1,16 @@
1
+ import { insert_after } from "./insert_after.js";
2
+
3
+ test("basics", () => {
4
+
5
+ expect(insert_after("aba", "b", "c")).toBe("abca");
6
+ expect(insert_after("a", "a", "c")).toBe("ac");
7
+ expect(insert_after("ba", "a", "c")).toBe("bac");
8
+
9
+ });
10
+
11
+ test("non-occurrence", () => {
12
+
13
+ expect(insert_after("", "a", "c")).toBe("");
14
+ expect(insert_after("b", "a", "c")).toBe("b");
15
+
16
+ });
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=insert_before.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"insert_before.spec.d.ts","sourceRoot":"","sources":["../../../../../src/core/primitives/strings/insert_before.spec.js"],"names":[],"mappings":""}
@@ -0,0 +1,16 @@
1
+ import { insert_before } from "./insert_before.js";
2
+
3
+ test("basics", () => {
4
+
5
+ expect(insert_before("aba", "b", "c")).toBe("acba");
6
+ expect(insert_before("a", "a", "c")).toBe("ca");
7
+ expect(insert_before("ba", "a", "c")).toBe("bca");
8
+
9
+ });
10
+
11
+ test("non-occurrence", () => {
12
+
13
+ expect(insert_before("", "a", "c")).toBe("");
14
+ expect(insert_before("b", "a", "c")).toBe("b");
15
+
16
+ });
@@ -1 +1 @@
1
- {"version":3,"file":"ConcurrentExecutor.d.ts","sourceRoot":"","sources":["../../../../../src/core/process/executor/ConcurrentExecutor.js"],"names":[],"mappings":";AAmBA;;GAEG;AACH;IAQI;;;;;OAKG;IACH,wBAJW,MAAM,aACN,MAAM,EAwChB;IApCG;;;OAGG;IACH,WAFU,MAAM,CAEU;IAC1B;;;OAGG;IACH,UAFU,MAAM,CAEQ;IAExB;;;OAGG;IACH,iBAFU,MAAM,CAES;IAEzB;;;OAGG;IACH,YAFU,MAAM,CAEI;IAEpB;;;;MAIC;IAED,cAAiB;IAEjB;;;OAGG;IACH,QAFU,MAAM,GAAC,gBAAgB,CAES;IAG9C;;;OAGG;IACH,qCAmEC;IAED;;;OAGG;IACH,oCAaC;IAED;;;;OAIG;IACH,wBAFY,OAAO,CAwBlB;IAED;;;OAGG;IACH,sBAGC;IAED;;;OAGG;IACH,eAFW,MAAM,QAMhB;IAED;;;;OAIG;IACH,kBAkCC;IAED;;OAEG;IACH,qBA8BC;IAED;;;OAGG;IACH,8BAUC;IA+KD;;;OAGG;IACH,aAQC;IAED,0BAMC;;CACJ;;;;mBAjfkB,+BAA+B;wBAqfxC,MAAM"}
1
+ {"version":3,"file":"ConcurrentExecutor.d.ts","sourceRoot":"","sources":["../../../../../src/core/process/executor/ConcurrentExecutor.js"],"names":[],"mappings":";AAmBA;;GAEG;AACH;IAaI;;;;;OAKG;IACH,wBAJW,MAAM,aACN,MAAM,EAwChB;IApCG;;;OAGG;IACH,WAFU,MAAM,CAEU;IAC1B;;;OAGG;IACH,UAFU,MAAM,CAEQ;IAExB;;;OAGG;IACH,iBAFU,MAAM,CAES;IAEzB;;;OAGG;IACH,YAFU,MAAM,CAEI;IAEpB;;;;MAIC;IAED,cAAiB;IAEjB;;;OAGG;IACH,QAFU,MAAM,GAAC,gBAAgB,CAES;IAG9C;;;OAGG;IACH,qCAmEC;IAED;;;OAGG;IACH,oCAaC;IAED;;;;OAIG;IACH,wBAFY,OAAO,CAwBlB;IAED;;;OAGG;IACH,sBAGC;IAED;;;OAGG;IACH,eAFW,MAAM,QAMhB;IAED;;;;OAIG;IACH,kBAkCC;IAED;;OAEG;IACH,qBA8BC;IAED;;;;OAIG;IACH,sBAFa,OAAO,CAYnB;IA+KD;;;OAGG;IACH,aAQC;IAED,0BAMC;;CACJ;;;;mBAvfkB,+BAA+B;wBA2fxC,MAAM"}
@@ -13,7 +13,7 @@ import TaskState from "../task/TaskState.js";
13
13
  * @param {TaskGroup|Task} t
14
14
  * @returns {boolean}
15
15
  */
16
- function isGroup(t) {
16
+ function isGroupTask(t) {
17
17
  return t.children instanceof Array;
18
18
  }
19
19
 
@@ -21,7 +21,12 @@ function isGroup(t) {
21
21
  * @class
22
22
  */
23
23
  class ConcurrentExecutor {
24
+ /**
25
+ * How many time-slice cycles have been executed this far. This is a monotonically increasing counter
26
+ * @type {number}
27
+ */
24
28
  #cycle_count = 0;
29
+
25
30
  /**
26
31
  * Handle of the last scheduled `setTimeout`
27
32
  * @type {number}
@@ -134,7 +139,7 @@ class ConcurrentExecutor {
134
139
  const child = children[i];
135
140
  child.on.completed.add(subTaskCompleted);
136
141
  child.on.failed.add(subTaskFailed);
137
- if (isGroup(child)) {
142
+ if (isGroupTask(child)) {
138
143
  this.runGroup(child);
139
144
  } else {
140
145
  this.run(child);
@@ -157,7 +162,7 @@ class ConcurrentExecutor {
157
162
  for (let i = 0; i < n; i++) {
158
163
  const child = children[i];
159
164
 
160
- if (isGroup(child)) {
165
+ if (isGroupTask(child)) {
161
166
  this.removeGroup(child);
162
167
  } else {
163
168
  this.removeTask(child);
@@ -255,7 +260,7 @@ class ConcurrentExecutor {
255
260
  }
256
261
 
257
262
  /**
258
- * Go through unresolved queue and move tasks who's dependencies have been completed to ready queue or fail them
263
+ * Go through unresolved queue and move tasks whose dependencies have been completed to ready queue or fail them
259
264
  */
260
265
  resolveTasks() {
261
266
  const queueUnresolved = this.queueUnresolved;
@@ -292,6 +297,7 @@ class ConcurrentExecutor {
292
297
  /**
293
298
  *
294
299
  * @param {Task} task
300
+ * @returns {boolean}
295
301
  */
296
302
  contains(task) {
297
303
  if (this.queueUnresolved.indexOf(task) !== -1) {
@@ -1 +1 @@
1
- {"version":3,"file":"current_time_in_seconds.d.ts","sourceRoot":"","sources":["../../../../src/core/time/current_time_in_seconds.js"],"names":[],"mappings":"AAIA;;;GAGG;AACH,2CAFa,MAAM,CAIlB"}
1
+ {"version":3,"file":"current_time_in_seconds.d.ts","sourceRoot":"","sources":["../../../../src/core/time/current_time_in_seconds.js"],"names":[],"mappings":"AAGA;;;GAGG;AACH,2CAFa,MAAM,CAKlB"}
@@ -1,4 +1,3 @@
1
-
2
1
  //Use highest available resolution time source
3
2
  const source = typeof performance === "undefined" ? Date : performance;
4
3
 
@@ -7,5 +6,6 @@ const source = typeof performance === "undefined" ? Date : performance;
7
6
  * @returns {number}
8
7
  */
9
8
  export function current_time_in_seconds() {
9
+ // time source produces value in milliseconds, we need to scale to seconds
10
10
  return source.now() * 1e-3;
11
11
  }
@@ -1 +1 @@
1
- {"version":3,"file":"compute_curve_aabb.d.ts","sourceRoot":"","sources":["../../../../../src/engine/animation/curve/compute_curve_aabb.js"],"names":[],"mappings":"AAMA;;;;GAIG;AACH,4EAmCC"}
1
+ {"version":3,"file":"compute_curve_aabb.d.ts","sourceRoot":"","sources":["../../../../../src/engine/animation/curve/compute_curve_aabb.js"],"names":[],"mappings":"AAMA;;;;GAIG;AACH,4EAsCC"}
@@ -18,29 +18,32 @@ export function compute_curve_aabb(out, curve) {
18
18
  const keys = curve.keys;
19
19
  const key_count = keys.length;
20
20
 
21
- let previous = keys[0];
22
- x0 = x1 = previous.time;
23
- y0 = y1 = previous.value;
21
+ if (key_count > 0) {
24
22
 
23
+ let previous = keys[0];
24
+ x0 = x1 = previous.time;
25
+ y0 = y1 = previous.value;
25
26
 
26
- for (let i = 1; i < key_count; i++) {
27
- const keyframe = keys[i];
27
+ for (let i = 1; i < key_count; i++) {
28
+ const keyframe = keys[i];
28
29
 
29
- const time_delta = keyframe.time - previous.time;
30
+ const time_delta = keyframe.time - previous.time;
30
31
 
31
- spline_hermite3_bounds(temp_bounds, 0, 1,
32
- previous.value, keyframe.value,
33
- previous.outTangent * time_delta,
34
- keyframe.inTangent * time_delta
35
- );
32
+ spline_hermite3_bounds(temp_bounds, 0, 1,
33
+ previous.value, keyframe.value,
34
+ previous.outTangent * time_delta,
35
+ keyframe.inTangent * time_delta
36
+ );
36
37
 
37
- x0 = min2(x0, keyframe.time)
38
- x1 = max2(x1, keyframe.time)
38
+ x0 = min2(x0, keyframe.time)
39
+ x1 = max2(x1, keyframe.time)
39
40
 
40
- y0 = min2(y0, temp_bounds[0]);
41
- y1 = max2(y1, temp_bounds[1]);
41
+ y0 = min2(y0, temp_bounds[0]);
42
+ y1 = max2(y1, temp_bounds[1]);
43
+
44
+ previous = keyframe;
45
+ }
42
46
 
43
- previous = keyframe;
44
47
  }
45
48
 
46
49
  out.set(x0, y0, x1, y1);
@@ -1 +1 @@
1
- {"version":3,"file":"FogOfWar.d.ts","sourceRoot":"","sources":["../../../../../src/engine/ecs/fow/FogOfWar.js"],"names":[],"mappings":"AA+CA;;GAEG;AACH;IAEI;;;OAGG;IACH,oBAFU,OAAO,CAES;IAC1B;;;OAGG;IACH,0BAFU,OAAO,CAEgB;IAEjC;;;OAGG;IACH,SAFU,WAAW,GAAC,IAAI,CAEX;IAEf;;;OAGG;IACH,OAFU,OAAO,CAEM;IAEvB;;;OAGG;IACH,MAFU,OAAO,CAEQ;IAEzB,eAAsC;IAEtC;;;OAGG;IACH,UAFU,aAAa,CAE2B;IAElD;;MAEE;IAEF;;;OAGG;IACH,SAFU,SAAS,CAEgB;IAEnC;;;OAGG;IACH,iBAFU,SAAS,CAEwB;IAE3C;;;OAGG;IACH,sBAFW,MAAM,QAqDhB;IAED;;;;OAIG;IACH,eAHW,MAAM,KACN,MAAM,QAyBhB;IAED,cAOC;IAED,kBAOC;IAED,mBAEC;IAED;;;;;OAKG;IACH,UAJW,MAAM,KACN,MAAM,UACN,MAAM,QA+ChB;IAED;;;;;OAKG;IACH,WAJW,MAAM,KACN,MAAM,UACN,MAAM,QAgDhB;IAED,gBAIC;IAED,sBAqCC;IAED;;;OAGG;IACH,kBAFW,MAAM,QAYhB;IAED;;;OAGG;IACH,0DA+BC;IAED;;;;;OAKG;IACH,yBAJW,MAAM,KACN,MAAM,UACN,MAAM,EAAE,QAelB;IAED;;;;;OAKG;IACH,yEAFW,MAAM,WA+EhB;IAED;;;;;OAKG;IACH,qBAJW,MAAM,KACN,MAAM,GACJ,MAAM,CASlB;IAED,6BAKC;IAED,+BASC;IAED,uBAyBC;IAGD;;;;;OAKG;IACH,UAJW,MAAM,KACN,MAAM,oBAUhB;CACJ;;;;4BAplB2F,OAAO;oBAC/E,+BAA+B;oBAC/B,+BAA+B;oBAE/B,+BAA+B;8BAErB,iDAAiD;mBAD5D,uCAAuC;0BANhC,6CAA6C"}
1
+ {"version":3,"file":"FogOfWar.d.ts","sourceRoot":"","sources":["../../../../../src/engine/ecs/fow/FogOfWar.js"],"names":[],"mappings":"AA+CA;;GAEG;AACH;IAEI;;;OAGG;IACH,oBAFU,OAAO,CAES;IAC1B;;;OAGG;IACH,0BAFU,OAAO,CAEgB;IAEjC;;;OAGG;IACH,SAFU,WAAW,GAAC,IAAI,CAEX;IAEf;;;OAGG;IACH,OAFU,OAAO,CAEM;IAEvB;;;OAGG;IACH,MAFU,OAAO,CAEQ;IAEzB,eAAsC;IAEtC;;;OAGG;IACH,UAFU,aAAa,CAE2B;IAElD;;MAEE;IAEF;;;OAGG;IACH,SAFU,SAAS,CAEgB;IAEnC;;;OAGG;IACH,iBAFU,SAAS,CAEwB;IAE3C;;;OAGG;IACH,sBAFW,MAAM,QAqDhB;IAED;;;;OAIG;IACH,eAHW,MAAM,KACN,MAAM,QAyBhB;IAED,cAOC;IAED,kBAOC;IAED,mBAEC;IAED;;;;;OAKG;IACH,UAJW,MAAM,KACN,MAAM,UACN,MAAM,QA+ChB;IAED;;;;;OAKG;IACH,WAJW,MAAM,KACN,MAAM,UACN,MAAM,QAgDhB;IAED,gBAIC;IAED,sBAqCC;IAED;;;OAGG;IACH,kBAFW,MAAM,QAYhB;IAED;;;OAGG;IACH,0DA+BC;IAED;;;;;OAKG;IACH,yBAJW,MAAM,KACN,MAAM,UACN,MAAM,EAAE,QAelB;IAED;;;;;OAKG;IACH,yEAFW,MAAM,WA+EhB;IAED;;;;;OAKG;IACH,qBAJW,MAAM,KACN,MAAM,GACJ,MAAM,CASlB;IAED,6BAKC;IAED,+BASC;IAED,uBAyBC;IAGD;;;;;OAKG;IACH,UAJW,MAAM,KACN,MAAM,oBAUhB;CACJ;;;;4BAxlB2F,OAAO;oBAM/E,+BAA+B;oBAC/B,+BAA+B;oBAC/B,+BAA+B;8BALrB,iDAAiD;mBAE5D,uCAAuC;0BAQhC,6CAA6C"}
@@ -1,18 +1,18 @@
1
- import { clamp } from "../../../core/math/clamp.js";
2
- import { max2 } from "../../../core/math/max2.js";
3
- import { min2 } from "../../../core/math/min2.js";
4
- import { Sampler2D } from "../../graphics/texture/sampler/Sampler2D.js";
5
1
  import { ClampToEdgeWrapping, DataTexture, LinearFilter, RedFormat, UnsignedByteType } from "three";
6
- import Vector1 from "../../../core/geom/Vector1.js";
7
- import Vector2 from "../../../core/geom/Vector2.js";
8
2
  import { assert } from "../../../core/assert.js";
9
- import Vector4 from "../../../core/geom/Vector4.js";
10
- import Signal from "../../../core/events/signal/Signal.js";
3
+ import { BinaryDataType } from "../../../core/binary/type/BinaryDataType.js";
11
4
  import { RowFirstTable } from "../../../core/collection/table/RowFirstTable.js";
12
5
  import { RowFirstTableSpec } from "../../../core/collection/table/RowFirstTableSpec.js";
13
- import { BinaryDataType } from "../../../core/binary/type/BinaryDataType.js";
14
- import { writeSample2DDataToDataTexture } from "../../graphics/texture/sampler/writeSampler2DDataToDataTexture.js";
6
+ import Signal from "../../../core/events/signal/Signal.js";
7
+ import Vector1 from "../../../core/geom/Vector1.js";
8
+ import Vector2 from "../../../core/geom/Vector2.js";
9
+ import Vector4 from "../../../core/geom/Vector4.js";
10
+ import { clamp } from "../../../core/math/clamp.js";
11
+ import { max2 } from "../../../core/math/max2.js";
12
+ import { min2 } from "../../../core/math/min2.js";
15
13
  import { computeUnsignedDistanceField } from "../../graphics/texture/sampler/distance/computeUnsignedDistanceField.js";
14
+ import { Sampler2D } from "../../graphics/texture/sampler/Sampler2D.js";
15
+ import { writeSample2DDataToDataTexture } from "../../graphics/texture/sampler/writeSampler2DDataToDataTexture.js";
16
16
 
17
17
  const samplePosition = [];
18
18
 
@@ -1,14 +1,13 @@
1
1
  import { FogOfWar } from "./FogOfWar.js";
2
2
 
3
3
  test('getWorldClearance', () => {
4
- const sut = new FogOfWar();
4
+ const fog = new FogOfWar();
5
5
 
6
- sut.resize(1, 1, 2);
6
+ fog.resize(1, 1, 2);
7
7
 
8
+ expect(fog.getWorldClearance(1, 1)).toBe(255);
8
9
 
9
- expect(sut.getWorldClearance(1, 1)).toBe(255);
10
+ fog.reveal(0, 0, 0.5);
10
11
 
11
- sut.reveal(0, 0, 0.5);
12
-
13
- expect(sut.getWorldClearance(1, 1)).toBe(0);
12
+ expect(fog.getWorldClearance(1, 1)).toBe(0);
14
13
  });
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Google tracker initialization
3
+ * @param {string} id measurement ID
4
+ * @return {function} tracker function
5
+ */
6
+ export function loadGTAG(id: string): Function;
7
+ //# sourceMappingURL=loadGTAG.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loadGTAG.d.ts","sourceRoot":"","sources":["../../../../src/engine/google/loadGTAG.js"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,6BAHW,MAAM,YA6BhB"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Google tracker initialization
3
+ * @param {string} id measurement ID
4
+ * @return {function} tracker function
5
+ */
6
+ export function loadGTAG(id) {
7
+
8
+ (function (target, s, domTag, sourceURL) {
9
+
10
+ const a = s.createElement(domTag);
11
+ const m = s.getElementsByTagName(domTag)[0];
12
+
13
+ a.async = 1;
14
+ a.src = sourceURL;
15
+
16
+ m.parentNode.insertBefore(a, m)
17
+ })(document, document, 'script', `https://www.googletagmanager.com/gtag/js?id=${id}`);
18
+
19
+
20
+ window.dataLayer = window.dataLayer || [];
21
+
22
+ function gtag() {
23
+ dataLayer.push(arguments);
24
+ }
25
+
26
+ gtag('js', new Date());
27
+
28
+ gtag('config', id);
29
+
30
+
31
+ return gtag;
32
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"computeUnsignedDistanceField.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/texture/sampler/distance/computeUnsignedDistanceField.js"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,sGAFW,MAAM,QAIhB"}
1
+ {"version":3,"file":"computeUnsignedDistanceField.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/texture/sampler/distance/computeUnsignedDistanceField.js"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,sGAFW,MAAM,QAShB"}