Agent Harness · VibeGit
Agent Harness Публичная копия обвязки агентной разработки: гейты, journeys, скиллы и шаблоны. Без ключей и личных данных.
agent-harness / tools / spells-assets / ue / spells / void / portal.js 540 строк · изменён 6 нояб., 03:45
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
import * as THREE from 'three' ;
import { U , ARENA , COMMON_GLSL , NOISE_GLSL , FX_VERT_HEAD , FX_FRAG_HEAD , FX_OUT_GLSL , FX_BLENDING } from '../../vfx/common.js' ;
_a _b _h _sd _t
_col _s2 _M _F
_plane _clip _q4
x
t x a b a t t t
x x
x x x x x x x
fx
streamEm
jetEm
sparkEm
splashEm
moteIn
moteOut
popEm
smokeEm
rim core
quad
fx fx mobile
_s2
viewRT _s2 _s2
uView viewRT
vcam
vcam vcam
portals
i
rim
p portals
p portals p
p quad
p uView
p p camera
p quad
p
m p p m m
fx p
fx p
_b q q
out q _b q q q _b q q q _b q q
inView
inView camera fx
_s2
w _s2 h _s2
viewRT w viewRT h viewRT w h
_M _F _F
vcam _M camera
vcam vcam
vcam camera
_a vcam
_plane _b _a vcam
pe vcam
_clip _plane _plane _plane _plane
_q4 _clip pe pe _clip pe pe pe pe
_clip _clip _q4
pe _clip pe _clip pe _clip pe _clip
vcam vcam
x0 y0 x1 y1
_b
k k k
_a k _b k camera
_a x0 y0 x1 y1
x0 x0 _a x1 x1 _a y0 y0 _a y1 y1 _a
px0 x0 w py0 y0 h
px1 w x1 w py1 h y1 h
px1 px0 py1 py0
viewRT px0 py0 px1 px0 py1 py0
viewRT
inView
q portals q q q
prev auto ca
_col
viewRT
fx vcam
fx vcam
prev
_col ca
auto
q portals q q
inView
slots portals k portals k portals k portals k
s slots s s s
lastRim lastCore
p
p lastRim p lastCore
lastRim p lastCore p
rim p core p
core core rim
core rim
core _col rim
core rim
k k
x z radius amount pattern seed width
fx
pos r1 dist
fx
s s p
_h c c
_h _h
_h
_sd _h
dist c c c c
c _h dist c
_h
sg _t fx c _sd
c _h p _sd sg p
rr lim
rr lim lim rr lim rr
_t c c
_t
q s
q q
q c q
c lag c c
slit open
p
q slit
q open
q p
q slit c q
q q
rel c lag
rel q p rel c c rel
tl
tl
q tl
q tl
close tl
q q close
q close
q q close
tl q
tl
_b q q
_a q f half _b f half
em o _a em o _a
popEm q popEm p popEm p
smokeEm q smokeEm p smokeEm
q p
q q p p c q
q q q
k k
p d c
name
d d fx d fx d fx
d d d d
d d d d rim
d d d d d d
d d d d d d
s d
s
s c p
q s
q
q fx
q q q q q rim
q q p q rim
q fx
q fx
q q q q q s q q q p q
name
fx rim
fx
fx
s d
s
q s
q p
q q p p c q
fx _a q p rim
popEm q popEm popEm p
name
d d d
d d d
s d
s
q s
q q q
q q q q
s
d
fx _col
p d c s d
s
s s c c
tlA c p tlB c p
v p start c
tau start v rel c
c fx rim c
q s
open q q q p
q q q q q rim q q dt q q
q
q c
q c
q dt q
q q q
q q q q q open q open
open p
ang fx a2 ang sp q
rr q
sparkEm q q ang rr q _b q q ang rr
sparkEm q q a2 rr q _b a2 rr
_t sparkEm sparkEm
sparkEm _t sp _a sparkEm q
sparkEm p q q dt
c
k c
moteIn moteIn p moteIn k dt
moteOut moteOut moteOut moteOut k dt
inRate p rel outRate p rel tau
inRate
_t start
j j j
_t rel j p streamEm
streamEm v
streamEm start v
streamEm inRate dt
outRate
_t
j j j
_t rel tau j p jetEm
jetEm v
jetEm outRate dt
k outRate p
d d c d rim d k c
d dt
d
d
c
dm fx c
dm _a
dm _a p k
dm dm
c c p p k c c
splashEm c splashEm splashEm p k
d d dt
d rel tau c
d
dm fx c
dm _a dm _a p
fx _a c p rim
fx
oA oB
d d d oA
d d d d oB d d oB
tlA d d c p fx fx
tlB d d c p fx fx fx
c fx rim c
p
q portals
on q
q q on
on q
q q q q q
q q q q q
q q q q
q q q q q
q p q p q
const
MAX
=
2
;
const
UP
=
new
THREE. Vector3
(
0
,
1
,
0
)
;
const
RAW_FRAG_HEAD
=
`
precision highp float;
precision highp int;
precision highp sampler2D;
uniform mat4 projectionMatrix;
uniform mat4 viewMatrix;
uniform vec3 cameraPosition;
`
;
const
EDGE_GLSL
=
`
float portalEdge(float a, float seed, float instab) {
float e = 1.0 + 0.022 * sin(a * 5.0 + uTime * 3.7 + seed) + 0.016 * sin(a * 11.0 - uTime * 6.1 + seed * 2.0)
+ 0.05 * (noise3(vec3(cos(a) * 0.3, sin(a) * 0.3, uTime * 0.22 + seed * 0.013)) - 0.5);
return e + instab * (0.07 * sin(a * 3.0 + uTime * 23.0) + 0.05 * sin(a * 7.0 - uTime * 31.0));
}
// approximate signed distance (radius units) to the rim of the slit-to-disc ellipse; a = angle
float portalDist(vec2 q, float ox, float seed, float instab, out float a, out float re) {
vec2 qe = vec2(q.x / ox, q.y);
re = length(qe);
a = atan(qe.y, qe.x);
float g = length(vec2(q.x / (ox * ox), q.y)) / max(re, 1e-4);
return (re - portalEdge(a, seed, instab)) / max(g, 1e-4);
} `
;
const
SURF_VERT
=
FX_VERT_HEAD
+
COMMON_GLSL
+
`
uniform vec4 uC; // centre, radius (0 = hidden)
uniform vec4 uN; // normal, opening (x scale: slit -> disc)
uniform vec4 uU; // in-plane right axis
out vec3 vW;
out vec2 vQ;
void main() {
vec3 n = uN.xyz, u = uU.xyz, v = cross(n, u);
vQ = position.xy * vec2(max(uN.w, 0.03) * 1.15, 1.15);
vW = uC.xyz + (u * vQ.x + v * vQ.y) * uC.w;
gl_Position = uC.w > 0.0 ? projectionMatrix * viewMatrix * vec4(vW, 1.0) : vec4(2.0, 2.0, 2.0, 1.0);
} `
;
const
SURF_FRAG
=
RAW_FRAG_HEAD
+
COMMON_GLSL
+
NOISE_GLSL
+
EDGE_GLSL
+
`
uniform vec4 uC; uniform vec4 uN; uniform vec4 uU;
uniform vec4 uLook; // clarity, ripple, rim gain, seed
uniform vec4 uLook2; // swirl (distortion), view twist, -, instability
uniform vec3 uRim;
uniform sampler2D uView; // the scene seen out of the partner, rendered just before this draw
in vec3 vW;
in vec2 vQ;
out vec4 fragColor;
void main() {
float ox = max(uN.w, 0.03), a, re;
float d = portalDist(vQ, ox, uLook.w, uLook2.w, a, re);
if (d > 0.0) discard;
float e = -d, E = re - d;
// the membrane: a dark spiral nebula with a few stars, there while the portal opens and closes
float rn = clamp(re / max(E, 1e-3), 0.0, 1.0);
float sw = a + 2.2 / (rn + 0.3) - uTime * 1.1;
float neb = fbm3(vec3(cos(sw) * rn * 0.45, sin(sw) * rn * 0.45, uTime * 0.06 + uLook.w * 0.01));
vec3 col = uRim * (0.05 * pow(neb, 2.2) + 0.12 * pow(neb, 6.0)) + vec3(0.002, 0.0, 0.004);
col += vec3(0.8, 0.85, 1.0) * step(0.993, hash12(floor(vQ * 70.0) + uLook.w)) * (0.4 + 0.4 * sin(uTime * 4.0 + vQ.x * 30.0));
// the view: clears from the centre outwards with clarity. Space twists towards the rim and rings
// ripple out from the stream's entry point: sample where the displaced surface point projects
float reveal = smoothstep(0.0, 0.35, uLook.x * 1.35 - rn);
if (reveal > 0.0) {
vec3 n = uN.xyz, u = uU.xyz, v = cross(n, u);
float tw = uLook2.y * rn * rn * rn, c = cos(tw), s = sin(tw);
vec2 q = mat2(c, s, -s, c) * vQ;
float rl = length(q);
q += q / max(rl, 1e-3) * (uLook.y * 0.022 * sin(rl * 24.0 - uTime * 13.0) * exp(-rl * 2.2));
vec4 cl = projectionMatrix * viewMatrix * vec4(uC.xyz + (u * q.x + v * q.y) * uC.w, 1.0);
vec3 view = texture(uView, cl.xy / cl.w * 0.5 + 0.5).rgb;
col = mix(col, view, reveal);
}
// rim: darkens to violet-black, then the white-hot inner edge
float em = e * uC.w; // metres inside the rim
col = mix(uRim * 0.01, col, smoothstep(0.02, 0.16, em));
float crackle = 0.55 + 0.9 * noise3(vec3(a * 0.5, uTime * 1.4, uLook.w * 0.02));
col += (uRim * (exp(-em / 0.12) * 1.2) + mix(uRim, vec3(1.0), 0.6) * exp(-em / 0.022) * 5.0) * crackle * uLook.z;
fragColor = vec4(col, 1.0);
} `
;
const
RING_VERT
=
FX_VERT_HEAD
+
`
uniform vec4 uC; uniform vec4 uN; uniform vec4 uU;
out vec2 vQ;
out float vViewZ;
out vec2 vJu;
out vec2 vJv;
void main() {
vec3 n = uN.xyz, u = uU.xyz, v = cross(n, u);
float R = uC.w;
vQ = position.xy * vec2(max(uN.w, 0.03) * 1.1 + 0.6, 1.75);
vec3 w = uC.xyz + (u * vQ.x + v * vQ.y) * R;
w += normalize(cameraPosition - uC.xyz) * 0.05; // in front of the opaque surface
vec4 cv = viewMatrix * vec4(w, 1.0);
vViewZ = -cv.z;
gl_Position = R > 0.0 ? projectionMatrix * cv : vec4(2.0, 2.0, 2.0, 1.0);
mat4 vp = projectionMatrix * viewMatrix;
vec4 c0 = vp * vec4(uC.xyz, 1.0), cu = vp * vec4(uC.xyz + u * 0.1, 1.0), cw = vp * vec4(uC.xyz + v * 0.1, 1.0);
vJu = (cu.xy / cu.w - c0.xy / c0.w) * 5.0; // screen uv per metre along u, v
vJv = (cw.xy / cw.w - c0.xy / c0.w) * 5.0;
} `
;
const
RING_FRAG
=
FX_FRAG_HEAD
+
COMMON_GLSL
+
NOISE_GLSL
+
FX_OUT_GLSL
+
EDGE_GLSL
+
`
uniform vec4 uC; uniform vec4 uN;
uniform vec4 uLook; uniform vec4 uLook2;
uniform vec3 uRim;
in vec2 vQ;
in float vViewZ;
in vec2 vJu;
in vec2 vJv;
void main() {
float ox = max(uN.w, 0.03), a, re;
float dm = portalDist(vQ, ox, uLook.w, uLook2.w, a, re) * uC.w; // metres, > 0 outside
float ad = abs(dm), out_ = step(0.0, dm);
float fil = noise3(vec3(cos(a) * 0.4 + uTime * 0.03, sin(a) * 0.4, dm * 0.5 - uTime * 0.5 + uLook.w * 0.01));
fil = pow(clamp(fil * 1.7 - 0.45, 0.0, 1.0), 3.0);
vec3 e = uRim * uLook.z * (exp(-ad / 0.035) * 2.2 + out_ * (exp(-dm / 0.16) * 0.7 + fil * exp(-dm / 0.25) * 4.0));
// space dragged round the rim
vec2 qe = vec2(vQ.x / ox, vQ.y), tg = vec2(-qe.y, qe.x) / max(re, 1e-3);
float amt = uLook2.x * exp(-ad / 0.35) * smoothstep(-0.25, 0.0, dm) * uC.w;
vec2 dist = (vJu * tg.x + vJv * tg.y) * amt;
float s = softFade(vViewZ, 0.15);
fxOut(vec3(0.0), 0.0, e * s, dist * s, vViewZ);
} `
;
const
=
new
THREE. Vector3
(
)
,
=
new
THREE. Vector3
(
)
,
=
new
THREE. Vector3
(
)
,
=
new
THREE. Vector3
(
)
,
=
new
THREE. Vector3
(
)
;
const
=
new
THREE. Color
(
)
,
=
new
THREE. Vector2
(
)
,
=
new
THREE. Matrix4
(
)
,
=
new
THREE. Matrix4
(
)
;
const
=
new
THREE. Plane
(
)
,
=
new
THREE. Vector4
(
)
,
=
new
THREE. Vector4
(
)
;
const
FLIP
=
new
THREE. Matrix4
(
)
.
makeScale
(
-
1
,
1
,
-
1
)
;
const
SPLAT
=
{
x
:
0
,
z
:
0
,
radius
:
1
,
corruption
:
0
,
glow
:
0
,
pattern
:
'noise'
,
seed
:
0
,
width
:
0
}
;
const
SHOCK
=
{
pos
:
new
THREE. Vector3
(
)
,
radius0
:
0.2
,
radius1
:
3
,
duration
:
0.5
,
thickness
:
0.6
,
distortion
:
0.08
,
intensity
:
0
,
ground
:
false
,
color
:
null
}
;
const
SIGIL
=
{
pos
:
new
THREE. Vector3
(
)
,
radius
:
1
,
style
:
'void'
,
intensity
:
0
,
reveal
:
0
,
seed
:
0
,
color
:
null
}
;
const
clamp01
=
(
x
)
=>
Math
.
min
(
1
,
Math
.
max
(
0
,
)
)
;
const
smooth
=
(
a, b, x
)
=>
{
const
=
clamp01
(
(
-
)
/
(
-
)
)
;
return
*
*
(
3
-
2
*
)
;
}
;
const
win
=
(
x, Ti
)
=>
smooth
(
0
,
0.12
,
)
*
(
1
-
smooth
(
Ti
-
0.5
,
Ti
-
0.3
,
)
)
;
const
backOut
=
(
x
)
=>
{
=
clamp01
(
)
-
1
;
return
1
+
2.4
*
*
*
+
1.4
*
*
;
}
;
export
default
{
id
:
'portal'
,
name
:
'Portal'
,
element
:
'void'
,
order
:
10
,
hue
:
'#8a3dff'
,
shape
:
'area'
,
radius
:
0.35
,
params
:
{
size
:
1
,
reach
:
1
,
speed
:
16
,
stream
:
1
,
sparks
:
1
,
clarity
:
1
,
swirl
:
1
,
ripple
:
1
,
knockback
:
1
,
corruption
:
1
,
rim
:
'#9a4dff'
,
core
:
'#efe4ff'
}
,
ranges
:
{
size
:
[
0.5
,
1.6
,
0.01
]
,
reach
:
[
0.6
,
1.8
,
0.01
]
,
speed
:
[
6
,
30
,
0.1
]
,
stream
:
[
0
,
3
,
0.01
]
,
sparks
:
[
0
,
3
,
0.01
]
,
clarity
:
[
0
,
1
,
0.01
]
,
swirl
:
[
0
,
3
,
0.01
]
,
ripple
:
[
0
,
3
,
0.01
]
,
knockback
:
[
0
,
3
,
0.01
]
,
corruption
:
[
0
,
3
,
0.01
]
}
,
presets
:
{
'event horizon'
:
{
rim
:
'#5a8cff'
,
core
:
'#e4f0ff'
,
ripple
:
2.2
,
swirl
:
0.6
,
sparks
:
0.4
}
,
'ember ring'
:
{
rim
:
'#ff7a1a'
,
core
:
'#fff0d8'
,
sparks
:
2.2
,
swirl
:
1.4
,
corruption
:
0.3
}
,
abyss
:
{
rim
:
'#ff2a60'
,
core
:
'#ffd6e0'
,
clarity
:
0.55
,
swirl
:
2
,
corruption
:
2
,
stream
:
1.6
}
,
}
,
timing
:
{
charge
:
1.2
,
impact
:
2.4
,
linger
:
2.0
}
,
kinds
:
{
stream
:
{
style
:
'glow'
,
drag
:
0
,
gravity
:
0
,
forceResponse
:
0
,
life
:
[
1
,
1
]
,
size
:
[
0.026
,
0.022
]
,
stretch
:
0.03
,
emissive
:
3.2
,
color
:
[
'#f1e9ff'
,
'#a670ff'
]
,
alpha
:
[
1
,
1
]
,
fadeIn
:
0.03
,
fadeOut
:
0.001
}
,
jet
:
{
style
:
'glow'
,
drag
:
0.4
,
gravity
:
2
,
forceResponse
:
0
,
restitution
:
0.25
,
friction
:
0.5
,
life
:
[
0.45
,
0.8
]
,
size
:
[
0.026
,
0.01
]
,
stretch
:
0.03
,
emissive
:
5
,
color
:
[
'#f1e9ff'
,
'#7b2dff'
]
,
alpha
:
[
1
,
0
]
,
fadeIn
:
0.001
,
fadeOut
:
0.35
,
morph
:
'portal.splash'
}
,
splash
:
{
style
:
'glow'
,
drag
:
1.3
,
gravity
:
7
,
forceResponse
:
0.5
,
restitution
:
0.3
,
friction
:
0.4
,
life
:
[
0.25
,
0.6
]
,
size
:
[
0.03
,
0.006
]
,
stretch
:
0.03
,
emissive
:
11
,
color
:
[
'#ffffff'
,
'#8a3dff'
]
,
alpha
:
[
1
,
0
]
,
paints
:
'corruption'
,
paintAmount
:
0.05
}
,
spark
:
{
style
:
'glow'
,
drag
:
0.35
,
gravity
:
2.4
,
forceResponse
:
1
,
restitution
:
0.3
,
friction
:
0.3
,
life
:
[
0.45
,
1.0
]
,
size
:
[
0.022
,
0.006
]
,
stretch
:
0.045
,
emissive
:
8
,
color
:
[
'#f4ecff'
,
'#8a3dff'
]
,
alpha
:
[
1
,
0
]
,
fadeIn
:
0.02
}
,
}
,
create
(
fx
)
{
const
S
=
this
,
P
=
.
particles
;
const
=
P
.
emitter
(
'portal.stream'
,
{
shape
:
'line'
,
radius
:
0.05
}
)
;
const
=
P
.
emitter
(
'portal.jet'
,
{
shape
:
'line'
,
radius
:
0.05
,
spread
:
0.7
}
)
;
const
=
P
.
emitter
(
'portal.spark'
,
{
shape
:
'line'
,
radius
:
0.03
,
spread
:
0.5
}
)
;
const
=
P
.
emitter
(
'portal.splash'
,
{
shape
:
'sphere'
,
radius
:
0.15
,
spread
:
3
,
radial
:
3
}
)
;
const
=
P
.
emitter
(
'void.mote'
,
{
shape
:
'shell'
,
radius
:
2.2
,
spread
:
0.3
,
radial
:
-
1.6
}
)
;
const
=
P
.
emitter
(
'void.mote'
,
{
shape
:
'cone'
,
radius
:
0.15
,
spread
:
0.4
,
radial
:
2.6
,
cone
:
0.9
}
)
;
const
=
P
.
emitter
(
'void.spark'
,
{
shape
:
'shell'
,
radius
:
0.25
,
spread
:
2
,
radial
:
7
}
)
;
const
=
P
.
emitter
(
'void.smoke'
,
{
shape
:
'sphere'
,
radius
:
0.4
,
spread
:
0.6
,
radial
:
1.5
}
)
;
const
=
new
THREE. Color
(
)
,
=
new
THREE. Color
(
)
;
const
=
new
THREE. PlaneGeometry
(
2
,
2
)
;
const
R
=
.
renderer
,
VIEW_SCALE
=
.
Q
?.
?
0.35
:
0.5
;
R
.
getDrawingBufferSize
(
)
;
const
=
new
THREE. WebGLRenderTarget
(
Math
.
ceil
(
.
x
*
VIEW_SCALE
)
,
Math
.
ceil
(
.
y
*
VIEW_SCALE
)
,
{
type
:
THREE
.
HalfFloatType
,
generateMipmaps
:
false
}
)
;
const
=
{
value
:
.
texture
}
;
const
=
new
THREE. PerspectiveCamera
(
)
;
.
matrixAutoUpdate
=
false
;
.
matrixWorldAutoUpdate
=
false
;
const
=
Array
.
from
(
{
length
:
MAX
*
2
}
,
(
_, i
)
=>
(
{
,
c
:
new
THREE. Vector3
(
)
,
n
:
new
THREE. Vector3
(
0
,
0
,
1
)
,
u
:
new
THREE. Vector3
(
1
,
0
,
0
)
,
R
:
0
,
ox
:
0.03
,
clarity
:
0
,
ripple
:
0
,
gain
:
0
,
instab
:
0
,
seed
:
0
,
light
:
null
,
sigil
:
null
,
orbit
:
null
,
partner
:
null
,
surf
:
null
,
ring
:
null
,
vis
:
false
,
su
:
{
uC
:
{
value
:
new
THREE. Vector4
(
)
}
,
uN
:
{
value
:
new
THREE. Vector4
(
)
}
,
uU
:
{
value
:
new
THREE. Vector4
(
)
}
,
uLook
:
{
value
:
new
THREE. Vector4
(
)
}
,
uLook2
:
{
value
:
new
THREE. Vector4
(
)
}
,
uRim
:
{
value
:
}
}
,
}
)
)
;
for
(
const
of
)
{
.
partner
=
[
.
i
^
1
]
;
.
surf
=
new
THREE. Mesh
(
,
new
THREE. RawShaderMaterial
(
{
glslVersion
:
THREE
.
GLSL3
,
vertexShader
:
SURF_VERT
,
fragmentShader
:
SURF_FRAG
,
side
:
THREE
.
DoubleSide
,
uniforms
:
{
...
U
,
...
.
su
,
}
,
}
)
)
;
.
surf
.
onBeforeRender
=
(
r, scene, camera
)
=>
renderView
(
,
)
;
.
ring
=
new
THREE. Mesh
(
,
new
THREE. RawShaderMaterial
(
{
glslVersion
:
THREE
.
GLSL3
,
vertexShader
:
RING_VERT
,
fragmentShader
:
RING_FRAG
,
...
FX_BLENDING
,
side
:
THREE
.
DoubleSide
,
uniforms
:
{
...
U
,
...
.
su
}
,
}
)
)
;
for
(
const
of
[
.
surf
,
.
ring
]
)
{
.
frustumCulled
=
false
;
.
visible
=
false
;
}
.
scenes
.
opaque
.
add
(
.
surf
)
;
.
scenes
.
fx
.
add
(
.
ring
)
;
}
function
frame
(
q, out
)
{
.
crossVectors
(
.
n
,
.
u
)
;
return
.
set
(
.
u
.
x
,
.
x
,
.
n
.
x
,
.
c
.
x
,
.
u
.
y
,
.
y
,
.
n
.
y
,
.
c
.
y
,
.
u
.
z
,
.
z
,
.
n
.
z
,
.
c
.
z
,
0
,
0
,
0
,
1
)
;
}
let
=
false
;
function
renderView
(
X , camera
)
{
if
(
||
!==
.
camera
||
X
.
R
<=
0.002
||
X
.
clarity
<=
0.001
)
return
;
const
Y
=
X
.
partner
;
R
.
getDrawingBufferSize
(
)
;
const
=
Math
.
ceil
(
.
x
*
VIEW_SCALE
)
,
=
Math
.
ceil
(
.
y
*
VIEW_SCALE
)
;
if
(
.
width
!==
||
.
height
!==
)
.
setSize
(
,
)
;
.
copy
(
frame
(
Y
,
)
)
.
multiply
(
FLIP
)
.
multiply
(
frame
(
X
,
)
.
invert
(
)
)
;
.
matrixWorld
.
multiplyMatrices
(
,
.
matrixWorld
)
;
.
matrixWorldInverse
.
copy
(
.
matrixWorld
)
.
invert
(
)
;
.
projectionMatrix
.
copy
(
.
projectionMatrix
)
;
.
setFromMatrixPosition
(
.
matrixWorld
)
.
sub
(
Y
.
c
)
;
.
setFromNormalAndCoplanarPoint
(
.
copy
(
Y
.
n
)
.
multiplyScalar
(
.
dot
(
Y
.
n
)
<
0
?
1
:
-
1
)
,
Y
.
c
)
.
applyMatrix4
(
.
matrixWorldInverse
)
;
const
=
.
projectionMatrix
.
elements
;
.
set
(
.
normal
.
x
,
.
normal
.
y
,
.
normal
.
z
,
.
constant
)
;
.
set
(
(
Math
.
sign
(
.
x
)
+
[
8
]
)
/
[
0
]
,
(
Math
.
sign
(
.
y
)
+
[
9
]
)
/
[
5
]
,
-
1
,
(
1
+
[
10
]
)
/
[
14
]
)
;
.
multiplyScalar
(
2
/
.
dot
(
)
)
;
[
2
]
=
.
x
;
[
6
]
=
.
y
;
[
10
]
=
.
z
+
1
;
[
14
]
=
.
w
;
.
projectionMatrixInverse
.
copy
(
.
projectionMatrix
)
.
invert
(
)
;
let
=
1
,
=
1
,
=
-
1
,
=
-
1
;
.
crossVectors
(
X
.
n
,
X
.
u
)
;
for
(
let
=
0
;
<
4
;
++
)
{
.
copy
(
X
.
c
)
.
addScaledVector
(
X
.
u
,
(
&
1
?
1.25
:
-
1.25
)
*
X
.
R
)
.
addScaledVector
(
,
(
&
2
?
1.25
:
-
1.25
)
*
X
.
R
)
.
project
(
)
;
if
(
.
z
>
1
)
{
=
=
-
1
;
=
=
1
;
break
;
}
=
Math
.
min
(
,
.
x
)
;
=
Math
.
max
(
,
.
x
)
;
=
Math
.
min
(
,
.
y
)
;
=
Math
.
max
(
,
.
y
)
;
}
const
=
Math
.
max
(
0
,
Math
.
floor
(
(
*
0.5
+
0.5
)
*
)
)
,
=
Math
.
max
(
0
,
Math
.
floor
(
(
*
0.5
+
0.5
)
*
)
)
;
const
=
Math
.
min
(
,
Math
.
ceil
(
(
*
0.5
+
0.5
)
*
)
)
,
=
Math
.
min
(
,
Math
.
ceil
(
(
*
0.5
+
0.5
)
*
)
)
;
if
(
<=
||
<=
)
return
;
.
scissor
.
set
(
,
,
-
,
-
)
;
.
scissorTest
=
true
;
=
true
;
for
(
const
of
)
{
.
vis
=
.
surf
.
visible
;
.
surf
.
visible
=
false
;
}
const
=
R
.
getRenderTarget
(
)
,
=
R
.
autoClear
,
=
R
.
getClearAlpha
(
)
;
R
.
getClearColor
(
)
;
R
.
autoClear
=
false
;
R
.
setRenderTarget
(
)
;
R
.
setClearColor
(
0x000000
,
1
)
;
R
.
clear
(
true
,
true
,
false
)
;
R
.
render
(
.
scenes
.
opaque
,
)
;
R
.
render
(
.
scenes
.
lines
,
)
;
R
.
setRenderTarget
(
)
;
R
.
setClearColor
(
,
)
;
R
.
autoClear
=
;
for
(
const
of
)
.
surf
.
visible
=
.
vis
;
=
false
;
}
const
=
Array
.
from
(
{
length
:
MAX
}
,
(
_, k
)
=>
(
{
busy
:
false
,
A
:
[
*
2
]
,
B
:
[
*
2
+
1
]
,
AB
:
[
[
*
2
]
,
[
*
2
+
1
]
]
}
)
)
;
const
takeSlot
=
(
)
=>
{
for
(
const
of
)
if
(
!
.
busy
)
{
.
busy
=
true
;
return
;
}
return
null
;
}
;
const
KC
=
{
stream
:
{
color
:
[
new
THREE. Color
(
)
,
new
THREE. Color
(
)
]
}
,
jet
:
{
color
:
[
new
THREE. Color
(
)
,
new
THREE. Color
(
)
]
}
,
splash
:
{
color
:
[
new
THREE. Color
(
)
,
new
THREE. Color
(
)
]
}
,
spark
:
{
color
:
[
new
THREE. Color
(
)
,
new
THREE. Color
(
)
]
}
}
;
let
=
''
,
=
''
;
function
retint
(
)
{
const
=
S
.
params
;
if
(
.
rim
===
&&
.
core
===
)
return
;
=
.
rim
;
=
.
core
;
.
set
(
.
rim
)
;
.
set
(
.
core
)
;
KC
.
stream
.
color
[
0
]
.
copy
(
)
;
KC
.
stream
.
color
[
1
]
.
copy
(
)
.
lerp
(
,
0.8
)
;
KC
.
jet
.
color
[
0
]
.
copy
(
)
;
KC
.
jet
.
color
[
1
]
.
copy
(
)
;
KC
.
splash
.
color
[
0
]
.
copy
(
)
.
lerp
(
.
setRGB
(
1
,
1
,
1
)
,
0.5
)
;
KC
.
splash
.
color
[
1
]
.
copy
(
)
;
KC
.
spark
.
color
[
0
]
.
copy
(
)
;
KC
.
spark
.
color
[
1
]
.
copy
(
)
;
for
(
const
in
KC
)
P
.
setKind
(
` portal. ${ k} `
,
KC
[
]
)
;
}
retint
(
)
;
function
splat
(
x, z, radius, amount, pattern, seed, width = 0
)
{
SPLAT
.
x
=
;
SPLAT
.
z
=
;
SPLAT
.
radius
=
;
SPLAT
.
corruption
=
;
SPLAT
.
glow
=
0
;
SPLAT
.
pattern
=
;
SPLAT
.
seed
=
%
100
;
SPLAT
.
width
=
;
.
ground
.
splat
(
SPLAT
)
;
}
function
shock
(
pos, r1, dist
)
{
SHOCK
.
pos
.
copy
(
)
;
SHOCK
.
radius0
=
0.15
;
SHOCK
.
radius1
=
;
SHOCK
.
duration
=
0.45
;
SHOCK
.
thickness
=
0.5
;
SHOCK
.
distortion
=
;
SHOCK
.
ground
=
false
;
.
shocks
?.
spawn
(
SHOCK
)
;
}
function
place
(
s, c, p
)
{
const
A
=
.
A
,
B
=
.
B
,
R0
=
.
size
;
.
subVectors
(
.
to
,
.
from
)
.
setY
(
0
)
;
if
(
.
lengthSq
(
)
<
1e-4
)
.
set
(
0
,
0
,
-
1
)
;
.
normalize
(
)
;
.
crossVectors
(
,
UP
)
;
const
=
Math
.
hypot
(
.
to
.
x
-
.
from
.
x
,
.
to
.
z
-
.
from
.
z
)
;
A
.
c
.
copy
(
.
from
)
.
addScaledVector
(
,
Math
.
min
(
2.8
,
*
0.35
)
)
.
setY
(
Math
.
max
(
.
from
.
y
,
R0
+
0.45
)
)
;
A
.
n
.
copy
(
)
.
negate
(
)
;
const
=
Math
.
sign
(
.
subVectors
(
.
camera
.
position
,
.
to
)
.
dot
(
)
)
||
1
;
B
.
c
.
copy
(
.
to
)
.
addScaledVector
(
,
2.8
*
.
reach
)
.
addScaledVector
(
,
*
1.5
*
.
reach
)
.
setY
(
R0
+
0.55
)
;
const
=
Math
.
hypot
(
B
.
c
.
x
,
B
.
c
.
z
)
,
=
ARENA
.
radius
-
1.5
-
R0
;
if
(
>
)
{
B
.
c
.
x
*=
/
;
B
.
c
.
z
*=
/
;
}
.
copy
(
.
to
)
.
setY
(
THREE
.
MathUtils
.
clamp
(
.
to
.
y
,
0.9
,
1.4
)
)
;
B
.
n
.
subVectors
(
,
B
.
c
)
.
normalize
(
)
;
for
(
const
of
.
AB
)
{
.
u
.
crossVectors
(
UP
,
.
n
)
.
normalize
(
)
;
.
seed
=
(
.
seed
%
997
)
*
0.37
+
.
i
*
13.1
;
}
}
function
animate
(
q, c, p, lag
)
{
const
T
=
.
age
-
,
Tc
=
.
durations
.
charge
,
Te
=
Tc
+
.
durations
.
impact
;
const
=
smooth
(
0.15
,
0.38
,
T
)
,
=
backOut
(
(
T
-
0.4
)
/
0.55
)
;
const
R0
=
.
size
;
.
R
=
R0
*
;
.
ox
=
0.03
+
0.97
*
Math
.
max
(
0
,
)
;
.
clarity
=
.
clarity
*
smooth
(
0.75
,
1.25
,
T
)
;
.
gain
=
*
(
1.9
-
0.9
*
smooth
(
0.4
,
0.9
,
T
)
)
*
(
0.9
+
0.1
*
Math
.
sin
(
.
age
*
37
+
.
i
)
)
;
.
ripple
=
0
;
.
instab
=
0
;
const
=
.
age
-
Tc
-
;
if
(
>
0
&&
T
<
Te
+
0.1
)
.
ripple
=
.
ripple
*
smooth
(
0
,
0.2
,
)
*
(
1
-
smooth
(
.
durations
.
impact
-
0.45
,
.
durations
.
impact
,
)
)
;
const
=
T
-
Te
;
if
(
>
0
)
{
.
instab
=
smooth
(
0
,
0.5
,
)
;
.
clarity
*=
1
-
smooth
(
0.2
,
0.55
,
)
;
const
=
smooth
(
0.5
,
0.88
,
)
;
.
ox
=
Math
.
max
(
0.03
,
.
ox
*
(
1
-
)
)
;
.
R
*=
1
-
0.25
*
;
.
gain
*=
1
+
1.6
*
.
instab
+
2
*
;
if
(
>=
0.9
)
.
R
=
0
;
}
return
;
}
function
comb
(
q, o, f, half, em
)
{
.
crossVectors
(
.
n
,
.
u
)
;
.
copy
(
.
u
)
.
multiplyScalar
(
Math
.
cos
(
)
*
)
.
addScaledVector
(
,
Math
.
sin
(
)
*
)
;
.
pos
.
copy
(
)
.
add
(
)
;
.
p
.
copy
(
)
.
sub
(
)
;
}
function
pop
(
q, c, p
)
{
.
pos
.
copy
(
.
c
)
;
.
radial
=
7
*
.
size
;
.
burst
(
500
*
.
sparks
+
150
)
;
.
pos
.
copy
(
.
c
)
;
.
size
=
0.6
*
.
size
;
.
burst
(
14
)
;
shock
(
.
c
,
3.2
*
.
size
,
0.07
)
;
splat
(
.
c
.
x
,
.
c
.
z
,
1.4
*
.
size
,
1.6
*
.
corruption
,
'radial'
,
.
seed
+
.
i
)
;
if
(
.
light
)
{
.
light
.
intensity
=
40
;
.
light
.
range
=
9
;
}
}
return
{
onParam
(
k
)
{
if
(
===
'rim'
||
===
'core'
)
retint
(
)
;
}
,
phase
(
c, name
)
{
const
=
S
.
params
,
=
.
data
;
retint
(
)
;
if
(
===
'charge'
)
{
.
s
=
takeSlot
(
)
;
.
hit
=
.
lights
.
acquire
(
)
;
.
attr
=
.
forces
.
acquire
(
)
;
.
push
=
.
forces
.
acquire
(
)
;
.
hitT
=
0
;
.
splatT
=
0
;
.
popped
=
0
;
.
released
=
false
;
if
(
.
hit
)
{
.
hit
.
range
=
6
;
.
hit
.
intensity
=
0
;
.
hit
.
color
.
copy
(
)
;
}
if
(
.
attr
)
{
.
attr
.
type
=
2
;
.
attr
.
p
[
0
]
=
0
;
.
attr
.
p
[
1
]
=
0.4
;
.
attr
.
p
[
2
]
=
0.2
;
.
attr
.
p
[
3
]
=
5
;
}
if
(
.
push
)
{
.
push
.
type
=
5
;
.
push
.
p
[
0
]
=
0
;
.
push
.
p
[
1
]
=
1
;
.
push
.
p
[
2
]
=
4
;
.
push
.
p
[
3
]
=
0
;
}
const
=
.
s
;
if
(
!
)
return
;
place
(
,
,
)
;
for
(
const
of
.
AB
)
{
.
R
=
0
;
.
light
=
.
lights
.
acquire
(
)
;
if
(
.
light
)
{
.
light
.
range
=
7.5
;
.
light
.
intensity
=
0
;
.
light
.
shadow
=
true
;
.
light
.
color
.
copy
(
)
;
}
SIGIL
.
pos
.
set
(
.
c
.
x
,
0.03
,
.
c
.
z
)
;
SIGIL
.
radius
=
1.3
*
.
size
;
SIGIL
.
seed
=
.
seed
|
0
;
SIGIL
.
color
=
;
SIGIL
.
intensity
=
0
;
SIGIL
.
reveal
=
0
;
.
sigil
=
.
sigils
.
acquire
(
SIGIL
)
;
.
orbit
=
.
forces
.
acquire
(
)
;
if
(
.
orbit
)
{
.
orbit
.
type
=
3
;
.
orbit
.
dir
.
copy
(
.
n
)
.
multiplyScalar
(
===
.
A
?
1
:
-
1
)
;
.
orbit
.
p
[
0
]
=
0
;
.
orbit
.
p
[
1
]
=
0.25
;
.
orbit
.
p
[
2
]
=
1.9
*
.
size
;
.
orbit
.
p
[
3
]
=
0
;
}
}
}
else
if
(
===
'release'
)
{
.
arena
.
setFocus
(
,
0.3
)
;
.
rig
.
shake
(
0.18
,
9
)
;
.
flash
(
0.08
)
;
const
=
.
s
;
if
(
!
)
return
;
for
(
const
of
.
AB
)
{
shock
(
.
c
,
3
*
.
size
,
0.06
)
;
splat
(
.
c
.
x
,
.
c
.
z
,
1.5
*
.
size
,
1.2
*
.
corruption
,
'ring'
,
.
seed
+
.
i
,
0.35
)
;
.
impacts
.
add
(
'corruption'
,
.
copy
(
.
c
)
.
setY
(
0.3
)
,
1.8
*
.
size
,
0.7
,
6
,
)
;
.
pos
.
copy
(
.
c
)
;
.
radial
=
4
;
.
burst
(
120
*
.
sparks
)
;
}
}
else
if
(
===
'done'
)
{
.
hit
?.
release
(
)
;
.
attr
?.
release
(
)
;
.
push
?.
release
(
)
;
.
hit
=
.
attr
=
.
push
=
null
;
const
=
.
s
;
if
(
)
{
for
(
const
of
.
AB
)
{
.
light
?.
release
(
)
;
.
sigil
?.
release
(
)
;
.
orbit
?.
release
(
)
;
.
light
=
.
sigil
=
.
orbit
=
null
;
.
R
=
0
;
}
.
busy
=
false
;
}
.
s
=
null
;
.
arena
.
setFocus
(
.
set
(
S
.
hue
)
,
2.5
)
;
}
}
,
update
(
c, dt
)
{
const
=
S
.
params
,
=
.
data
,
=
.
s
;
if
(
!
)
return
;
const
A
=
.
A
,
B
=
.
B
,
Tc
=
.
durations
.
charge
,
Ti
=
.
durations
.
impact
;
const
=
animate
(
A
,
,
,
0
)
,
=
animate
(
B
,
,
,
0.1
)
;
const
=
.
speed
,
=
2.8
*
Math
.
min
(
1
,
A
.
c
.
distanceTo
(
.
from
)
/
2.8
)
;
const
=
/
,
=
.
age
-
Tc
;
if
(
.
phase
===
'charge'
)
.
arena
.
setFocus
(
,
0.5
+
2.5
*
smooth
(
0
,
0.6
,
.
t
)
)
;
for
(
const
of
.
AB
)
{
const
=
.
R
>
0
?
smooth
(
0.3
,
1
,
.
ox
)
*
.
R
/
.
size
:
0
;
if
(
.
light
)
{
.
light
.
pos
.
copy
(
.
c
)
.
addScaledVector
(
.
n
,
0.45
)
;
.
light
.
color
.
copy
(
)
;
.
light
.
intensity
=
Math
.
max
(
.
light
.
intensity
*
Math
.
exp
(
-
*
6
)
,
10
*
.
gain
*
(
.
R
>
0
?
1
:
0
)
)
;
}
if
(
.
sigil
)
{
.
sigil
.
reveal
=
smooth
(
0
,
0.95
,
.
age
)
;
.
sigil
.
intensity
=
2.4
*
(
1
-
smooth
(
0.6
,
1.8
,
.
age
-
Tc
-
Ti
)
)
;
.
sigil
.
rotation
+=
*
(
===
A
?
0.4
:
-
0.4
)
;
if
(
.
sigil
.
intensity
<=
0
)
{
.
sigil
.
release
(
)
;
.
sigil
=
null
;
}
}
if
(
.
orbit
)
{
.
orbit
.
pos
.
copy
(
.
c
)
;
.
orbit
.
p
[
0
]
=
22
*
.
R
*
;
.
orbit
.
p
[
3
]
=
1.4
*
;
}
if
(
>
0.2
&&
.
sparks
>
0
)
{
const
=
.
rand
(
)
*
6.2832
,
=
+
0.4
,
=
(
===
A
?
1
:
-
1
)
;
const
=
.
R
*
1.02
;
.
pos
.
copy
(
.
c
)
.
addScaledVector
(
.
u
,
Math
.
cos
(
)
*
*
.
ox
)
.
addScaledVector
(
.
crossVectors
(
.
n
,
.
u
)
,
Math
.
sin
(
)
*
)
;
.
p
.
copy
(
.
c
)
.
addScaledVector
(
.
u
,
Math
.
cos
(
)
*
*
.
ox
)
.
addScaledVector
(
,
Math
.
sin
(
)
*
)
;
.
subVectors
(
.
p
,
.
pos
)
.
normalize
(
)
;
.
vel
.
copy
(
)
.
multiplyScalar
(
4.5
*
)
.
addScaledVector
(
.
subVectors
(
.
pos
,
.
c
)
.
normalize
(
)
,
0.8
)
;
.
rate
(
700
*
.
sparks
*
(
0.4
+
.
gain
*
0.5
+
.
instab
*
1.5
)
,
)
;
}
}
if
(
.
phase
===
'charge'
)
{
const
=
smooth
(
0.35
,
1
,
.
t
/
Tc
)
;
.
pos
.
copy
(
A
.
c
)
;
.
radius
=
2.2
*
.
size
;
.
rate
(
900
*
,
)
;
.
pos
.
copy
(
B
.
c
)
.
addScaledVector
(
B
.
n
,
-
0.1
)
;
.
p
.
copy
(
B
.
n
)
;
.
vel
.
copy
(
B
.
n
)
.
multiplyScalar
(
1.2
)
;
.
rate
(
500
*
,
)
;
}
const
=
4800
*
.
stream
*
win
(
,
Ti
)
,
=
4800
*
.
stream
*
win
(
-
,
Ti
)
;
if
(
>
0
&&
A
.
R
>
0
)
{
.
copy
(
A
.
c
)
.
addScaledVector
(
A
.
n
,
)
;
for
(
let
=
0
;
<
2
;
++
)
{
comb
(
A
,
,
18
*
+
*
1.5708
,
0.24
*
.
size
,
)
;
.
vel
.
copy
(
A
.
n
)
.
multiplyScalar
(
-
)
;
.
life
=
(
+
0.1
)
/
;
.
rate
(
*
0.5
,
)
;
}
}
if
(
>
0
&&
B
.
R
>
0
)
{
.
copy
(
B
.
c
)
.
addScaledVector
(
B
.
n
,
-
0.08
)
;
for
(
let
=
0
;
<
2
;
++
)
{
comb
(
B
,
,
Math
.
PI
-
18
*
(
-
)
-
*
1.5708
,
0.24
*
.
size
,
)
;
.
vel
.
copy
(
B
.
n
)
.
multiplyScalar
(
)
;
.
rate
(
*
0.5
,
)
;
}
const
=
/
(
4800
*
Math
.
max
(
.
stream
,
1e-3
)
)
;
if
(
.
hit
)
{
.
hit
.
pos
.
copy
(
.
to
)
.
addScaledVector
(
B
.
n
,
-
0.5
)
;
.
hit
.
color
.
copy
(
)
;
.
hit
.
intensity
=
22
*
*
(
0.8
+
0.2
*
Math
.
sin
(
.
age
*
47
)
)
;
}
.
hitT
-=
;
if
(
.
hitT
<=
0
)
{
.
hitT
=
0.2
;
if
(
.
target
>=
0
)
{
const
=
.
dummies
[
.
target
]
;
if
(
.
pos
.
distanceTo
(
.
copy
(
B
.
c
)
.
setY
(
0
)
)
<
5
)
{
.
hit
(
.
copy
(
B
.
n
)
.
setY
(
0
)
.
normalize
(
)
,
0.16
*
.
knockback
*
)
;
.
status
.
corrupt
=
Math
.
max
(
.
status
.
corrupt
,
0.9
)
;
}
}
splat
(
.
to
.
x
,
.
to
.
z
,
0.9
*
.
size
,
0.9
*
.
corruption
*
,
'noise'
,
.
seed
+
.
age
*
31
)
;
.
pos
.
copy
(
.
to
)
.
addScaledVector
(
B
.
n
,
-
0.3
)
;
.
vel
.
copy
(
B
.
n
)
.
multiplyScalar
(
-
2
)
;
.
burst
(
40
*
.
stream
*
)
;
}
}
else
if
(
.
hit
)
.
hit
.
intensity
*=
Math
.
exp
(
-
*
8
)
;
if
(
!
.
released
&&
>
Ti
-
0.3
+
&&
.
target
>=
0
)
{
.
released
=
true
;
const
=
.
dummies
[
.
target
]
;
if
(
.
pos
.
distanceTo
(
.
copy
(
B
.
c
)
.
setY
(
0
)
)
<
5
)
.
hit
(
.
copy
(
B
.
n
)
.
setY
(
0
)
.
normalize
(
)
,
0.7
*
.
knockback
)
;
.
impacts
.
add
(
'corruption'
,
.
copy
(
.
to
)
,
1.6
*
.
size
,
1
,
8
,
)
;
.
rig
.
shake
(
0.22
,
12
)
;
}
const
=
A
.
R
>
0
?
smooth
(
0.3
,
1
,
A
.
ox
)
:
0
,
=
B
.
R
>
0
?
smooth
(
0.3
,
1
,
B
.
ox
)
:
0
;
if
(
.
attr
)
{
.
attr
.
pos
.
copy
(
A
.
c
)
;
.
attr
.
p
[
0
]
=
9
*
;
}
if
(
.
push
)
{
.
push
.
pos
.
copy
(
B
.
c
)
;
.
push
.
dir
.
copy
(
B
.
n
)
;
.
push
.
p
[
0
]
=
7
*
;
.
push
.
p
[
1
]
=
B
.
R
;
.
push
.
p
[
3
]
=
2
*
;
}
if
(
>=
0.9
&&
!
(
.
popped
&
1
)
)
{
.
popped
|=
1
;
pop
(
A
,
,
)
;
.
flash
(
0.1
)
;
.
rig
.
shake
(
0.3
,
14
)
;
}
if
(
>=
0.9
&&
!
(
.
popped
&
2
)
)
{
.
popped
|=
2
;
pop
(
B
,
,
)
;
.
rig
.
shake
(
0.25
,
14
)
;
if
(
!
.
reduced
)
.
rig
.
punch
(
1.5
,
0.08
)
;
}
if
(
.
phase
===
'linger'
)
.
arena
.
setFocus
(
,
0.3
+
2.2
*
smooth
(
0.8
,
1.8
,
.
t
)
)
;
}
,
tick
(
)
{
const
=
S
.
params
;
for
(
const
of
)
{
const
=
.
R
>
0.002
;
.
surf
.
visible
=
.
ring
.
visible
=
;
if
(
!
)
{
.
su
.
uC
.
value
.
w
=
0
;
continue
;
}
.
su
.
uC
.
value
.
set
(
.
c
.
x
,
.
c
.
y
,
.
c
.
z
,
.
R
)
;
.
su
.
uN
.
value
.
set
(
.
n
.
x
,
.
n
.
y
,
.
n
.
z
,
.
ox
)
;
.
su
.
uU
.
value
.
set
(
.
u
.
x
,
.
u
.
y
,
.
u
.
z
,
0
)
;
.
su
.
uLook
.
value
.
set
(
.
clarity
,
.
ripple
,
.
gain
,
.
seed
)
;
.
su
.
uLook2
.
value
.
set
(
0.05
*
.
swirl
*
(
0.6
+
.
instab
)
,
0.35
*
.
swirl
,
0
,
.
instab
)
;
}
}
,
}
;
}
,
}
;