@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
|
@@ -23,23 +23,29 @@ const vertexShader = `
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
vec2 project(vec4 device){
|
|
26
|
-
vec3 device_normal = device.xyz/device.w;
|
|
26
|
+
vec3 device_normal = device.xyz / device.w;
|
|
27
27
|
vec2 clip_pos = (device_normal*0.5+0.5).xy;
|
|
28
28
|
return clip_pos * resolution;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
vec4 unproject(vec2 screen, float z, float w){
|
|
32
|
-
vec2 clip_pos = screen/resolution;
|
|
32
|
+
vec2 clip_pos = screen / resolution;
|
|
33
33
|
vec2 device_normal = clip_pos*2.0-1.0;
|
|
34
|
-
return vec4(device_normal*w, z, w);
|
|
34
|
+
return vec4( device_normal * w, z, w);
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
float estimateScale(vec3 position, vec2 sPosition){
|
|
38
|
-
|
|
38
|
+
|
|
39
|
+
vec4 view_pos = modelViewMatrix * vec4( position, 1.0 );
|
|
40
|
+
|
|
39
41
|
float halfWidth = thickness*0.5;
|
|
40
|
-
|
|
42
|
+
|
|
43
|
+
vec4 scale_pos = view_pos - vec4( normalize(view_pos.xy) * halfWidth, 0.0, 0.0);
|
|
44
|
+
|
|
41
45
|
vec2 screen_scale_pos = project(projectionMatrix * scale_pos);
|
|
42
|
-
|
|
46
|
+
|
|
47
|
+
return distance( sPosition, screen_scale_pos );
|
|
48
|
+
|
|
43
49
|
}
|
|
44
50
|
|
|
45
51
|
void main(){
|
|
@@ -52,25 +58,26 @@ const vertexShader = `
|
|
|
52
58
|
vec2 normal1 = normalize(sLast - sCurrent);
|
|
53
59
|
vec2 normal2 = normalize(sCurrent - sNext);
|
|
54
60
|
|
|
55
|
-
|
|
61
|
+
// vector between two segments
|
|
62
|
+
vec2 normal = (normal1 + normal2) * 0.5;
|
|
56
63
|
|
|
57
64
|
float offset_signed = off*2.0 - 1.0;
|
|
58
65
|
|
|
59
|
-
vUv = vec2(uv_offset,
|
|
66
|
+
vUv = vec2(uv_offset, off);
|
|
60
67
|
|
|
61
|
-
float relativeAge = clamp(age/maxAge, 0.0, 1.0);
|
|
68
|
+
float relativeAge = clamp(age / maxAge, 0.0, 1.0);
|
|
62
69
|
|
|
63
|
-
vColor = vec4(color/ 255.0, alpha);
|
|
70
|
+
vColor = vec4( color / 255.0, alpha );
|
|
64
71
|
|
|
65
72
|
vec2 dir = vec2(normal.y, -normal.x) * offset_signed;
|
|
66
73
|
|
|
67
|
-
float angular_compensation = max( normal.x*normal.x + normal.y*normal.y, 0.25 );
|
|
74
|
+
float angular_compensation = max( normal.x * normal.x + normal.y * normal.y, 0.25 );
|
|
68
75
|
|
|
69
76
|
float visual_size = resolution.y * projectionMatrix[1][1] * thickness*0.5 / dCurrent.w;
|
|
70
77
|
|
|
71
78
|
float scale = visual_size / angular_compensation;
|
|
72
79
|
|
|
73
|
-
vec2 pos = sCurrent + dir*scale;
|
|
80
|
+
vec2 pos = sCurrent + dir * scale;
|
|
74
81
|
|
|
75
82
|
gl_Position = unproject(pos, dCurrent.z, dCurrent.w);
|
|
76
83
|
}
|
|
@@ -101,7 +108,7 @@ export class RibbonMaterialX extends ShaderMaterial {
|
|
|
101
108
|
vertexShader,
|
|
102
109
|
uniforms: {
|
|
103
110
|
resolution: {
|
|
104
|
-
value: new Vector2(
|
|
111
|
+
value: new Vector2(600, 600)
|
|
105
112
|
},
|
|
106
113
|
uDiffuse: {
|
|
107
114
|
type: 't',
|
|
@@ -121,10 +128,18 @@ export class RibbonMaterialX extends ShaderMaterial {
|
|
|
121
128
|
this.setValues(params);
|
|
122
129
|
}
|
|
123
130
|
|
|
131
|
+
/**
|
|
132
|
+
*
|
|
133
|
+
* @param {Vector2} v2
|
|
134
|
+
*/
|
|
124
135
|
set resolution(v2) {
|
|
125
136
|
this.uniforms.resolution.value.set(v2.x, v2.y);
|
|
126
137
|
}
|
|
127
138
|
|
|
139
|
+
/**
|
|
140
|
+
*
|
|
141
|
+
* @return {Vector2}
|
|
142
|
+
*/
|
|
128
143
|
get resolution() {
|
|
129
144
|
return this.uniforms.resolution.value;
|
|
130
145
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { assert } from "../../../core/assert.js";
|
|
2
|
-
import { v4_applyMatrix4 } from "../../../core/geom/Vector4.js";
|
|
3
2
|
import { v3_dot } from "../../../core/geom/vec3/v3_dot.js";
|
|
3
|
+
import { v4_multiply_mat4 } from "../../../core/geom/vec4/v4_multiply_mat4.js";
|
|
4
4
|
|
|
5
5
|
const v4 = [];
|
|
6
6
|
|
|
@@ -21,7 +21,7 @@ export function projectSphere(sph, cam, fl) {
|
|
|
21
21
|
v4[3] = 1;
|
|
22
22
|
|
|
23
23
|
//transform to camera space
|
|
24
|
-
|
|
24
|
+
v4_multiply_mat4(v4, v4, cam.elements);
|
|
25
25
|
|
|
26
26
|
const r2 = sph.w * sph.w;
|
|
27
27
|
|
|
@@ -50,7 +50,7 @@ export function v3_compute_perspective_divide(v3, matrix) {
|
|
|
50
50
|
v4[3] = 1;
|
|
51
51
|
|
|
52
52
|
//transform sphere center to camera space
|
|
53
|
-
|
|
53
|
+
v4_multiply_mat4(v4, v4, matrix);
|
|
54
54
|
|
|
55
55
|
const v4_w = v4[3];
|
|
56
56
|
|
|
@@ -73,7 +73,7 @@ export function compute_projected_sphere_radius_sqr(fl, matrix, sph) {
|
|
|
73
73
|
v4[3] = 1;
|
|
74
74
|
|
|
75
75
|
//transform sphere center to camera space
|
|
76
|
-
|
|
76
|
+
v4_multiply_mat4(v4, v4, matrix);
|
|
77
77
|
|
|
78
78
|
const r2 = sph[3] * sph[3];
|
|
79
79
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GoogleAnalyticsMetrics.d.ts","sourceRoot":"","sources":["../../../../src/engine/metrics/GoogleAnalyticsMetrics.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"GoogleAnalyticsMetrics.d.ts","sourceRoot":"","sources":["../../../../src/engine/metrics/GoogleAnalyticsMetrics.js"],"names":[],"mappings":"AAIA;IACI,sBAOC;IAJG;;MAEC;IAIL,oCAYC;CACJ;+BA1B8B,qBAAqB"}
|
|
@@ -1,46 +1,15 @@
|
|
|
1
|
+
import { loadGTAG } from "../google/loadGTAG.js";
|
|
1
2
|
import { MetricsGateway } from "./MetricsGateway.js";
|
|
2
3
|
|
|
3
|
-
// const GOOGLE_ANALYTICS_KEY = 'UA-66021000-1'; //Lazy-Kitty.com
|
|
4
|
-
// const GOOGLE_ANALYTICS_KEY = 'UA-138821093-1'; //Itch.com
|
|
5
|
-
const GOOGLE_ANALYTICS_KEY = 'G-ZBGZD4ZMZ1'; //ASKARA
|
|
6
|
-
|
|
7
|
-
function loadGTAG(MEASUREMENT_ID) {
|
|
8
|
-
|
|
9
|
-
(function (target, s, domTag, sourceURL) {
|
|
10
|
-
|
|
11
|
-
const a = s.createElement(domTag);
|
|
12
|
-
const m = s.getElementsByTagName(domTag)[0];
|
|
13
|
-
|
|
14
|
-
a.async = 1;
|
|
15
|
-
a.src = sourceURL;
|
|
16
|
-
|
|
17
|
-
m.parentNode.insertBefore(a, m)
|
|
18
|
-
})(document, document, 'script', `https://www.googletagmanager.com/gtag/js?id=${MEASUREMENT_ID}`);
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
window.dataLayer = window.dataLayer || [];
|
|
22
|
-
|
|
23
|
-
function gtag() {
|
|
24
|
-
dataLayer.push(arguments);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
gtag('js', new Date());
|
|
28
|
-
|
|
29
|
-
gtag('config', MEASUREMENT_ID);
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
return gtag;
|
|
33
|
-
}
|
|
34
4
|
|
|
35
5
|
export class GoogleAnalyticsMetrics extends MetricsGateway {
|
|
36
|
-
constructor() {
|
|
6
|
+
constructor(key) {
|
|
37
7
|
super();
|
|
38
8
|
|
|
39
9
|
this.api = {
|
|
40
|
-
gtag: loadGTAG(
|
|
10
|
+
gtag: loadGTAG(key)
|
|
41
11
|
};
|
|
42
12
|
|
|
43
|
-
|
|
44
13
|
}
|
|
45
14
|
|
|
46
15
|
record(type, event) {
|
|
@@ -54,10 +23,6 @@ export class GoogleAnalyticsMetrics extends MetricsGateway {
|
|
|
54
23
|
payload.event_label = event.label;
|
|
55
24
|
}
|
|
56
25
|
|
|
57
|
-
|
|
58
|
-
this.api.gtag('event', type, payload);
|
|
59
|
-
} else {
|
|
60
|
-
console.log("[DEBUG] metric would be sent", type, payload);
|
|
61
|
-
}
|
|
26
|
+
this.api.gtag('event', type, payload);
|
|
62
27
|
}
|
|
63
28
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export default NotificationLog;
|
|
2
|
-
declare function NotificationLog(): void;
|
|
3
2
|
declare class NotificationLog {
|
|
4
3
|
/**
|
|
5
4
|
* @readonly
|
|
@@ -13,7 +12,7 @@ declare class NotificationLog {
|
|
|
13
12
|
maxLength: number;
|
|
14
13
|
/**
|
|
15
14
|
*
|
|
16
|
-
* @param {{}} options See Notification.constructor for details
|
|
15
|
+
* @param {{}} options See {@link Notification.constructor} for details
|
|
17
16
|
* @returns {Notification}
|
|
18
17
|
*/
|
|
19
18
|
add(options: {}): Notification;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationLog.d.ts","sourceRoot":"","sources":["../../../../src/engine/notify/NotificationLog.js"],"names":[],"mappings":";AASA
|
|
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
|
-
|
|
10
|
+
class NotificationLog {
|
|
11
11
|
/**
|
|
12
12
|
* @readonly
|
|
13
13
|
* @type {List<Notification>}
|
|
14
14
|
*/
|
|
15
|
-
|
|
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
|
-
|
|
22
|
-
}
|
|
21
|
+
maxLength = 1000;
|
|
23
22
|
|
|
24
|
-
/**
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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
|
-
|
|
31
|
+
this.addNotification(notification);
|
|
33
32
|
|
|
34
|
-
|
|
35
|
-
}
|
|
33
|
+
return notification;
|
|
34
|
+
}
|
|
36
35
|
|
|
37
|
-
/**
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
36
|
+
/**
|
|
37
|
+
*
|
|
38
|
+
* @param {Notification} notification
|
|
39
|
+
*/
|
|
40
|
+
addNotification(notification) {
|
|
41
|
+
assert.defined(notification, 'notification');
|
|
42
|
+
assert.notNull(notification, 'notification');
|
|
44
43
|
|
|
45
|
-
|
|
44
|
+
assert.ok(notification.isNotification, 'not a Notification');
|
|
46
45
|
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
// Crop notification log to size
|
|
47
|
+
const length = this.elements.length;
|
|
49
48
|
|
|
50
|
-
|
|
49
|
+
const target = this.maxLength - 1;
|
|
51
50
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
if (length > target) {
|
|
52
|
+
// too many elements, drop some
|
|
53
|
+
this.elements.crop(length - target, length);
|
|
54
|
+
}
|
|
55
55
|
|
|
56
|
-
|
|
57
|
-
}
|
|
56
|
+
this.elements.add(notification);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
58
59
|
|
|
59
60
|
export default NotificationLog;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"allocate_transform_m4.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/mat4/allocate_transform_m4.js"],"names":[],"mappings":"AAuBA;;;GAGG;AACH,yCAFa,YAAY,CAgBxB"}
|
|
@@ -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;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CodeflowTrailMaterial.d.ts","sourceRoot":"","sources":["../../../../../src/engine/graphics/trail/CodeflowTrailMaterial.js"],"names":[],"mappings":";AAoGA,oDA+BC;+BA3H4E,OAAO"}
|