@woosh/meep-engine 2.101.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.
- package/build/meep.cjs +149 -127
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +149 -127
- package/package.json +1 -1
- package/src/core/__module.d.ts +4 -0
- package/src/core/__module.js +4 -0
- package/src/core/geom/2d/circle/Circle.d.ts +0 -8
- package/src/core/geom/2d/circle/Circle.d.ts.map +1 -1
- package/src/core/geom/2d/circle/Circle.js +85 -85
- package/src/core/geom/3d/cone/computeConePlaneSide.js +1 -1
- package/src/core/geom/3d/mat4/{allocate_transform_m4.d.ts → allocate_m4.d.ts} +2 -2
- package/src/core/geom/3d/mat4/allocate_m4.d.ts.map +1 -0
- package/src/core/geom/3d/mat4/{allocate_transform_m4.js → allocate_m4.js} +1 -1
- package/src/core/geom/ConicRay.d.ts +3 -1
- package/src/core/geom/ConicRay.d.ts.map +1 -1
- package/src/core/geom/ConicRay.js +7 -5
- package/src/core/geom/Vector1.d.ts.map +1 -1
- package/src/core/geom/Vector1.js +3 -0
- package/src/core/geom/Vector2.d.ts.map +1 -1
- package/src/core/geom/Vector2.js +6 -3
- package/src/core/geom/Vector3.js +1 -1
- package/src/core/geom/Vector4.d.ts.map +1 -1
- package/src/core/geom/Vector4.js +13 -92
- package/src/core/geom/vec3/v3_angle_cos_between.spec.d.ts +2 -0
- package/src/core/geom/vec3/v3_angle_cos_between.spec.d.ts.map +1 -0
- package/src/core/geom/vec3/v3_angle_cos_between.spec.js +124 -0
- package/src/core/geom/vec3/v3_distance_above_plane.d.ts +13 -4
- package/src/core/geom/vec3/v3_distance_sqr.d.ts +12 -1
- package/src/core/geom/vec3/v3_length.d.ts +9 -1
- package/src/core/geom/vec4/v4_distance_sqr.d.ts +14 -0
- package/src/core/geom/vec4/v4_distance_sqr.d.ts.map +1 -0
- package/src/core/geom/vec4/v4_distance_sqr.js +20 -0
- package/src/core/geom/vec4/v4_dot.d.ts +14 -0
- package/src/core/geom/vec4/v4_dot.d.ts.map +1 -0
- package/src/core/geom/vec4/v4_dot.js +19 -0
- package/src/core/geom/vec4/v4_length_sqr.d.ts +10 -0
- package/src/core/geom/vec4/v4_length_sqr.d.ts.map +1 -0
- package/src/core/geom/vec4/v4_length_sqr.js +11 -0
- package/src/core/geom/vec4/v4_multiply_mat4.d.ts +8 -0
- package/src/core/geom/vec4/v4_multiply_mat4.d.ts.map +1 -0
- package/src/core/geom/vec4/v4_multiply_mat4.js +42 -0
- package/src/core/lang/reactive/compileReactiveExpression.d.ts.map +1 -1
- package/src/core/lang/reactive/compileReactiveExpression.js +1 -3
- package/src/core/lang/reactive/pegjs/ReactivePegCompiler.d.ts.map +1 -1
- package/src/core/lang/reactive/pegjs/ReactivePegCompiler.js +11 -5
- package/src/core/math/PI_RECIPROCAL.d.ts +6 -0
- package/src/core/math/PI_RECIPROCAL.d.ts.map +1 -0
- package/src/core/math/PI_RECIPROCAL.js +5 -0
- package/src/core/math/newton_solver_1d.d.ts +4 -3
- package/src/core/math/newton_solver_1d.d.ts.map +1 -1
- package/src/core/math/newton_solver_1d.js +4 -3
- package/src/core/math/physics/brdf/D_GGX.d.ts.map +1 -1
- package/src/core/math/physics/brdf/D_GGX.js +4 -1
- package/src/core/math/physics/brdf/brdf_burley.d.ts.map +1 -1
- package/src/core/math/physics/brdf/brdf_burley.js +5 -1
- package/src/core/math/physics/irradiance/interpolate_irradiance_smith.d.ts.map +1 -1
- package/src/core/math/physics/irradiance/interpolate_irradiance_smith.js +3 -3
- package/src/core/primitives/strings/insert_after.spec.d.ts +2 -0
- package/src/core/primitives/strings/insert_after.spec.d.ts.map +1 -0
- package/src/core/primitives/strings/insert_after.spec.js +16 -0
- package/src/core/primitives/strings/insert_before.spec.d.ts +2 -0
- package/src/core/primitives/strings/insert_before.spec.d.ts.map +1 -0
- package/src/core/primitives/strings/insert_before.spec.js +16 -0
- package/src/core/process/executor/ConcurrentExecutor.d.ts.map +1 -1
- package/src/core/process/executor/ConcurrentExecutor.js +10 -4
- package/src/core/time/current_time_in_seconds.d.ts.map +1 -1
- package/src/core/time/current_time_in_seconds.js +1 -1
- package/src/engine/animation/curve/compute_curve_aabb.d.ts.map +1 -1
- package/src/engine/animation/curve/compute_curve_aabb.js +19 -16
- package/src/engine/ecs/fow/FogOfWar.d.ts.map +1 -1
- package/src/engine/ecs/fow/FogOfWar.js +12 -12
- package/src/engine/ecs/fow/FogOfWar.spec.js +5 -6
- package/src/engine/ecs/transform/Transform.d.ts.map +1 -1
- package/src/engine/ecs/transform/Transform.js +2 -2
- package/src/engine/google/loadGTAG.d.ts +7 -0
- package/src/engine/google/loadGTAG.d.ts.map +1 -0
- package/src/engine/google/loadGTAG.js +32 -0
- package/src/engine/graphics/texture/sampler/distance/computeUnsignedDistanceField.d.ts.map +1 -1
- package/src/engine/graphics/texture/sampler/distance/computeUnsignedDistanceField.js +6 -1
- package/src/engine/graphics/texture/sampler/distance/computeUnsignedDistanceField_Chamfer.d.ts.map +1 -1
- package/src/engine/graphics/texture/sampler/distance/computeUnsignedDistanceField_Chamfer.js +17 -1
- package/src/engine/graphics/texture/virtual/tile/VirtualTextureTile.d.ts +4 -0
- package/src/engine/graphics/texture/virtual/tile/VirtualTextureTile.d.ts.map +1 -1
- package/src/engine/graphics/texture/virtual/tile/VirtualTextureTile.js +4 -0
- package/src/engine/graphics/trail/x/NOTES.md +3 -0
- package/src/engine/graphics/trail/x/RibbonMaterialX.d.ts +11 -2
- package/src/engine/graphics/trail/x/RibbonMaterialX.d.ts.map +1 -1
- package/src/engine/graphics/trail/x/RibbonMaterialX.js +28 -13
- package/src/engine/graphics/util/projectSphere.js +4 -4
- package/src/engine/metrics/GoogleAnalyticsMetrics.d.ts +2 -1
- package/src/engine/metrics/GoogleAnalyticsMetrics.d.ts.map +1 -1
- package/src/engine/metrics/GoogleAnalyticsMetrics.js +4 -39
- package/src/engine/notify/NotificationLog.d.ts +1 -2
- package/src/engine/notify/NotificationLog.d.ts.map +1 -1
- package/src/engine/notify/NotificationLog.js +33 -32
- package/src/core/geom/3d/mat4/allocate_transform_m4.d.ts.map +0 -1
- package/src/core/lang/reactive/nearley/Reactive.ne +0 -87
- package/src/engine/compression/CompressionService.d.ts +0 -19
- package/src/engine/compression/CompressionService.d.ts.map +0 -1
- package/src/engine/compression/CompressionService.js +0 -144
- package/src/engine/graphics/trail/CodeflowTrailMaterial.d.ts +0 -4
- package/src/engine/graphics/trail/CodeflowTrailMaterial.d.ts.map +0 -1
- package/src/engine/graphics/trail/CodeflowTrailMaterial.js +0 -134
- package/src/engine/graphics/trail/TemporalPath.d.ts +0 -39
- package/src/engine/graphics/trail/TemporalPath.d.ts.map +0 -1
- package/src/engine/graphics/trail/TemporalPath.js +0 -129
- package/src/engine/graphics/trail/TemporalPath.spec.d.ts +0 -2
- package/src/engine/graphics/trail/TemporalPath.spec.d.ts.map +0 -1
- package/src/engine/graphics/trail/TemporalPath.spec.js +0 -5
- package/src/engine/graphics/util/composeMatrix4RotationScale.d.ts +0 -9
- package/src/engine/graphics/util/composeMatrix4RotationScale.d.ts.map +0 -1
- package/src/engine/graphics/util/composeMatrix4RotationScale.js +0 -14
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Represents a direction vector+angle
|
|
3
3
|
* Mainly used inside particle systems for pick a motion direction at spawn
|
|
4
|
+
* @copyright "Company Named Limited"
|
|
4
5
|
*/
|
|
5
6
|
export class ConicRay {
|
|
6
7
|
/**
|
|
@@ -14,9 +15,10 @@ export class ConicRay {
|
|
|
14
15
|
static fromScalars(x: number, y: number, z: number, angle: number): ConicRay;
|
|
15
16
|
/**
|
|
16
17
|
* Must be normalized
|
|
18
|
+
* @readonly
|
|
17
19
|
* @type {Vector3}
|
|
18
20
|
*/
|
|
19
|
-
direction: Vector3;
|
|
21
|
+
readonly direction: Vector3;
|
|
20
22
|
/**
|
|
21
23
|
* Half-angle of the cone, that is the angle between the center axis and the edge of the cone
|
|
22
24
|
* In radians
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConicRay.d.ts","sourceRoot":"","sources":["../../../../src/core/geom/ConicRay.js"],"names":[],"mappings":"AAQA
|
|
1
|
+
{"version":3,"file":"ConicRay.d.ts","sourceRoot":"","sources":["../../../../src/core/geom/ConicRay.js"],"names":[],"mappings":"AAQA;;;;GAIG;AACH;IA4KI;;;;;;;OAOG;IACH,sBANW,MAAM,KACN,MAAM,KACN,MAAM,SACN,MAAM,GACJ,QAAQ,CAWpB;IA3LD;;;;OAIG;IACH,oBAFU,OAAO,CAEgB;IAEjC;;;;OAIG;IACH,OAFU,MAAM,CAEN;IAEV;;;MAKC;IAED,0BAGC;IAED;;;OAGG;IACH,2CAGC;IAED;;;OAGG;IACH,6CAMC;IAED;;;;OAIG;IACH,cAHW,QAAQ,GACN,OAAO,CAInB;IAED;;;;;OAKG;IACH,qBAJW,QAAQ,cACR,MAAM,GACJ,OAAO,CAKnB;IAED,eAKC;IAED;;;OAGG;IACH,YAFW,QAAQ,QAKlB;IAED;;;;OAIG;IACH,4BAHW,OAAO,GACL,OAAO,CAMnB;IAED;;;;;OAKG;IACH,gDAFW,OAAO,QAsEjB;CAoBJ;oBAtMmB,cAAc"}
|
|
@@ -1,19 +1,21 @@
|
|
|
1
|
-
import {assert} from "../assert.js";
|
|
2
|
-
import {computeHashIntegerArray} from "../collection/array/computeHashIntegerArray.js";
|
|
3
|
-
import {EPSILON} from "../math/EPSILON.js";
|
|
4
|
-
import {epsilonEquals} from "../math/epsilonEquals.js";
|
|
5
|
-
import {computeHashFloat} from "../primitives/numbers/computeHashFloat.js";
|
|
1
|
+
import { assert } from "../assert.js";
|
|
2
|
+
import { computeHashIntegerArray } from "../collection/array/computeHashIntegerArray.js";
|
|
3
|
+
import { EPSILON } from "../math/EPSILON.js";
|
|
4
|
+
import { epsilonEquals } from "../math/epsilonEquals.js";
|
|
5
|
+
import { computeHashFloat } from "../primitives/numbers/computeHashFloat.js";
|
|
6
6
|
import Vector3 from "./Vector3.js";
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Represents a direction vector+angle
|
|
11
11
|
* Mainly used inside particle systems for pick a motion direction at spawn
|
|
12
|
+
* @copyright "Company Named Limited"
|
|
12
13
|
*/
|
|
13
14
|
export class ConicRay {
|
|
14
15
|
|
|
15
16
|
/**
|
|
16
17
|
* Must be normalized
|
|
18
|
+
* @readonly
|
|
17
19
|
* @type {Vector3}
|
|
18
20
|
*/
|
|
19
21
|
direction = new Vector3(0, 1, 0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Vector1.d.ts","sourceRoot":"","sources":["../../../../src/core/geom/Vector1.js"],"names":[],"mappings":";AAWA;
|
|
1
|
+
{"version":3,"file":"Vector1.d.ts","sourceRoot":"","sources":["../../../../src/core/geom/Vector1.js"],"names":[],"mappings":";AAWA;IA2PI;;;;;OAKG;IACH,kBAJW,OAAO,KACP,OAAO,GACN,MAAM,CAIjB;IAlQD;;;;;;OAMG;IACH,gBALW,MAAM,EAchB;IAHG,UAAU;IAEV,0DAA6B;IAWjC;;;OAGG;IACH,YAFa,MAAM,CAIlB;IAED;;;OAGG;IACH,YAFa,MAAM,CAIlB;IAED;;;;OAIG;IACH,iBAHW,OAAO,GACL,MAAM,CAIlB;IAED;;;;OAIG;IACH,OAHW,MAAM,GACJ,OAAO,CAgBnB;IAED;;;OAGG;IACH,aAFW,MAAM,QAOhB;IAED;;;OAGG;IACH,UAFY,OAAO,CAIlB;IAED,kBAEC;IAED,kBAEC;IAED;;;;OAIG;IACH,iBAFY,OAAO,CAIlB;IAED;;;OAGG;IACH,WAFW,OAAO,8BAAwB,WAIzC;IAED;;;;OAIG;IACH,iBAFY,OAAO,CAIlB;IAED;;;;OAIG;IACH,WAHW,OAAO,GACL,OAAO,CAInB;IAED;;;;OAIG;IACH,gBAHW,OAAO,GACL,OAAO,CAInB;IAED;;;OAGG;IACH,kBAFW,MAAM,QAIhB;IAED;;;;;OAKG;IACH,WAJW,MAAM,QACN,MAAM,GACJ,OAAO,CAInB;IAED;;;OAGG;IACH,YAFW,OAAO,8BAAwB,QAIzC;IAED;;;OAGG;IACH,SAFa,OAAO,CAInB;IAED;;;;OAIG;IACH,cAHW,OAAO,GACL,OAAO,CAInB;IAED;;OAEG;IACH,QAFa,MAAM,CAIlB;IAED;;;OAGG;IACH,4BAGC;IAED,iBAEC;IAED,yBAEC;IAED;;;;OAIG;IACH,qBAHW,MAAM,EAAE,WACR,MAAM,QAIhB;IAED;;;;OAIG;IACH,oBAHW,MAAM,EAAE,WACR,MAAM,QAIhB;IAED,oBAEC;IAED;;;OAGG;IACH,2CAEC;IAED;;;OAGG;IACH,6CAIC;IAgBD,mBAEC;IAND,gBAEC;IAaL;;;OAGG;IACH,oBAFU,OAAO,CAEU;IAXvB,sDAIC;CACJ;;;cAYS,OAAO;aAMP,OAAO;;mBAzSE,4BAA4B"}
|
package/src/core/geom/Vector1.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Vector2.d.ts","sourceRoot":"","sources":["../../../../src/core/geom/Vector2.js"],"names":[],"mappings":";AAmBA;IACI
|
|
1
|
+
{"version":3,"file":"Vector2.d.ts","sourceRoot":"","sources":["../../../../src/core/geom/Vector2.js"],"names":[],"mappings":";AAmBA;IACI;;;;;OAKG;IACH,gBAJW,MAAM,MACN,MAAM,EAuBhB;IAbG;;;OAGG;IACH,GAFU,MAAM,CAEN;IAEV;;;OAGG;IACH,GAFU,MAAM,CAEN;IAEV,0DAA6B;IAGjC;;;;OAIG;IACH,qBAHW,MAAM,EAAE,WACR,MAAM,QAOhB;IAED;;;;OAIG;IACH,oBAHW,MAAM,EAAE,WACR,MAAM,QAKhB;IAED,iBAMC;IAED;;;;;OAKG;IACH,OAJW,MAAM,KACN,MAAM,GACJ,OAAO,CAqBnB;IAED;;;;OAIG;IACH,aAHW,MAAM,KACN,MAAM,QAYhB;IAED;;;;OAIG;IACH,QAHW,MAAM,GACJ,OAAO,CAInB;IAED;;;;OAIG;IACH,QAHW,MAAM,GACJ,OAAO,CAInB;IAED;;;;;OAKG;IACH,QAJW,MAAM,KACN,MAAM,GACJ,OAAO,CAInB;IAED;;;;OAIG;IACH,WAHW,OAAO,GACL,OAAO,CAInB;IAED;;;;OAIG;IACH,cAHW,OAAO,KACP,OAAO,QAIjB;IAED;;;OAGG;IACH,SAFa,OAAO,CAInB;IAED;;;OAGG;IACH,QAFa,OAAO,CAInB;IAED;;OAEG;IACH,cAIC;IAED;;;OAGG;IACH,OAFa,OAAO,CAInB;IAED;;;;;OAKG;IACH,QAJW,MAAM,KACN,MAAM,GACJ,OAAO,CAInB;IAED;;;;OAIG;IACH,WAHW,OAAO,GACL,OAAO,CAInB;IAED;;;;OAIG;IACH,cAHW,OAAO,GACL,OAAO,CAInB;IAED;;;;OAIG;IACH,gBAHW,OAAO,GACL,OAAO,CAInB;IAED;;;;;OAKG;IACH,aAJW,MAAM,KACN,MAAM,GACJ,OAAO,CAInB;IAED;;;;OAIG;IACH,WAHW,OAAO,GACL,OAAO,CAMnB;IAED;;;;OAIG;IACH,WAHW,OAAO,GACL,MAAM,CAIlB;IAED;;;;OAIG;IACH,YAHW,OAAO,GACL,OAAO,CAInB;IAED;;;OAGG;IACH,SAFa,OAAO,CAInB;IAED;;;OAGG;IACH,UAFa,OAAO,CAInB;IAED;;;;;OAKG;IACH,QAJW,MAAM,KACN,MAAM,GACJ,OAAO,CAInB;IAED;;;;OAIG;IACH,WAHW,OAAO,GACL,OAAO,CAInB;IAED;;;OAGG;IACH,gCAEC;IAED;;;OAGG;IACH,eAFW,MAAM,QAIhB;IAED;;;OAGG;IACH,kBAFW,MAAM,QAIhB;IAED;;;;OAIG;IACH,6BAFa,OAAO,CAOnB;IAED;;;MAEC;IAED,0BAOC;IAED;;;OAGG;IACH,2CAGC;IAED;;;OAGG;IACH,6CAKC;IAED;;;OAGG;IACH,kDAGC;IAED;;;OAGG;IACH,oDAKC;IAED;;;OAGG;IACH,UAFa,OAAO,CAInB;IAED;;;;;;OAMG;IACH,uEAIC;IAED;;;;OAIG;IACH,8CAIC;IAED;;;;OAIG;IACH,iDAIC;IAED;;;;OAIG;IACH,qBAHW,OAAO,GACL,MAAM,CAIlB;IAED;;;;;OAKG;IACH,eAJW,OAAO,KACP,OAAO,YACP,MAAM,QAOhB;IAED;;;OAGG;IACH,sBAFW,MAAM,EAAE,QAUlB;IAED;;;;OAIG;IACH,kBAHW,OAAO,GACL,MAAM,CAIlB;IAED;;;;;OAKG;IACH,kBAJW,MAAM,KACN,MAAM,GACJ,MAAM,CAMlB;IAED;;;;;OAKG;IACH,eAJW,MAAM,KACN,MAAM,GACJ,MAAM,CAIlB;IAED;;;;OAIG;IACH,2BAHW,OAAO,GACL,MAAM,CAOlB;IAED;;OAEG;IACH,UAFa,MAAM,CAIlB;IAED;;OAEG;IACH,kBAWC;IAGD;;;OAGG;IACH,QAFa,MAAM,CAOlB;IAED;;;OAGG;IACH,cAFW,MAAM,QAahB;IAED;;;;;OAKG;IACH,6CAFa,OAAO,CAQnB;IAED,mBAEC;IAED;;;;OAIG;IACH,cAHW,OAAO,GACL,OAAO,CAInB;IAED;;;;;OAKG;IACH,qBAJW,OAAO,cACP,MAAM,GACL,OAAO,CAIlB;IAED;;;;;;OAMG;IACH,kBALW,MAAM,KACN,MAAM,cACN,MAAM,GACL,OAAO,CAKlB;IAUD,mBAEC;IAVD,gBAEC;IAUD,mBAEC;IAVD,gBAEC;IAsDL;;;OAGG;IACH,oBAFU,OAAO,CAEU;IA/CvB,sDAKC;CACJ;;mBAIS,OAAO;qBAMP,OAAO;qBAMP,OAAO;sBAMP,OAAO;qBAMP,OAAO;oBAKP,OAAO;;;mBAlqBE,4BAA4B;4BAQnB,uBAAuB"}
|
package/src/core/geom/Vector2.js
CHANGED
|
@@ -20,10 +20,8 @@ import { v2_magnitude } from "./vec2/v2_magnitude.js";
|
|
|
20
20
|
class Vector2 {
|
|
21
21
|
/**
|
|
22
22
|
*
|
|
23
|
-
* @param {number} [x=0
|
|
23
|
+
* @param {number} [x=0]
|
|
24
24
|
* @param {number} [y=0]
|
|
25
|
-
* @property {number} x
|
|
26
|
-
* @property {number} y
|
|
27
25
|
* @constructor
|
|
28
26
|
*/
|
|
29
27
|
constructor(x = 0, y = 0) {
|
|
@@ -111,6 +109,11 @@ class Vector2 {
|
|
|
111
109
|
* @param {number} y
|
|
112
110
|
*/
|
|
113
111
|
setSilent(x, y) {
|
|
112
|
+
assert.isNumber(x, 'x');
|
|
113
|
+
assert.isNumber(y, 'y');
|
|
114
|
+
|
|
115
|
+
assert.notNaN(x, 'x');
|
|
116
|
+
assert.notNaN(y, 'y');
|
|
114
117
|
|
|
115
118
|
this.x = x;
|
|
116
119
|
this.y = y;
|
package/src/core/geom/Vector3.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Vector4.d.ts","sourceRoot":"","sources":["../../../../src/core/geom/Vector4.js"],"names":[],"mappings":"AAUA
|
|
1
|
+
{"version":3,"file":"Vector4.d.ts","sourceRoot":"","sources":["../../../../src/core/geom/Vector4.js"],"names":[],"mappings":";AAUA;IA2WI;;;;;;OAMG;IACH,gBALW,OAAO,MACP,OAAO,qBAEP,OAAO,QASjB;IAxXD;;;;;;;;OAQG;IACH,4DAOC;IANG,UAAU;IACV,UAAU;IACV,UAAU;IACV,UAAU;IAEV,eAA6B;IAGjC,gBAEC;IAED,gBAEC;IAED,gBAEC;IAED,gBAEC;IAED;;;;OAIG;IACH,qBAHW,MAAM,EAAE,WACR,MAAM,QAShB;IAED;;;;OAIG;IACH,oBAHW,MAAM,EAAE,WACR,MAAM,QAOhB;IAED;;;;;;;OAOG;IACH,iDAFa,OAAO,CAkCnB;IAED;;;OAGG;IACH,mCAMC;IAED;;;;OAIG;IACH,+BAFa,OAAO,CAOnB;IAED;;;;;;;;;;;;;;;;;;;OAmBG;IACH,kBAlBW,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,GACJ,OAAO,CAoBnB;IAED;;;;OAIG;IACH,WAHW,OAAO,GACL,MAAM,CAIlB;IAED;;;;OAIG;IACH,SAHW,UAAQ,OAAO,GACb,OAAO,CASnB;IAED;;;;OAIG;IACH,+BAFa,OAAO,CAUnB;IAED;;;;OAIG;IACH,WAHW,OAAO,GACL,OAAO,CAInB;IAED;;;OAGG;IACH,SAFa,OAAO,CAQnB;IAED;;;OAGG;IACH,qCAuBC;IAED;;;;OAIG;IACH,aAHW,OAAO,GACL,OAAO,CAInB;IAED;;;OAGG;IACH,QAFY,MAAM,CASjB;IAED;;;;OAIG;IACH,gBAJW,OAAO,MACP,OAAO,mBAKjB;IAED;;;OAGG;IACH,gBAFW,MAAM,EAAE,QAOlB;IAED;;OAEG;IACH,WAFa,MAAM,EAAE,CAQpB;IAED;;;;OAIG;IACH,mBAHW,MAAM,EAAE,UACR,MAAM,QAIhB;IAED;;;;;MAOC;IAED,0BAEC;IAED;;;OAGG;IACH,2CAKC;IAED;;;OAGG;IACH,6CAOC;IAED,sDAOC;CAiBJ"}
|
package/src/core/geom/Vector4.js
CHANGED
|
@@ -3,98 +3,11 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import { assert } from "../assert.js";
|
|
6
|
+
import { computeHashIntegerArray } from "../collection/array/computeHashIntegerArray.js";
|
|
6
7
|
import { Signal } from "../events/signal/Signal.js";
|
|
7
8
|
import { lerp } from "../math/lerp.js";
|
|
8
|
-
import { computeHashIntegerArray } from "../collection/array/computeHashIntegerArray.js";
|
|
9
9
|
import { computeHashFloat } from "../primitives/numbers/computeHashFloat.js";
|
|
10
10
|
|
|
11
|
-
/**
|
|
12
|
-
*
|
|
13
|
-
* @param {number[]} result
|
|
14
|
-
* @param {number[]} input
|
|
15
|
-
* @param {number[]} mat4
|
|
16
|
-
*/
|
|
17
|
-
export function v4_applyMatrix4(result, input, mat4) {
|
|
18
|
-
const a0 = mat4[0];
|
|
19
|
-
const a1 = mat4[1];
|
|
20
|
-
const a2 = mat4[2];
|
|
21
|
-
const a3 = mat4[3];
|
|
22
|
-
|
|
23
|
-
const b0 = mat4[4];
|
|
24
|
-
const b1 = mat4[5];
|
|
25
|
-
const b2 = mat4[6];
|
|
26
|
-
const b3 = mat4[7];
|
|
27
|
-
|
|
28
|
-
const c0 = mat4[8];
|
|
29
|
-
const c1 = mat4[9];
|
|
30
|
-
const c2 = mat4[10];
|
|
31
|
-
const c3 = mat4[11];
|
|
32
|
-
|
|
33
|
-
const d0 = mat4[12];
|
|
34
|
-
const d1 = mat4[13];
|
|
35
|
-
const d2 = mat4[14];
|
|
36
|
-
const d3 = mat4[15];
|
|
37
|
-
|
|
38
|
-
const _x = input[0];
|
|
39
|
-
const _y = input[1];
|
|
40
|
-
const _z = input[2];
|
|
41
|
-
const _w = input[3];
|
|
42
|
-
|
|
43
|
-
const x = a0 * _x + b0 * _y + c0 * _z + d0 * _w;
|
|
44
|
-
const y = a1 * _x + b1 * _y + c1 * _z + d1 * _w;
|
|
45
|
-
const z = a2 * _x + b2 * _y + c2 * _z + d2 * _w;
|
|
46
|
-
const w = a3 * _x + b3 * _y + c3 * _z + d3 * _w;
|
|
47
|
-
|
|
48
|
-
result[0] = x;
|
|
49
|
-
result[1] = y;
|
|
50
|
-
result[2] = z;
|
|
51
|
-
result[3] = w;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
*
|
|
56
|
-
* @param {number} x0
|
|
57
|
-
* @param {number} y0
|
|
58
|
-
* @param {number} z0
|
|
59
|
-
* @param {number} w0
|
|
60
|
-
* @param {number} x1
|
|
61
|
-
* @param {number} y1
|
|
62
|
-
* @param {number} z1
|
|
63
|
-
* @param {number} w1
|
|
64
|
-
* @returns {number}
|
|
65
|
-
*/
|
|
66
|
-
export function v4_dot(x0, y0, z0, w0, x1, y1, z1, w1) {
|
|
67
|
-
return (x0 * x1 + y0 * y1 + z0 * z1 + w0 * w1);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
*
|
|
72
|
-
* @param {number} x
|
|
73
|
-
* @param {number} y
|
|
74
|
-
* @param {number} z
|
|
75
|
-
* @param {number} w
|
|
76
|
-
* @returns {number}
|
|
77
|
-
*/
|
|
78
|
-
export function v4_length_sqr(x, y, z, w) {
|
|
79
|
-
return x * x + y * y + z * z + w * w;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
*
|
|
84
|
-
* @param {number} x0
|
|
85
|
-
* @param {number} y0
|
|
86
|
-
* @param {number} z0
|
|
87
|
-
* @param {number} w0
|
|
88
|
-
* @param {number} x1
|
|
89
|
-
* @param {number} y1
|
|
90
|
-
* @param {number} z1
|
|
91
|
-
* @param {number} w1
|
|
92
|
-
* @returns {number}
|
|
93
|
-
*/
|
|
94
|
-
export function v4_distance_sqr(x0, y0, z0, w0, x1, y1, z1, w1) {
|
|
95
|
-
return v4_length_sqr(x0 - x1, y0 - y1, z0 - z1, w0 - w1);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
11
|
class Vector4 {
|
|
99
12
|
/**
|
|
100
13
|
*
|
|
@@ -188,7 +101,10 @@ class Vector4 {
|
|
|
188
101
|
this.w = w;
|
|
189
102
|
|
|
190
103
|
if (this.onChanged.hasHandlers()) {
|
|
191
|
-
this.onChanged.
|
|
104
|
+
this.onChanged.send8(
|
|
105
|
+
x, y, z, w,
|
|
106
|
+
_x, _y, _z, _w
|
|
107
|
+
);
|
|
192
108
|
}
|
|
193
109
|
}
|
|
194
110
|
|
|
@@ -213,8 +129,8 @@ class Vector4 {
|
|
|
213
129
|
* @returns {Vector4}
|
|
214
130
|
*/
|
|
215
131
|
multiplyScalar(value) {
|
|
216
|
-
assert.
|
|
217
|
-
assert.
|
|
132
|
+
assert.isNumber(value, 'value');
|
|
133
|
+
assert.notNaN(value, 'value');
|
|
218
134
|
|
|
219
135
|
return this.set(this.x * value, this.y * value, this.z * value, this.w * value);
|
|
220
136
|
}
|
|
@@ -274,7 +190,12 @@ class Vector4 {
|
|
|
274
190
|
* @returns {Vector4}
|
|
275
191
|
*/
|
|
276
192
|
add3(v3) {
|
|
277
|
-
return this.set(
|
|
193
|
+
return this.set(
|
|
194
|
+
this.x + v3.x,
|
|
195
|
+
this.y + v3.y,
|
|
196
|
+
this.z + v3.z,
|
|
197
|
+
this.w
|
|
198
|
+
);
|
|
278
199
|
}
|
|
279
200
|
|
|
280
201
|
/**
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"v3_angle_cos_between.spec.d.ts","sourceRoot":"","sources":["../../../../../src/core/geom/vec3/v3_angle_cos_between.spec.js"],"names":[],"mappings":""}
|
|
@@ -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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @param {number} x0
|
|
4
|
+
* @param {number} y0
|
|
5
|
+
* @param {number} z0
|
|
6
|
+
* @param {number} w0
|
|
7
|
+
* @param {number} x1
|
|
8
|
+
* @param {number} y1
|
|
9
|
+
* @param {number} z1
|
|
10
|
+
* @param {number} w1
|
|
11
|
+
* @returns {number}
|
|
12
|
+
*/
|
|
13
|
+
export function v4_distance_sqr(x0: number, y0: number, z0: number, w0: number, x1: number, y1: number, z1: number, w1: number): number;
|
|
14
|
+
//# sourceMappingURL=v4_distance_sqr.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"v4_distance_sqr.d.ts","sourceRoot":"","sources":["../../../../../src/core/geom/vec4/v4_distance_sqr.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AACH,oCAVW,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,GACJ,MAAM,CAOlB"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { v4_length_sqr } from "./v4_length_sqr.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @param {number} x0
|
|
6
|
+
* @param {number} y0
|
|
7
|
+
* @param {number} z0
|
|
8
|
+
* @param {number} w0
|
|
9
|
+
* @param {number} x1
|
|
10
|
+
* @param {number} y1
|
|
11
|
+
* @param {number} z1
|
|
12
|
+
* @param {number} w1
|
|
13
|
+
* @returns {number}
|
|
14
|
+
*/
|
|
15
|
+
export function v4_distance_sqr(
|
|
16
|
+
x0, y0, z0, w0,
|
|
17
|
+
x1, y1, z1, w1
|
|
18
|
+
) {
|
|
19
|
+
return v4_length_sqr(x0 - x1, y0 - y1, z0 - z1, w0 - w1);
|
|
20
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @param {number} x0
|
|
4
|
+
* @param {number} y0
|
|
5
|
+
* @param {number} z0
|
|
6
|
+
* @param {number} w0
|
|
7
|
+
* @param {number} x1
|
|
8
|
+
* @param {number} y1
|
|
9
|
+
* @param {number} z1
|
|
10
|
+
* @param {number} w1
|
|
11
|
+
* @returns {number}
|
|
12
|
+
*/
|
|
13
|
+
export function v4_dot(x0: number, y0: number, z0: number, w0: number, x1: number, y1: number, z1: number, w1: number): number;
|
|
14
|
+
//# sourceMappingURL=v4_dot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"v4_dot.d.ts","sourceRoot":"","sources":["../../../../../src/core/geom/vec4/v4_dot.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,2BAVW,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,GACJ,MAAM,CAQlB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @param {number} x0
|
|
4
|
+
* @param {number} y0
|
|
5
|
+
* @param {number} z0
|
|
6
|
+
* @param {number} w0
|
|
7
|
+
* @param {number} x1
|
|
8
|
+
* @param {number} y1
|
|
9
|
+
* @param {number} z1
|
|
10
|
+
* @param {number} w1
|
|
11
|
+
* @returns {number}
|
|
12
|
+
*/
|
|
13
|
+
export function v4_dot(
|
|
14
|
+
x0, y0, z0, w0,
|
|
15
|
+
x1, y1, z1, w1
|
|
16
|
+
) {
|
|
17
|
+
|
|
18
|
+
return (x0 * x1 + y0 * y1 + z0 * z1 + w0 * w1);
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"v4_length_sqr.d.ts","sourceRoot":"","sources":["../../../../../src/core/geom/vec4/v4_length_sqr.js"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,iCANW,MAAM,KACN,MAAM,KACN,MAAM,KACN,MAAM,GACJ,MAAM,CAIlB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"v4_multiply_mat4.d.ts","sourceRoot":"","sources":["../../../../../src/core/geom/vec4/v4_multiply_mat4.js"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,yCAJW,MAAM,EAAE,SACR,MAAM,EAAE,QACR,MAAM,EAAE,QAqClB"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @param {number[]} result
|
|
4
|
+
* @param {number[]} input
|
|
5
|
+
* @param {number[]} mat4
|
|
6
|
+
*/
|
|
7
|
+
export function v4_multiply_mat4(result, input, mat4) {
|
|
8
|
+
const a0 = mat4[0];
|
|
9
|
+
const a1 = mat4[1];
|
|
10
|
+
const a2 = mat4[2];
|
|
11
|
+
const a3 = mat4[3];
|
|
12
|
+
|
|
13
|
+
const b0 = mat4[4];
|
|
14
|
+
const b1 = mat4[5];
|
|
15
|
+
const b2 = mat4[6];
|
|
16
|
+
const b3 = mat4[7];
|
|
17
|
+
|
|
18
|
+
const c0 = mat4[8];
|
|
19
|
+
const c1 = mat4[9];
|
|
20
|
+
const c2 = mat4[10];
|
|
21
|
+
const c3 = mat4[11];
|
|
22
|
+
|
|
23
|
+
const d0 = mat4[12];
|
|
24
|
+
const d1 = mat4[13];
|
|
25
|
+
const d2 = mat4[14];
|
|
26
|
+
const d3 = mat4[15];
|
|
27
|
+
|
|
28
|
+
const _x = input[0];
|
|
29
|
+
const _y = input[1];
|
|
30
|
+
const _z = input[2];
|
|
31
|
+
const _w = input[3];
|
|
32
|
+
|
|
33
|
+
const x = a0 * _x + b0 * _y + c0 * _z + d0 * _w;
|
|
34
|
+
const y = a1 * _x + b1 * _y + c1 * _z + d1 * _w;
|
|
35
|
+
const z = a2 * _x + b2 * _y + c2 * _z + d2 * _w;
|
|
36
|
+
const w = a3 * _x + b3 * _y + c3 * _z + d3 * _w;
|
|
37
|
+
|
|
38
|
+
result[0] = x;
|
|
39
|
+
result[1] = y;
|
|
40
|
+
result[2] = z;
|
|
41
|
+
result[3] = w;
|
|
42
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compileReactiveExpression.d.ts","sourceRoot":"","sources":["../../../../../src/core/lang/reactive/compileReactiveExpression.js"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,
|
|
1
|
+
{"version":3,"file":"compileReactiveExpression.d.ts","sourceRoot":"","sources":["../../../../../src/core/lang/reactive/compileReactiveExpression.js"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,4EAMC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReactivePegCompiler.d.ts","sourceRoot":"","sources":["../../../../../../src/core/lang/reactive/pegjs/ReactivePegCompiler.js"],"names":[],"mappings":"
|
|
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
|
|
114
|
+
const node_type = node.type;
|
|
114
115
|
|
|
115
|
-
|
|
116
|
-
}
|
|
116
|
+
assert.isString(node_type, 'node.type');
|
|
117
117
|
|
|
118
|
-
|
|
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
|