@woosh/meep-engine 2.102.0 → 2.103.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 (69) hide show
  1. package/build/meep.cjs +42 -35
  2. package/build/meep.min.js +1 -1
  3. package/build/meep.module.js +42 -35
  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/metrics/GoogleAnalyticsMetrics.d.ts +2 -1
  61. package/src/engine/metrics/GoogleAnalyticsMetrics.d.ts.map +1 -1
  62. package/src/engine/metrics/GoogleAnalyticsMetrics.js +4 -39
  63. package/src/engine/notify/NotificationLog.d.ts +1 -2
  64. package/src/engine/notify/NotificationLog.d.ts.map +1 -1
  65. package/src/engine/notify/NotificationLog.js +33 -32
  66. package/src/core/lang/reactive/nearley/Reactive.ne +0 -87
  67. package/src/engine/compression/CompressionService.d.ts +0 -19
  68. package/src/engine/compression/CompressionService.d.ts.map +0 -1
  69. package/src/engine/compression/CompressionService.js +0 -144
@@ -1 +1 @@
1
- {"version":3,"file":"NotificationLog.d.ts","sourceRoot":"","sources":["../../../../src/engine/notify/NotificationLog.js"],"names":[],"mappings":";AASA,yCAYC;;IAXG;;;OAGG;IACH,mBAFU,KAAK,YAAY,CAAC,CAEF;IAE1B;;;OAGG;IACH,WAFU,MAAM,CAEK;IAGzB;;;;OAIG;IACH,aAHW,EAAE,GACA,YAAY,CAQxB;IAED;;;OAGG;IACH,8BAFW,YAAY,QAkBtB;;iBAlDgB,oCAAoC;6BADxB,mBAAmB"}
1
+ {"version":3,"file":"NotificationLog.d.ts","sourceRoot":"","sources":["../../../../src/engine/notify/NotificationLog.js"],"names":[],"mappings":";AASA;IACI;;;OAGG;IACH,mBAFU,KAAK,YAAY,CAAC,CAEN;IAEtB;;;OAGG;IACH,WAFU,MAAM,CAEC;IAEjB;;;;OAIG;IACH,aAHW,EAAE,GACA,YAAY,CAQxB;IAED;;;OAGG;IACH,8BAFW,YAAY,QAmBtB;CACJ;iBAnDgB,oCAAoC;6BACxB,mBAAmB"}
@@ -3,57 +3,58 @@
3
3
  */
4
4
 
5
5
 
6
- import { Notification } from './Notification.js';
7
- import List from '../../core/collection/list/List.js';
8
6
  import { assert } from "../../core/assert.js";
7
+ import List from '../../core/collection/list/List.js';
8
+ import { Notification } from './Notification.js';
9
9
 
10
- function NotificationLog() {
10
+ class NotificationLog {
11
11
  /**
12
12
  * @readonly
13
13
  * @type {List<Notification>}
14
14
  */
15
- this.elements = new List();
15
+ elements = new List();
16
16
 
17
17
  /**
18
18
  * Once number of entries in the log reaches this amount, the earliest entries will be removed to make space for new ones
19
19
  * @type {number}
20
20
  */
21
- this.maxLength = 1000;
22
- }
21
+ maxLength = 1000;
23
22
 
24
- /**
25
- *
26
- * @param {{}} options See Notification.constructor for details
27
- * @returns {Notification}
28
- */
29
- NotificationLog.prototype.add = function (options) {
30
- const notification = new Notification(options);
23
+ /**
24
+ *
25
+ * @param {{}} options See {@link Notification.constructor} for details
26
+ * @returns {Notification}
27
+ */
28
+ add(options) {
29
+ const notification = new Notification(options);
31
30
 
32
- this.addNotification(notification);
31
+ this.addNotification(notification);
33
32
 
34
- return notification;
35
- };
33
+ return notification;
34
+ }
36
35
 
37
- /**
38
- *
39
- * @param {Notification} notification
40
- */
41
- NotificationLog.prototype.addNotification = function (notification) {
42
- assert.notEqual(notification, undefined, 'notification is undefined');
43
- assert.notEqual(notification, null, 'notification is null');
36
+ /**
37
+ *
38
+ * @param {Notification} notification
39
+ */
40
+ addNotification(notification) {
41
+ assert.defined(notification, 'notification');
42
+ assert.notNull(notification, 'notification');
44
43
 
45
- assert.ok(notification.isNotification, 'not a Notification');
44
+ assert.ok(notification.isNotification, 'not a Notification');
46
45
 
47
- // Crop notification log to size
48
- const length = this.elements.length;
46
+ // Crop notification log to size
47
+ const length = this.elements.length;
49
48
 
50
- const target = this.maxLength - 1;
49
+ const target = this.maxLength - 1;
51
50
 
52
- if (length > target) {
53
- this.elements.crop(length - target, length);
54
- }
51
+ if (length > target) {
52
+ // too many elements, drop some
53
+ this.elements.crop(length - target, length);
54
+ }
55
55
 
56
- this.elements.add(notification);
57
- };
56
+ this.elements.add(notification);
57
+ }
58
+ }
58
59
 
59
60
  export default NotificationLog;
@@ -1,87 +0,0 @@
1
- @builtin "whitespace.ne"
2
- @builtin "number.ne"
3
-
4
- expression -> binary_expression_add {% id %}
5
-
6
- group_expression -> "(" _ expression _ ")" {% (a) => a[2] %}
7
- | atomic {% id %}
8
-
9
- #####################
10
- # Unary Expressions
11
- #####################
12
-
13
- unary_expression_negate -> "-" _ expression {% (d)=> {return {type:'UnaryNegate', value: d[2]}} %}
14
- | group_expression {% id %}
15
-
16
-
17
- unary_expression_not -> "!" _ expression {% (d)=> {return {type:'UnaryNot', value: d[2]}} %}
18
- | unary_expression_negate {% id %}
19
-
20
- #####################
21
- # Binary Expressions
22
- #####################
23
-
24
- # Logic
25
-
26
- binary_expression_or -> binary_expression_or _ "||" _ unary_expression_not {% (d)=> {return {type:'BinaryOr', left: d[0], right: d[4]}} %}
27
- | unary_expression_not {% id %}
28
-
29
- binary_expression_and -> binary_expression_and _ "&&" _ binary_expression_or {% (d)=> {return {type:'BinaryAnd', left: d[0], right: d[4]}} %}
30
- | binary_expression_or {% id %}
31
-
32
- # Equality
33
-
34
- binary_expression_equals -> binary_expression_equals _ "==" _ binary_expression_and {% (d)=> {return {type:'BinaryEqual', left: d[0], right: d[4]}} %}
35
- | binary_expression_and {% id %}
36
-
37
- binary_expression_not_equals -> binary_expression_not_equals _ "!=" _ binary_expression_equals {% (d)=> {return {type:'BinaryNotEqual', left: d[0], right: d[4]}} %}
38
- | binary_expression_equals {% id %}
39
-
40
- # Comparison
41
-
42
- binary_expression_lte -> binary_expression_lte _ "<=" _ binary_expression_not_equals {% (d)=> {return {type:'BinaryLessOrEqual', left: d[0], right: d[4]}} %}
43
- | binary_expression_not_equals {% id %}
44
-
45
- binary_expression_gte -> binary_expression_gte _ ">=" _ binary_expression_lte {% (d)=> {return {type:'BinaryGreaterOrEqual', left: d[0], right: d[4]}} %}
46
- | binary_expression_lte {% id %}
47
-
48
- binary_expression_lt -> binary_expression_lt _ "<" _ binary_expression_gte {% (d)=> {return {type:'BinaryLess', left: d[0], right: d[4]}} %}
49
- | binary_expression_gte {% id %}
50
-
51
- binary_expression_gt -> binary_expression_gt _ ">" _ binary_expression_lt {% (d)=> {return {type:'BinaryGreater', left: d[0], right: d[4]}} %}
52
- | binary_expression_lt {% id %}
53
-
54
- # Multiplication
55
-
56
- binary_expression_multiply -> binary_expression_multiply _ "*" _ binary_expression_gt {% (d)=> {return {type:'BinaryMultiply', left: d[0], right: d[4]}} %}
57
- | binary_expression_gt {% id %}
58
-
59
- binary_expression_divide -> binary_expression_divide _ "/" _ binary_expression_multiply {% (d)=> {return {type:'BinaryDivide', left: d[0], right: d[4]}} %}
60
- | binary_expression_multiply {% id %}
61
-
62
- # Addition
63
-
64
- binary_expression_subtract -> binary_expression_subtract _ "-" _ binary_expression_divide {% (d)=> {return {type:'BinarySubtract', left: d[0], right: d[4]}} %}
65
- | binary_expression_divide {% id %}
66
-
67
- binary_expression_add -> binary_expression_add _ "+" _ binary_expression_subtract {% (d)=> {return {type:'BinaryAdd', left: d[0], right: d[4]}} %}
68
- | binary_expression_subtract {% id %}
69
-
70
-
71
- #####################
72
- # Primitives
73
- #####################
74
-
75
- atomic -> literal {% id %}
76
- | reference {% (d,l,r)=> { return {type:'Reference', value: d[0] } } %}
77
-
78
- reference -> identifier ("." identifier {% (a)=>a[1] %}):* {% (a,l,r) => [a[0]].concat(a[1]) %}
79
-
80
- identifier -> [a-zA-Z_] [a-zA-Z_0-9]:* {% (d,l,r) => { const value =d[0]+d[1].join(""); if(value === 'true' || value === 'false'){return r}else{return value} } %}
81
-
82
- literal -> decimal {% (d)=> {return {type:'LiteralNumber', value: d[0] }} %}
83
- | literal_boolean {% (d) => { return {type:'LiteralBoolean', value:d[0]} } %}
84
-
85
-
86
- literal_boolean -> "true" {% ()=> true %}
87
- | "false" {% ()=> false %}
@@ -1,19 +0,0 @@
1
- export default CompressionService;
2
- declare class CompressionService {
3
- private __incrementRequestCount;
4
- private __decrementRequestCount;
5
- /**
6
- *
7
- * @param data
8
- * @param level
9
- * @returns {Promise}
10
- */
11
- encode(data: any, level: any): Promise<any>;
12
- /**
13
- *
14
- * @param data
15
- * @returns {Promise}
16
- */
17
- decode(data: any): Promise<any>;
18
- }
19
- //# sourceMappingURL=CompressionService.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CompressionService.d.ts","sourceRoot":"","sources":["../../../../src/engine/compression/CompressionService.js"],"names":[],"mappings":";;IA2FuD,gCAetD;IAMsD,gCAKtD;IAED;;;;;OAKG;IACH,4CAIC;IAED;;;;OAIG;IACH,gCAIC"}
@@ -1,144 +0,0 @@
1
- /**
2
- * Created by Alex on 03/11/2016.
3
- */
4
-
5
-
6
- import WorkerBuilder from '../../core/process/worker/WorkerBuilder.js';
7
-
8
- function buildWorker() {
9
- const workerBuilder = new WorkerBuilder();
10
- workerBuilder.importScript('lib/lzma_worker.js');
11
-
12
- workerBuilder.addMethod('encode', function encode(data, level) {
13
- return new Promise(function (resolve, reject) {
14
- //Validate data type
15
- if (typeof data !== "string" && !(data instanceof Uint8Array)) {
16
- reject("data must be a string or a Uint8Array, instead got '" + (typeof data) + "'");
17
- }
18
-
19
- let compressionLevel;
20
- if (typeof level === 'number') {
21
- if (level < 1) {
22
- compressionLevel = 1;
23
- console.warn('Requested compression level(' + level + ') < minimum(1), using 1 instead');
24
- } else if (level > 9) {
25
- compressionLevel = 9;
26
- console.warn('Requested compression level(' + level + ') > maximum(9), using 9 instead');
27
- } else if (level % 1 !== 0) {
28
- compressionLevel = level | 0;
29
- console.warn('Requested compression level(' + level + ') is not integer, using ' + compressionLevel + ' instead');
30
- } else {
31
- compressionLevel = level;
32
- }
33
- } else {
34
- if (level !== undefined && typeof level !== 'number') {
35
- console.warn('Supplied compression level must be a number, was ' + (typeof level) + ' instead. Defaulting to minimum(1)');
36
- }
37
- //no valid compression level specified
38
- compressionLevel = 1;
39
- }
40
-
41
- console.time("Compression");
42
- LZMA.compress(data, compressionLevel, function on_finish(result, error) {
43
- console.timeEnd("Compression");
44
- if (error) {
45
- reject(error);
46
- } else {
47
- if (result instanceof Array) {
48
- resolve(new Uint8Array(result));
49
- } else {
50
- resolve(result);
51
- }
52
- }
53
- }, function on_progress(percent) {
54
- });
55
- });
56
- });
57
-
58
- workerBuilder.addMethod('decode', function decode(data) {
59
- return new Promise(function (resolve, reject) {
60
- LZMA.decompress(data, function on_finish(result, error) {
61
- if (error) {
62
- reject(error);
63
- } else {
64
- if (result instanceof Array) {
65
- resolve(new Uint8Array(result));
66
- } else {
67
- resolve(result);
68
- }
69
- }
70
- }, function on_progress(percent) {
71
- });
72
- });
73
- });
74
- return workerBuilder.build();
75
- }
76
-
77
- /**
78
- * @property {WorkerProxy} __workerProxy
79
- * @property {number} __requestCount
80
- * @constructor
81
- */
82
- const CompressionService = function () {
83
- this.__workerProxy = buildWorker();
84
- this.__requestCount = 0;
85
- };
86
-
87
- /**
88
- *
89
- * @param {Promise} r
90
- * @private
91
- */
92
- CompressionService.prototype.__incrementRequestCount = function (r) {
93
- this.__requestCount++;
94
-
95
-
96
- const self = this;
97
-
98
- function d() {
99
- self.__decrementRequestCount();
100
- }
101
-
102
- r.then(d, d);
103
-
104
- if (!this.__workerProxy.isRunning()) {
105
- this.__workerProxy.start();
106
- }
107
- };
108
-
109
- /**
110
- *
111
- * @private
112
- */
113
- CompressionService.prototype.__decrementRequestCount = function () {
114
- this.__requestCount--;
115
- if (this.__requestCount <= 0 && this.__workerProxy.isRunning()) {
116
- this.__workerProxy.stop();
117
- }
118
- };
119
-
120
- /**
121
- *
122
- * @param data
123
- * @param level
124
- * @returns {Promise}
125
- */
126
- CompressionService.prototype.encode = function (data, level) {
127
- const result = this.__workerProxy.encode(data, level);
128
- this.__incrementRequestCount(result);
129
- return result;
130
- };
131
-
132
- /**
133
- *
134
- * @param data
135
- * @returns {Promise}
136
- */
137
- CompressionService.prototype.decode = function (data) {
138
- const result = this.__workerProxy.decode(data);
139
- this.__incrementRequestCount(result);
140
- return result;
141
- };
142
-
143
-
144
- export default CompressionService;