@truelab/truengine 6.0.0 → 7.0.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 (35) hide show
  1. package/dist/browserAll-chunk.js +6 -6
  2. package/dist/index-chunk2.js +190 -0
  3. package/dist/index-chunk3.js +25211 -0
  4. package/dist/libs/particles.js +1 -1
  5. package/dist/libs/pixi.js +27 -27
  6. package/dist/pixi-chunk.js +208 -208
  7. package/dist/truengine.js +255 -24930
  8. package/dist/types/src/classes/borderview.class.d.ts +15 -3
  9. package/dist/types/src/classes/borderview.class.d.ts.map +1 -1
  10. package/dist/types/src/classes/engine.class.d.ts.map +1 -1
  11. package/dist/types/src/classes/producer.class.d.ts.map +1 -1
  12. package/dist/types/src/components/animation.catalog.d.ts +7 -0
  13. package/dist/types/src/components/animation.catalog.d.ts.map +1 -1
  14. package/dist/types/src/components/cheat.panel.animations.d.ts +4 -2
  15. package/dist/types/src/components/cheat.panel.animations.d.ts.map +1 -1
  16. package/dist/types/src/components/slot/reel.component.d.ts +67 -18
  17. package/dist/types/src/components/slot/reel.component.d.ts.map +1 -1
  18. package/dist/types/src/components/slot/slot.component.d.ts +7 -0
  19. package/dist/types/src/components/slot/slot.component.d.ts.map +1 -1
  20. package/dist/types/src/components/slot/slot.config.d.ts.map +1 -1
  21. package/dist/types/src/components/slot/symbol/symbol.component.d.ts +3 -0
  22. package/dist/types/src/components/slot/symbol/symbol.component.d.ts.map +1 -1
  23. package/dist/types/src/components/slot/symbol/symbol.motion.blur.d.ts +65 -0
  24. package/dist/types/src/components/slot/symbol/symbol.motion.blur.d.ts.map +1 -0
  25. package/dist/types/src/components/text.component.d.ts +15 -2
  26. package/dist/types/src/components/text.component.d.ts.map +1 -1
  27. package/dist/types/src/functions/placement.funcs.d.ts +24 -0
  28. package/dist/types/src/functions/placement.funcs.d.ts.map +1 -0
  29. package/dist/types/src/functions/text/complexscript.func.d.ts +7 -0
  30. package/dist/types/src/functions/text/complexscript.func.d.ts.map +1 -0
  31. package/dist/types/src/index.d.ts +3 -0
  32. package/dist/types/src/index.d.ts.map +1 -1
  33. package/dist/types/src/scenes/background.scene.d.ts.map +1 -1
  34. package/dist/webworkerAll-chunk.js +1 -1
  35. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
- import { e as a, A as e, C as i, a as s, D as t, E as n, F as d } from "./pixi-chunk.js";
1
+ import { e as i, A as e, C as a, b as s, D as t, E as n, c as d } from "./pixi-chunk.js";
2
2
  import "./webworkerAll-chunk.js";
3
- a.add(e);
4
- a.mixin(i, s);
5
- a.add(t);
6
- a.add(n);
7
- a.mixin(i, d);
3
+ i.add(e);
4
+ i.mixin(a, s);
5
+ i.add(t);
6
+ i.add(n);
7
+ i.mixin(a, d);
@@ -0,0 +1,190 @@
1
+ import { F as a, O as c, d as m, G as v, a as y } from "./pixi-chunk.js";
2
+ import { w as p, v as S } from "./index-chunk3.js";
3
+ var x = `precision highp float;
4
+ in vec2 vTextureCoord;
5
+ out vec4 finalColor;
6
+
7
+ uniform sampler2D uTexture;
8
+ uniform vec2 uVelocity;
9
+ uniform int uKernelSize;
10
+ uniform float uOffset;
11
+
12
+ uniform vec4 uInputSize;
13
+
14
+ const int MAX_KERNEL_SIZE = 2048;
15
+
16
+ // Notice:
17
+ // the perfect way:
18
+ // int kernelSize = min(uKernelSize, MAX_KERNELSIZE);
19
+ // BUT in real use-case , uKernelSize < MAX_KERNELSIZE almost always.
20
+ // So use uKernelSize directly.
21
+
22
+ void main(void)
23
+ {
24
+ vec4 color = texture(uTexture, vTextureCoord);
25
+
26
+ if (uKernelSize == 0)
27
+ {
28
+ finalColor = color;
29
+ return;
30
+ }
31
+
32
+ vec2 velocity = uVelocity / uInputSize.xy;
33
+ float offset = -uOffset / length(uVelocity) - 0.5;
34
+ int k = uKernelSize - 1;
35
+
36
+ for(int i = 0; i < MAX_KERNEL_SIZE - 1; i++) {
37
+ if (i == k) {
38
+ break;
39
+ }
40
+ vec2 bias = velocity * (float(i) / float(k) + offset);
41
+ color += texture(uTexture, vTextureCoord + bias);
42
+ }
43
+ finalColor = color / float(uKernelSize);
44
+ }
45
+ `, h = `struct MotionBlurUniforms {
46
+ uVelocity: vec2<f32>,
47
+ uKernelSize: i32,
48
+ uOffset: f32,
49
+ };
50
+
51
+ struct GlobalFilterUniforms {
52
+ uInputSize:vec4<f32>,
53
+ uInputPixel:vec4<f32>,
54
+ uInputClamp:vec4<f32>,
55
+ uOutputFrame:vec4<f32>,
56
+ uGlobalFrame:vec4<f32>,
57
+ uOutputTexture:vec4<f32>,
58
+ };
59
+
60
+ @group(0) @binding(0) var<uniform> gfu: GlobalFilterUniforms;
61
+
62
+ @group(0) @binding(1) var uTexture: texture_2d<f32>;
63
+ @group(0) @binding(2) var uSampler: sampler;
64
+ @group(1) @binding(0) var<uniform> motionBlurUniforms : MotionBlurUniforms;
65
+
66
+ @fragment
67
+ fn mainFragment(
68
+ @builtin(position) position: vec4<f32>,
69
+ @location(0) uv : vec2<f32>
70
+ ) -> @location(0) vec4<f32> {
71
+ let uVelocity = motionBlurUniforms.uVelocity;
72
+ let uKernelSize = motionBlurUniforms.uKernelSize;
73
+ let uOffset = motionBlurUniforms.uOffset;
74
+
75
+ let velocity: vec2<f32> = uVelocity / gfu.uInputSize.xy;
76
+ let offset: f32 = -uOffset / length(uVelocity) - 0.5;
77
+ let k: i32 = min(uKernelSize - 1, MAX_KERNEL_SIZE - 1);
78
+
79
+ var color: vec4<f32> = textureSample(uTexture, uSampler, uv);
80
+
81
+ for(var i: i32 = 0; i < k; i += 1) {
82
+ let bias: vec2<f32> = velocity * (f32(i) / f32(k) + offset);
83
+ color += textureSample(uTexture, uSampler, uv + bias);
84
+ }
85
+
86
+ return select(color / f32(uKernelSize), textureSample(uTexture, uSampler, uv), uKernelSize == 0);
87
+ }
88
+
89
+ const MAX_KERNEL_SIZE: i32 = 2048;`, z = Object.defineProperty, g = (n, e, t) => e in n ? z(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, i = (n, e, t) => (g(n, typeof e != "symbol" ? e + "" : e, t), t);
90
+ const r = class o extends a {
91
+ /** @ignore */
92
+ constructor(...e) {
93
+ let t = e[0] ?? {};
94
+ if (Array.isArray(t) || "x" in t && "y" in t || t instanceof c) {
95
+ m("6.0.0", "MotionBlurFilter constructor params are now options object. See params: { velocity, kernelSize, offset }");
96
+ const s = "x" in t ? t.x : t[0], f = "y" in t ? t.y : t[1];
97
+ t = { velocity: { x: s, y: f } }, e[1] !== void 0 && (t.kernelSize = e[1]), e[2] !== void 0 && (t.offset = e[2]);
98
+ }
99
+ t = { ...o.DEFAULT_OPTIONS, ...t };
100
+ const u = v.from({
101
+ vertex: {
102
+ source: p,
103
+ entryPoint: "mainVertex"
104
+ },
105
+ fragment: {
106
+ source: h,
107
+ entryPoint: "mainFragment"
108
+ }
109
+ }), l = y.from({
110
+ vertex: S,
111
+ fragment: x,
112
+ name: "motion-blur-filter"
113
+ });
114
+ super({
115
+ gpuProgram: u,
116
+ glProgram: l,
117
+ resources: {
118
+ motionBlurUniforms: {
119
+ uVelocity: { value: { x: 0, y: 0 }, type: "vec2<f32>" },
120
+ uKernelSize: { value: Math.trunc(t.kernelSize ?? 5), type: "i32" },
121
+ uOffset: { value: t.offset, type: "f32" }
122
+ }
123
+ }
124
+ }), i(this, "uniforms"), i(this, "_kernelSize"), this.uniforms = this.resources.motionBlurUniforms.uniforms, Object.assign(this, t);
125
+ }
126
+ /**
127
+ * Sets the velocity of the motion for blur effect
128
+ * This should be a size 2 array or an object containing `x` and `y` values, you cannot change types
129
+ * once defined in the constructor
130
+ * @default {x:0,y:0}
131
+ */
132
+ get velocity() {
133
+ return this.uniforms.uVelocity;
134
+ }
135
+ set velocity(e) {
136
+ Array.isArray(e) && (e = { x: e[0], y: e[1] }), this.uniforms.uVelocity = e, this._updateDirty();
137
+ }
138
+ /**
139
+ * Sets the velocity of the motion for blur effect on the `x` axis
140
+ * @default 0
141
+ */
142
+ get velocityX() {
143
+ return this.velocity.x;
144
+ }
145
+ set velocityX(e) {
146
+ this.velocity.x = e, this._updateDirty();
147
+ }
148
+ /**
149
+ * Sets the velocity of the motion for blur effect on the `x` axis
150
+ * @default 0
151
+ */
152
+ get velocityY() {
153
+ return this.velocity.y;
154
+ }
155
+ set velocityY(e) {
156
+ this.velocity.y = e, this._updateDirty();
157
+ }
158
+ /**
159
+ * The kernelSize of the blur filter. Must be odd number >= 5
160
+ * @default 5
161
+ */
162
+ get kernelSize() {
163
+ return this._kernelSize;
164
+ }
165
+ set kernelSize(e) {
166
+ this._kernelSize = e, this._updateDirty();
167
+ }
168
+ /**
169
+ * The offset of the blur filter
170
+ * @default 0
171
+ */
172
+ get offset() {
173
+ return this.uniforms.uOffset;
174
+ }
175
+ set offset(e) {
176
+ this.uniforms.uOffset = e;
177
+ }
178
+ _updateDirty() {
179
+ this.padding = (Math.max(Math.abs(this.velocityX), Math.abs(this.velocityY)) >> 0) + 1, this.uniforms.uKernelSize = this.velocityX !== 0 || this.velocityY !== 0 ? this._kernelSize : 0;
180
+ }
181
+ };
182
+ i(r, "DEFAULT_OPTIONS", {
183
+ velocity: { x: 0, y: 0 },
184
+ kernelSize: 5,
185
+ offset: 0
186
+ });
187
+ let b = r;
188
+ export {
189
+ b as MotionBlurFilter
190
+ };